linux/drivers/net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c

// SPDX-License-Identifier: GPL-2.0
/* Marvell MACSEC hardware offload driver
 *
 * Copyright (C) 2022 Marvell.
 */

#include <crypto/skcipher.h>
#include <linux/rtnetlink.h>
#include <linux/bitfield.h>
#include "otx2_common.h"

#define MCS_TCAM0_MAC_DA_MASK
#define MCS_TCAM0_MAC_SA_MASK
#define MCS_TCAM1_MAC_SA_MASK
#define MCS_TCAM1_ETYPE_MASK

#define MCS_SA_MAP_MEM_SA_USE

#define MCS_RX_SECY_PLCY_RW_MASK
#define MCS_RX_SECY_PLCY_RP
#define MCS_RX_SECY_PLCY_AUTH_ENA
#define MCS_RX_SECY_PLCY_CIP
#define MCS_RX_SECY_PLCY_VAL
#define MCS_RX_SECY_PLCY_ENA

#define MCS_TX_SECY_PLCY_MTU
#define MCS_TX_SECY_PLCY_ST_TCI
#define MCS_TX_SECY_PLCY_ST_OFFSET
#define MCS_TX_SECY_PLCY_INS_MODE
#define MCS_TX_SECY_PLCY_AUTH_ENA
#define MCS_TX_SECY_PLCY_CIP
#define MCS_TX_SECY_PLCY_PROTECT
#define MCS_TX_SECY_PLCY_ENA

#define MCS_GCM_AES_128
#define MCS_GCM_AES_256
#define MCS_GCM_AES_XPN_128
#define MCS_GCM_AES_XPN_256

#define MCS_TCI_ES
#define MCS_TCI_SC
#define MCS_TCI_SCB
#define MCS_TCI_E
#define MCS_TCI_C

#define CN10K_MAX_HASH_LEN
#define CN10K_MAX_SAK_LEN

static int cn10k_ecb_aes_encrypt(struct otx2_nic *pfvf, u8 *sak,
				 u16 sak_len, u8 *hash)
{}

static struct cn10k_mcs_txsc *cn10k_mcs_get_txsc(struct cn10k_mcs_cfg *cfg,
						 struct macsec_secy *secy)
{}

static struct cn10k_mcs_rxsc *cn10k_mcs_get_rxsc(struct cn10k_mcs_cfg *cfg,
						 struct macsec_secy *secy,
						 struct macsec_rx_sc *rx_sc)
{}

static const char *rsrc_name(enum mcs_rsrc_type rsrc_type)
{}

static int cn10k_mcs_alloc_rsrc(struct otx2_nic *pfvf, enum mcs_direction dir,
				enum mcs_rsrc_type type, u16 *rsrc_id)
{}

static void cn10k_mcs_free_rsrc(struct otx2_nic *pfvf, enum mcs_direction dir,
				enum mcs_rsrc_type type, u16 hw_rsrc_id,
				bool all)
{}

static int cn10k_mcs_alloc_txsa(struct otx2_nic *pfvf, u16 *hw_sa_id)
{}

static int cn10k_mcs_alloc_rxsa(struct otx2_nic *pfvf, u16 *hw_sa_id)
{}

static void cn10k_mcs_free_txsa(struct otx2_nic *pfvf, u16 hw_sa_id)
{}

static void cn10k_mcs_free_rxsa(struct otx2_nic *pfvf, u16 hw_sa_id)
{}

static int cn10k_mcs_write_rx_secy(struct otx2_nic *pfvf,
				   struct macsec_secy *secy, u8 hw_secy_id)
{}

static int cn10k_mcs_write_rx_flowid(struct otx2_nic *pfvf,
				     struct cn10k_mcs_rxsc *rxsc, u8 hw_secy_id)
{}

static int cn10k_mcs_write_sc_cam(struct otx2_nic *pfvf,
				  struct cn10k_mcs_rxsc *rxsc, u8 hw_secy_id)
{}

static int cn10k_mcs_write_keys(struct otx2_nic *pfvf,
				struct macsec_secy *secy,
				struct mcs_sa_plcy_write_req *req,
				u8 *sak, u8 *salt, ssci_t ssci)
{}

static int cn10k_mcs_write_rx_sa_plcy(struct otx2_nic *pfvf,
				      struct macsec_secy *secy,
				      struct cn10k_mcs_rxsc *rxsc,
				      u8 assoc_num, bool sa_in_use)
{}

static int cn10k_mcs_write_rx_sa_pn(struct otx2_nic *pfvf,
				    struct cn10k_mcs_rxsc *rxsc,
				    u8 assoc_num, u64 next_pn)
{}

static int cn10k_mcs_write_tx_secy(struct otx2_nic *pfvf,
				   struct macsec_secy *secy,
				   struct cn10k_mcs_txsc *txsc)
{}

static int cn10k_mcs_write_tx_flowid(struct otx2_nic *pfvf,
				     struct macsec_secy *secy,
				     struct cn10k_mcs_txsc *txsc)
{}

static int cn10k_mcs_link_tx_sa2sc(struct otx2_nic *pfvf,
				   struct macsec_secy *secy,
				   struct cn10k_mcs_txsc *txsc,
				   u8 sa_num, bool sa_active)
{}

static int cn10k_mcs_write_tx_sa_plcy(struct otx2_nic *pfvf,
				      struct macsec_secy *secy,
				      struct cn10k_mcs_txsc *txsc,
				      u8 assoc_num)
{}

static int cn10k_write_tx_sa_pn(struct otx2_nic *pfvf,
				struct cn10k_mcs_txsc *txsc,
				u8 assoc_num, u64 next_pn)
{}

static int cn10k_mcs_ena_dis_flowid(struct otx2_nic *pfvf, u16 hw_flow_id,
				    bool enable, enum mcs_direction dir)
{}

static int cn10k_mcs_sa_stats(struct otx2_nic *pfvf, u8 hw_sa_id,
			      struct mcs_sa_stats *rsp_p,
			      enum mcs_direction dir, bool clear)
{}

static int cn10k_mcs_sc_stats(struct otx2_nic *pfvf, u8 hw_sc_id,
			      struct mcs_sc_stats *rsp_p,
			      enum mcs_direction dir, bool clear)
{}

static int cn10k_mcs_secy_stats(struct otx2_nic *pfvf, u8 hw_secy_id,
				struct mcs_secy_stats *rsp_p,
				enum mcs_direction dir, bool clear)
{}

static struct cn10k_mcs_txsc *cn10k_mcs_create_txsc(struct otx2_nic *pfvf)
{}

/* Free Tx SC and its SAs(if any) resources to AF
 */
static void cn10k_mcs_delete_txsc(struct otx2_nic *pfvf,
				  struct cn10k_mcs_txsc *txsc)
{}

static struct cn10k_mcs_rxsc *cn10k_mcs_create_rxsc(struct otx2_nic *pfvf)
{}

/* Free Rx SC and its SAs(if any) resources to AF
 */
static void cn10k_mcs_delete_rxsc(struct otx2_nic *pfvf,
				  struct cn10k_mcs_rxsc *rxsc)
{}

static int cn10k_mcs_secy_tx_cfg(struct otx2_nic *pfvf, struct macsec_secy *secy,
				 struct cn10k_mcs_txsc *txsc,
				 struct macsec_tx_sa *sw_tx_sa, u8 sa_num)
{}

static int cn10k_mcs_secy_rx_cfg(struct otx2_nic *pfvf,
				 struct macsec_secy *secy, u8 hw_secy_id)
{}

static int cn10k_mcs_disable_rxscs(struct otx2_nic *pfvf,
				   struct macsec_secy *secy,
				   bool delete)
{}

static void cn10k_mcs_sync_stats(struct otx2_nic *pfvf, struct macsec_secy *secy,
				 struct cn10k_mcs_txsc *txsc)
{}

static int cn10k_mdo_open(struct macsec_context *ctx)
{}

static int cn10k_mdo_stop(struct macsec_context *ctx)
{}

static int cn10k_mdo_add_secy(struct macsec_context *ctx)
{}

static int cn10k_mdo_upd_secy(struct macsec_context *ctx)
{}

static int cn10k_mdo_del_secy(struct macsec_context *ctx)
{}

static int cn10k_mdo_add_txsa(struct macsec_context *ctx)
{}

static int cn10k_mdo_upd_txsa(struct macsec_context *ctx)
{}

static int cn10k_mdo_del_txsa(struct macsec_context *ctx)
{}

static int cn10k_mdo_add_rxsc(struct macsec_context *ctx)
{}

static int cn10k_mdo_upd_rxsc(struct macsec_context *ctx)
{}

static int cn10k_mdo_del_rxsc(struct macsec_context *ctx)
{}

static int cn10k_mdo_add_rxsa(struct macsec_context *ctx)
{}

static int cn10k_mdo_upd_rxsa(struct macsec_context *ctx)
{}

static int cn10k_mdo_del_rxsa(struct macsec_context *ctx)
{}

static int cn10k_mdo_get_dev_stats(struct macsec_context *ctx)
{}

static int cn10k_mdo_get_tx_sc_stats(struct macsec_context *ctx)
{}

static int cn10k_mdo_get_tx_sa_stats(struct macsec_context *ctx)
{}

static int cn10k_mdo_get_rx_sc_stats(struct macsec_context *ctx)
{}

static int cn10k_mdo_get_rx_sa_stats(struct macsec_context *ctx)
{}

static const struct macsec_ops cn10k_mcs_ops =;

void cn10k_handle_mcs_event(struct otx2_nic *pfvf, struct mcs_intr_info *event)
{}

int cn10k_mcs_init(struct otx2_nic *pfvf)
{}

void cn10k_mcs_free(struct otx2_nic *pfvf)
{}