Now lib security is enabled by default, and cannot be disabled if the
driver is intended to be used. But there are some functional scenarios
where lib security should be disabled, just like to enale Tx descriptor
hardware check. See commit 0eabdfcd4af4 ("net/txgbe: enable Tx
descriptor error interrupt").

So remove the build dependency on lib security for the driver.

Signed-off-by: Jiawen Wu <[email protected]>
---
 drivers/net/txgbe/meson.build  |  8 ++++++--
 drivers/net/txgbe/txgbe_rxtx.c | 15 ++++++++++++++-
 2 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/drivers/net/txgbe/meson.build b/drivers/net/txgbe/meson.build
index 5cdec017ed..57b2f6dbf1 100644
--- a/drivers/net/txgbe/meson.build
+++ b/drivers/net/txgbe/meson.build
@@ -14,17 +14,21 @@ sources = files(
         'txgbe_ethdev_vf.c',
         'txgbe_fdir.c',
         'txgbe_flow.c',
-        'txgbe_ipsec.c',
         'txgbe_ptypes.c',
         'txgbe_pf.c',
         'txgbe_rxtx.c',
         'txgbe_tm.c',
 )
 
-deps += ['hash', 'security']
+deps += ['hash']
 
 cflags += no_wvla_cflag
 
+if dpdk_conf.has('RTE_LIB_SECURITY')
+    sources += files('txgbe_ipsec.c')
+    deps += 'security'
+endif
+
 if arch_subdir == 'x86'
     sources += files('txgbe_rxtx_vec_sse.c')
 elif arch_subdir == 'arm'
diff --git a/drivers/net/txgbe/txgbe_rxtx.c b/drivers/net/txgbe/txgbe_rxtx.c
index 78199ea00b..e9b9f17c84 100644
--- a/drivers/net/txgbe/txgbe_rxtx.c
+++ b/drivers/net/txgbe/txgbe_rxtx.c
@@ -21,7 +21,9 @@
 #include <rte_debug.h>
 #include <rte_ethdev.h>
 #include <ethdev_driver.h>
+#ifdef RTE_LIB_SECURITY
 #include <rte_security_driver.h>
+#endif
 #include <rte_memzone.h>
 #include <rte_atomic.h>
 #include <rte_mempool.h>
@@ -342,6 +344,17 @@ txgbe_xmit_pkts_vec(void *tx_queue, struct rte_mbuf 
**tx_pkts,
        return nb_tx;
 }
 
+static uint64_t *
+txgbe_security_dynfield(struct rte_mbuf *tx_pkt)
+{
+#ifdef RTE_LIB_SECURITY
+       return rte_security_dynfield(tx_pkt);
+#else
+       UNREFERENCED_PARAMETER(tx_pkt);
+       return NULL;
+#endif
+}
+
 static inline void
 txgbe_set_xmit_ctx(struct txgbe_tx_queue *txq,
                volatile struct txgbe_tx_ctx_desc *ctx_txd,
@@ -1102,7 +1115,7 @@ txgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 
                                txgbe_set_xmit_ctx(txq, ctx_txd, tx_ol_req,
                                        tx_offload,
-                                       rte_security_dynfield(tx_pkt));
+                                       txgbe_security_dynfield(tx_pkt));
 
                                txe->last_id = tx_last;
                                tx_id = txe->next_id;
-- 
2.48.1

Reply via email to