Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Jiri Pirko and committed by
David S. Miller
bb0858d8 f13e4415

+5 -3
+5 -3
drivers/net/ethernet/intel/iavf/iavf_main.c
··· 3061 3061 static int iavf_setup_tc_cls_flower(struct iavf_adapter *adapter, 3062 3062 struct flow_cls_offload *cls_flower) 3063 3063 { 3064 - if (cls_flower->common.chain_index) 3065 - return -EOPNOTSUPP; 3066 - 3067 3064 switch (cls_flower->command) { 3068 3065 case FLOW_CLS_REPLACE: 3069 3066 return iavf_configure_clsflower(adapter, cls_flower); ··· 3084 3087 static int iavf_setup_tc_block_cb(enum tc_setup_type type, void *type_data, 3085 3088 void *cb_priv) 3086 3089 { 3090 + struct iavf_adapter *adapter = cb_priv; 3091 + 3092 + if (!tc_cls_can_offload_and_chain0(adapter->netdev, type_data)) 3093 + return -EOPNOTSUPP; 3094 + 3087 3095 switch (type) { 3088 3096 case TC_SETUP_CLSFLOWER: 3089 3097 return iavf_setup_tc_cls_flower(cb_priv, type_data);