* [Intel-wired-lan] [PATCH iwl-next 1/8] ice: in dvm, use outer VLAN in MAC, VLAN lookup
2025-11-20 16:28 [Intel-wired-lan] [PATCH iwl-next 0/8] ice: in VEB, prevent "cross-vlan" traffic Jakub Slepecki
@ 2025-11-20 16:28 ` Jakub Slepecki
2025-11-20 16:28 ` [Intel-wired-lan] [PATCH iwl-next 2/8] ice: allow creating mac, vlan filters along mac filters Jakub Slepecki
` (6 subsequent siblings)
7 siblings, 0 replies; 13+ messages in thread
From: Jakub Slepecki @ 2025-11-20 16:28 UTC (permalink / raw)
To: intel-wired-lan
Cc: linux-kernel, netdev, przemyslaw.kitszel, anthony.l.nguyen,
michal.swiatkowski, jakub.slepecki
In double VLAN mode (DVM), outer VLAN is located a word earlier in
the field vector compared to the single VLAN mode. We already modify
ICE_SW_LKUP_VLAN to use it but ICE_SW_LKUP_MAC_VLAN was left untouched,
causing the lookup to match any packet with one or no layer of Dot1q.
This change enables to fix cross-vlan loopback traffic using MAC,VLAN
lookups.
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Signed-off-by: Jakub Slepecki <jakub.slepecki@intel.com>
---
drivers/net/ethernet/intel/ice/ice_vlan_mode.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/net/ethernet/intel/ice/ice_vlan_mode.c b/drivers/net/ethernet/intel/ice/ice_vlan_mode.c
index fb526cb84776..68a7b05de44e 100644
--- a/drivers/net/ethernet/intel/ice/ice_vlan_mode.c
+++ b/drivers/net/ethernet/intel/ice/ice_vlan_mode.c
@@ -198,6 +198,7 @@ static bool ice_is_dvm_supported(struct ice_hw *hw)
#define ICE_SW_LKUP_VLAN_LOC_LKUP_IDX 1
#define ICE_SW_LKUP_VLAN_PKT_FLAGS_LKUP_IDX 2
#define ICE_SW_LKUP_PROMISC_VLAN_LOC_LKUP_IDX 2
+#define ICE_SW_LKUP_MAC_VLAN_LOC_LKUP_IDX 4
#define ICE_PKT_FLAGS_0_TO_15_FV_IDX 1
static struct ice_update_recipe_lkup_idx_params ice_dvm_dflt_recipes[] = {
{
@@ -234,6 +235,17 @@ static struct ice_update_recipe_lkup_idx_params ice_dvm_dflt_recipes[] = {
.mask_valid = false, /* use pre-existing mask */
.lkup_idx = ICE_SW_LKUP_PROMISC_VLAN_LOC_LKUP_IDX,
},
+ {
+ /* Similarly to ICE_SW_LKUP_VLAN, change to outer/single VLAN in
+ * DVM
+ */
+ .rid = ICE_SW_LKUP_MAC_VLAN,
+ .fv_idx = ICE_EXTERNAL_VLAN_ID_FV_IDX,
+ .ignore_valid = true,
+ .mask = 0,
+ .mask_valid = false,
+ .lkup_idx = ICE_SW_LKUP_MAC_VLAN_LOC_LKUP_IDX,
+ },
};
/**
--
2.43.0
^ permalink raw reply related [flat|nested] 13+ messages in thread* [Intel-wired-lan] [PATCH iwl-next 2/8] ice: allow creating mac, vlan filters along mac filters
2025-11-20 16:28 [Intel-wired-lan] [PATCH iwl-next 0/8] ice: in VEB, prevent "cross-vlan" traffic Jakub Slepecki
2025-11-20 16:28 ` [Intel-wired-lan] [PATCH iwl-next 1/8] ice: in dvm, use outer VLAN in MAC, VLAN lookup Jakub Slepecki
@ 2025-11-20 16:28 ` Jakub Slepecki
2025-11-20 16:28 ` [Intel-wired-lan] [PATCH iwl-next 3/8] ice: do not check for zero mac when creating " Jakub Slepecki
` (5 subsequent siblings)
7 siblings, 0 replies; 13+ messages in thread
From: Jakub Slepecki @ 2025-11-20 16:28 UTC (permalink / raw)
To: intel-wired-lan
Cc: linux-kernel, netdev, przemyslaw.kitszel, anthony.l.nguyen,
michal.swiatkowski, jakub.slepecki
Among other uses, MAC filters are currently used to forward loopback
traffic between VSIs. However, they only match destination MAC addresses
making them prone to mistakes when handling traffic within multiple
VLANs and especially across the boundaries.
This patch allows the driver to create MAC,VLAN filters in the same
flow as MAC-only filters completely interchangeably. This is intended
to be used to forward the loopback traffic only within the boundaries
of particular VLANs.
Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: Jakub Slepecki <jakub.slepecki@intel.com>
---
drivers/net/ethernet/intel/ice/ice_switch.c | 48 ++++++++++++++++-----
1 file changed, 38 insertions(+), 10 deletions(-)
diff --git a/drivers/net/ethernet/intel/ice/ice_switch.c b/drivers/net/ethernet/intel/ice/ice_switch.c
index 84848f0123e7..0275e2910c6b 100644
--- a/drivers/net/ethernet/intel/ice/ice_switch.c
+++ b/drivers/net/ethernet/intel/ice/ice_switch.c
@@ -3606,6 +3606,29 @@ bool ice_vlan_fltr_exist(struct ice_hw *hw, u16 vlan_id, u16 vsi_handle)
return false;
}
+/**
+ * ice_fltr_mac_address - Find MAC in filter
+ * @dst: output MAC address
+ * @info: information struct for the filter in question
+ *
+ * Return: 0 for success, %-ENXIO if no address was found in the filter
+ * information.
+ */
+static
+int ice_fltr_mac_address(u8 *dst, struct ice_fltr_info *info)
+{
+ switch (info->lkup_type) {
+ case ICE_SW_LKUP_MAC:
+ ether_addr_copy(dst, info->l_data.mac.mac_addr);
+ return 0;
+ case ICE_SW_LKUP_MAC_VLAN:
+ ether_addr_copy(dst, info->l_data.mac_vlan.mac_addr);
+ return 0;
+ default:
+ return -ENXIO;
+ }
+}
+
/**
* ice_add_mac - Add a MAC address based filter rule
* @hw: pointer to the hardware structure
@@ -3614,16 +3637,19 @@ bool ice_vlan_fltr_exist(struct ice_hw *hw, u16 vlan_id, u16 vsi_handle)
int ice_add_mac(struct ice_hw *hw, struct list_head *m_list)
{
struct ice_fltr_list_entry *m_list_itr;
- int status = 0;
+ int err;
if (!m_list || !hw)
return -EINVAL;
list_for_each_entry(m_list_itr, m_list, list_entry) {
- u8 *add = &m_list_itr->fltr_info.l_data.mac.mac_addr[0];
+ u8 addr[ETH_ALEN];
u16 vsi_handle;
u16 hw_vsi_id;
+ err = ice_fltr_mac_address(addr, &m_list_itr->fltr_info);
+ if (err || is_zero_ether_addr(addr))
+ return -EINVAL;
m_list_itr->fltr_info.flag = ICE_FLTR_TX;
vsi_handle = m_list_itr->fltr_info.vsi_handle;
if (!ice_is_vsi_valid(hw, vsi_handle))
@@ -3634,17 +3660,19 @@ int ice_add_mac(struct ice_hw *hw, struct list_head *m_list)
if (m_list_itr->fltr_info.src_id != ICE_SRC_ID_VSI)
return -EINVAL;
m_list_itr->fltr_info.src = hw_vsi_id;
- if (m_list_itr->fltr_info.lkup_type != ICE_SW_LKUP_MAC ||
- is_zero_ether_addr(add))
+ if (m_list_itr->fltr_info.lkup_type != ICE_SW_LKUP_MAC &&
+ m_list_itr->fltr_info.lkup_type != ICE_SW_LKUP_MAC_VLAN)
return -EINVAL;
- m_list_itr->status = ice_add_rule_internal(hw, ICE_SW_LKUP_MAC,
- m_list_itr);
+ m_list_itr->status =
+ ice_add_rule_internal(hw,
+ m_list_itr->fltr_info.lkup_type,
+ m_list_itr);
if (m_list_itr->status)
return m_list_itr->status;
}
- return status;
+ return 0;
}
/**
@@ -4055,7 +4083,7 @@ int ice_remove_mac(struct ice_hw *hw, struct list_head *m_list)
enum ice_sw_lkup_type l_type = list_itr->fltr_info.lkup_type;
u16 vsi_handle;
- if (l_type != ICE_SW_LKUP_MAC)
+ if (l_type != ICE_SW_LKUP_MAC && l_type != ICE_SW_LKUP_MAC_VLAN)
return -EINVAL;
vsi_handle = list_itr->fltr_info.vsi_handle;
@@ -4066,7 +4094,7 @@ int ice_remove_mac(struct ice_hw *hw, struct list_head *m_list)
ice_get_hw_vsi_num(hw, vsi_handle);
list_itr->status = ice_remove_rule_internal(hw,
- ICE_SW_LKUP_MAC,
+ l_type,
list_itr);
if (list_itr->status)
return list_itr->status;
@@ -4507,6 +4535,7 @@ ice_remove_vsi_lkup_fltr(struct ice_hw *hw, u16 vsi_handle,
switch (lkup) {
case ICE_SW_LKUP_MAC:
+ case ICE_SW_LKUP_MAC_VLAN:
ice_remove_mac(hw, &remove_list_head);
break;
case ICE_SW_LKUP_VLAN:
@@ -4516,7 +4545,6 @@ ice_remove_vsi_lkup_fltr(struct ice_hw *hw, u16 vsi_handle,
case ICE_SW_LKUP_PROMISC_VLAN:
ice_remove_promisc(hw, lkup, &remove_list_head);
break;
- case ICE_SW_LKUP_MAC_VLAN:
case ICE_SW_LKUP_ETHERTYPE:
case ICE_SW_LKUP_ETHERTYPE_MAC:
case ICE_SW_LKUP_DFLT:
--
2.43.0
^ permalink raw reply related [flat|nested] 13+ messages in thread* [Intel-wired-lan] [PATCH iwl-next 3/8] ice: do not check for zero mac when creating mac filters
2025-11-20 16:28 [Intel-wired-lan] [PATCH iwl-next 0/8] ice: in VEB, prevent "cross-vlan" traffic Jakub Slepecki
2025-11-20 16:28 ` [Intel-wired-lan] [PATCH iwl-next 1/8] ice: in dvm, use outer VLAN in MAC, VLAN lookup Jakub Slepecki
2025-11-20 16:28 ` [Intel-wired-lan] [PATCH iwl-next 2/8] ice: allow creating mac, vlan filters along mac filters Jakub Slepecki
@ 2025-11-20 16:28 ` Jakub Slepecki
2025-11-20 16:28 ` [Intel-wired-lan] [PATCH iwl-next 4/8] ice: allow overriding lan_en, lb_en in switch Jakub Slepecki
` (4 subsequent siblings)
7 siblings, 0 replies; 13+ messages in thread
From: Jakub Slepecki @ 2025-11-20 16:28 UTC (permalink / raw)
To: intel-wired-lan
Cc: linux-kernel, netdev, przemyslaw.kitszel, anthony.l.nguyen,
michal.swiatkowski, jakub.slepecki
A zero MAC address was considered a special case while creating a new
MAC filter. There is no particular reason for that other than the fact
that the union containing it was assumed to be zeroed out. Now, address
is pulled out of the union by ice_fltr_mac_address which checks all of
the previously assumed zero-address cases and returns an error if they
are hit.
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Signed-off-by: Jakub Slepecki <jakub.slepecki@intel.com>
---
drivers/net/ethernet/intel/ice/ice_switch.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/intel/ice/ice_switch.c b/drivers/net/ethernet/intel/ice/ice_switch.c
index 0275e2910c6b..04e5d653efce 100644
--- a/drivers/net/ethernet/intel/ice/ice_switch.c
+++ b/drivers/net/ethernet/intel/ice/ice_switch.c
@@ -3648,7 +3648,7 @@ int ice_add_mac(struct ice_hw *hw, struct list_head *m_list)
u16 hw_vsi_id;
err = ice_fltr_mac_address(addr, &m_list_itr->fltr_info);
- if (err || is_zero_ether_addr(addr))
+ if (err)
return -EINVAL;
m_list_itr->fltr_info.flag = ICE_FLTR_TX;
vsi_handle = m_list_itr->fltr_info.vsi_handle;
--
2.43.0
^ permalink raw reply related [flat|nested] 13+ messages in thread* [Intel-wired-lan] [PATCH iwl-next 4/8] ice: allow overriding lan_en, lb_en in switch
2025-11-20 16:28 [Intel-wired-lan] [PATCH iwl-next 0/8] ice: in VEB, prevent "cross-vlan" traffic Jakub Slepecki
` (2 preceding siblings ...)
2025-11-20 16:28 ` [Intel-wired-lan] [PATCH iwl-next 3/8] ice: do not check for zero mac when creating " Jakub Slepecki
@ 2025-11-20 16:28 ` Jakub Slepecki
2025-11-21 9:21 ` Loktionov, Aleksandr
2025-11-20 16:28 ` [Intel-wired-lan] [PATCH iwl-next 5/8] ice: update mac, vlan rules when toggling between VEB and VEPA Jakub Slepecki
` (3 subsequent siblings)
7 siblings, 1 reply; 13+ messages in thread
From: Jakub Slepecki @ 2025-11-20 16:28 UTC (permalink / raw)
To: intel-wired-lan
Cc: linux-kernel, netdev, przemyslaw.kitszel, anthony.l.nguyen,
michal.swiatkowski, jakub.slepecki
Currently, lan_en and lb_en are determined based on switching mode,
destination MAC, and the lookup type, action type and flags of the rule
in question. This gives little to no options for the user (such as
ice_fltr.c) to enforce rules to behave in a specific way.
Such functionality is needed to work with pairs of rules, for example,
when handling MAC forward to LAN together with MAC,VLAN forward to
loopback rules pair. This case could not be easily deduced in a context
of a single filter without adding a specialized flag.
Instead of adding a specialized flag to mark special scenario rules,
we add a slightly more generic flag to the lan_en and lb_en themselves
for the ice_fltr.c to request specific destination flags later on, for
example, to override value:
struct ice_fltr_info fi;
fi.lb_en = ICE_FLTR_INFO_LB_LAN_FORCE_ENABLED;
fi.lan_en = ICE_FLTR_INFO_LB_LAN_FORCE_DISABLED;
Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Signed-off-by: Jakub Slepecki <jakub.slepecki@intel.com>
---
drivers/net/ethernet/intel/ice/ice_switch.c | 21 +++++++++++++--------
drivers/net/ethernet/intel/ice/ice_switch.h | 7 +++++++
2 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/intel/ice/ice_switch.c b/drivers/net/ethernet/intel/ice/ice_switch.c
index 04e5d653efce..7b63588948fd 100644
--- a/drivers/net/ethernet/intel/ice/ice_switch.c
+++ b/drivers/net/ethernet/intel/ice/ice_switch.c
@@ -2538,8 +2538,9 @@ int ice_get_initial_sw_cfg(struct ice_hw *hw)
*/
static void ice_fill_sw_info(struct ice_hw *hw, struct ice_fltr_info *fi)
{
- fi->lb_en = false;
- fi->lan_en = false;
+ bool lan_en = false;
+ bool lb_en = false;
+
if ((fi->flag & ICE_FLTR_TX) &&
(fi->fltr_act == ICE_FWD_TO_VSI ||
fi->fltr_act == ICE_FWD_TO_VSI_LIST ||
@@ -2549,7 +2550,7 @@ static void ice_fill_sw_info(struct ice_hw *hw, struct ice_fltr_info *fi)
* packets to the internal switch that will be dropped.
*/
if (fi->lkup_type != ICE_SW_LKUP_VLAN)
- fi->lb_en = true;
+ lb_en = true;
/* Set lan_en to TRUE if
* 1. The switch is a VEB AND
@@ -2578,14 +2579,18 @@ static void ice_fill_sw_info(struct ice_hw *hw, struct ice_fltr_info *fi)
!is_unicast_ether_addr(fi->l_data.mac.mac_addr)) ||
(fi->lkup_type == ICE_SW_LKUP_MAC_VLAN &&
!is_unicast_ether_addr(fi->l_data.mac.mac_addr)))
- fi->lan_en = true;
+ lan_en = true;
} else {
- fi->lan_en = true;
+ lan_en = true;
}
}
if (fi->flag & ICE_FLTR_TX_ONLY)
- fi->lan_en = false;
+ lan_en = false;
+ if (!(fi->lb_en & ICE_FLTR_INFO_LB_LAN_FORCE_MASK))
+ fi->lb_en = lb_en;
+ if (!(fi->lan_en & ICE_FLTR_INFO_LB_LAN_FORCE_MASK))
+ fi->lan_en = lan_en;
}
/**
@@ -2669,9 +2674,9 @@ ice_fill_sw_rule(struct ice_hw *hw, struct ice_fltr_info *f_info,
return;
}
- if (f_info->lb_en)
+ if (f_info->lb_en & ICE_FLTR_INFO_LB_LAN_VALUE_MASK)
act |= ICE_SINGLE_ACT_LB_ENABLE;
- if (f_info->lan_en)
+ if (f_info->lan_en & ICE_FLTR_INFO_LB_LAN_VALUE_MASK)
act |= ICE_SINGLE_ACT_LAN_ENABLE;
switch (f_info->lkup_type) {
diff --git a/drivers/net/ethernet/intel/ice/ice_switch.h b/drivers/net/ethernet/intel/ice/ice_switch.h
index 671d7a5f359f..a7dc4bfec3a0 100644
--- a/drivers/net/ethernet/intel/ice/ice_switch.h
+++ b/drivers/net/ethernet/intel/ice/ice_switch.h
@@ -72,6 +72,13 @@ enum ice_src_id {
ICE_SRC_ID_LPORT,
};
+#define ICE_FLTR_INFO_LB_LAN_VALUE_MASK BIT(0)
+#define ICE_FLTR_INFO_LB_LAN_FORCE_MASK BIT(1)
+#define ICE_FLTR_INFO_LB_LAN_FORCE_ENABLED \
+ (ICE_FLTR_INFO_LB_LAN_VALUE_MASK | \
+ ICE_FLTR_INFO_LB_LAN_FORCE_MASK)
+#define ICE_FLTR_INFO_LB_LAN_FORCE_DISABLED ICE_FLTR_INFO_LB_LAN_FORCE_MASK
+
struct ice_fltr_info {
/* Look up information: how to look up packet */
enum ice_sw_lkup_type lkup_type;
--
2.43.0
^ permalink raw reply related [flat|nested] 13+ messages in thread* Re: [Intel-wired-lan] [PATCH iwl-next 4/8] ice: allow overriding lan_en, lb_en in switch
2025-11-20 16:28 ` [Intel-wired-lan] [PATCH iwl-next 4/8] ice: allow overriding lan_en, lb_en in switch Jakub Slepecki
@ 2025-11-21 9:21 ` Loktionov, Aleksandr
2025-11-24 10:20 ` Jakub Slepecki
0 siblings, 1 reply; 13+ messages in thread
From: Loktionov, Aleksandr @ 2025-11-21 9:21 UTC (permalink / raw)
To: Slepecki, Jakub, intel-wired-lan@lists.osuosl.org
Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
Kitszel, Przemyslaw, Nguyen, Anthony L,
michal.swiatkowski@linux.intel.com, Slepecki, Jakub
> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf
> Of Jakub Slepecki
> Sent: Thursday, November 20, 2025 5:28 PM
> To: intel-wired-lan@lists.osuosl.org
> Cc: linux-kernel@vger.kernel.org; netdev@vger.kernel.org; Kitszel,
> Przemyslaw <przemyslaw.kitszel@intel.com>; Nguyen, Anthony L
> <anthony.l.nguyen@intel.com>; michal.swiatkowski@linux.intel.com;
> Slepecki, Jakub <jakub.slepecki@intel.com>
> Subject: [Intel-wired-lan] [PATCH iwl-next 4/8] ice: allow overriding
> lan_en, lb_en in switch
>
> Currently, lan_en and lb_en are determined based on switching mode,
> destination MAC, and the lookup type, action type and flags of the
> rule in question. This gives little to no options for the user (such
> as
> ice_fltr.c) to enforce rules to behave in a specific way.
>
> Such functionality is needed to work with pairs of rules, for example,
> when handling MAC forward to LAN together with MAC,VLAN forward to
> loopback rules pair. This case could not be easily deduced in a
> context of a single filter without adding a specialized flag.
>
> Instead of adding a specialized flag to mark special scenario rules,
> we add a slightly more generic flag to the lan_en and lb_en themselves
> for the ice_fltr.c to request specific destination flags later on, for
> example, to override value:
>
> struct ice_fltr_info fi;
> fi.lb_en = ICE_FLTR_INFO_LB_LAN_FORCE_ENABLED;
> fi.lan_en = ICE_FLTR_INFO_LB_LAN_FORCE_DISABLED;
>
> Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
> Signed-off-by: Jakub Slepecki <jakub.slepecki@intel.com>
> ---
> drivers/net/ethernet/intel/ice/ice_switch.c | 21 +++++++++++++-------
> - drivers/net/ethernet/intel/ice/ice_switch.h | 7 +++++++
> 2 files changed, 20 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/ice/ice_switch.c
> b/drivers/net/ethernet/intel/ice/ice_switch.c
> index 04e5d653efce..7b63588948fd 100644
> --- a/drivers/net/ethernet/intel/ice/ice_switch.c
> +++ b/drivers/net/ethernet/intel/ice/ice_switch.c
> @@ -2538,8 +2538,9 @@ int ice_get_initial_sw_cfg(struct ice_hw *hw)
> */
> static void ice_fill_sw_info(struct ice_hw *hw, struct ice_fltr_info
> *fi) {
> - fi->lb_en = false;
> - fi->lan_en = false;
> + bool lan_en = false;
> + bool lb_en = false;
> +
> if ((fi->flag & ICE_FLTR_TX) &&
> (fi->fltr_act == ICE_FWD_TO_VSI ||
> fi->fltr_act == ICE_FWD_TO_VSI_LIST || @@ -2549,7 +2550,7
> @@ static void ice_fill_sw_info(struct ice_hw *hw, struct
> ice_fltr_info *fi)
> * packets to the internal switch that will be dropped.
> */
> if (fi->lkup_type != ICE_SW_LKUP_VLAN)
> - fi->lb_en = true;
> + lb_en = true;
>
> /* Set lan_en to TRUE if
> * 1. The switch is a VEB AND
> @@ -2578,14 +2579,18 @@ static void ice_fill_sw_info(struct ice_hw
> *hw, struct ice_fltr_info *fi)
> !is_unicast_ether_addr(fi-
> >l_data.mac.mac_addr)) ||
> (fi->lkup_type == ICE_SW_LKUP_MAC_VLAN &&
> !is_unicast_ether_addr(fi-
> >l_data.mac.mac_addr)))
> - fi->lan_en = true;
> + lan_en = true;
> } else {
> - fi->lan_en = true;
> + lan_en = true;
> }
> }
>
> if (fi->flag & ICE_FLTR_TX_ONLY)
> - fi->lan_en = false;
> + lan_en = false;
> + if (!(fi->lb_en & ICE_FLTR_INFO_LB_LAN_FORCE_MASK))
> + fi->lb_en = lb_en;
> + if (!(fi->lan_en & ICE_FLTR_INFO_LB_LAN_FORCE_MASK))
> + fi->lan_en = lan_en;
For me it looks strange.
What type the fi->lb_en has?
fi->lb_en declared as bool, and you assign fi->lan_en from bool.
But you check condition by fi->lan_en & ICE_FLTR_INFO_LB_LAN_FORCE_MASK ?
It rases questions if fi->lan_en a bool why use fi->lan_en & ICE_FLTR_INFO_LB_LAN_FORCE_MASK then?
And if fi->lan_en is a bitmask why not use FIELD_GET(ICE_FLTR_INFO_LB_LAN_FORCE_MASK, fi->lan_en) and
why not something like:
if (!FIELD_GET(ICE_FLTR_INFO_LB_LAN_FORCE_MASK, fi->lan_en))
FIELD_MODIFY(ICE_FLTR_INFO_LB_LAN_VALUE_MASK, &fi->lan_en, lan_en);
It could preserve unrelated bits (like FORCE) and make the code resilient to future changes in bit positions?
> }
>
> /**
> @@ -2669,9 +2674,9 @@ ice_fill_sw_rule(struct ice_hw *hw, struct
> ice_fltr_info *f_info,
> return;
> }
>
> - if (f_info->lb_en)
> + if (f_info->lb_en & ICE_FLTR_INFO_LB_LAN_VALUE_MASK)
> act |= ICE_SINGLE_ACT_LB_ENABLE;
> - if (f_info->lan_en)
> + if (f_info->lan_en & ICE_FLTR_INFO_LB_LAN_VALUE_MASK)
> act |= ICE_SINGLE_ACT_LAN_ENABLE;
>
> switch (f_info->lkup_type) {
> diff --git a/drivers/net/ethernet/intel/ice/ice_switch.h
> b/drivers/net/ethernet/intel/ice/ice_switch.h
> index 671d7a5f359f..a7dc4bfec3a0 100644
> --- a/drivers/net/ethernet/intel/ice/ice_switch.h
> +++ b/drivers/net/ethernet/intel/ice/ice_switch.h
> @@ -72,6 +72,13 @@ enum ice_src_id {
> ICE_SRC_ID_LPORT,
> };
>
> +#define ICE_FLTR_INFO_LB_LAN_VALUE_MASK BIT(0) #define
> +ICE_FLTR_INFO_LB_LAN_FORCE_MASK BIT(1)
> +#define ICE_FLTR_INFO_LB_LAN_FORCE_ENABLED \
> + (ICE_FLTR_INFO_LB_LAN_VALUE_MASK | \
> + ICE_FLTR_INFO_LB_LAN_FORCE_MASK)
> +#define ICE_FLTR_INFO_LB_LAN_FORCE_DISABLED
> +ICE_FLTR_INFO_LB_LAN_FORCE_MASK
> +
> struct ice_fltr_info {
> /* Look up information: how to look up packet */
> enum ice_sw_lkup_type lkup_type;
> --
> 2.43.0
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [Intel-wired-lan] [PATCH iwl-next 4/8] ice: allow overriding lan_en, lb_en in switch
2025-11-21 9:21 ` Loktionov, Aleksandr
@ 2025-11-24 10:20 ` Jakub Slepecki
0 siblings, 0 replies; 13+ messages in thread
From: Jakub Slepecki @ 2025-11-24 10:20 UTC (permalink / raw)
To: Loktionov, Aleksandr, intel-wired-lan@lists.osuosl.org
Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
Kitszel, Przemyslaw, Nguyen, Anthony L,
michal.swiatkowski@linux.intel.com
On 2025-11-21 10:21, Loktionov, Aleksandr wrote:
>> -----Original Message-----
>> diff --git a/drivers/net/ethernet/intel/ice/ice_switch.c
>> b/drivers/net/ethernet/intel/ice/ice_switch.c
>> index 04e5d653efce..7b63588948fd 100644
>> --- a/drivers/net/ethernet/intel/ice/ice_switch.c
>> +++ b/drivers/net/ethernet/intel/ice/ice_switch.c
>> @@ -2538,8 +2538,9 @@ int ice_get_initial_sw_cfg(struct ice_hw *hw)
>> */
>> static void ice_fill_sw_info(struct ice_hw *hw, struct ice_fltr_info
>> *fi) {
>> - fi->lb_en = false;
>> - fi->lan_en = false;
>> + bool lan_en = false;
>> + bool lb_en = false;
>> +
>> if ((fi->flag & ICE_FLTR_TX) &&
>> (fi->fltr_act == ICE_FWD_TO_VSI ||
>> fi->fltr_act == ICE_FWD_TO_VSI_LIST || @@ -2549,7 +2550,7
>> @@ static void ice_fill_sw_info(struct ice_hw *hw, struct
>> ice_fltr_info *fi)
>> * packets to the internal switch that will be dropped.
>> */
>> if (fi->lkup_type != ICE_SW_LKUP_VLAN)
>> - fi->lb_en = true;
>> + lb_en = true;
>>
>> /* Set lan_en to TRUE if
>> * 1. The switch is a VEB AND
>> @@ -2578,14 +2579,18 @@ static void ice_fill_sw_info(struct ice_hw
>> *hw, struct ice_fltr_info *fi)
>> !is_unicast_ether_addr(fi-
>>> l_data.mac.mac_addr)) ||
>> (fi->lkup_type == ICE_SW_LKUP_MAC_VLAN &&
>> !is_unicast_ether_addr(fi-
>>> l_data.mac.mac_addr)))
>> - fi->lan_en = true;
>> + lan_en = true;
>> } else {
>> - fi->lan_en = true;
>> + lan_en = true;
>> }
>> }
>>
>> if (fi->flag & ICE_FLTR_TX_ONLY)
>> - fi->lan_en = false;
>> + lan_en = false;
>> + if (!(fi->lb_en & ICE_FLTR_INFO_LB_LAN_FORCE_MASK))
>> + fi->lb_en = lb_en;
>> + if (!(fi->lan_en & ICE_FLTR_INFO_LB_LAN_FORCE_MASK))
>> + fi->lan_en = lan_en;
> For me it looks strange.
> What type the fi->lb_en has?
> fi->lb_en declared as bool, and you assign fi->lan_en from bool.
> But you check condition by fi->lan_en & ICE_FLTR_INFO_LB_LAN_FORCE_MASK ?
I agree this can look strange. lb_en and lan_en are both u8 in
ice_switch.h:/^struct ice_fltr_info/ and we assign them from bool.
Before, even though we had the same implicit conversion bool -> u8 we
did not use either of u8s to hold anything else.
> It rases questions if fi->lan_en a bool why use fi->lan_en & ICE_FLTR_INFO_LB_LAN_FORCE_MASK then?
> And if fi->lan_en is a bitmask why not use FIELD_GET(ICE_FLTR_INFO_LB_LAN_FORCE_MASK, fi->lan_en) and
> why not something like:
>
> if (!FIELD_GET(ICE_FLTR_INFO_LB_LAN_FORCE_MASK, fi->lan_en))
> FIELD_MODIFY(ICE_FLTR_INFO_LB_LAN_VALUE_MASK, &fi->lan_en, lan_en);
>
> It could preserve unrelated bits (like FORCE) and make the code resilient to future changes in bit positions?
The latter. Original intention, one of, was to avoid implying this
can be extended, because it should not: for better customization we
have "advanced" rules, and "simple" rules shouldn't try to chase them.
Instead, porting everything to "advanced" rules would be more reasonable.
I make an exception here, because cost of any other option is way higher.
That being said, I don't see any reason to not use
FIELD_{GET,PREP,MODIFY}. I will modify this accordingly across the
series.
Thanks!
>> }
>>
>> /**
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Intel-wired-lan] [PATCH iwl-next 5/8] ice: update mac, vlan rules when toggling between VEB and VEPA
2025-11-20 16:28 [Intel-wired-lan] [PATCH iwl-next 0/8] ice: in VEB, prevent "cross-vlan" traffic Jakub Slepecki
` (3 preceding siblings ...)
2025-11-20 16:28 ` [Intel-wired-lan] [PATCH iwl-next 4/8] ice: allow overriding lan_en, lb_en in switch Jakub Slepecki
@ 2025-11-20 16:28 ` Jakub Slepecki
2025-11-21 8:54 ` Loktionov, Aleksandr
2025-11-20 16:28 ` [Intel-wired-lan] [PATCH iwl-next 6/8] ice: add functions to query for vsi's pvids Jakub Slepecki
` (2 subsequent siblings)
7 siblings, 1 reply; 13+ messages in thread
From: Jakub Slepecki @ 2025-11-20 16:28 UTC (permalink / raw)
To: intel-wired-lan
Cc: linux-kernel, netdev, przemyslaw.kitszel, anthony.l.nguyen,
michal.swiatkowski, jakub.slepecki
When changing into VEPA mode MAC rules are modified to forward all traffic
to the wire instead of allowing some packets to go into the loopback.
MAC,VLAN rules may and will also be used to forward loopback traffic
in VEB, so when we switch to VEPA, we want them to behave similarly to
MAC-only rules.
Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Signed-off-by: Jakub Slepecki <jakub.slepecki@intel.com>
---
drivers/net/ethernet/intel/ice/ice_main.c | 38 ++++++++++++++++-----
drivers/net/ethernet/intel/ice/ice_switch.c | 8 +++--
drivers/net/ethernet/intel/ice/ice_switch.h | 3 +-
3 files changed, 37 insertions(+), 12 deletions(-)
diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
index 0b6175ade40d..661af039bf4f 100644
--- a/drivers/net/ethernet/intel/ice/ice_main.c
+++ b/drivers/net/ethernet/intel/ice/ice_main.c
@@ -8115,8 +8115,8 @@ ice_bridge_setlink(struct net_device *dev, struct nlmsghdr *nlh,
struct ice_pf *pf = ice_netdev_to_pf(dev);
struct nlattr *attr, *br_spec;
struct ice_hw *hw = &pf->hw;
+ int rem, v, rb_err, err = 0;
struct ice_sw *pf_sw;
- int rem, v, err = 0;
pf_sw = pf->first_sw;
/* find the attribute in the netlink message */
@@ -8126,6 +8126,7 @@ ice_bridge_setlink(struct net_device *dev, struct nlmsghdr *nlh,
nla_for_each_nested_type(attr, IFLA_BRIDGE_MODE, br_spec, rem) {
__u16 mode = nla_get_u16(attr);
+ u8 old_evb_veb = hw->evb_veb;
if (mode != BRIDGE_MODE_VEPA && mode != BRIDGE_MODE_VEB)
return -EINVAL;
@@ -8147,17 +8148,38 @@ ice_bridge_setlink(struct net_device *dev, struct nlmsghdr *nlh,
/* Update the unicast switch filter rules for the corresponding
* switch of the netdev
*/
- err = ice_update_sw_rule_bridge_mode(hw);
+ err = ice_update_sw_rule_bridge_mode(hw, ICE_SW_LKUP_MAC);
if (err) {
- netdev_err(dev, "switch rule update failed, mode = %d err %d aq_err %s\n",
- mode, err,
+ /* evb_veb is expected to be already reverted in error
+ * path because of the potential rollback.
+ */
+ hw->evb_veb = old_evb_veb;
+ goto err_without_rollback;
+ }
+ err = ice_update_sw_rule_bridge_mode(hw, ICE_SW_LKUP_MAC_VLAN);
+ if (err) {
+ /* ice_update_sw_rule_bridge_mode looks this up, so we
+ * must revert it before attempting a rollback.
+ */
+ hw->evb_veb = old_evb_veb;
+ goto err_rollback_mac;
+ }
+ pf_sw->bridge_mode = mode;
+ continue;
+
+err_rollback_mac:
+ rb_err = ice_update_sw_rule_bridge_mode(hw, ICE_SW_LKUP_MAC);
+ if (rb_err) {
+ netdev_err(dev, "switch rule update failed, mode = %d err %d; rollback failed, err %d aq_err %s\n",
+ mode, err, rb_err,
libie_aq_str(hw->adminq.sq_last_status));
- /* revert hw->evb_veb */
- hw->evb_veb = (pf_sw->bridge_mode == BRIDGE_MODE_VEB);
- return err;
+ return rb_err;
}
- pf_sw->bridge_mode = mode;
+err_without_rollback:
+ netdev_err(dev, "switch rule update failed, mode = %d err %d aq_err %s\n",
+ mode, err, libie_aq_str(hw->adminq.sq_last_status));
+ return err;
}
return 0;
diff --git a/drivers/net/ethernet/intel/ice/ice_switch.c b/drivers/net/ethernet/intel/ice/ice_switch.c
index 7b63588948fd..b1445dfb1b64 100644
--- a/drivers/net/ethernet/intel/ice/ice_switch.c
+++ b/drivers/net/ethernet/intel/ice/ice_switch.c
@@ -3065,10 +3065,12 @@ ice_update_pkt_fwd_rule(struct ice_hw *hw, struct ice_fltr_info *f_info)
/**
* ice_update_sw_rule_bridge_mode
* @hw: pointer to the HW struct
+ * @lkup: recipe/lookup type to update
*
* Updates unicast switch filter rules based on VEB/VEPA mode
*/
-int ice_update_sw_rule_bridge_mode(struct ice_hw *hw)
+int ice_update_sw_rule_bridge_mode(struct ice_hw *hw,
+ enum ice_sw_lkup_type lkup)
{
struct ice_switch_info *sw = hw->switch_info;
struct ice_fltr_mgmt_list_entry *fm_entry;
@@ -3076,8 +3078,8 @@ int ice_update_sw_rule_bridge_mode(struct ice_hw *hw)
struct mutex *rule_lock; /* Lock to protect filter rule list */
int status = 0;
- rule_lock = &sw->recp_list[ICE_SW_LKUP_MAC].filt_rule_lock;
- rule_head = &sw->recp_list[ICE_SW_LKUP_MAC].filt_rules;
+ rule_lock = &sw->recp_list[lkup].filt_rule_lock;
+ rule_head = &sw->recp_list[lkup].filt_rules;
mutex_lock(rule_lock);
list_for_each_entry(fm_entry, rule_head, list_entry) {
diff --git a/drivers/net/ethernet/intel/ice/ice_switch.h b/drivers/net/ethernet/intel/ice/ice_switch.h
index a7dc4bfec3a0..60527475959b 100644
--- a/drivers/net/ethernet/intel/ice/ice_switch.h
+++ b/drivers/net/ethernet/intel/ice/ice_switch.h
@@ -360,7 +360,8 @@ int
ice_add_adv_rule(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups,
u16 lkups_cnt, struct ice_adv_rule_info *rinfo,
struct ice_rule_query_data *added_entry);
-int ice_update_sw_rule_bridge_mode(struct ice_hw *hw);
+int ice_update_sw_rule_bridge_mode(struct ice_hw *hw,
+ enum ice_sw_lkup_type lkup);
int ice_add_vlan(struct ice_hw *hw, struct list_head *m_list);
int ice_remove_vlan(struct ice_hw *hw, struct list_head *v_list);
int ice_add_mac(struct ice_hw *hw, struct list_head *m_lst);
--
2.43.0
^ permalink raw reply related [flat|nested] 13+ messages in thread* Re: [Intel-wired-lan] [PATCH iwl-next 5/8] ice: update mac, vlan rules when toggling between VEB and VEPA
2025-11-20 16:28 ` [Intel-wired-lan] [PATCH iwl-next 5/8] ice: update mac, vlan rules when toggling between VEB and VEPA Jakub Slepecki
@ 2025-11-21 8:54 ` Loktionov, Aleksandr
2025-11-21 9:25 ` Jakub Slepecki
0 siblings, 1 reply; 13+ messages in thread
From: Loktionov, Aleksandr @ 2025-11-21 8:54 UTC (permalink / raw)
To: Slepecki, Jakub, intel-wired-lan@lists.osuosl.org
Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
Kitszel, Przemyslaw, Nguyen, Anthony L,
michal.swiatkowski@linux.intel.com, Slepecki, Jakub
> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf
> Of Jakub Slepecki
> Sent: Thursday, November 20, 2025 5:28 PM
> To: intel-wired-lan@lists.osuosl.org
> Cc: linux-kernel@vger.kernel.org; netdev@vger.kernel.org; Kitszel,
> Przemyslaw <przemyslaw.kitszel@intel.com>; Nguyen, Anthony L
> <anthony.l.nguyen@intel.com>; michal.swiatkowski@linux.intel.com;
> Slepecki, Jakub <jakub.slepecki@intel.com>
> Subject: [Intel-wired-lan] [PATCH iwl-next 5/8] ice: update mac, vlan
> rules when toggling between VEB and VEPA
>
> When changing into VEPA mode MAC rules are modified to forward all
> traffic to the wire instead of allowing some packets to go into the
> loopback.
> MAC,VLAN rules may and will also be used to forward loopback traffic
> in VEB, so when we switch to VEPA, we want them to behave similarly to
> MAC-only rules.
Is it possible to verify from shell? Could be nice to add exact steps to reproduce/verify.
>
> Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
> Signed-off-by: Jakub Slepecki <jakub.slepecki@intel.com>
> ---
> drivers/net/ethernet/intel/ice/ice_main.c | 38 ++++++++++++++++----
> -
> drivers/net/ethernet/intel/ice/ice_switch.c | 8 +++--
> drivers/net/ethernet/intel/ice/ice_switch.h | 3 +-
> 3 files changed, 37 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/ice/ice_main.c
> b/drivers/net/ethernet/intel/ice/ice_main.c
> index 0b6175ade40d..661af039bf4f 100644
> --- a/drivers/net/ethernet/intel/ice/ice_main.c
> +++ b/drivers/net/ethernet/intel/ice/ice_main.c
> @@ -8115,8 +8115,8 @@ ice_bridge_setlink(struct net_device *dev,
> struct nlmsghdr *nlh,
> struct ice_pf *pf = ice_netdev_to_pf(dev);
> struct nlattr *attr, *br_spec;
> struct ice_hw *hw = &pf->hw;
> + int rem, v, rb_err, err = 0;
> struct ice_sw *pf_sw;
> - int rem, v, err = 0;
>
> pf_sw = pf->first_sw;
> /* find the attribute in the netlink message */ @@ -8126,6
> +8126,7 @@ ice_bridge_setlink(struct net_device *dev, struct nlmsghdr
> *nlh,
>
> nla_for_each_nested_type(attr, IFLA_BRIDGE_MODE, br_spec, rem)
> {
> __u16 mode = nla_get_u16(attr);
> + u8 old_evb_veb = hw->evb_veb;
>
> if (mode != BRIDGE_MODE_VEPA && mode != BRIDGE_MODE_VEB)
> return -EINVAL;
> @@ -8147,17 +8148,38 @@ ice_bridge_setlink(struct net_device *dev,
> struct nlmsghdr *nlh,
> /* Update the unicast switch filter rules for the
> corresponding
> * switch of the netdev
> */
> - err = ice_update_sw_rule_bridge_mode(hw);
> + err = ice_update_sw_rule_bridge_mode(hw,
> ICE_SW_LKUP_MAC);
> if (err) {
> - netdev_err(dev, "switch rule update failed, mode
> = %d err %d aq_err %s\n",
> - mode, err,
> + /* evb_veb is expected to be already reverted in
> error
> + * path because of the potential rollback.
> + */
> + hw->evb_veb = old_evb_veb;
> + goto err_without_rollback;
> + }
> + err = ice_update_sw_rule_bridge_mode(hw,
> ICE_SW_LKUP_MAC_VLAN);
> + if (err) {
> + /* ice_update_sw_rule_bridge_mode looks this up,
> so we
> + * must revert it before attempting a rollback.
> + */
> + hw->evb_veb = old_evb_veb;
> + goto err_rollback_mac;
> + }
> + pf_sw->bridge_mode = mode;
> + continue;
> +
> +err_rollback_mac:
> + rb_err = ice_update_sw_rule_bridge_mode(hw,
> ICE_SW_LKUP_MAC);
> + if (rb_err) {
> + netdev_err(dev, "switch rule update failed, mode
> = %d err %d; rollback failed, err %d aq_err %s\n",
> + mode, err, rb_err,
> libie_aq_str(hw-
> >adminq.sq_last_status));
> - /* revert hw->evb_veb */
> - hw->evb_veb = (pf_sw->bridge_mode ==
> BRIDGE_MODE_VEB);
> - return err;
> + return rb_err;
On rollback failure you now return `rb_err` instead of the original `err`.
This is a visible semantic change.
Please justify it in the commit message (and confirm callers expect rollback status rather than the original failure).
> }
>
> - pf_sw->bridge_mode = mode;
> +err_without_rollback:
> + netdev_err(dev, "switch rule update failed, mode = %d
> err %d aq_err %s\n",
> + mode, err, libie_aq_str(hw-
> >adminq.sq_last_status));
> + return err;
> }
>
> return 0;
> diff --git a/drivers/net/ethernet/intel/ice/ice_switch.c
> b/drivers/net/ethernet/intel/ice/ice_switch.c
> index 7b63588948fd..b1445dfb1b64 100644
> --- a/drivers/net/ethernet/intel/ice/ice_switch.c
> +++ b/drivers/net/ethernet/intel/ice/ice_switch.c
> @@ -3065,10 +3065,12 @@ ice_update_pkt_fwd_rule(struct ice_hw *hw,
> struct ice_fltr_info *f_info)
> /**
> * ice_update_sw_rule_bridge_mode
> * @hw: pointer to the HW struct
> + * @lkup: recipe/lookup type to update
> *
> * Updates unicast switch filter rules based on VEB/VEPA mode
> */
> -int ice_update_sw_rule_bridge_mode(struct ice_hw *hw)
> +int ice_update_sw_rule_bridge_mode(struct ice_hw *hw,
> + enum ice_sw_lkup_type lkup)
> {
> struct ice_switch_info *sw = hw->switch_info;
> struct ice_fltr_mgmt_list_entry *fm_entry; @@ -3076,8 +3078,8
> @@ int ice_update_sw_rule_bridge_mode(struct ice_hw *hw)
> struct mutex *rule_lock; /* Lock to protect filter rule list */
> int status = 0;
>
> - rule_lock = &sw->recp_list[ICE_SW_LKUP_MAC].filt_rule_lock;
> - rule_head = &sw->recp_list[ICE_SW_LKUP_MAC].filt_rules;
> + rule_lock = &sw->recp_list[lkup].filt_rule_lock;
> + rule_head = &sw->recp_list[lkup].filt_rules;
>
> mutex_lock(rule_lock);
> list_for_each_entry(fm_entry, rule_head, list_entry) { diff --
> git a/drivers/net/ethernet/intel/ice/ice_switch.h
> b/drivers/net/ethernet/intel/ice/ice_switch.h
> index a7dc4bfec3a0..60527475959b 100644
> --- a/drivers/net/ethernet/intel/ice/ice_switch.h
> +++ b/drivers/net/ethernet/intel/ice/ice_switch.h
> @@ -360,7 +360,8 @@ int
> ice_add_adv_rule(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups,
> u16 lkups_cnt, struct ice_adv_rule_info *rinfo,
> struct ice_rule_query_data *added_entry); -int
> ice_update_sw_rule_bridge_mode(struct ice_hw *hw);
> +int ice_update_sw_rule_bridge_mode(struct ice_hw *hw,
> + enum ice_sw_lkup_type lkup);
> int ice_add_vlan(struct ice_hw *hw, struct list_head *m_list); int
> ice_remove_vlan(struct ice_hw *hw, struct list_head *v_list); int
> ice_add_mac(struct ice_hw *hw, struct list_head *m_lst);
> --
> 2.43.0
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [Intel-wired-lan] [PATCH iwl-next 5/8] ice: update mac, vlan rules when toggling between VEB and VEPA
2025-11-21 8:54 ` Loktionov, Aleksandr
@ 2025-11-21 9:25 ` Jakub Slepecki
0 siblings, 0 replies; 13+ messages in thread
From: Jakub Slepecki @ 2025-11-21 9:25 UTC (permalink / raw)
To: Loktionov, Aleksandr, intel-wired-lan@lists.osuosl.org
Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
Kitszel, Przemyslaw, Nguyen, Anthony L,
michal.swiatkowski@linux.intel.com
On 2025-11-21 9:54, Loktionov, Aleksandr wrote:
>> -----Original Message-----
>> When changing into VEPA mode MAC rules are modified to forward all
>> traffic to the wire instead of allowing some packets to go into the
>> loopback.
>> MAC,VLAN rules may and will also be used to forward loopback traffic
>> in VEB, so when we switch to VEPA, we want them to behave similarly to
>> MAC-only rules.
> Is it possible to verify from shell? Could be nice to add exact steps to reproduce/verify.
It's not straightforward. The easiest way is to observe traffic on the
wire (or lack of thereof). For my testing, I have a patch that:
# cat /sys/kernel/debug/ice/0000:45:00.0/switch_rules
lkup=0x0, id=8207, flag=0x0001, action=0x0, lan=no, lb=no, count=1, mac=00:00:00:00:00:00, ethertype=0x88cc
lkup=0x0, id=20509, flag=0x0002, action=0x4, lan=no, lb=no, count=1, mac=00:00:00:00:00:00, ethertype=0x88cc
lkup=0x0, id=24593, flag=0x0002, action=0x4, lan=no, lb=no, count=1, mac=00:00:00:00:00:00, ethertype=0x8808
lkup=0x1, id=14353, flag=0x0002, action=0x0, lan=yes, lb=yes, count=1, mac=33:33:ff:0b:64:f2
lkup=0x1, id=18456, flag=0x0002, action=0x0, lan=yes, lb=yes, count=1, mac=33:33:ff:df:a9:13
lkup=0x1, id=24594, flag=0x0002, action=0x0, lan=yes, lb=yes, count=1, mac=33:33:ff:f0:75:00
lkup=0x1, id=4108, flag=0x0002, action=0x1, lan=yes, lb=yes, count=3, mac=01:00:5e:00:00:01
lkup=0x1, id=6156, flag=0x0002, action=0x1, lan=yes, lb=yes, count=3, mac=33:33:00:00:00:01
lkup=0x1, id=8208, flag=0x0002, action=0x0, lan=no, lb=yes, count=1, mac=22:0a:5b:f0:75:00
lkup=0x1, id=22538, flag=0x0002, action=0x0, lan=no, lb=yes, count=1, mac=ba:d1:81:0b:64:f2
lkup=0x1, id=18455, flag=0x0002, action=0x0, lan=no, lb=yes, count=1, mac=d6:3b:b5:df:a9:13
lkup=0x1, id=2056, flag=0x0002, action=0x1, lan=yes, lb=yes, count=3, mac=ff:ff:ff:ff:ff:ff
lkup=0x4, id=26632, flag=0x0002, action=0x1, lan=yes, lb=no, count=3, tpid=0x8100, valid=yes, vlan=0
lkup=0x4, id=9, flag=0x0002, action=0x1, lan=yes, lb=no, count=3, tpid=0x0000, valid=yes, vlan=0
I could RFC it here or on e1000 if it seems useful. Otherwise, one
could enable and pay (very close) attention to 0x02A[01] commands.
I'll try to write something to clear it up in the commit message.
>> diff --git a/drivers/net/ethernet/intel/ice/ice_main.c
>> b/drivers/net/ethernet/intel/ice/ice_main.c
>> index 0b6175ade40d..661af039bf4f 100644
>> --- a/drivers/net/ethernet/intel/ice/ice_main.c
>> +++ b/drivers/net/ethernet/intel/ice/ice_main.c
>> @@ -8147,17 +8148,38 @@ ice_bridge_setlink(struct net_device *dev,
>> struct nlmsghdr *nlh,
>> /* Update the unicast switch filter rules for the
>> corresponding
>> * switch of the netdev
>> */
>> - err = ice_update_sw_rule_bridge_mode(hw);
>> + err = ice_update_sw_rule_bridge_mode(hw,
>> ICE_SW_LKUP_MAC);
>> if (err) {
>> - netdev_err(dev, "switch rule update failed, mode
>> = %d err %d aq_err %s\n",
>> - mode, err,
>> + /* evb_veb is expected to be already reverted in
>> error
>> + * path because of the potential rollback.
>> + */
>> + hw->evb_veb = old_evb_veb;
>> + goto err_without_rollback;
>> + }
>> + err = ice_update_sw_rule_bridge_mode(hw,
>> ICE_SW_LKUP_MAC_VLAN);
>> + if (err) {
>> + /* ice_update_sw_rule_bridge_mode looks this up,
>> so we
>> + * must revert it before attempting a rollback.
>> + */
>> + hw->evb_veb = old_evb_veb;
>> + goto err_rollback_mac;
>> + }
>> + pf_sw->bridge_mode = mode;
>> + continue;
>> +
>> +err_rollback_mac:
>> + rb_err = ice_update_sw_rule_bridge_mode(hw,
>> ICE_SW_LKUP_MAC);
>> + if (rb_err) {
>> + netdev_err(dev, "switch rule update failed, mode
>> = %d err %d; rollback failed, err %d aq_err %s\n",
>> + mode, err, rb_err,
>> libie_aq_str(hw-
>>> adminq.sq_last_status));
>> - /* revert hw->evb_veb */
>> - hw->evb_veb = (pf_sw->bridge_mode ==
>> BRIDGE_MODE_VEB);
>> - return err;
>> + return rb_err;
> On rollback failure you now return `rb_err` instead of the original `err`.
> This is a visible semantic change.
> Please justify it in the commit message (and confirm callers expect rollback status rather than the original failure).
Agreed. I'll see if function documentation would need a refresh for
this, too.
Thanks!
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Intel-wired-lan] [PATCH iwl-next 6/8] ice: add functions to query for vsi's pvids
2025-11-20 16:28 [Intel-wired-lan] [PATCH iwl-next 0/8] ice: in VEB, prevent "cross-vlan" traffic Jakub Slepecki
` (4 preceding siblings ...)
2025-11-20 16:28 ` [Intel-wired-lan] [PATCH iwl-next 5/8] ice: update mac, vlan rules when toggling between VEB and VEPA Jakub Slepecki
@ 2025-11-20 16:28 ` Jakub Slepecki
2025-11-20 16:28 ` [Intel-wired-lan] [PATCH iwl-next 7/8] ice: add mac vlan to filter API Jakub Slepecki
2025-11-20 16:28 ` [Intel-wired-lan] [PATCH iwl-next 8/8] ice: in VEB, prevent "cross-vlan" traffic from hitting loopback Jakub Slepecki
7 siblings, 0 replies; 13+ messages in thread
From: Jakub Slepecki @ 2025-11-20 16:28 UTC (permalink / raw)
To: intel-wired-lan
Cc: linux-kernel, netdev, przemyslaw.kitszel, anthony.l.nguyen,
michal.swiatkowski, jakub.slepecki
PVID information is set across two structs and several members depending
primarily on DVM support and VSI type. This commit adds function that
guess whether PVID is set and where and allow to access raw VLAN ID set.
This is intended to be used later on to decide what MAC{,VLAN} filters
to set for a VSI.
Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: Jakub Slepecki <jakub.slepecki@intel.com>
---
drivers/net/ethernet/intel/ice/ice_lib.c | 56 ++++++++++++++++++++++++
drivers/net/ethernet/intel/ice/ice_lib.h | 2 +
2 files changed, 58 insertions(+)
diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c
index 44f3c2bab308..55ba043f8f5e 100644
--- a/drivers/net/ethernet/intel/ice/ice_lib.c
+++ b/drivers/net/ethernet/intel/ice/ice_lib.c
@@ -4059,3 +4059,59 @@ void ice_vsi_update_l2tsel(struct ice_vsi *vsi, enum ice_l2tsel l2tsel)
wr32(hw, qrx_context_offset, regval);
}
}
+
+/**
+ * ice_vsi_has_outer_pvid - check if VSI has outer Port VLAN ID assigned
+ * @info: props of VSI in question
+ *
+ * Return: true if VSI has outer PVID, false otherwise.
+ */
+static bool
+ice_vsi_has_outer_pvid(const struct ice_aqc_vsi_props *info)
+{
+ return info->outer_vlan_flags & ICE_AQ_VSI_OUTER_VLAN_PORT_BASED_INSERT;
+}
+
+/**
+ * ice_vsi_has_inner_pvid - check if VSI has inner Port VLAN ID assigned
+ * @info: props of VSI in question
+ *
+ * Return: true if VSI has inner PVID, false otherwise.
+ */
+static bool
+ice_vsi_has_inner_pvid(const struct ice_aqc_vsi_props *info)
+{
+ return info->inner_vlan_flags & ICE_AQ_VSI_INNER_VLAN_INSERT_PVID;
+}
+
+/**
+ * ice_vsi_has_pvid - check if VSI has Port VLAN ID assigned
+ * @vsi: VSI in question
+ *
+ * Return: true if VSI has either outer or inner PVID, false otherwise.
+ */
+bool
+ice_vsi_has_pvid(struct ice_vsi *vsi)
+{
+ return ice_vsi_has_outer_pvid(&vsi->info) ||
+ ice_vsi_has_inner_pvid(&vsi->info);
+}
+
+/**
+ * ice_vsi_pvid - retrieve VSI's Port VLAN ID
+ * @vsi: VSI in question
+ *
+ * Return: VSI's PVID; it is valid only if ice_vsi_has_pvid is true.
+ */
+u16
+ice_vsi_pvid(struct ice_vsi *vsi)
+{
+ __le16 vlan_info = 0;
+
+ if (ice_vsi_has_outer_pvid(&vsi->info))
+ vlan_info = vsi->info.port_based_outer_vlan;
+ else if (ice_vsi_has_inner_pvid(&vsi->info))
+ vlan_info = vsi->info.port_based_inner_vlan;
+
+ return le16_to_cpu(vlan_info) & VLAN_VID_MASK;
+}
diff --git a/drivers/net/ethernet/intel/ice/ice_lib.h b/drivers/net/ethernet/intel/ice/ice_lib.h
index 2cb1eb98b9da..c28c69963946 100644
--- a/drivers/net/ethernet/intel/ice/ice_lib.h
+++ b/drivers/net/ethernet/intel/ice/ice_lib.h
@@ -124,4 +124,6 @@ void ice_clear_feature_support(struct ice_pf *pf, enum ice_feature f);
void ice_init_feature_support(struct ice_pf *pf);
bool ice_vsi_is_rx_queue_active(struct ice_vsi *vsi);
void ice_vsi_update_l2tsel(struct ice_vsi *vsi, enum ice_l2tsel l2tsel);
+bool ice_vsi_has_pvid(struct ice_vsi *vsi);
+u16 ice_vsi_pvid(struct ice_vsi *vsi);
#endif /* !_ICE_LIB_H_ */
--
2.43.0
^ permalink raw reply related [flat|nested] 13+ messages in thread* [Intel-wired-lan] [PATCH iwl-next 7/8] ice: add mac vlan to filter API
2025-11-20 16:28 [Intel-wired-lan] [PATCH iwl-next 0/8] ice: in VEB, prevent "cross-vlan" traffic Jakub Slepecki
` (5 preceding siblings ...)
2025-11-20 16:28 ` [Intel-wired-lan] [PATCH iwl-next 6/8] ice: add functions to query for vsi's pvids Jakub Slepecki
@ 2025-11-20 16:28 ` Jakub Slepecki
2025-11-20 16:28 ` [Intel-wired-lan] [PATCH iwl-next 8/8] ice: in VEB, prevent "cross-vlan" traffic from hitting loopback Jakub Slepecki
7 siblings, 0 replies; 13+ messages in thread
From: Jakub Slepecki @ 2025-11-20 16:28 UTC (permalink / raw)
To: intel-wired-lan
Cc: linux-kernel, netdev, przemyslaw.kitszel, anthony.l.nguyen,
michal.swiatkowski, jakub.slepecki
From: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Allow mac vlan filters to be managed by filters API in ice driver.
Together with mac-only filters they will be used to forward traffic
intended for loopback in VEB mode.
Signed-off-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: Jakub Slepecki <jakub.slepecki@intel.com>
---
drivers/net/ethernet/intel/ice/ice_fltr.c | 33 +++++++++++++++++++++++
drivers/net/ethernet/intel/ice/ice_fltr.h | 4 +++
2 files changed, 37 insertions(+)
diff --git a/drivers/net/ethernet/intel/ice/ice_fltr.c b/drivers/net/ethernet/intel/ice/ice_fltr.c
index aff7a141c30d..96a4e4b1b3fc 100644
--- a/drivers/net/ethernet/intel/ice/ice_fltr.c
+++ b/drivers/net/ethernet/intel/ice/ice_fltr.c
@@ -240,6 +240,39 @@ ice_fltr_add_mac_to_list(struct ice_vsi *vsi, struct list_head *list,
list);
}
+/**
+ * ice_fltr_add_mac_vlan_to_list - add MAC VLAN filter info to
+ * existing list
+ * @vsi: pointer to VSI struct
+ * @list: list to add filter info to
+ * @mac: MAC address to add
+ * @vlan_id: VLAN id to add
+ * @action: filter action
+ *
+ * Return:
+ * * 0 if entry for filter was added, or
+ * * %-ENOMEM if entry could not be allocated.
+ */
+int
+ice_fltr_add_mac_vlan_to_list(struct ice_vsi *vsi, struct list_head *list,
+ const u8 *mac, u16 vlan_id,
+ enum ice_sw_fwd_act_type action)
+{
+ struct ice_fltr_info info = {};
+
+ info.flag = ICE_FLTR_TX;
+ info.src_id = ICE_SRC_ID_VSI;
+ info.lkup_type = ICE_SW_LKUP_MAC_VLAN;
+ info.fltr_act = action;
+ info.vsi_handle = vsi->idx;
+
+ info.l_data.mac_vlan.vlan_id = vlan_id;
+ ether_addr_copy(info.l_data.mac_vlan.mac_addr, mac);
+
+ return ice_fltr_add_entry_to_list(ice_pf_to_dev(vsi->back), &info,
+ list);
+}
+
/**
* ice_fltr_add_vlan_to_list - add VLAN filter info to exsisting list
* @vsi: pointer to VSI struct
diff --git a/drivers/net/ethernet/intel/ice/ice_fltr.h b/drivers/net/ethernet/intel/ice/ice_fltr.h
index 0f3dbc308eec..fb9ffb39be50 100644
--- a/drivers/net/ethernet/intel/ice/ice_fltr.h
+++ b/drivers/net/ethernet/intel/ice/ice_fltr.h
@@ -23,6 +23,10 @@ int
ice_fltr_add_mac_to_list(struct ice_vsi *vsi, struct list_head *list,
const u8 *mac, enum ice_sw_fwd_act_type action);
int
+ice_fltr_add_mac_vlan_to_list(struct ice_vsi *vsi, struct list_head *list,
+ const u8 *mac, u16 vlan_id,
+ enum ice_sw_fwd_act_type action);
+int
ice_fltr_add_mac(struct ice_vsi *vsi, const u8 *mac,
enum ice_sw_fwd_act_type action);
int
--
2.43.0
^ permalink raw reply related [flat|nested] 13+ messages in thread* [Intel-wired-lan] [PATCH iwl-next 8/8] ice: in VEB, prevent "cross-vlan" traffic from hitting loopback
2025-11-20 16:28 [Intel-wired-lan] [PATCH iwl-next 0/8] ice: in VEB, prevent "cross-vlan" traffic Jakub Slepecki
` (6 preceding siblings ...)
2025-11-20 16:28 ` [Intel-wired-lan] [PATCH iwl-next 7/8] ice: add mac vlan to filter API Jakub Slepecki
@ 2025-11-20 16:28 ` Jakub Slepecki
7 siblings, 0 replies; 13+ messages in thread
From: Jakub Slepecki @ 2025-11-20 16:28 UTC (permalink / raw)
To: intel-wired-lan
Cc: linux-kernel, netdev, przemyslaw.kitszel, anthony.l.nguyen,
michal.swiatkowski, jakub.slepecki
In Virtual Ethernet Bridge (VEB) mode, we use MAC filters to forward
traffic between two VFs. We also use VLAN filters to prune potential
destinations, so that they don't cross VLANs. In case a VF in VLAN X
sends a packet to a MAC address matching another VF but in VLAN Y, both
these filters will be hit. Packet will be sent to loopback-only to VF
in VLAN Y, but VLAN filter will prune its VSI from the destination list
leaving the packet stranded in the internal switch and thus dropped.
Since there is no destination for the packet in the VLAN X, it should
instead be sent to the wire.
To fix this, we introduce MAC,VLAN filters in place of MAC-only filters
if VSI is part of any VLAN. We consider VSI part of a VLAN if it has a
PVID set, or if it has a specific VLAN filter and does not have a VLAN
0 filter.
This approach does not attempt to fix interactions with upper devices.
If an upper vlan device requests a separate MAC address filter resulting
in a call to __dev_uc_sync, the VSI will start receiving all packets
destined for this MAC and not just within the VLAN. I don't see a
straight-forward way to resolve this: information about MAC and VLAN
filters coming from kernel to driver is disconnected from one another
and from the device that requests it. It could be worked around by,
for example, tracking all upper devices with netdev notifications and
adjusting the filters there. The scope of this patch is hence limited
to VF traffic.
Following situations were considered for VLAN filters additions, removal,
or changes:
1. ice changes VF's vlan
2. VF is reset and rebuilt
3. vlan device attaches above a PF or a VF
And same for MAC filters:
4. PF's MAC is changed
5. PF changes MAC of a VF
6. VF's MAC is changed
7. ndo_set_rx_mode et al
When VLAN is assigned to a VF in (1), the affected VF is reset and
rebuild. This makes (1) the same as (2). We end up with two cases
where VLAN filters are added: (2) and (3).
To correctly handle (1-2), we move the VLAN filters initialization
before the MAC filters initialization, since MAC filters now depend
on VLAN filters presence. These two handle PVID (or lack of thereof)
and because they are always associated with a reset, we don't need to
consider updating MAC and MAC,VLAN filters afterwards.
In (3), we will always have a lower device that is expected to receive
all packets for its MAC regardless of VLAN tag. Because of the caveat
described above, we will do the same for each MAC address associated with
the interface regardless of VLANs. The result is we only have MAC-only
filters in this case.
When we create MAC filters in (4-7) we now check for existing VLAN
filters and depending on PVID and VLAN 0 presence we decide to create,
respectively, a MAC and MAC,VLAN filter pair, or a MAC filter. This is
done implicitly when requesting to remove old MAC and add new MAC,
so no change is required to this flow.
Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: Jakub Slepecki <jakub.slepecki@intel.com>
---
Note the /a.s. dead/ branch in ice_fltr.c. I decided to make it explicit,
but it can be merged into VLAN 0 branch as well (with or without a
comment), because their final effect is exactly the same.
---
drivers/net/ethernet/intel/ice/ice_fltr.c | 71 +++++++++++++++++++--
drivers/net/ethernet/intel/ice/ice_fltr.h | 6 +-
drivers/net/ethernet/intel/ice/ice_main.c | 8 +--
drivers/net/ethernet/intel/ice/ice_switch.c | 2 +-
drivers/net/ethernet/intel/ice/ice_switch.h | 2 +
drivers/net/ethernet/intel/ice/ice_vf_lib.c | 8 +--
6 files changed, 83 insertions(+), 14 deletions(-)
diff --git a/drivers/net/ethernet/intel/ice/ice_fltr.c b/drivers/net/ethernet/intel/ice/ice_fltr.c
index 96a4e4b1b3fc..c0fc1bced167 100644
--- a/drivers/net/ethernet/intel/ice/ice_fltr.c
+++ b/drivers/net/ethernet/intel/ice/ice_fltr.c
@@ -3,6 +3,7 @@
#include "ice.h"
#include "ice_fltr.h"
+#include "ice_lib.h"
/**
* ice_fltr_free_list - free filter lists helper
@@ -221,10 +222,12 @@ void ice_fltr_remove_all(struct ice_vsi *vsi)
* @list: list to add filter info to
* @mac: MAC address to add
* @action: filter action
+ * @external: force the filter to enable lan destination
*/
int
ice_fltr_add_mac_to_list(struct ice_vsi *vsi, struct list_head *list,
- const u8 *mac, enum ice_sw_fwd_act_type action)
+ const u8 *mac, enum ice_sw_fwd_act_type action,
+ bool external)
{
struct ice_fltr_info info = { 0 };
@@ -233,6 +236,10 @@ ice_fltr_add_mac_to_list(struct ice_vsi *vsi, struct list_head *list,
info.lkup_type = ICE_SW_LKUP_MAC;
info.fltr_act = action;
info.vsi_handle = vsi->idx;
+ if (external) {
+ info.lb_en = ICE_FLTR_INFO_LB_LAN_FORCE_ENABLED;
+ info.lan_en = ICE_FLTR_INFO_LB_LAN_FORCE_ENABLED;
+ }
ether_addr_copy(info.l_data.mac.mac_addr, mac);
@@ -273,6 +280,62 @@ ice_fltr_add_mac_vlan_to_list(struct ice_vsi *vsi, struct list_head *list,
list);
}
+/**
+ * ice_fltr_add_macs_to_list - add MAC and MAC,VLAN filters info to an existing
+ * list
+ * @vsi: pointer to VSI struct
+ * @list: list to add filter info to
+ * @mac: MAC address to add
+ * @action: filter action
+ *
+ * Return:
+ * * 0 on success, or
+ * * %-ENOMEM if entry for filter could not be allocated.
+ */
+int
+ice_fltr_add_macs_to_list(struct ice_vsi *vsi, struct list_head *list,
+ const u8 *mac, enum ice_sw_fwd_act_type action)
+{
+ if (is_multicast_ether_addr(mac)) {
+ /* There is no point in doing the same gymnastics as below
+ * because multicast addresses are sent to both lan and lb then
+ * pruned as necessary.
+ */
+ return ice_fltr_add_mac_to_list(vsi, list, mac, action, false);
+ } else if (ice_vsi_has_pvid(vsi)) {
+ u16 pvid = ice_vsi_pvid(vsi);
+ int ret;
+
+ ret = ice_fltr_add_mac_to_list(vsi, list, mac, action, true);
+ if (ret)
+ return ret;
+
+ return ice_fltr_add_mac_vlan_to_list(vsi, list, mac, pvid,
+ action);
+ } else if (vsi->num_vlan != ice_vsi_num_non_zero_vlans(vsi)) {
+ /* If VSI has VLAN 0 filters, then the interface is prepared to
+ * receive untagged packets. As of now, we simply don't have
+ * heuristics to decide which MAC is and is not part of which
+ * VLAN so we put them all in the same bucket.
+ */
+ return ice_fltr_add_mac_to_list(vsi, list, mac, action, false);
+ }
+
+ /* This branch is a.s. dead. There are three cases that may happen:
+ *
+ * - no vlans in sight; this is the VLAN 0 branch,
+ * - VF is assigned PVID; this is ice_vsi_has_pvid branch,
+ * - PF or VF is under vlan device; this is the VLAN 0 branch.
+ *
+ * This is where you would implement support for multiple VLANs but
+ * without the VLAN 0. This could happen if vlan upper device is
+ * assigned a MAC that is unique compared to lower ice device that is
+ * forced to accept any VLAN. This would imply MAC-only filter for one
+ * MAC address (PF) and MAC,VLAN+MAC filters for another (vlan).
+ */
+ return ice_fltr_add_mac_to_list(vsi, list, mac, action, false);
+}
+
/**
* ice_fltr_add_vlan_to_list - add VLAN filter info to exsisting list
* @vsi: pointer to VSI struct
@@ -343,7 +406,7 @@ ice_fltr_prepare_mac(struct ice_vsi *vsi, const u8 *mac,
LIST_HEAD(tmp_list);
int result;
- if (ice_fltr_add_mac_to_list(vsi, &tmp_list, mac, action)) {
+ if (ice_fltr_add_macs_to_list(vsi, &tmp_list, mac, action)) {
ice_fltr_free_list(ice_pf_to_dev(vsi->back), &tmp_list);
return -ENOMEM;
}
@@ -371,8 +434,8 @@ ice_fltr_prepare_mac_and_broadcast(struct ice_vsi *vsi, const u8 *mac,
int result;
eth_broadcast_addr(broadcast);
- if (ice_fltr_add_mac_to_list(vsi, &tmp_list, mac, action) ||
- ice_fltr_add_mac_to_list(vsi, &tmp_list, broadcast, action)) {
+ if (ice_fltr_add_macs_to_list(vsi, &tmp_list, mac, action) ||
+ ice_fltr_add_macs_to_list(vsi, &tmp_list, broadcast, action)) {
ice_fltr_free_list(ice_pf_to_dev(vsi->back), &tmp_list);
return -ENOMEM;
}
diff --git a/drivers/net/ethernet/intel/ice/ice_fltr.h b/drivers/net/ethernet/intel/ice/ice_fltr.h
index fb9ffb39be50..ed3371b0a71f 100644
--- a/drivers/net/ethernet/intel/ice/ice_fltr.h
+++ b/drivers/net/ethernet/intel/ice/ice_fltr.h
@@ -21,12 +21,16 @@ ice_fltr_set_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask,
u16 vid);
int
ice_fltr_add_mac_to_list(struct ice_vsi *vsi, struct list_head *list,
- const u8 *mac, enum ice_sw_fwd_act_type action);
+ const u8 *mac, enum ice_sw_fwd_act_type action,
+ bool external);
int
ice_fltr_add_mac_vlan_to_list(struct ice_vsi *vsi, struct list_head *list,
const u8 *mac, u16 vlan_id,
enum ice_sw_fwd_act_type action);
int
+ice_fltr_add_macs_to_list(struct ice_vsi *vsi, struct list_head *list,
+ const u8 *mac, enum ice_sw_fwd_act_type action);
+int
ice_fltr_add_mac(struct ice_vsi *vsi, const u8 *mac,
enum ice_sw_fwd_act_type action);
int
diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
index 661af039bf4f..8325f06c41a8 100644
--- a/drivers/net/ethernet/intel/ice/ice_main.c
+++ b/drivers/net/ethernet/intel/ice/ice_main.c
@@ -212,8 +212,8 @@ static int ice_add_mac_to_sync_list(struct net_device *netdev, const u8 *addr)
struct ice_netdev_priv *np = netdev_priv(netdev);
struct ice_vsi *vsi = np->vsi;
- if (ice_fltr_add_mac_to_list(vsi, &vsi->tmp_sync_list, addr,
- ICE_FWD_TO_VSI))
+ if (ice_fltr_add_macs_to_list(vsi, &vsi->tmp_sync_list, addr,
+ ICE_FWD_TO_VSI))
return -EINVAL;
return 0;
@@ -242,8 +242,8 @@ static int ice_add_mac_to_unsync_list(struct net_device *netdev, const u8 *addr)
if (ether_addr_equal(addr, netdev->dev_addr))
return 0;
- if (ice_fltr_add_mac_to_list(vsi, &vsi->tmp_unsync_list, addr,
- ICE_FWD_TO_VSI))
+ if (ice_fltr_add_macs_to_list(vsi, &vsi->tmp_unsync_list, addr,
+ ICE_FWD_TO_VSI))
return -EINVAL;
return 0;
diff --git a/drivers/net/ethernet/intel/ice/ice_switch.c b/drivers/net/ethernet/intel/ice/ice_switch.c
index b1445dfb1b64..ca19affbbf2a 100644
--- a/drivers/net/ethernet/intel/ice/ice_switch.c
+++ b/drivers/net/ethernet/intel/ice/ice_switch.c
@@ -4016,7 +4016,7 @@ ice_cfg_dflt_vsi(struct ice_port_info *pi, u16 vsi_handle, bool set,
* @fm_entry: filter entry to inspect
* @vsi_handle: VSI handle to compare with filter info
*/
-static bool
+bool
ice_vsi_uses_fltr(struct ice_fltr_mgmt_list_entry *fm_entry, u16 vsi_handle)
{
return ((fm_entry->fltr_info.fltr_act == ICE_FWD_TO_VSI &&
diff --git a/drivers/net/ethernet/intel/ice/ice_switch.h b/drivers/net/ethernet/intel/ice/ice_switch.h
index 60527475959b..79648f525abf 100644
--- a/drivers/net/ethernet/intel/ice/ice_switch.h
+++ b/drivers/net/ethernet/intel/ice/ice_switch.h
@@ -340,6 +340,8 @@ ice_update_vsi(struct ice_hw *hw, u16 vsi_handle, struct ice_vsi_ctx *vsi_ctx,
bool ice_is_vsi_valid(struct ice_hw *hw, u16 vsi_handle);
struct ice_vsi_ctx *ice_get_vsi_ctx(struct ice_hw *hw, u16 vsi_handle);
void ice_clear_all_vsi_ctx(struct ice_hw *hw);
+bool ice_vsi_uses_fltr(struct ice_fltr_mgmt_list_entry *fm_entry,
+ u16 vsi_handle);
/* Switch config */
int ice_get_initial_sw_cfg(struct ice_hw *hw);
diff --git a/drivers/net/ethernet/intel/ice/ice_vf_lib.c b/drivers/net/ethernet/intel/ice/ice_vf_lib.c
index de9e81ccee66..1031ce20bb60 100644
--- a/drivers/net/ethernet/intel/ice/ice_vf_lib.c
+++ b/drivers/net/ethernet/intel/ice/ice_vf_lib.c
@@ -501,14 +501,14 @@ static void ice_vf_rebuild_host_cfg(struct ice_vf *vf)
ice_vf_set_host_trust_cfg(vf);
- if (ice_vf_rebuild_host_mac_cfg(vf))
- dev_err(dev, "failed to rebuild default MAC configuration for VF %d\n",
- vf->vf_id);
-
if (ice_vf_rebuild_host_vlan_cfg(vf, vsi))
dev_err(dev, "failed to rebuild VLAN configuration for VF %u\n",
vf->vf_id);
+ if (ice_vf_rebuild_host_mac_cfg(vf))
+ dev_err(dev, "failed to rebuild default MAC configuration for VF %d\n",
+ vf->vf_id);
+
if (ice_vf_rebuild_host_tx_rate_cfg(vf))
dev_err(dev, "failed to rebuild Tx rate limiting configuration for VF %u\n",
vf->vf_id);
--
2.43.0
^ permalink raw reply related [flat|nested] 13+ messages in thread