Skip to contentSkip to conversation

net/ice: add source prune configuration API

PATCH Superseded Anurag Mandal 2 participants 9 messages Nov 1, 2025 – Nov 6, 2025 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/ice: add source prune configuration API

Source prune is disabled by default to support VRRP advertisement packets in a vsi of ice PF. There is no way to enable source prune itself.

This patch adds a PMD specific API to enable/disable source prune for all PF ports or for an indiviual PF port.

Tested the following with VRRP advertisement packets in a vsi of ice PF :-
1. Source prune default mode.
2. Enable source prune for an indiviual PF port.
3. Disable source prune for an indiviual PF port
4. Enable source prune for all PF ports.
5. Disable source prune for all PF ports.

Fixes 6f866eb93e79 ("net/ice: fix dropped packets when using VRRP")
---
 drivers/net/intel/ice/ice_ethdev.c  | 72 +++++++++++++++++++++++
 drivers/net/intel/ice/ice_ethdev.h  | 16 ++++++
 drivers/net/intel/ice/ice_testpmd.c | 88 +++++++++++++++++++++++++++++
 3 files changed, 176 insertions(+)
drivers/net/intel/ice/ice_ethdev.c +72 -0
index 4669eba7c7..2431199add 100644
@@ -13,6 +13,7 @@
 #include <unistd.h>
 #include <math.h>
 
+#include <eal_export.h>
 #include <rte_tailq.h>
 #include <rte_os_shim.h>
 
@@ -201,6 +202,7 @@ static const uint32_t *ice_buffer_split_supported_hdr_ptypes_get(struct rte_eth_
 						size_t *no_of_elements);
 static int ice_get_dcb_info(struct rte_eth_dev *dev, struct rte_eth_dcb_info *dcb_info);
 static int ice_priority_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_pfc_conf *pfc_conf);
+static int ice_pf_set_source_prune(struct ice_pf *pf, uint8_t on);
 
 static const struct rte_pci_id pci_id_ice_map[] = {
 	{ RTE_PCI_DEVICE(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E823L_BACKPLANE) },
@@ -1703,6 +1705,75 @@ ice_pf_sw_init(struct rte_eth_dev *dev)
 	return 0;
 }
 
+RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_pmd_ice_set_pf_src_prune, 25.11)
+int
+rte_pmd_ice_set_pf_src_prune(uint16_t port, uint8_t on)
+{
+	struct rte_eth_dev *dev;
+	struct ice_pf *pf;
+	int ret;
+
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+	dev = &rte_eth_devices[port];
+	if (!is_ice_supported(dev))
+		return -ENOTSUP;
+
+	pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+
+	ret = ice_pf_set_source_prune(pf, on);
+	return ret;
+}
+
+/* ice_pf_set_source_prune
+ * @pf: pointer to the pf structure
+ * @on: enable/disable source prune
+ *
+ * set source prune on pf
+ */
+static int
+ice_pf_set_source_prune(struct ice_pf *pf, uint8_t on)
+{
+	struct ice_hw *hw = ICE_PF_TO_HW(pf);
+	struct ice_vsi *vsi = pf->main_vsi;
+	struct ice_vsi_ctx ctxt;
+	int ret;
+
+	memset(&ctxt, 0, sizeof(ctxt));
+	ctxt.flags = ICE_AQ_VSI_TYPE_PF;
+	ctxt.info.valid_sections |=
+		rte_cpu_to_le_16(ICE_AQ_VSI_PROP_SW_VALID);
+	ctxt.info.sw_id = hw->port_info->sw_id;
+	ctxt.vsi_num = vsi->vsi_id;
+
+	if (on) {
+		/* Enable source prune */
+		ctxt.info.sw_flags &=
+			~(ICE_AQ_VSI_SW_FLAG_LOCAL_LB);
+		ctxt.info.sw_flags &=
+			~(ICE_AQ_VSI_SW_FLAG_SRC_PRUNE);
+	} else {
+		/* Disable source prune to support VRRP */
+		ctxt.info.sw_flags =
+			ICE_AQ_VSI_SW_FLAG_LOCAL_LB;
+		ctxt.info.sw_flags |=
+			ICE_AQ_VSI_SW_FLAG_SRC_PRUNE;
+	}
+
+        ret = ice_update_vsi(hw, vsi->idx, &ctxt, NULL);
+        if (ret) {
+                PMD_DRV_LOG(ERR, "Update VSI failed to %s source prune",
+                            on ? "enable" : "disable");
+                return -EINVAL;
+        } else {
+		vsi->info.valid_sections |=
+			rte_cpu_to_le_16(ICE_AQ_VSI_PROP_SW_VALID);
+		vsi->info.sw_flags = ctxt.info.sw_flags;
+        }
+
+        return 0;
+}
+
 struct ice_vsi *
 ice_setup_vsi(struct ice_pf *pf, enum ice_vsi_type type)
 {
@@ -1753,6 +1824,7 @@ ice_setup_vsi(struct ice_pf *pf, enum ice_vsi_type type)
 		 * by ice_init_hw
 		 */
 		vsi_ctx.info.sw_id = hw->port_info->sw_id;
+		/* disable source prune to support VRRP in default */
 		vsi_ctx.info.sw_flags = ICE_AQ_VSI_SW_FLAG_LOCAL_LB;
 		vsi_ctx.info.sw_flags |= ICE_AQ_VSI_SW_FLAG_SRC_PRUNE;
 		cfg = ICE_AQ_VSI_PROP_SW_VALID;
drivers/net/intel/ice/ice_ethdev.h +16 -0
index 6478d6dfbd..c2dad32045 100644
@@ -805,6 +805,22 @@ int rte_pmd_ice_dump_switch(uint16_t port, uint8_t **buff, uint32_t *size);
 __rte_experimental
 int rte_pmd_ice_dump_txsched(uint16_t port, bool detail, FILE *stream);
 
+/**
+ * Enable/Disable source prune on all the PF.
+ *
+ * @param port
+ *    The port identifier of the Ethernet device.
+ * @param on
+ *    1 - Enable source prune.
+ *    0 - Disable source prune.
+ * @return
+ *   - (0) if successful.
+ *   - (-ENODEV) if *port* invalid.
+ *   - (-EINVAL) if bad parameter.
+ */
+__rte_experimental
+int rte_pmd_ice_set_pf_src_prune(uint16_t port, uint8_t on);
+
 int
 ice_tm_setup_txq_node(struct ice_pf *pf, struct ice_hw *hw, uint16_t qid, uint32_t node_teid);
 
drivers/net/intel/ice/ice_testpmd.c +88 -0

100 lines not on this page · raw message

Signature · 1 line
2.34.1
#1 lore raw

PATCH v2 1/1 net/ice: add source prune configuration API

Source prune is disabled by default to support VRRP advertisement packets in a vsi of ice PF. There is no way to enable source prune itself.

This patch adds a PMD specific API to enable/disable source prune for all PF ports or for an individual PF port.

Tested the following with VRRP advertisement packets in a vsi of ice PF:
1. Source prune default mode.
2. Enable source prune for an individual PF port.
3. Disable source prune for an individual PF port.
4. Enable source prune for all PF ports.
5. Disable source prune for all PF ports.

Fixes 6f866eb93e79 ("net/ice: fix dropped packets when using VRRP")
---
 drivers/net/intel/ice/ice_ethdev.c  | 72 +++++++++++++++++++++++
 drivers/net/intel/ice/ice_ethdev.h  | 16 ++++++
 drivers/net/intel/ice/ice_testpmd.c | 88 +++++++++++++++++++++++++++++
 3 files changed, 176 insertions(+)
drivers/net/intel/ice/ice_ethdev.c +72 -0
index 4669eba7c7..27904589d5 100644
@@ -2,6 +2,7 @@
  * Copyright(c) 2018 Intel Corporation
  */
 
+#include <eal_export.h>
 #include <rte_string_fns.h>
 #include <ethdev_pci.h>
 
@@ -201,6 +202,7 @@ static const uint32_t *ice_buffer_split_supported_hdr_ptypes_get(struct rte_eth_
 						size_t *no_of_elements);
 static int ice_get_dcb_info(struct rte_eth_dev *dev, struct rte_eth_dcb_info *dcb_info);
 static int ice_priority_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_pfc_conf *pfc_conf);
+static int ice_pf_set_source_prune(struct ice_pf *pf, uint8_t on);
 
 static const struct rte_pci_id pci_id_ice_map[] = {
 	{ RTE_PCI_DEVICE(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E823L_BACKPLANE) },
@@ -1703,6 +1705,75 @@ ice_pf_sw_init(struct rte_eth_dev *dev)
 	return 0;
 }
 
+RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_pmd_ice_set_pf_src_prune, 25.11)
+int
+rte_pmd_ice_set_pf_src_prune(uint16_t port, uint8_t on)
+{
+	struct rte_eth_dev *dev;
+	struct ice_pf *pf;
+	int ret;
+
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+	dev = &rte_eth_devices[port];
+	if (!is_ice_supported(dev))
+		return -ENOTSUP;
+
+	pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+
+	ret = ice_pf_set_source_prune(pf, on);
+	return ret;
+}
+
+/* ice_pf_set_source_prune
+ * @pf: pointer to the pf structure
+ * @on: enable/disable source prune
+ *
+ * set source prune on pf
+ */
+static int
+ice_pf_set_source_prune(struct ice_pf *pf, uint8_t on)
+{
+	struct ice_hw *hw = ICE_PF_TO_HW(pf);
+	struct ice_vsi *vsi = pf->main_vsi;
+	struct ice_vsi_ctx ctxt;
+	int ret;
+
+	memset(&ctxt, 0, sizeof(ctxt));
+	ctxt.flags = ICE_AQ_VSI_TYPE_PF;
+	ctxt.info.valid_sections |=
+		rte_cpu_to_le_16(ICE_AQ_VSI_PROP_SW_VALID);
+	ctxt.info.sw_id = hw->port_info->sw_id;
+	ctxt.vsi_num = vsi->vsi_id;
+
+	if (on) {
+		/* Enable source prune */
+		ctxt.info.sw_flags &=
+			~(ICE_AQ_VSI_SW_FLAG_LOCAL_LB);
+		ctxt.info.sw_flags &=
+			~(ICE_AQ_VSI_SW_FLAG_SRC_PRUNE);
+	} else {
+		/* Disable source prune to support VRRP */
+		ctxt.info.sw_flags =
+			ICE_AQ_VSI_SW_FLAG_LOCAL_LB;
+		ctxt.info.sw_flags |=
+			ICE_AQ_VSI_SW_FLAG_SRC_PRUNE;
+	}
+
+	ret = ice_update_vsi(hw, vsi->idx, &ctxt, NULL);
+	if (ret) {
+		PMD_DRV_LOG(ERR, "Update VSI failed to %s source prune",
+			on ? "enable" : "disable");
+		return -EINVAL;
+	} else {
+		vsi->info.valid_sections |=
+			rte_cpu_to_le_16(ICE_AQ_VSI_PROP_SW_VALID);
+		vsi->info.sw_flags = ctxt.info.sw_flags;
+	}
+
+	return 0;
+}
+
 struct ice_vsi *
 ice_setup_vsi(struct ice_pf *pf, enum ice_vsi_type type)
 {
@@ -1753,6 +1824,7 @@ ice_setup_vsi(struct ice_pf *pf, enum ice_vsi_type type)
 		 * by ice_init_hw
 		 */
 		vsi_ctx.info.sw_id = hw->port_info->sw_id;
+		/* disable source prune to support VRRP in default */
 		vsi_ctx.info.sw_flags = ICE_AQ_VSI_SW_FLAG_LOCAL_LB;
 		vsi_ctx.info.sw_flags |= ICE_AQ_VSI_SW_FLAG_SRC_PRUNE;
 		cfg = ICE_AQ_VSI_PROP_SW_VALID;
drivers/net/intel/ice/ice_ethdev.h +16 -0
index 6478d6dfbd..c2dad32045 100644
@@ -805,6 +805,22 @@ int rte_pmd_ice_dump_switch(uint16_t port, uint8_t **buff, uint32_t *size);
 __rte_experimental
 int rte_pmd_ice_dump_txsched(uint16_t port, bool detail, FILE *stream);
 
+/**
+ * Enable/Disable source prune on all the PF.
+ *
+ * @param port
+ *    The port identifier of the Ethernet device.
+ * @param on
+ *    1 - Enable source prune.
+ *    0 - Disable source prune.
+ * @return
+ *   - (0) if successful.
+ *   - (-ENODEV) if *port* invalid.
+ *   - (-EINVAL) if bad parameter.
+ */
+__rte_experimental
+int rte_pmd_ice_set_pf_src_prune(uint16_t port, uint8_t on);
+
 int
 ice_tm_setup_txq_node(struct ice_pf *pf, struct ice_hw *hw, uint16_t qid, uint32_t node_teid);
 
drivers/net/intel/ice/ice_testpmd.c +88 -0

100 lines not on this page · raw message

Signature · 1 line
2.34.1
#2 lore raw

PATCH v3 1/1 net/ice: add source prune configuration API

Source prune is disabled by default to support VRRP advertisement packets in a vsi of ice PF. There is no way to enable source prune itself.

This patch adds a PMD specific API to enable/disable source prune for all PF ports or for an individual PF port.

Tested the following with VRRP advertisement packets in a vsi of ice PF:
1. Source prune default mode.
2. Enable source prune for an individual PF port.
3. Disable source prune for an individual PF port.
4. Enable source prune for all PF ports.
5. Disable source prune for all PF ports.

Fixes 6f866eb93e79 ("net/ice: fix dropped packets when using VRRP")
---
 drivers/net/intel/ice/ice_ethdev.c  | 72 +++++++++++++++++++++++
 drivers/net/intel/ice/ice_ethdev.h  | 16 ++++++
 drivers/net/intel/ice/ice_testpmd.c | 88 +++++++++++++++++++++++++++++
 3 files changed, 176 insertions(+)
drivers/net/intel/ice/ice_ethdev.c +72 -0
index 4669eba7c7..d1565f0a7a 100644
@@ -2,6 +2,7 @@
  * Copyright(c) 2018 Intel Corporation
  */
 
+#include <eal_export.h>
 #include <rte_string_fns.h>
 #include <ethdev_pci.h>
 
@@ -201,6 +202,7 @@ static const uint32_t *ice_buffer_split_supported_hdr_ptypes_get(struct rte_eth_
 						size_t *no_of_elements);
 static int ice_get_dcb_info(struct rte_eth_dev *dev, struct rte_eth_dcb_info *dcb_info);
 static int ice_priority_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_pfc_conf *pfc_conf);
+static int ice_pf_set_source_prune(struct ice_pf *pf, uint8_t on);
 
 static const struct rte_pci_id pci_id_ice_map[] = {
 	{ RTE_PCI_DEVICE(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E823L_BACKPLANE) },
@@ -1703,6 +1705,75 @@ ice_pf_sw_init(struct rte_eth_dev *dev)
 	return 0;
 }
 
+RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_pmd_ice_set_pf_src_prune, 25.11)
+int
+rte_pmd_ice_set_pf_src_prune(uint16_t port, uint8_t on)
+{
+	struct rte_eth_dev *dev;
+	struct ice_pf *pf;
+	int ret;
+
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+	dev = &rte_eth_devices[port];
+	if (!is_ice_supported(dev))
+		return -ENOTSUP;
+
+	pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+
+	ret = ice_pf_set_source_prune(pf, on);
+	return ret;
+}
+
+/* ice_pf_set_source_prune
+ * @pf: pointer to the pf structure
+ * @on: enable/disable source prune
+ *
+ * set source prune on pf
+ */
+static int
+ice_pf_set_source_prune(struct ice_pf *pf, uint8_t on)
+{
+	struct ice_hw *hw = ICE_PF_TO_HW(pf);
+	struct ice_vsi *vsi = pf->main_vsi;
+	struct ice_vsi_ctx ctxt;
+	int ret;
+
+	memset(&ctxt, 0, sizeof(ctxt));
+	ctxt.flags = ICE_AQ_VSI_TYPE_PF;
+	ctxt.info.valid_sections |=
+		rte_cpu_to_le_16(ICE_AQ_VSI_PROP_SW_VALID);
+	ctxt.info.sw_id = hw->port_info->sw_id;
+	ctxt.vsi_num = vsi->vsi_id;
+
+	if (on) {
+		/* Enable source prune */
+		ctxt.info.sw_flags &=
+			~(ICE_AQ_VSI_SW_FLAG_LOCAL_LB);
+		ctxt.info.sw_flags &=
+			~(ICE_AQ_VSI_SW_FLAG_SRC_PRUNE);
+	} else {
+		/* Disable source prune to support VRRP */
+		ctxt.info.sw_flags =
+			ICE_AQ_VSI_SW_FLAG_LOCAL_LB;
+		ctxt.info.sw_flags |=
+			ICE_AQ_VSI_SW_FLAG_SRC_PRUNE;
+	}
+
+	ret = ice_update_vsi(hw, vsi->idx, &ctxt, NULL);
+	if (ret) {
+		PMD_DRV_LOG(ERR, "Update VSI failed to %s source prune",
+			on ? "enable" : "disable");
+		return -EINVAL;
+	}
+
+	vsi->info.valid_sections |=
+		rte_cpu_to_le_16(ICE_AQ_VSI_PROP_SW_VALID);
+	vsi->info.sw_flags = ctxt.info.sw_flags;
+
+	return 0;
+}
+
 struct ice_vsi *
 ice_setup_vsi(struct ice_pf *pf, enum ice_vsi_type type)
 {
@@ -1753,6 +1824,7 @@ ice_setup_vsi(struct ice_pf *pf, enum ice_vsi_type type)
 		 * by ice_init_hw
 		 */
 		vsi_ctx.info.sw_id = hw->port_info->sw_id;
+		/* disable source prune to support VRRP in default */
 		vsi_ctx.info.sw_flags = ICE_AQ_VSI_SW_FLAG_LOCAL_LB;
 		vsi_ctx.info.sw_flags |= ICE_AQ_VSI_SW_FLAG_SRC_PRUNE;
 		cfg = ICE_AQ_VSI_PROP_SW_VALID;
drivers/net/intel/ice/ice_ethdev.h +16 -0
index 6478d6dfbd..c2dad32045 100644
@@ -805,6 +805,22 @@ int rte_pmd_ice_dump_switch(uint16_t port, uint8_t **buff, uint32_t *size);
 __rte_experimental
 int rte_pmd_ice_dump_txsched(uint16_t port, bool detail, FILE *stream);
 
+/**
+ * Enable/Disable source prune on all the PF.
+ *
+ * @param port
+ *    The port identifier of the Ethernet device.
+ * @param on
+ *    1 - Enable source prune.
+ *    0 - Disable source prune.
+ * @return
+ *   - (0) if successful.
+ *   - (-ENODEV) if *port* invalid.
+ *   - (-EINVAL) if bad parameter.
+ */
+__rte_experimental
+int rte_pmd_ice_set_pf_src_prune(uint16_t port, uint8_t on);
+
 int
 ice_tm_setup_txq_node(struct ice_pf *pf, struct ice_hw *hw, uint16_t qid, uint32_t node_teid);
 
drivers/net/intel/ice/ice_testpmd.c +88 -0

100 lines not on this page · raw message

Signature · 1 line
2.34.1
#3 lore raw
Quoted 18 lines · Anurag Mandal

Source prune is disabled by default to support VRRP advertisement packets in a vsi of ice PF. There is no way to enable source prune itself.

This patch adds a PMD specific API to enable/disable source prune for all PF ports or for an individual PF port.

Tested the following with VRRP advertisement packets in a vsi of ice PF:
1. Source prune default mode.
2. Enable source prune for an individual PF port.
3. Disable source prune for an individual PF port.
4. Enable source prune for all PF ports.
5. Disable source prune for all PF ports.

Fixes 6f866eb93e79 ("net/ice: fix dropped packets when using VRRP")
Quoted 7 lines
---
 drivers/net/intel/ice/ice_ethdev.c  | 72 +++++++++++++++++++++++
 drivers/net/intel/ice/ice_ethdev.h  | 16 ++++++
 drivers/net/intel/ice/ice_testpmd.c | 88 +++++++++++++++++++++++++++++
 3 files changed, 176 insertions(+)

Rather than having a new private API for this, would a device arg (devarg) passed on the commandline be a better choice? Private APIs are not really nice in DPDK, and for this feature I can't see it being something that needs enabling/disabling at runtime by apps. Just having it as a device setting, set at init should probably work.

/Bruce

#4 lore raw

PATCH v4 1/1 net/ice: add option to enable source prune

In reply to Anurag Mandal

Source prune is disabled by default to support
VRRP advertisement packets in a vsi of ice PF.
There is no way to enable source prune itself.

This patch introduces devarg "source-prune-enable" to allow user to enable source prune.

Enable Source Prune to automatically drop incoming packets when their source MAC address matches one of the MAC addresses assigned to that same NIC port.

Tested the following with VRRP advertisement packets in a vsi of ice PF:
1. Source prune default mode with no devarg option.
2. Enable source prune with devarg"source-prune-enable=1".
3. Disable source prune with devarg"source-prune-enable=0".

Fixes 6f866eb93e79 ("net/ice: fix dropped packets when using VRRP")

---
V4: Adressed Bruce Richardson's comment
- changed from private API to devarg option.

 doc/guides/nics/ice.rst            | 11 +++++++++++
 drivers/net/intel/ice/ice_ethdev.c | 25 +++++++++++++++++++++++--
 drivers/net/intel/ice/ice_ethdev.h |  1 +
 3 files changed, 35 insertions(+), 2 deletions(-)
doc/guides/nics/ice.rst +11 -0
index 7e9ba23102..09561b08c5 100644
@@ -183,6 +183,17 @@ Runtime Configuration
   If the value provided is greater than the number of levels provided by the HW,
   SW will use the hardware maximum value.
 
+- ``Source Prune Enable`` (default ``0``)
+
+  Enable Source Prune to automatically drop incoming packets when
+  their source MAC address matches one of the MAC addresses assigned
+  to that same NIC port.
+
+  Source Prune can be enabled by setting the devargs parameter ``source-prune-enable``,
+  for example::
+
+    -a 80:00.0,source-prune-enable=1
+
 - ``Protocol extraction for per queue``
 
   Configure the RX queues to do protocol extraction into mbuf for protocol
drivers/net/intel/ice/ice_ethdev.c +23 -2
index 4669eba7c7..540d0bd977 100644
@@ -41,6 +41,7 @@
 #define ICE_DDP_FILENAME_ARG      "ddp_pkg_file"
 #define ICE_DDP_LOAD_SCHED_ARG    "ddp_load_sched_topo"
 #define ICE_TM_LEVELS_ARG         "tm_sched_levels"
+#define ICE_SRC_PRUNE_ENABLE_ARG  "source-prune-enable"
 #define ICE_LINK_STATE_ON_CLOSE   "link_state_on_close"
 
 #define ICE_CYCLECOUNTER_MASK  0xffffffffffffffffULL
@@ -58,6 +59,7 @@ static const char * const ice_valid_args[] = {
 	ICE_DDP_FILENAME_ARG,
 	ICE_DDP_LOAD_SCHED_ARG,
 	ICE_TM_LEVELS_ARG,
+	ICE_SRC_PRUNE_ENABLE_ARG,
 	ICE_LINK_STATE_ON_CLOSE,
 	NULL
 };
@@ -1716,6 +1718,7 @@ ice_setup_vsi(struct ice_pf *pf, enum ice_vsi_type type)
 	uint16_t max_txqs[ICE_MAX_TRAFFIC_CLASS] = { 0 };
 	uint8_t tc_bitmap = 0x1;
 	uint16_t cfg;
+	struct ice_adapter *ad = (struct ice_adapter *)hw->back;
 
 	/* hw->num_lports = 1 in NIC mode */
 	vsi = rte_zmalloc(NULL, sizeof(struct ice_vsi), 0);
@@ -1753,8 +1756,20 @@ ice_setup_vsi(struct ice_pf *pf, enum ice_vsi_type type)
 		 * by ice_init_hw
 		 */
 		vsi_ctx.info.sw_id = hw->port_info->sw_id;
-		vsi_ctx.info.sw_flags = ICE_AQ_VSI_SW_FLAG_LOCAL_LB;
-		vsi_ctx.info.sw_flags |= ICE_AQ_VSI_SW_FLAG_SRC_PRUNE;
+		/* Source Prune */
+		if (ad->devargs.source_prune_enable == 1) {
+			/* Enable source prune */
+			vsi_ctx.info.sw_flags &=
+				~(ICE_AQ_VSI_SW_FLAG_LOCAL_LB);
+			vsi_ctx.info.sw_flags &=
+				~(ICE_AQ_VSI_SW_FLAG_SRC_PRUNE);
+		} else {
+			/* Disable source prune to support VRRP */
+			vsi_ctx.info.sw_flags =
+				ICE_AQ_VSI_SW_FLAG_LOCAL_LB;
+			vsi_ctx.info.sw_flags |=
+				ICE_AQ_VSI_SW_FLAG_SRC_PRUNE;
+		}
 		cfg = ICE_AQ_VSI_PROP_SW_VALID;
 		vsi_ctx.info.valid_sections |= rte_cpu_to_le_16(cfg);
 		vsi_ctx.info.sw_flags2 = ICE_AQ_VSI_SW_FLAG_LAN_ENA;
@@ -2449,6 +2464,11 @@ static int ice_parse_devargs(struct rte_eth_dev *dev)
 	if (ret)
 		goto bail;
 
+	ret = rte_kvargs_process(kvlist, ICE_SRC_PRUNE_ENABLE_ARG,
+				 &parse_bool, &ad->devargs.source_prune_enable);
+	if (ret)
+		goto bail;
+
 	ret = rte_kvargs_process(kvlist, ICE_LINK_STATE_ON_CLOSE,
 				 &parse_link_state_on_close, &ad->devargs.link_state_on_close);
 
@@ -7659,6 +7679,7 @@ RTE_PMD_REGISTER_PARAM_STRING(net_ice,
 			      ICE_DDP_FILENAME_ARG "=</path/to/file>"
 			      ICE_DDP_LOAD_SCHED_ARG "=<0|1>"
 			      ICE_TM_LEVELS_ARG "=<N>"
+			      ICE_SRC_PRUNE_ENABLE_ARG "=<0|1>"
 			      ICE_RX_LOW_LATENCY_ARG "=<0|1>"
 			      ICE_LINK_STATE_ON_CLOSE "=<down|up|initial>");
 
drivers/net/intel/ice/ice_ethdev.h +1 -0
index 6478d6dfbd..408cbe4a38 100644
@@ -614,6 +614,7 @@ struct ice_devargs {
 	uint8_t pps_out_ena;
 	uint8_t ddp_load_sched;
 	uint8_t tm_exposed_levels;
+	uint8_t source_prune_enable;
 	int link_state_on_close;
 	int xtr_field_offs;
 	uint8_t xtr_flag_offs[PROTO_XTR_MAX];
Signature · 1 line
2.34.1
#5 lore raw

Re: [PATCH v4] net/ice: add option to enable source prune

Quoted 17 lines · Anurag Mandal

Source prune is disabled by default to support
VRRP advertisement packets in a vsi of ice PF.
There is no way to enable source prune itself.

This patch introduces devarg "source-prune-enable" to allow user to enable source prune.

Enable Source Prune to automatically drop incoming packets when their source MAC address matches one of the MAC addresses assigned to that same NIC port.

Tested the following with VRRP advertisement packets in a vsi of ice PF:
1. Source prune default mode with no devarg option.
2. Enable source prune with devarg"source-prune-enable=1".
3. Disable source prune with devarg"source-prune-enable=0".

Quoted 7 lines
Fixes 6f866eb93e79 ("net/ice: fix dropped packets when using VRRP")

---
V4: Adressed Bruce Richardson's comment
- changed from private API to devarg option.

This looks a better solution to me than a private API. However, it strikes me as a new feature, rather than a fix, so I'm not sure backporting is appropriate.

Couple of comments inline below.

Thanks,
/Bruce

Quoted 15 lines
 doc/guides/nics/ice.rst            | 11 +++++++++++
 drivers/net/intel/ice/ice_ethdev.c | 25 +++++++++++++++++++++++--
 drivers/net/intel/ice/ice_ethdev.h |  1 +
 3 files changed, 35 insertions(+), 2 deletions(-)
doc/guides/nics/ice.rst +1 -0
index 7e9ba23102..09561b08c5 100644
@@ -183,6 +183,17 @@ Runtime Configuration
   If the value provided is greater than the number of levels provided by the HW,
   SW will use the hardware maximum value.
 
+- ``Source Prune Enable`` (default ``0``)

doc/guides/nics/ice.rst Runtime Configuration · line 196

Quoted 10 lines
doc/guides/nics/ice.rst +10 -0
+
+  Enable Source Prune to automatically drop incoming packets when
+  their source MAC address matches one of the MAC addresses assigned
+  to that same NIC port.
+
+  Source Prune can be enabled by setting the devargs parameter ``source-prune-enable``,
+  for example::
+
+    -a 80:00.0,source-prune-enable=1
+

I think the word "enable" is unnecessary. Just having the option be "source-prune" is probably enough, since source-prune=1 is really the same as source-prune-enable=1.

Quoted 16 lines
doc/guides/nics/ice.rst +0 -0
 - ``Protocol extraction for per queue``
 
   Configure the RX queues to do protocol extraction into mbuf for protocol
drivers/net/intel/ice/ice_ethdev.c +1 -0
index 4669eba7c7..540d0bd977 100644
@@ -41,6 +41,7 @@
 #define ICE_DDP_FILENAME_ARG      "ddp_pkg_file"
 #define ICE_DDP_LOAD_SCHED_ARG    "ddp_load_sched_topo"
 #define ICE_TM_LEVELS_ARG         "tm_sched_levels"
+#define ICE_SRC_PRUNE_ENABLE_ARG  "source-prune-enable"
 #define ICE_LINK_STATE_ON_CLOSE   "link_state_on_close"
 
 #define ICE_CYCLECOUNTER_MASK  0xffffffffffffffffULL

drivers/net/intel/ice/ice_ethdev.c static const char * const ice_valid_args[] = { · line 62

Quoted 4 lines
drivers/net/intel/ice/ice_ethdev.c +1 -0
@@ -58,6 +59,7 @@ static const char * const ice_valid_args[] = {
 	ICE_DDP_FILENAME_ARG,
 	ICE_DDP_LOAD_SCHED_ARG,
 	ICE_TM_LEVELS_ARG,
+	ICE_SRC_PRUNE_ENABLE_ARG,

Removing ENABLE also shortens the enum values, enhancing readability.

Quoted 14 lines
drivers/net/intel/ice/ice_ethdev.c +1 -0
 	ICE_LINK_STATE_ON_CLOSE,
 	NULL
 };
@@ -1716,6 +1718,7 @@ ice_setup_vsi(struct ice_pf *pf, enum ice_vsi_type type)
 	uint16_t max_txqs[ICE_MAX_TRAFFIC_CLASS] = { 0 };
 	uint8_t tc_bitmap = 0x1;
 	uint16_t cfg;
+	struct ice_adapter *ad = (struct ice_adapter *)hw->back;
 
 	/* hw->num_lports = 1 in NIC mode */
 	vsi = rte_zmalloc(NULL, sizeof(struct ice_vsi), 0);
@@ -1753,8 +1756,20 @@ ice_setup_vsi(struct ice_pf *pf, enum ice_vsi_type type)
 		 * by ice_init_hw
 		 */

drivers/net/intel/ice/ice_ethdev.c ice_setup_vsi(struct ice_pf *pf, enum ice_vsi_type type) · line 1765

Quoted 10 lines
drivers/net/intel/ice/ice_ethdev.c +7 -2
 		vsi_ctx.info.sw_id = hw->port_info->sw_id;
-		vsi_ctx.info.sw_flags = ICE_AQ_VSI_SW_FLAG_LOCAL_LB;
-		vsi_ctx.info.sw_flags |= ICE_AQ_VSI_SW_FLAG_SRC_PRUNE;
+		/* Source Prune */drivers/net/intel/ice/ice_ethdev.c:1707:ice_setup_vsi
+		if (ad->devargs.source_prune_enable == 1) {
+			/* Enable source prune */
+			vsi_ctx.info.sw_flags &=
+				~(ICE_AQ_VSI_SW_FLAG_LOCAL_LB);
+			vsi_ctx.info.sw_flags &=
+				~(ICE_AQ_VSI_SW_FLAG_SRC_PRUNE);

I don't believe we need this branch at all. The VSI context is cleared just before entering this block, so the sw_flags should already be zero. Notice how in the second block (existing code) we assign software flags rather than or-ing in the values.

Quoted 45 lines
drivers/net/intel/ice/ice_ethdev.c +13 -0
+		} else {
+			/* Disable source prune to support VRRP */
+			vsi_ctx.info.sw_flags =
+				ICE_AQ_VSI_SW_FLAG_LOCAL_LB;
+			vsi_ctx.info.sw_flags |=
+				ICE_AQ_VSI_SW_FLAG_SRC_PRUNE;
+		}
 		cfg = ICE_AQ_VSI_PROP_SW_VALID;
 		vsi_ctx.info.valid_sections |= rte_cpu_to_le_16(cfg);
 		vsi_ctx.info.sw_flags2 = ICE_AQ_VSI_SW_FLAG_LAN_ENA;
@@ -2449,6 +2464,11 @@ static int ice_parse_devargs(struct rte_eth_dev *dev)
 	if (ret)
 		goto bail;
 
+	ret = rte_kvargs_process(kvlist, ICE_SRC_PRUNE_ENABLE_ARG,
+				 &parse_bool, &ad->devargs.source_prune_enable);
+	if (ret)
+		goto bail;
+
 	ret = rte_kvargs_process(kvlist, ICE_LINK_STATE_ON_CLOSE,
 				 &parse_link_state_on_close, &ad->devargs.link_state_on_close);
 
@@ -7659,6 +7679,7 @@ RTE_PMD_REGISTER_PARAM_STRING(net_ice,
 			      ICE_DDP_FILENAME_ARG "=</path/to/file>"
 			      ICE_DDP_LOAD_SCHED_ARG "=<0|1>"
 			      ICE_TM_LEVELS_ARG "=<N>"
+			      ICE_SRC_PRUNE_ENABLE_ARG "=<0|1>"
 			      ICE_RX_LOW_LATENCY_ARG "=<0|1>"
 			      ICE_LINK_STATE_ON_CLOSE "=<down|up|initial>");
 
drivers/net/intel/ice/ice_ethdev.h +1 -0
index 6478d6dfbd..408cbe4a38 100644
@@ -614,6 +614,7 @@ struct ice_devargs {
 	uint8_t pps_out_ena;
 	uint8_t ddp_load_sched;
 	uint8_t tm_exposed_levels;
+	uint8_t source_prune_enable;
 	int link_state_on_close;
 	int xtr_field_offs;
 	uint8_t xtr_flag_offs[PROTO_XTR_MAX];
Signature · 1 line
2.34.1
#6 lore raw

PATCH v5 1/1 net/ice: add option to enable source prune

In reply to Anurag Mandal

Source prune is disabled by default to support VRRP advertisement packets in a vsi of ice PF. There is no way to enable source prune itself.

This patch introduces devarg "source-prune" to allow user to enable source prune.

Enable Source Prune to automatically drop incoming packets when their source MAC address matches one of the MAC addresses assigned to that same NIC port.

Tested the following with VRRP advertisement packets in a vsi of ice PF:
1. Source prune default mode with no devarg option.
2. Enable source prune with devarg "source-prune=1".
3. Disable source prune with devarg "source-prune=0".

---
V5:Addressed Bruce Richardson's minor feedbacks
- changed devarg name to "source-prune"
- removed "Fixes" from commit msg
- removed explicit source prune enabling 'if' block
- changed devargs member name to "source_prune"
- changed macro name to "ICE_SOURCE_PRUNE_ARG"

V4: Addressed Bruce Richardson's feedback
- changed from private API to devarg option.

V3: Addressed Coding Style Warning

V2: Addressed Coding Style Warnings

 doc/guides/nics/ice.rst            | 11 +++++++++++
 drivers/net/intel/ice/ice_ethdev.c | 21 +++++++++++++++++++--
 drivers/net/intel/ice/ice_ethdev.h |  1 +
 3 files changed, 31 insertions(+), 2 deletions(-)
doc/guides/nics/ice.rst +11 -0
index 7e9ba23102..d050140e84 100644
@@ -183,6 +183,17 @@ Runtime Configuration
   If the value provided is greater than the number of levels provided by the HW,
   SW will use the hardware maximum value.
 
+- ``Source Prune Enable`` (default ``0``)
+
+  Enable Source Prune to automatically drop incoming packets when
+  their source MAC address matches one of the MAC addresses assigned
+  to that same NIC port.
+
+  Source Prune can be enabled by setting the devargs parameter ``source-prune``,
+  for example::
+
+    -a 80:00.0,source-prune=1
+
 - ``Protocol extraction for per queue``
 
   Configure the RX queues to do protocol extraction into mbuf for protocol
drivers/net/intel/ice/ice_ethdev.c +19 -2
index 4669eba7c7..65d4ae5407 100644
@@ -41,6 +41,7 @@
 #define ICE_DDP_FILENAME_ARG      "ddp_pkg_file"
 #define ICE_DDP_LOAD_SCHED_ARG    "ddp_load_sched_topo"
 #define ICE_TM_LEVELS_ARG         "tm_sched_levels"
+#define ICE_SOURCE_PRUNE_ARG      "source-prune"
 #define ICE_LINK_STATE_ON_CLOSE   "link_state_on_close"
 
 #define ICE_CYCLECOUNTER_MASK  0xffffffffffffffffULL
@@ -58,6 +59,7 @@ static const char * const ice_valid_args[] = {
 	ICE_DDP_FILENAME_ARG,
 	ICE_DDP_LOAD_SCHED_ARG,
 	ICE_TM_LEVELS_ARG,
+	ICE_SOURCE_PRUNE_ARG,
 	ICE_LINK_STATE_ON_CLOSE,
 	NULL
 };
@@ -1716,6 +1718,7 @@ ice_setup_vsi(struct ice_pf *pf, enum ice_vsi_type type)
 	uint16_t max_txqs[ICE_MAX_TRAFFIC_CLASS] = { 0 };
 	uint8_t tc_bitmap = 0x1;
 	uint16_t cfg;
+	struct ice_adapter *ad = (struct ice_adapter *)hw->back;
 
 	/* hw->num_lports = 1 in NIC mode */
 	vsi = rte_zmalloc(NULL, sizeof(struct ice_vsi), 0);
@@ -1753,8 +1756,16 @@ ice_setup_vsi(struct ice_pf *pf, enum ice_vsi_type type)
 		 * by ice_init_hw
 		 */
 		vsi_ctx.info.sw_id = hw->port_info->sw_id;
-		vsi_ctx.info.sw_flags = ICE_AQ_VSI_SW_FLAG_LOCAL_LB;
-		vsi_ctx.info.sw_flags |= ICE_AQ_VSI_SW_FLAG_SRC_PRUNE;
+		/* Source Prune */
+		if (ad->devargs.source_prune != 1) {
+			/* Disable source prune to support VRRP
+			 * when source-prune devarg is not set
+			 */
+			vsi_ctx.info.sw_flags =
+				ICE_AQ_VSI_SW_FLAG_LOCAL_LB;
+			vsi_ctx.info.sw_flags |=
+				ICE_AQ_VSI_SW_FLAG_SRC_PRUNE;
+		}
 		cfg = ICE_AQ_VSI_PROP_SW_VALID;
 		vsi_ctx.info.valid_sections |= rte_cpu_to_le_16(cfg);
 		vsi_ctx.info.sw_flags2 = ICE_AQ_VSI_SW_FLAG_LAN_ENA;
@@ -2449,6 +2460,11 @@ static int ice_parse_devargs(struct rte_eth_dev *dev)
 	if (ret)
 		goto bail;
 
+	ret = rte_kvargs_process(kvlist, ICE_SOURCE_PRUNE_ARG,
+				 &parse_bool, &ad->devargs.source_prune);
+	if (ret)
+		goto bail;
+
 	ret = rte_kvargs_process(kvlist, ICE_LINK_STATE_ON_CLOSE,
 				 &parse_link_state_on_close, &ad->devargs.link_state_on_close);
 
@@ -7659,6 +7675,7 @@ RTE_PMD_REGISTER_PARAM_STRING(net_ice,
 			      ICE_DDP_FILENAME_ARG "=</path/to/file>"
 			      ICE_DDP_LOAD_SCHED_ARG "=<0|1>"
 			      ICE_TM_LEVELS_ARG "=<N>"
+			      ICE_SOURCE_PRUNE_ARG "=<0|1>"
 			      ICE_RX_LOW_LATENCY_ARG "=<0|1>"
 			      ICE_LINK_STATE_ON_CLOSE "=<down|up|initial>");
 
drivers/net/intel/ice/ice_ethdev.h +1 -0
index 6478d6dfbd..5decb05d5f 100644
@@ -614,6 +614,7 @@ struct ice_devargs {
 	uint8_t pps_out_ena;
 	uint8_t ddp_load_sched;
 	uint8_t tm_exposed_levels;
+	uint8_t source_prune;
 	int link_state_on_close;
 	int xtr_field_offs;
 	uint8_t xtr_flag_offs[PROTO_XTR_MAX];
Signature · 1 line
2.34.1
Acked-by on v5 1/1
#7 lore raw

Re: [PATCH v5] net/ice: add option to enable source prune

Quoted 11 lines · Anurag Mandal

Source prune is disabled by default to support VRRP advertisement packets in a vsi of ice PF. There is no way to enable source prune itself.

This patch introduces devarg "source-prune" to allow user to enable source prune.

Enable Source Prune to automatically drop incoming packets when their source MAC address matches one of the MAC addresses assigned to that same NIC port.

Quoted 7 lines

Tested the following with VRRP advertisement packets in a vsi of ice PF:
1. Source prune default mode with no devarg option.
2. Enable source prune with devarg "source-prune=1".
3. Disable source prune with devarg "source-prune=0".

#8 lore raw

Re: [PATCH v5] net/ice: add option to enable source prune

Quoted 12 lines · Bruce Richardson
Quoted 11 lines · Anurag Mandal

Source prune is disabled by default to support VRRP advertisement packets in a vsi of ice PF. There is no way to enable source prune itself.

This patch introduces devarg "source-prune" to allow user to enable source prune.

Enable Source Prune to automatically drop incoming packets when their source MAC address matches one of the MAC addresses assigned to that same NIC port.

Quoted 9 lines
Quoted 7 lines

Tested the following with VRRP advertisement packets in a vsi of ice PF:
1. Source prune default mode with no devarg option.
2. Enable source prune with devarg "source-prune=1".
3. Disable source prune with devarg "source-prune=0".

Applied to dpdk-next-net-intel

Thanks,
/Bruce