net/cnxk: register callback early to handle initial packets
authorNithin Dabilpuram <ndabilpuram@marvell.com>
Tue, 22 Feb 2022 19:35:04 +0000 (01:05 +0530)
committerJerin Jacob <jerinj@marvell.com>
Wed, 23 Feb 2022 16:37:15 +0000 (17:37 +0100)
Register callback early to handle initial error packets from
inline device.

Fixes: 69daa9e5022b ("net/cnxk: support inline security setup for cn10k")
Cc: stable@dpdk.org
Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
drivers/net/cnxk/cn10k_ethdev.c
drivers/net/cnxk/cn10k_ethdev.h
drivers/net/cnxk/cn10k_ethdev_sec.c

index 03ca1ab..c6890f3 100644 (file)
@@ -294,6 +294,12 @@ cn10k_nix_configure(struct rte_eth_dev *eth_dev)
        if (rc)
                return rc;
 
+       if (dev->tx_offloads & RTE_ETH_TX_OFFLOAD_SECURITY ||
+           dev->rx_offloads & RTE_ETH_RX_OFFLOAD_SECURITY) {
+               /* Register callback to handle security error work */
+               roc_nix_inl_cb_register(cn10k_eth_sec_sso_work_cb, NULL);
+       }
+
        /* Update offload flags */
        dev->rx_offload_flags = nix_rx_offload_flags(eth_dev);
        dev->tx_offload_flags = nix_tx_offload_flags(eth_dev);
index ec40e53..fd72730 100644 (file)
@@ -81,6 +81,9 @@ void cn10k_eth_set_tx_function(struct rte_eth_dev *eth_dev);
 /* Security context setup */
 void cn10k_eth_sec_ops_override(void);
 
+/* SSO Work callback */
+void cn10k_eth_sec_sso_work_cb(uint64_t *gw, void *args);
+
 #define LMT_OFF(lmt_addr, lmt_num, offset)                                     \
        (void *)((uintptr_t)(lmt_addr) +                                       \
                 ((uint64_t)(lmt_num) << ROC_LMT_LINE_SIZE_LOG2) + (offset))
index 6fbf444..ac45056 100644 (file)
@@ -138,7 +138,7 @@ static const struct rte_security_capability cn10k_eth_sec_capabilities[] = {
        }
 };
 
-static void
+void
 cn10k_eth_sec_sso_work_cb(uint64_t *gw, void *args)
 {
        struct rte_eth_event_ipsec_desc desc;
@@ -251,9 +251,6 @@ cn10k_eth_sec_session_create(void *device,
        if (rte_security_dynfield_register() < 0)
                return -ENOTSUP;
 
-       if (rte_eal_process_type() == RTE_PROC_PRIMARY)
-               roc_nix_inl_cb_register(cn10k_eth_sec_sso_work_cb, NULL);
-
        ipsec = &conf->ipsec;
        crypto = conf->crypto_xform;
        inbound = !!(ipsec->direction == RTE_SECURITY_IPSEC_SA_DIR_INGRESS);