Skip to content

Commit 980c840

Browse files
anuragma2025bruce-richardson
authored andcommitted
net/ice: add source prune option
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. Signed-off-by: Anurag Mandal <[email protected]> Acked-by: Bruce Richardson <[email protected]>
1 parent 193a11f commit 980c840

File tree

3 files changed

+31
-2
lines changed

3 files changed

+31
-2
lines changed

doc/guides/nics/ice.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,17 @@ Runtime Configuration
183183
If the value provided is greater than the number of levels provided by the HW,
184184
SW will use the hardware maximum value.
185185

186+
- ``Source Prune Enable`` (default ``0``)
187+
188+
Enable Source Prune to automatically drop incoming packets
189+
when their source MAC address matches one of the MAC addresses
190+
assigned to that same NIC port.
191+
192+
Source Prune can be enabled by setting the devargs parameter ``source-prune``,
193+
for example::
194+
195+
-a 80:00.0,source-prune=1
196+
186197
- ``Protocol extraction for per queue``
187198

188199
Configure the RX queues to do protocol extraction into mbuf for protocol

drivers/net/intel/ice/ice_ethdev.c

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
#define ICE_DDP_FILENAME_ARG "ddp_pkg_file"
4242
#define ICE_DDP_LOAD_SCHED_ARG "ddp_load_sched_topo"
4343
#define ICE_TM_LEVELS_ARG "tm_sched_levels"
44+
#define ICE_SOURCE_PRUNE_ARG "source-prune"
4445
#define ICE_LINK_STATE_ON_CLOSE "link_state_on_close"
4546

4647
#define ICE_CYCLECOUNTER_MASK 0xffffffffffffffffULL
@@ -58,6 +59,7 @@ static const char * const ice_valid_args[] = {
5859
ICE_DDP_FILENAME_ARG,
5960
ICE_DDP_LOAD_SCHED_ARG,
6061
ICE_TM_LEVELS_ARG,
62+
ICE_SOURCE_PRUNE_ARG,
6163
ICE_LINK_STATE_ON_CLOSE,
6264
NULL
6365
};
@@ -1718,6 +1720,7 @@ ice_setup_vsi(struct ice_pf *pf, enum ice_vsi_type type)
17181720
uint16_t max_txqs[ICE_MAX_TRAFFIC_CLASS] = { 0 };
17191721
uint8_t tc_bitmap = 0x1;
17201722
uint16_t cfg;
1723+
struct ice_adapter *ad = (struct ice_adapter *)hw->back;
17211724

17221725
/* hw->num_lports = 1 in NIC mode */
17231726
vsi = rte_zmalloc(NULL, sizeof(struct ice_vsi), 0);
@@ -1755,8 +1758,16 @@ ice_setup_vsi(struct ice_pf *pf, enum ice_vsi_type type)
17551758
* by ice_init_hw
17561759
*/
17571760
vsi_ctx.info.sw_id = hw->port_info->sw_id;
1758-
vsi_ctx.info.sw_flags = ICE_AQ_VSI_SW_FLAG_LOCAL_LB;
1759-
vsi_ctx.info.sw_flags |= ICE_AQ_VSI_SW_FLAG_SRC_PRUNE;
1761+
/* Source Prune */
1762+
if (ad->devargs.source_prune != 1) {
1763+
/* Disable source prune to support VRRP
1764+
* when source-prune devarg is not set
1765+
*/
1766+
vsi_ctx.info.sw_flags =
1767+
ICE_AQ_VSI_SW_FLAG_LOCAL_LB;
1768+
vsi_ctx.info.sw_flags |=
1769+
ICE_AQ_VSI_SW_FLAG_SRC_PRUNE;
1770+
}
17601771
cfg = ICE_AQ_VSI_PROP_SW_VALID;
17611772
vsi_ctx.info.valid_sections |= rte_cpu_to_le_16(cfg);
17621773
vsi_ctx.info.sw_flags2 = ICE_AQ_VSI_SW_FLAG_LAN_ENA;
@@ -2451,6 +2462,11 @@ static int ice_parse_devargs(struct rte_eth_dev *dev)
24512462
if (ret)
24522463
goto bail;
24532464

2465+
ret = rte_kvargs_process(kvlist, ICE_SOURCE_PRUNE_ARG,
2466+
&parse_bool, &ad->devargs.source_prune);
2467+
if (ret)
2468+
goto bail;
2469+
24542470
ret = rte_kvargs_process(kvlist, ICE_LINK_STATE_ON_CLOSE,
24552471
&parse_link_state_on_close, &ad->devargs.link_state_on_close);
24562472

@@ -7715,6 +7731,7 @@ RTE_PMD_REGISTER_PARAM_STRING(net_ice,
77157731
ICE_DDP_FILENAME_ARG "=</path/to/file>"
77167732
ICE_DDP_LOAD_SCHED_ARG "=<0|1>"
77177733
ICE_TM_LEVELS_ARG "=<N>"
7734+
ICE_SOURCE_PRUNE_ARG "=<0|1>"
77187735
ICE_RX_LOW_LATENCY_ARG "=<0|1>"
77197736
ICE_LINK_STATE_ON_CLOSE "=<down|up|initial>");
77207737

drivers/net/intel/ice/ice_ethdev.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -616,6 +616,7 @@ struct ice_devargs {
616616
uint8_t pps_out_ena;
617617
uint8_t ddp_load_sched;
618618
uint8_t tm_exposed_levels;
619+
uint8_t source_prune;
619620
int link_state_on_close;
620621
int xtr_field_offs;
621622
uint8_t xtr_flag_offs[PROTO_XTR_MAX];

0 commit comments

Comments
 (0)