* [PATCH iwl-net] ice: Fix VF-VF direction matching in drop rule in switchdev
@ 2023-10-25 14:47 Marcin Szycik
2023-10-30 7:46 ` [Intel-wired-lan] " Buvaneswaran, Sujai
2023-11-04 13:46 ` Simon Horman
0 siblings, 2 replies; 3+ messages in thread
From: Marcin Szycik @ 2023-10-25 14:47 UTC (permalink / raw)
To: intel-wired-lan; +Cc: netdev, Marcin Szycik, Michal Swiatkowski
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: 0960a27bd479 ("ice: Add direction metadata")
Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Signed-off-by: Marcin Szycik <marcin.szycik@linux.intel.com>
---
drivers/net/ethernet/intel/ice/ice_tc_lib.c | 24 ++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/intel/ice/ice_tc_lib.c b/drivers/net/ethernet/intel/ice/ice_tc_lib.c
index 0e75fc6b3c06..dd03cb69ad26 100644
--- a/drivers/net/ethernet/intel/ice/ice_tc_lib.c
+++ b/drivers/net/ethernet/intel/ice/ice_tc_lib.c
@@ -670,6 +670,25 @@ static int ice_tc_setup_redirect_action(struct net_device *filter_dev,
return 0;
}
+static int
+ice_tc_setup_drop_action(struct net_device *filter_dev,
+ struct ice_tc_flower_fltr *fltr)
+{
+ fltr->action.fltr_act = ICE_DROP_PACKET;
+
+ if (ice_is_port_repr_netdev(filter_dev)) {
+ fltr->direction = ICE_ESWITCH_FLTR_EGRESS;
+ } else if (ice_tc_is_dev_uplink(filter_dev)) {
+ fltr->direction = ICE_ESWITCH_FLTR_INGRESS;
+ } else {
+ NL_SET_ERR_MSG_MOD(fltr->extack,
+ "Unsupported netdevice in switchdev mode");
+ return -EINVAL;
+ }
+
+ return 0;
+}
+
static int ice_eswitch_tc_parse_action(struct net_device *filter_dev,
struct ice_tc_flower_fltr *fltr,
struct flow_action_entry *act)
@@ -678,7 +697,10 @@ static int ice_eswitch_tc_parse_action(struct net_device *filter_dev,
switch (act->id) {
case FLOW_ACTION_DROP:
- fltr->action.fltr_act = ICE_DROP_PACKET;
+ err = ice_tc_setup_drop_action(filter_dev, fltr);
+ if (err)
+ return err;
+
break;
case FLOW_ACTION_REDIRECT:
--
2.31.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* RE: [Intel-wired-lan] [PATCH iwl-net] ice: Fix VF-VF direction matching in drop rule in switchdev
2023-10-25 14:47 [PATCH iwl-net] ice: Fix VF-VF direction matching in drop rule in switchdev Marcin Szycik
@ 2023-10-30 7:46 ` Buvaneswaran, Sujai
2023-11-04 13:46 ` Simon Horman
1 sibling, 0 replies; 3+ messages in thread
From: Buvaneswaran, Sujai @ 2023-10-30 7:46 UTC (permalink / raw)
To: Marcin Szycik, intel-wired-lan@lists.osuosl.org
Cc: netdev@vger.kernel.org, Michal Swiatkowski
> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of
> Marcin Szycik
> Sent: Wednesday, October 25, 2023 8:17 PM
> To: intel-wired-lan@lists.osuosl.org
> Cc: netdev@vger.kernel.org; Marcin Szycik <marcin.szycik@linux.intel.com>;
> Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
> Subject: [Intel-wired-lan] [PATCH iwl-net] 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: 0960a27bd479 ("ice: Add direction metadata")
> Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
> Signed-off-by: Marcin Szycik <marcin.szycik@linux.intel.com>
> ---
> drivers/net/ethernet/intel/ice/ice_tc_lib.c | 24 ++++++++++++++++++++-
> 1 file changed, 23 insertions(+), 1 deletion(-)
>
Tested-by: Sujai Buvaneswaran <sujai.buvaneswaran@intel.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH iwl-net] ice: Fix VF-VF direction matching in drop rule in switchdev
2023-10-25 14:47 [PATCH iwl-net] ice: Fix VF-VF direction matching in drop rule in switchdev Marcin Szycik
2023-10-30 7:46 ` [Intel-wired-lan] " Buvaneswaran, Sujai
@ 2023-11-04 13:46 ` Simon Horman
1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2023-11-04 13:46 UTC (permalink / raw)
To: Marcin Szycik; +Cc: intel-wired-lan, netdev, Michal Swiatkowski
On Wed, Oct 25, 2023 at 04:47:24PM +0200, Marcin Szycik wrote:
> 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: 0960a27bd479 ("ice: Add direction metadata")
> Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
> Signed-off-by: Marcin Szycik <marcin.szycik@linux.intel.com>
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-11-04 13:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-25 14:47 [PATCH iwl-net] ice: Fix VF-VF direction matching in drop rule in switchdev Marcin Szycik
2023-10-30 7:46 ` [Intel-wired-lan] " Buvaneswaran, Sujai
2023-11-04 13:46 ` Simon Horman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).