Skip to content

Commit 7cb7b6d

Browse files
Subbaraya Sundeepsmb49
authored andcommitted
octeontx2-pf: mcs: Match macsec ethertype along with DMAC
BugLink: https://bugs.launchpad.net/bugs/2028580 [ Upstream commit 57d00d4 ] On CN10KB silicon a single hardware macsec block is present and offloads macsec operations for all the ethernet LMACs. TCAM match with macsec ethertype 0x88e5 alone at RX side is not sufficient to distinguish all the macsec interfaces created on top of netdevs. Hence append the DMAC of the macsec interface too. Otherwise the first created macsec interface only receives all the macsec traffic. Fixes: c54ffc7 ("octeontx2-pf: mcs: Introduce MACSEC hardware offloading") Signed-off-by: Subbaraya Sundeep <sbhatta@marvell.com> Signed-off-by: Sunil Goutham <sgoutham@marvell.com> Signed-off-by: Geetha sowjanya <gakula@marvell.com> Reviewed-by: Leon Romanovsky <leonro@nvidia.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Kamal Mostafa <kamal@canonical.com> Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
1 parent c65c81f commit 7cb7b6d

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <net/macsec.h>
1010
#include "otx2_common.h"
1111

12+
#define MCS_TCAM0_MAC_DA_MASK GENMASK_ULL(47, 0)
1213
#define MCS_TCAM0_MAC_SA_MASK GENMASK_ULL(63, 48)
1314
#define MCS_TCAM1_MAC_SA_MASK GENMASK_ULL(31, 0)
1415
#define MCS_TCAM1_ETYPE_MASK GENMASK_ULL(47, 32)
@@ -237,8 +238,10 @@ static int cn10k_mcs_write_rx_flowid(struct otx2_nic *pfvf,
237238
struct cn10k_mcs_rxsc *rxsc, u8 hw_secy_id)
238239
{
239240
struct macsec_rx_sc *sw_rx_sc = rxsc->sw_rxsc;
241+
struct macsec_secy *secy = rxsc->sw_secy;
240242
struct mcs_flowid_entry_write_req *req;
241243
struct mbox *mbox = &pfvf->mbox;
244+
u64 mac_da;
242245
int ret;
243246

244247
mutex_lock(&mbox->lock);
@@ -249,11 +252,16 @@ static int cn10k_mcs_write_rx_flowid(struct otx2_nic *pfvf,
249252
goto fail;
250253
}
251254

255+
mac_da = ether_addr_to_u64(secy->netdev->dev_addr);
256+
257+
req->data[0] = FIELD_PREP(MCS_TCAM0_MAC_DA_MASK, mac_da);
258+
req->mask[0] = ~0ULL;
259+
req->mask[0] = ~MCS_TCAM0_MAC_DA_MASK;
260+
252261
req->data[1] = FIELD_PREP(MCS_TCAM1_ETYPE_MASK, ETH_P_MACSEC);
253262
req->mask[1] = ~0ULL;
254263
req->mask[1] &= ~MCS_TCAM1_ETYPE_MASK;
255264

256-
req->mask[0] = ~0ULL;
257265
req->mask[2] = ~0ULL;
258266
req->mask[3] = ~0ULL;
259267

0 commit comments

Comments
 (0)