Commit bb0858d8 authored by Jiri Pirko's avatar Jiri Pirko Committed by David S. Miller

iavf: use tc_cls_can_offload_and_chain0() instead of chain check

Looks like the iavf code actually experienced a race condition, when a
developer took code before the check for chain 0 was put to helper.
So use tc_cls_can_offload_and_chain0() helper instead of direct check and
move the check to _cb() so this is similar to i40e code.
Signed-off-by: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f13e4415
...@@ -3061,9 +3061,6 @@ static int iavf_delete_clsflower(struct iavf_adapter *adapter, ...@@ -3061,9 +3061,6 @@ static int iavf_delete_clsflower(struct iavf_adapter *adapter,
static int iavf_setup_tc_cls_flower(struct iavf_adapter *adapter, static int iavf_setup_tc_cls_flower(struct iavf_adapter *adapter,
struct flow_cls_offload *cls_flower) struct flow_cls_offload *cls_flower)
{ {
if (cls_flower->common.chain_index)
return -EOPNOTSUPP;
switch (cls_flower->command) { switch (cls_flower->command) {
case FLOW_CLS_REPLACE: case FLOW_CLS_REPLACE:
return iavf_configure_clsflower(adapter, cls_flower); return iavf_configure_clsflower(adapter, cls_flower);
...@@ -3087,6 +3084,11 @@ static int iavf_setup_tc_cls_flower(struct iavf_adapter *adapter, ...@@ -3087,6 +3084,11 @@ static int iavf_setup_tc_cls_flower(struct iavf_adapter *adapter,
static int iavf_setup_tc_block_cb(enum tc_setup_type type, void *type_data, static int iavf_setup_tc_block_cb(enum tc_setup_type type, void *type_data,
void *cb_priv) void *cb_priv)
{ {
struct iavf_adapter *adapter = cb_priv;
if (!tc_cls_can_offload_and_chain0(adapter->netdev, type_data))
return -EOPNOTSUPP;
switch (type) { switch (type) {
case TC_SETUP_CLSFLOWER: case TC_SETUP_CLSFLOWER:
return iavf_setup_tc_cls_flower(cb_priv, type_data); return iavf_setup_tc_cls_flower(cb_priv, type_data);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment