From: Ankur Dwivedi <adwivedi@marvell.com>
To: <dev@dpdk.org>
Cc: <gakhil@marvell.com>, <vattunuru@marvell.com>,
<jerinj@marvell.com>, "Ankur Dwivedi" <adwivedi@marvell.com>
Subject: [PATCH v1 2/2] net/cnxk: update sa to port map
Date: Wed, 23 Aug 2023 11:20:00 +0530 [thread overview]
Message-ID: <20230823055000.2692083-3-adwivedi@marvell.com> (raw)
In-Reply-To: <20230823055000.2692083-1-adwivedi@marvell.com>
The sa to port map is updated when the sa is created. In this patch the
portid field is also added to macsec event callback function.
Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
---
drivers/net/cnxk/cnxk_ethdev_mcs.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/drivers/net/cnxk/cnxk_ethdev_mcs.c b/drivers/net/cnxk/cnxk_ethdev_mcs.c
index 5264774394..06ef7c98f3 100644
--- a/drivers/net/cnxk/cnxk_ethdev_mcs.c
+++ b/drivers/net/cnxk/cnxk_ethdev_mcs.c
@@ -113,6 +113,8 @@ cnxk_eth_macsec_sa_create(void *device, struct rte_security_macsec_sa *conf)
return -EINVAL;
}
+ roc_mcs_sa_port_map_update(mcs_dev->mdev, sa_id, mcs_dev->port_id);
+
return sa_id;
}
@@ -586,9 +588,11 @@ cnxk_eth_macsec_session_stats_get(struct cnxk_eth_dev *dev, struct cnxk_macsec_s
}
static int
-cnxk_mcs_event_cb(void *userdata, struct roc_mcs_event_desc *desc, void *cb_arg)
+cnxk_mcs_event_cb(void *userdata, struct roc_mcs_event_desc *desc, void *cb_arg,
+ uint8_t port_id)
{
struct rte_eth_event_macsec_desc d = {0};
+ struct cnxk_mcs_dev *mcs_dev = userdata;
d.metadata = (uint64_t)userdata;
@@ -617,15 +621,23 @@ cnxk_mcs_event_cb(void *userdata, struct roc_mcs_event_desc *desc, void *cb_arg)
break;
case ROC_MCS_EVENT_RX_SA_PN_HARD_EXP:
d.type = RTE_ETH_EVENT_MACSEC_RX_SA_PN_HARD_EXP;
+ if (mcs_dev->port_id != port_id)
+ return 0;
break;
case ROC_MCS_EVENT_RX_SA_PN_SOFT_EXP:
d.type = RTE_ETH_EVENT_MACSEC_RX_SA_PN_SOFT_EXP;
+ if (mcs_dev->port_id != port_id)
+ return 0;
break;
case ROC_MCS_EVENT_TX_SA_PN_HARD_EXP:
d.type = RTE_ETH_EVENT_MACSEC_TX_SA_PN_HARD_EXP;
+ if (mcs_dev->port_id != port_id)
+ return 0;
break;
case ROC_MCS_EVENT_TX_SA_PN_SOFT_EXP:
d.type = RTE_ETH_EVENT_MACSEC_TX_SA_PN_SOFT_EXP;
+ if (mcs_dev->port_id != port_id)
+ return 0;
break;
default:
plt_err("Unknown MACsec event type: %d", desc->type);
--
2.25.1
next prev parent reply other threads:[~2023-08-23 5:50 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-23 5:49 [PATCH v1 0/2] support of MACsec PN threshold events on multiple ports Ankur Dwivedi
2023-08-23 5:49 ` [PATCH v1 1/2] common/cnxk: add sa to port mapping Ankur Dwivedi
2023-08-24 12:20 ` Jerin Jacob
2023-08-23 5:50 ` Ankur Dwivedi [this message]
2023-08-25 10:36 ` [PATCH v2 0/1] support for MACsec PN threshold events on multiple ports Ankur Dwivedi
2023-08-25 10:36 ` [PATCH v2 1/1] net/cnxk: support " Ankur Dwivedi
2023-08-28 13:08 ` Jerin Jacob
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230823055000.2692083-3-adwivedi@marvell.com \
--to=adwivedi@marvell.com \
--cc=dev@dpdk.org \
--cc=gakhil@marvell.com \
--cc=jerinj@marvell.com \
--cc=vattunuru@marvell.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).