Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 803f310

Browse files
Michal Swiatkowskigregkh
authored andcommitted
ice: set correct dst VSI in only LAN filters
[ Upstream commit 839e3f9 ] 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. Reviewed-by: Przemek Kitszel <[email protected]> Fixes: 73b483b ("ice: Manage act flags for switchdev offloads") Signed-off-by: Michal Swiatkowski <[email protected]> Reviewed-by: Jacob Keller <[email protected]> Tested-by: Sujai Buvaneswaran <[email protected]> Signed-off-by: Tony Nguyen <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 4ab0723 commit 803f310

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

drivers/net/ethernet/intel/ice/ice_tc_lib.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -777,6 +777,17 @@ ice_eswitch_add_tc_fltr(struct ice_vsi *vsi, struct ice_tc_flower_fltr *fltr)
777777
rule_info.sw_act.flag |= ICE_FLTR_TX;
778778
rule_info.sw_act.src = vsi->idx;
779779
rule_info.flags_info.act = ICE_SINGLE_ACT_LAN_ENABLE;
780+
/* This is a specific case. The destination VSI index is
781+
* overwritten by the source VSI index. This type of filter
782+
* should allow the packet to go to the LAN, not to the
783+
* VSI passed here. It should set LAN_EN bit only. However,
784+
* the VSI must be a valid one. Setting source VSI index
785+
* here is safe. Even if the result from switch is set LAN_EN
786+
* and LB_EN (which normally will pass the packet to this VSI)
787+
* packet won't be seen on the VSI, because local loopback is
788+
* turned off.
789+
*/
790+
rule_info.sw_act.vsi_handle = vsi->idx;
780791
} else {
781792
/* VF to VF */
782793
rule_info.sw_act.flag |= ICE_FLTR_TX;

0 commit comments

Comments
 (0)