Mellanox, mlx5 updates 2020-01-24
Subsystems (9)
Hi Dave,
This series adds some updates to mlx5 driver
1) Devlink health dump support for both rx and tx health reporters.
2) FEC modes supports.
3) two misc small patches.
V4:
- Resend after net-next is open and rebased
- Added Reviewed-by: Andrew Lunn, to the ethtool patch
V3:
- Improve ethtool patch "FEC LLRS" commit message as requested by Andrew Lunn.
- Since we've missed the last cycle, dropped two small fixes patches, as they should go to net now.
V2:
- Remove "\n" from snprintf, happened due to rebase with a conflicting feature, Thanks Joe for spotting this.
For more information please see tag log below.
Please pull and let me know if there is any problem.
Note about non-mlx5 change:
For the FEC link modes support, Aya added the define for low latency Reed Solomon FEC as LLRS, in: include/uapi/linux/ethtool.h
Thanks,
Saeed.
---
The following changes since commit 00796b929ce8c9e7567fe7e395763418eb579100:
sfc: elide assignment of skb (2020-02-18 12:40:49 -0800)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux.git tags/mlx5-updates-2020-01-24
for you to fetch changes up to 0120936a9fc7493fed63588204af427dcf00feea:
net/mlx5: Remove a useless 'drain_workqueue()' call in 'mlx5e_ipsec_cleanup()' (2020-02-18 19:17:31 -0800)
----------------------------------------------------------------
mlx5-updates-2020-01-24
This series adds two moderate updates and some misc small patches to mlx5 driver.
1) From Aya, Add the missing devlink health dump callbacks support for both rx and tx health reporters.
First patch of the series is extending devlink API to set binary fmsg data.
All others patches in the series are adding the mlx5 devlink health callbacks support and the needed FW commands.
2) Also from Aya, Support for FEC modes based on 50G per lane links. Part of this series, Aya adds one missing link mode define "FEC_LLRS" to include/uapi/linux/ethtool.h.
3) From Joe, Use proper logging and tracing line terminations
4) From Christophe, Remove a useless 'drain_workqueue()'
----------------------------------------------------------------
Aya Levin (11):
devlink: Force enclosing array on binary fmsg data net/mlx5: Add support for resource dump
net/mlx5e: Gather reporters APIs together
net/mlx5e: Support dump callback in TX reporter net/mlx5e: Support dump callback in RX reporter net/mlx5e: Set FEC to auto when configured mode is not supported net/mlx5e: Enforce setting of a single FEC mode net/mlx5e: Advertise globaly supported FEC modes net/mlxe5: Separate between FEC and current speed
ethtool: Add support for low latency RS FEC net/mlx5e: Add support for FEC modes based on 50G per lane links
Christophe JAILLET (1):
net/mlx5: Remove a useless 'drain_workqueue()' call in 'mlx5e_ipsec_cleanup()'
Joe Perches (1):
mlx5: Use proper logging and tracing line terminations
drivers/net/ethernet/mellanox/mlx5/core/Makefile | 2 +- .../ethernet/mellanox/mlx5/core/diag/rsc_dump.c | 286 +++++++++++++++++++++ .../ethernet/mellanox/mlx5/core/diag/rsc_dump.h | 58 +++++ .../net/ethernet/mellanox/mlx5/core/en/health.c | 107 +++++++- .../net/ethernet/mellanox/mlx5/core/en/health.h | 8 +- drivers/net/ethernet/mellanox/mlx5/core/en/port.c | 253 ++++++++++-------- drivers/net/ethernet/mellanox/mlx5/core/en/port.h | 8 +- .../ethernet/mellanox/mlx5/core/en/reporter_rx.c | 266 ++++++++++++++++--- .../ethernet/mellanox/mlx5/core/en/reporter_tx.c | 181 ++++++++++--- .../ethernet/mellanox/mlx5/core/en_accel/ipsec.c | 1 - .../net/ethernet/mellanox/mlx5/core/en_ethtool.c | 71 ++--- drivers/net/ethernet/mellanox/mlx5/core/main.c | 12 + drivers/net/phy/phy-core.c | 2 +- include/linux/mlx5/driver.h | 1 + include/net/devlink.h | 5 + include/uapi/linux/ethtool.h | 4 +- net/core/devlink.c | 94 ++++++- net/ethtool/common.c | 1 + net/ethtool/linkmodes.c | 1 + 19 files changed, 1136 insertions(+), 225 deletions(-) create mode 100644 drivers/net/ethernet/mellanox/mlx5/core/diag/rsc_dump.c create mode 100644 drivers/net/ethernet/mellanox/mlx5/core/diag/rsc_dump.h
PATCH v4 1/13 devlink: Force enclosing array on binary fmsg data
From: Aya Levin <[email protected]>
Add a new API for start/end binary array brackets [] to force array around binary data as required from JSON. With this restriction, re-open API to set binary fmsg data.
--- include/net/devlink.h | 5 +++ net/core/devlink.c | 94 +++++++++++++++++++++++++++++++++++++++---- 2 files changed, 91 insertions(+), 8 deletions(-)
include/net/devlink.h +5 -0
@@ -981,12 +981,17 @@ int devlink_fmsg_pair_nest_end(struct devlink_fmsg *fmsg);int devlink_fmsg_arr_pair_nest_start (struct devlink_fmsg *fmsg,const char *name);int devlink_fmsg_arr_pair_nest_end (struct devlink_fmsg *fmsg); +int devlink_fmsg_binary_pair_nest_start (struct devlink_fmsg *fmsg, +const char *name); +int devlink_fmsg_binary_pair_nest_end (struct devlink_fmsg *fmsg);int devlink_fmsg_bool_put (struct devlink_fmsg *fmsg,bool value);int devlink_fmsg_u8_put (struct devlink_fmsg *fmsg,u8 value);int devlink_fmsg_u32_put (struct devlink_fmsg *fmsg,u32 value);int devlink_fmsg_u64_put (struct devlink_fmsg *fmsg,u64 value);int devlink_fmsg_string_put (struct devlink_fmsg *fmsg,const char *value); +int devlink_fmsg_binary_put (struct devlink_fmsg *fmsg,const void *value, +u16 value_len);int devlink_fmsg_bool_pair_put (struct devlink_fmsg *fmsg,const char *name,bool value);
net/core/devlink.c +86 -8
209 lines not on this page · raw message
Signature · 1 line
2.24.1
PATCH v4 2/13 net/mlx5: Add support for resource dump
In reply to Saeed MahameedFrom: Aya Levin <[email protected]>
On driver load:
- Initialize resource dump data structure and memory access tools (mkey & pd).
- Read the resource dump's menu which contains the FW segment identifier. Each record is identified by the segment name (ASCII).
During the driver's course of life, users (like reporters) may request dumps per segment. The user should create a command providing the segment identifier (SW enumeration) and command keys. In return, the user receives a command context. In order to receive the dump, the user should supply the command context and a memory (aligned to a PAGE) on which the dump content will be written. Since the dump may be larger than the given memory, the user may resubmit the command until received an indication of end-of-dump. It is the user's responsibility to destroy the command.
--- .../net/ethernet/mellanox/mlx5/core/Makefile | 2 +- .../mellanox/mlx5/core/diag/rsc_dump.c | 286 ++++++++++++++++++ .../mellanox/mlx5/core/diag/rsc_dump.h | 58 ++++ .../net/ethernet/mellanox/mlx5/core/main.c | 12 + include/linux/mlx5/driver.h | 1 + 5 files changed, 358 insertions(+), 1 deletion(-) create mode 100644 drivers/net/ethernet/mellanox/mlx5/core/diag/rsc_dump.c create mode 100644 drivers/net/ethernet/mellanox/mlx5/core/diag/rsc_dump.h
drivers/net/ethernet/mellanox/mlx5/core/Makefile +1 -1
@@ -16,7 +16,7 @@ mlx5_core-y := main.o cmd.o debugfs.o fw.o eq.o uar.o pagealloc.o \ transobj.o vport.o sriov.o fs_cmd.o fs_core.o pci_irq.o \ fs_counters.o rl.o lag.o dev.o events.o wq.o lib/gid.o \ lib/devcom.o lib/pci_vsc.o lib/dm.o diag/fs_tracepoint.o \ - diag/fw_tracer.o diag/crdump.o devlink.o + diag/fw_tracer.o diag/crdump.o devlink.o diag/rsc_dump.o # # Netdev basic
drivers/net/ethernet/mellanox/mlx5/core/diag/rsc_dump.c new file +286 -0
286 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/diag/rsc_dump.h new file +58 -0
58 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/main.c +12 -0
@@ -70,6 +70,7 @@#include "diag/fw_tracer.h" #include "ecpf.h" #include "lib/hv_vhca.h" +#include "diag/rsc_dump.h" MODULE_AUTHOR ("Eli Cohen <[email protected]>" );MODULE_DESCRIPTION ("Mellanox 5th generation network adapters (ConnectX series) core driver" );
@@ -880,6 +881,7 @@ static int mlx5_init_once(struct mlx5_core_dev *dev) dev->tracer =mlx5_fw_tracer_create (dev); dev->hv_vhca =mlx5_hv_vhca_create (dev); + dev->rsc_dump =mlx5_rsc_dump_create (dev);return 0 ;
@@ -909,6 +911,7 @@ static int mlx5_init_once(struct mlx5_core_dev *dev)static void mlx5_cleanup_once (struct mlx5_core_dev *dev) { +mlx5_rsc_dump_destroy (dev);mlx5_hv_vhca_destroy (dev->hv_vhca);mlx5_fw_tracer_destroy (dev->tracer);mlx5_dm_cleanup (dev);
@@ -1079,6 +1082,12 @@ static int mlx5_load(struct mlx5_core_dev *dev)mlx5_hv_vhca_init (dev->hv_vhca); + err =mlx5_rsc_dump_init (dev); +if (err) { +mlx5_core_err (dev,"Failed to init Resource dump\n" ); + goto err_rsc_dump; + } + err =mlx5_fpga_device_start (dev);if (err) {mlx5_core_err (dev,"fpga device start failed %d\n" , err);
@@ -1134,6 +1143,8 @@ static int mlx5_load(struct mlx5_core_dev *dev) err_ipsec_start:mlx5_fpga_device_stop (dev); err_fpga_start: +mlx5_rsc_dump_cleanup (dev); +err_rsc_dump:mlx5_hv_vhca_cleanup (dev->hv_vhca);mlx5_fw_tracer_cleanup (dev->tracer); err_fw_tracer:
@@ -1155,6 +1166,7 @@ static void mlx5_unload(struct mlx5_core_dev *dev)mlx5_accel_ipsec_cleanup (dev);mlx5_accel_tls_cleanup (dev);mlx5_fpga_device_stop (dev); +mlx5_rsc_dump_cleanup (dev);mlx5_hv_vhca_cleanup (dev->hv_vhca);mlx5_fw_tracer_cleanup (dev->tracer);mlx5_eq_table_destroy (dev);
include/linux/mlx5/driver.h +1 -0
@@ -722,6 +722,7 @@ struct mlx5_core_dev {struct mlx5_clock clock;struct mlx5_ib_clock_info *clock_info;struct mlx5_fw_tracer *tracer; +struct mlx5_rsc_dump *rsc_dump;u32 vsc_addr;struct mlx5_hv_vhca *hv_vhca; };
Signature · 1 line
2.24.1
PATCH v4 3/13 net/mlx5e: Gather reporters APIs together
In reply to Saeed MahameedFrom: Aya Levin <[email protected]>
Assemble all the API's to ease insertion of dump callbacks in the following patches in the set.
--- .../mellanox/mlx5/core/en/reporter_rx.c | 82 +++++++++---------- .../mellanox/mlx5/core/en/reporter_tx.c | 58 ++++++------- 2 files changed, 70 insertions(+), 70 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en/reporter_rx.c +41 -41
@@ -102,19 +102,6 @@ static int mlx5e_rx_reporter_err_icosq_cqe_recover(void *ctx)return err; } -void mlx5e_reporter_icosq_cqe_err (struct mlx5e_icosq *icosq) -{ -struct mlx5e_priv *priv = icosq->channel->priv; -char err_str[MLX5E_REPORTER_PER_Q_MAX_LEN ]; -struct mlx5e_err_ctx err_ctx = {}; - - err_ctx.ctx = icosq; - err_ctx.recover = mlx5e_rx_reporter_err_icosq_cqe_recover; -sprintf (err_str,"ERR CQE on ICOSQ: 0x%x" , icosq->sqn); - -mlx5e_health_report (priv, priv->rx_reporter, err_str, &err_ctx); -} -static int mlx5e_rq_to_ready (struct mlx5e_rq *rq,int curr_state) {struct net_device *dev = rq->netdev;
@@ -171,19 +158,6 @@ static int mlx5e_rx_reporter_err_rq_cqe_recover(void *ctx)return err; } -void mlx5e_reporter_rq_cqe_err (struct mlx5e_rq *rq) -{ -struct mlx5e_priv *priv = rq->channel->priv; -char err_str[MLX5E_REPORTER_PER_Q_MAX_LEN ]; -struct mlx5e_err_ctx err_ctx = {}; - - err_ctx.ctx = rq; - err_ctx.recover = mlx5e_rx_reporter_err_rq_cqe_recover; -sprintf (err_str,"ERR CQE on RQ: 0x%x" , rq->rqn); - -mlx5e_health_report (priv, priv->rx_reporter, err_str, &err_ctx); -} -static int mlx5e_rx_reporter_timeout_recover (void *ctx) {struct mlx5e_icosq *icosq;
@@ -201,21 +175,6 @@ static int mlx5e_rx_reporter_timeout_recover(void *ctx)return err; } -void mlx5e_reporter_rx_timeout (struct mlx5e_rq *rq) -{ -struct mlx5e_icosq *icosq = &rq->channel->icosq; -struct mlx5e_priv *priv = rq->channel->priv; -char err_str[MLX5E_REPORTER_PER_Q_MAX_LEN ]; -struct mlx5e_err_ctx err_ctx = {}; - - err_ctx.ctx = rq; - err_ctx.recover = mlx5e_rx_reporter_timeout_recover; -sprintf (err_str,"RX timeout on channel: %d, ICOSQ: 0x%x RQ: 0x%x, CQ: 0x%x\n" , - icosq->channel->ix, icosq->sqn, rq->rqn, rq->cq.mcq.cqn); - -mlx5e_health_report (priv, priv->rx_reporter, err_str, &err_ctx); -} -static int mlx5e_rx_reporter_recover_from_ctx (struct mlx5e_err_ctx *err_ctx) {return err_ctx->recover (err_ctx->ctx);
@@ -371,6 +330,47 @@ static int mlx5e_rx_reporter_diagnose(struct devlink_health_reporter *reporter,return err; } +void mlx5e_reporter_rx_timeout (struct mlx5e_rq *rq) +{ +struct mlx5e_icosq *icosq = &rq->channel->icosq; +struct mlx5e_priv *priv = rq->channel->priv; +char err_str[MLX5E_REPORTER_PER_Q_MAX_LEN ]; +struct mlx5e_err_ctx err_ctx = {}; + + err_ctx.ctx = rq; + err_ctx.recover = mlx5e_rx_reporter_timeout_recover; +sprintf (err_str,"RX timeout on channel: %d, ICOSQ: 0x%x RQ: 0x%x, CQ: 0x%x\n" , + icosq->channel->ix, icosq->sqn, rq->rqn, rq->cq.mcq.cqn); + +mlx5e_health_report (priv, priv->rx_reporter, err_str, &err_ctx); +} + +void mlx5e_reporter_rq_cqe_err (struct mlx5e_rq *rq) +{ +struct mlx5e_priv *priv = rq->channel->priv; +char err_str[MLX5E_REPORTER_PER_Q_MAX_LEN ]; +struct mlx5e_err_ctx err_ctx = {}; + + err_ctx.ctx = rq; + err_ctx.recover = mlx5e_rx_reporter_err_rq_cqe_recover; +sprintf (err_str,"ERR CQE on RQ: 0x%x" , rq->rqn); + +mlx5e_health_report (priv, priv->rx_reporter, err_str, &err_ctx); +} + +void mlx5e_reporter_icosq_cqe_err (struct mlx5e_icosq *icosq) +{ +struct mlx5e_priv *priv = icosq->channel->priv; +char err_str[MLX5E_REPORTER_PER_Q_MAX_LEN ]; +struct mlx5e_err_ctx err_ctx = {}; + + err_ctx.ctx = icosq; + err_ctx.recover = mlx5e_rx_reporter_err_icosq_cqe_recover; +sprintf (err_str,"ERR CQE on ICOSQ: 0x%x" , icosq->sqn); + +mlx5e_health_report (priv, priv->rx_reporter, err_str, &err_ctx); +} +static const struct devlink_health_reporter_ops mlx5_rx_reporter_ops = { .name ="rx" , .recover = mlx5e_rx_reporter_recover,
drivers/net/ethernet/mellanox/mlx5/core/en/reporter_tx.c +29 -29
76 lines not on this page · raw message
Signature · 1 line
2.24.1
PATCH v4 4/13 net/mlx5e: Support dump callback in TX reporter
In reply to Saeed MahameedFrom: Aya Levin <[email protected]>
Add support for SQ's FW dump on TX reporter's events. Use Resource dump API to retrieve the relevant data: SX slice, SQ dump and SQ buffer. Wrap it in formatted messages and store the binary output in devlink core.
Example:
$ devlink health dump show pci/0000:00:0b.0 reporter tx
SX Slice:
data:
00 00 00 00 00 00 00 80 00 01 00 00 00 00 ad de
22 01 00 00 00 00 ad de 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ff ff ff ff 01 00 00 00 00 00 00 00 00 00 00 00
00 02 01 00 00 00 00 80 00 01 00 00 00 00 ad de
22 01 00 00 00 00 ad de 00 20 40 90 81 88 ff ff
00 00 00 00 00 00 00 00 15 00 15 00 00 00 00 00
ff ff ff ff 01 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 80 81 ae 41 06 00 ea ff ff
SQs:
SQ:
index: 1511
data:
00 00 00 00 00 00 00 80 00 01 00 00 00 00 ad de
22 01 00 00 00 00 ad de 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ff ff ff ff 01 00 00 00 00 00 00 00 00 00 00 00
00 02 01 00 00 00 00 80 00 01 00 00 00 00 ad de
22 01 00 00 00 00 ad de 00 20 40 90 81 88 ff ff
00 00 00 00 00 00 00 00 15 00 15 00 00 00 00 00
ff ff ff ff 01 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 80 81 ae 41 06 00 ea ff ff
SQ:
index: 1516
data:
00 00 00 00 00 00 00 80 00 01 00 00 00 00 ad de
22 01 00 00 00 00 ad de 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ff ff ff ff 01 00 00 00 00 00 00 00 00 00 00 00
00 02 01 00 00 00 00 80 00 01 00 00 00 00 ad de
22 01 00 00 00 00 ad de 00 20 40 90 81 88 ff ff
00 00 00 00 00 00 00 00 15 00 15 00 00 00 00 00
ff ff ff ff 01 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 80 81 ae 41 06 00 ea ff ff$ devlink health dump show pci/0000:00:0b.0 reporter tx -jp
{
"SX Slice": {
"data": [ 0,0,0,0,0,0,0,128,0,1,0,0,0,0,173,222,34,1,0,0,0,0,173,222,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,1,0,0,0,0,0,0,0,0,0,0,0,0,2,1,0,0,0,0,128,0,1,0,0,0,0,173,222,34,1,0,0,0,0,173,222,0,32,64,144,129,136,255,255,0,0,0,0,0,0,0,0,21,0,21,0,0,0,0,0,255,255,255,255,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,129,174,65,6,0,234,255,255],
},
"SQs": [ {
"SQ": {
"index": 1511,
"data": [ 0,0,0,0,0,0,0,128,0,1,0,0,0,0,173,222,34,1,0,0,0,0,173,222,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,1,0,0,0,0,0,0,0,0,0,0,0,0,2,1,0,0,0,0,128,0,1,0,0,0,0,173,222,34,1,0,0,0,0,173,222,0,32,64,144,129,136,255,255,0,0,0,0,0,0,0,0,21,0,21,0,0,0,0,0,255,255,255,255,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,129,174,65,6,0,234,255,255]
}
},{
"SQ": {
"index": 1516,
"data": [ 0,0,0,0,0,0,0,128,0,1,0,0,0,0,173,222,34,1,0,0,0,0,173,222,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,1,0,0,0,0,0,0,0,0,0,0,0,0,2,1,0,0,0,0,128,0,1,0,0,0,0,173,222,34,1,0,0,0,0,173,222,0,32,64,144,129,136,255,255,0,0,0,0,0,0,0,0,21,0,21,0,0,0,0,0,255,255,255,255,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,129,174,65,6,0,234,255,255]
}
} ]
}--- .../ethernet/mellanox/mlx5/core/en/health.c | 105 +++++++++++++++ .../ethernet/mellanox/mlx5/core/en/health.h | 8 +- .../mellanox/mlx5/core/en/reporter_tx.c | 123 ++++++++++++++++++ 3 files changed, 234 insertions(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en/health.c +105 -0
@@ -3,6 +3,7 @@#include "health.h" #include "lib/eq.h" +#include "lib/mlx5.h" int mlx5e_reporter_named_obj_nest_start (struct devlink_fmsg *fmsg,char *name) {
@@ -204,3 +205,107 @@ int mlx5e_health_report(struct mlx5e_priv *priv,return devlink_health_report (reporter, err_str, err_ctx); } + +#define MLX5_HEALTH_DEVLINK_MAX_SIZE 1024 +static int mlx5e_health_rsc_fmsg_binary (struct devlink_fmsg *fmsg, +const void *value,u32 value_len) + +{ +u32 data_size; +u32 offset; +int err; + +for (offset =0 ; offset < value_len; offset += data_size) { + data_size = value_len - offset; +if (data_size >MLX5_HEALTH_DEVLINK_MAX_SIZE ) + data_size =MLX5_HEALTH_DEVLINK_MAX_SIZE ; + err =devlink_fmsg_binary_put (fmsg, value + offset, data_size); +if (err) +break ; + } +return err; +} + +int mlx5e_health_rsc_fmsg_dump (struct mlx5e_priv *priv,struct mlx5_rsc_key *key, +struct devlink_fmsg *fmsg) +{ +struct mlx5_core_dev *mdev = priv->mdev; +struct mlx5_rsc_dump_cmd *cmd; +struct page *page; +int cmd_err, err; +int end_err; +int size; + +if (IS_ERR_OR_NULL (mdev->rsc_dump)) +return -EOPNOTSUPP ; + + page =alloc_page (GFP_KERNEL ); +if (!page) +return -ENOMEM ; + + err =devlink_fmsg_binary_pair_nest_start (fmsg,"data" ); +if (err) +return err; + + cmd =mlx5_rsc_dump_cmd_create (mdev, key); +if (IS_ERR (cmd)) { + err =PTR_ERR (cmd); + goto free_page; + } + +do { + cmd_err =mlx5_rsc_dump_next (mdev, cmd, page, &size); +if (cmd_err <0 ) { + err = cmd_err; + goto destroy_cmd; + } + + err =mlx5e_health_rsc_fmsg_binary (fmsg,page_address (page), size); +if (err) + goto destroy_cmd; + + }while (cmd_err >0 ); + +destroy_cmd: +mlx5_rsc_dump_cmd_destroy (cmd); + end_err =devlink_fmsg_binary_pair_nest_end (fmsg); +if (end_err) + err = end_err; +free_page: +__free_page (page); +return err; +} + +int mlx5e_health_queue_dump (struct mlx5e_priv *priv,struct devlink_fmsg *fmsg, +int queue_idx,char *lbl) +{ +struct mlx5_rsc_key key = {}; +int err; + + key.rsc =MLX5_SGMT_TYPE_FULL_QPC ; + key.index1 = queue_idx; + key.size =PAGE_SIZE ; + key.num_of_obj1 =1 ; + + err =devlink_fmsg_obj_nest_start (fmsg); +if (err) +return err; + + err =mlx5e_reporter_named_obj_nest_start (fmsg, lbl); +if (err) +return err; + + err =devlink_fmsg_u32_pair_put (fmsg,"index" , queue_idx); +if (err) +return err; + + err =mlx5e_health_rsc_fmsg_dump (priv, &key, fmsg); +if (err) +return err; + + err =mlx5e_reporter_named_obj_nest_end (fmsg); +if (err) +return err; + +return devlink_fmsg_obj_nest_end (fmsg); +}
drivers/net/ethernet/mellanox/mlx5/core/en/health.h +6 -2
@@ -5,6 +5,7 @@#define __MLX5E_EN_HEALTH_H#include "en.h" +#include "diag/rsc_dump.h" #define MLX5E_RX_ERR_CQE (cqe) (get_cqe_opcode(cqe) != MLX5_CQE_RESP_SEND)
@@ -36,6 +37,7 @@ void mlx5e_reporter_rx_timeout(struct mlx5e_rq *rq);struct mlx5e_err_ctx {int (*recover)(void *ctx); +int (*dump)(struct mlx5e_priv *priv,struct devlink_fmsg *fmsg,void *ctx);void *ctx; };
@@ -48,6 +50,8 @@ int mlx5e_health_report(struct mlx5e_priv *priv,int mlx5e_health_create_reporters (struct mlx5e_priv *priv);void mlx5e_health_destroy_reporters (struct mlx5e_priv *priv);void mlx5e_health_channels_update (struct mlx5e_priv *priv); - - +int mlx5e_health_rsc_fmsg_dump (struct mlx5e_priv *priv,struct mlx5_rsc_key *key, +struct devlink_fmsg *fmsg); +int mlx5e_health_queue_dump (struct mlx5e_priv *priv,struct devlink_fmsg *fmsg, +int queue_idx,char *lbl);#endif
drivers/net/ethernet/mellanox/mlx5/core/en/reporter_tx.c +123 -0
147 lines not on this page · raw message
Signature · 1 line
2.24.1
PATCH v4 5/13 net/mlx5e: Support dump callback in RX reporter
In reply to Saeed MahameedFrom: Aya Levin <[email protected]>
Add support for SQ's FW dump on RX reporter's events. Use Resource dump API to retrieve the relevant data: RX slice, RQ dump, RX buffer and ICOSQ dump (depends on the error). Wrap it in formatted messages and store the binary output in devlink core.
Example:
$ devlink health dump show pci/0000:00:0b.0 reporter rx
RX Slice:
data:
00 00 00 00 00 00 00 80 00 01 00 00 00 00 ad de
22 01 00 00 00 00 ad de 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ff ff ff ff 01 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 80 00 01 00 00 00 00 ad de
22 01 00 00 00 00 ad de 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ff ff ff ff 01 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 80 00 01 00 00 00 00 ad de
RQs:
RQ:
rqn: 1512
data:
00 00 00 00 00 00 00 80 00 01 00 00 00 00 ad de
22 01 00 00 00 00 ad de 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ff ff ff ff 01 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 80 00 01 00 00 00 00 ad de
22 01 00 00 00 00 ad de 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ff ff ff ff 01 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 80 00 01 00 00 00 00 ad de
RQ:
rqn: 1517
data:
00 00 00 00 00 00 00 80 00 01 00 00 00 00 ad de
22 01 00 00 00 00 ad de 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ff ff ff ff 01 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 80 00 01 00 00 00 00 ad de
22 01 00 00 00 00 ad de 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ff ff ff ff 01 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 80 00 01 00 00 00 00 ad de$ devlink health dump show pci/0000:00:0b.0 reporter rx -jp
{
"RX Slice": {
"data":[ 0,0,0,0,0,0,0,128,0,1,0,0,0,0,173,222,34,1,0,0,0,0,173,222,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,0,1,0,0,0,0,173,222,34,1,0,0,0,0,173,222,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,0,1,0,0,0,0,173,222,34,1,0,0,0,0,173,222,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,0,1,0,0,0,0,173,222,34,1,0,0,0,0,173,222,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,0,1,0,0,0,0,173,222,34,1,0,0,0,0,173,222,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,1,0,0,0,0,0,0,0,0,0,0,0,0,2,1,0,0,0,0,128,0,1,0,0,0,0,173,222]
},
"RQs": [ {
"RQ": {
"index": 1512,
"data": [ 0,0,0,0,0,0,0,128,0,1,0,0,0,0,173,222,34,1,0,0,0,0,173,222,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,0,1,0,0,0,0,173,222,34,1,0,0,0,0,173,222,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,0,1,0,0,0,0,173,222,34,1,0,0,0,0,173,222,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,0,1,0,0,0,0,173,222,34,1,0,0,0,0,173,222,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,0,1,0,0,0,0,173,222,34,1,0,0,0,0,173,222,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,1,0,0,0,0,0,0,0,0,0,0,0,0,2,1,0,0,0,0,128,0,1,0,0,0,0,173,222]
}
},{
"RQ": {
"index": 1517,
"data": [ 0,0,0,0,0,0,0,128,0,1,0,0,0,0,173,222,34,1,0,0,0,0,173,222,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,0,1,0,0,0,0,173,222,34,1,0,0,0,0,173,222,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,0,1,0,0,0,0,173,222,34,1,0,0,0,0,173,222,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,0,1,0,0,0,0,173,222,34,1,0,0,0,0,173,222,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,0,1,0,0,0,0,173,222,34,1,0,0,0,0,173,222,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,1,0,0,0,0,0,0,0,0,0,0,0,0,2,1,0,0,0,0,128,0,1,0,0,0,0,173]
}
} ]
}--- .../mellanox/mlx5/core/en/reporter_rx.c | 183 ++++++++++++++++++ 1 file changed, 183 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/en/reporter_rx.c +183 -0
@@ -330,6 +330,185 @@ static int mlx5e_rx_reporter_diagnose(struct devlink_health_reporter *reporter,return err; } +static int mlx5e_rx_reporter_dump_icosq (struct mlx5e_priv *priv,struct devlink_fmsg *fmsg, +void *ctx) +{ +struct mlx5e_txqsq *icosq = ctx; +struct mlx5_rsc_key key = {}; +int err; + +if (!test_bit (MLX5E_STATE_OPENED , &priv->state)) +return 0 ; + + err =mlx5e_reporter_named_obj_nest_start (fmsg,"SX Slice" ); +if (err) +return err; + + key.size =PAGE_SIZE ; + key.rsc =MLX5_SGMT_TYPE_SX_SLICE_ALL ; + err =mlx5e_health_rsc_fmsg_dump (priv, &key, fmsg); +if (err) +return err; + + err =mlx5e_reporter_named_obj_nest_end (fmsg); +if (err) +return err; + + err =mlx5e_reporter_named_obj_nest_start (fmsg,"ICOSQ" ); +if (err) +return err; + + err =mlx5e_reporter_named_obj_nest_start (fmsg,"QPC" ); +if (err) +return err; + + key.rsc =MLX5_SGMT_TYPE_FULL_QPC ; + key.index1 = icosq->sqn; + key.num_of_obj1 =1 ; + + err =mlx5e_health_rsc_fmsg_dump (priv, &key, fmsg); +if (err) +return err; + + err =mlx5e_reporter_named_obj_nest_end (fmsg); +if (err) +return err; + + err =mlx5e_reporter_named_obj_nest_start (fmsg,"send_buff" ); +if (err) +return err; + + key.rsc =MLX5_SGMT_TYPE_SND_BUFF ; + key.num_of_obj2 =MLX5_RSC_DUMP_ALL ; + + err =mlx5e_health_rsc_fmsg_dump (priv, &key, fmsg); +if (err) +return err; + + err =mlx5e_reporter_named_obj_nest_end (fmsg); +if (err) +return err; + +return mlx5e_reporter_named_obj_nest_end (fmsg); +} + +static int mlx5e_rx_reporter_dump_rq (struct mlx5e_priv *priv,struct devlink_fmsg *fmsg, +void *ctx) +{ +struct mlx5_rsc_key key = {}; +struct mlx5e_rq *rq = ctx; +int err; + +if (!test_bit (MLX5E_STATE_OPENED , &priv->state)) +return 0 ; + + err =mlx5e_reporter_named_obj_nest_start (fmsg,"RX Slice" ); +if (err) +return err; + + key.size =PAGE_SIZE ; + key.rsc =MLX5_SGMT_TYPE_RX_SLICE_ALL ; + err =mlx5e_health_rsc_fmsg_dump (priv, &key, fmsg); +if (err) +return err; + + err =mlx5e_reporter_named_obj_nest_end (fmsg); +if (err) +return err; + + err =mlx5e_reporter_named_obj_nest_start (fmsg,"RQ" ); +if (err) +return err; + + err =mlx5e_reporter_named_obj_nest_start (fmsg,"QPC" ); +if (err) +return err; + + key.rsc =MLX5_SGMT_TYPE_FULL_QPC ; + key.index1 = rq->rqn; + key.num_of_obj1 =1 ; + + err =mlx5e_health_rsc_fmsg_dump (priv, &key, fmsg); +if (err) +return err; + + err =mlx5e_reporter_named_obj_nest_end (fmsg); +if (err) +return err; + + err =mlx5e_reporter_named_obj_nest_start (fmsg,"receive_buff" ); +if (err) +return err; + + key.rsc =MLX5_SGMT_TYPE_RCV_BUFF ; + key.num_of_obj2 =MLX5_RSC_DUMP_ALL ; + err =mlx5e_health_rsc_fmsg_dump (priv, &key, fmsg); +if (err) +return err; + + err =mlx5e_reporter_named_obj_nest_end (fmsg); +if (err) +return err; + +return mlx5e_reporter_named_obj_nest_end (fmsg); +} + +static int mlx5e_rx_reporter_dump_all_rqs (struct mlx5e_priv *priv, +struct devlink_fmsg *fmsg) +{ +struct mlx5_rsc_key key = {}; +int i, err; + +if (!test_bit (MLX5E_STATE_OPENED , &priv->state)) +return 0 ; + + err =mlx5e_reporter_named_obj_nest_start (fmsg,"RX Slice" ); +if (err) +return err; + + key.size =PAGE_SIZE ; + key.rsc =MLX5_SGMT_TYPE_RX_SLICE_ALL ; + err =mlx5e_health_rsc_fmsg_dump (priv, &key, fmsg); +if (err) +return err; + + err =mlx5e_reporter_named_obj_nest_end (fmsg); +if (err) +return err; + + err =devlink_fmsg_arr_pair_nest_start (fmsg,"RQs" ); +if (err) +return err; + +for (i =0 ; i < priv->channels.num; i++) { +struct mlx5e_rq *rq = &priv->channels.c[i]->rq; + + err =mlx5e_health_queue_dump (priv, fmsg, rq->rqn,"RQ" ); +if (err) +return err; + } + +return devlink_fmsg_arr_pair_nest_end (fmsg); +} + +static int mlx5e_rx_reporter_dump_from_ctx (struct mlx5e_priv *priv, +struct mlx5e_err_ctx *err_ctx, +struct devlink_fmsg *fmsg) +{ +return err_ctx->dump (priv, fmsg, err_ctx->ctx); +} + +static int mlx5e_rx_reporter_dump (struct devlink_health_reporter *reporter, +struct devlink_fmsg *fmsg,void *context, +struct netlink_ext_ack *extack) +{ +struct mlx5e_priv *priv =devlink_health_reporter_priv (reporter); +struct mlx5e_err_ctx *err_ctx = context; + +return err_ctx ?mlx5e_rx_reporter_dump_from_ctx (priv, err_ctx, fmsg) : +mlx5e_rx_reporter_dump_all_rqs (priv, fmsg); +} +void mlx5e_reporter_rx_timeout (struct mlx5e_rq *rq) {struct mlx5e_icosq *icosq = &rq->channel->icosq;
@@ -339,6 +518,7 @@ void mlx5e_reporter_rx_timeout(struct mlx5e_rq *rq) err_ctx.ctx = rq; err_ctx.recover = mlx5e_rx_reporter_timeout_recover; + err_ctx.dump = mlx5e_rx_reporter_dump_rq;sprintf (err_str,"RX timeout on channel: %d, ICOSQ: 0x%x RQ: 0x%x, CQ: 0x%x\n" , icosq->channel->ix, icosq->sqn, rq->rqn, rq->cq.mcq.cqn);
@@ -353,6 +533,7 @@ void mlx5e_reporter_rq_cqe_err(struct mlx5e_rq *rq) err_ctx.ctx = rq; err_ctx.recover = mlx5e_rx_reporter_err_rq_cqe_recover; + err_ctx.dump = mlx5e_rx_reporter_dump_rq;sprintf (err_str,"ERR CQE on RQ: 0x%x" , rq->rqn);mlx5e_health_report (priv, priv->rx_reporter, err_str, &err_ctx);
@@ -366,6 +547,7 @@ void mlx5e_reporter_icosq_cqe_err(struct mlx5e_icosq *icosq) err_ctx.ctx = icosq; err_ctx.recover = mlx5e_rx_reporter_err_icosq_cqe_recover; + err_ctx.dump = mlx5e_rx_reporter_dump_icosq;sprintf (err_str,"ERR CQE on ICOSQ: 0x%x" , icosq->sqn);mlx5e_health_report (priv, priv->rx_reporter, err_str, &err_ctx);
@@ -375,6 +557,7 @@ static const struct devlink_health_reporter_ops mlx5_rx_reporter_ops = { .name = "rx", .recover = mlx5e_rx_reporter_recover, .diagnose = mlx5e_rx_reporter_diagnose, + .dump = mlx5e_rx_reporter_dump, };#define MLX5E_REPORTER_RX_GRACEFUL_PERIOD 500
Signature · 1 line
2.24.1
PATCH v4 6/13 mlx5: Use proper logging and tracing line terminations
In reply to Saeed MahameedFrom: Joe Perches <[email protected]>
netdev_err should use newline termination but mlx5_health_report is used in a trace output function devlink_health_report where no newline should be used.
Remove the newlines from a couple formats and add a format string of "%s\n" to the netdev_err call to not directly output the logging string.
Also use snprintf to avoid any possible output string overrun.
--- drivers/net/ethernet/mellanox/mlx5/core/en/health.c | 2 +- .../net/ethernet/mellanox/mlx5/core/en/reporter_rx.c | 9 +++++---- .../net/ethernet/mellanox/mlx5/core/en/reporter_tx.c | 10 +++++----- 3 files changed, 11 insertions(+), 10 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en/health.c +1 -1
@@ -198,7 +198,7 @@ int mlx5e_health_report(struct mlx5e_priv *priv, struct devlink_health_reporter *reporter, char *err_str, struct mlx5e_err_ctx *err_ctx) { - netdev_err(priv->netdev, err_str); + netdev_err(priv->netdev, "%s\n", err_str);if (!reporter)return err_ctx->recover (&err_ctx->ctx);
drivers/net/ethernet/mellanox/mlx5/core/en/reporter_rx.c +5 -4
@@ -519,8 +519,9 @@ void mlx5e_reporter_rx_timeout(struct mlx5e_rq *rq) err_ctx.ctx = rq; err_ctx.recover = mlx5e_rx_reporter_timeout_recover; err_ctx.dump = mlx5e_rx_reporter_dump_rq; -sprintf (err_str,"RX timeout on channel: %d, ICOSQ: 0x%x RQ: 0x%x, CQ: 0x%x\n" , - icosq->channel->ix, icosq->sqn, rq->rqn, rq->cq.mcq.cqn); +snprintf (err_str,sizeof (err_str), +"RX timeout on channel: %d, ICOSQ: 0x%x RQ: 0x%x, CQ: 0x%x" , + icosq->channel->ix, icosq->sqn, rq->rqn, rq->cq.mcq.cqn);mlx5e_health_report (priv, priv->rx_reporter, err_str, &err_ctx); }
@@ -534,7 +535,7 @@ void mlx5e_reporter_rq_cqe_err(struct mlx5e_rq *rq) err_ctx.ctx = rq; err_ctx.recover = mlx5e_rx_reporter_err_rq_cqe_recover; err_ctx.dump = mlx5e_rx_reporter_dump_rq; -sprintf (err_str,"ERR CQE on RQ: 0x%x" , rq->rqn); +snprintf (err_str,sizeof (err_str),"ERR CQE on RQ: 0x%x" , rq->rqn);mlx5e_health_report (priv, priv->rx_reporter, err_str, &err_ctx); }
@@ -548,7 +549,7 @@ void mlx5e_reporter_icosq_cqe_err(struct mlx5e_icosq *icosq) err_ctx.ctx = icosq; err_ctx.recover = mlx5e_rx_reporter_err_icosq_cqe_recover; err_ctx.dump = mlx5e_rx_reporter_dump_icosq; -sprintf (err_str,"ERR CQE on ICOSQ: 0x%x" , icosq->sqn); +snprintf (err_str,sizeof (err_str),"ERR CQE on ICOSQ: 0x%x" , icosq->sqn);mlx5e_health_report (priv, priv->rx_reporter, err_str, &err_ctx); }
drivers/net/ethernet/mellanox/mlx5/core/en/reporter_tx.c +5 -5
@@ -375,7 +375,7 @@ void mlx5e_reporter_tx_err_cqe(struct mlx5e_txqsq *sq) err_ctx.ctx = sq; err_ctx.recover = mlx5e_tx_reporter_err_cqe_recover; err_ctx.dump = mlx5e_tx_reporter_dump_sq; -sprintf (err_str,"ERR CQE on SQ: 0x%x" , sq->sqn); +snprintf (err_str,sizeof (err_str),"ERR CQE on SQ: 0x%x" , sq->sqn);mlx5e_health_report (priv, priv->tx_reporter, err_str, &err_ctx); }
@@ -389,10 +389,10 @@ int mlx5e_reporter_tx_timeout(struct mlx5e_txqsq *sq) err_ctx.ctx = sq; err_ctx.recover = mlx5e_tx_reporter_timeout_recover; err_ctx.dump = mlx5e_tx_reporter_dump_sq; -sprintf (err_str, -"TX timeout on queue: %d, SQ: 0x%x, CQ: 0x%x, SQ Cons: 0x%x SQ Prod: 0x%x, usecs since last trans: %u\n" , - sq->channel->ix, sq->sqn, sq->cq.mcq.cqn, sq->cc, sq->pc, -jiffies_to_usecs (jiffies - sq->txq->trans_start)); +snprintf (err_str,sizeof (err_str), +"TX timeout on queue: %d, SQ: 0x%x, CQ: 0x%x, SQ Cons: 0x%x SQ Prod: 0x%x, usecs since last trans: %u" , + sq->channel->ix, sq->sqn, sq->cq.mcq.cqn, sq->cc, sq->pc, +jiffies_to_usecs (jiffies - sq->txq->trans_start));return mlx5e_health_report (priv, priv->tx_reporter, err_str, &err_ctx); }
Signature · 1 line
2.24.1
PATCH v4 7/13 net/mlx5e: Set FEC to auto when configured mode is not supported
In reply to Saeed MahameedFrom: Aya Levin <[email protected]>
When configuring FEC mode, driver tries to set it for all available link types. If a link type doesn't support a FEC mode, set this link type to auto (FW best effort). Prior to this patch, when a link type didn't support a FEC mode is was set to no FEC.
--- .../net/ethernet/mellanox/mlx5/core/en/port.c | 22 +++++-------------- 1 file changed, 6 insertions(+), 16 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en/port.c +6 -16
@@ -501,8 +501,6 @@ int mlx5e_get_fec_mode(struct mlx5_core_dev *dev, u32 *fec_mode_active,int mlx5e_set_fec_mode (struct mlx5_core_dev *dev,u8 fec_policy) { -u8 fec_policy_nofec =BIT (MLX5E_FEC_NOFEC ); -bool fec_mode_not_supp_in_speed = false;u32 out[MLX5_ST_SZ_DW (pplm_reg)] = {};u32 in[MLX5_ST_SZ_DW (pplm_reg)] = {};int sz =MLX5_ST_SZ_BYTES (pplm_reg);
@@ -526,23 +524,15 @@ int mlx5e_set_fec_mode(struct mlx5_core_dev *dev, u8 fec_policy)for (i =0 ; i <MLX5E_FEC_SUPPORTED_SPEEDS ; i++) {mlx5e_get_fec_cap_field (out, &fec_caps, fec_supported_speeds[i]); -/* policy supported for link speed, or policy is auto */ -if (fec_caps & fec_policy || fec_policy == fec_policy_auto) { +/* policy supported for link speed */ +if (fec_caps & fec_policy)mlx5e_fec_admin_field (out, &fec_policy,1 , fec_supported_speeds[i]); - }else { -/* turn off FEC if supported. Else, leave it the same */ -if (fec_caps & fec_policy_nofec) -mlx5e_fec_admin_field (out, &fec_policy_nofec,1 , - fec_supported_speeds[i]); - fec_mode_not_supp_in_speed = true; - } +else +/* set FEC to auto*/ +mlx5e_fec_admin_field (out, &fec_policy_auto,1 , + fec_supported_speeds[i]); } -if (fec_mode_not_supp_in_speed) -mlx5_core_dbg (dev, -"FEC policy 0x%x is not supported for some speeds" , - fec_policy); -return mlx5_core_access_reg (dev, out, sz, out, sz,MLX5_REG_PPLM ,0 ,1 ); }
Signature · 1 line
2.24.1
PATCH v4 8/13 net/mlx5e: Enforce setting of a single FEC mode
In reply to Saeed MahameedFrom: Aya Levin <[email protected]>
Ethtool command allow setting of several FEC modes in a single set command. The driver can only set a single FEC mode at a time. With this patch driver will reply not-supported on setting several FEC modes.
--- drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +4 -0
@@ -1541,6 +1541,10 @@ static int mlx5e_set_fecparam(struct net_device *netdev,int mode;int err; +if (bitmap_weight ((unsigned long *)&fecparam->fec, +ETHTOOL_FEC_BASER_BIT +1 ) >1 ) +return -EOPNOTSUPP ; +for (mode =0 ; mode <ARRAY_SIZE (pplm_fec_2_ethtool); mode++) {if (!(pplm_fec_2_ethtool[mode] & fecparam->fec))continue ;
Signature · 1 line
2.24.1
PATCH v4 9/13 net/mlx5e: Advertise globaly supported FEC modes
In reply to Saeed MahameedFrom: Aya Levin <[email protected]>
Ethtool advertise supported link modes on an interface. Per each FEC mode, query if there is a link type which supports it. If so, add this FEC mode to the supported FEC modes list. Prior to this patch, ethtool advertised only the supported FEC modes on the current link type. Add an explicit mapping between internal FEC modes and ethtool link mode bits. With this change, adding new FEC modes in the downstream patch would be easier.
--- .../net/ethernet/mellanox/mlx5/core/en/port.c | 17 +++--- .../net/ethernet/mellanox/mlx5/core/en/port.h | 2 +- .../ethernet/mellanox/mlx5/core/en_ethtool.c | 55 +++++++++---------- 3 files changed, 38 insertions(+), 36 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en/port.c +10 -7
@@ -441,13 +441,13 @@ static int mlx5e_get_fec_cap_field(u32 *pplm,return 0 ; } -int mlx5e_get_fec_caps (struct mlx5_core_dev *dev,u8 *fec_caps) +bool mlx5e_fec_in_caps (struct mlx5_core_dev *dev,int fec_policy) {u32 out[MLX5_ST_SZ_DW (pplm_reg)] = {};u32 in[MLX5_ST_SZ_DW (pplm_reg)] = {};int sz =MLX5_ST_SZ_BYTES (pplm_reg); -u32 current_fec_speed;int err; +int i;if (!MLX5_CAP_GEN (dev, pcam_reg))return -EOPNOTSUPP ;
@@ -458,13 +458,16 @@ int mlx5e_get_fec_caps(struct mlx5_core_dev *dev, u8 *fec_caps)MLX5_SET (pplm_reg, in, local_port,1 ); err =mlx5_core_access_reg (dev, in, sz, out, sz,MLX5_REG_PPLM ,0 ,0 );if (err) -return err; +return false; - err =mlx5e_port_linkspeed (dev, ¤t_fec_speed); -if (err) -return err; +for (i =0 ; i <MLX5E_FEC_SUPPORTED_SPEEDS ; i++) { +u8 fec_caps; -return mlx5e_get_fec_cap_field (out, fec_caps, current_fec_speed); +mlx5e_get_fec_cap_field (out, &fec_caps, fec_supported_speeds[i]); +if (fec_caps & fec_policy) +return true; + } +return false; } int mlx5e_get_fec_mode(struct mlx5_core_dev *dev, u32 *fec_mode_active,
drivers/net/ethernet/mellanox/mlx5/core/en/port.h +1 -1
@@ -60,7 +60,7 @@ int mlx5e_port_set_pbmc(struct mlx5_core_dev *mdev, void *in);int mlx5e_port_query_priority2buffer (struct mlx5_core_dev *mdev,u8 *buffer);int mlx5e_port_set_priority2buffer (struct mlx5_core_dev *mdev,u8 *buffer); -int mlx5e_get_fec_caps (struct mlx5_core_dev *dev,u8 *fec_caps); +bool mlx5e_fec_in_caps (struct mlx5_core_dev *dev,int fec_policy);int mlx5e_get_fec_mode (struct mlx5_core_dev *dev,u32 *fec_mode_active,u8 *fec_configured_mode);int mlx5e_set_fec_mode (struct mlx5_core_dev *dev,u8 fec_policy);
drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +27 -28
72 lines not on this page · raw message
Signature · 1 line
2.24.1
PATCH v4 10/13 net/mlxe5: Separate between FEC and current speed
In reply to Saeed MahameedFrom: Aya Levin <[email protected]>
FEC mode is per link type, not necessary per speed. This patch access FEC register by link modes instead of speeds. This patch will allow further enhacment of link modes supporting FEC with the same speed (different lane type).
--- .../net/ethernet/mellanox/mlx5/core/en/port.c | 146 ++++++++---------- 1 file changed, 62 insertions(+), 84 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en/port.c +62 -84
@@ -343,64 +343,45 @@ int mlx5e_port_set_priority2buffer(struct mlx5_core_dev *mdev, u8 *buffer)return err; } -static u32 fec_supported_speeds[] = { -10000 , -40000 , -25000 , -50000 , -56000 , -100000 +enum mlx5e_fec_supported_link_mode { +MLX5E_FEC_SUPPORTED_LINK_MODES_10G_40G , +MLX5E_FEC_SUPPORTED_LINK_MODES_25G , +MLX5E_FEC_SUPPORTED_LINK_MODES_50G , +MLX5E_FEC_SUPPORTED_LINK_MODES_56G , +MLX5E_FEC_SUPPORTED_LINK_MODES_100G , +MLX5E_MAX_FEC_SUPPORTED_LINK_MODE , }; -#define MLX5E_FEC_SUPPORTED_SPEEDS ARRAY_SIZE(fec_supported_speeds) +#define MLX5E_FEC_OVERRIDE_ADMIN_POLICY (buf, policy, write, link) \ + do { \ + u8 *_policy = &(policy); \ + u32 *_buf = buf; \ + \ + if (write) \ + MLX5_SET(pplm_reg, _buf, fec_override_admin_##link, *_policy); \ + else \ + *_policy = MLX5_GET(pplm_reg, _buf, fec_override_admin_##link); \ + } while (0)/* get/set FEC admin field for a given speed */ -static int mlx5e_fec_admin_field (u32 *pplm, -u8 *fec_policy, -bool write, -u32 speed) +static int mlx5e_fec_admin_field (u32 *pplm,u8 *fec_policy,bool write, +enum mlx5e_fec_supported_link_mode link_mode) { -switch (speed) { -case 10000 : -case 40000 : -if (!write) - *fec_policy =MLX5_GET (pplm_reg, pplm, - fec_override_admin_10g_40g); -else -MLX5_SET (pplm_reg, pplm, - fec_override_admin_10g_40g, *fec_policy); +switch (link_mode) { +case MLX5E_FEC_SUPPORTED_LINK_MODES_10G_40G : + MLX5E_FEC_OVERRIDE_ADMIN_POLICY(pplm, *fec_policy, write, 10g_40g);break ; -case 25000 : -if (!write) - *fec_policy =MLX5_GET (pplm_reg, pplm, - fec_override_admin_25g); -else -MLX5_SET (pplm_reg, pplm, - fec_override_admin_25g, *fec_policy); +case MLX5E_FEC_SUPPORTED_LINK_MODES_25G : + MLX5E_FEC_OVERRIDE_ADMIN_POLICY(pplm, *fec_policy, write, 25g);break ; -case 50000 : -if (!write) - *fec_policy =MLX5_GET (pplm_reg, pplm, - fec_override_admin_50g); -else -MLX5_SET (pplm_reg, pplm, - fec_override_admin_50g, *fec_policy); +case MLX5E_FEC_SUPPORTED_LINK_MODES_50G : + MLX5E_FEC_OVERRIDE_ADMIN_POLICY(pplm, *fec_policy, write, 50g);break ; -case 56000 : -if (!write) - *fec_policy =MLX5_GET (pplm_reg, pplm, - fec_override_admin_56g); -else -MLX5_SET (pplm_reg, pplm, - fec_override_admin_56g, *fec_policy); +case MLX5E_FEC_SUPPORTED_LINK_MODES_56G : + MLX5E_FEC_OVERRIDE_ADMIN_POLICY(pplm, *fec_policy, write, 56g);break ; -case 100000 : -if (!write) - *fec_policy =MLX5_GET (pplm_reg, pplm, - fec_override_admin_100g); -else -MLX5_SET (pplm_reg, pplm, - fec_override_admin_100g, *fec_policy); +case MLX5E_FEC_SUPPORTED_LINK_MODES_100G : + MLX5E_FEC_OVERRIDE_ADMIN_POLICY(pplm, *fec_policy, write, 100g);break ;default :return -EINVAL ;
@@ -408,32 +389,28 @@ static int mlx5e_fec_admin_field(u32 *pplm,return 0 ; } +#define MLX5E_GET_FEC_OVERRIDE_CAP (buf, link) \ + MLX5_GET(pplm_reg, buf, fec_override_cap_##link) +/* returns FEC capabilities for a given speed */ -static int mlx5e_get_fec_cap_field (u32 *pplm, -u8 *fec_cap, -u32 speed) +static int mlx5e_get_fec_cap_field (u32 *pplm,u8 *fec_cap, +enum mlx5e_fec_supported_link_mode link_mode) { -switch (speed) { -case 10000 : -case 40000 : - *fec_cap =MLX5_GET (pplm_reg, pplm, - fec_override_cap_10g_40g); +switch (link_mode) { +case MLX5E_FEC_SUPPORTED_LINK_MODES_10G_40G : + *fec_cap = MLX5E_GET_FEC_OVERRIDE_CAP(pplm, 10g_40g);break ; -case 25000 : - *fec_cap =MLX5_GET (pplm_reg, pplm, - fec_override_cap_25g); +case MLX5E_FEC_SUPPORTED_LINK_MODES_25G : + *fec_cap = MLX5E_GET_FEC_OVERRIDE_CAP(pplm, 25g);break ; -case 50000 : - *fec_cap =MLX5_GET (pplm_reg, pplm, - fec_override_cap_50g); +case MLX5E_FEC_SUPPORTED_LINK_MODES_50G : + *fec_cap = MLX5E_GET_FEC_OVERRIDE_CAP(pplm, 50g);break ; -case 56000 : - *fec_cap =MLX5_GET (pplm_reg, pplm, - fec_override_cap_56g); +case MLX5E_FEC_SUPPORTED_LINK_MODES_56G : + *fec_cap = MLX5E_GET_FEC_OVERRIDE_CAP(pplm, 56g);break ; -case 100000 : - *fec_cap =MLX5_GET (pplm_reg, pplm, - fec_override_cap_100g); +case MLX5E_FEC_SUPPORTED_LINK_MODES_100G : + *fec_cap = MLX5E_GET_FEC_OVERRIDE_CAP(pplm, 100g);break ;default :return -EINVAL ;
@@ -460,10 +437,10 @@ bool mlx5e_fec_in_caps(struct mlx5_core_dev *dev, int fec_policy)if (err)return false; -for (i =0 ; i <MLX5E_FEC_SUPPORTED_SPEEDS ; i++) { +for (i =0 ; i <MLX5E_MAX_FEC_SUPPORTED_LINK_MODE ; i++) {u8 fec_caps; -mlx5e_get_fec_cap_field (out, &fec_caps, fec_supported_speeds[i]); +mlx5e_get_fec_cap_field (out, &fec_caps, i);if (fec_caps & fec_policy)return true; }
@@ -476,8 +453,8 @@ int mlx5e_get_fec_mode(struct mlx5_core_dev *dev, u32 *fec_mode_active,u32 out[MLX5_ST_SZ_DW (pplm_reg)] = {};u32 in[MLX5_ST_SZ_DW (pplm_reg)] = {};int sz =MLX5_ST_SZ_BYTES (pplm_reg); -u32 link_speed;int err; +int i;if (!MLX5_CAP_GEN (dev, pcam_reg))return -EOPNOTSUPP ;
@@ -493,13 +470,16 @@ int mlx5e_get_fec_mode(struct mlx5_core_dev *dev, u32 *fec_mode_active, *fec_mode_active =MLX5_GET (pplm_reg, out, fec_mode_active);if (!fec_configured_mode) -return 0 ; - - err =mlx5e_port_linkspeed (dev, &link_speed); -if (err) -return err; + goto out; -return mlx5e_fec_admin_field (out, fec_configured_mode,0 , link_speed); + *fec_configured_mode =0 ; +for (i =0 ; i <MLX5E_MAX_FEC_SUPPORTED_LINK_MODE ; i++) { +mlx5e_fec_admin_field (out, fec_configured_mode,0 , i); +if (*fec_configured_mode !=0 ) + goto out; + } +out: +return 0 ; }int mlx5e_set_fec_mode (struct mlx5_core_dev *dev,u8 fec_policy)
@@ -525,16 +505,14 @@ int mlx5e_set_fec_mode(struct mlx5_core_dev *dev, u8 fec_policy)MLX5_SET (pplm_reg, out, local_port,1 ); -for (i =0 ; i <MLX5E_FEC_SUPPORTED_SPEEDS ; i++) { -mlx5e_get_fec_cap_field (out, &fec_caps, fec_supported_speeds[i]); +for (i =0 ; i <MLX5E_MAX_FEC_SUPPORTED_LINK_MODE ; i++) { +mlx5e_get_fec_cap_field (out, &fec_caps, i);/* policy supported for link speed */ if (fec_caps & fec_policy) -mlx5e_fec_admin_field (out, &fec_policy,1 , - fec_supported_speeds[i]); +mlx5e_fec_admin_field (out, &fec_policy,1 , i);else /* set FEC to auto*/ -mlx5e_fec_admin_field (out, &fec_policy_auto,1 , - fec_supported_speeds[i]); +mlx5e_fec_admin_field (out, &fec_policy_auto,1 , i); }return mlx5_core_access_reg (dev, out, sz, out, sz,MLX5_REG_PPLM ,0 ,1 );
Signature · 1 line
2.24.1
PATCH v4 11/13 ethtool: Add support for low latency RS FEC
In reply to Saeed MahameedFrom: Aya Levin <[email protected]>
Add support for low latency Reed Solomon FEC as LLRS.
The LL-FEC is defined by the 25G/50G ethernet consortium,
in the document titled "Low Latency Reed Solomon Forward Error Correction"
--- drivers/net/phy/phy-core.c | 2 +- include/uapi/linux/ethtool.h | 4 +++- net/ethtool/common.c | 1 + net/ethtool/linkmodes.c | 1 + 4 files changed, 6 insertions(+), 2 deletions(-)
drivers/net/phy/phy-core.c +1 -1
@@ -8,7 +8,7 @@const char *phy_speed_to_str (int speed) { -BUILD_BUG_ON_MSG (__ETHTOOL_LINK_MODE_MASK_NBITS !=74 , +BUILD_BUG_ON_MSG (__ETHTOOL_LINK_MODE_MASK_NBITS !=75 ,"Enum ethtool_link_mode_bit_indices and phylib are out of sync. " "If a speed or mode has been added please update phy_speed_to_str " "and the PHY settings array.\n" );
include/uapi/linux/ethtool.h +3 -1
@@ -1330,6 +1330,7 @@ enum ethtool_fec_config_bits {ETHTOOL_FEC_OFF_BIT ,ETHTOOL_FEC_RS_BIT ,ETHTOOL_FEC_BASER_BIT , + ETHTOOL_FEC_LLRS_BIT, };#define ETHTOOL_FEC_NONE (1 << ETHTOOL_FEC_NONE_BIT)
@@ -1337,6 +1338,7 @@ enum ethtool_fec_config_bits {#define ETHTOOL_FEC_OFF (1 << ETHTOOL_FEC_OFF_BIT)#define ETHTOOL_FEC_RS (1 << ETHTOOL_FEC_RS_BIT)#define ETHTOOL_FEC_BASER (1 << ETHTOOL_FEC_BASER_BIT) +#define ETHTOOL_FEC_LLRS (1 << ETHTOOL_FEC_LLRS_BIT)/* CMDs currently supported */ #define ETHTOOL_GSET 0x00000001/* DEPRECATED, Get settings.
@@ -1521,7 +1523,7 @@ enum ethtool_link_mode_bit_indices { ETHTOOL_LINK_MODE_400000baseLR8_ER8_FR8_Full_BIT =71 , ETHTOOL_LINK_MODE_400000baseDR8_Full_BIT =72 , ETHTOOL_LINK_MODE_400000baseCR8_Full_BIT =73 , - +ETHTOOL_LINK_MODE_FEC_LLRS_BIT =74 ,/* must be last entry */ __ETHTOOL_LINK_MODE_MASK_NBITS };
net/ethtool/common.c +1 -0
@@ -168,6 +168,7 @@ const char link_mode_names[][ETH_GSTRING_LEN] = {__DEFINE_LINK_MODE_NAME (400000 ,LR8_ER8_FR8 , Full),__DEFINE_LINK_MODE_NAME (400000 ,DR8 , Full),__DEFINE_LINK_MODE_NAME (400000 ,CR8 , Full), +__DEFINE_SPECIAL_MODE_NAME (FEC_LLRS ,"LLRS" ), };static_assert (ARRAY_SIZE (link_mode_names) == __ETHTOOL_LINK_MODE_MASK_NBITS);
net/ethtool/linkmodes.c +1 -0
@@ -237,6 +237,7 @@ static const struct link_mode_info link_mode_params[] = {__DEFINE_LINK_MODE_PARAMS (400000 ,LR8_ER8_FR8 , Full),__DEFINE_LINK_MODE_PARAMS (400000 ,DR8 , Full),__DEFINE_LINK_MODE_PARAMS (400000 ,CR8 , Full), + __DEFINE_SPECIAL_MODE_PARAMS(FEC_LLRS), }; static const struct nla_policy
Signature · 1 line
2.24.1
PATCH v4 12/13 net/mlx5e: Add support for FEC modes based on 50G per lane links
In reply to Saeed MahameedFrom: Aya Levin <[email protected]>
Introduce new FEC modes:
- RS-FEC-(544,514)
- LL_RS-FEC-(272,257+1)
Add support in ethtool for set and get callbacks for the new modes above. While RS-FEC-(544,514) is mapped to exsiting RS FEC mode, LL_RS-FEC-(272,257+1) is mapped to a new ethtool link mode: LL-RS.
Add support for FEC on 50G per lane link modes up to 400G. The new link modes uses a u16 fields instead of u8 fields for the legacy link modes.
--- .../net/ethernet/mellanox/mlx5/core/en/port.c | 90 ++++++++++++++++--- .../net/ethernet/mellanox/mlx5/core/en/port.h | 6 +- .../ethernet/mellanox/mlx5/core/en_ethtool.c | 14 ++- 3 files changed, 94 insertions(+), 16 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en/port.c +80 -10
@@ -349,12 +349,18 @@ enum mlx5e_fec_supported_link_mode {MLX5E_FEC_SUPPORTED_LINK_MODES_50G ,MLX5E_FEC_SUPPORTED_LINK_MODES_56G ,MLX5E_FEC_SUPPORTED_LINK_MODES_100G , +MLX5E_FEC_SUPPORTED_LINK_MODE_50G_1X , +MLX5E_FEC_SUPPORTED_LINK_MODE_100G_2X , +MLX5E_FEC_SUPPORTED_LINK_MODE_200G_4X , +MLX5E_FEC_SUPPORTED_LINK_MODE_400G_8X , MLX5E_MAX_FEC_SUPPORTED_LINK_MODE, }; +#define MLX5E_FEC_FIRST_50G_PER_LANE_MODE MLX5E_FEC_SUPPORTED_LINK_MODE_50G_1X +#define MLX5E_FEC_OVERRIDE_ADMIN_POLICY (buf, policy, write, link) \ do { \ - u8 *_policy = &(policy); \ + u16 *_policy = &(policy); \ u32 *_buf = buf; \ \ if (write) \
@@ -363,8 +369,21 @@ enum mlx5e_fec_supported_link_mode { *_policy = MLX5_GET(pplm_reg, _buf, fec_override_admin_##link); \ } while (0) +#define MLX5E_FEC_OVERRIDE_ADMIN_50G_POLICY (buf, policy, write, link) \ + do { \ + u16 *__policy = &(policy); \ + bool _write = (write); \ + \ + if (_write && *__policy) \ + *__policy = find_first_bit((u_long *)__policy, \ + sizeof(u16) * BITS_PER_BYTE);\ + MLX5E_FEC_OVERRIDE_ADMIN_POLICY(buf, *__policy, _write, link); \ + if (!_write && *__policy) \ + *__policy = 1 << *__policy; \ + } while (0) +/* get/set FEC admin field for a given speed */ -static int mlx5e_fec_admin_field(u32 *pplm, u8 *fec_policy, bool write, +static int mlx5e_fec_admin_field (u32 *pplm,u16 *fec_policy,bool write,enum mlx5e_fec_supported_link_mode link_mode) {switch (link_mode) {
@@ -383,6 +402,18 @@ static int mlx5e_fec_admin_field(u32 *pplm, u8 *fec_policy, bool write,case MLX5E_FEC_SUPPORTED_LINK_MODES_100G : MLX5E_FEC_OVERRIDE_ADMIN_POLICY(pplm, *fec_policy, write, 100g);break ; +case MLX5E_FEC_SUPPORTED_LINK_MODE_50G_1X : + MLX5E_FEC_OVERRIDE_ADMIN_50G_POLICY(pplm, *fec_policy, write, 50g_1x); +break ; +case MLX5E_FEC_SUPPORTED_LINK_MODE_100G_2X : + MLX5E_FEC_OVERRIDE_ADMIN_50G_POLICY(pplm, *fec_policy, write, 100g_2x); +break ; +case MLX5E_FEC_SUPPORTED_LINK_MODE_200G_4X : + MLX5E_FEC_OVERRIDE_ADMIN_50G_POLICY(pplm, *fec_policy, write, 200g_4x); +break ; +case MLX5E_FEC_SUPPORTED_LINK_MODE_400G_8X : + MLX5E_FEC_OVERRIDE_ADMIN_50G_POLICY(pplm, *fec_policy, write, 400g_8x); +break ;default :return -EINVAL ; }
@@ -393,7 +424,7 @@ static int mlx5e_fec_admin_field(u32 *pplm, u8 *fec_policy, bool write, MLX5_GET(pplm_reg, buf, fec_override_cap_##link) /* returns FEC capabilities for a given speed */ -static int mlx5e_get_fec_cap_field (u32 *pplm,u8 *fec_cap, +static int mlx5e_get_fec_cap_field (u32 *pplm,u16 *fec_cap,enum mlx5e_fec_supported_link_mode link_mode) {switch (link_mode) {
@@ -412,6 +443,18 @@ static int mlx5e_get_fec_cap_field(u32 *pplm, u8 *fec_cap,case MLX5E_FEC_SUPPORTED_LINK_MODES_100G : *fec_cap = MLX5E_GET_FEC_OVERRIDE_CAP(pplm, 100g);break ; +case MLX5E_FEC_SUPPORTED_LINK_MODE_50G_1X : + *fec_cap = MLX5E_GET_FEC_OVERRIDE_CAP(pplm, 50g_1x); +break ; +case MLX5E_FEC_SUPPORTED_LINK_MODE_100G_2X : + *fec_cap = MLX5E_GET_FEC_OVERRIDE_CAP(pplm, 100g_2x); +break ; +case MLX5E_FEC_SUPPORTED_LINK_MODE_200G_4X : + *fec_cap = MLX5E_GET_FEC_OVERRIDE_CAP(pplm, 200g_4x); +break ; +case MLX5E_FEC_SUPPORTED_LINK_MODE_400G_8X : + *fec_cap = MLX5E_GET_FEC_OVERRIDE_CAP(pplm, 400g_8x); +break ;default :return -EINVAL ; }
@@ -420,6 +463,7 @@ static int mlx5e_get_fec_cap_field(u32 *pplm, u8 *fec_cap,bool mlx5e_fec_in_caps (struct mlx5_core_dev *dev,int fec_policy) { +bool fec_50g_per_lane =MLX5_CAP_PCAM_FEATURE (dev, fec_50G_per_lane_in_pplm);u32 out[MLX5_ST_SZ_DW (pplm_reg)] = {};u32 in[MLX5_ST_SZ_DW (pplm_reg)] = {};int sz =MLX5_ST_SZ_BYTES (pplm_reg);
@@ -438,7 +482,10 @@ bool mlx5e_fec_in_caps(struct mlx5_core_dev *dev, int fec_policy)return false;for (i =0 ; i <MLX5E_MAX_FEC_SUPPORTED_LINK_MODE ; i++) { -u8 fec_caps; +u16 fec_caps; + +if (i >=MLX5E_FEC_FIRST_50G_PER_LANE_MODE && !fec_50g_per_lane) +break ;mlx5e_get_fec_cap_field (out, &fec_caps, i);if (fec_caps & fec_policy)
@@ -448,8 +495,9 @@ bool mlx5e_fec_in_caps(struct mlx5_core_dev *dev, int fec_policy) }int mlx5e_get_fec_mode (struct mlx5_core_dev *dev,u32 *fec_mode_active, -u8 *fec_configured_mode) +u16 *fec_configured_mode) { +bool fec_50g_per_lane =MLX5_CAP_PCAM_FEATURE (dev, fec_50G_per_lane_in_pplm);u32 out[MLX5_ST_SZ_DW (pplm_reg)] = {};u32 in[MLX5_ST_SZ_DW (pplm_reg)] = {};int sz =MLX5_ST_SZ_BYTES (pplm_reg);
@@ -474,6 +522,9 @@ int mlx5e_get_fec_mode(struct mlx5_core_dev *dev, u32 *fec_mode_active, *fec_configured_mode =0 ;for (i =0 ; i <MLX5E_MAX_FEC_SUPPORTED_LINK_MODE ; i++) { +if (i >=MLX5E_FEC_FIRST_50G_PER_LANE_MODE && !fec_50g_per_lane) +break ; +mlx5e_fec_admin_field (out, fec_configured_mode,0 , i);if (*fec_configured_mode !=0 ) goto out;
@@ -482,13 +533,13 @@ int mlx5e_get_fec_mode(struct mlx5_core_dev *dev, u32 *fec_mode_active,return 0 ; } -int mlx5e_set_fec_mode (struct mlx5_core_dev *dev,u8 fec_policy) +int mlx5e_set_fec_mode (struct mlx5_core_dev *dev,u16 fec_policy) { +bool fec_50g_per_lane =MLX5_CAP_PCAM_FEATURE (dev, fec_50G_per_lane_in_pplm);u32 out[MLX5_ST_SZ_DW (pplm_reg)] = {};u32 in[MLX5_ST_SZ_DW (pplm_reg)] = {};int sz =MLX5_ST_SZ_BYTES (pplm_reg); -u8 fec_policy_auto =0 ; -u8 fec_caps =0 ; +u16 fec_policy_auto =0 ;int err;int i;
@@ -498,6 +549,9 @@ int mlx5e_set_fec_mode(struct mlx5_core_dev *dev, u8 fec_policy)if (!MLX5_CAP_PCAM_REG (dev, pplm))return -EOPNOTSUPP ; +if (fec_policy >= (1 <<MLX5E_FEC_LLRS_272_257_1 ) && !fec_50g_per_lane) +return -EOPNOTSUPP ; +MLX5_SET (pplm_reg, in, local_port,1 ); err =mlx5_core_access_reg (dev, in, sz, out, sz,MLX5_REG_PPLM ,0 ,0 );if (err)
@@ -506,10 +560,26 @@ int mlx5e_set_fec_mode(struct mlx5_core_dev *dev, u8 fec_policy)MLX5_SET (pplm_reg, out, local_port,1 );for (i =0 ; i <MLX5E_MAX_FEC_SUPPORTED_LINK_MODE ; i++) { +u16 conf_fec = fec_policy; +u16 fec_caps =0 ; + +if (i >=MLX5E_FEC_FIRST_50G_PER_LANE_MODE && !fec_50g_per_lane) +break ; + +/* RS fec in ethtool is mapped to MLX5E_FEC_RS_528_514 +* to link modes up to 25G per lane and to +* MLX5E_FEC_RS_544_514 in the new link modes based on +* 50 G per lane +*/ +if (conf_fec == (1 <<MLX5E_FEC_RS_528_514 ) && + i >=MLX5E_FEC_FIRST_50G_PER_LANE_MODE ) + conf_fec = (1 <<MLX5E_FEC_RS_544_514 ); +mlx5e_get_fec_cap_field (out, &fec_caps, i); +/* policy supported for link speed */ -if (fec_caps & fec_policy) -mlx5e_fec_admin_field (out, &fec_policy,1 , i); +if (fec_caps & conf_fec) +mlx5e_fec_admin_field (out, &conf_fec,1 , i);else /* set FEC to auto*/ mlx5e_fec_admin_field (out, &fec_policy_auto,1 , i);
drivers/net/ethernet/mellanox/mlx5/core/en/port.h +4 -2
@@ -62,13 +62,15 @@ int mlx5e_port_set_priority2buffer(struct mlx5_core_dev *mdev, u8 *buffer);bool mlx5e_fec_in_caps (struct mlx5_core_dev *dev,int fec_policy);int mlx5e_get_fec_mode (struct mlx5_core_dev *dev,u32 *fec_mode_active, -u8 *fec_configured_mode); -int mlx5e_set_fec_mode (struct mlx5_core_dev *dev,u8 fec_policy); +u16 *fec_configured_mode); +int mlx5e_set_fec_mode (struct mlx5_core_dev *dev,u16 fec_policy);enum {MLX5E_FEC_NOFEC ,MLX5E_FEC_FIRECODE ,MLX5E_FEC_RS_528_514 , +MLX5E_FEC_RS_544_514 =7 , +MLX5E_FEC_LLRS_272_257_1 =9 , };#endif
drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +10 -4
@@ -633,6 +633,8 @@ static const u32 pplm_fec_2_ethtool[] = { [MLX5E_FEC_NOFEC] = ETHTOOL_FEC_OFF, [MLX5E_FEC_FIRECODE] = ETHTOOL_FEC_BASER, [MLX5E_FEC_RS_528_514] = ETHTOOL_FEC_RS, + [MLX5E_FEC_RS_544_514] = ETHTOOL_FEC_RS, + [MLX5E_FEC_LLRS_272_257_1] = ETHTOOL_FEC_LLRS, };static u32 pplm2ethtool_fec (u_long fec_mode,unsigned long size)
@@ -661,6 +663,8 @@ static const u32 pplm_fec_2_ethtool_linkmodes[] = { [MLX5E_FEC_NOFEC] = ETHTOOL_LINK_MODE_FEC_NONE_BIT, [MLX5E_FEC_FIRECODE] = ETHTOOL_LINK_MODE_FEC_BASER_BIT, [MLX5E_FEC_RS_528_514] = ETHTOOL_LINK_MODE_FEC_RS_BIT, + [MLX5E_FEC_RS_544_514] = ETHTOOL_LINK_MODE_FEC_RS_BIT, + [MLX5E_FEC_LLRS_272_257_1] = ETHTOOL_LINK_MODE_FEC_LLRS_BIT, }; static int get_fec_supported_advertised(struct mlx5_core_dev *dev,
@@ -680,6 +684,8 @@ static int get_fec_supported_advertised(struct mlx5_core_dev *dev, ETHTOOL_LINK_MODE_FEC_BASER_BIT);MLX5E_ADVERTISE_SUPPORTED_FEC (MLX5E_FEC_RS_528_514 ,ETHTOOL_LINK_MODE_FEC_RS_BIT ); +MLX5E_ADVERTISE_SUPPORTED_FEC (MLX5E_FEC_LLRS_272_257_1 , +ETHTOOL_LINK_MODE_FEC_LLRS_BIT );/* active fec is a bit set, find out which bit is set and * advertise the corresponding ethtool bit
@@ -1510,7 +1516,7 @@ static int mlx5e_get_fecparam(struct net_device *netdev, {struct mlx5e_priv *priv =netdev_priv (netdev);struct mlx5_core_dev *mdev = priv->mdev; -u8 fec_configured =0 ; +u16 fec_configured =0 ;u32 fec_active =0 ;int err;
@@ -1526,7 +1532,7 @@ static int mlx5e_get_fecparam(struct net_device *netdev,return -EOPNOTSUPP ; fecparam->fec =pplm2ethtool_fec ((u_long )fec_configured, -sizeof (u8) *BITS_PER_BYTE ); +sizeof (u16) *BITS_PER_BYTE );return 0 ; }
@@ -1536,12 +1542,12 @@ static int mlx5e_set_fecparam(struct net_device *netdev, {struct mlx5e_priv *priv =netdev_priv (netdev);struct mlx5_core_dev *mdev = priv->mdev; -u8 fec_policy =0 ; +u16 fec_policy =0 ;int mode;int err;if (bitmap_weight ((unsigned long *)&fecparam->fec, -ETHTOOL_FEC_BASER_BIT +1 ) >1 ) +ETHTOOL_FEC_LLRS_BIT +1 ) >1 )return -EOPNOTSUPP ;for (mode =0 ; mode <ARRAY_SIZE (pplm_fec_2_ethtool); mode++) {
Signature · 1 line
2.24.1
PATCH v4 13/13 net/mlx5: Remove a useless 'drain_workqueue()' call in 'mlx5e_ipsec_cleanup()'
In reply to Saeed MahameedFrom: Christophe JAILLET <[email protected]>
'destroy_workqueue()' already calls 'drain_workqueue()', there is no need to call it explicitly.
--- drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c | 1 - 1 file changed, 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c +0 -1
@@ -433,7 +433,6 @@ void mlx5e_ipsec_cleanup(struct mlx5e_priv *priv)if (!ipsec)return ; -drain_workqueue (ipsec->wq);destroy_workqueue (ipsec->wq);ida_destroy (&ipsec->halloc);
Signature · 1 line
2.24.1
David Miller
maintainerFrom: Saeed Mahameed <[email protected]>
Date: Wed, 19 Feb 2020 03:22:58 +0000
Quoted 19 lines
This series adds some updates to mlx5 driver
1) Devlink health dump support for both rx and tx health reporters.
2) FEC modes supports.
3) two misc small patches.V4:
- Resend after net-next is open and rebased
- Added Reviewed-by: Andrew Lunn, to the ethtool patchV3:
- Improve ethtool patch "FEC LLRS" commit message as requested by Andrew Lunn.
- Since we've missed the last cycle, dropped two small fixes patches, as they should go to net now.V2:
- Remove "\n" from snprintf, happened due to rebase with a conflicting feature, Thanks Joe for spotting this.
Quoted 7 lines
For more information please see tag log below.
Please pull and let me know if there is any problem.
Note about non-mlx5 change:
For the FEC link modes support, Aya added the define for low latency Reed Solomon FEC as LLRS, in:include/uapi/linux/ethtool.h
Pulled, thank you.