Skip to content

Commit 68c51db

Browse files
Marcin Szycikanguy11
authored andcommitted
ice: Fix VF-VF direction matching in drop rule in switchdev
When adding a drop rule on a VF, rule direction is not being set, which results in it always being set to ingress (ICE_ESWITCH_FLTR_INGRESS equals 0). Because of this, drop rules added on port representors don't match any packets. To fix it, set rule direction in drop action to egress when netdev is a port representor, otherwise set it to ingress. Fixes: 0960a27 ("ice: Add direction metadata") Reviewed-by: Michal Swiatkowski <[email protected]> Signed-off-by: Marcin Szycik <[email protected]> Tested-by: Sujai Buvaneswaran <[email protected]> Reviewed-by: Simon Horman <[email protected]> Signed-off-by: Tony Nguyen <[email protected]>
1 parent 8b3c8c5 commit 68c51db

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

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

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -670,6 +670,25 @@ static int ice_tc_setup_redirect_action(struct net_device *filter_dev,
670670
return 0;
671671
}
672672

673+
static int
674+
ice_tc_setup_drop_action(struct net_device *filter_dev,
675+
struct ice_tc_flower_fltr *fltr)
676+
{
677+
fltr->action.fltr_act = ICE_DROP_PACKET;
678+
679+
if (ice_is_port_repr_netdev(filter_dev)) {
680+
fltr->direction = ICE_ESWITCH_FLTR_EGRESS;
681+
} else if (ice_tc_is_dev_uplink(filter_dev)) {
682+
fltr->direction = ICE_ESWITCH_FLTR_INGRESS;
683+
} else {
684+
NL_SET_ERR_MSG_MOD(fltr->extack,
685+
"Unsupported netdevice in switchdev mode");
686+
return -EINVAL;
687+
}
688+
689+
return 0;
690+
}
691+
673692
static int ice_eswitch_tc_parse_action(struct net_device *filter_dev,
674693
struct ice_tc_flower_fltr *fltr,
675694
struct flow_action_entry *act)
@@ -678,7 +697,10 @@ static int ice_eswitch_tc_parse_action(struct net_device *filter_dev,
678697

679698
switch (act->id) {
680699
case FLOW_ACTION_DROP:
681-
fltr->action.fltr_act = ICE_DROP_PACKET;
700+
err = ice_tc_setup_drop_action(filter_dev, fltr);
701+
if (err)
702+
return err;
703+
682704
break;
683705

684706
case FLOW_ACTION_REDIRECT:

0 commit comments

Comments
 (0)