Skip to content

Commit

Permalink
ixgbe: fix parsing of TC actions for HW offload
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Ondřej Hlavatý authored and davem330 committed Jun 1, 2018
1 parent 8005b09 commit 16e6653
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -9075,11 +9074,11 @@ 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;
Expand Down

0 comments on commit 16e6653

Please sign in to comment.