This patch adds an mbuf dynflag IAVF_TX_LLDP_DYNFLAG to determine
whether or not to fill the SWTCH_UPLINK bit in the Tx context descriptor
to send LLDP packet.

Signed-off-by: Zhichao Zeng <zhichaox.z...@intel.com>
---
 drivers/net/iavf/iavf_rxtx.c    | 5 +++++
 drivers/net/iavf/rte_pmd_iavf.h | 2 ++
 2 files changed, 7 insertions(+)

diff --git a/drivers/net/iavf/iavf_rxtx.c b/drivers/net/iavf/iavf_rxtx.c
index f19aa14646..c986fa944a 100644
--- a/drivers/net/iavf/iavf_rxtx.c
+++ b/drivers/net/iavf/iavf_rxtx.c
@@ -2427,6 +2427,8 @@ iavf_calc_context_desc(uint64_t flags, uint8_t vlan_flag)
        if (flags & RTE_MBUF_F_TX_VLAN &&
            vlan_flag & IAVF_TX_FLAGS_VLAN_TAG_LOC_L2TAG2)
                return 1;
+       if (rte_mbuf_dynflag_lookup(IAVF_TX_LLDP_DYNFLAG, NULL) > 0)
+               return 1;
        return 0;
 }
 
@@ -2445,6 +2447,9 @@ iavf_fill_ctx_desc_cmd_field(volatile uint64_t *field, 
struct rte_mbuf *m,
                cmd |= IAVF_TX_CTX_DESC_IL2TAG2
                        << IAVF_TXD_CTX_QW1_CMD_SHIFT;
        }
+       if (rte_mbuf_dynflag_lookup(IAVF_TX_LLDP_DYNFLAG, NULL) > 0)
+               cmd |= IAVF_TX_CTX_DESC_SWTCH_UPLINK
+                       << IAVF_TXD_CTX_QW1_CMD_SHIFT;
 
        *field |= cmd;
 }
diff --git a/drivers/net/iavf/rte_pmd_iavf.h b/drivers/net/iavf/rte_pmd_iavf.h
index 56d453fc4c..2c442b6a05 100644
--- a/drivers/net/iavf/rte_pmd_iavf.h
+++ b/drivers/net/iavf/rte_pmd_iavf.h
@@ -23,6 +23,8 @@
 extern "C" {
 #endif
 
+#define IAVF_TX_LLDP_DYNFLAG "intel_pmd_dynflag_tx_lldp"
+
 /**
  * The supported network flexible descriptor's extraction metadata format.
  */
-- 
2.34.1

Reply via email to