Mellanox, mlx5 updates 2020-02-27
Subsystems (7)
Hi Dave,
This series includes mlx5 misc updates and cleanups. For more information please see tag log below.
Please pull and let me know if there is any problem.
Thanks,
Saeed.
---
The following changes since commit 37e1244a79fd248ed31281259b478bc945b7bd4b:
WAN: Replace zero-length array with flexible-array member (2020-02-27 12:06:55 -0800)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux.git tags/mlx5-updates-2020-02-27
for you to fetch changes up to bc1d75fa79860ec9d065cd3de041f86811d48563:
net/mlx5e: Remove redundant comment about goto slow path (2020-02-27 16:40:42 -0800)
----------------------------------------------------------------
mlx5-updates-2020-02-27
mlx5 misc updates and minor cleanups:
1) Use per vport tables for mirroring
2) Improve log messages for SW steering (DR)
3) Add devlink fdb_large_groups parameter
4) E-Switch, Allow goto earlier chain
5) Don't allow forwarding between uplink representors
6) Add support for devlink-port in non-representors mode
7) Minor misc cleanups
----------------------------------------------------------------
Eli Cohen (4):
net/mlx5: Eswitch, avoid redundant mask
net/mlx5e: Eswitch, Use per vport tables for mirroring net/mlx5e: Remove unused argument from parse_tc_pedit_action() net/mlx5e: Reduce number of arguments in slow path handling
Erez Shitrit (1):
net/mlx5: DR, Improve log messages
Hamdan Igbaria (1):
net/mlx5: DR, Change matcher priority parameter type
Jianbo Liu (2):
net/mlx5: Change the name of steering mode param id net/mlx5e: Add devlink fdb_large_groups parameter
Roi Dayan (5):
net/mlx5: E-Switch, Allow goto earlier chain if FW supports it net/mlx5e: Use netdev_warn() for errors for added prefix net/mlx5e: Use netdev_warn() instead of pr_err() for errors net/mlx5e: Use NL_SET_ERR_MSG_MOD() extack for errors net/mlx5e: Remove redundant comment about goto slow path
Tonghao Zhang (1):
net/mlx5e: Don't allow forwarding between uplink
Vladyslav Tarasiuk (2):
net/mlx5e: Rename representor get devlink port function net/mlx5e: Add support for devlink-port in non-representors mode
Documentation/networking/devlink/mlx5.rst | 6 + drivers/net/ethernet/mellanox/mlx5/core/Makefile | 2 +- drivers/net/ethernet/mellanox/mlx5/core/devlink.c | 40 +++- drivers/net/ethernet/mellanox/mlx5/core/devlink.h | 6 + drivers/net/ethernet/mellanox/mlx5/core/en.h | 1 + .../net/ethernet/mellanox/mlx5/core/en/devlink.c | 38 ++++ .../net/ethernet/mellanox/mlx5/core/en/devlink.h | 15 ++ drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 11 ++ drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 38 ++-- drivers/net/ethernet/mellanox/mlx5/core/en_rep.h | 1 + drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 115 +++++++----- drivers/net/ethernet/mellanox/mlx5/core/eswitch.c | 22 +++ drivers/net/ethernet/mellanox/mlx5/core/eswitch.h | 14 ++ .../ethernet/mellanox/mlx5/core/eswitch_offloads.c | 208 ++++++++++++++++++++- .../mellanox/mlx5/core/eswitch_offloads_chains.c | 20 +- .../mellanox/mlx5/core/eswitch_offloads_chains.h | 2 + .../mellanox/mlx5/core/eswitch_offloads_termtbl.c | 4 +- drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | 11 ++ .../mellanox/mlx5/core/steering/dr_action.c | 10 +- .../mellanox/mlx5/core/steering/dr_domain.c | 17 +- .../mellanox/mlx5/core/steering/dr_icm_pool.c | 2 +- .../mellanox/mlx5/core/steering/dr_matcher.c | 12 +- .../ethernet/mellanox/mlx5/core/steering/dr_rule.c | 18 +- .../ethernet/mellanox/mlx5/core/steering/dr_send.c | 16 +- .../ethernet/mellanox/mlx5/core/steering/dr_ste.c | 2 +- .../mellanox/mlx5/core/steering/dr_table.c | 8 +- .../mellanox/mlx5/core/steering/dr_types.h | 2 +- .../ethernet/mellanox/mlx5/core/steering/fs_dr.c | 2 +- .../ethernet/mellanox/mlx5/core/steering/mlx5dr.h | 4 +- include/linux/mlx5/fs.h | 1 + 30 files changed, 519 insertions(+), 129 deletions(-) create mode 100644 drivers/net/ethernet/mellanox/mlx5/core/en/devlink.c create mode 100644 drivers/net/ethernet/mellanox/mlx5/core/en/devlink.h
PATCH 1/16 net/mlx5e: Don't allow forwarding between uplink
From: Tonghao Zhang <[email protected]>
We can install forwarding packets rule between uplink in switchdev mode, as show below. But the hardware does not do that as expected (mlnx_perf -i $PF1, we can't get the counter of the PF1). By the way, if we add the uplink PF0, PF1 to Open vSwitch and enable hw-offload, the rules can be offloaded but not work fine too. This patch add a check and if so return -EOPNOTSUPP.
$ tc filter add dev $PF0 protocol all parent ffff: prio 1 handle 1 \
flower skip_sw action mirred egress redirect dev $PF1$ tc -d -s filter show dev $PF0 ingress
skip_sw
in_hw in_hw_count 1
action order 1: mirred (Egress Redirect to device enp130s0f1) stolen
...
Sent hardware 408954 bytes 4173 pkt
...--- .../net/ethernet/mellanox/mlx5/core/en_rep.c | 5 +++++ .../net/ethernet/mellanox/mlx5/core/en_rep.h | 1 + drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 17 +++++++++++++++++ 3 files changed, 23 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +5 -0
@@ -1464,6 +1464,11 @@ static const struct net_device_ops mlx5e_netdev_ops_uplink_rep = { .ndo_set_features = mlx5e_set_features, }; +bool mlx5e_eswitch_uplink_rep (struct net_device *netdev) +{ +return netdev->netdev_ops == &mlx5e_netdev_ops_uplink_rep; +} +bool mlx5e_eswitch_rep (struct net_device *netdev) { if (netdev->netdev_ops == &mlx5e_netdev_ops_rep ||
drivers/net/ethernet/mellanox/mlx5/core/en_rep.h +1 -0
@@ -200,6 +200,7 @@ void mlx5e_rep_encap_entry_detach(struct mlx5e_priv *priv,void mlx5e_rep_queue_neigh_stats_work (struct mlx5e_priv *priv);bool mlx5e_eswitch_rep (struct net_device *netdev); +bool mlx5e_eswitch_uplink_rep (struct net_device *netdev);#else /* CONFIG_MLX5_ESWITCH */ static inline bool mlx5e_is_uplink_rep (struct mlx5e_priv *priv) {return false; }
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +17 -0
@@ -3405,6 +3405,7 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv,struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;struct net_device *uplink_dev =mlx5_eswitch_uplink_get_proto_dev (esw,REP_ETH );struct net_device *uplink_upper; +struct mlx5e_rep_priv *rep_priv; if (is_duplicated_output_device(priv->netdev, out_dev,
@@ -3440,6 +3441,22 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv,return err; } +/* Don't allow forwarding between uplink. +* +* Input vport was stored esw_attr->in_rep. +* In LAG case, *priv* is the private data of +* uplink which may be not the input vport. +*/ + rep_priv =mlx5e_rep_to_rep_priv (attr->in_rep); +if (mlx5e_eswitch_uplink_rep (rep_priv->netdev) && +mlx5e_eswitch_uplink_rep (out_dev)) { +NL_SET_ERR_MSG_MOD (extack, +"devices are both uplink, can't offload forwarding" ); +pr_err ("devices %s %s are both uplink, can't offload forwarding\n" , + priv->netdev->name, out_dev->name); +return -EOPNOTSUPP ; + } +if (!mlx5e_is_valid_eswitch_fwd_dev (priv, out_dev)) {NL_SET_ERR_MSG_MOD (extack,"devices are not on same switch HW, can't offload forwarding" );
Signature · 1 line
2.24.1
PATCH 2/16 net/mlx5: Eswitch, avoid redundant mask
In reply to Saeed MahameedFrom: Eli Cohen <[email protected]>
misc_params.source_port is a 16 bit field already so no need for redundant masking against 0xffff. Also change local variables type to u16.
--- .../ethernet/mellanox/mlx5/core/eswitch_offloads_termtbl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_termtbl.c +2 -2
@@ -181,7 +181,7 @@ mlx5_eswitch_termtbl_actions_move(struct mlx5_flow_act *src,static bool mlx5_eswitch_offload_is_uplink_port (const struct mlx5_eswitch *esw,const struct mlx5_flow_spec *spec) { -u32 port_mask, port_value; +u16 port_mask, port_value;if (MLX5_CAP_ESW_FLOWTABLE (esw->dev, flow_source)) return spec->flow_context.flow_source ==
@@ -191,7 +191,7 @@ static bool mlx5_eswitch_offload_is_uplink_port(const struct mlx5_eswitch *esw, misc_parameters.source_port); port_value =MLX5_GET (fte_match_param, spec->match_value, misc_parameters.source_port); -return (port_mask & port_value &0xffff ) ==MLX5_VPORT_UPLINK ; +return (port_mask & port_value) ==MLX5_VPORT_UPLINK ; }bool
Signature · 1 line
2.24.1
PATCH 3/16 net/mlx5e: Eswitch, Use per vport tables for mirroring
In reply to Saeed MahameedFrom: Eli Cohen <[email protected]>
When using port mirroring, we forward the traffic to another table and use that table to forward to the mirrored vport. Since the hardware loses the values of reg c, and in particular reg c0, we fail the match on the input vport which previously existed in reg c0. To overcome this situation, we use a set of per vport tables, positioned at the lowest priority, and forward traffic to those tables. Since these tables are per vport, we can avoid matching on reg c0.
--- .../net/ethernet/mellanox/mlx5/core/eswitch.h | 10 + .../mellanox/mlx5/core/eswitch_offloads.c | 206 +++++++++++++++++- .../mlx5/core/eswitch_offloads_chains.c | 11 +- .../net/ethernet/mellanox/mlx5/core/fs_core.c | 11 + include/linux/mlx5/fs.h | 1 + 5 files changed, 221 insertions(+), 18 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/eswitch.h +10 -0
@@ -49,6 +49,7 @@/* The index of the last real chain (FT) + 1 as chain zero is valid as well */ #define FDB_NUM_CHAINS (FDB_FT_CHAIN + 1) +#define ESW_OFFLOADS_NUM_GROUPS 4#define FDB_TC_MAX_PRIO 16#define FDB_TC_LEVELS_PER_PRIO 2
@@ -183,6 +184,12 @@ struct mlx5_eswitch_fdb {int vlan_push_pop_refcount;struct mlx5_esw_chains_priv *esw_chains_priv; +struct { + DECLARE_HASHTABLE(table, 8); +/* Protects vports.table */ +struct mutex lock; + } vports; + } offloads; };u32 flags;
@@ -623,6 +630,9 @@ void esw_vport_destroy_offloads_acl_tables(struct mlx5_eswitch *esw, struct mlx5_vport *vport); +int mlx5_esw_vport_tbl_get (struct mlx5_eswitch *esw); +void mlx5_esw_vport_tbl_put (struct mlx5_eswitch *esw); +#else /* CONFIG_MLX5_ESWITCH */ /* eswitch API stubs */ static inline int mlx5_eswitch_init (struct mlx5_core_dev *dev) {return 0 ; }
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +196 -10
262 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_chains.c +3 -8
@@ -21,8 +21,6 @@#define fdb_ignore_flow_level_supported (esw) \ (MLX5_CAP_ESW_FLOWTABLE_FDB((esw)->dev, ignore_flow_level)) -#define ESW_OFFLOADS_NUM_GROUPS 4 -/* Firmware currently has 4 pool of 4 sizes that it supports (ESW_POOLS), * and a virtual memory region of 16M (ESW_SIZE), this region is duplicated * for each flow table pool. We can allocate up to 16M of each pool,
@@ -704,12 +702,9 @@ mlx5_esw_chains_open(struct mlx5_eswitch *esw)/* Open level 1 for split rules now if prios isn't supported */ if (!mlx5_esw_chains_prios_supported (esw)) { - ft =mlx5_esw_chains_get_table (esw,0 ,1 ,1 ); - -if (IS_ERR (ft)) { - err =PTR_ERR (ft); + err =mlx5_esw_vport_tbl_get (esw); +if (err) goto level_1_err; - } }return 0 ;
@@ -725,7 +720,7 @@ static void mlx5_esw_chains_close(struct mlx5_eswitch *esw) {if (!mlx5_esw_chains_prios_supported (esw)) -mlx5_esw_chains_put_table (esw,0 ,1 ,1 ); +mlx5_esw_vport_tbl_put (esw);mlx5_esw_chains_put_table (esw,0 ,1 ,0 );mlx5_esw_chains_put_table (esw,mlx5_esw_chains_get_ft_chain (esw),1 ,0 ); }
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c +11 -0
@@ -2700,6 +2700,17 @@ static int init_fdb_root_ns(struct mlx5_flow_steering *steering) goto out_err; } +/* We put this priority last, knowing that nothing will get here +* unless explicitly forwarded to. This is possible because the +* slow path tables have catch all rules and nothing gets passed +* those tables. +*/ + maj_prio =fs_create_prio (&steering->fdb_root_ns->ns,FDB_PER_VPORT ,1 ); +if (IS_ERR (maj_prio)) { + err =PTR_ERR (maj_prio); + goto out_err; + } +set_prio_attrs (steering->fdb_root_ns);return 0 ;
include/linux/mlx5/fs.h +1 -0
@@ -84,6 +84,7 @@ enum {FDB_TC_OFFLOAD ,FDB_FT_OFFLOAD ,FDB_SLOW_PATH , + FDB_PER_VPORT, };struct mlx5_pkt_reformat ;
Signature · 1 line
2.24.1
PATCH 4/16 net/mlx5: E-Switch, Allow goto earlier chain if FW supports it
In reply to Saeed MahameedFrom: Roi Dayan <[email protected]>
Mellanox FW can support this if ignore_flow_level capability exists.
--- drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 3 ++- .../ethernet/mellanox/mlx5/core/eswitch_offloads_chains.c | 5 +++++ .../ethernet/mellanox/mlx5/core/eswitch_offloads_chains.h | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +2 -1
@@ -3533,7 +3533,8 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv,NL_SET_ERR_MSG_MOD (extack,"Goto action is not supported" );return -EOPNOTSUPP ; } -if (dest_chain <= attr->chain) { +if (!mlx5_esw_chains_backwards_supported (esw) && + dest_chain <= attr->chain) {NL_SET_ERR_MSG (extack,"Goto earlier chain isn't supported" );return -EOPNOTSUPP ; }
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_chains.c +5 -0
@@ -97,6 +97,11 @@ bool mlx5_esw_chains_prios_supported(struct mlx5_eswitch *esw)return esw->fdb_table.flags &ESW_FDB_CHAINS_AND_PRIOS_SUPPORTED ; } +bool mlx5_esw_chains_backwards_supported (struct mlx5_eswitch *esw) +{ +return fdb_ignore_flow_level_supported (esw); +} +u32 mlx5_esw_chains_get_chain_range (struct mlx5_eswitch *esw) {if (!mlx5_esw_chains_prios_supported (esw))
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_chains.h +2 -0
@@ -6,6 +6,8 @@bool mlx5_esw_chains_prios_supported (struct mlx5_eswitch *esw); +bool +mlx5_esw_chains_backwards_supported (struct mlx5_eswitch *esw);u32 mlx5_esw_chains_get_prio_range (struct mlx5_eswitch *esw); u32
Signature · 1 line
2.24.1
PATCH 5/16 net/mlx5e: Rename representor get devlink port function
In reply to Saeed MahameedFrom: Vladyslav Tarasiuk <[email protected]>
Rename representor's mlx5e_get_devlink_port() to mlx5e_rep_get_devlink_port().
The downstream patch will add a non-representor mlx5e function called mlx5e_get_devlink_phy_port().
--- drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +3 -3
@@ -1422,7 +1422,7 @@ static int mlx5e_uplink_rep_set_vf_vlan(struct net_device *dev, int vf, u16 vlanreturn 0 ; } -static struct devlink_port *mlx5e_get_devlink_port (struct net_device *dev) +static struct devlink_port *mlx5e_rep_get_devlink_port (struct net_device *dev) {struct mlx5e_priv *priv =netdev_priv (dev);struct mlx5e_rep_priv *rpriv = priv->ppriv;
@@ -1435,7 +1435,7 @@ static const struct net_device_ops mlx5e_netdev_ops_rep = { .ndo_stop = mlx5e_rep_close, .ndo_start_xmit = mlx5e_xmit, .ndo_setup_tc = mlx5e_rep_setup_tc, - .ndo_get_devlink_port = mlx5e_get_devlink_port, + .ndo_get_devlink_port = mlx5e_rep_get_devlink_port, .ndo_get_stats64 = mlx5e_rep_get_stats, .ndo_has_offload_stats = mlx5e_rep_has_offload_stats, .ndo_get_offload_stats = mlx5e_rep_get_offload_stats,
@@ -1448,7 +1448,7 @@ static const struct net_device_ops mlx5e_netdev_ops_uplink_rep = { .ndo_start_xmit = mlx5e_xmit, .ndo_set_mac_address = mlx5e_uplink_rep_set_mac, .ndo_setup_tc = mlx5e_rep_setup_tc, - .ndo_get_devlink_port = mlx5e_get_devlink_port, + .ndo_get_devlink_port = mlx5e_rep_get_devlink_port, .ndo_get_stats64 = mlx5e_get_stats, .ndo_has_offload_stats = mlx5e_rep_has_offload_stats, .ndo_get_offload_stats = mlx5e_rep_get_offload_stats,
Signature · 1 line
2.24.1
PATCH 6/16 net/mlx5e: Add support for devlink-port in non-representors mode
In reply to Saeed MahameedFrom: Vladyslav Tarasiuk <[email protected]>
Added devlink_port field to mlx5e_priv structure and a callback to netdev ops to enable devlink to get info about the port. The port registration happens at driver initialization.
--- .../net/ethernet/mellanox/mlx5/core/Makefile | 2 +- drivers/net/ethernet/mellanox/mlx5/core/en.h | 1 + .../ethernet/mellanox/mlx5/core/en/devlink.c | 38 +++++++++++++++++++ .../ethernet/mellanox/mlx5/core/en/devlink.h | 15 ++++++++ .../net/ethernet/mellanox/mlx5/core/en_main.c | 11 ++++++ 5 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 drivers/net/ethernet/mellanox/mlx5/core/en/devlink.c create mode 100644 drivers/net/ethernet/mellanox/mlx5/core/en/devlink.h
drivers/net/ethernet/mellanox/mlx5/core/Makefile +1 -1
@@ -25,7 +25,7 @@ mlx5_core-$(CONFIG_MLX5_CORE_EN) += en_main.o en_common.o en_fs.o en_ethtool.o \ en_tx.o en_rx.o en_dim.o en_txrx.o en/xdp.o en_stats.o \ en_selftest.o en/port.o en/monitor_stats.o en/health.o \ en/reporter_tx.o en/reporter_rx.o en/params.o en/xsk/umem.o \ - en/xsk/setup.o en/xsk/rx.o en/xsk/tx.o + en/xsk/setup.o en/xsk/rx.o en/xsk/tx.o en/devlink.o # # Netdev extra
drivers/net/ethernet/mellanox/mlx5/core/en.h +1 -0
@@ -880,6 +880,7 @@ struct mlx5e_priv {#endif struct devlink_health_reporter *tx_reporter;struct devlink_health_reporter *rx_reporter; +struct devlink_port dl_phy_port;struct mlx5e_xsk xsk;#if IS_ENABLED (CONFIG_PCI_HYPERV_INTERFACE )struct mlx5e_hv_vhca_stats_agent stats_agent;
drivers/net/ethernet/mellanox/mlx5/core/en/devlink.c new file +38 -0
@@ -0,0 +1,38 @@ +// SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB +/* Copyright (c) 2020, Mellanox Technologies inc. All rights reserved. */ + +#include "en/devlink.h" + +int mlx5e_devlink_phy_port_register (struct net_device *dev) +{ +struct mlx5e_priv *priv; +struct devlink *devlink; +int err; + + priv =netdev_priv (dev); + devlink =priv_to_devlink (priv->mdev); + +devlink_port_attrs_set (&priv->dl_phy_port, +DEVLINK_PORT_FLAVOUR_PHYSICAL , +PCI_FUNC (priv->mdev->pdev->devfn), + false,0 , +NULL ,0 ); + err =devlink_port_register (devlink, &priv->dl_phy_port,1 ); +if (err) +return err; +devlink_port_type_eth_set (&priv->dl_phy_port, dev); +return 0 ; +} + +void mlx5e_devlink_phy_port_unregister (struct mlx5e_priv *priv) +{ +devlink_port_unregister (&priv->dl_phy_port); +} + +struct devlink_port *mlx5e_get_devlink_phy_port (struct net_device *dev) +{ +struct mlx5e_priv *priv =netdev_priv (dev); + +return &priv->dl_phy_port; +} +
drivers/net/ethernet/mellanox/mlx5/core/en/devlink.h new file +15 -0
@@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */ +/* Copyright (c) 2020, Mellanox Technologies inc. All rights reserved. */ + +#ifndef __MLX5E_EN_DEVLINK_H +#define __MLX5E_EN_DEVLINK_H + +#include <net/devlink.h> +#include "en.h" + +int mlx5e_devlink_phy_port_register (struct net_device *dev); +void mlx5e_devlink_phy_port_unregister (struct mlx5e_priv *priv); +struct devlink_port *mlx5e_get_devlink_phy_port (struct net_device *dev); + +#endif +
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +11 -0
@@ -63,6 +63,7 @@#include "en/xsk/rx.h" #include "en/xsk/tx.h" #include "en/hv_vhca_stats.h" +#include "en/devlink.h" #include "lib/mlx5.h"
@@ -4605,6 +4606,7 @@ const struct net_device_ops mlx5e_netdev_ops = { .ndo_set_vf_link_state = mlx5e_set_vf_link_state, .ndo_get_vf_stats = mlx5e_get_vf_stats, #endif + .ndo_get_devlink_port = mlx5e_get_devlink_phy_port, };static int mlx5e_check_required_hca_cap (struct mlx5_core_dev *mdev)
@@ -5472,11 +5474,19 @@ static void *mlx5e_add(struct mlx5_core_dev *mdev) goto err_detach; } + err =mlx5e_devlink_phy_port_register (netdev); +if (err) { +mlx5_core_err (mdev,"mlx5e_devlink_phy_port_register failed, %d\n" , err); + goto err_unregister_netdev; + } +#ifdef CONFIG_MLX5_CORE_EN_DCB mlx5e_dcbnl_init_app (priv);#endif return priv; +err_unregister_netdev: +unregister_netdev (netdev); err_detach:mlx5e_detach (mdev, priv); err_destroy_netdev:
@@ -5498,6 +5508,7 @@ static void mlx5e_remove(struct mlx5_core_dev *mdev, void *vpriv)#ifdef CONFIG_MLX5_CORE_EN_DCB mlx5e_dcbnl_delete_app (priv);#endif +mlx5e_devlink_phy_port_unregister (priv);unregister_netdev (priv->netdev);mlx5e_detach (mdev, vpriv);mlx5e_destroy_netdev (priv);
Signature · 1 line
2.24.1
PATCH 7/16 net/mlx5: Change the name of steering mode param id
In reply to Saeed MahameedFrom: Jianbo Liu <[email protected]>
The prefix should be "MLX5_DEVLINK_PARAM_ID_" for all in mlx5_devlink_param_id enum.
--- drivers/net/ethernet/mellanox/mlx5/core/devlink.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/devlink.c +3 -3
@@ -192,7 +192,7 @@ static int mlx5_devlink_fs_mode_get(struct devlink *devlink, u32 id,enum mlx5_devlink_param_id {MLX5_DEVLINK_PARAM_ID_BASE =DEVLINK_PARAM_GENERIC_ID_MAX , -MLX5_DEVLINK_PARAM_FLOW_STEERING_MODE , +MLX5_DEVLINK_PARAM_ID_FLOW_STEERING_MODE , }; static int mlx5_devlink_enable_roce_validate(struct devlink *devlink, u32 id,
@@ -211,7 +211,7 @@ static int mlx5_devlink_enable_roce_validate(struct devlink *devlink, u32 id, }static const struct devlink_param mlx5_devlink_params[] = { - DEVLINK_PARAM_DRIVER(MLX5_DEVLINK_PARAM_FLOW_STEERING_MODE, + DEVLINK_PARAM_DRIVER(MLX5_DEVLINK_PARAM_ID_FLOW_STEERING_MODE, "flow_steering_mode", DEVLINK_PARAM_TYPE_STRING, BIT(DEVLINK_PARAM_CMODE_RUNTIME), mlx5_devlink_fs_mode_get, mlx5_devlink_fs_mode_set,
@@ -230,7 +230,7 @@ static void mlx5_devlink_set_params_init_values(struct devlink *devlink)else strcpy (value.vstr,"smfs" );devlink_param_driverinit_value_set (devlink, -MLX5_DEVLINK_PARAM_FLOW_STEERING_MODE , +MLX5_DEVLINK_PARAM_ID_FLOW_STEERING_MODE , value); value.vbool =MLX5_CAP_GEN (dev, roce);
Signature · 1 line
2.24.1
PATCH 8/16 net/mlx5e: Add devlink fdb_large_groups parameter
In reply to Saeed MahameedFrom: Jianbo Liu <[email protected]>
Add a devlink parameter to control the number of large groups in a autogrouped flow table. The default value is 15, and the range is between 1 and 1024.
The size of each large group can be calculated according to the following
formula: size = 4M / (fdb_large_groups + 1).
Examples:
- Set the number of large groups to 20.
$ devlink dev param set pci/0000:82:00.0 name fdb_large_groups \
cmode driverinit value 20Then run devlink reload command to apply the new value.
$ devlink dev reload pci/0000:82:00.0
- Read the number of large groups in flow table.
$ devlink dev param show pci/0000:82:00.0 name fdb_large_groups
pci/0000:82:00.0:
name fdb_large_groups type driver-specific
values:
cmode driverinit value 20--- Documentation/networking/devlink/mlx5.rst | 6 ++++ .../net/ethernet/mellanox/mlx5/core/devlink.c | 36 ++++++++++++++++--- .../net/ethernet/mellanox/mlx5/core/devlink.h | 6 ++++ .../net/ethernet/mellanox/mlx5/core/eswitch.c | 22 ++++++++++++ .../net/ethernet/mellanox/mlx5/core/eswitch.h | 6 +++- .../mellanox/mlx5/core/eswitch_offloads.c | 4 ++- .../mlx5/core/eswitch_offloads_chains.c | 4 +-- 7 files changed, 75 insertions(+), 9 deletions(-)
Documentation/networking/devlink/mlx5.rst +6 -0
@@ -37,6 +37,12 @@ parameters. * ``smfs`` Software managed flow steering. In SMFS mode, the HW steering entities are created and manage through the driver without firmware intervention. + * - ``fdb_large_groups`` + - u32 + - driverinit + - Control the number of large groups (size > 1) in the FDB table. + + * The default value is 15, and the range is between 1 and 1024. The ``mlx5`` driver supports reloading via ``DEVLINK_CMD_RELOAD``
drivers/net/ethernet/mellanox/mlx5/core/devlink.c +31 -5
@@ -190,11 +190,6 @@ static int mlx5_devlink_fs_mode_get(struct devlink *devlink, u32 id,return 0 ; } -enum mlx5_devlink_param_id { -MLX5_DEVLINK_PARAM_ID_BASE =DEVLINK_PARAM_GENERIC_ID_MAX , -MLX5_DEVLINK_PARAM_ID_FLOW_STEERING_MODE , -}; -static int mlx5_devlink_enable_roce_validate (struct devlink *devlink,u32 id,union devlink_param_value val,struct netlink_ext_ack *extack)
@@ -210,6 +205,23 @@ static int mlx5_devlink_enable_roce_validate(struct devlink *devlink, u32 id,return 0 ; } +#ifdef CONFIG_MLX5_ESWITCH +static int mlx5_devlink_large_group_num_validate (struct devlink *devlink,u32 id, +union devlink_param_value val, +struct netlink_ext_ack *extack) +{ +int group_num = val.vu32; + +if (group_num <1 || group_num >1024 ) { +NL_SET_ERR_MSG_MOD (extack, +"Unsupported group number, supported range is 1-1024" ); +return -EOPNOTSUPP ; + } + +return 0 ; +} +#endif +static const struct devlink_param mlx5_devlink_params[] = { DEVLINK_PARAM_DRIVER(MLX5_DEVLINK_PARAM_ID_FLOW_STEERING_MODE, "flow_steering_mode", DEVLINK_PARAM_TYPE_STRING,
@@ -218,6 +230,13 @@ static const struct devlink_param mlx5_devlink_params[] = { mlx5_devlink_fs_mode_validate),DEVLINK_PARAM_GENERIC (ENABLE_ROCE ,BIT (DEVLINK_PARAM_CMODE_DRIVERINIT ),NULL ,NULL , mlx5_devlink_enable_roce_validate), +#ifdef CONFIG_MLX5_ESWITCH +DEVLINK_PARAM_DRIVER (MLX5_DEVLINK_PARAM_ID_ESW_LARGE_GROUP_NUM , +"fdb_large_groups" ,DEVLINK_PARAM_TYPE_U32 , +BIT (DEVLINK_PARAM_CMODE_DRIVERINIT ), +NULL ,NULL , + mlx5_devlink_large_group_num_validate), +#endif };static void mlx5_devlink_set_params_init_values (struct devlink *devlink)
@@ -237,6 +256,13 @@ static void mlx5_devlink_set_params_init_values(struct devlink *devlink)devlink_param_driverinit_value_set (devlink,DEVLINK_PARAM_GENERIC_ID_ENABLE_ROCE , value); + +#ifdef CONFIG_MLX5_ESWITCH + value.vu32 =ESW_OFFLOADS_DEFAULT_NUM_GROUPS ; +devlink_param_driverinit_value_set (devlink, +MLX5_DEVLINK_PARAM_ID_ESW_LARGE_GROUP_NUM , + value); +#endif }int mlx5_devlink_register (struct devlink *devlink,struct device *dev)
drivers/net/ethernet/mellanox/mlx5/core/devlink.h +6 -0
@@ -6,6 +6,12 @@#include <net/devlink.h> +enum mlx5_devlink_param_id { +MLX5_DEVLINK_PARAM_ID_BASE =DEVLINK_PARAM_GENERIC_ID_MAX , +MLX5_DEVLINK_PARAM_ID_FLOW_STEERING_MODE , +MLX5_DEVLINK_PARAM_ID_ESW_LARGE_GROUP_NUM , +}; +struct devlink *mlx5_devlink_alloc (void );void mlx5_devlink_free (struct devlink *devlink);int mlx5_devlink_register (struct devlink *devlink,struct device *dev);
drivers/net/ethernet/mellanox/mlx5/core/eswitch.c +22 -0
@@ -39,6 +39,7 @@#include "lib/eq.h" #include "eswitch.h" #include "fs_core.h" +#include "devlink.h" #include "ecpf.h" enum {
@@ -2006,6 +2007,25 @@ void mlx5_eswitch_disable_pf_vf_vports(struct mlx5_eswitch *esw)esw_disable_vport (esw, vport); } +static void mlx5_eswitch_get_devlink_param (struct mlx5_eswitch *esw) +{ +struct devlink *devlink =priv_to_devlink (esw->dev); +union devlink_param_value val; +int err; + + err =devlink_param_driverinit_value_get (devlink, +MLX5_DEVLINK_PARAM_ID_ESW_LARGE_GROUP_NUM , + &val); +if (!err) { + esw->params.large_group_num = val.vu32; + }else { +esw_warn (esw->dev, +"Devlink can't get param fdb_large_groups, uses default (%d).\n" , +ESW_OFFLOADS_DEFAULT_NUM_GROUPS ); + esw->params.large_group_num =ESW_OFFLOADS_DEFAULT_NUM_GROUPS ; + } +} +int mlx5_eswitch_enable (struct mlx5_eswitch *esw,int mode) {int err;
@@ -2022,6 +2042,8 @@ int mlx5_eswitch_enable(struct mlx5_eswitch *esw, int mode)if (!MLX5_CAP_ESW_EGRESS_ACL (esw->dev, ft_support))esw_warn (esw->dev,"engress ACL is not supported by FW\n" ); +mlx5_eswitch_get_devlink_param (esw); +esw_create_tsar (esw); esw->mode = mode;
drivers/net/ethernet/mellanox/mlx5/core/eswitch.h +5 -1
@@ -49,13 +49,14 @@/* The index of the last real chain (FT) + 1 as chain zero is valid as well */ #define FDB_NUM_CHAINS (FDB_FT_CHAIN + 1) -#define ESW_OFFLOADS_NUM_GROUPS 4#define FDB_TC_MAX_PRIO 16#define FDB_TC_LEVELS_PER_PRIO 2#ifdef CONFIG_MLX5_ESWITCH +#define ESW_OFFLOADS_DEFAULT_NUM_GROUPS 15 +#define MLX5_MAX_UC_PER_VPORT (dev) \ (1 << MLX5_CAP_GEN(dev, log_max_current_uc_list))
@@ -262,6 +263,9 @@ struct mlx5_eswitch {u16 manager_vport;u16 first_host_vport;struct mlx5_esw_functions esw_funcs; +struct { +u32 large_group_num; + } params; };void esw_offloads_disable (struct mlx5_eswitch *esw);
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +3 -1
@@ -71,13 +71,15 @@ struct mlx5_vport_table {struct mlx5_vport_key key; }; +#define MLX5_ESW_VPORT_TBL_NUM_GROUPS 4 +static struct mlx5_flow_table *esw_vport_tbl_create (struct mlx5_eswitch *esw,struct mlx5_flow_namespace *ns) {struct mlx5_flow_table_attr ft_attr = {};struct mlx5_flow_table *fdb; - ft_attr.autogroup.max_num_groups =ESW_OFFLOADS_NUM_GROUPS ; + ft_attr.autogroup.max_num_groups =MLX5_ESW_VPORT_TBL_NUM_GROUPS ; ft_attr.max_fte =MLX5_ESW_VPORT_TABLE_SIZE ; ft_attr.prio =FDB_PER_VPORT ; fdb =mlx5_create_auto_grouped_flow_table (ns, &ft_attr);
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_chains.c +2 -2
@@ -237,7 +237,7 @@ mlx5_esw_chains_create_fdb_table(struct mlx5_eswitch *esw, } ft_attr.autogroup.num_reserved_entries =2 ; - ft_attr.autogroup.max_num_groups =ESW_OFFLOADS_NUM_GROUPS ; + ft_attr.autogroup.max_num_groups = esw->params.large_group_num; fdb =mlx5_create_auto_grouped_flow_table (ns, &ft_attr);if (IS_ERR (fdb)) { esw_warn(esw->dev,
@@ -640,7 +640,7 @@ mlx5_esw_chains_init(struct mlx5_eswitch *esw)esw_debug (dev,"Init esw offloads chains, max counters(%d), groups(%d), max flow table size(%d)\n" , - max_flow_counter,ESW_OFFLOADS_NUM_GROUPS , fdb_max); + max_flow_counter, esw->params.large_group_num, fdb_max);mlx5_esw_chains_init_sz_pool (esw);
Signature · 1 line
2.24.1
Jakub Kicinski
maintainerRe: [net-next 08/16] net/mlx5e: Add devlink fdb_large_groups parameter
Quoted 24 lines · On Thu, 27 Feb 2020 16:44:38 -0800 Saeed Mahameed wrote:
From: Jianbo Liu <[email protected]>
Add a devlink parameter to control the number of large groups in a autogrouped flow table. The default value is 15, and the range is between 1 and 1024.
The size of each large group can be calculated according to the following
formula: size = 4M / (fdb_large_groups+ 1).Examples:
- Set the number of large groups to 20.$ devlink dev param set pci/0000:82:00.0 name fdb_large_groups \ cmode driverinit value 20Then run devlink reload command to apply the new value.
$ devlink dev reload pci/0000:82:00.0- Read the number of large groups in flow table.
$ devlink dev param show pci/0000:82:00.0 name fdb_large_groups pci/0000:82:00.0: name fdb_large_groups type driver-specific values: cmode driverinit value 20
Quoted 5 lines
Signed-off-by Jianbo Liu <[email protected]>Reviewed-by Vlad Buslov <[email protected]>Reviewed-by Roi Dayan <[email protected]>Acked-by Jiri Pirko <[email protected]>Signed-off-by Saeed Mahameed <[email protected]>
Slicing memory up sounds like something that should be supported via the devlink-resource API, not by params and non-obvious calculations :(
Re: [net-next 08/16] net/mlx5e: Add devlink fdb_large_groups parameter
Quoted 25 lines · Jakub Kicinski
Quoted 24 lines · On Thu, 27 Feb 2020 16:44:38 -0800 Saeed Mahameed wrote:
From: Jianbo Liu <[email protected]>
Add a devlink parameter to control the number of large groups in a autogrouped flow table. The default value is 15, and the range is between 1 and 1024.
The size of each large group can be calculated according to the following
formula: size = 4M / (fdb_large_groups+ 1).Examples:
- Set the number of large groups to 20.$ devlink dev param set pci/0000:82:00.0 name fdb_large_groups \ cmode driverinit value 20Then run devlink reload command to apply the new value.
$ devlink dev reload pci/0000:82:00.0- Read the number of large groups in flow table.
$ devlink dev param show pci/0000:82:00.0 name fdb_large_groups pci/0000:82:00.0: name fdb_large_groups type driver-specific values: cmode driverinit value 20
Quoted 8 lines
Quoted 5 lines
Signed-off-by Jianbo Liu <[email protected]>Reviewed-by Vlad Buslov <[email protected]>Reviewed-by Roi Dayan <[email protected]>Acked-by Jiri Pirko <[email protected]>Signed-off-by Saeed Mahameed <[email protected]>Slicing memory up sounds like something that should be supported via the devlink-resource API, not by params and non-obvious calculations :(
No, it's not to configure memory resource. It is to control how many large groups in FW FDB. The calculations to to tell how many rules in each large group.
Jakub Kicinski
maintainerRe: [net-next 08/16] net/mlx5e: Add devlink fdb_large_groups parameter
Quoted 32 lines · On Mon, 2 Mar 2020 02:04:20 +0000 Jianbo Liu wrote:
Quoted 31 lines · Jakub Kicinski
Quoted 29 lines · On Thu, 27 Feb 2020 16:44:38 -0800 Saeed Mahameed wrote:
From: Jianbo Liu <[email protected]>
Add a devlink parameter to control the number of large groups in a autogrouped flow table. The default value is 15, and the range is between 1 and 1024.
The size of each large group can be calculated according to the following
formula: size = 4M / (fdb_large_groups+ 1).Examples:
- Set the number of large groups to 20.$ devlink dev param set pci/0000:82:00.0 name fdb_large_groups \ cmode driverinit value 20Then run devlink reload command to apply the new value.
$ devlink dev reload pci/0000:82:00.0- Read the number of large groups in flow table.
$ devlink dev param show pci/0000:82:00.0 name fdb_large_groups pci/0000:82:00.0: name fdb_large_groups type driver-specific values: cmode driverinit value 20Signed-off-by Jianbo Liu <[email protected]>Reviewed-by Vlad Buslov <[email protected]>Reviewed-by Roi Dayan <[email protected]>Acked-by Jiri Pirko <[email protected]>Signed-off-by Saeed Mahameed <[email protected]>
Quoted 6 lines
Quoted 2 lines
Slicing memory up sounds like something that should be supported via the devlink-resource API, not by params and non-obvious calculations :(
No, it's not to configure memory resource. It is to control how many large groups in FW FDB. The calculations to to tell how many rules in each large group.
I don't know what a "large group" is. Please update the documentation so it's not an utter pleonasm.
What's a large group? How does twiddling with this knob change the behavior of the system? Who and in what conditions may be interested in adjusting it?
Re: [net-next 08/16] net/mlx5e: Add devlink fdb_large_groups parameter
In reply to Jakub KicinskiQuoted 34 lines · Jakub Kicinski
Quoted 27 lines · On Thu, 27 Feb 2020 16:44:38 -0800 Saeed Mahameed wrote:
From: Jianbo Liu <[email protected]>
Add a devlink parameter to control the number of large groups in a autogrouped flow table. The default value is 15, and the range is between 1
and 1024.The size of each large group can be calculated according to the following
formula: size = 4M / (fdb_large_groups+ 1).Examples:
- Set the number of large groups to 20.$ devlink dev param set pci/0000:82:00.0 name fdb_large_groups \ cmode driverinit value 20Then run devlink reload command to apply the new value.
$ devlink dev reload pci/0000:82:00.0- Read the number of large groups in flow table.
$ devlink dev param show pci/0000:82:00.0 name fdb_large_groups pci/0000:82:00.0: name fdb_large_groups type driver-specific values: cmode driverinit value 20Quoted 5 lines
Signed-off-by Jianbo Liu <[email protected]>Reviewed-by Vlad Buslov <[email protected]>Reviewed-by Roi Dayan <[email protected]>Acked-by Jiri Pirko <[email protected]>Signed-off-by Saeed Mahameed <[email protected]>
Quoted 3 lines
Slicing memory up sounds like something that should be supported via the devlink-resource API, not by params and non-obvious calculations :(
Hi Jakub, you have a point, but due to to the non-triviality of the internal mlnx driver and FW architecture of handling internal FDB table breakdown, we preferred to go with one driver-specific parameter to simplify the approach, instead of 3 or 4 generic params, which will not make any sense to other vendors for now.
As always we will keep an eye on what other vendors are doing and will try to unify with a generic set of params once other vendors show interest of a similar thing.
Thanks,
Saeed.
Jakub Kicinski
maintainerRe: [net-next 08/16] net/mlx5e: Add devlink fdb_large_groups parameter
Quoted 10 lines · On Mon, 2 Mar 2020 18:48:22 +0000 Saeed Mahameed wrote:
Quoted 8 lines · Jakub Kicinski
Quoted 3 lines · On Thu, 27 Feb 2020 16:44:38 -0800 Saeed Mahameed wrote:
The size of each large group can be calculated according to the following
formula: size = 4M / (fdb_large_groups+ 1).Slicing memory up sounds like something that should be supported via the devlink-resource API, not by params and non-obvious calculations :(
Quoted 5 lines
Hi Jakub, you have a point, but due to to the non-triviality of the internal mlnx driver and FW architecture of handling internal FDB table breakdown, we preferred to go with one driver-specific parameter to simplify the approach, instead of 3 or 4 generic params, which will not make any sense to other vendors for now.
Actually I was hoping this can be made into some resource attribute, rather than a generic parameter. The formula in the commit message looks very much like there is a resource of 4M "things" which is subdivided into "large groups".
Maybe if Jiri acked it it's not a great fit.
Quoted 3 lines
As always we will keep an eye on what other vendors are doing and will try to unify with a generic set of params once other vendors show interest of a similar thing.
Ah, yes :)
Re: [net-next 08/16] net/mlx5e: Add devlink fdb_large_groups parameter
Quoted 17 lines · Jakub Kicinski
Quoted 10 lines · On Mon, 2 Mar 2020 18:48:22 +0000 Saeed Mahameed wrote:
Quoted 8 lines · Jakub Kicinski
Quoted 3 lines · On Thu, 27 Feb 2020 16:44:38 -0800 Saeed Mahameed wrote:
The size of each large group can be calculated according to the following
formula: size = 4M / (fdb_large_groups+ 1).Slicing memory up sounds like something that should be supported via the devlink-resource API, not by params and non-obvious calculations :(
Quoted 5 lines
Hi Jakub, you have a point, but due to to the non-triviality of the internal mlnx driver and FW architecture of handling internal FDB table breakdown, we preferred to go with one driver-specific parameter to simplify the approach, instead of 3 or 4 generic params, which will not make any sense to other vendors for now.
Quoted 6 lines
Actually I was hoping this can be made into some resource attribute, rather than a generic parameter. The formula in the commit message looks very much like there is a resource of 4M "things" which is subdivided into "large groups".
Maybe if Jiri acked it it's not a great fit.
Actually it's Jiri's suggestion.
Quoted 6 lines
Quoted 4 lines
As always we will keep an eye on what other vendors are doing and will try to unify with a generic set of params once other vendors show interest of a similar thing.
Ah, yes :)
PATCH 9/16 net/mlx5: DR, Change matcher priority parameter type
In reply to Saeed MahameedFrom: Hamdan Igbaria <[email protected]>
Change matcher priority parameter type from u16 to u32, this change is needed since sometimes upper levels create a matcher with priority bigger than 2^16.
--- drivers/net/ethernet/mellanox/mlx5/core/steering/dr_matcher.c | 2 +- drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h | 2 +- drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c | 2 +- drivers/net/ethernet/mellanox/mlx5/core/steering/mlx5dr.h | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_matcher.c +1 -1
@@ -671,7 +671,7 @@ static int dr_matcher_init(struct mlx5dr_matcher *matcher,struct mlx5dr_matcher *mlx5dr_matcher_create (struct mlx5dr_table *tbl, -u16 priority, +u32 priority,u8 match_criteria_enable,struct mlx5dr_match_parameters *mask) {
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h +1 -1
@@ -705,7 +705,7 @@ struct mlx5dr_matcher {struct mlx5dr_matcher_rx_tx rx;struct mlx5dr_matcher_rx_tx tx;struct list_head matcher_list; -u16 prio; +u32 prio;struct mlx5dr_match_param mask;u8 match_criteria;refcount_t refcount;
drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c +1 -1
@@ -140,7 +140,7 @@ static int mlx5_cmd_dr_create_flow_group(struct mlx5_flow_root_namespace *ns, struct mlx5_flow_group *fg) {struct mlx5dr_matcher *matcher; -u16 priority =MLX5_GET (create_flow_group_in, in, +u32 priority =MLX5_GET (create_flow_group_in, in, start_flow_index); u8 match_criteria_enable = MLX5_GET(create_flow_group_in, in,
drivers/net/ethernet/mellanox/mlx5/core/steering/mlx5dr.h +2 -2
@@ -59,7 +59,7 @@ u32 mlx5dr_table_get_id(struct mlx5dr_table *table);struct mlx5dr_matcher *mlx5dr_matcher_create (struct mlx5dr_table *table, -u16 priority, +u32 priority,u8 match_criteria_enable,struct mlx5dr_match_parameters *mask);
@@ -151,7 +151,7 @@ mlx5dr_table_get_id(struct mlx5dr_table *table) { return 0; }static inline struct mlx5dr_matcher *mlx5dr_matcher_create (struct mlx5dr_table *table, -u16 priority, +u32 priority,u8 match_criteria_enable,struct mlx5dr_match_parameters *mask) {return NULL ; }
Signature · 1 line
2.24.1
PATCH 10/16 net/mlx5: DR, Improve log messages
In reply to Saeed MahameedFrom: Erez Shitrit <[email protected]>
Few print messages are in debug level where they should be in error, and few messages are missing.
--- .../mellanox/mlx5/core/steering/dr_action.c | 10 +++++----- .../mellanox/mlx5/core/steering/dr_domain.c | 17 ++++++++++------- .../mellanox/mlx5/core/steering/dr_icm_pool.c | 2 +- .../mellanox/mlx5/core/steering/dr_matcher.c | 10 +++++----- .../mellanox/mlx5/core/steering/dr_rule.c | 18 +++++++++--------- .../mellanox/mlx5/core/steering/dr_send.c | 16 ++++++++++++---- .../mellanox/mlx5/core/steering/dr_ste.c | 2 +- .../mellanox/mlx5/core/steering/dr_table.c | 8 ++++++-- 8 files changed, 49 insertions(+), 34 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_action.c +5 -5
@@ -672,7 +672,7 @@ int mlx5dr_actions_build_ste_arr(struct mlx5dr_matcher *matcher, dest_action = action;if (!action->dest_tbl.is_fw_tbl) {if (action->dest_tbl.tbl->dmn != dmn) { -mlx5dr_dbg (dmn, +mlx5dr_err (dmn,"Destination table belongs to a different domain\n" ); goto out_invalid_arg; }
@@ -703,7 +703,7 @@ int mlx5dr_actions_build_ste_arr(struct mlx5dr_matcher *matcher, action->dest_tbl.fw_tbl.rx_icm_addr = output.sw_owner_icm_root_0; }else { -mlx5dr_dbg (dmn, +mlx5dr_err (dmn,"Failed mlx5_cmd_query_flow_table ret: %d\n" , ret);return ret;
@@ -772,7 +772,7 @@ int mlx5dr_actions_build_ste_arr(struct mlx5dr_matcher *matcher,/* Check action duplication */ if (++action_type_set[action_type] > max_actions_type) { -mlx5dr_dbg (dmn,"Action type %d supports only max %d time(s)\n" , +mlx5dr_err (dmn,"Action type %d supports only max %d time(s)\n" , action_type, max_actions_type); goto out_invalid_arg; }
@@ -781,7 +781,7 @@ int mlx5dr_actions_build_ste_arr(struct mlx5dr_matcher *matcher,if (dr_action_validate_and_get_next_state (action_domain, action_type, &state)) { -mlx5dr_dbg (dmn,"Invalid action sequence provided\n" ); +mlx5dr_err (dmn,"Invalid action sequence provided\n" );return -EOPNOTSUPP ; } }
@@ -797,7 +797,7 @@ int mlx5dr_actions_build_ste_arr(struct mlx5dr_matcher *matcher, rx_rule && recalc_cs_required && dest_action) { ret =dr_action_handle_cs_recalc (dmn, dest_action, &attr.final_icm_addr);if (ret) { -mlx5dr_dbg (dmn, +mlx5dr_err (dmn,"Failed to handle checksum recalculation err %d\n" , ret);return ret;
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_domain.c +10 -7
@@ -59,7 +59,7 @@ static int dr_domain_init_resources(struct mlx5dr_domain *dmn) ret =mlx5_core_alloc_pd (dmn->mdev, &dmn->pdn);if (ret) { -mlx5dr_dbg (dmn,"Couldn't allocate PD\n" ); +mlx5dr_err (dmn,"Couldn't allocate PD, ret: %d" , ret);return ret; }
@@ -192,7 +192,7 @@ static int dr_domain_query_fdb_caps(struct mlx5_core_dev *mdev, ret =dr_domain_query_vports (dmn);if (ret) { -mlx5dr_dbg (dmn,"Failed to query vports caps\n" ); +mlx5dr_err (dmn,"Failed to query vports caps (err: %d)" , ret); goto free_vports_caps; }
@@ -213,7 +213,7 @@ static int dr_domain_caps_init(struct mlx5_core_dev *mdev,int ret;if (MLX5_CAP_GEN (mdev, port_type) !=MLX5_CAP_PORT_TYPE_ETH ) { -mlx5dr_dbg (dmn,"Failed to allocate domain, bad link type\n" ); +mlx5dr_err (dmn,"Failed to allocate domain, bad link type\n" );return -EOPNOTSUPP ; }
@@ -257,7 +257,7 @@ static int dr_domain_caps_init(struct mlx5_core_dev *mdev, dmn->info.tx.ste_type =MLX5DR_STE_TYPE_TX ; vport_cap =mlx5dr_get_vport_cap (&dmn->info.caps,0 );if (!vport_cap) { -mlx5dr_dbg (dmn,"Failed to get esw manager vport\n" ); +mlx5dr_err (dmn,"Failed to get esw manager vport\n" );return -ENOENT ; }
@@ -268,7 +268,7 @@ static int dr_domain_caps_init(struct mlx5_core_dev *mdev, dmn->info.tx.drop_icm_addr = dmn->info.caps.esw_tx_drop_address;break ;default : -mlx5dr_dbg (dmn,"Invalid domain\n" ); +mlx5dr_err (dmn,"Invalid domain\n" ); ret = -EINVAL ;break ; }
@@ -300,7 +300,7 @@ mlx5dr_domain_create(struct mlx5_core_dev *mdev, enum mlx5dr_domain_type type)mutex_init (&dmn->mutex);if (dr_domain_caps_init (mdev, dmn)) { -mlx5dr_dbg (dmn,"Failed init domain, no caps\n" ); +mlx5dr_err (dmn,"Failed init domain, no caps\n" ); goto free_domain; }
@@ -348,8 +348,11 @@ int mlx5dr_domain_sync(struct mlx5dr_domain *dmn, u32 flags)mutex_lock (&dmn->mutex); ret =mlx5dr_send_ring_force_drain (dmn);mutex_unlock (&dmn->mutex); -if (ret) +if (ret) { +mlx5dr_err (dmn,"Force drain failed flags: %d, ret: %d\n" , + flags, ret);return ret; + } }if (flags &MLX5DR_DOMAIN_SYNC_FLAGS_HW )
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_icm_pool.c +1 -1
@@ -468,7 +468,7 @@ mlx5dr_icm_alloc_chunk(struct mlx5dr_icm_pool *pool, err =mlx5dr_cmd_sync_steering (pool->dmn->mdev);if (err) {dr_icm_chill_buckets_abort (pool, bucket, buckets); -mlx5dr_dbg (pool->dmn,"Sync_steering failed\n" ); +mlx5dr_err (pool->dmn,"Sync_steering failed\n" ); chunk =NULL ; goto out; }
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_matcher.c +5 -5
@@ -388,14 +388,14 @@ static int dr_matcher_set_ste_builders(struct mlx5dr_matcher *matcher,mlx5dr_ste_build_empty_always_hit (&sb[idx++], rx);if (idx ==0 ) { -mlx5dr_dbg (dmn,"Cannot generate any valid rules from mask\n" ); +mlx5dr_err (dmn,"Cannot generate any valid rules from mask\n" );return -EINVAL ; }/* Check that all mask fields were consumed */ for (i =0 ; i <sizeof (struct mlx5dr_match_param ); i++) {if (((u8 *)&mask)[i] !=0 ) { -mlx5dr_info (dmn,"Mask contains unsupported parameters\n" ); +mlx5dr_err (dmn,"Mask contains unsupported parameters\n" );return -EOPNOTSUPP ; } }
@@ -563,7 +563,7 @@ static int dr_matcher_set_all_ste_builders(struct mlx5dr_matcher *matcher,dr_matcher_set_ste_builders (matcher, nic_matcher,DR_RULE_IPV6 ,DR_RULE_IPV6 );if (!nic_matcher->ste_builder) { -mlx5dr_dbg (dmn,"Cannot generate IPv4 or IPv6 rules with given mask\n" ); +mlx5dr_err (dmn,"Cannot generate IPv4 or IPv6 rules with given mask\n" );return -EINVAL ; }
@@ -634,13 +634,13 @@ static int dr_matcher_init(struct mlx5dr_matcher *matcher,int ret;if (matcher->match_criteria >=DR_MATCHER_CRITERIA_MAX ) { -mlx5dr_info (dmn,"Invalid match criteria attribute\n" ); +mlx5dr_err (dmn,"Invalid match criteria attribute\n" );return -EINVAL ; }if (mask) {if (mask->match_sz >sizeof (struct mlx5dr_match_param )) { -mlx5dr_info (dmn,"Invalid match size attribute\n" ); +mlx5dr_err (dmn,"Invalid match size attribute\n" );return -EINVAL ; } mlx5dr_ste_copy_param(matcher->match_criteria,
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_rule.c +9 -9
@@ -826,8 +826,8 @@ dr_rule_handle_ste_branch(struct mlx5dr_rule *rule, ste_location, send_ste_list);if (!new_htbl) {mlx5dr_htbl_put (cur_htbl); -mlx5dr_info (dmn,"failed creating rehash table, htbl-log_size: %d\n" , - cur_htbl->chunk_size); +mlx5dr_err (dmn,"Failed creating rehash table, htbl-log_size: %d\n" , + cur_htbl->chunk_size); }else { cur_htbl = new_htbl; }
@@ -877,7 +877,7 @@ static bool dr_rule_verify(struct mlx5dr_matcher *matcher,if (!value_size || (value_size >sizeof (struct mlx5dr_match_param ) || (value_size %sizeof (u32)))) { -mlx5dr_dbg (matcher->tbl->dmn,"Rule parameters length is incorrect\n" ); +mlx5dr_err (matcher->tbl->dmn,"Rule parameters length is incorrect\n" );return false; }
@@ -888,7 +888,7 @@ static bool dr_rule_verify(struct mlx5dr_matcher *matcher, e_idx =min (s_idx +sizeof (param->outer), value_size);if (!dr_rule_cmp_value_to_mask (mask_p, param_p, s_idx, e_idx)) { -mlx5dr_dbg (matcher->tbl->dmn,"Rule outer parameters contains a value not specified by mask\n" ); +mlx5dr_err (matcher->tbl->dmn,"Rule outer parameters contains a value not specified by mask\n" );return false; } }
@@ -898,7 +898,7 @@ static bool dr_rule_verify(struct mlx5dr_matcher *matcher, e_idx =min (s_idx +sizeof (param->misc), value_size);if (!dr_rule_cmp_value_to_mask (mask_p, param_p, s_idx, e_idx)) { -mlx5dr_dbg (matcher->tbl->dmn,"Rule misc parameters contains a value not specified by mask\n" ); +mlx5dr_err (matcher->tbl->dmn,"Rule misc parameters contains a value not specified by mask\n" );return false; } }
@@ -908,7 +908,7 @@ static bool dr_rule_verify(struct mlx5dr_matcher *matcher, e_idx =min (s_idx +sizeof (param->inner), value_size);if (!dr_rule_cmp_value_to_mask (mask_p, param_p, s_idx, e_idx)) { -mlx5dr_dbg (matcher->tbl->dmn,"Rule inner parameters contains a value not specified by mask\n" ); +mlx5dr_err (matcher->tbl->dmn,"Rule inner parameters contains a value not specified by mask\n" );return false; } }
@@ -918,7 +918,7 @@ static bool dr_rule_verify(struct mlx5dr_matcher *matcher, e_idx =min (s_idx +sizeof (param->misc2), value_size);if (!dr_rule_cmp_value_to_mask (mask_p, param_p, s_idx, e_idx)) { -mlx5dr_dbg (matcher->tbl->dmn,"Rule misc2 parameters contains a value not specified by mask\n" ); +mlx5dr_err (matcher->tbl->dmn,"Rule misc2 parameters contains a value not specified by mask\n" );return false; } }
@@ -928,7 +928,7 @@ static bool dr_rule_verify(struct mlx5dr_matcher *matcher, e_idx =min (s_idx +sizeof (param->misc3), value_size);if (!dr_rule_cmp_value_to_mask (mask_p, param_p, s_idx, e_idx)) { -mlx5dr_dbg (matcher->tbl->dmn,"Rule misc3 parameters contains a value not specified by mask\n" ); +mlx5dr_err (matcher->tbl->dmn,"Rule misc3 parameters contains a value not specified by mask\n" );return false; } }
@@ -1221,7 +1221,7 @@ dr_rule_create_rule(struct mlx5dr_matcher *matcher,dr_rule_remove_action_members (rule); free_rule:kfree (rule); -mlx5dr_info (dmn,"Failed creating rule\n" ); +mlx5dr_err (dmn,"Failed creating rule\n" );return NULL ; }
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c +12 -4
@@ -136,7 +136,7 @@ static struct mlx5dr_qp *dr_create_rc_qp(struct mlx5_core_dev *mdev, err =mlx5_wq_qp_create (mdev, &wqp, temp_qpc, &dr_qp->wq, &dr_qp->wq_ctrl);if (err) { -mlx5_core_info (mdev,"Can't create QP WQ\n" ); +mlx5_core_warn (mdev,"Can't create QP WQ\n" ); goto err_wq; }
@@ -651,8 +651,10 @@ static int dr_prepare_qp_to_rts(struct mlx5dr_domain *dmn)/* Init */ ret =dr_modify_qp_rst2init (dmn->mdev, dr_qp, port); -if (ret) +if (ret) { +mlx5dr_err (dmn,"Failed modify QP rst2init\n" );return ret; + }/* RTR */ ret =mlx5dr_cmd_query_gid (dmn->mdev, port, gid_index, &rtr_attr.dgid_attr);
@@ -667,8 +669,10 @@ static int dr_prepare_qp_to_rts(struct mlx5dr_domain *dmn) rtr_attr.udp_src_port = dmn->info.caps.roce_min_src_udp; ret =dr_cmd_modify_qp_init2rtr (dmn->mdev, dr_qp, &rtr_attr); -if (ret) +if (ret) { +mlx5dr_err (dmn,"Failed modify QP init2rtr\n" );return ret; + }/* RTS */ rts_attr.timeout =14 ;
@@ -676,8 +680,10 @@ static int dr_prepare_qp_to_rts(struct mlx5dr_domain *dmn) rts_attr.rnr_retry =7 ; ret =dr_cmd_modify_qp_rtr2rts (dmn->mdev, dr_qp, &rts_attr); -if (ret) +if (ret) { +mlx5dr_err (dmn,"Failed modify QP rtr2rts\n" );return ret; + }return 0 ; }
@@ -861,6 +867,7 @@ int mlx5dr_send_ring_alloc(struct mlx5dr_domain *dmn) cq_size =QUEUE_SIZE +1 ; dmn->send_ring->cq =dr_create_cq (dmn->mdev, dmn->uar, cq_size);if (!dmn->send_ring->cq) { +mlx5dr_err (dmn,"Failed creating CQ\n" ); ret = -ENOMEM ; goto free_send_ring; }
@@ -872,6 +879,7 @@ int mlx5dr_send_ring_alloc(struct mlx5dr_domain *dmn) dmn->send_ring->qp =dr_create_rc_qp (dmn->mdev, &init_attr);if (!dmn->send_ring->qp) { +mlx5dr_err (dmn,"Failed creating QP\n" ); ret = -ENOMEM ; goto clean_cq; }
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.c +1 -1
@@ -728,7 +728,7 @@ int mlx5dr_ste_build_pre_check(struct mlx5dr_domain *dmn, {if (!value && (match_criteria &DR_MATCHER_CRITERIA_MISC )) {if (mask->misc.source_port && mask->misc.source_port !=0xffff ) { -mlx5dr_dbg (dmn,"Partial mask source_port is not supported\n" ); +mlx5dr_err (dmn,"Partial mask source_port is not supported\n" );return -EINVAL ; } }
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_table.c +6 -2
@@ -128,16 +128,20 @@ static int dr_table_init_nic(struct mlx5dr_domain *dmn,DR_CHUNK_SIZE_1 ,MLX5DR_STE_LU_TYPE_DONT_CARE , 0); -if (!nic_tbl->s_anchor) +if (!nic_tbl->s_anchor) { +mlx5dr_err (dmn,"Failed allocating htbl\n" );return -ENOMEM ; + } info.type =CONNECT_MISS ; info.miss_icm_addr = nic_dmn->default_icm_addr; ret =mlx5dr_ste_htbl_init_and_postsend (dmn, nic_dmn, nic_tbl->s_anchor, &info, true); -if (ret) +if (ret) { +mlx5dr_err (dmn,"Failed int and send htbl\n" ); goto free_s_anchor; + }mlx5dr_htbl_get (nic_tbl->s_anchor);
Signature · 1 line
2.24.1
PATCH 11/16 net/mlx5e: Use netdev_warn() for errors for added prefix
In reply to Saeed MahameedFrom: Roi Dayan <[email protected]>
This helps identify the source of the message. If netdev still doesn't exists use mlx5_core_warn().
--- .../net/ethernet/mellanox/mlx5/core/en_rep.c | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +16 -11
@@ -192,7 +192,8 @@ static MLX5E_DECLARE_STATS_GRP_OP_UPDATE_STATS(vport_rep) err =mlx5_eswitch_get_vport_stats (esw, rep->vport, &vf_stats);if (err) { -pr_warn ("vport %d error %d reading stats\n" , rep->vport, err); +netdev_warn (priv->netdev,"vport %d error %d reading stats\n" , + rep->vport, err);return ; }
@@ -2032,8 +2033,9 @@ mlx5e_vport_rep_load(struct mlx5_core_dev *dev, struct mlx5_eswitch_rep *rep) &mlx5e_uplink_rep_profile : &mlx5e_rep_profile; netdev =mlx5e_create_netdev (dev, profile, nch, rpriv);if (!netdev) { -pr_warn ("Failed to create representor netdev for vport %d\n" , - rep->vport); +mlx5_core_warn (dev, +"Failed to create representor netdev for vport %d\n" , + rep->vport);kfree (rpriv);return -EINVAL ; }
@@ -2051,29 +2053,32 @@ mlx5e_vport_rep_load(struct mlx5_core_dev *dev, struct mlx5_eswitch_rep *rep) err =mlx5e_attach_netdev (netdev_priv (netdev));if (err) { -pr_warn ("Failed to attach representor netdev for vport %d\n" , - rep->vport); +netdev_warn (netdev, +"Failed to attach representor netdev for vport %d\n" , + rep->vport); goto err_destroy_mdev_resources; } err =mlx5e_rep_neigh_init (rpriv);if (err) { -pr_warn ("Failed to initialized neighbours handling for vport %d\n" , - rep->vport); +netdev_warn (netdev, +"Failed to initialized neighbours handling for vport %d\n" , + rep->vport); goto err_detach_netdev; } err =register_devlink_port (dev, rpriv);if (err) { -esw_warn (dev,"Failed to register devlink port %d\n" , - rep->vport); +netdev_warn (netdev,"Failed to register devlink port %d\n" , + rep->vport); goto err_neigh_cleanup; } err =register_netdev (netdev);if (err) { -pr_warn ("Failed to register representor netdev for vport %d\n" , - rep->vport); +netdev_warn (netdev, +"Failed to register representor netdev for vport %d\n" , + rep->vport); goto err_devlink_cleanup; }
Signature · 1 line
2.24.1
PATCH 12/16 net/mlx5e: Use netdev_warn() instead of pr_err() for errors
In reply to Saeed MahameedFrom: Roi Dayan <[email protected]>
This is for added netdev prefix that helps identify the source of the message.
--- drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +11 -6
@@ -3381,8 +3381,9 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv,if (attr->out_count >=MLX5_MAX_FLOW_FWD_VPORTS ) {NL_SET_ERR_MSG_MOD (extack,"can't support more output ports, can't offload forwarding" ); -pr_err ("can't support more than %d output ports, can't offload forwarding\n" , - attr->out_count); +netdev_warn (priv->netdev, +"can't support more than %d output ports, can't offload forwarding\n" , + attr->out_count);return -EOPNOTSUPP ; }
@@ -3460,8 +3461,10 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv,if (!mlx5e_is_valid_eswitch_fwd_dev (priv, out_dev)) {NL_SET_ERR_MSG_MOD (extack,"devices are not on same switch HW, can't offload forwarding" ); -pr_err ("devices %s %s not on same switch HW, can't offload forwarding\n" , - priv->netdev->name, out_dev->name); +netdev_warn (priv->netdev, +"devices %s %s not on same switch HW, can't offload forwarding\n" , + priv->netdev->name, + out_dev->name);return -EOPNOTSUPP ; }
@@ -3480,8 +3483,10 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, }else {NL_SET_ERR_MSG_MOD (extack,"devices are not on same switch HW, can't offload forwarding" ); -pr_err ("devices %s %s not on same switch HW, can't offload forwarding\n" , - priv->netdev->name, out_dev->name); +netdev_warn (priv->netdev, +"devices %s %s not on same switch HW, can't offload forwarding\n" , + priv->netdev->name, + out_dev->name);return -EINVAL ; } }
Signature · 1 line
2.24.1
PATCH 13/16 net/mlx5e: Use NL_SET_ERR_MSG_MOD() extack for errors
In reply to Saeed MahameedFrom: Roi Dayan <[email protected]>
This to be consistent and adds the module name to the error message.
--- .../net/ethernet/mellanox/mlx5/core/en_tc.c | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +14 -7
@@ -1173,7 +1173,8 @@ mlx5e_tc_add_fdb_flow(struct mlx5e_priv *priv,int out_index;if (!mlx5_esw_chains_prios_supported (esw) && attr->prio !=1 ) { -NL_SET_ERR_MSG (extack,"E-switch priorities unsupported, upgrade FW" ); +NL_SET_ERR_MSG_MOD (extack, +"E-switch priorities unsupported, upgrade FW" );return -EOPNOTSUPP ; }
@@ -1184,13 +1185,15 @@ mlx5e_tc_add_fdb_flow(struct mlx5e_priv *priv,*/ max_chain =mlx5_esw_chains_get_chain_range (esw);if (!mlx5e_is_ft_flow (flow) && attr->chain > max_chain) { -NL_SET_ERR_MSG (extack,"Requested chain is out of supported range" ); +NL_SET_ERR_MSG_MOD (extack, +"Requested chain is out of supported range" );return -EOPNOTSUPP ; } max_prio =mlx5_esw_chains_get_prio_range (esw);if (attr->prio > max_prio) { -NL_SET_ERR_MSG (extack,"Requested priority is out of supported range" ); +NL_SET_ERR_MSG_MOD (extack, +"Requested priority is out of supported range" );return -EOPNOTSUPP ; }
@@ -3540,11 +3543,13 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, }if (!mlx5_esw_chains_backwards_supported (esw) && dest_chain <= attr->chain) { -NL_SET_ERR_MSG (extack,"Goto earlier chain isn't supported" ); +NL_SET_ERR_MSG_MOD (extack, +"Goto earlier chain isn't supported" );return -EOPNOTSUPP ; }if (dest_chain > max_chain) { -NL_SET_ERR_MSG (extack,"Requested destination chain is out of supported range" ); +NL_SET_ERR_MSG_MOD (extack, +"Requested destination chain is out of supported range" );return -EOPNOTSUPP ; } action |=MLX5_FLOW_CONTEXT_ACTION_COUNT ;
@@ -3594,7 +3599,8 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv,if (attr->dest_chain) {if (attr->action &MLX5_FLOW_CONTEXT_ACTION_FWD_DEST ) { -NL_SET_ERR_MSG (extack,"Mirroring goto chain rules isn't supported" ); +NL_SET_ERR_MSG_MOD (extack, +"Mirroring goto chain rules isn't supported" );return -EOPNOTSUPP ; } attr->action |=MLX5_FLOW_CONTEXT_ACTION_FWD_DEST ;
@@ -3602,7 +3608,8 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv,if (!(attr->action & (MLX5_FLOW_CONTEXT_ACTION_FWD_DEST |MLX5_FLOW_CONTEXT_ACTION_DROP ))) { -NL_SET_ERR_MSG (extack,"Rule must have at least one forward/drop action" ); +NL_SET_ERR_MSG_MOD (extack, +"Rule must have at least one forward/drop action" );return -EOPNOTSUPP ; }
Signature · 1 line
2.24.1
PATCH 14/16 net/mlx5e: Remove unused argument from parse_tc_pedit_action()
In reply to Saeed MahameedFrom: Eli Cohen <[email protected]>
parse_attr is not used by parse_tc_pedit_action() so revmove it.
--- drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +3 -5
@@ -2563,7 +2563,6 @@ static const struct pedit_headers zero_masks = {};static int parse_tc_pedit_action (struct mlx5e_priv *priv,const struct flow_action_entry *act,int namespace, -struct mlx5e_tc_flow_parse_attr *parse_attr,struct pedit_headers_action *hdrs,struct netlink_ext_ack *extack) {
@@ -2839,8 +2838,7 @@ static int add_vlan_rewrite_action(struct mlx5e_priv *priv, int namespace,return -EOPNOTSUPP ; } - err =parse_tc_pedit_action (priv, &pedit_act, namespace, parse_attr, - hdrs,NULL ); + err =parse_tc_pedit_action (priv, &pedit_act, namespace, hdrs,NULL ); *action |=MLX5_FLOW_CONTEXT_ACTION_MOD_HDR ;return err;
@@ -2902,7 +2900,7 @@ static int parse_tc_nic_actions(struct mlx5e_priv *priv,case FLOW_ACTION_MANGLE :case FLOW_ACTION_ADD : err =parse_tc_pedit_action (priv, act,MLX5_FLOW_NAMESPACE_KERNEL , - parse_attr, hdrs, extack); + hdrs, extack);if (err)return err;
@@ -3346,7 +3344,7 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv,case FLOW_ACTION_MANGLE :case FLOW_ACTION_ADD : err =parse_tc_pedit_action (priv, act,MLX5_FLOW_NAMESPACE_FDB , - parse_attr, hdrs, extack); + hdrs, extack);if (err)return err;
Signature · 1 line
2.24.1
PATCH 15/16 net/mlx5e: Reduce number of arguments in slow path handling
In reply to Saeed MahameedFrom: Eli Cohen <[email protected]>
mlx5e_tc_offload_to_slow_path() and mlx5e_tc_unoffload_from_slow_path() take an extra argument allocated on the stack of the caller but not used by the caller. Avoid the extra argument and use local variable in the function itself.
--- .../net/ethernet/mellanox/mlx5/core/en_tc.c | 43 +++++++++---------- 1 file changed, 20 insertions(+), 23 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +20 -23
@@ -1076,17 +1076,17 @@ mlx5e_tc_unoffload_fdb_rules(struct mlx5_eswitch *esw,static struct mlx5_flow_handle *mlx5e_tc_offload_to_slow_path (struct mlx5_eswitch *esw,struct mlx5e_tc_flow *flow, -struct mlx5_flow_spec *spec, -struct mlx5_esw_flow_attr *slow_attr) +struct mlx5_flow_spec *spec) { +struct mlx5_esw_flow_attr slow_attr;struct mlx5_flow_handle *rule; -memcpy (slow_attr, flow->esw_attr,sizeof (*slow_attr)); - slow_attr->action =MLX5_FLOW_CONTEXT_ACTION_FWD_DEST ; - slow_attr->split_count =0 ; - slow_attr->flags |=MLX5_ESW_ATTR_FLAG_SLOW_PATH ; +memcpy (&slow_attr, flow->esw_attr,sizeof (slow_attr)); + slow_attr.action =MLX5_FLOW_CONTEXT_ACTION_FWD_DEST ; + slow_attr.split_count =0 ; + slow_attr.flags |=MLX5_ESW_ATTR_FLAG_SLOW_PATH ; - rule =mlx5e_tc_offload_fdb_rules (esw, flow, spec, slow_attr); + rule =mlx5e_tc_offload_fdb_rules (esw, flow, spec, &slow_attr);if (!IS_ERR (rule))flow_flag_set (flow,SLOW );
@@ -1095,14 +1095,15 @@ mlx5e_tc_offload_to_slow_path(struct mlx5_eswitch *esw,static void mlx5e_tc_unoffload_from_slow_path (struct mlx5_eswitch *esw, -struct mlx5e_tc_flow *flow, -struct mlx5_esw_flow_attr *slow_attr) +struct mlx5e_tc_flow *flow) { -memcpy (slow_attr, flow->esw_attr,sizeof (*slow_attr)); - slow_attr->action =MLX5_FLOW_CONTEXT_ACTION_FWD_DEST ; - slow_attr->split_count =0 ; - slow_attr->flags |=MLX5_ESW_ATTR_FLAG_SLOW_PATH ; -mlx5e_tc_unoffload_fdb_rules (esw, flow, slow_attr); +struct mlx5_esw_flow_attr slow_attr; + +memcpy (&slow_attr, flow->esw_attr,sizeof (slow_attr)); + slow_attr.action =MLX5_FLOW_CONTEXT_ACTION_FWD_DEST ; + slow_attr.split_count =0 ; + slow_attr.flags |=MLX5_ESW_ATTR_FLAG_SLOW_PATH ; +mlx5e_tc_unoffload_fdb_rules (esw, flow, &slow_attr);flow_flag_clear (flow,SLOW ); }
@@ -1242,9 +1243,7 @@ mlx5e_tc_add_fdb_flow(struct mlx5e_priv *priv,*/ if (!encap_valid) {/* continue with goto slow path rule instead */ -struct mlx5_esw_flow_attr slow_attr; - - flow->rule[0 ] =mlx5e_tc_offload_to_slow_path (esw, flow, &parse_attr->spec, &slow_attr); + flow->rule[0 ] =mlx5e_tc_offload_to_slow_path (esw, flow, &parse_attr->spec); }else { flow->rule[0 ] =mlx5e_tc_offload_fdb_rules (esw, flow, &parse_attr->spec, attr); }
@@ -1275,7 +1274,6 @@ static void mlx5e_tc_del_fdb_flow(struct mlx5e_priv *priv, {struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;struct mlx5_esw_flow_attr *attr = flow->esw_attr; -struct mlx5_esw_flow_attr slow_attr;int out_index;if (flow_flag_test (flow,NOT_READY )) {
@@ -1286,7 +1284,7 @@ static void mlx5e_tc_del_fdb_flow(struct mlx5e_priv *priv,if (mlx5e_is_offloaded_flow (flow)) {if (flow_flag_test (flow,SLOW )) -mlx5e_tc_unoffload_from_slow_path (esw, flow, &slow_attr); +mlx5e_tc_unoffload_from_slow_path (esw, flow);else mlx5e_tc_unoffload_fdb_rules (esw, flow, attr); }
@@ -1315,7 +1313,7 @@ void mlx5e_tc_encap_flows_add(struct mlx5e_priv *priv, struct list_head *flow_list) {struct mlx5_eswitch *esw = priv->mdev->priv.eswitch; -struct mlx5_esw_flow_attr slow_attr, *esw_attr; +struct mlx5_esw_flow_attr *esw_attr;struct mlx5_flow_handle *rule;struct mlx5_flow_spec *spec;struct mlx5e_tc_flow *flow;
@@ -1368,7 +1366,7 @@ void mlx5e_tc_encap_flows_add(struct mlx5e_priv *priv,continue ; } -mlx5e_tc_unoffload_from_slow_path (esw, flow, &slow_attr); +mlx5e_tc_unoffload_from_slow_path (esw, flow); flow->rule[0 ] = rule;/* was unset when slow path rule removed */ flow_flag_set (flow,OFFLOADED );
@@ -1380,7 +1378,6 @@ void mlx5e_tc_encap_flows_del(struct mlx5e_priv *priv, struct list_head *flow_list) {struct mlx5_eswitch *esw = priv->mdev->priv.eswitch; -struct mlx5_esw_flow_attr slow_attr;struct mlx5_flow_handle *rule;struct mlx5_flow_spec *spec;struct mlx5e_tc_flow *flow;
@@ -1392,7 +1389,7 @@ void mlx5e_tc_encap_flows_del(struct mlx5e_priv *priv, spec = &flow->esw_attr->parse_attr->spec;/* update from encap rule to slow path rule */ - rule =mlx5e_tc_offload_to_slow_path (esw, flow, spec, &slow_attr); + rule =mlx5e_tc_offload_to_slow_path (esw, flow, spec);/* mark the flow's encap dest as non-valid */ flow->esw_attr->dests[flow->tmp_efi_index].flags &= ~MLX5_ESW_DEST_ENCAP_VALID ;
Signature · 1 line
2.24.1
PATCH 16/16 net/mlx5e: Remove redundant comment about goto slow path
In reply to Saeed MahameedFrom: Roi Dayan <[email protected]>
The code is self explanatory and makes the comment redundant.
--- drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +2 -4
@@ -1241,12 +1241,10 @@ mlx5e_tc_add_fdb_flow(struct mlx5e_priv *priv,* (1) there's no error * (2) there's an encap action and we don't have valid neigh */ -if (!encap_valid) { -/* continue with goto slow path rule instead */ +if (!encap_valid) flow->rule[0 ] =mlx5e_tc_offload_to_slow_path (esw, flow, &parse_attr->spec); - }else { +else flow->rule[0 ] =mlx5e_tc_offload_fdb_rules (esw, flow, &parse_attr->spec, attr); - }if (IS_ERR (flow->rule[0 ]))return PTR_ERR (flow->rule[0 ]);
Signature · 1 line
2.24.1
David Miller
maintainerFrom: Saeed Mahameed <[email protected]>
Date: Thu, 27 Feb 2020 16:44:30 -0800
Quoted 4 lines
This series includes mlx5 misc updates and cleanups. For more information please see tag log below.
Please pull and let me know if there is any problem.
Pulled, thanks Saeed.