From: Long Wu <long...@corigine.com>

Use Rx/Tx offloads flag to control IPsec offload configuration.

Signed-off-by: Long Wu <long...@corigine.com>
Reviewed-by: Chaoyong He <chaoyong...@corigine.com>
---
 drivers/net/nfp/nfp_ethdev.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index 219265035d..53afdc8b18 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -390,10 +390,13 @@ nfp_net_start(struct rte_eth_dev *dev)
        if ((cap_extend & NFP_NET_CFG_CTRL_PKT_TYPE) != 0)
                ctrl_extend = NFP_NET_CFG_CTRL_PKT_TYPE;
 
-       if ((cap_extend & NFP_NET_CFG_CTRL_IPSEC) != 0)
-               ctrl_extend |= NFP_NET_CFG_CTRL_IPSEC |
-                               NFP_NET_CFG_CTRL_IPSEC_SM_LOOKUP |
-                               NFP_NET_CFG_CTRL_IPSEC_LM_LOOKUP;
+       if ((rxmode->offloads & RTE_ETH_RX_OFFLOAD_SECURITY) != 0 ||
+                       (txmode->offloads & RTE_ETH_TX_OFFLOAD_SECURITY) != 0) {
+               if ((cap_extend & NFP_NET_CFG_CTRL_IPSEC) != 0)
+                       ctrl_extend |= NFP_NET_CFG_CTRL_IPSEC |
+                                       NFP_NET_CFG_CTRL_IPSEC_SM_LOOKUP |
+                                       NFP_NET_CFG_CTRL_IPSEC_LM_LOOKUP;
+       }
 
        /* Enable flow steer by extend ctrl word1. */
        if ((cap_extend & NFP_NET_CFG_CTRL_FLOW_STEER) != 0)
-- 
2.39.1

Reply via email to