* [PATCH v1 0/2] support of MACsec PN threshold events on multiple ports @ 2023-08-23 5:49 Ankur Dwivedi 2023-08-23 5:49 ` [PATCH v1 1/2] common/cnxk: add sa to port mapping Ankur Dwivedi ` (2 more replies) 0 siblings, 3 replies; 7+ messages in thread From: Ankur Dwivedi @ 2023-08-23 5:49 UTC (permalink / raw) To: dev; +Cc: gakhil, vattunuru, jerinj, Ankur Dwivedi This patch series adds support for packet number threshold events to be received on the respective ethernet port. For this a sa to port mapping is created during sa creation. When the pn threshold event is received then the check for port id is made to receive the event on the correct port. Ankur Dwivedi (2): common/cnxk: add sa to port mapping net/cnxk: update sa to port map drivers/common/cnxk/roc_mcs.c | 22 +++++++++++++++++++--- drivers/common/cnxk/roc_mcs.h | 8 ++++++-- drivers/common/cnxk/roc_mcs_sec_cfg.c | 6 ++++++ drivers/common/cnxk/version.map | 1 + drivers/net/cnxk/cnxk_ethdev_mcs.c | 14 +++++++++++++- 5 files changed, 45 insertions(+), 6 deletions(-) -- 2.25.1 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v1 1/2] common/cnxk: add sa to port mapping 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 ` Ankur Dwivedi 2023-08-24 12:20 ` Jerin Jacob 2023-08-23 5:50 ` [PATCH v1 2/2] net/cnxk: update sa to port map Ankur Dwivedi 2023-08-25 10:36 ` [PATCH v2 0/1] support for MACsec PN threshold events on multiple ports Ankur Dwivedi 2 siblings, 1 reply; 7+ messages in thread From: Ankur Dwivedi @ 2023-08-23 5:49 UTC (permalink / raw) To: dev; +Cc: gakhil, vattunuru, jerinj, Ankur Dwivedi Adds sa to port mapping in roc mcs. This helps to propagate the tx and rx pn threshold events to the correct ethernet device. Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com> --- drivers/common/cnxk/roc_mcs.c | 22 +++++++++++++++++++--- drivers/common/cnxk/roc_mcs.h | 8 ++++++-- drivers/common/cnxk/roc_mcs_sec_cfg.c | 6 ++++++ drivers/common/cnxk/version.map | 1 + 4 files changed, 32 insertions(+), 5 deletions(-) diff --git a/drivers/common/cnxk/roc_mcs.c b/drivers/common/cnxk/roc_mcs.c index 1f269ddae5..f823f7f478 100644 --- a/drivers/common/cnxk/roc_mcs.c +++ b/drivers/common/cnxk/roc_mcs.c @@ -10,6 +10,7 @@ struct mcs_event_cb { enum roc_mcs_event_type event; roc_mcs_dev_cb_fn cb_fn; void *cb_arg; + void *userdata; void *ret_param; uint32_t active; }; @@ -320,12 +321,16 @@ roc_mcs_intr_configure(struct roc_mcs *mcs, struct roc_mcs_intr_cfg *config) { struct mcs_intr_cfg *req; struct msg_rsp *rsp; + int rc; if (config == NULL) return -EINVAL; MCS_SUPPORT_CHECK; + if (mcs->intr_cfg_once) + return 0; + req = mbox_alloc_msg_mcs_intr_cfg(mcs->mbox); if (req == NULL) return -ENOMEM; @@ -333,7 +338,11 @@ roc_mcs_intr_configure(struct roc_mcs *mcs, struct roc_mcs_intr_cfg *config) req->intr_mask = config->intr_mask; req->mcs_id = mcs->idx; - return mbox_process_msg(mcs->mbox, (void *)&rsp); + rc = mbox_process_msg(mcs->mbox, (void *)&rsp); + if (rc == 0) + mcs->intr_cfg_once = true; + + return rc; } int @@ -630,7 +639,7 @@ roc_mcs_event_cb_register(struct roc_mcs *mcs, enum roc_mcs_event_type event, cb->cb_fn = cb_fn; cb->cb_arg = cb_arg; cb->event = event; - mcs->userdata = userdata; + cb->userdata = userdata; TAILQ_INSERT_TAIL(cb_list, cb, next); } @@ -678,7 +687,8 @@ mcs_event_cb_process(struct roc_mcs *mcs, struct roc_mcs_event_desc *desc) cb->active = 1; mcs_cb.ret_param = desc; - rc = mcs_cb.cb_fn(mcs->userdata, mcs_cb.ret_param, mcs_cb.cb_arg); + rc = mcs_cb.cb_fn(mcs_cb.userdata, mcs_cb.ret_param, mcs_cb.cb_arg, + mcs->sa_port_map[desc->metadata.sa_idx]); cb->active = 0; } @@ -788,6 +798,10 @@ mcs_alloc_rsrc_bmap(struct roc_mcs *mcs) } } + mcs->sa_port_map = plt_zmalloc(sizeof(uint8_t) * hw->sa_entries, 0); + if (mcs->sa_port_map == NULL) + goto exit; + return rc; exit: @@ -865,6 +879,8 @@ roc_mcs_dev_fini(struct roc_mcs *mcs) plt_free(priv->port_rsrc); + plt_free(mcs->sa_port_map); + roc_idev_mcs_free(mcs); plt_free(mcs); diff --git a/drivers/common/cnxk/roc_mcs.h b/drivers/common/cnxk/roc_mcs.h index afac6c92e2..1b554f79c9 100644 --- a/drivers/common/cnxk/roc_mcs.h +++ b/drivers/common/cnxk/roc_mcs.h @@ -477,15 +477,17 @@ struct roc_mcs_fips_result_rsp { }; /** User application callback to be registered for any notifications from driver. */ -typedef int (*roc_mcs_dev_cb_fn)(void *userdata, struct roc_mcs_event_desc *desc, void *cb_arg); +typedef int (*roc_mcs_dev_cb_fn)(void *userdata, struct roc_mcs_event_desc *desc, void *cb_arg, + uint8_t port_id); struct roc_mcs { TAILQ_ENTRY(roc_mcs) next; struct plt_pci_device *pci_dev; struct mbox *mbox; - void *userdata; uint8_t idx; uint8_t refcount; + bool intr_cfg_once; + uint8_t *sa_port_map; #define ROC_MCS_MEM_SZ (1 * 1024) uint8_t reserved[ROC_MCS_MEM_SZ] __plt_cache_aligned; @@ -556,6 +558,8 @@ __roc_api int roc_mcs_tx_sc_sa_map_write(struct roc_mcs *mcs, struct roc_mcs_tx_sc_sa_map *tx_sc_sa_map); __roc_api int roc_mcs_tx_sc_sa_map_read(struct roc_mcs *mcs, struct roc_mcs_tx_sc_sa_map *tx_sc_sa_map); +/* SA to Port map update */ +__roc_api void roc_mcs_sa_port_map_update(struct roc_mcs *mcs, int sa_id, uint8_t port_id); /* Flow entry read, write and enable */ __roc_api int roc_mcs_flowid_entry_write(struct roc_mcs *mcs, diff --git a/drivers/common/cnxk/roc_mcs_sec_cfg.c b/drivers/common/cnxk/roc_mcs_sec_cfg.c index 7b3a4c91e8..e2fd3e7b8c 100644 --- a/drivers/common/cnxk/roc_mcs_sec_cfg.c +++ b/drivers/common/cnxk/roc_mcs_sec_cfg.c @@ -526,3 +526,9 @@ roc_mcs_flowid_entry_enable(struct roc_mcs *mcs, struct roc_mcs_flowid_ena_dis_e return mbox_process_msg(mcs->mbox, (void *)&rsp); } + +void +roc_mcs_sa_port_map_update(struct roc_mcs *mcs, int sa_id, uint8_t port_id) +{ + mcs->sa_port_map[sa_id] = port_id; +} diff --git a/drivers/common/cnxk/version.map b/drivers/common/cnxk/version.map index 8c71497df8..47b219af2b 100644 --- a/drivers/common/cnxk/version.map +++ b/drivers/common/cnxk/version.map @@ -170,6 +170,7 @@ INTERNAL { roc_mcs_rx_sc_sa_map_write; roc_mcs_sa_policy_read; roc_mcs_sa_policy_write; + roc_mcs_sa_port_map_update; roc_mcs_sc_stats_get; roc_mcs_secy_policy_read; roc_mcs_secy_policy_write; -- 2.25.1 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v1 1/2] common/cnxk: add sa to port mapping 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 0 siblings, 0 replies; 7+ messages in thread From: Jerin Jacob @ 2023-08-24 12:20 UTC (permalink / raw) To: Ankur Dwivedi; +Cc: dev, gakhil, vattunuru, jerinj On Wed, Aug 23, 2023 at 12:15 PM Ankur Dwivedi <adwivedi@marvell.com> wrote: > > Adds sa to port mapping in roc mcs. This helps to propagate the tx and > rx pn threshold events to the correct ethernet device. > > Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com> > --- > drivers/common/cnxk/roc_mcs.c | 22 +++++++++++++++++++--- > drivers/common/cnxk/roc_mcs.h | 8 ++++++-- > drivers/common/cnxk/roc_mcs_sec_cfg.c | 6 ++++++ > drivers/common/cnxk/version.map | 1 + > 4 files changed, 32 insertions(+), 5 deletions(-) Found following build issue. Please fix and resend [for-next-net]dell[dpdk-next-net-mrvl] $ gcc -v Using built-in specs. COLLECT_GCC=/usr/bin/gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: /build/gcc/src/gcc/configure --enable-languages=ada,c,c++,d,fortran,go,lto,objc,obj-c++ --enable-bootstrap --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugur l=https://bugs.archlinux.org/ --with-build-config=bootstrap-lto --with-linker-hash-style=gnu --with-system-zlib --enable-__cxa_atexit --enable-cet=auto --enable-checking=release --enable-clocale=gnu --enable-default-pie --enable-default-ssp --enable-gnu-indirect-function --enable-gnu-unique-object --enable-libstdcxx-backtrace --enable-link-serialization=1 --enable-linker-build-id --enable-lto --enable-multilib --enable-plugin --enable-shared --enable-threads=posix --disable-l ibssp --disable-libstdcxx-pch --disable-werror Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 13.2.1 20230801 (GCC) [1778/2638] Compiling C object drivers/libtmp_rte_net_cnxk.a.p/net_cnxk_cnxk_ethdev_mcs.c.o FAILED: drivers/libtmp_rte_net_cnxk.a.p/net_cnxk_cnxk_ethdev_mcs.c.o ccache gcc -Idrivers/libtmp_rte_net_cnxk.a.p -Idrivers -I../drivers -Idrivers/net/cnxk -I../drivers/net/cnxk -Ilib/ethdev -I../lib/ethdev -I. -I.. -Iconfig -I../config -Ilib/eal/include -I../lib/eal/include -Ilib/eal/linux/include -I../lib/ eal/linux/include -Ilib/eal/x86/include -I../lib/eal/x86/include -Ilib/eal/common -I../lib/eal/common -Ilib/eal -I../lib/eal -Ilib/kvargs -I../lib/kvargs -Ilib/metrics -I../lib/metrics -Ilib/telemetry -I../lib/telemetry -Ilib/net -I../lib/n et -Ilib/mbuf -I../lib/mbuf -Ilib/mempool -I../lib/mempool -Ilib/ring -I../lib/ring -Ilib/meter -I../lib/meter -Idrivers/bus/pci -I../drivers/bus/pci -I../drivers/bus/pci/linux -Ilib/pci -I../lib/pci -Idrivers/bus/vdev -I../drivers/bus/vdev -Ilib/cryptodev -I../lib/cryptodev -Ilib/rcu -I../lib/rcu -Ilib/eventdev -I../lib/eventdev -Ilib/hash -I../lib/hash -Ilib/timer -I../lib/timer -Ilib/security -I../lib/security -Idrivers/common/cnxk -I../drivers/common/cnxk -Idrivers/mempoo l/cnxk -I../drivers/mempool/cnxk -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Werror -O2 -g -include rte_config.h -Wcast-qual -Wdeprecated -Wformat -Wformat-nonliteral -Wformat-security -Wmissing-declaratio ns -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpointer-arith -Wsign-compare -Wstrict-prototypes -Wundef -Wwrite-strings -Wno-address-of-packed-member -Wno-packed-not-aligned -Wno-missing-field-initializers -Wno-zero-lengt h-bounds -D_GNU_SOURCE -fPIC -march=native -DALLOW_EXPERIMENTAL_API -DALLOW_INTERNAL_API -Wno-format-truncation -flax-vector-conversions -Wno-strict-aliasing -DRTE_LOG_DEFAULT_LOGTYPE=pmd.net.cnxk -MD -MQ drivers/libtmp_rte_net_cnxk.a.p/net _cnxk_cnxk_ethdev_mcs.c.o -MF drivers/libtmp_rte_net_cnxk.a.p/net_cnxk_cnxk_ethdev_mcs.c.o.d -o drivers/libtmp_rte_net_cnxk.a.p/net_cnxk_cnxk_ethdev_mcs.c.o -c ../drivers/net/cnxk/cnxk_ethdev_mcs.c ../drivers/net/cnxk/cnxk_ethdev_mcs.c: In function ‘cnxk_mcs_dev_init’: ../drivers/net/cnxk/cnxk_ethdev_mcs.c:707:40: error: passing argument 3 of ‘roc_mcs_event_cb_register’ from incompatible pointer type [-Werror=incompatible-pointer-types] 707 | cnxk_mcs_event_cb, dev->eth_dev, mcs_dev); | ^~~~~~~~~~~~~~~~~ | | | int (*)(void *, struct roc_mcs_event_desc *, void *) In file included from ../drivers/common/cnxk/roc_api.h:118, from ../drivers/net/cnxk/cnxk_ethdev.h:24, from ../drivers/net/cnxk/cnxk_ethdev_mcs.c:5: ../drivers/common/cnxk/roc_mcs.h:598:59: note: expected ‘roc_mcs_dev_cb_fn’ {aka ‘int (*)(void *, struct roc_mcs_event_desc *, void *, unsigned char)’} but argument is of type ‘int (*)(void *, struct roc_mcs_event_desc *, void *)’ 598 | roc_mcs_dev_cb_fn cb_fn, void *cb_arg, void *userdata); | ~~~~~~~~~~~~~~~~~~^~~~~ ../drivers/net/cnxk/cnxk_ethdev_mcs.c:714:40: error: passing argument 3 of ‘roc_mcs_event_cb_register’ from incompatible pointer type [-Werror=incompatible-pointer-types] 714 | cnxk_mcs_event_cb, dev->eth_dev, mcs_dev); | ^~~~~~~~~~~~~~~~~ | | | int (*)(void *, struct roc_mcs_event_desc *, void *) ../drivers/common/cnxk/roc_mcs.h:598:59: note: expected ‘roc_mcs_dev_cb_fn’ {aka ‘int (*)(void *, struct roc_mcs_event_desc *, void *, unsigned char)’} but argument is of type ‘int (*)(void *, struct roc_mcs_event_desc *, void *)’ 598 | roc_mcs_dev_cb_fn cb_fn, void *cb_arg, void *userdata); | ~~~~~~~~~~~~~~~~~~^~~~~ ../drivers/net/cnxk/cnxk_ethdev_mcs.c:721:40: error: passing argument 3 of ‘roc_mcs_event_cb_register’ from incompatible pointer type [-Werror=incompatible-pointer-types] 721 | cnxk_mcs_event_cb, dev->eth_dev, mcs_dev); | ^~~~~~~~~~~~~~~~~ | | | int (*)(void *, struct roc_mcs_event_desc *, void *) ../drivers/common/cnxk/roc_mcs.h:598:59: note: expected ‘roc_mcs_dev_cb_fn’ {aka ‘int (*)(void *, struct roc_mcs_event_desc *, void *, unsigned char)’} but argument is of type ‘int (*)(void *, struct roc_mcs_event_desc *, void *)’ 598 | roc_mcs_dev_cb_fn cb_fn, void *cb_arg, void *userdata); | ~~~~~~~~~~~~~~~~~~^~~~~ ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v1 2/2] net/cnxk: update sa to port map 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-23 5:50 ` Ankur Dwivedi 2023-08-25 10:36 ` [PATCH v2 0/1] support for MACsec PN threshold events on multiple ports Ankur Dwivedi 2 siblings, 0 replies; 7+ messages in thread From: Ankur Dwivedi @ 2023-08-23 5:50 UTC (permalink / raw) To: dev; +Cc: gakhil, vattunuru, jerinj, Ankur Dwivedi 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 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 0/1] support for MACsec PN threshold events on multiple ports 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-23 5:50 ` [PATCH v1 2/2] net/cnxk: update sa to port map Ankur Dwivedi @ 2023-08-25 10:36 ` Ankur Dwivedi 2023-08-25 10:36 ` [PATCH v2 1/1] net/cnxk: support " Ankur Dwivedi 2 siblings, 1 reply; 7+ messages in thread From: Ankur Dwivedi @ 2023-08-25 10:36 UTC (permalink / raw) To: dev; +Cc: gakhil, vattunuru, jerinj, Ankur Dwivedi This patch series adds support for packet number threshold events to be received on the respective ethernet port. For this a sa to port mapping is created during sa creation. When the pn threshold event is received then the check for port id is made to receive the event on the correct port. v2: - Squashed the v1 patches, to resolve compilation error. Ankur Dwivedi (1): net/cnxk: support MACsec PN threshold events on multiple ports drivers/common/cnxk/roc_mcs.c | 22 +++++++++++++++++++--- drivers/common/cnxk/roc_mcs.h | 8 ++++++-- drivers/common/cnxk/roc_mcs_sec_cfg.c | 6 ++++++ drivers/common/cnxk/version.map | 1 + drivers/net/cnxk/cnxk_ethdev_mcs.c | 14 +++++++++++++- 5 files changed, 45 insertions(+), 6 deletions(-) -- 2.25.1 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 1/1] net/cnxk: support MACsec PN threshold events on multiple ports 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 ` Ankur Dwivedi 2023-08-28 13:08 ` Jerin Jacob 0 siblings, 1 reply; 7+ messages in thread From: Ankur Dwivedi @ 2023-08-25 10:36 UTC (permalink / raw) To: dev; +Cc: gakhil, vattunuru, jerinj, Ankur Dwivedi Adds sa to port mapping in roc mcs. The sa to port map is updated when the sa is created. A portid field is also added to macsec event callback function. The above changes helps to propagate the tx and rx pn threshold events to the correct ethernet device. Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com> --- drivers/common/cnxk/roc_mcs.c | 22 +++++++++++++++++++--- drivers/common/cnxk/roc_mcs.h | 8 ++++++-- drivers/common/cnxk/roc_mcs_sec_cfg.c | 6 ++++++ drivers/common/cnxk/version.map | 1 + drivers/net/cnxk/cnxk_ethdev_mcs.c | 14 +++++++++++++- 5 files changed, 45 insertions(+), 6 deletions(-) diff --git a/drivers/common/cnxk/roc_mcs.c b/drivers/common/cnxk/roc_mcs.c index 1f269ddae5..f823f7f478 100644 --- a/drivers/common/cnxk/roc_mcs.c +++ b/drivers/common/cnxk/roc_mcs.c @@ -10,6 +10,7 @@ struct mcs_event_cb { enum roc_mcs_event_type event; roc_mcs_dev_cb_fn cb_fn; void *cb_arg; + void *userdata; void *ret_param; uint32_t active; }; @@ -320,12 +321,16 @@ roc_mcs_intr_configure(struct roc_mcs *mcs, struct roc_mcs_intr_cfg *config) { struct mcs_intr_cfg *req; struct msg_rsp *rsp; + int rc; if (config == NULL) return -EINVAL; MCS_SUPPORT_CHECK; + if (mcs->intr_cfg_once) + return 0; + req = mbox_alloc_msg_mcs_intr_cfg(mcs->mbox); if (req == NULL) return -ENOMEM; @@ -333,7 +338,11 @@ roc_mcs_intr_configure(struct roc_mcs *mcs, struct roc_mcs_intr_cfg *config) req->intr_mask = config->intr_mask; req->mcs_id = mcs->idx; - return mbox_process_msg(mcs->mbox, (void *)&rsp); + rc = mbox_process_msg(mcs->mbox, (void *)&rsp); + if (rc == 0) + mcs->intr_cfg_once = true; + + return rc; } int @@ -630,7 +639,7 @@ roc_mcs_event_cb_register(struct roc_mcs *mcs, enum roc_mcs_event_type event, cb->cb_fn = cb_fn; cb->cb_arg = cb_arg; cb->event = event; - mcs->userdata = userdata; + cb->userdata = userdata; TAILQ_INSERT_TAIL(cb_list, cb, next); } @@ -678,7 +687,8 @@ mcs_event_cb_process(struct roc_mcs *mcs, struct roc_mcs_event_desc *desc) cb->active = 1; mcs_cb.ret_param = desc; - rc = mcs_cb.cb_fn(mcs->userdata, mcs_cb.ret_param, mcs_cb.cb_arg); + rc = mcs_cb.cb_fn(mcs_cb.userdata, mcs_cb.ret_param, mcs_cb.cb_arg, + mcs->sa_port_map[desc->metadata.sa_idx]); cb->active = 0; } @@ -788,6 +798,10 @@ mcs_alloc_rsrc_bmap(struct roc_mcs *mcs) } } + mcs->sa_port_map = plt_zmalloc(sizeof(uint8_t) * hw->sa_entries, 0); + if (mcs->sa_port_map == NULL) + goto exit; + return rc; exit: @@ -865,6 +879,8 @@ roc_mcs_dev_fini(struct roc_mcs *mcs) plt_free(priv->port_rsrc); + plt_free(mcs->sa_port_map); + roc_idev_mcs_free(mcs); plt_free(mcs); diff --git a/drivers/common/cnxk/roc_mcs.h b/drivers/common/cnxk/roc_mcs.h index afac6c92e2..1b554f79c9 100644 --- a/drivers/common/cnxk/roc_mcs.h +++ b/drivers/common/cnxk/roc_mcs.h @@ -477,15 +477,17 @@ struct roc_mcs_fips_result_rsp { }; /** User application callback to be registered for any notifications from driver. */ -typedef int (*roc_mcs_dev_cb_fn)(void *userdata, struct roc_mcs_event_desc *desc, void *cb_arg); +typedef int (*roc_mcs_dev_cb_fn)(void *userdata, struct roc_mcs_event_desc *desc, void *cb_arg, + uint8_t port_id); struct roc_mcs { TAILQ_ENTRY(roc_mcs) next; struct plt_pci_device *pci_dev; struct mbox *mbox; - void *userdata; uint8_t idx; uint8_t refcount; + bool intr_cfg_once; + uint8_t *sa_port_map; #define ROC_MCS_MEM_SZ (1 * 1024) uint8_t reserved[ROC_MCS_MEM_SZ] __plt_cache_aligned; @@ -556,6 +558,8 @@ __roc_api int roc_mcs_tx_sc_sa_map_write(struct roc_mcs *mcs, struct roc_mcs_tx_sc_sa_map *tx_sc_sa_map); __roc_api int roc_mcs_tx_sc_sa_map_read(struct roc_mcs *mcs, struct roc_mcs_tx_sc_sa_map *tx_sc_sa_map); +/* SA to Port map update */ +__roc_api void roc_mcs_sa_port_map_update(struct roc_mcs *mcs, int sa_id, uint8_t port_id); /* Flow entry read, write and enable */ __roc_api int roc_mcs_flowid_entry_write(struct roc_mcs *mcs, diff --git a/drivers/common/cnxk/roc_mcs_sec_cfg.c b/drivers/common/cnxk/roc_mcs_sec_cfg.c index 7b3a4c91e8..e2fd3e7b8c 100644 --- a/drivers/common/cnxk/roc_mcs_sec_cfg.c +++ b/drivers/common/cnxk/roc_mcs_sec_cfg.c @@ -526,3 +526,9 @@ roc_mcs_flowid_entry_enable(struct roc_mcs *mcs, struct roc_mcs_flowid_ena_dis_e return mbox_process_msg(mcs->mbox, (void *)&rsp); } + +void +roc_mcs_sa_port_map_update(struct roc_mcs *mcs, int sa_id, uint8_t port_id) +{ + mcs->sa_port_map[sa_id] = port_id; +} diff --git a/drivers/common/cnxk/version.map b/drivers/common/cnxk/version.map index 8c71497df8..47b219af2b 100644 --- a/drivers/common/cnxk/version.map +++ b/drivers/common/cnxk/version.map @@ -170,6 +170,7 @@ INTERNAL { roc_mcs_rx_sc_sa_map_write; roc_mcs_sa_policy_read; roc_mcs_sa_policy_write; + roc_mcs_sa_port_map_update; roc_mcs_sc_stats_get; roc_mcs_secy_policy_read; roc_mcs_secy_policy_write; 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 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 1/1] net/cnxk: support MACsec PN threshold events on multiple ports 2023-08-25 10:36 ` [PATCH v2 1/1] net/cnxk: support " Ankur Dwivedi @ 2023-08-28 13:08 ` Jerin Jacob 0 siblings, 0 replies; 7+ messages in thread From: Jerin Jacob @ 2023-08-28 13:08 UTC (permalink / raw) To: Ankur Dwivedi; +Cc: dev, gakhil, vattunuru, jerinj On Fri, Aug 25, 2023 at 4:15 PM Ankur Dwivedi <adwivedi@marvell.com> wrote: > > Adds sa to port mapping in roc mcs. The sa to port map is updated when the > sa is created. A portid field is also added to macsec event callback > function. The above changes helps to propagate the tx and rx pn threshold > events to the correct ethernet device. > > Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com> Updated the git commit as follows and applied to dpdk-next-net-mrvl/for-next-net. Thanks commit 3cadd086a2322a366f880e6c0b4a995313cc803e (HEAD -> for-next-net, origin/for-next-net) Author: Ankur Dwivedi <adwivedi@marvell.com> Date: Fri Aug 25 16:06:35 2023 +0530 net/cnxk: support multi port MACsec PN threshold events Adds SA to port mapping in roc mcs. The SA to port map is updated when the SA is created. A portid field is also added to macsec event callback function. The above changes helps to propagate the Tx and Rx PN threshold events to the correct ethernet device. Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com> ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-08-28 13:09 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 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 ` [PATCH v1 2/2] net/cnxk: update sa to port map Ankur Dwivedi 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
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).