ice: set correct dst VSI in only LAN filters
Subsystems (3)
PATCH 1/1 ice: set correct dst VSI in only LAN filters
The filters set that will reproduce the problem:
$ tc filter add dev $VF0_PR ingress protocol arp prio 0 flower \ skip_sw dst_mac ff:ff:ff:ff:ff:ff action mirred egress \ redirect dev $PF0 $ tc filter add dev $VF0_PR ingress protocol arp prio 0 flower \ skip_sw dst_mac ff:ff:ff:ff:ff:ff src_mac 52:54:00:00:00:10 \ action mirred egress mirror dev $VF1_PR
Expected behaviour is to set all broadcast from VF0 to the LAN. If the src_mac match the value from filters, send packet to LAN and to VF1.
In this case both LAN_EN and LB_EN flags in switch is set in case of packet matching both filters. As dst VSI for the only LAN enable bit is PF VSI, the packet is being seen on PF. To fix this change dst VSI to the source VSI. It will block receiving any packet even when LB_EN is set by switch, because local loopback is clear on VF VSI during normal operation.
Side note: if the second filters action is redirect instead of mirror LAN_EN is clear, because switch is AND-ing LAN_EN from each matched filters and OR-ing LB_EN.
--- drivers/net/ethernet/intel/ice/ice_tc_lib.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/net/ethernet/intel/ice/ice_tc_lib.c +11 -0
@@ -819,6 +819,17 @@ ice_eswitch_add_tc_fltr(struct ice_vsi *vsi, struct ice_tc_flower_fltr *fltr) rule_info.sw_act.flag |=ICE_FLTR_TX ; rule_info.sw_act.src = vsi->idx; rule_info.flags_info.act =ICE_SINGLE_ACT_LAN_ENABLE ; +/* This is a specific case. The destination VSI index is +* overwritten by the source VSI index. This type of filter +* should allow the packet to go to the LAN, not to the +* VSI passed here. It should set LAN_EN bit only. However, +* the VSI must be a valid one. Setting source VSI index +* here is safe. Even if the result from switch is set LAN_EN +* and LB_EN (which normally will pass the packet to this VSI) +* packet won't be seen on the VSI, because local loopback is +* turned off. +*/ + rule_info.sw_act.vsi_handle = vsi->idx; }else {/* VF to VF */ rule_info.sw_act.flag |=ICE_FLTR_TX ;
Signature · 1 line
2.42.0
Quoted 18 lines · Michal Swiatkowski
The filters set that will reproduce the problem:
$ tc filter add dev $VF0_PR ingress protocol arp prio 0 flower \ skip_sw dst_mac ff:ff:ff:ff:ff:ff action mirred egress \ redirect dev $PF0 $ tc filter add dev $VF0_PR ingress protocol arp prio 0 flower \ skip_sw dst_mac ff:ff:ff:ff:ff:ff src_mac 52:54:00:00:00:10 \ action mirred egress mirror dev $VF1_PRExpected behaviour is to set all broadcast from VF0 to the LAN. If the
src_macmatch the value from filters, send packet to LAN and to VF1.In this case both
LAN_ENandLB_ENflags in switch is set in case of packet matching both filters. As dst VSI for the only LAN enable bit is PF VSI, the packet is being seen on PF. To fix this change dst VSI to the source VSI. It will block receiving any packet even whenLB_ENis set by switch, because local loopback is clear on VF VSI during normal operation.
Quoted 7 lines
Side note: if the second filters action is redirect instead of mirror
LAN_ENis clear, because switch is AND-ingLAN_ENfrom each matched filters and OR-ingLB_EN.Reviewed-by Przemek Kitszel <[email protected]>Fixes 73b483b79029 ("ice: Manage act flags for switchdev offloads")Signed-off-by Michal Swiatkowski <[email protected]>
Quoted 32 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Michal Swiatkowski
Sent: Monday, August 19, 2024 3:44 PM
To: [email protected]
Cc: [email protected]; Drewek, Wojciech <[email protected]>; Kitszel, Przemyslaw <[email protected]>
Subject: [Intel-wired-lan] [iwl-next v1] ice: set correct dst VSI in only LAN filtersThe filters set that will reproduce the problem:
$ tc filter add dev $VF0_PR ingress protocol arp prio 0 flower \ skip_sw dst_mac ff:ff:ff:ff:ff:ff action mirred egress \ redirect dev $PF0 $ tc filter add dev $VF0_PR ingress protocol arp prio 0 flower \ skip_sw dst_mac ff:ff:ff:ff:ff:ff src_mac 52:54:00:00:00:10 \ action mirred egress mirror dev $VF1_PRExpected behaviour is to set all broadcast from VF0 to the LAN. If the
src_macmatch the value from filters, send packet to LAN and to VF1.In this case both
LAN_ENandLB_ENflags in switch is set in case of packet matching both filters. As dst VSI for the only LAN enable bit is PF VSI, the packet is being seen on PF. To fix this change dst VSI to the source VSI. It will block receiving any packet even whenLB_ENis set by switch, because local loopback is clear on VF VSI during normal operation.Side note: if the second filters action is redirect instead of mirror
LAN_ENis clear, because switch is AND-ingLAN_ENfrom each matched filters and OR- ingLB_EN.
Quoted 7 lines
Reviewed-by Przemek Kitszel <[email protected]>Fixes 73b483b79029 ("ice: Manage act flags for switchdev offloads")Signed-off-by Michal Swiatkowski <[email protected]>--- drivers/net/ethernet/intel/ice/ice_tc_lib.c | 11 +++++++++++ 1 file changed, 11 insertions(+)