iavf: use tc_cls_can_offload_basic() instead of chain check
Subsystems (3)
PATCH 1/1 iavf: use tc_cls_can_offload_basic() instead of chain check
From: Jiri Pirko <[email protected]>
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_basic() helper instead of direct check and move the check to _cb() so this is similar to i40e code.
---
This was originally part of "net: allow user specify TC filter HW stats type" patchset, but it is no longer related after the requested changes. Sending separatelly.
--- drivers/net/ethernet/intel/iavf/iavf_main.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/iavf/iavf_main.c +5 -3
@@ -3061,9 +3061,6 @@ static int iavf_delete_clsflower(struct iavf_adapter *adapter,static int iavf_setup_tc_cls_flower (struct iavf_adapter *adapter,struct flow_cls_offload *cls_flower) { -if (cls_flower->common.chain_index) -return -EOPNOTSUPP ; -switch (cls_flower->command) {case FLOW_CLS_REPLACE :return iavf_configure_clsflower (adapter, cls_flower);
@@ -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,void *cb_priv) { +struct iavf_adapter *adapter = cb_priv; + +if (!tc_cls_can_offload_basic (adapter->netdev, type_data)) +return -EOPNOTSUPP ; +switch (type) {case TC_SETUP_CLSFLOWER :return iavf_setup_tc_cls_flower (cb_priv, type_data);
Signature · 1 line
2.21.1
David Miller
maintainerFrom: Jiri Pirko <[email protected]>
Date: Tue, 25 Feb 2020 13:10:23 +0100
Quoted 7 lines
From: Jiri Pirko <[email protected]>
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_basic()helper instead of direct check and move the check to_cb()so this is similar to i40e code.
Quoted 5 lines
Signed-off-by Jiri Pirko <[email protected]>---
This was originally part of "net: allow user specify TC filter HW stats type" patchset, but it is no longer related after the requested changes. Sending separatelly.
Jeff, do you want me to apply this directly? If so, please give your ack.
Thanks.
kbuild test robot
build botI love your patch! Yet something to improve:
Hi Jiri,
I love your patch! Yet something to improve:
[auto build test ERROR on net-next/master]
[also build test ERROR on jkirsher-next-queue/dev-queue v5.6-rc3 next-20200225] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Jiri-Pirko/iavf-use-tc_cls_can_offload_basic-instead-of-chain-check/20200225-225956 base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 3b3e808cd883dd2e39c85e6d8debc0020b5ef5e7 config: i386-randconfig-a002-20200225 (attached as .config) compiler: gcc-5 (Ubuntu 5.5.0-12ubuntu1) 5.5.0 20171010 reproduce: # save the attached .config to linux build tree make ARCH=i386
If you fix the issue, kindly add following tag
All errors (new ones prefixed by >>):
In file included from include/linux/export.h:43:0,
from include/linux/linkage.h:7,
from include/linux/kernel.h:8,
from include/linux/list.h:9,
from include/linux/module.h:12,
from drivers/net/ethernet/intel/iavf/iavf.h:7,
from drivers/net/ethernet/intel/iavf/iavf_main.c:4:
drivers/net/ethernet/intel/iavf/iavf_main.c: In function 'iavf_setup_tc_block_cb':
>> drivers/net/ethernet/intel/iavf/iavf_main.c:3089:7: error: implicit declaration of function 'tc_cls_can_offload_basic' [-Werror=implicit-function-declaration]
if (!tc_cls_can_offload_basic(adapter->netdev, type_data))
^
include/linux/compiler.h:58:52: note: in definition of macro '__trace_if_var'
#define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
^
drivers/net/ethernet/intel/iavf/iavf_main.c:3089:2: note: in expansion of macro 'if'
if (!tc_cls_can_offload_basic(adapter->netdev, type_data))
^cc1: some warnings being treated as errors
vim +/tc_cls_can_offload_basic +3089 drivers/net/ethernet/intel/iavf/iavf_main.c
3075
3076 /**
3077 * iavf_setup_tc_block_cb - block callback for tc
3078 * @type: type of offload
3079 * @type_data: offload data
3080 * @cb_priv:
3081 *
3082 * This function is the block callback for traffic classes
3083 **/
3084 static int iavf_setup_tc_block_cb(enum tc_setup_type type, void *type_data,
3085 void *cb_priv)
3086 {
3087 struct iavf_adapter *adapter = cb_priv;
3088
> 3089 if (!tc_cls_can_offload_basic(adapter->netdev, type_data))
3090 return -EOPNOTSUPP;
3091
3092 switch (type) {
3093 case TC_SETUP_CLSFLOWER:
3094 return iavf_setup_tc_cls_flower(cb_priv, type_data);
3095 default:
3096 return -EOPNOTSUPP;
3097 }
3098 }
3099
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
Quoted 9 lines · Jiri Pirko
From: Jiri Pirko <[email protected]>
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 usetc_cls_can_offload_basic()helper instead of direct check and move the check to_cb()so this is similar to i40e code.Signed-off-by Jiri Pirko <[email protected]>
Go ahead and pick this up Dave, thanks!
Quoted 8 lines
---
This was originally part of "net: allow user specify TC filter HW stats type"
patchset, but it is no longer related after the requested changes. Sending separatelly.--- drivers/net/ethernet/intel/iavf/iavf_main.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://lists.osuosl.org/pipermail/intel-wired-lan/attachments/20200225/50d89acb/attachment.asc>
David Miller
maintainerFrom: Jeff Kirsher <[email protected]>
Date: Tue, 25 Feb 2020 13:15:46 -0800
Quoted 9 lines · Jiri Pirko
Quoted 8 lines
From: Jiri Pirko <[email protected]>
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 usetc_cls_can_offload_basic()helper instead of direct check and move the check to_cb()so this is similar to i40e code.
Quoted 5 lines
Quoted 1 line
Signed-off-by Jiri Pirko <[email protected]>Acked-by Jeff Kirsher <[email protected]>Go ahead and pick this up Dave, thanks!
Hmmm, Jiri this doesn't compile?
CC [M] drivers/net/ethernet/intel/iavf/iavf_main.odrivers/net/ethernet/intel/iavf/iavf_main.c: In function ?iavf_setup_tc_block_cb?:drivers/net/ethernet/intel/iavf/iavf_main.c:3089:7: error: implicit declaration of function ?tc_cls_can_offload_basic?; did you mean ?tc_cls_common_offload_init?? [-Werror=implicit-function-declaration]
if (!tc_cls_can_offload_basic(adapter->netdev, type_data))
^~~~~~~~~~~~~~~~~~~~~~~~
tc_cls_common_offload_initMaybe it does depend upon something in the tc filter patch series?
Quoted 12 lines · davem at davemloft.net
From: Jeff Kirsher <[email protected]>
Date: Tue, 25 Feb 2020 13:15:46 -0800Quoted 9 lines · Jiri Pirko
Quoted 8 lines
From: Jiri Pirko <[email protected]>
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 usetc_cls_can_offload_basic()helper instead of direct check and move the check to_cb()so this is similar to i40e code.
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
Signed-off-by Jiri Pirko <[email protected]>Acked-by Jeff Kirsher <[email protected]>Go ahead and pick this up Dave, thanks!
Hmmm, Jiri this doesn't compile?
Crap :/ I shuffled with the patches too much. Will send v2. Sorry.
Quoted 9 lines
CC [M]
drivers/net/ethernet/intel/iavf/iavf_main.odrivers/net/ethernet/intel/iavf/iavf_main.c: In function ?iavf_setup_tc_block_cb?:drivers/net/ethernet/intel/iavf/iavf_main.c:3089:7: error: implicit declaration of function ?tc_cls_can_offload_basic?; did you mean ?tc_cls_common_offload_init?? [-Werror=implicit-function-declaration]
if (!tc_cls_can_offload_basic(adapter->netdev,type_data))^~~~~~~~~~~~~~~~~~~~~~~~ tc_cls_common_offload_initMaybe it does depend upon something in the tc filter patch series?
kbuild test robot
build botI love your patch! Perhaps something to improve:
Hi Jiri,
I love your patch! Perhaps something to improve:
[auto build test WARNING on net-next/master]
[also build test WARNING on jkirsher-next-queue/dev-queue ipvs/master sparc-next/master v5.6-rc3 next-20200225] [if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Jiri-Pirko/iavf-use-tc_cls_can_offload_basic-instead-of-chain-check/20200225-225956 base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 3b3e808cd883dd2e39c85e6d8debc0020b5ef5e7 config: i386-randconfig-a002-20200225 (attached as .config) compiler: gcc-7 (Debian 7.5.0-5) 7.5.0 reproduce: # save the attached .config to linux build tree make ARCH=i386
If you fix the issue, kindly add following tag
All warnings (new ones prefixed by >>):
In file included from include/linux/export.h:43:0,
from include/linux/linkage.h:7,
from include/linux/kernel.h:8,
from include/linux/list.h:9,
from include/linux/module.h:12,
from drivers/net/ethernet/intel/iavf/iavf.h:7,
from drivers/net/ethernet/intel/iavf/iavf_main.c:4:
drivers/net/ethernet/intel/iavf/iavf_main.c: In function 'iavf_setup_tc_block_cb':
drivers/net/ethernet/intel/iavf/iavf_main.c:3089:7: error: implicit declaration of function 'tc_cls_can_offload_basic'; did you mean 'tc_cls_common_offload_init'? [-Werror=implicit-function-declaration]
if (!tc_cls_can_offload_basic(adapter->netdev, type_data))
^
include/linux/compiler.h:58:52: note: in definition of macro '__trace_if_var'
#define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
^~~~
>> drivers/net/ethernet/intel/iavf/iavf_main.c:3089:2: note: in expansion of macro 'if'
if (!tc_cls_can_offload_basic(adapter->netdev, type_data))
^~cc1: some warnings being treated as errors
vim +/if +3089 drivers/net/ethernet/intel/iavf/iavf_main.c
3075
3076 /**
3077 * iavf_setup_tc_block_cb - block callback for tc
3078 * @type: type of offload
3079 * @type_data: offload data
3080 * @cb_priv:
3081 *
3082 * This function is the block callback for traffic classes
3083 **/
3084 static int iavf_setup_tc_block_cb(enum tc_setup_type type, void *type_data,
3085 void *cb_priv)
3086 {
3087 struct iavf_adapter *adapter = cb_priv;
3088
> 3089 if (!tc_cls_can_offload_basic(adapter->netdev, type_data))
3090 return -EOPNOTSUPP;
3091
3092 switch (type) {
3093 case TC_SETUP_CLSFLOWER:
3094 return iavf_setup_tc_cls_flower(cb_priv, type_data);
3095 default:
3096 return -EOPNOTSUPP;
3097 }
3098 }
3099
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
kbuild test robot
build botI love your patch! Yet something to improve:
Hi Jiri,
I love your patch! Yet something to improve:
[auto build test ERROR on net-next/master]
[also build test ERROR on jkirsher-next-queue/dev-queue v5.6-rc3 next-20200225] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Jiri-Pirko/iavf-use-tc_cls_can_offload_basic-instead-of-chain-check/20200225-225956 base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 3b3e808cd883dd2e39c85e6d8debc0020b5ef5e7 config: arm64-allyesconfig (attached as .config) compiler: clang version 11.0.0 (git://gitmirror/llvm_project 7f9f027c62623bff79730cd30d1a8a534e2ddb06)
reproduce:
# FIXME the reproduce steps for clang is not ready yet
If you fix the issue, kindly add following tag
All errors (new ones prefixed by >>):
>> drivers/net/ethernet/intel/iavf/iavf_main.c:3089:7: error: implicit declaration of function 'tc_cls_can_offload_basic' [-Werror,-Wimplicit-function-declaration]
if (!tc_cls_can_offload_basic(adapter->netdev, type_data))
^ drivers/net/ethernet/intel/iavf/iavf_main.c:3089:7: note: did you mean 'tc_cls_common_offload_init'? include/net/pkt_cls.h:630:1: note: 'tc_cls_common_offload_init' declared here tc_cls_common_offload_init(struct flow_cls_common_offload *cls_common,
^
1 error generated.
vim +/tc_cls_can_offload_basic +3089 drivers/net/ethernet/intel/iavf/iavf_main.c
3075
3076 /**
3077 * iavf_setup_tc_block_cb - block callback for tc
3078 * @type: type of offload
3079 * @type_data: offload data
3080 * @cb_priv:
3081 *
3082 * This function is the block callback for traffic classes
3083 **/
3084 static int iavf_setup_tc_block_cb(enum tc_setup_type type, void *type_data,
3085 void *cb_priv)
3086 {
3087 struct iavf_adapter *adapter = cb_priv;
3088
> 3089 if (!tc_cls_can_offload_basic(adapter->netdev, type_data))
3090 return -EOPNOTSUPP;
3091
3092 switch (type) {
3093 case TC_SETUP_CLSFLOWER:
3094 return iavf_setup_tc_cls_flower(cb_priv, type_data);
3095 default:
3096 return -EOPNOTSUPP;
3097 }
3098 }
3099
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org