All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 net-next 0/10] allow user to offload tc action to net device
@ 2021-11-18 13:07 Simon Horman
  2021-11-18 13:07 ` [PATCH v4 01/10] flow_offload: fill flags to action structure Simon Horman
                   ` (10 more replies)
  0 siblings, 11 replies; 31+ messages in thread
From: Simon Horman @ 2021-11-18 13:07 UTC (permalink / raw)
  To: netdev
  Cc: Cong Wang, Ido Schimmel, Jamal Hadi Salim, Jiri Pirko, Oz Shlomo,
	Roi Dayan, Vlad Buslov, Baowen Zheng, Louis Peens, oss-drivers

Baowen Zheng says:

Allow use of flow_indr_dev_register/flow_indr_dev_setup_offload to offload
tc actions independent of flows.

The motivation for this work is to prepare for using TC police action
instances to provide hardware offload of OVS metering feature - which calls
for policers that may be used by multiple flows and whose lifecycle is
independent of any flows that use them.

This patch includes basic changes to offload drivers to return EOPNOTSUPP
if this feature is used - it is not yet supported by any driver.

Tc cli command to offload and quote an action:

  tc qdisc add dev $DEV ingress
  tc qdisc show dev $DEV ingress

  tc actions add action police rate 100mbit burst 10000k index 200 skip_sw
  tc -s -d actions list action police

  tc filter add dev $DEV protocol ip parent ffff: \
    flower skip_sw ip_proto tcp action police index 200
  tc -s -d filter show dev $DEV protocol ip parent ffff:
  tc filter add dev $DEV protocol ipv6 parent ffff: \
    flower skip_sw ip_proto tcp action police index 200
  tc -s -d filter show dev $DEV protocol ipv6 parent ffff:
  tc -s -d actions list action police

Output for the tc action verbose dump:

  action order 0: police index 200 rate 100Mbit burst 10000Kb mtu 2Kb action drop overhead 0 linklayer unspec ref 3 bind 2 installed 52 sec used 0 sec firstused 30 sec
  Action statistics:
  Sent 136094386 bytes 91110 pkt (dropped 0, overlimits 0 requeues 0)
  Sent software 0 bytes 0 pkt
  Sent hardware 136094386 bytes 91110 pkt
  backlog 0b 0p requeues 0
  skip_sw in_hw in_hw_count 1
  used_hw_stats delayed

Tc cli cleanup commands

  tc qdisc del dev $DEV ingress && sleep 1
  tc actions delete action police index 200

Changes compared to v3 patches:
* Made changes according to the public review comments.
* Validate flags inside tcf_action_init() instead of creating new
  tcf_exts_validate_actions() function.
* Exactly match when validating flags of actions and filters.
* Add index to flow_action_entry for driver to identify actions.

Baowen Zheng (10):
  flow_offload: fill flags to action structure
  flow_offload: reject to offload tc actions in offload drivers
  flow_offload: add index to flow_action_entry structure
  flow_offload: allow user to offload tc action to net device
  flow_offload: add skip_hw and skip_sw to control if offload the action
  flow_offload: add process to update action stats from hardware
  net: sched: save full flags for tc action
  flow_offload: add reoffload process to update hw_count
  flow_offload: validate flags of filter and actions
  selftests: tc-testing: add action offload selftest for action and
    filter

 drivers/net/dsa/sja1105/sja1105_flower.c      |   2 +-
 drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c  |   2 +-
 .../net/ethernet/freescale/enetc/enetc_qos.c  |   6 +-
 .../ethernet/mellanox/mlx5/core/en/rep/tc.c   |   3 +
 .../ethernet/mellanox/mlxsw/spectrum_flower.c |   2 +-
 .../ethernet/netronome/nfp/flower/offload.c   |   3 +
 include/linux/netdevice.h                     |   1 +
 include/net/act_api.h                         |  34 +-
 include/net/flow_offload.h                    |  20 +-
 include/net/pkt_cls.h                         |  56 ++-
 include/net/tc_act/tc_gate.h                  |   5 -
 include/uapi/linux/pkt_cls.h                  |   9 +-
 net/core/flow_offload.c                       |  47 +-
 net/sched/act_api.c                           | 451 +++++++++++++++++-
 net/sched/act_bpf.c                           |   2 +-
 net/sched/act_connmark.c                      |   2 +-
 net/sched/act_ctinfo.c                        |   2 +-
 net/sched/act_gate.c                          |   2 +-
 net/sched/act_ife.c                           |   2 +-
 net/sched/act_ipt.c                           |   2 +-
 net/sched/act_mpls.c                          |   2 +-
 net/sched/act_nat.c                           |   2 +-
 net/sched/act_pedit.c                         |   2 +-
 net/sched/act_police.c                        |   2 +-
 net/sched/act_sample.c                        |   2 +-
 net/sched/act_simple.c                        |   2 +-
 net/sched/act_skbedit.c                       |   2 +-
 net/sched/act_skbmod.c                        |   2 +-
 net/sched/cls_api.c                           |  52 +-
 net/sched/cls_flower.c                        |   9 +-
 net/sched/cls_matchall.c                      |   9 +-
 net/sched/cls_u32.c                           |  12 +-
 .../tc-testing/tc-tests/actions/police.json   |  24 +
 .../tc-testing/tc-tests/filters/matchall.json |  24 +
 34 files changed, 719 insertions(+), 80 deletions(-)

-- 
2.20.1


^ permalink raw reply	[flat|nested] 31+ messages in thread
* Re: [PATCH v4 08/10] flow_offload: add reoffload process to update hw_count
@ 2021-11-19 21:48 kernel test robot
  0 siblings, 0 replies; 31+ messages in thread
From: kernel test robot @ 2021-11-19 21:48 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 4914 bytes --]

CC: kbuild-all(a)lists.01.org
In-Reply-To: <20211118130805.23897-9-simon.horman@corigine.com>
References: <20211118130805.23897-9-simon.horman@corigine.com>
TO: Simon Horman <simon.horman@corigine.com>
TO: netdev(a)vger.kernel.org
CC: Cong Wang <xiyou.wangcong@gmail.com>
CC: Ido Schimmel <idosch@nvidia.com>
CC: Jamal Hadi Salim <jhs@mojatatu.com>
CC: Jiri Pirko <jiri@resnulli.us>
CC: Oz Shlomo <ozsh@nvidia.com>
CC: Roi Dayan <roid@nvidia.com>
CC: Vlad Buslov <vladbu@nvidia.com>
CC: Baowen Zheng <baowen.zheng@corigine.com>
CC: Louis Peens <louis.peens@corigine.com>

Hi Simon,

Thank you for the patch! Perhaps something to improve:

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

url:    https://github.com/0day-ci/linux/commits/Simon-Horman/allow-user-to-offload-tc-action-to-net-device/20211118-210959
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git f6ef47e5bdc6f652176e433b02317fc83049f8d7
:::::: branch date: 33 hours ago
:::::: commit date: 33 hours ago
config: microblaze-randconfig-m031-20211118 (attached as .config)
compiler: microblaze-linux-gcc (GCC) 11.2.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

New smatch warnings:
net/sched/act_api.c:981 tcf_register_action() error: we previously assumed 'ops->id' could be null (see line 961)

Old smatch warnings:
arch/microblaze/include/asm/thread_info.h:91 current_thread_info() error: uninitialized symbol 'sp'.

vim +981 net/sched/act_api.c

^1da177e4c3f41 Linus Torvalds   2005-04-16  943  
ddf97ccdd7cb7e WANG Cong        2016-02-22  944  int tcf_register_action(struct tc_action_ops *act,
ddf97ccdd7cb7e WANG Cong        2016-02-22  945  			struct pernet_operations *ops)
^1da177e4c3f41 Linus Torvalds   2005-04-16  946  {
1f747c26c48bb2 WANG Cong        2013-12-15  947  	struct tc_action_ops *a;
ddf97ccdd7cb7e WANG Cong        2016-02-22  948  	int ret;
^1da177e4c3f41 Linus Torvalds   2005-04-16  949  
ddf97ccdd7cb7e WANG Cong        2016-02-22  950  	if (!act->act || !act->dump || !act->init || !act->walk || !act->lookup)
76c82d7a3d24a4 Jamal Hadi Salim 2013-12-04  951  		return -EINVAL;
76c82d7a3d24a4 Jamal Hadi Salim 2013-12-04  952  
ab102b80cef28c WANG Cong        2016-10-11  953  	/* We have to register pernet ops before making the action ops visible,
ab102b80cef28c WANG Cong        2016-10-11  954  	 * otherwise tcf_action_init_1() could get a partially initialized
ab102b80cef28c WANG Cong        2016-10-11  955  	 * netns.
ab102b80cef28c WANG Cong        2016-10-11  956  	 */
ab102b80cef28c WANG Cong        2016-10-11  957  	ret = register_pernet_subsys(ops);
ab102b80cef28c WANG Cong        2016-10-11  958  	if (ret)
ab102b80cef28c WANG Cong        2016-10-11  959  		return ret;
ab102b80cef28c WANG Cong        2016-10-11  960  
adae2ff19c2701 Baowen Zheng     2021-11-18 @961  	if (ops->id) {
adae2ff19c2701 Baowen Zheng     2021-11-18  962  		ret = tcf_pernet_add_id_list(*ops->id);
adae2ff19c2701 Baowen Zheng     2021-11-18  963  		if (ret)
adae2ff19c2701 Baowen Zheng     2021-11-18  964  			goto id_err;
adae2ff19c2701 Baowen Zheng     2021-11-18  965  	}
adae2ff19c2701 Baowen Zheng     2021-11-18  966  
^1da177e4c3f41 Linus Torvalds   2005-04-16  967  	write_lock(&act_mod_lock);
1f747c26c48bb2 WANG Cong        2013-12-15  968  	list_for_each_entry(a, &act_base, head) {
eddd2cf195d6fb Eli Cohen        2019-02-10  969  		if (act->id == a->id || (strcmp(act->kind, a->kind) == 0)) {
adae2ff19c2701 Baowen Zheng     2021-11-18  970  			ret = -EEXIST;
adae2ff19c2701 Baowen Zheng     2021-11-18  971  			goto err_out;
^1da177e4c3f41 Linus Torvalds   2005-04-16  972  		}
^1da177e4c3f41 Linus Torvalds   2005-04-16  973  	}
1f747c26c48bb2 WANG Cong        2013-12-15  974  	list_add_tail(&act->head, &act_base);
^1da177e4c3f41 Linus Torvalds   2005-04-16  975  	write_unlock(&act_mod_lock);
ddf97ccdd7cb7e WANG Cong        2016-02-22  976  
^1da177e4c3f41 Linus Torvalds   2005-04-16  977  	return 0;
adae2ff19c2701 Baowen Zheng     2021-11-18  978  
adae2ff19c2701 Baowen Zheng     2021-11-18  979  err_out:
adae2ff19c2701 Baowen Zheng     2021-11-18  980  	write_unlock(&act_mod_lock);
adae2ff19c2701 Baowen Zheng     2021-11-18 @981  	tcf_pernet_del_id_list(*ops->id);
adae2ff19c2701 Baowen Zheng     2021-11-18  982  id_err:
adae2ff19c2701 Baowen Zheng     2021-11-18  983  	unregister_pernet_subsys(ops);
adae2ff19c2701 Baowen Zheng     2021-11-18  984  	return ret;
^1da177e4c3f41 Linus Torvalds   2005-04-16  985  }
62e3ba1b558e5f Patrick McHardy  2008-01-22  986  EXPORT_SYMBOL(tcf_register_action);
^1da177e4c3f41 Linus Torvalds   2005-04-16  987  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 38555 bytes --]

^ permalink raw reply	[flat|nested] 31+ messages in thread

end of thread, other threads:[~2021-11-25  0:51 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-18 13:07 [PATCH v4 net-next 0/10] allow user to offload tc action to net device Simon Horman
2021-11-18 13:07 ` [PATCH v4 01/10] flow_offload: fill flags to action structure Simon Horman
2021-11-18 13:07 ` [PATCH v4 02/10] flow_offload: reject to offload tc actions in offload drivers Simon Horman
2021-11-18 13:07 ` [PATCH v4 03/10] flow_offload: add index to flow_action_entry structure Simon Horman
2021-11-19  6:31   ` Jakub Kicinski
2021-11-19  7:03     ` Baowen Zheng
2021-11-18 13:07 ` [PATCH v4 04/10] flow_offload: allow user to offload tc action to net device Simon Horman
2021-11-19 19:05   ` Vlad Buslov
2021-11-22  2:18     ` Baowen Zheng
2021-11-22 12:24   ` Jamal Hadi Salim
2021-11-23  8:23     ` Baowen Zheng
2021-11-23 19:03       ` Jamal Hadi Salim
2021-11-24  2:11         ` Baowen Zheng
2021-11-24  2:59           ` Baowen Zheng
2021-11-24 11:39             ` Jamal Hadi Salim
2021-11-24 13:47               ` Baowen Zheng
2021-11-24 14:58                 ` Jamal Hadi Salim
2021-11-25  0:49                   ` Baowen Zheng
2021-11-24 11:10           ` Jamal Hadi Salim
2021-11-24 11:32             ` Jamal Hadi Salim
2021-11-18 13:08 ` [PATCH v4 05/10] flow_offload: add skip_hw and skip_sw to control if offload the action Simon Horman
2021-11-18 13:08 ` [PATCH v4 06/10] flow_offload: add process to update action stats from hardware Simon Horman
2021-11-18 13:08 ` [PATCH v4 07/10] net: sched: save full flags for tc action Simon Horman
2021-11-18 13:08 ` [PATCH v4 08/10] flow_offload: add reoffload process to update hw_count Simon Horman
2021-11-19 20:09   ` Vlad Buslov
2021-11-22 10:13     ` Baowen Zheng
2021-11-18 13:08 ` [PATCH v4 09/10] flow_offload: validate flags of filter and actions Simon Horman
2021-11-18 13:08 ` [PATCH v4 10/10] selftests: tc-testing: add action offload selftest for action and filter Simon Horman
2021-11-22 12:17 ` [PATCH v4 net-next 0/10] allow user to offload tc action to net device Jamal Hadi Salim
2021-11-23  7:57   ` Baowen Zheng
  -- strict thread matches above, loose matches on Subject: below --
2021-11-19 21:48 [PATCH v4 08/10] flow_offload: add reoffload process to update hw_count kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.