* [net] ixgbe: fix parsing of TC actions for HW offload
@ 2018-05-30 18:01 Jeff Kirsher
2018-05-31 19:41 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: Jeff Kirsher @ 2018-05-30 18:01 UTC (permalink / raw)
To: davem
Cc: Ondřej Hlavatý,
netdev, nhorman, sassmann, jogreene, Jamal Hadi Salim,
Jiri Pirko, Jeff Kirsher
From: Ondřej Hlavatý <ohlavaty@redhat.com>
The previous code was optimistic, accepting the offload of whole action
chain when there was a single known action (drop/redirect). This results
in offloading a rule which should not be offloaded, because its behavior
cannot be reproduced in the hardware.
For example:
$ tc filter add dev eno1 parent ffff: protocol ip \
u32 ht 800: order 1 match tcp src 42 FFFF \
action mirred egress mirror dev enp1s16 pipe \
drop
The controller is unable to mirror the packet to a VF, but still
offloads the rule by dropping the packet.
Change the approach of the function to a pessimistic one, rejecting the
chain when an unknown action is found. This is better suited for future
extensions.
Note that both recognized actions always return TC_ACT_SHOT, therefore
it is safe to ignore actions behind them.
Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Cc: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: Ondřej Hlavatý <ohlavaty@redhat.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index afadba99f7b8..d01e1f0280cf 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -9054,7 +9054,6 @@ static int parse_tc_actions(struct ixgbe_adapter *adapter,
{
const struct tc_action *a;
LIST_HEAD(actions);
- int err;
if (!tcf_exts_has_actions(exts))
return -EINVAL;
@@ -9075,14 +9074,14 @@ static int parse_tc_actions(struct ixgbe_adapter *adapter,
if (!dev)
return -EINVAL;
- err = handle_redirect_action(adapter, dev->ifindex, queue,
- action);
- if (err == 0)
- return err;
+ return handle_redirect_action(adapter, dev->ifindex,
+ queue, action);
}
+
+ return -EINVAL;
}
- return -EINVAL;
+ return 0;
}
#else
static int parse_tc_actions(struct ixgbe_adapter *adapter,
--
2.17.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [net] ixgbe: fix parsing of TC actions for HW offload
2018-05-30 18:01 [net] ixgbe: fix parsing of TC actions for HW offload Jeff Kirsher
@ 2018-05-31 19:41 ` David Miller
2018-05-31 20:01 ` Ondřej Hlavatý
0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2018-05-31 19:41 UTC (permalink / raw)
To: jeffrey.t.kirsher
Cc: ohlavaty, netdev, nhorman, sassmann, jogreene, jhs, jiri
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Date: Wed, 30 May 2018 11:01:34 -0700
> From: Ondřej Hlavatý <ohlavaty@redhat.com>
>
> The previous code was optimistic, accepting the offload of whole action
> chain when there was a single known action (drop/redirect). This results
> in offloading a rule which should not be offloaded, because its behavior
> cannot be reproduced in the hardware.
>
> For example:
>
> $ tc filter add dev eno1 parent ffff: protocol ip \
> u32 ht 800: order 1 match tcp src 42 FFFF \
> action mirred egress mirror dev enp1s16 pipe \
> drop
>
> The controller is unable to mirror the packet to a VF, but still
> offloads the rule by dropping the packet.
>
> Change the approach of the function to a pessimistic one, rejecting the
> chain when an unknown action is found. This is better suited for future
> extensions.
>
> Note that both recognized actions always return TC_ACT_SHOT, therefore
> it is safe to ignore actions behind them.
>
> Cc: Jamal Hadi Salim <jhs@mojatatu.com>
> Cc: Jiri Pirko <jiri@resnulli.us>
> Signed-off-by: Ondřej Hlavatý <ohlavaty@redhat.com>
> Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
This introduces a new warning with gcc-8.1.1 on Fedora 28.
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c: In function ‘ixgbe_configure_clsu32’:
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c:9311:8: warning: ‘queue’ may be used uninitialized in this function [-Wmaybe-uninitialized]
err = ixgbe_fdir_write_perfect_filter_82599(hw, &input->filter,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
input->sw_idx, queue);
~~~~~~~~~~~~~~~~~~~~~
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [net] ixgbe: fix parsing of TC actions for HW offload
2018-05-31 19:41 ` David Miller
@ 2018-05-31 20:01 ` Ondřej Hlavatý
0 siblings, 0 replies; 3+ messages in thread
From: Ondřej Hlavatý @ 2018-05-31 20:01 UTC (permalink / raw)
To: David Miller
Cc: jeffrey.t.kirsher, netdev, nhorman, sassmann, jogreene, jhs, jiri
On 31.05., David Miller wrote:
> From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> Date: Wed, 30 May 2018 11:01:34 -0700
>
> > From: Ondřej Hlavatý <ohlavaty@redhat.com>
> >
> > The previous code was optimistic, accepting the offload of whole action
> > chain when there was a single known action (drop/redirect). This results
> > in offloading a rule which should not be offloaded, because its behavior
> > cannot be reproduced in the hardware.
> >
>
> This introduces a new warning with gcc-8.1.1 on Fedora 28.
Indeed. Sorry for noticing that it was introduced by my patch. The
issue is pretty obvious - empty action chain will not select a queue. As
the Flow Director rules always need to explicitly set a queue index when
they match (as far as I'm concerned), the correct solution should be to
just reject empty chains for offload as well. I will prepare v2 soon.
Ondřej
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-05-31 20:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-30 18:01 [net] ixgbe: fix parsing of TC actions for HW offload Jeff Kirsher
2018-05-31 19:41 ` David Miller
2018-05-31 20:01 ` Ondřej Hlavatý
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.