linux/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c

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

#include <linux/mlx5/device.h>
#include <linux/mlx5/mlx5_ifc.h>
#include <linux/xarray.h>
#include <linux/if_vlan.h>

#include "en.h"
#include "lib/aso.h"
#include "lib/crypto.h"
#include "en_accel/macsec.h"

#define MLX5_MACSEC_EPN_SCOPE_MID
#define MLX5E_MACSEC_ASO_CTX_SZ

enum mlx5_macsec_aso_event_arm {};

enum {};

struct mlx5e_macsec_handle {};

enum {};

struct mlx5e_macsec_aso_out {};

struct mlx5e_macsec_aso_in {};

struct mlx5e_macsec_epn_state {};

struct mlx5e_macsec_async_work {};

struct mlx5e_macsec_sa {};

struct mlx5e_macsec_rx_sc;
struct mlx5e_macsec_rx_sc_xarray_element {};

struct mlx5e_macsec_rx_sc {};

struct mlx5e_macsec_umr {};

struct mlx5e_macsec_aso {};

struct mlx5e_macsec_device {};

struct mlx5e_macsec {};

struct mlx5_macsec_obj_attrs {};

struct mlx5_aso_ctrl_param {};

static int mlx5e_macsec_aso_reg_mr(struct mlx5_core_dev *mdev, struct mlx5e_macsec_aso *aso)
{}

static void mlx5e_macsec_aso_dereg_mr(struct mlx5_core_dev *mdev, struct mlx5e_macsec_aso *aso)
{}

static int macsec_set_replay_protection(struct mlx5_macsec_obj_attrs *attrs, void *aso_ctx)
{}

static int mlx5e_macsec_create_object(struct mlx5_core_dev *mdev,
				      struct mlx5_macsec_obj_attrs *attrs,
				      bool is_tx,
				      u32 *macsec_obj_id)
{}

static void mlx5e_macsec_destroy_object(struct mlx5_core_dev *mdev, u32 macsec_obj_id)
{}

static void mlx5e_macsec_cleanup_sa_fs(struct mlx5e_macsec *macsec,
				       struct mlx5e_macsec_sa *sa, bool is_tx,
				       struct net_device *netdev, u32 fs_id)
{}

static void mlx5e_macsec_cleanup_sa(struct mlx5e_macsec *macsec,
				    struct mlx5e_macsec_sa *sa, bool is_tx,
				    struct net_device *netdev, u32 fs_id)
{}

static int mlx5e_macsec_init_sa_fs(struct macsec_context *ctx,
				   struct mlx5e_macsec_sa *sa, bool encrypt,
				   bool is_tx, u32 *fs_id)
{}

static int mlx5e_macsec_init_sa(struct macsec_context *ctx,
				struct mlx5e_macsec_sa *sa,
				bool encrypt, bool is_tx, u32 *fs_id)
{}

static struct mlx5e_macsec_rx_sc *
mlx5e_macsec_get_rx_sc_from_sc_list(const struct list_head *list, sci_t sci)
{}

static int macsec_rx_sa_active_update(struct macsec_context *ctx,
				      struct mlx5e_macsec_sa *rx_sa,
				      bool active, u32 *fs_id)
{}

static bool mlx5e_macsec_secy_features_validate(struct macsec_context *ctx)
{}

static struct mlx5e_macsec_device *
mlx5e_macsec_get_macsec_device_context(const struct mlx5e_macsec *macsec,
				       const struct macsec_context *ctx)
{}

static void update_macsec_epn(struct mlx5e_macsec_sa *sa, const struct macsec_key *key,
			      const pn_t *next_pn_halves, ssci_t ssci)
{}

static int mlx5e_macsec_add_txsa(struct macsec_context *ctx)
{}

static int mlx5e_macsec_upd_txsa(struct macsec_context *ctx)
{}

static int mlx5e_macsec_del_txsa(struct macsec_context *ctx)
{}

static int mlx5e_macsec_add_rxsc(struct macsec_context *ctx)
{}

static int mlx5e_macsec_upd_rxsc(struct macsec_context *ctx)
{}

static void macsec_del_rxsc_ctx(struct mlx5e_macsec *macsec, struct mlx5e_macsec_rx_sc *rx_sc,
				struct net_device *netdev)
{}

static int mlx5e_macsec_del_rxsc(struct macsec_context *ctx)
{}

static int mlx5e_macsec_add_rxsa(struct macsec_context *ctx)
{}

static int mlx5e_macsec_upd_rxsa(struct macsec_context *ctx)
{}

static int mlx5e_macsec_del_rxsa(struct macsec_context *ctx)
{}

static int mlx5e_macsec_add_secy(struct macsec_context *ctx)
{}

static int macsec_upd_secy_hw_address(struct macsec_context *ctx,
				      struct mlx5e_macsec_device *macsec_device)
{}

/* this function is called from 2 macsec ops functions:
 *  macsec_set_mac_address – MAC address was changed, therefore we need to destroy
 *  and create new Tx contexts(macsec object + steering).
 *  macsec_changelink – in this case the tx SC or SecY may be changed, therefore need to
 *  destroy Tx and Rx contexts(macsec object + steering)
 */
static int mlx5e_macsec_upd_secy(struct macsec_context *ctx)
{}

static int mlx5e_macsec_del_secy(struct macsec_context *ctx)
{}

static void macsec_build_accel_attrs(struct mlx5e_macsec_sa *sa,
				     struct mlx5_macsec_obj_attrs *attrs)
{}

static void macsec_aso_build_wqe_ctrl_seg(struct mlx5e_macsec_aso *macsec_aso,
					  struct mlx5_wqe_aso_ctrl_seg *aso_ctrl,
					  struct mlx5_aso_ctrl_param *param)
{}

static int mlx5e_macsec_modify_obj(struct mlx5_core_dev *mdev, struct mlx5_macsec_obj_attrs *attrs,
				   u32 macsec_id)
{}

static void macsec_aso_build_ctrl(struct mlx5e_macsec_aso *aso,
				  struct mlx5_wqe_aso_ctrl_seg *aso_ctrl,
				  struct mlx5e_macsec_aso_in *in)
{}

static int macsec_aso_set_arm_event(struct mlx5_core_dev *mdev, struct mlx5e_macsec *macsec,
				    struct mlx5e_macsec_aso_in *in)
{}

static int macsec_aso_query(struct mlx5_core_dev *mdev, struct mlx5e_macsec *macsec,
			    struct mlx5e_macsec_aso_in *in, struct mlx5e_macsec_aso_out *out)
{}

static struct mlx5e_macsec_sa *get_macsec_tx_sa_from_obj_id(const struct mlx5e_macsec *macsec,
							    const u32 obj_id)
{}

static struct mlx5e_macsec_sa *get_macsec_rx_sa_from_obj_id(const struct mlx5e_macsec *macsec,
							    const u32 obj_id)
{}

static void macsec_epn_update(struct mlx5e_macsec *macsec, struct mlx5_core_dev *mdev,
			      struct mlx5e_macsec_sa *sa, u32 obj_id, u32 mode_param)
{}

static void macsec_async_event(struct work_struct *work)
{}

static int macsec_obj_change_event(struct notifier_block *nb, unsigned long event, void *data)
{}

static int mlx5e_macsec_aso_init(struct mlx5e_macsec_aso *aso, struct mlx5_core_dev *mdev)
{}

static void mlx5e_macsec_aso_cleanup(struct mlx5e_macsec_aso *aso, struct mlx5_core_dev *mdev)
{}

static const struct macsec_ops macsec_offload_ops =;

bool mlx5e_macsec_handle_tx_skb(struct mlx5e_macsec *macsec, struct sk_buff *skb)
{}

void mlx5e_macsec_tx_build_eseg(struct mlx5e_macsec *macsec,
				struct sk_buff *skb,
				struct mlx5_wqe_eth_seg *eseg)
{}

void mlx5e_macsec_offload_handle_rx_skb(struct net_device *netdev,
					struct sk_buff *skb,
					struct mlx5_cqe64 *cqe)
{}

void mlx5e_macsec_build_netdev(struct mlx5e_priv *priv)
{}

int mlx5e_macsec_init(struct mlx5e_priv *priv)
{}

void mlx5e_macsec_cleanup(struct mlx5e_priv *priv)
{}