Skip to content

Commit

Permalink
octeontx2-pf: mcs: Support VLAN in clear text
Browse files Browse the repository at this point in the history
Detect whether macsec secy is running on top of VLAN
which implies transmitting VLAN tag in clear text before
macsec SecTag. In this case configure hardware to insert
SecTag after VLAN tag.

Signed-off-by: Subbaraya Sundeep <sbhatta@marvell.com>
Signed-off-by: Sunil Kovvuri Goutham <sgoutham@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Subbaraya Sundeep authored and David S. Miller committed May 17, 2023
1 parent fa0583c commit 030d71f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
8 changes: 6 additions & 2 deletions drivers/net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c
Original file line number Diff line number Diff line change
Expand Up @@ -426,13 +426,16 @@ static int cn10k_mcs_write_tx_secy(struct otx2_nic *pfvf,
struct mcs_secy_plcy_write_req *req;
struct mbox *mbox = &pfvf->mbox;
struct macsec_tx_sc *sw_tx_sc;
/* Insert SecTag after 12 bytes (DA+SA)*/
u8 tag_offset = 12;
u8 sectag_tci = 0;
u8 tag_offset;
u64 policy;
u8 cipher;
int ret;

/* Insert SecTag after 12 bytes (DA+SA) or 16 bytes
* if VLAN tag needs to be sent in clear text.
*/
tag_offset = txsc->vlan_dev ? 16 : 12;
sw_tx_sc = &secy->tx_sc;

mutex_lock(&mbox->lock);
Expand Down Expand Up @@ -1163,6 +1166,7 @@ static int cn10k_mdo_add_secy(struct macsec_context *ctx)
txsc->encoding_sa = secy->tx_sc.encoding_sa;
txsc->last_validate_frames = secy->validate_frames;
txsc->last_replay_protect = secy->replay_protect;
txsc->vlan_dev = is_vlan_dev(ctx->netdev);

list_add(&txsc->entry, &cfg->txsc_list);

Expand Down
1 change: 1 addition & 0 deletions drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,7 @@ struct cn10k_mcs_txsc {
u8 encoding_sa;
u8 salt[CN10K_MCS_SA_PER_SC][MACSEC_SALT_LEN];
ssci_t ssci[CN10K_MCS_SA_PER_SC];
bool vlan_dev; /* macsec running on VLAN ? */
};

struct cn10k_mcs_rxsc {
Expand Down

0 comments on commit 030d71f

Please sign in to comment.