diff mbox series

[net-next,v12,1/8] net/sched: Rename user cookie and act cookie

Message ID 20230215211014.6485-2-paulb@nvidia.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series net/sched: cls_api: Support hardware miss to tc action | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next, async
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 fail Errors and warnings before: 1800 this patch: 1802
netdev/cc_maintainers warning 2 maintainers not CCed: leon@kernel.org linux-rdma@vger.kernel.org
netdev/build_clang fail Errors and warnings before: 158 this patch: 160
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 fail Errors and warnings before: 1958 this patch: 1960
netdev/checkpatch warning WARNING: line length of 81 exceeds 80 columns WARNING: line length of 89 exceeds 80 columns
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Paul Blakey Feb. 15, 2023, 9:10 p.m. UTC
struct tc_action->act_cookie is a user defined cookie,
and the related struct flow_action_entry->act_cookie is
used as an handle similar to struct flow_cls_offload->cookie.

Rename tc_action->act_cookie to user_cookie, and
flow_action_entry->act_cookie to cookie so their names
would better fit their usage.

Signed-off-by: Paul Blakey <paulb@nvidia.com>
---
 .../net/ethernet/mellanox/mlx5/core/en_tc.c   |  2 +-
 include/net/act_api.h                         |  2 +-
 include/net/flow_offload.h                    |  4 +--
 net/sched/act_api.c                           | 26 ++++++++---------
 net/sched/cls_api.c                           | 28 +++++++++----------
 5 files changed, 31 insertions(+), 31 deletions(-)

Comments

Marcelo Ricardo Leitner Feb. 15, 2023, 10 p.m. UTC | #1
On Wed, Feb 15, 2023 at 11:10:07PM +0200, Paul Blakey wrote:
> struct tc_action->act_cookie is a user defined cookie,
> and the related struct flow_action_entry->act_cookie is
> used as an handle similar to struct flow_cls_offload->cookie.
> 
> Rename tc_action->act_cookie to user_cookie, and
> flow_action_entry->act_cookie to cookie so their names
> would better fit their usage.
> 
> Signed-off-by: Paul Blakey <paulb@nvidia.com>

Reviewed-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
kernel test robot Feb. 16, 2023, 12:01 a.m. UTC | #2
Hi Paul,

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/Paul-Blakey/net-sched-Rename-user-cookie-and-act-cookie/20230216-051354
patch link:    https://lore.kernel.org/r/20230215211014.6485-2-paulb%40nvidia.com
patch subject: [PATCH net-next v12 1/8] net/sched: Rename user cookie and act cookie
config: sparc-allyesconfig (https://download.01.org/0day-ci/archive/20230216/202302160703.Lk9KSGnE-lkp@intel.com/config)
compiler: sparc64-linux-gcc (GCC) 12.1.0
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/172c6e134bdb4051c442e2dfad973cf7b4b85ec7
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Paul-Blakey/net-sched-Rename-user-cookie-and-act-cookie/20230216-051354
        git checkout 172c6e134bdb4051c442e2dfad973cf7b4b85ec7
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=sparc olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=sparc SHELL=/bin/bash drivers/net/ethernet/mellanox/mlxsw/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202302160703.Lk9KSGnE-lkp@intel.com/

All warnings (new ones prefixed by >>):

   drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c: In function 'mlxsw_sp_flower_parse_actions':
>> drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c:106:62: warning: passing argument 3 of 'mlxsw_sp_acl_rulei_act_drop' makes pointer from integer without a cast [-Wint-conversion]
     106 |                                                           act->cookie, extack);
         |                                                           ~~~^~~~~~~~
         |                                                              |
         |                                                              long unsigned int
   In file included from drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c:15:
   drivers/net/ethernet/mellanox/mlxsw/spectrum.h:1020:66: note: expected 'const struct flow_action_cookie *' but argument is of type 'long unsigned int'
    1020 |                                 const struct flow_action_cookie *fa_cookie,
         |                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~


vim +/mlxsw_sp_acl_rulei_act_drop +106 drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c

d97b4b105ce71f Jianbo Liu         2022-02-24   57  
7aa0f5aa9030aa Jiri Pirko         2017-02-03   58  static int mlxsw_sp_flower_parse_actions(struct mlxsw_sp *mlxsw_sp,
3bc3ffb6e911f9 Jiri Pirko         2020-04-27   59  					 struct mlxsw_sp_flow_block *block,
7aa0f5aa9030aa Jiri Pirko         2017-02-03   60  					 struct mlxsw_sp_acl_rule_info *rulei,
738678817573ce Pablo Neira Ayuso  2019-02-02   61  					 struct flow_action *flow_action,
ad7769ca2d80c3 Nir Dotan          2018-07-24   62  					 struct netlink_ext_ack *extack)
7aa0f5aa9030aa Jiri Pirko         2017-02-03   63  {
738678817573ce Pablo Neira Ayuso  2019-02-02   64  	const struct flow_action_entry *act;
52feb8b588f6d2 Danielle Ratson    2019-09-26   65  	int mirror_act_count = 0;
af11e818a76914 Ido Schimmel       2020-07-15   66  	int police_act_count = 0;
45aad0b7043da8 Ido Schimmel       2021-03-16   67  	int sample_act_count = 0;
244cd96adb5f5a Cong Wang          2018-08-19   68  	int err, i;
7aa0f5aa9030aa Jiri Pirko         2017-02-03   69  
738678817573ce Pablo Neira Ayuso  2019-02-02   70  	if (!flow_action_has_entries(flow_action))
7aa0f5aa9030aa Jiri Pirko         2017-02-03   71  		return 0;
53eca1f3479f35 Jakub Kicinski     2020-03-16   72  	if (!flow_action_mixed_hw_stats_check(flow_action, extack))
3632f6d3907828 Jiri Pirko         2020-03-07   73  		return -EOPNOTSUPP;
7aa0f5aa9030aa Jiri Pirko         2017-02-03   74  
c4afd0c81635db Jiri Pirko         2020-03-07   75  	act = flow_action_first_entry_get(flow_action);
060b6381efe584 Edward Cree        2020-05-20   76  	if (act->hw_stats & FLOW_ACTION_HW_STATS_DISABLED) {
060b6381efe584 Edward Cree        2020-05-20   77  		/* Nothing to do */
060b6381efe584 Edward Cree        2020-05-20   78  	} else if (act->hw_stats & FLOW_ACTION_HW_STATS_IMMEDIATE) {
7c1b8eb175b69a Arkadi Sharshevsky 2017-03-11   79  		/* Count action is inserted first */
ad7769ca2d80c3 Nir Dotan          2018-07-24   80  		err = mlxsw_sp_acl_rulei_act_count(mlxsw_sp, rulei, extack);
7c1b8eb175b69a Arkadi Sharshevsky 2017-03-11   81  		if (err)
7c1b8eb175b69a Arkadi Sharshevsky 2017-03-11   82  			return err;
060b6381efe584 Edward Cree        2020-05-20   83  	} else {
c4afd0c81635db Jiri Pirko         2020-03-07   84  		NL_SET_ERR_MSG_MOD(extack, "Unsupported action HW stats type");
c4afd0c81635db Jiri Pirko         2020-03-07   85  		return -EOPNOTSUPP;
c4afd0c81635db Jiri Pirko         2020-03-07   86  	}
7c1b8eb175b69a Arkadi Sharshevsky 2017-03-11   87  
738678817573ce Pablo Neira Ayuso  2019-02-02   88  	flow_action_for_each(i, act, flow_action) {
738678817573ce Pablo Neira Ayuso  2019-02-02   89  		switch (act->id) {
738678817573ce Pablo Neira Ayuso  2019-02-02   90  		case FLOW_ACTION_ACCEPT:
49bae2f3093b0a Jiri Pirko         2018-03-09   91  			err = mlxsw_sp_acl_rulei_act_terminate(rulei);
27c203cd148921 Nir Dotan          2018-07-24   92  			if (err) {
27c203cd148921 Nir Dotan          2018-07-24   93  				NL_SET_ERR_MSG_MOD(extack, "Cannot append terminate action");
b2925957ec1a93 Jiri Pirko         2017-09-25   94  				return err;
27c203cd148921 Nir Dotan          2018-07-24   95  			}
738678817573ce Pablo Neira Ayuso  2019-02-02   96  			break;
86272d33973c93 Jiri Pirko         2020-02-24   97  		case FLOW_ACTION_DROP: {
86272d33973c93 Jiri Pirko         2020-02-24   98  			bool ingress;
86272d33973c93 Jiri Pirko         2020-02-24   99  
3bc3ffb6e911f9 Jiri Pirko         2020-04-27  100  			if (mlxsw_sp_flow_block_is_mixed_bound(block)) {
86272d33973c93 Jiri Pirko         2020-02-24  101  				NL_SET_ERR_MSG_MOD(extack, "Drop action is not supported when block is bound to ingress and egress");
86272d33973c93 Jiri Pirko         2020-02-24  102  				return -EOPNOTSUPP;
86272d33973c93 Jiri Pirko         2020-02-24  103  			}
3bc3ffb6e911f9 Jiri Pirko         2020-04-27  104  			ingress = mlxsw_sp_flow_block_is_ingress_bound(block);
6d19d2bdc8a15b Jiri Pirko         2020-02-25  105  			err = mlxsw_sp_acl_rulei_act_drop(rulei, ingress,
6d19d2bdc8a15b Jiri Pirko         2020-02-25 @106  							  act->cookie, extack);
27c203cd148921 Nir Dotan          2018-07-24  107  			if (err) {
27c203cd148921 Nir Dotan          2018-07-24  108  				NL_SET_ERR_MSG_MOD(extack, "Cannot append drop action");
7aa0f5aa9030aa Jiri Pirko         2017-02-03  109  				return err;
27c203cd148921 Nir Dotan          2018-07-24  110  			}
86272d33973c93 Jiri Pirko         2020-02-24  111  
86272d33973c93 Jiri Pirko         2020-02-24  112  			/* Forbid block with this rulei to be bound
86272d33973c93 Jiri Pirko         2020-02-24  113  			 * to ingress/egress in future. Ingress rule is
86272d33973c93 Jiri Pirko         2020-02-24  114  			 * a blocker for egress and vice versa.
86272d33973c93 Jiri Pirko         2020-02-24  115  			 */
86272d33973c93 Jiri Pirko         2020-02-24  116  			if (ingress)
86272d33973c93 Jiri Pirko         2020-02-24  117  				rulei->egress_bind_blocker = 1;
86272d33973c93 Jiri Pirko         2020-02-24  118  			else
86272d33973c93 Jiri Pirko         2020-02-24  119  				rulei->ingress_bind_blocker = 1;
86272d33973c93 Jiri Pirko         2020-02-24  120  			}
738678817573ce Pablo Neira Ayuso  2019-02-02  121  			break;
738678817573ce Pablo Neira Ayuso  2019-02-02  122  		case FLOW_ACTION_TRAP:
bd5ddba52dc0e2 Jiri Pirko         2017-06-06  123  			err = mlxsw_sp_acl_rulei_act_trap(rulei);
27c203cd148921 Nir Dotan          2018-07-24  124  			if (err) {
27c203cd148921 Nir Dotan          2018-07-24  125  				NL_SET_ERR_MSG_MOD(extack, "Cannot append trap action");
bd5ddba52dc0e2 Jiri Pirko         2017-06-06  126  				return err;
27c203cd148921 Nir Dotan          2018-07-24  127  			}
738678817573ce Pablo Neira Ayuso  2019-02-02  128  			break;
738678817573ce Pablo Neira Ayuso  2019-02-02  129  		case FLOW_ACTION_GOTO: {
738678817573ce Pablo Neira Ayuso  2019-02-02  130  			u32 chain_index = act->chain_index;
0ede6ba2a1de08 Jiri Pirko         2017-08-23  131  			struct mlxsw_sp_acl_ruleset *ruleset;
0ede6ba2a1de08 Jiri Pirko         2017-08-23  132  			u16 group_id;
0ede6ba2a1de08 Jiri Pirko         2017-08-23  133  
3aaff323044e22 Jiri Pirko         2018-01-17  134  			ruleset = mlxsw_sp_acl_ruleset_lookup(mlxsw_sp, block,
0ede6ba2a1de08 Jiri Pirko         2017-08-23  135  							      chain_index,
0ede6ba2a1de08 Jiri Pirko         2017-08-23  136  							      MLXSW_SP_ACL_PROFILE_FLOWER);
0ede6ba2a1de08 Jiri Pirko         2017-08-23  137  			if (IS_ERR(ruleset))
0ede6ba2a1de08 Jiri Pirko         2017-08-23  138  				return PTR_ERR(ruleset);
0ede6ba2a1de08 Jiri Pirko         2017-08-23  139  
0ede6ba2a1de08 Jiri Pirko         2017-08-23  140  			group_id = mlxsw_sp_acl_ruleset_group_id(ruleset);
2a52a8c6e594cd Jiri Pirko         2017-09-25  141  			err = mlxsw_sp_acl_rulei_act_jump(rulei, group_id);
27c203cd148921 Nir Dotan          2018-07-24  142  			if (err) {
27c203cd148921 Nir Dotan          2018-07-24  143  				NL_SET_ERR_MSG_MOD(extack, "Cannot append jump action");
2a52a8c6e594cd Jiri Pirko         2017-09-25  144  				return err;
27c203cd148921 Nir Dotan          2018-07-24  145  			}
738678817573ce Pablo Neira Ayuso  2019-02-02  146  			}
738678817573ce Pablo Neira Ayuso  2019-02-02  147  			break;
738678817573ce Pablo Neira Ayuso  2019-02-02  148  		case FLOW_ACTION_REDIRECT: {
7aa0f5aa9030aa Jiri Pirko         2017-02-03  149  			struct net_device *out_dev;
a110748725450a Ido Schimmel       2017-05-26  150  			struct mlxsw_sp_fid *fid;
a110748725450a Ido Schimmel       2017-05-26  151  			u16 fid_index;
7aa0f5aa9030aa Jiri Pirko         2017-02-03  152  
3bc3ffb6e911f9 Jiri Pirko         2020-04-27  153  			if (mlxsw_sp_flow_block_is_egress_bound(block)) {
185556f0924911 Jiri Pirko         2019-07-27  154  				NL_SET_ERR_MSG_MOD(extack, "Redirect action is not supported on egress");
185556f0924911 Jiri Pirko         2019-07-27  155  				return -EOPNOTSUPP;
185556f0924911 Jiri Pirko         2019-07-27  156  			}
185556f0924911 Jiri Pirko         2019-07-27  157  
c9588e28123c56 Jiri Pirko         2019-07-27  158  			/* Forbid block with this rulei to be bound
c9588e28123c56 Jiri Pirko         2019-07-27  159  			 * to egress in future.
c9588e28123c56 Jiri Pirko         2019-07-27  160  			 */
c9588e28123c56 Jiri Pirko         2019-07-27  161  			rulei->egress_bind_blocker = 1;
c9588e28123c56 Jiri Pirko         2019-07-27  162  
a110748725450a Ido Schimmel       2017-05-26  163  			fid = mlxsw_sp_acl_dummy_fid(mlxsw_sp);
a110748725450a Ido Schimmel       2017-05-26  164  			fid_index = mlxsw_sp_fid_index(fid);
cedbb8b2594876 Jiri Pirko         2017-04-18  165  			err = mlxsw_sp_acl_rulei_act_fid_set(mlxsw_sp, rulei,
ad7769ca2d80c3 Nir Dotan          2018-07-24  166  							     fid_index, extack);
cedbb8b2594876 Jiri Pirko         2017-04-18  167  			if (err)
cedbb8b2594876 Jiri Pirko         2017-04-18  168  				return err;
cedbb8b2594876 Jiri Pirko         2017-04-18  169  
738678817573ce Pablo Neira Ayuso  2019-02-02  170  			out_dev = act->dev;
7aa0f5aa9030aa Jiri Pirko         2017-02-03  171  			err = mlxsw_sp_acl_rulei_act_fwd(mlxsw_sp, rulei,
ad7769ca2d80c3 Nir Dotan          2018-07-24  172  							 out_dev, extack);
7aa0f5aa9030aa Jiri Pirko         2017-02-03  173  			if (err)
7aa0f5aa9030aa Jiri Pirko         2017-02-03  174  				return err;
738678817573ce Pablo Neira Ayuso  2019-02-02  175  			}
738678817573ce Pablo Neira Ayuso  2019-02-02  176  			break;
738678817573ce Pablo Neira Ayuso  2019-02-02  177  		case FLOW_ACTION_MIRRED: {
738678817573ce Pablo Neira Ayuso  2019-02-02  178  			struct net_device *out_dev = act->dev;
d0d13c1858a11b Arkadi Sharshevsky 2018-01-19  179  
52feb8b588f6d2 Danielle Ratson    2019-09-26  180  			if (mirror_act_count++) {
52feb8b588f6d2 Danielle Ratson    2019-09-26  181  				NL_SET_ERR_MSG_MOD(extack, "Multiple mirror actions per rule are not supported");
52feb8b588f6d2 Danielle Ratson    2019-09-26  182  				return -EOPNOTSUPP;
52feb8b588f6d2 Danielle Ratson    2019-09-26  183  			}
52feb8b588f6d2 Danielle Ratson    2019-09-26  184  
d0d13c1858a11b Arkadi Sharshevsky 2018-01-19  185  			err = mlxsw_sp_acl_rulei_act_mirror(mlxsw_sp, rulei,
ad7769ca2d80c3 Nir Dotan          2018-07-24  186  							    block, out_dev,
ad7769ca2d80c3 Nir Dotan          2018-07-24  187  							    extack);
d0d13c1858a11b Arkadi Sharshevsky 2018-01-19  188  			if (err)
d0d13c1858a11b Arkadi Sharshevsky 2018-01-19  189  				return err;
738678817573ce Pablo Neira Ayuso  2019-02-02  190  			}
738678817573ce Pablo Neira Ayuso  2019-02-02  191  			break;
384c2f7473bc4f Ido Schimmel       2019-02-12  192  		case FLOW_ACTION_VLAN_MANGLE: {
738678817573ce Pablo Neira Ayuso  2019-02-02  193  			u16 proto = be16_to_cpu(act->vlan.proto);
738678817573ce Pablo Neira Ayuso  2019-02-02  194  			u8 prio = act->vlan.prio;
738678817573ce Pablo Neira Ayuso  2019-02-02  195  			u16 vid = act->vlan.vid;
a150201a70da3b Petr Machata       2017-03-09  196  
ccfc569347f870 Petr Machata       2020-04-05  197  			err = mlxsw_sp_acl_rulei_act_vlan(mlxsw_sp, rulei,
738678817573ce Pablo Neira Ayuso  2019-02-02  198  							  act->id, vid,
ad7769ca2d80c3 Nir Dotan          2018-07-24  199  							  proto, prio, extack);
ccfc569347f870 Petr Machata       2020-04-05  200  			if (err)
ccfc569347f870 Petr Machata       2020-04-05  201  				return err;
ccfc569347f870 Petr Machata       2020-04-05  202  			break;
738678817573ce Pablo Neira Ayuso  2019-02-02  203  			}
463957e3fbab36 Petr Machata       2020-03-19  204  		case FLOW_ACTION_PRIORITY:
0be0ae144109a4 Petr Machata       2020-04-05  205  			err = mlxsw_sp_acl_rulei_act_priority(mlxsw_sp, rulei,
463957e3fbab36 Petr Machata       2020-03-19  206  							      act->priority,
463957e3fbab36 Petr Machata       2020-03-19  207  							      extack);
0be0ae144109a4 Petr Machata       2020-04-05  208  			if (err)
0be0ae144109a4 Petr Machata       2020-04-05  209  				return err;
0be0ae144109a4 Petr Machata       2020-04-05  210  			break;
9b4b16bba298ce Petr Machata       2020-03-26  211  		case FLOW_ACTION_MANGLE: {
9b4b16bba298ce Petr Machata       2020-03-26  212  			enum flow_action_mangle_base htype = act->mangle.htype;
9b4b16bba298ce Petr Machata       2020-03-26  213  			__be32 be_mask = (__force __be32) act->mangle.mask;
9b4b16bba298ce Petr Machata       2020-03-26  214  			__be32 be_val = (__force __be32) act->mangle.val;
9b4b16bba298ce Petr Machata       2020-03-26  215  			u32 offset = act->mangle.offset;
9b4b16bba298ce Petr Machata       2020-03-26  216  			u32 mask = be32_to_cpu(be_mask);
9b4b16bba298ce Petr Machata       2020-03-26  217  			u32 val = be32_to_cpu(be_val);
9b4b16bba298ce Petr Machata       2020-03-26  218  
9b4b16bba298ce Petr Machata       2020-03-26  219  			err = mlxsw_sp_acl_rulei_act_mangle(mlxsw_sp, rulei,
9b4b16bba298ce Petr Machata       2020-03-26  220  							    htype, offset,
9b4b16bba298ce Petr Machata       2020-03-26  221  							    mask, val, extack);
9b4b16bba298ce Petr Machata       2020-03-26  222  			if (err)
9b4b16bba298ce Petr Machata       2020-03-26  223  				return err;
9b4b16bba298ce Petr Machata       2020-03-26  224  			break;
9b4b16bba298ce Petr Machata       2020-03-26  225  			}
af11e818a76914 Ido Schimmel       2020-07-15  226  		case FLOW_ACTION_POLICE: {
af11e818a76914 Ido Schimmel       2020-07-15  227  			u32 burst;
af11e818a76914 Ido Schimmel       2020-07-15  228  
af11e818a76914 Ido Schimmel       2020-07-15  229  			if (police_act_count++) {
af11e818a76914 Ido Schimmel       2020-07-15  230  				NL_SET_ERR_MSG_MOD(extack, "Multiple police actions per rule are not supported");
af11e818a76914 Ido Schimmel       2020-07-15  231  				return -EOPNOTSUPP;
af11e818a76914 Ido Schimmel       2020-07-15  232  			}
af11e818a76914 Ido Schimmel       2020-07-15  233  
d97b4b105ce71f Jianbo Liu         2022-02-24  234  			err = mlxsw_sp_policer_validate(flow_action, act, extack);
d97b4b105ce71f Jianbo Liu         2022-02-24  235  			if (err)
d97b4b105ce71f Jianbo Liu         2022-02-24  236  				return err;
6a56e19902af01 Baowen Zheng       2021-03-12  237  
af11e818a76914 Ido Schimmel       2020-07-15  238  			/* The kernel might adjust the requested burst size so
af11e818a76914 Ido Schimmel       2020-07-15  239  			 * that it is not exactly a power of two. Re-adjust it
af11e818a76914 Ido Schimmel       2020-07-15  240  			 * here since the hardware only supports burst sizes
af11e818a76914 Ido Schimmel       2020-07-15  241  			 * that are a power of two.
af11e818a76914 Ido Schimmel       2020-07-15  242  			 */
af11e818a76914 Ido Schimmel       2020-07-15  243  			burst = roundup_pow_of_two(act->police.burst);
af11e818a76914 Ido Schimmel       2020-07-15  244  			err = mlxsw_sp_acl_rulei_act_police(mlxsw_sp, rulei,
5a9959008fb631 Baowen Zheng       2021-12-17  245  							    act->hw_index,
af11e818a76914 Ido Schimmel       2020-07-15  246  							    act->police.rate_bytes_ps,
af11e818a76914 Ido Schimmel       2020-07-15  247  							    burst, extack);
af11e818a76914 Ido Schimmel       2020-07-15  248  			if (err)
af11e818a76914 Ido Schimmel       2020-07-15  249  				return err;
af11e818a76914 Ido Schimmel       2020-07-15  250  			break;
af11e818a76914 Ido Schimmel       2020-07-15  251  			}
45aad0b7043da8 Ido Schimmel       2021-03-16  252  		case FLOW_ACTION_SAMPLE: {
45aad0b7043da8 Ido Schimmel       2021-03-16  253  			if (sample_act_count++) {
45aad0b7043da8 Ido Schimmel       2021-03-16  254  				NL_SET_ERR_MSG_MOD(extack, "Multiple sample actions per rule are not supported");
45aad0b7043da8 Ido Schimmel       2021-03-16  255  				return -EOPNOTSUPP;
45aad0b7043da8 Ido Schimmel       2021-03-16  256  			}
45aad0b7043da8 Ido Schimmel       2021-03-16  257  
45aad0b7043da8 Ido Schimmel       2021-03-16  258  			err = mlxsw_sp_acl_rulei_act_sample(mlxsw_sp, rulei,
45aad0b7043da8 Ido Schimmel       2021-03-16  259  							    block,
45aad0b7043da8 Ido Schimmel       2021-03-16  260  							    act->sample.psample_group,
45aad0b7043da8 Ido Schimmel       2021-03-16  261  							    act->sample.rate,
45aad0b7043da8 Ido Schimmel       2021-03-16  262  							    act->sample.trunc_size,
45aad0b7043da8 Ido Schimmel       2021-03-16  263  							    act->sample.truncate,
45aad0b7043da8 Ido Schimmel       2021-03-16  264  							    extack);
45aad0b7043da8 Ido Schimmel       2021-03-16  265  			if (err)
45aad0b7043da8 Ido Schimmel       2021-03-16  266  				return err;
45aad0b7043da8 Ido Schimmel       2021-03-16  267  			break;
45aad0b7043da8 Ido Schimmel       2021-03-16  268  			}
738678817573ce Pablo Neira Ayuso  2019-02-02  269  		default:
27c203cd148921 Nir Dotan          2018-07-24  270  			NL_SET_ERR_MSG_MOD(extack, "Unsupported action");
7aa0f5aa9030aa Jiri Pirko         2017-02-03  271  			dev_err(mlxsw_sp->bus_info->dev, "Unsupported action\n");
7aa0f5aa9030aa Jiri Pirko         2017-02-03  272  			return -EOPNOTSUPP;
7aa0f5aa9030aa Jiri Pirko         2017-02-03  273  		}
7aa0f5aa9030aa Jiri Pirko         2017-02-03  274  	}
463e1ab82a41c8 Danielle Ratson    2022-02-06  275  
463e1ab82a41c8 Danielle Ratson    2022-02-06  276  	if (rulei->ipv6_valid) {
463e1ab82a41c8 Danielle Ratson    2022-02-06  277  		NL_SET_ERR_MSG_MOD(extack, "Unsupported mangle field");
463e1ab82a41c8 Danielle Ratson    2022-02-06  278  		return -EOPNOTSUPP;
463e1ab82a41c8 Danielle Ratson    2022-02-06  279  	}
463e1ab82a41c8 Danielle Ratson    2022-02-06  280  
7aa0f5aa9030aa Jiri Pirko         2017-02-03  281  	return 0;
7aa0f5aa9030aa Jiri Pirko         2017-02-03  282  }
7aa0f5aa9030aa Jiri Pirko         2017-02-03  283
diff mbox series

Patch

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
index 2d06b4412762..208809a8eb0e 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
@@ -4180,7 +4180,7 @@  parse_tc_actions(struct mlx5e_tc_act_parse_state *parse_state,
 
 		parse_state->actions |= attr->action;
 		if (!tc_act->stats_action)
-			attr->tc_act_cookies[attr->tc_act_cookies_count++] = act->act_cookie;
+			attr->tc_act_cookies[attr->tc_act_cookies_count++] = act->cookie;
 
 		/* Split attr for multi table act if not the last act. */
 		if (jump_state.jump_target ||
diff --git a/include/net/act_api.h b/include/net/act_api.h
index 2a6f443f0ef6..4ae0580b63ca 100644
--- a/include/net/act_api.h
+++ b/include/net/act_api.h
@@ -39,7 +39,7 @@  struct tc_action {
 	struct gnet_stats_basic_sync __percpu *cpu_bstats;
 	struct gnet_stats_basic_sync __percpu *cpu_bstats_hw;
 	struct gnet_stats_queue __percpu *cpu_qstats;
-	struct tc_cookie	__rcu *act_cookie;
+	struct tc_cookie	__rcu *user_cookie;
 	struct tcf_chain	__rcu *goto_chain;
 	u32			tcfa_flags;
 	u8			hw_stats;
diff --git a/include/net/flow_offload.h b/include/net/flow_offload.h
index 8c05455b1e34..9c5cb12f8a90 100644
--- a/include/net/flow_offload.h
+++ b/include/net/flow_offload.h
@@ -228,7 +228,7 @@  void flow_action_cookie_destroy(struct flow_action_cookie *cookie);
 struct flow_action_entry {
 	enum flow_action_id		id;
 	u32				hw_index;
-	unsigned long			act_cookie;
+	unsigned long			cookie;
 	enum flow_action_hw_stats	hw_stats;
 	action_destr			destructor;
 	void				*destructor_priv;
@@ -321,7 +321,7 @@  struct flow_action_entry {
 			u16		sid;
 		} pppoe;
 	};
-	struct flow_action_cookie *cookie; /* user defined action cookie */
+	struct flow_action_cookie *user_cookie; /* user defined action cookie */
 };
 
 struct flow_action {
diff --git a/net/sched/act_api.c b/net/sched/act_api.c
index eda58b78da13..e67ebc939901 100644
--- a/net/sched/act_api.c
+++ b/net/sched/act_api.c
@@ -125,7 +125,7 @@  static void free_tcf(struct tc_action *p)
 	free_percpu(p->cpu_bstats_hw);
 	free_percpu(p->cpu_qstats);
 
-	tcf_set_action_cookie(&p->act_cookie, NULL);
+	tcf_set_action_cookie(&p->user_cookie, NULL);
 	if (chain)
 		tcf_chain_put_by_act(chain);
 
@@ -431,14 +431,14 @@  EXPORT_SYMBOL(tcf_idr_release);
 
 static size_t tcf_action_shared_attrs_size(const struct tc_action *act)
 {
-	struct tc_cookie *act_cookie;
+	struct tc_cookie *user_cookie;
 	u32 cookie_len = 0;
 
 	rcu_read_lock();
-	act_cookie = rcu_dereference(act->act_cookie);
+	user_cookie = rcu_dereference(act->user_cookie);
 
-	if (act_cookie)
-		cookie_len = nla_total_size(act_cookie->len);
+	if (user_cookie)
+		cookie_len = nla_total_size(user_cookie->len);
 	rcu_read_unlock();
 
 	return  nla_total_size(0) /* action number nested */
@@ -488,7 +488,7 @@  tcf_action_dump_terse(struct sk_buff *skb, struct tc_action *a, bool from_act)
 		goto nla_put_failure;
 
 	rcu_read_lock();
-	cookie = rcu_dereference(a->act_cookie);
+	cookie = rcu_dereference(a->user_cookie);
 	if (cookie) {
 		if (nla_put(skb, TCA_ACT_COOKIE, cookie->len, cookie->data)) {
 			rcu_read_unlock();
@@ -1362,9 +1362,9 @@  struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp,
 {
 	bool police = flags & TCA_ACT_FLAGS_POLICE;
 	struct nla_bitfield32 userflags = { 0, 0 };
+	struct tc_cookie *user_cookie = NULL;
 	u8 hw_stats = TCA_ACT_HW_STATS_ANY;
 	struct nlattr *tb[TCA_ACT_MAX + 1];
-	struct tc_cookie *cookie = NULL;
 	struct tc_action *a;
 	int err;
 
@@ -1375,8 +1375,8 @@  struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp,
 		if (err < 0)
 			return ERR_PTR(err);
 		if (tb[TCA_ACT_COOKIE]) {
-			cookie = nla_memdup_cookie(tb);
-			if (!cookie) {
+			user_cookie = nla_memdup_cookie(tb);
+			if (!user_cookie) {
 				NL_SET_ERR_MSG(extack, "No memory to generate TC cookie");
 				err = -ENOMEM;
 				goto err_out;
@@ -1402,7 +1402,7 @@  struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp,
 	*init_res = err;
 
 	if (!police && tb[TCA_ACT_COOKIE])
-		tcf_set_action_cookie(&a->act_cookie, cookie);
+		tcf_set_action_cookie(&a->user_cookie, user_cookie);
 
 	if (!police)
 		a->hw_stats = hw_stats;
@@ -1410,9 +1410,9 @@  struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp,
 	return a;
 
 err_out:
-	if (cookie) {
-		kfree(cookie->data);
-		kfree(cookie);
+	if (user_cookie) {
+		kfree(user_cookie->data);
+		kfree(user_cookie);
 	}
 	return ERR_PTR(err);
 }
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
index bfabc9c95fa9..656049ead8bb 100644
--- a/net/sched/cls_api.c
+++ b/net/sched/cls_api.c
@@ -3490,28 +3490,28 @@  int tc_setup_cb_reoffload(struct tcf_block *block, struct tcf_proto *tp,
 }
 EXPORT_SYMBOL(tc_setup_cb_reoffload);
 
-static int tcf_act_get_cookie(struct flow_action_entry *entry,
-			      const struct tc_action *act)
+static int tcf_act_get_user_cookie(struct flow_action_entry *entry,
+				   const struct tc_action *act)
 {
-	struct tc_cookie *cookie;
+	struct tc_cookie *user_cookie;
 	int err = 0;
 
 	rcu_read_lock();
-	cookie = rcu_dereference(act->act_cookie);
-	if (cookie) {
-		entry->cookie = flow_action_cookie_create(cookie->data,
-							  cookie->len,
-							  GFP_ATOMIC);
-		if (!entry->cookie)
+	user_cookie = rcu_dereference(act->user_cookie);
+	if (user_cookie) {
+		entry->user_cookie = flow_action_cookie_create(user_cookie->data,
+							       user_cookie->len,
+							       GFP_ATOMIC);
+		if (!entry->user_cookie)
 			err = -ENOMEM;
 	}
 	rcu_read_unlock();
 	return err;
 }
 
-static void tcf_act_put_cookie(struct flow_action_entry *entry)
+static void tcf_act_put_user_cookie(struct flow_action_entry *entry)
 {
-	flow_action_cookie_destroy(entry->cookie);
+	flow_action_cookie_destroy(entry->user_cookie);
 }
 
 void tc_cleanup_offload_action(struct flow_action *flow_action)
@@ -3520,7 +3520,7 @@  void tc_cleanup_offload_action(struct flow_action *flow_action)
 	int i;
 
 	flow_action_for_each(i, entry, flow_action) {
-		tcf_act_put_cookie(entry);
+		tcf_act_put_user_cookie(entry);
 		if (entry->destructor)
 			entry->destructor(entry->destructor_priv);
 	}
@@ -3565,7 +3565,7 @@  int tc_setup_action(struct flow_action *flow_action,
 
 		entry = &flow_action->entries[j];
 		spin_lock_bh(&act->tcfa_lock);
-		err = tcf_act_get_cookie(entry, act);
+		err = tcf_act_get_user_cookie(entry, act);
 		if (err)
 			goto err_out_locked;
 
@@ -3577,7 +3577,7 @@  int tc_setup_action(struct flow_action *flow_action,
 		for (k = 0; k < index ; k++) {
 			entry[k].hw_stats = tc_act_hw_stats(act->hw_stats);
 			entry[k].hw_index = act->tcfa_index;
-			entry[k].act_cookie = (unsigned long)act;
+			entry[k].cookie = (unsigned long)act;
 		}
 
 		j += index;