diff mbox series

[net-next,v1,1/7] net: flow_offload: provision conntrack info in ct_metadata

Message ID 20230110133023.2366381-2-vladbu@nvidia.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series Allow offloading of UDP NEW connections via act_ct | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Series has a cover letter
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1795 this patch: 1795
netdev/cc_maintainers warning 10 maintainers not CCed: hui.zhou@corigine.com linux-rdma@vger.kernel.org edumazet@google.com yinjun.zhang@corigine.com paulb@nvidia.com oss-drivers@corigine.com saeedm@nvidia.com leon@kernel.org louis.peens@corigine.com roid@nvidia.com
netdev/build_clang success Errors and warnings before: 155 this patch: 155
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 1953 this patch: 1953
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 54 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Vlad Buslov Jan. 10, 2023, 1:30 p.m. UTC
In order to offload connections in other states besides "established" the
driver offload callbacks need to have access to connection conntrack info.
Extend flow offload intermediate representation data structure
flow_action_entry->ct_metadata with new enum ip_conntrack_info field and
fill it in tcf_ct_flow_table_add_action_meta() callback.

Reject offloading IP_CT_NEW connections for now by returning an error in
relevant driver callbacks based on value of ctinfo. Support for offloading
such connections will need to be added to the drivers afterwards.

Signed-off-by: Vlad Buslov <vladbu@nvidia.com>
---
 .../ethernet/mellanox/mlx5/core/en/tc_ct.c    |  2 +-
 .../ethernet/netronome/nfp/flower/conntrack.c | 20 +++++++++++++++++++
 include/net/flow_offload.h                    |  1 +
 net/sched/act_ct.c                            |  1 +
 4 files changed, 23 insertions(+), 1 deletion(-)

Comments

kernel test robot Jan. 10, 2023, 3:14 p.m. UTC | #1
Hi Vlad,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on net-next/master]

url:    https://github.com/intel-lab-lkp/linux/commits/Vlad-Buslov/net-flow_offload-provision-conntrack-info-in-ct_metadata/20230110-213500
patch link:    https://lore.kernel.org/r/20230110133023.2366381-2-vladbu%40nvidia.com
patch subject: [PATCH net-next v1 1/7] net: flow_offload: provision conntrack info in ct_metadata
config: i386-tinyconfig
compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
reproduce (this is a W=1 build):
        # https://github.com/intel-lab-lkp/linux/commit/99f16b3535be4a9588707780f082146c647c5b5f
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Vlad-Buslov/net-flow_offload-provision-conntrack-info-in-ct_metadata/20230110-213500
        git checkout 99f16b3535be4a9588707780f082146c647c5b5f
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        make W=1 O=build_dir ARCH=i386 olddefconfig
        make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   In file included from include/net/sch_generic.h:21,
                    from include/linux/filter.h:26,
                    from kernel/sysctl.c:35:
>> include/net/flow_offload.h:291:48: error: field 'ctinfo' has incomplete type
     291 |                         enum ip_conntrack_info ctinfo;
         |                                                ^~~~~~


vim +/ctinfo +291 include/net/flow_offload.h

   227	
   228	struct flow_action_entry {
   229		enum flow_action_id		id;
   230		u32				hw_index;
   231		enum flow_action_hw_stats	hw_stats;
   232		action_destr			destructor;
   233		void				*destructor_priv;
   234		union {
   235			u32			chain_index;	/* FLOW_ACTION_GOTO */
   236			struct net_device	*dev;		/* FLOW_ACTION_REDIRECT */
   237			struct {				/* FLOW_ACTION_VLAN */
   238				u16		vid;
   239				__be16		proto;
   240				u8		prio;
   241			} vlan;
   242			struct {				/* FLOW_ACTION_VLAN_PUSH_ETH */
   243				unsigned char dst[ETH_ALEN];
   244				unsigned char src[ETH_ALEN];
   245			} vlan_push_eth;
   246			struct {				/* FLOW_ACTION_MANGLE */
   247								/* FLOW_ACTION_ADD */
   248				enum flow_action_mangle_base htype;
   249				u32		offset;
   250				u32		mask;
   251				u32		val;
   252			} mangle;
   253			struct ip_tunnel_info	*tunnel;	/* FLOW_ACTION_TUNNEL_ENCAP */
   254			u32			csum_flags;	/* FLOW_ACTION_CSUM */
   255			u32			mark;		/* FLOW_ACTION_MARK */
   256			u16                     ptype;          /* FLOW_ACTION_PTYPE */
   257			u16			rx_queue;	/* FLOW_ACTION_RX_QUEUE_MAPPING */
   258			u32			priority;	/* FLOW_ACTION_PRIORITY */
   259			struct {				/* FLOW_ACTION_QUEUE */
   260				u32		ctx;
   261				u32		index;
   262				u8		vf;
   263			} queue;
   264			struct {				/* FLOW_ACTION_SAMPLE */
   265				struct psample_group	*psample_group;
   266				u32			rate;
   267				u32			trunc_size;
   268				bool			truncate;
   269			} sample;
   270			struct {				/* FLOW_ACTION_POLICE */
   271				u32			burst;
   272				u64			rate_bytes_ps;
   273				u64			peakrate_bytes_ps;
   274				u32			avrate;
   275				u16			overhead;
   276				u64			burst_pkt;
   277				u64			rate_pkt_ps;
   278				u32			mtu;
   279				struct {
   280					enum flow_action_id	act_id;
   281					u32			extval;
   282				} exceed, notexceed;
   283			} police;
   284			struct {				/* FLOW_ACTION_CT */
   285				int action;
   286				u16 zone;
   287				struct nf_flowtable *flow_table;
   288			} ct;
   289			struct {
   290				unsigned long cookie;
 > 291				enum ip_conntrack_info ctinfo;
   292				u32 mark;
   293				u32 labels[4];
   294				bool orig_dir;
   295			} ct_metadata;
   296			struct {				/* FLOW_ACTION_MPLS_PUSH */
   297				u32		label;
   298				__be16		proto;
   299				u8		tc;
   300				u8		bos;
   301				u8		ttl;
   302			} mpls_push;
   303			struct {				/* FLOW_ACTION_MPLS_POP */
   304				__be16		proto;
   305			} mpls_pop;
   306			struct {				/* FLOW_ACTION_MPLS_MANGLE */
   307				u32		label;
   308				u8		tc;
   309				u8		bos;
   310				u8		ttl;
   311			} mpls_mangle;
   312			struct {
   313				s32		prio;
   314				u64		basetime;
   315				u64		cycletime;
   316				u64		cycletimeext;
   317				u32		num_entries;
   318				struct action_gate_entry *entries;
   319			} gate;
   320			struct {				/* FLOW_ACTION_PPPOE_PUSH */
   321				u16		sid;
   322			} pppoe;
   323		};
   324		struct flow_action_cookie *cookie; /* user defined action cookie */
   325	};
   326
kernel test robot Jan. 10, 2023, 8:27 p.m. UTC | #2
Hi Vlad,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on net-next/master]

url:    https://github.com/intel-lab-lkp/linux/commits/Vlad-Buslov/net-flow_offload-provision-conntrack-info-in-ct_metadata/20230110-213500
patch link:    https://lore.kernel.org/r/20230110133023.2366381-2-vladbu%40nvidia.com
patch subject: [PATCH net-next v1 1/7] net: flow_offload: provision conntrack info in ct_metadata
config: x86_64-randconfig-a003
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/99f16b3535be4a9588707780f082146c647c5b5f
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Vlad-Buslov/net-flow_offload-provision-conntrack-info-in-ct_metadata/20230110-213500
        git checkout 99f16b3535be4a9588707780f082146c647c5b5f
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash net/sched/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   In file included from net/sched/act_skbedit.c:14:
   In file included from include/net/pkt_sched.h:9:
   In file included from include/net/sch_generic.h:21:
   include/net/flow_offload.h:291:27: error: field has incomplete type 'enum ip_conntrack_info'
                           enum ip_conntrack_info ctinfo;
                                                  ^
   include/net/flow_offload.h:291:9: note: forward declaration of 'enum ip_conntrack_info'
                           enum ip_conntrack_info ctinfo;
                                ^
>> net/sched/act_skbedit.c:377:11: error: no member named 'mark' in 'struct flow_action_entry'
                           entry->mark = tcf_skbedit_mark(act);
                           ~~~~~  ^
>> net/sched/act_skbedit.c:380:11: error: no member named 'ptype' in 'struct flow_action_entry'
                           entry->ptype = tcf_skbedit_ptype(act);
                           ~~~~~  ^
>> net/sched/act_skbedit.c:383:11: error: no member named 'priority' in 'struct flow_action_entry'
                           entry->priority = tcf_skbedit_priority(act);
                           ~~~~~  ^
>> net/sched/act_skbedit.c:389:11: error: no member named 'rx_queue' in 'struct flow_action_entry'
                           entry->rx_queue = tcf_skbedit_rx_queue_mapping(act);
                           ~~~~~  ^
   5 errors generated.
--
   In file included from net/sched/act_gact.c:17:
   In file included from include/net/pkt_sched.h:9:
   In file included from include/net/sch_generic.h:21:
   include/net/flow_offload.h:291:27: error: field has incomplete type 'enum ip_conntrack_info'
                           enum ip_conntrack_info ctinfo;
                                                  ^
   include/net/flow_offload.h:291:9: note: forward declaration of 'enum ip_conntrack_info'
                           enum ip_conntrack_info ctinfo;
                                ^
>> net/sched/act_gact.c:254:11: error: no member named 'chain_index' in 'struct flow_action_entry'
                           entry->chain_index = tcf_gact_goto_chain_index(act);
                           ~~~~~  ^
   2 errors generated.
--
   In file included from net/sched/act_mirred.c:23:
   In file included from include/net/pkt_sched.h:9:
   In file included from include/net/sch_generic.h:21:
   include/net/flow_offload.h:291:27: error: field has incomplete type 'enum ip_conntrack_info'
                           enum ip_conntrack_info ctinfo;
                                                  ^
   include/net/flow_offload.h:291:9: note: forward declaration of 'enum ip_conntrack_info'
                           enum ip_conntrack_info ctinfo;
                                ^
>> net/sched/act_mirred.c:439:9: error: no member named 'dev' in 'struct flow_action_entry'
           entry->dev = act->ops->get_dev(act, &entry->destructor);
           ~~~~~  ^
   net/sched/act_mirred.c:440:14: error: no member named 'dev' in 'struct flow_action_entry'
           if (!entry->dev)
                ~~~~~  ^
   net/sched/act_mirred.c:442:34: error: no member named 'dev' in 'struct flow_action_entry'
           entry->destructor_priv = entry->dev;
                                    ~~~~~  ^
   4 errors generated.
--
   In file included from net/sched/act_pedit.c:18:
   In file included from include/net/pkt_sched.h:9:
   In file included from include/net/sch_generic.h:21:
   include/net/flow_offload.h:291:27: error: field has incomplete type 'enum ip_conntrack_info'
                           enum ip_conntrack_info ctinfo;
                                                  ^
   include/net/flow_offload.h:291:9: note: forward declaration of 'enum ip_conntrack_info'
                           enum ip_conntrack_info ctinfo;
                                ^
>> net/sched/act_pedit.c:516:11: error: no member named 'mangle' in 'struct flow_action_entry'
                           entry->mangle.htype = tcf_pedit_htype(act, k);
                           ~~~~~  ^
   net/sched/act_pedit.c:517:11: error: no member named 'mangle' in 'struct flow_action_entry'
                           entry->mangle.mask = tcf_pedit_mask(act, k);
                           ~~~~~  ^
   net/sched/act_pedit.c:518:11: error: no member named 'mangle' in 'struct flow_action_entry'
                           entry->mangle.val = tcf_pedit_val(act, k);
                           ~~~~~  ^
   net/sched/act_pedit.c:519:11: error: no member named 'mangle' in 'struct flow_action_entry'
                           entry->mangle.offset = tcf_pedit_offset(act, k);
                           ~~~~~  ^
   5 errors generated.
--
   In file included from net/sched/act_tunnel_key.c:16:
   In file included from include/net/pkt_sched.h:9:
   In file included from include/net/sch_generic.h:21:
   include/net/flow_offload.h:291:27: error: field has incomplete type 'enum ip_conntrack_info'
                           enum ip_conntrack_info ctinfo;
                                                  ^
   include/net/flow_offload.h:291:9: note: forward declaration of 'enum ip_conntrack_info'
                           enum ip_conntrack_info ctinfo;
                                ^
>> net/sched/act_tunnel_key.c:784:9: error: no member named 'tunnel' in 'struct flow_action_entry'
           entry->tunnel = tcf_tunnel_info_copy(act);
           ~~~~~  ^
   net/sched/act_tunnel_key.c:785:14: error: no member named 'tunnel' in 'struct flow_action_entry'
           if (!entry->tunnel)
                ~~~~~  ^
   net/sched/act_tunnel_key.c:788:34: error: no member named 'tunnel' in 'struct flow_action_entry'
           entry->destructor_priv = entry->tunnel;
                                    ~~~~~  ^
   4 errors generated.
--
   In file included from net/sched/act_gate.c:13:
   In file included from include/net/act_api.h:10:
   include/net/flow_offload.h:291:27: error: field has incomplete type 'enum ip_conntrack_info'
                           enum ip_conntrack_info ctinfo;
                                                  ^
   include/net/flow_offload.h:291:9: note: forward declaration of 'enum ip_conntrack_info'
                           enum ip_conntrack_info ctinfo;
                                ^
>> net/sched/act_gate.c:594:9: error: no member named 'gate' in 'struct flow_action_entry'
           entry->gate.entries = tcf_gate_get_list(act);
           ~~~~~  ^
   net/sched/act_gate.c:596:14: error: no member named 'gate' in 'struct flow_action_entry'
           if (!entry->gate.entries)
                ~~~~~  ^
   net/sched/act_gate.c:600:34: error: no member named 'gate' in 'struct flow_action_entry'
           entry->destructor_priv = entry->gate.entries;
                                    ~~~~~  ^
   net/sched/act_gate.c:615:10: error: no member named 'gate' in 'struct flow_action_entry'
                   entry->gate.prio = tcf_gate_prio(act);
                   ~~~~~  ^
   net/sched/act_gate.c:616:10: error: no member named 'gate' in 'struct flow_action_entry'
                   entry->gate.basetime = tcf_gate_basetime(act);
                   ~~~~~  ^
   net/sched/act_gate.c:617:10: error: no member named 'gate' in 'struct flow_action_entry'
                   entry->gate.cycletime = tcf_gate_cycletime(act);
                   ~~~~~  ^
   net/sched/act_gate.c:618:10: error: no member named 'gate' in 'struct flow_action_entry'
                   entry->gate.cycletimeext = tcf_gate_cycletimeext(act);
                   ~~~~~  ^
   net/sched/act_gate.c:619:10: error: no member named 'gate' in 'struct flow_action_entry'
                   entry->gate.num_entries = tcf_gate_num_entries(act);
                   ~~~~~  ^
   9 errors generated.


vim +377 net/sched/act_skbedit.c

e1fea322fc6d407 Roman Mashak    2019-08-07  367  
c54e1d920f04d52 Baowen Zheng    2021-12-17  368  static int tcf_skbedit_offload_act_setup(struct tc_action *act, void *entry_data,
c2ccf84ecb715bb Ido Schimmel    2022-04-07  369  					 u32 *index_inc, bool bind,
c2ccf84ecb715bb Ido Schimmel    2022-04-07  370  					 struct netlink_ext_ack *extack)
c54e1d920f04d52 Baowen Zheng    2021-12-17  371  {
c54e1d920f04d52 Baowen Zheng    2021-12-17  372  	if (bind) {
c54e1d920f04d52 Baowen Zheng    2021-12-17  373  		struct flow_action_entry *entry = entry_data;
c54e1d920f04d52 Baowen Zheng    2021-12-17  374  
c54e1d920f04d52 Baowen Zheng    2021-12-17  375  		if (is_tcf_skbedit_mark(act)) {
c54e1d920f04d52 Baowen Zheng    2021-12-17  376  			entry->id = FLOW_ACTION_MARK;
c54e1d920f04d52 Baowen Zheng    2021-12-17 @377  			entry->mark = tcf_skbedit_mark(act);
c54e1d920f04d52 Baowen Zheng    2021-12-17  378  		} else if (is_tcf_skbedit_ptype(act)) {
c54e1d920f04d52 Baowen Zheng    2021-12-17  379  			entry->id = FLOW_ACTION_PTYPE;
c54e1d920f04d52 Baowen Zheng    2021-12-17 @380  			entry->ptype = tcf_skbedit_ptype(act);
c54e1d920f04d52 Baowen Zheng    2021-12-17  381  		} else if (is_tcf_skbedit_priority(act)) {
c54e1d920f04d52 Baowen Zheng    2021-12-17  382  			entry->id = FLOW_ACTION_PRIORITY;
c54e1d920f04d52 Baowen Zheng    2021-12-17 @383  			entry->priority = tcf_skbedit_priority(act);
4a6a676f8c16ec1 Amritha Nambiar 2022-10-21  384  		} else if (is_tcf_skbedit_tx_queue_mapping(act)) {
4a6a676f8c16ec1 Amritha Nambiar 2022-10-21  385  			NL_SET_ERR_MSG_MOD(extack, "Offload not supported when \"queue_mapping\" option is used on transmit side");
a9c64939b669b3c Ido Schimmel    2022-04-07  386  			return -EOPNOTSUPP;
4a6a676f8c16ec1 Amritha Nambiar 2022-10-21  387  		} else if (is_tcf_skbedit_rx_queue_mapping(act)) {
4a6a676f8c16ec1 Amritha Nambiar 2022-10-21  388  			entry->id = FLOW_ACTION_RX_QUEUE_MAPPING;
4a6a676f8c16ec1 Amritha Nambiar 2022-10-21 @389  			entry->rx_queue = tcf_skbedit_rx_queue_mapping(act);
a9c64939b669b3c Ido Schimmel    2022-04-07  390  		} else if (is_tcf_skbedit_inheritdsfield(act)) {
a9c64939b669b3c Ido Schimmel    2022-04-07  391  			NL_SET_ERR_MSG_MOD(extack, "Offload not supported when \"inheritdsfield\" option is used");
a9c64939b669b3c Ido Schimmel    2022-04-07  392  			return -EOPNOTSUPP;
c54e1d920f04d52 Baowen Zheng    2021-12-17  393  		} else {
a9c64939b669b3c Ido Schimmel    2022-04-07  394  			NL_SET_ERR_MSG_MOD(extack, "Unsupported skbedit option offload");
c54e1d920f04d52 Baowen Zheng    2021-12-17  395  			return -EOPNOTSUPP;
c54e1d920f04d52 Baowen Zheng    2021-12-17  396  		}
c54e1d920f04d52 Baowen Zheng    2021-12-17  397  		*index_inc = 1;
c54e1d920f04d52 Baowen Zheng    2021-12-17  398  	} else {
8cbfe939abe9052 Baowen Zheng    2021-12-17  399  		struct flow_offload_action *fl_action = entry_data;
8cbfe939abe9052 Baowen Zheng    2021-12-17  400  
8cbfe939abe9052 Baowen Zheng    2021-12-17  401  		if (is_tcf_skbedit_mark(act))
8cbfe939abe9052 Baowen Zheng    2021-12-17  402  			fl_action->id = FLOW_ACTION_MARK;
8cbfe939abe9052 Baowen Zheng    2021-12-17  403  		else if (is_tcf_skbedit_ptype(act))
8cbfe939abe9052 Baowen Zheng    2021-12-17  404  			fl_action->id = FLOW_ACTION_PTYPE;
8cbfe939abe9052 Baowen Zheng    2021-12-17  405  		else if (is_tcf_skbedit_priority(act))
8cbfe939abe9052 Baowen Zheng    2021-12-17  406  			fl_action->id = FLOW_ACTION_PRIORITY;
4a6a676f8c16ec1 Amritha Nambiar 2022-10-21  407  		else if (is_tcf_skbedit_rx_queue_mapping(act))
4a6a676f8c16ec1 Amritha Nambiar 2022-10-21  408  			fl_action->id = FLOW_ACTION_RX_QUEUE_MAPPING;
8cbfe939abe9052 Baowen Zheng    2021-12-17  409  		else
c54e1d920f04d52 Baowen Zheng    2021-12-17  410  			return -EOPNOTSUPP;
c54e1d920f04d52 Baowen Zheng    2021-12-17  411  	}
c54e1d920f04d52 Baowen Zheng    2021-12-17  412  
c54e1d920f04d52 Baowen Zheng    2021-12-17  413  	return 0;
c54e1d920f04d52 Baowen Zheng    2021-12-17  414  }
c54e1d920f04d52 Baowen Zheng    2021-12-17  415
kernel test robot Jan. 10, 2023, 8:37 p.m. UTC | #3
Hi Vlad,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on net-next/master]

url:    https://github.com/intel-lab-lkp/linux/commits/Vlad-Buslov/net-flow_offload-provision-conntrack-info-in-ct_metadata/20230110-213500
patch link:    https://lore.kernel.org/r/20230110133023.2366381-2-vladbu%40nvidia.com
patch subject: [PATCH net-next v1 1/7] net: flow_offload: provision conntrack info in ct_metadata
config: hexagon-randconfig-r045-20230110
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 8d9828ef5aa9688500657d36cd2aefbe12bbd162)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/99f16b3535be4a9588707780f082146c647c5b5f
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Vlad-Buslov/net-flow_offload-provision-conntrack-info-in-ct_metadata/20230110-213500
        git checkout 99f16b3535be4a9588707780f082146c647c5b5f
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/net/ethernet/mediatek/ net/sched/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>

All error/warnings (new ones prefixed by >>):

   In file included from net/sched/cls_flow.c:14:
   In file included from include/linux/skbuff.h:17:
   In file included from include/linux/bvec.h:10:
   In file included from include/linux/highmem.h:12:
   In file included from include/linux/hardirq.h:11:
   In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/hexagon/include/asm/io.h:334:
   include/asm-generic/io.h:547:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __raw_readb(PCI_IOBASE + addr);
                             ~~~~~~~~~~ ^
   include/asm-generic/io.h:560:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
                                                           ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/little_endian.h:37:51: note: expanded from macro '__le16_to_cpu'
   #define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
                                                     ^
   In file included from net/sched/cls_flow.c:14:
   In file included from include/linux/skbuff.h:17:
   In file included from include/linux/bvec.h:10:
   In file included from include/linux/highmem.h:12:
   In file included from include/linux/hardirq.h:11:
   In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/hexagon/include/asm/io.h:334:
   include/asm-generic/io.h:573:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
                                                           ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/little_endian.h:35:51: note: expanded from macro '__le32_to_cpu'
   #define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
                                                     ^
   In file included from net/sched/cls_flow.c:14:
   In file included from include/linux/skbuff.h:17:
   In file included from include/linux/bvec.h:10:
   In file included from include/linux/highmem.h:12:
   In file included from include/linux/hardirq.h:11:
   In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/hexagon/include/asm/io.h:334:
   include/asm-generic/io.h:584:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writeb(value, PCI_IOBASE + addr);
                               ~~~~~~~~~~ ^
   include/asm-generic/io.h:594:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
                                                         ~~~~~~~~~~ ^
   include/asm-generic/io.h:604:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
                                                         ~~~~~~~~~~ ^
   In file included from net/sched/cls_flow.c:23:
   In file included from include/net/pkt_cls.h:7:
   In file included from include/net/sch_generic.h:21:
   include/net/flow_offload.h:291:27: error: field has incomplete type 'enum ip_conntrack_info'
                           enum ip_conntrack_info ctinfo;
                                                  ^
   include/net/flow_offload.h:291:9: note: forward declaration of 'enum ip_conntrack_info'
                           enum ip_conntrack_info ctinfo;
                                ^
>> net/sched/cls_flow.c:64:52: warning: shift count >= width of type [-Wshift-count-overflow]
           return (a & 0xFFFFFFFF) ^ (BITS_PER_LONG > 32 ? a >> 32 : 0);
                                                             ^  ~~
   7 warnings and 1 error generated.
--
   In file included from drivers/net/ethernet/mediatek/mtk_ppe_offload.c:6:
   In file included from include/linux/if_ether.h:19:
   In file included from include/linux/skbuff.h:17:
   In file included from include/linux/bvec.h:10:
   In file included from include/linux/highmem.h:12:
   In file included from include/linux/hardirq.h:11:
   In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/hexagon/include/asm/io.h:334:
   include/asm-generic/io.h:547:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __raw_readb(PCI_IOBASE + addr);
                             ~~~~~~~~~~ ^
   include/asm-generic/io.h:560:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
                                                           ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/little_endian.h:37:51: note: expanded from macro '__le16_to_cpu'
   #define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
                                                     ^
   In file included from drivers/net/ethernet/mediatek/mtk_ppe_offload.c:6:
   In file included from include/linux/if_ether.h:19:
   In file included from include/linux/skbuff.h:17:
   In file included from include/linux/bvec.h:10:
   In file included from include/linux/highmem.h:12:
   In file included from include/linux/hardirq.h:11:
   In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/hexagon/include/asm/io.h:334:
   include/asm-generic/io.h:573:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
                                                           ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/little_endian.h:35:51: note: expanded from macro '__le32_to_cpu'
   #define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
                                                     ^
   In file included from drivers/net/ethernet/mediatek/mtk_ppe_offload.c:6:
   In file included from include/linux/if_ether.h:19:
   In file included from include/linux/skbuff.h:17:
   In file included from include/linux/bvec.h:10:
   In file included from include/linux/highmem.h:12:
   In file included from include/linux/hardirq.h:11:
   In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/hexagon/include/asm/io.h:334:
   include/asm-generic/io.h:584:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writeb(value, PCI_IOBASE + addr);
                               ~~~~~~~~~~ ^
   include/asm-generic/io.h:594:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
                                                         ~~~~~~~~~~ ^
   include/asm-generic/io.h:604:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
                                                         ~~~~~~~~~~ ^
   In file included from drivers/net/ethernet/mediatek/mtk_ppe_offload.c:10:
   include/net/flow_offload.h:291:27: error: field has incomplete type 'enum ip_conntrack_info'
                           enum ip_conntrack_info ctinfo;
                                                  ^
   include/net/flow_offload.h:291:9: note: forward declaration of 'enum ip_conntrack_info'
                           enum ip_conntrack_info ctinfo;
                                ^
>> drivers/net/ethernet/mediatek/mtk_ppe_offload.c:75:26: error: no member named 'mangle' in 'struct flow_action_entry'
           void *dest = eth + act->mangle.offset;
                              ~~~  ^
   drivers/net/ethernet/mediatek/mtk_ppe_offload.c:76:26: error: no member named 'mangle' in 'struct flow_action_entry'
           const void *src = &act->mangle.val;
                              ~~~  ^
   drivers/net/ethernet/mediatek/mtk_ppe_offload.c:78:11: error: no member named 'mangle' in 'struct flow_action_entry'
           if (act->mangle.offset > 8)
               ~~~  ^
   drivers/net/ethernet/mediatek/mtk_ppe_offload.c:81:11: error: no member named 'mangle' in 'struct flow_action_entry'
           if (act->mangle.mask == 0xffff) {
               ~~~  ^
   drivers/net/ethernet/mediatek/mtk_ppe_offload.c:86:25: error: no member named 'mangle' in 'struct flow_action_entry'
           memcpy(dest, src, act->mangle.mask ? 2 : 4);
                             ~~~  ^
   drivers/net/ethernet/mediatek/mtk_ppe_offload.c:123:23: error: no member named 'mangle' in 'struct flow_action_entry'
           u32 val = ntohl(act->mangle.val);
                           ~~~  ^
   include/linux/byteorder/generic.h:140:27: note: expanded from macro 'ntohl'
   #define ntohl(x) ___ntohl(x)
                             ^
   include/linux/byteorder/generic.h:136:35: note: expanded from macro '___ntohl'
   #define ___ntohl(x) __be32_to_cpu(x)
                                     ^
   include/uapi/linux/byteorder/little_endian.h:41:59: note: expanded from macro '__be32_to_cpu'
   #define __be32_to_cpu(x) __swab32((__force __u32)(__be32)(x))
                                                             ^
   include/uapi/linux/swab.h:118:31: note: expanded from macro '__swab32'
           (__u32)(__builtin_constant_p(x) ?       \
                                        ^
   drivers/net/ethernet/mediatek/mtk_ppe_offload.c:123:23: error: no member named 'mangle' in 'struct flow_action_entry'
           u32 val = ntohl(act->mangle.val);
                           ~~~  ^
   include/linux/byteorder/generic.h:140:27: note: expanded from macro 'ntohl'
   #define ntohl(x) ___ntohl(x)
                             ^
   include/linux/byteorder/generic.h:136:35: note: expanded from macro '___ntohl'
   #define ___ntohl(x) __be32_to_cpu(x)
                                     ^
   include/uapi/linux/byteorder/little_endian.h:41:59: note: expanded from macro '__be32_to_cpu'
   #define __be32_to_cpu(x) __swab32((__force __u32)(__be32)(x))
                                                             ^
   include/uapi/linux/swab.h:119:21: note: expanded from macro '__swab32'
           ___constant_swab32(x) :                 \
                              ^
   include/uapi/linux/swab.h:19:12: note: expanded from macro '___constant_swab32'
           (((__u32)(x) & (__u32)0x000000ffUL) << 24) |            \
                     ^
   drivers/net/ethernet/mediatek/mtk_ppe_offload.c:123:23: error: no member named 'mangle' in 'struct flow_action_entry'
           u32 val = ntohl(act->mangle.val);
                           ~~~  ^
   include/linux/byteorder/generic.h:140:27: note: expanded from macro 'ntohl'
   #define ntohl(x) ___ntohl(x)
                             ^
   include/linux/byteorder/generic.h:136:35: note: expanded from macro '___ntohl'
   #define ___ntohl(x) __be32_to_cpu(x)
                                     ^
   include/uapi/linux/byteorder/little_endian.h:41:59: note: expanded from macro '__be32_to_cpu'
   #define __be32_to_cpu(x) __swab32((__force __u32)(__be32)(x))
                                                             ^
   include/uapi/linux/swab.h:119:21: note: expanded from macro '__swab32'
           ___constant_swab32(x) :                 \
                              ^
   include/uapi/linux/swab.h:20:12: note: expanded from macro '___constant_swab32'
           (((__u32)(x) & (__u32)0x0000ff00UL) <<  8) |            \
                     ^
   drivers/net/ethernet/mediatek/mtk_ppe_offload.c:123:23: error: no member named 'mangle' in 'struct flow_action_entry'
           u32 val = ntohl(act->mangle.val);
                           ~~~  ^
   include/linux/byteorder/generic.h:140:27: note: expanded from macro 'ntohl'
   #define ntohl(x) ___ntohl(x)
                             ^
   include/linux/byteorder/generic.h:136:35: note: expanded from macro '___ntohl'
   #define ___ntohl(x) __be32_to_cpu(x)
                                     ^
   include/uapi/linux/byteorder/little_endian.h:41:59: note: expanded from macro '__be32_to_cpu'
   #define __be32_to_cpu(x) __swab32((__force __u32)(__be32)(x))
                                                             ^
   include/uapi/linux/swab.h:119:21: note: expanded from macro '__swab32'
           ___constant_swab32(x) :                 \
                              ^
   include/uapi/linux/swab.h:21:12: note: expanded from macro '___constant_swab32'
           (((__u32)(x) & (__u32)0x00ff0000UL) >>  8) |            \
                     ^
   drivers/net/ethernet/mediatek/mtk_ppe_offload.c:123:23: error: no member named 'mangle' in 'struct flow_action_entry'
           u32 val = ntohl(act->mangle.val);
                           ~~~  ^
   include/linux/byteorder/generic.h:140:27: note: expanded from macro 'ntohl'
   #define ntohl(x) ___ntohl(x)
                             ^
   include/linux/byteorder/generic.h:136:35: note: expanded from macro '___ntohl'
   #define ___ntohl(x) __be32_to_cpu(x)
                                     ^
   include/uapi/linux/byteorder/little_endian.h:41:59: note: expanded from macro '__be32_to_cpu'
   #define __be32_to_cpu(x) __swab32((__force __u32)(__be32)(x))
                                                             ^
   include/uapi/linux/swab.h:119:21: note: expanded from macro '__swab32'
           ___constant_swab32(x) :                 \
                              ^
   include/uapi/linux/swab.h:22:12: note: expanded from macro '___constant_swab32'
           (((__u32)(x) & (__u32)0xff000000UL) >> 24)))
                     ^
   drivers/net/ethernet/mediatek/mtk_ppe_offload.c:123:23: error: no member named 'mangle' in 'struct flow_action_entry'
           u32 val = ntohl(act->mangle.val);
                           ~~~  ^
   include/linux/byteorder/generic.h:140:27: note: expanded from macro 'ntohl'
   #define ntohl(x) ___ntohl(x)
                             ^
   include/linux/byteorder/generic.h:136:35: note: expanded from macro '___ntohl'
   #define ___ntohl(x) __be32_to_cpu(x)
                                     ^
   include/uapi/linux/byteorder/little_endian.h:41:59: note: expanded from macro '__be32_to_cpu'
   #define __be32_to_cpu(x) __swab32((__force __u32)(__be32)(x))
                                                             ^
   include/uapi/linux/swab.h:120:12: note: expanded from macro '__swab32'
           __fswab32(x))
                     ^
   drivers/net/ethernet/mediatek/mtk_ppe_offload.c:125:15: error: no member named 'mangle' in 'struct flow_action_entry'
           switch (act->mangle.offset) {
                   ~~~  ^
   drivers/net/ethernet/mediatek/mtk_ppe_offload.c:127:12: error: no member named 'mangle' in 'struct flow_action_entry'
                   if (act->mangle.mask == ~htonl(0xffff))
                       ~~~  ^
   drivers/net/ethernet/mediatek/mtk_ppe_offload.c:148:15: error: no member named 'mangle' in 'struct flow_action_entry'
           switch (act->mangle.offset) {
                   ~~~  ^
   drivers/net/ethernet/mediatek/mtk_ppe_offload.c:159:21: error: no member named 'mangle' in 'struct flow_action_entry'
           memcpy(dest, &act->mangle.val, sizeof(u32));
                         ~~~  ^
   drivers/net/ethernet/mediatek/mtk_ppe_offload.c:321:13: error: no member named 'mangle' in 'struct flow_action_entry'
                           if (act->mangle.htype == FLOW_ACT_MANGLE_HDR_TYPE_ETH)
                               ~~~  ^
>> drivers/net/ethernet/mediatek/mtk_ppe_offload.c:325:16: error: no member named 'dev' in 'struct flow_action_entry'
                           odev = act->dev;
                                  ~~~  ^
>> drivers/net/ethernet/mediatek/mtk_ppe_offload.c:331:13: error: no member named 'vlan' in 'struct flow_action_entry'
                               act->vlan.proto != htons(ETH_P_8021Q))
                               ~~~  ^
   fatal error: too many errors emitted, stopping now [-ferror-limit=]
   6 warnings and 20 errors generated.


vim +75 drivers/net/ethernet/mediatek/mtk_ppe_offload.c

817b2fdf166766b David Bentham 2022-04-05  71  
502e84e2382d926 Felix Fietkau 2021-03-24  72  static void
502e84e2382d926 Felix Fietkau 2021-03-24  73  mtk_flow_offload_mangle_eth(const struct flow_action_entry *act, void *eth)
502e84e2382d926 Felix Fietkau 2021-03-24  74  {
502e84e2382d926 Felix Fietkau 2021-03-24 @75  	void *dest = eth + act->mangle.offset;
502e84e2382d926 Felix Fietkau 2021-03-24  76  	const void *src = &act->mangle.val;
502e84e2382d926 Felix Fietkau 2021-03-24  77  
502e84e2382d926 Felix Fietkau 2021-03-24  78  	if (act->mangle.offset > 8)
502e84e2382d926 Felix Fietkau 2021-03-24  79  		return;
502e84e2382d926 Felix Fietkau 2021-03-24  80  
502e84e2382d926 Felix Fietkau 2021-03-24  81  	if (act->mangle.mask == 0xffff) {
502e84e2382d926 Felix Fietkau 2021-03-24  82  		src += 2;
502e84e2382d926 Felix Fietkau 2021-03-24  83  		dest += 2;
502e84e2382d926 Felix Fietkau 2021-03-24  84  	}
502e84e2382d926 Felix Fietkau 2021-03-24  85  
502e84e2382d926 Felix Fietkau 2021-03-24  86  	memcpy(dest, src, act->mangle.mask ? 2 : 4);
502e84e2382d926 Felix Fietkau 2021-03-24  87  }
502e84e2382d926 Felix Fietkau 2021-03-24  88
kernel test robot Jan. 10, 2023, 8:47 p.m. UTC | #4
Hi Vlad,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on net-next/master]

url:    https://github.com/intel-lab-lkp/linux/commits/Vlad-Buslov/net-flow_offload-provision-conntrack-info-in-ct_metadata/20230110-213500
patch link:    https://lore.kernel.org/r/20230110133023.2366381-2-vladbu%40nvidia.com
patch subject: [PATCH net-next v1 1/7] net: flow_offload: provision conntrack info in ct_metadata
config: i386-randconfig-a004
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/99f16b3535be4a9588707780f082146c647c5b5f
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Vlad-Buslov/net-flow_offload-provision-conntrack-info-in-ct_metadata/20230110-213500
        git checkout 99f16b3535be4a9588707780f082146c647c5b5f
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/net/ethernet/broadcom/bnx2x/ drivers/net/ethernet/broadcom/bnxt/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   In file included from drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c:49:
   In file included from include/net/tcp.h:35:
   In file included from include/net/sock_reuseport.h:5:
   In file included from include/linux/filter.h:26:
   In file included from include/net/sch_generic.h:21:
   include/net/flow_offload.h:291:27: error: field has incomplete type 'enum ip_conntrack_info'
                           enum ip_conntrack_info ctinfo;
                                                  ^
   include/net/flow_offload.h:291:9: note: forward declaration of 'enum ip_conntrack_info'
                           enum ip_conntrack_info ctinfo;
                                ^
   drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c:13117:49: warning: shift count >= width of type [-Wshift-count-overflow]
           rc = dma_set_mask_and_coherent(&bp->pdev->dev, DMA_BIT_MASK(64));
                                                          ^~~~~~~~~~~~~~~~
   include/linux/dma-mapping.h:76:54: note: expanded from macro 'DMA_BIT_MASK'
   #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
                                                        ^ ~~~
>> drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c:15206:26: warning: shift count >= width of type [-Wshift-count-overflow]
           bp->cyclecounter.mask = CYCLECOUNTER_MASK(64);
                                   ^~~~~~~~~~~~~~~~~~~~~
   include/linux/timecounter.h:14:59: note: expanded from macro 'CYCLECOUNTER_MASK'
   #define CYCLECOUNTER_MASK(bits) (u64)((bits) < 64 ? ((1ULL<<(bits))-1) : -1)
                                                             ^ ~~~~~~
   2 warnings and 1 error generated.


vim +15206 drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c

eeed018cbfa30c0 Michal Kalderon         2014-08-17  15201  
eeed018cbfa30c0 Michal Kalderon         2014-08-17  15202  static void bnx2x_init_cyclecounter(struct bnx2x *bp)
eeed018cbfa30c0 Michal Kalderon         2014-08-17  15203  {
eeed018cbfa30c0 Michal Kalderon         2014-08-17  15204  	memset(&bp->cyclecounter, 0, sizeof(bp->cyclecounter));
eeed018cbfa30c0 Michal Kalderon         2014-08-17  15205  	bp->cyclecounter.read = bnx2x_cyclecounter_read;
f28ba401dbd9e9f Richard Cochran         2015-01-02 @15206  	bp->cyclecounter.mask = CYCLECOUNTER_MASK(64);
a6e2846cacf97d4 Sudarsana Reddy Kalluru 2016-10-21  15207  	bp->cyclecounter.shift = 0;
eeed018cbfa30c0 Michal Kalderon         2014-08-17  15208  	bp->cyclecounter.mult = 1;
eeed018cbfa30c0 Michal Kalderon         2014-08-17  15209  }
eeed018cbfa30c0 Michal Kalderon         2014-08-17  15210
Simon Horman Jan. 13, 2023, 9:12 a.m. UTC | #5
+ Baowen Zheng, oss-drivers@corigine.com

On Tue, Jan 10, 2023 at 02:30:17PM +0100, Vlad Buslov wrote:
> In order to offload connections in other states besides "established" the
> driver offload callbacks need to have access to connection conntrack info.
> Extend flow offload intermediate representation data structure
> flow_action_entry->ct_metadata with new enum ip_conntrack_info field and
> fill it in tcf_ct_flow_table_add_action_meta() callback.
> 
> Reject offloading IP_CT_NEW connections for now by returning an error in
> relevant driver callbacks based on value of ctinfo. Support for offloading
> such connections will need to be added to the drivers afterwards.
> 
> Signed-off-by: Vlad Buslov <vladbu@nvidia.com>
> ---

...

> diff --git a/drivers/net/ethernet/netronome/nfp/flower/conntrack.c b/drivers/net/ethernet/netronome/nfp/flower/conntrack.c
> index f693119541d5..2c550a1792b7 100644
> --- a/drivers/net/ethernet/netronome/nfp/flower/conntrack.c
> +++ b/drivers/net/ethernet/netronome/nfp/flower/conntrack.c
> @@ -1964,6 +1964,23 @@ int nfp_fl_ct_stats(struct flow_cls_offload *flow,
>  	return 0;
>  }
>  
> +static bool
> +nfp_fl_ct_offload_supported(struct flow_cls_offload *flow)
> +{
> +	struct flow_rule *flow_rule = flow->rule;
> +	struct flow_action *flow_action =
> +		&flow_rule->action;
> +	struct flow_action_entry *act;
> +	int i;
> +
> +	flow_action_for_each(i, act, flow_action) {
> +		if (act->id == FLOW_ACTION_CT_METADATA)
> +			return act->ct_metadata.ctinfo != IP_CT_NEW;
> +	}
> +
> +	return false;
> +}
> +

Hi Vlad,

Some feedback from Baowen Zheng, who asked me to pass it on here:

  It is confusing that after FLOW_ACTION_CT_METADATA check, this functoin
  will return false, that is -EOPNOTSUPP.

  Since this function is only used to check nft table, It seems better to
  change its name to nfp_fl_ct_offload_nft_supported(). This would make things
  clearer and may avoid it being used in the wrong way.

...
Vlad Buslov Jan. 13, 2023, 4:15 p.m. UTC | #6
On Fri 13 Jan 2023 at 10:12, Simon Horman <simon.horman@corigine.com> wrote:
> + Baowen Zheng, oss-drivers@corigine.com
>
> On Tue, Jan 10, 2023 at 02:30:17PM +0100, Vlad Buslov wrote:
>> In order to offload connections in other states besides "established" the
>> driver offload callbacks need to have access to connection conntrack info.
>> Extend flow offload intermediate representation data structure
>> flow_action_entry->ct_metadata with new enum ip_conntrack_info field and
>> fill it in tcf_ct_flow_table_add_action_meta() callback.
>> 
>> Reject offloading IP_CT_NEW connections for now by returning an error in
>> relevant driver callbacks based on value of ctinfo. Support for offloading
>> such connections will need to be added to the drivers afterwards.
>> 
>> Signed-off-by: Vlad Buslov <vladbu@nvidia.com>
>> ---
>
> ...
>
>> diff --git a/drivers/net/ethernet/netronome/nfp/flower/conntrack.c b/drivers/net/ethernet/netronome/nfp/flower/conntrack.c
>> index f693119541d5..2c550a1792b7 100644
>> --- a/drivers/net/ethernet/netronome/nfp/flower/conntrack.c
>> +++ b/drivers/net/ethernet/netronome/nfp/flower/conntrack.c
>> @@ -1964,6 +1964,23 @@ int nfp_fl_ct_stats(struct flow_cls_offload *flow,
>>  	return 0;
>>  }
>>  
>> +static bool
>> +nfp_fl_ct_offload_supported(struct flow_cls_offload *flow)
>> +{
>> +	struct flow_rule *flow_rule = flow->rule;
>> +	struct flow_action *flow_action =
>> +		&flow_rule->action;
>> +	struct flow_action_entry *act;
>> +	int i;
>> +
>> +	flow_action_for_each(i, act, flow_action) {
>> +		if (act->id == FLOW_ACTION_CT_METADATA)
>> +			return act->ct_metadata.ctinfo != IP_CT_NEW;
>> +	}
>> +
>> +	return false;
>> +}
>> +
>
> Hi Vlad,
>
> Some feedback from Baowen Zheng, who asked me to pass it on here:
>
>   It is confusing that after FLOW_ACTION_CT_METADATA check, this functoin
>   will return false, that is -EOPNOTSUPP.
>
>   Since this function is only used to check nft table, It seems better to
>   change its name to nfp_fl_ct_offload_nft_supported(). This would make things
>   clearer and may avoid it being used in the wrong way.

Thanks for the suggestions! I will change the naming and send V2.
Simon Horman Jan. 17, 2023, 7:55 a.m. UTC | #7
On Fri, Jan 13, 2023 at 06:15:55PM +0200, Vlad Buslov wrote:
> On Fri 13 Jan 2023 at 10:12, Simon Horman <simon.horman@corigine.com> wrote:
> > + Baowen Zheng, oss-drivers@corigine.com

...

> > Hi Vlad,
> >
> > Some feedback from Baowen Zheng, who asked me to pass it on here:
> >
> >   It is confusing that after FLOW_ACTION_CT_METADATA check, this functoin
> >   will return false, that is -EOPNOTSUPP.
> >
> >   Since this function is only used to check nft table, It seems better to
> >   change its name to nfp_fl_ct_offload_nft_supported(). This would make things
> >   clearer and may avoid it being used in the wrong way.
> 
> Thanks for the suggestions! I will change the naming and send V2.

Thanks Vlad, much appreciated.
diff mbox series

Patch

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c
index 313df8232db7..8cad5cf3305d 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c
@@ -1077,7 +1077,7 @@  mlx5_tc_ct_block_flow_offload_add(struct mlx5_ct_ft *ft,
 	int err;
 
 	meta_action = mlx5_tc_ct_get_ct_metadata_action(flow_rule);
-	if (!meta_action)
+	if (!meta_action || meta_action->ct_metadata.ctinfo == IP_CT_NEW)
 		return -EOPNOTSUPP;
 
 	spin_lock_bh(&ct_priv->ht_lock);
diff --git a/drivers/net/ethernet/netronome/nfp/flower/conntrack.c b/drivers/net/ethernet/netronome/nfp/flower/conntrack.c
index f693119541d5..2c550a1792b7 100644
--- a/drivers/net/ethernet/netronome/nfp/flower/conntrack.c
+++ b/drivers/net/ethernet/netronome/nfp/flower/conntrack.c
@@ -1964,6 +1964,23 @@  int nfp_fl_ct_stats(struct flow_cls_offload *flow,
 	return 0;
 }
 
+static bool
+nfp_fl_ct_offload_supported(struct flow_cls_offload *flow)
+{
+	struct flow_rule *flow_rule = flow->rule;
+	struct flow_action *flow_action =
+		&flow_rule->action;
+	struct flow_action_entry *act;
+	int i;
+
+	flow_action_for_each(i, act, flow_action) {
+		if (act->id == FLOW_ACTION_CT_METADATA)
+			return act->ct_metadata.ctinfo != IP_CT_NEW;
+	}
+
+	return false;
+}
+
 static int
 nfp_fl_ct_offload_nft_flow(struct nfp_fl_ct_zone_entry *zt, struct flow_cls_offload *flow)
 {
@@ -1976,6 +1993,9 @@  nfp_fl_ct_offload_nft_flow(struct nfp_fl_ct_zone_entry *zt, struct flow_cls_offl
 	extack = flow->common.extack;
 	switch (flow->command) {
 	case FLOW_CLS_REPLACE:
+		if (!nfp_fl_ct_offload_supported(flow))
+			return -EOPNOTSUPP;
+
 		/* Netfilter can request offload multiple times for the same
 		 * flow - protect against adding duplicates.
 		 */
diff --git a/include/net/flow_offload.h b/include/net/flow_offload.h
index 0400a0ac8a29..4a350f518b40 100644
--- a/include/net/flow_offload.h
+++ b/include/net/flow_offload.h
@@ -288,6 +288,7 @@  struct flow_action_entry {
 		} ct;
 		struct {
 			unsigned long cookie;
+			enum ip_conntrack_info ctinfo;
 			u32 mark;
 			u32 labels[4];
 			bool orig_dir;
diff --git a/net/sched/act_ct.c b/net/sched/act_ct.c
index 0ca2bb8ed026..515577f913a3 100644
--- a/net/sched/act_ct.c
+++ b/net/sched/act_ct.c
@@ -187,6 +187,7 @@  static void tcf_ct_flow_table_add_action_meta(struct nf_conn *ct,
 	/* aligns with the CT reference on the SKB nf_ct_set */
 	entry->ct_metadata.cookie = (unsigned long)ct | ctinfo;
 	entry->ct_metadata.orig_dir = dir == IP_CT_DIR_ORIGINAL;
+	entry->ct_metadata.ctinfo = ctinfo;
 
 	act_ct_labels = entry->ct_metadata.labels;
 	ct_labels = nf_ct_labels_find(ct);