linux/drivers/net/ethernet/mellanox/mlx5/core/lib/macsec_fs.c

// SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB
/* Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. */

#include <net/macsec.h>
#include <linux/mlx5/qp.h>
#include <linux/if_vlan.h>
#include <linux/mlx5/fs_helpers.h>
#include <linux/mlx5/macsec.h>
#include "fs_core.h"
#include "lib/macsec_fs.h"
#include "mlx5_core.h"

/* MACsec TX flow steering */
#define CRYPTO_NUM_MAXSEC_FTE
#define CRYPTO_TABLE_DEFAULT_RULE_GROUP_SIZE

#define TX_CRYPTO_TABLE_LEVEL
#define TX_CRYPTO_TABLE_NUM_GROUPS
#define TX_CRYPTO_TABLE_MKE_GROUP_SIZE
#define TX_CRYPTO_TABLE_SA_GROUP_SIZE
#define TX_CHECK_TABLE_LEVEL
#define TX_CHECK_TABLE_NUM_FTE
#define RX_CRYPTO_TABLE_LEVEL
#define RX_CHECK_TABLE_LEVEL
#define RX_ROCE_TABLE_LEVEL
#define RX_CHECK_TABLE_NUM_FTE
#define RX_ROCE_TABLE_NUM_FTE
#define RX_CRYPTO_TABLE_NUM_GROUPS
#define RX_CRYPTO_TABLE_SA_RULE_WITH_SCI_GROUP_SIZE
#define RX_CRYPTO_TABLE_SA_RULE_WITHOUT_SCI_GROUP_SIZE
#define RX_NUM_OF_RULES_PER_SA

#define RDMA_RX_ROCE_IP_TABLE_LEVEL
#define RDMA_RX_ROCE_MACSEC_OP_TABLE_LEVEL

#define MLX5_MACSEC_TAG_LEN
#define MLX5_MACSEC_SECTAG_TCI_AN_FIELD_BITMASK
#define MLX5_MACSEC_SECTAG_TCI_AN_FIELD_OFFSET
#define MLX5_MACSEC_SECTAG_TCI_SC_FIELD_OFFSET
#define MLX5_MACSEC_SECTAG_TCI_SC_FIELD_BIT
#define MLX5_SECTAG_HEADER_SIZE_WITHOUT_SCI
#define MLX5_SECTAG_HEADER_SIZE_WITH_SCI

/* MACsec RX flow steering */
#define MLX5_ETH_WQE_FT_META_MACSEC_MASK

/* MACsec fs_id handling for steering */
#define macsec_fs_set_tx_fs_id(fs_id)
#define macsec_fs_set_rx_fs_id(fs_id)

struct mlx5_sectag_header {}  __packed;

struct mlx5_roce_macsec_tx_rule {};

struct mlx5_macsec_tx_rule {};

struct mlx5_macsec_flow_table {};

struct mlx5_macsec_tables {};

struct mlx5_fs_id {};

struct mlx5_macsec_device {};

struct mlx5_macsec_tx {};

struct mlx5_roce_macsec_rx_rule {};

struct mlx5_macsec_rx_rule {};

struct mlx5_macsec_miss {};

struct mlx5_macsec_rx_roce {};

struct mlx5_macsec_rx {};

mlx5_macsec_rule;

static const struct rhashtable_params rhash_sci =;

static const struct rhashtable_params rhash_fs_id =;

struct mlx5_macsec_fs {};

static void macsec_fs_destroy_groups(struct mlx5_macsec_flow_table *ft)
{}

static void macsec_fs_destroy_flow_table(struct mlx5_macsec_flow_table *ft)
{}

static void macsec_fs_tx_destroy(struct mlx5_macsec_fs *macsec_fs)
{}

static int macsec_fs_tx_create_crypto_table_groups(struct mlx5_macsec_flow_table *ft)
{}

static struct mlx5_flow_table
	*macsec_fs_auto_group_table_create(struct mlx5_flow_namespace *ns, int flags,
					   int level, int max_fte)
{}

enum {};

static int macsec_fs_tx_roce_create(struct mlx5_macsec_fs *macsec_fs)
{}

static int macsec_fs_tx_create(struct mlx5_macsec_fs *macsec_fs)
{}

static int macsec_fs_tx_ft_get(struct mlx5_macsec_fs *macsec_fs)
{}

static void macsec_fs_tx_ft_put(struct mlx5_macsec_fs *macsec_fs)
{}

static int macsec_fs_tx_setup_fte(struct mlx5_macsec_fs *macsec_fs,
				  struct mlx5_flow_spec *spec,
				  struct mlx5_flow_act *flow_act,
				  u32 macsec_obj_id,
				  u32 *fs_id)
{}

static void macsec_fs_tx_create_sectag_header(const struct macsec_context *ctx,
					      char *reformatbf,
					      size_t *reformat_size)
{}

static bool macsec_fs_is_macsec_device_empty(struct mlx5_macsec_device *macsec_device)
{}

static void macsec_fs_id_del(struct list_head *macsec_devices_list, u32 fs_id,
			     void *macdev, struct rhashtable *hash_table, bool is_tx)
{}

static int macsec_fs_id_add(struct list_head *macsec_devices_list, u32 fs_id,
			    void *macdev, struct rhashtable *hash_table, sci_t sci,
			    bool is_tx)
{}

static void macsec_fs_tx_del_rule(struct mlx5_macsec_fs *macsec_fs,
				  struct mlx5_macsec_tx_rule *tx_rule,
				  void *macdev)
{}

#define MLX5_REFORMAT_PARAM_ADD_MACSEC_OFFSET_4_BYTES

static union mlx5_macsec_rule *
macsec_fs_tx_add_rule(struct mlx5_macsec_fs *macsec_fs,
		      const struct macsec_context *macsec_ctx,
		      struct mlx5_macsec_rule_attrs *attrs, u32 *fs_id)
{}

static void macsec_fs_tx_cleanup(struct mlx5_macsec_fs *macsec_fs)
{}

static int macsec_fs_tx_init(struct mlx5_macsec_fs *macsec_fs)
{}

static void macsec_fs_rx_roce_miss_destroy(struct mlx5_macsec_miss *miss)
{}

static void macsec_fs_rdma_rx_destroy(struct mlx5_macsec_rx_roce *roce, struct mlx5_core_dev *mdev)
{}

static void macsec_fs_rx_destroy(struct mlx5_macsec_fs *macsec_fs)
{}

static int macsec_fs_rx_create_crypto_table_groups(struct mlx5_macsec_flow_table *ft)
{}

static int macsec_fs_rx_create_check_decap_rule(struct mlx5_macsec_fs *macsec_fs,
						struct mlx5_flow_destination *dest,
						struct mlx5_flow_act *flow_act,
						struct mlx5_flow_spec *spec,
						int reformat_param_size)
{}

static int macsec_fs_rx_roce_miss_create(struct mlx5_core_dev *mdev,
					 struct mlx5_macsec_rx_roce *roce)
{}

#define MLX5_RX_ROCE_GROUP_SIZE

static int macsec_fs_rx_roce_jump_to_rdma_groups_create(struct mlx5_core_dev *mdev,
							struct mlx5_macsec_rx_roce *roce)
{}

static int macsec_fs_rx_roce_jump_to_rdma_rules_create(struct mlx5_macsec_fs *macsec_fs,
						       struct mlx5_macsec_rx_roce *roce)
{}

static int macsec_fs_rx_roce_jump_to_rdma_create(struct mlx5_macsec_fs *macsec_fs,
						 struct mlx5_macsec_rx_roce *roce)
{}

static int macsec_fs_rx_roce_create(struct mlx5_macsec_fs *macsec_fs)
{}

static int macsec_fs_rx_create(struct mlx5_macsec_fs *macsec_fs)
{}

static int macsec_fs_rx_ft_get(struct mlx5_macsec_fs *macsec_fs)
{}

static void macsec_fs_rx_ft_put(struct mlx5_macsec_fs *macsec_fs)
{}

static void macsec_fs_rx_del_rule(struct mlx5_macsec_fs *macsec_fs,
				  struct mlx5_macsec_rx_rule *rx_rule,
				  void *macdev, u32 fs_id)
{}

static void macsec_fs_rx_setup_fte(struct mlx5_flow_spec *spec,
				   struct mlx5_flow_act *flow_act,
				   struct mlx5_macsec_rule_attrs *attrs,
				   bool sci_present)
{}

static union mlx5_macsec_rule *
macsec_fs_rx_add_rule(struct mlx5_macsec_fs *macsec_fs,
		      const struct macsec_context *macsec_ctx,
		      struct mlx5_macsec_rule_attrs *attrs,
		      u32 fs_id)
{}

static int macsec_fs_rx_init(struct mlx5_macsec_fs *macsec_fs)
{}

static void macsec_fs_rx_cleanup(struct mlx5_macsec_fs *macsec_fs)
{}

static void set_ipaddr_spec_v4(struct sockaddr_in *in, struct mlx5_flow_spec *spec, bool is_dst_ip)
{}

static void set_ipaddr_spec_v6(struct sockaddr_in6 *in6, struct mlx5_flow_spec *spec,
			       bool is_dst_ip)
{}

static void set_ipaddr_spec(const struct sockaddr *addr,
			    struct mlx5_flow_spec *spec, bool is_dst_ip)
{}

static void macsec_fs_del_roce_rule_rx(struct mlx5_roce_macsec_rx_rule *rx_rule)
{}

static void macsec_fs_del_roce_rules_rx(struct mlx5_macsec_fs *macsec_fs, u32 fs_id,
					struct list_head *rx_rules_list)
{}

static void macsec_fs_del_roce_rule_tx(struct mlx5_core_dev *mdev,
				       struct mlx5_roce_macsec_tx_rule *tx_rule)
{}

static void macsec_fs_del_roce_rules_tx(struct mlx5_macsec_fs *macsec_fs, u32 fs_id,
					struct list_head *tx_rules_list)
{}

void mlx5_macsec_fs_get_stats_fill(struct mlx5_macsec_fs *macsec_fs, void *macsec_stats)
{}

struct mlx5_macsec_stats *mlx5_macsec_fs_get_stats(struct mlx5_macsec_fs *macsec_fs)
{}

u32 mlx5_macsec_fs_get_fs_id_from_hashtable(struct mlx5_macsec_fs *macsec_fs, sci_t *sci)
{}

union mlx5_macsec_rule *
mlx5_macsec_fs_add_rule(struct mlx5_macsec_fs *macsec_fs,
			const struct macsec_context *macsec_ctx,
			struct mlx5_macsec_rule_attrs *attrs,
			u32 *sa_fs_id)
{}

void mlx5_macsec_fs_del_rule(struct mlx5_macsec_fs *macsec_fs,
			     union mlx5_macsec_rule *macsec_rule,
			     int action, void *macdev, u32 sa_fs_id)
{}

static int mlx5_macsec_fs_add_roce_rule_rx(struct mlx5_macsec_fs *macsec_fs, u32 fs_id, u16 gid_idx,
					   const struct sockaddr *addr,
					   struct list_head *rx_rules_list)
{}

static int mlx5_macsec_fs_add_roce_rule_tx(struct mlx5_macsec_fs *macsec_fs, u32 fs_id, u16 gid_idx,
					   const struct sockaddr *addr,
					   struct list_head *tx_rules_list)
{}

void mlx5_macsec_del_roce_rule(u16 gid_idx, struct mlx5_macsec_fs *macsec_fs,
			       struct list_head *tx_rules_list, struct list_head *rx_rules_list)
{}
EXPORT_SYMBOL_GPL();

int mlx5_macsec_add_roce_rule(void *macdev, const struct sockaddr *addr, u16 gid_idx,
			      struct list_head *tx_rules_list, struct list_head *rx_rules_list,
			      struct mlx5_macsec_fs *macsec_fs)
{}
EXPORT_SYMBOL_GPL();

void mlx5_macsec_add_roce_sa_rules(u32 fs_id, const struct sockaddr *addr, u16 gid_idx,
				   struct list_head *tx_rules_list,
				   struct list_head *rx_rules_list,
				   struct mlx5_macsec_fs *macsec_fs, bool is_tx)
{}
EXPORT_SYMBOL_GPL();

void mlx5_macsec_del_roce_sa_rules(u32 fs_id, struct mlx5_macsec_fs *macsec_fs,
				   struct list_head *tx_rules_list,
				   struct list_head *rx_rules_list, bool is_tx)
{}
EXPORT_SYMBOL_GPL();

void mlx5_macsec_fs_cleanup(struct mlx5_macsec_fs *macsec_fs)
{}

struct mlx5_macsec_fs *
mlx5_macsec_fs_init(struct mlx5_core_dev *mdev)
{}