diff options
author | Ondřej Hlavatý <ohlavaty@redhat.com> | 2018-05-31 17:21:04 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-05-31 23:01:00 -0400 |
commit | 16e6653c8259ca5383126e1c6bcf7fe062af87fc (patch) | |
tree | 8452041e189fb54607e7942e00d0a04214b4f691 | |
parent | 8005b09d99fac78e6f5fb9da30b5ae94840af03b (diff) |
ixgbe: fix parsing of TC actions for HW offload
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.
Signed-off-by: Ondřej Hlavatý <ohlavaty@redhat.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index afadba99f7b8..2ecd55856c50 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, | |||
9054 | { | 9054 | { |
9055 | const struct tc_action *a; | 9055 | const struct tc_action *a; |
9056 | LIST_HEAD(actions); | 9056 | LIST_HEAD(actions); |
9057 | int err; | ||
9058 | 9057 | ||
9059 | if (!tcf_exts_has_actions(exts)) | 9058 | if (!tcf_exts_has_actions(exts)) |
9060 | return -EINVAL; | 9059 | return -EINVAL; |
@@ -9075,11 +9074,11 @@ static int parse_tc_actions(struct ixgbe_adapter *adapter, | |||
9075 | 9074 | ||
9076 | if (!dev) | 9075 | if (!dev) |
9077 | return -EINVAL; | 9076 | return -EINVAL; |
9078 | err = handle_redirect_action(adapter, dev->ifindex, queue, | 9077 | return handle_redirect_action(adapter, dev->ifindex, |
9079 | action); | 9078 | queue, action); |
9080 | if (err == 0) | ||
9081 | return err; | ||
9082 | } | 9079 | } |
9080 | |||
9081 | return -EINVAL; | ||
9083 | } | 9082 | } |
9084 | 9083 | ||
9085 | return -EINVAL; | 9084 | return -EINVAL; |