mlx5 updates 2022-11-12
Subsystems (6)
From: Saeed Mahameed <[email protected]>
This series provides misc updates to mlx5 driver.
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 b548b17a93fd18357a5a6f535c10c1e68719ad32:
tcp: tcp_wfree() refactoring (2022-11-11 21:38:03 -0800)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux.git tags/mlx5-updates-2022-11-12
for you to fetch changes up to e07c4924a77dbf21bf1973411149784cfa5d3b27:
net/mlx5e: ethtool: get_link_ext_stats for PHY down events (2022-11-12 02:20:20 -0800)
----------------------------------------------------------------
mlx5-updates-2022-11-12
Misc updates to mlx5 driver
1) Support enhanced CQE compression, on ConnectX6-Dx Reduce irq rate, cpu utilization and latency.
2) Connection tracking: Optimize the pre_ct table lookup for rules installed on chain 0.
3) implement ethtool get_link_ext_stats for PHY down events
4) Expose device vhca_id to debugfs
5) misc cleanups and trivial changes
----------------------------------------------------------------
Anisse Astier (1):
net/mlx5e: remove unused list in arfs
Colin Ian King (1):
net/mlx5: Fix spelling mistake "destoy" -> "destroy"
Eli Cohen (1):
net/mlx5: Expose vhca_id to debugfs
Gal Pressman (1):
net/mlx5e: Use clamp operation instead of open coding it
Guy Truzman (1):
net/mlx5e: Add error flow when failing update_rx
Moshe Shemesh (1):
net/mlx5: Unregister traps on driver unload flow
Ofer Levi (1):
net/mlx5e: Support enhanced CQE compression
Oz Shlomo (1):
net/mlx5e: CT, optimize pre_ct table lookup
Roi Dayan (2):
net/mlx5: Bridge, Use debug instead of warn if entry doesn't exists net/mlx5e: TC, Remove redundant WARN_ON()
Saeed Mahameed (1):
net/mlx5e: ethtool: get_link_ext_stats for PHY down events
Tariq Toukan (4):
net/mlx5e: Move params kernel log print to probe function net/mlx5e: kTLS, Remove unused work field
net/mlx5e: kTLS, Remove unnecessary per-callback completion net/mlx5e: kTLS, Use a single async context object per a callback bulk
drivers/net/ethernet/mellanox/mlx5/core/devlink.c | 11 +- drivers/net/ethernet/mellanox/mlx5/core/devlink.h | 2 + drivers/net/ethernet/mellanox/mlx5/core/en.h | 2 + .../net/ethernet/mellanox/mlx5/core/en/params.c | 12 +- .../net/ethernet/mellanox/mlx5/core/en/params.h | 14 ++ .../net/ethernet/mellanox/mlx5/core/en/rep/tc.c | 1 - drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c | 89 +++++++----- .../ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c | 65 ++++----- drivers/net/ethernet/mellanox/mlx5/core/en_arfs.c | 2 - .../net/ethernet/mellanox/mlx5/core/en_ethtool.c | 1 + drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 16 ++- drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | 150 ++++++++++++++++++--- drivers/net/ethernet/mellanox/mlx5/core/en_stats.c | 17 +++ drivers/net/ethernet/mellanox/mlx5/core/en_stats.h | 2 + drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 9 +- .../net/ethernet/mellanox/mlx5/core/esw/bridge.c | 8 +- .../net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c | 7 +- .../ethernet/mellanox/mlx5/core/ipoib/ipoib_vlan.c | 6 +- drivers/net/ethernet/mellanox/mlx5/core/main.c | 19 +++ .../mellanox/mlx5/core/steering/dr_table.c | 2 +- drivers/net/ethernet/mellanox/mlx5/core/wq.h | 17 +++ include/linux/mlx5/device.h | 6 + 22 files changed, 331 insertions(+), 127 deletions(-)
PATCH 1/15 net/mlx5: Bridge, Use debug instead of warn if entry doesn't exists
From: Roi Dayan <[email protected]>
There is no need for the warn if entry already removed. Use debug print like in the update flow.
Also update the messages so user can identify if the it's from the update flow or remove flow.
--- drivers/net/ethernet/mellanox/mlx5/core/esw/bridge.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/esw/bridge.c +4 -4
@@ -1722,7 +1722,7 @@ void mlx5_esw_bridge_fdb_update_used(struct net_device *dev, u16 vport_num, u16 entry =mlx5_esw_bridge_fdb_lookup (bridge, fdb_info->addr, fdb_info->vid);if (!entry) {esw_debug (br_offloads->esw->dev, -"FDB entry with specified key not found (MAC=%pM,vid=%u,vport=%u)\n" , +"FDB update entry with specified key not found (MAC=%pM,vid=%u,vport=%u)\n" , fdb_info->addr, fdb_info->vid, vport_num);return ; }
@@ -1775,9 +1775,9 @@ void mlx5_esw_bridge_fdb_remove(struct net_device *dev, u16 vport_num, u16 esw_o bridge = port->bridge; entry =mlx5_esw_bridge_fdb_lookup (bridge, fdb_info->addr, fdb_info->vid);if (!entry) { -esw_warn (esw->dev, -"FDB entry with specified key not found (MAC=%pM,vid=%u,vport=%u)\n" , - fdb_info->addr, fdb_info->vid, vport_num); +esw_debug (esw->dev, +"FDB remove entry with specified key not found (MAC=%pM,vid=%u,vport=%u)\n" , + fdb_info->addr, fdb_info->vid, vport_num);return ; }
Signature · 1 line
2.38.1
Re: [net-next 01/15] net/mlx5: Bridge, Use debug instead of warn if entry doesn't exists
This series was applied to netdev/net-next.git (master) by Saeed Mahameed <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (master) by Saeed Mahameed <[email protected]>:
Quoted 8 lines · On Sat, 12 Nov 2022 02:21:33 -0800 you wrote:
From: Roi Dayan <[email protected]>
There is no need for the warn if entry already removed. Use debug print like in the update flow.
Also update the messages so user can identify if the it's from the update flow or remove flow.[...]
Here is the summary with links:
- [net-next,01/15] net/mlx5: Bridge, Use debug instead of warn if entry doesn't exists
https://git.kernel.org/netdev/net-next/c/ea645f97bcec - [net-next,02/15] net/mlx5: Fix spelling mistake "destoy" -> "destroy" https://git.kernel.org/netdev/net-next/c/d23b928befda - [net-next,03/15] net/mlx5: Unregister traps on driver unload flow https://git.kernel.org/netdev/net-next/c/71b75f0e02ed - [net-next,04/15] net/mlx5: Expose vhca_id to debugfs https://git.kernel.org/netdev/net-next/c/dd3dd7263cde - [net-next,05/15] net/mlx5e: remove unused list in arfs https://git.kernel.org/netdev/net-next/c/60551e95a864 - [net-next,06/15] net/mlx5e: Use clamp operation instead of open coding it https://git.kernel.org/netdev/net-next/c/9458108040b3 - [net-next,07/15] net/mlx5e: Support enhanced CQE compression https://git.kernel.org/netdev/net-next/c/2c925db0a7d6 - [net-next,08/15] net/mlx5e: Move params kernel log print to probe function https://git.kernel.org/netdev/net-next/c/38438d39a9a0 - [net-next,09/15] net/mlx5e: Add error flow when failing update_rx https://git.kernel.org/netdev/net-next/c/e74ae1faeb71 - [net-next,10/15] net/mlx5e: TC, Remove redundant WARN_ON() https://git.kernel.org/netdev/net-next/c/989722906166 - [net-next,11/15] net/mlx5e: kTLS, Remove unused work field https://git.kernel.org/netdev/net-next/c/1f74399fd1ed - [net-next,12/15] net/mlx5e: kTLS, Remove unnecessary per-callback completion https://git.kernel.org/netdev/net-next/c/4d78a2ebbd2b - [net-next,13/15] net/mlx5e: kTLS, Use a single async context object per a callback bulk https://git.kernel.org/netdev/net-next/c/341361533011 - [net-next,14/15] net/mlx5e: CT, optimize pre_ct table lookup https://git.kernel.org/netdev/net-next/c/05bb74c29d84 - [net-next,15/15] net/mlx5e: ethtool: get_link_ext_stats for PHY down events https://git.kernel.org/netdev/net-next/c/e07c4924a77d
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
PATCH 2/15 net/mlx5: Fix spelling mistake "destoy" -> "destroy"
In reply to Saeed MahameedFrom: Colin Ian King <[email protected]>
There is a spelling mistake in an error message. Fix it.
--- drivers/net/ethernet/mellanox/mlx5/core/steering/dr_table.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_table.c +1 -1
@@ -292,7 +292,7 @@ int mlx5dr_table_destroy(struct mlx5dr_table *tbl)mlx5dr_dbg_tbl_del (tbl); ret =dr_table_destroy_sw_owned_tbl (tbl);if (ret) -mlx5dr_err (tbl->dmn,"Failed to destoy sw owned table\n" ); +mlx5dr_err (tbl->dmn,"Failed to destroy sw owned table\n" );dr_table_uninit (tbl);
Signature · 1 line
2.38.1
PATCH 3/15 net/mlx5: Unregister traps on driver unload flow
In reply to Saeed MahameedFrom: Moshe Shemesh <[email protected]>
Before this patch, devlink traps are registered only on full driver probe and unregistered on driver removal. As devlink traps are not usable once driver functionality is unloaded, it should be unrgeistered also on flows that unload the driver and then registered when loaded back, e.g. devlink reload flow.
--- drivers/net/ethernet/mellanox/mlx5/core/devlink.c | 11 ++--------- drivers/net/ethernet/mellanox/mlx5/core/devlink.h | 2 ++ drivers/net/ethernet/mellanox/mlx5/core/main.c | 8 ++++++++ 3 files changed, 12 insertions(+), 9 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/devlink.c +2 -9
@@ -840,7 +840,7 @@ static const struct devlink_trap_group mlx5_trap_groups_arr[] = { DEVLINK_TRAP_GROUP_GENERIC(L2_DROPS, 0), }; -static int mlx5_devlink_traps_register (struct devlink *devlink) +int mlx5_devlink_traps_register (struct devlink *devlink) {struct mlx5_core_dev *core_dev =devlink_priv (devlink);int err;
@@ -862,7 +862,7 @@ static int mlx5_devlink_traps_register(struct devlink *devlink)return err; } -static void mlx5_devlink_traps_unregister (struct devlink *devlink) +void mlx5_devlink_traps_unregister (struct devlink *devlink) {devl_traps_unregister (devlink, mlx5_traps_arr,ARRAY_SIZE (mlx5_traps_arr)); devl_trap_groups_unregister(devlink, mlx5_trap_groups_arr,
@@ -889,17 +889,11 @@ int mlx5_devlink_register(struct devlink *devlink)if (err) goto max_uc_list_err; - err =mlx5_devlink_traps_register (devlink); -if (err) - goto traps_reg_err; -if (!mlx5_core_is_mp_slave (dev))devlink_set_features (devlink,DEVLINK_F_RELOAD );return 0 ; -traps_reg_err: -mlx5_devlink_max_uc_list_param_unregister (devlink); max_uc_list_err:mlx5_devlink_auxdev_params_unregister (devlink); auxdev_reg_err:
@@ -910,7 +904,6 @@ int mlx5_devlink_register(struct devlink *devlink)void mlx5_devlink_unregister (struct devlink *devlink) { -mlx5_devlink_traps_unregister (devlink);mlx5_devlink_max_uc_list_param_unregister (devlink);mlx5_devlink_auxdev_params_unregister (devlink); devlink_params_unregister(devlink, mlx5_devlink_params,
drivers/net/ethernet/mellanox/mlx5/core/devlink.h +2 -0
@@ -30,6 +30,8 @@ void mlx5_devlink_trap_report(struct mlx5_core_dev *dev, int trap_id, struct sk_int mlx5_devlink_trap_get_num_active (struct mlx5_core_dev *dev);int mlx5_devlink_traps_get_action (struct mlx5_core_dev *dev,int trap_id,enum devlink_trap_action *action); +int mlx5_devlink_traps_register (struct devlink *devlink); +void mlx5_devlink_traps_unregister (struct devlink *devlink);struct devlink *mlx5_devlink_alloc (struct device *dev);void mlx5_devlink_free (struct devlink *devlink);
drivers/net/ethernet/mellanox/mlx5/core/main.c +8 -0
@@ -1306,8 +1306,15 @@ static int mlx5_load(struct mlx5_core_dev *dev)mlx5_sf_dev_table_create (dev); + err =mlx5_devlink_traps_register (priv_to_devlink (dev)); +if (err) + goto err_traps_reg; +return 0 ; +err_traps_reg: +mlx5_sf_dev_table_destroy (dev); +mlx5_sriov_detach (dev); err_sriov:mlx5_lag_remove_mdev (dev);mlx5_ec_cleanup (dev);
@@ -1336,6 +1343,7 @@ static int mlx5_load(struct mlx5_core_dev *dev)static void mlx5_unload (struct mlx5_core_dev *dev) { +mlx5_devlink_traps_unregister (priv_to_devlink (dev));mlx5_sf_dev_table_destroy (dev);mlx5_sriov_detach (dev);mlx5_eswitch_disable (dev->priv.eswitch);
Signature · 1 line
2.38.1
PATCH 4/15 net/mlx5: Expose vhca_id to debugfs
In reply to Saeed MahameedFrom: Eli Cohen <[email protected]>
hca_id is an identifier of an mlx5_core instance within the hardware. This identifier may be required for troubleshooting.
Expose it to debugfs.
Example:
$ cat /sys/kernel/debug/mlx5/mlx5_core.sf.2/vhca_id 0x12
--- drivers/net/ethernet/mellanox/mlx5/core/main.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/main.c +11 -0
@@ -1588,6 +1588,16 @@ static int mlx5_hca_caps_alloc(struct mlx5_core_dev *dev)return -ENOMEM ; } +static int vhca_id_show (struct seq_file *file,void *priv) +{ +struct mlx5_core_dev *dev = file->private; + +seq_printf (file,"0x%x\n" ,MLX5_CAP_GEN (dev, vhca_id)); +return 0 ; +} + +DEFINE_SHOW_ATTRIBUTE (vhca_id); +int mlx5_mdev_init (struct mlx5_core_dev *dev,int profile_idx) {struct mlx5_priv *priv = &dev->priv;
@@ -1612,6 +1622,7 @@ int mlx5_mdev_init(struct mlx5_core_dev *dev, int profile_idx) priv->numa_node =dev_to_node (mlx5_core_dma_dev (dev)); priv->dbg.dbg_root =debugfs_create_dir (dev_name (dev->device), mlx5_debugfs_root); +debugfs_create_file ("vhca_id" ,0400 , priv->dbg.dbg_root, dev, &vhca_id_fops);INIT_LIST_HEAD (&priv->traps); err =mlx5_tout_init (dev);
Signature · 1 line
2.38.1
PATCH 5/15 net/mlx5e: remove unused list in arfs
In reply to Saeed MahameedFrom: Anisse Astier <[email protected]>
This is never used, and probably something that was intended to be used before per-protocol hash tables were chosen instead.
--- drivers/net/ethernet/mellanox/mlx5/core/en_arfs.c | 2 -- 1 file changed, 2 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_arfs.c +0 -2
@@ -57,7 +57,6 @@ struct mlx5e_arfs_tables {struct arfs_table arfs_tables[ARFS_NUM_TYPES ];/* Protect aRFS rules list */ spinlock_t arfs_lock; -struct list_head rules;int last_filter_id;struct workqueue_struct *wq; };
@@ -376,7 +375,6 @@ int mlx5e_arfs_create_tables(struct mlx5e_flow_steering *fs,return -ENOMEM ;spin_lock_init (&arfs->arfs_lock); -INIT_LIST_HEAD (&arfs->rules); arfs->wq =create_singlethread_workqueue ("mlx5e_arfs" );if (!arfs->wq) goto err;
Signature · 1 line
2.38.1
PATCH 6/15 net/mlx5e: Use clamp operation instead of open coding it
In reply to Saeed MahameedFrom: Gal Pressman <[email protected]>
Replace the min/max operations with a single clamp.
--- drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +3 -6
@@ -1060,12 +1060,9 @@ static int mlx5e_hairpin_flow_add(struct mlx5e_priv *priv, hash_hairpin_info(peer_id, match_prio));mutex_unlock (&tc->hairpin_tbl_lock); - params.log_data_size =16 ; - params.log_data_size =min_t (u8, params.log_data_size, -MLX5_CAP_GEN (priv->mdev, log_max_hairpin_wq_data_sz)); - params.log_data_size =max_t (u8, params.log_data_size, -MLX5_CAP_GEN (priv->mdev, log_min_hairpin_wq_data_sz)); - + params.log_data_size =clamp_t (u8,16 , +MLX5_CAP_GEN (priv->mdev, log_min_hairpin_wq_data_sz), +MLX5_CAP_GEN (priv->mdev, log_max_hairpin_wq_data_sz)); params.log_num_packets = params.log_data_size -MLX5_MPWRQ_MIN_LOG_STRIDE_SZ (priv->mdev); params.log_num_packets = min_t(u8, params.log_num_packets,
Signature · 1 line
2.38.1
PATCH 7/15 net/mlx5e: Support enhanced CQE compression
In reply to Saeed MahameedFrom: Ofer Levi <[email protected]>
CQE compression feature improves performance by reducing PCI bandwidth bottleneck on CQEs write.
Enhanced CQE compression introduced in ConnectX-6 and it aims to reduce CPU utilization of SW side packets decompression by eliminating the need to rewrite ownership bit, which is likely to cost a cache-miss, is replaced by validity byte handled solely by HW.
Another advantage of the enhanced feature is that session packets are available to SW as soon as a single CQE slot is filled, instead of waiting for session to close, this improves packet latency from NIC to host.
Performance:
Following are tested scenarios and reults comparing basic and enahnced CQE compression.
setup: IXIA 100GbE connected directly to port 0 and port 1 of ConnectX-6 Dx 100GbE dual port.
Case #1 RX only, single flow goes to single queue:
IRQ rate reduced by ~ 30%, CPU utilization improved by 2%.
Case #2 IP forwarding from port 1 to port 0 single flow goes to single queue:
Avg latency improved from 60us to 21us, frame loss improved from 0.5% to 0.0%.
Case #3 IP forwarding from port 1 to port 0 Max Throughput IXIA sends 100%, 8192 UDP flows, goes to 24 queues:
Enhanced is equal or slightly better than basic.
Testing the basic compression feature with this patch shows there is no perfrormance degradation of the basic compression feature.
--- drivers/net/ethernet/mellanox/mlx5/core/en.h | 2 + .../ethernet/mellanox/mlx5/core/en/params.c | 10 +- .../net/ethernet/mellanox/mlx5/core/en_main.c | 8 + .../net/ethernet/mellanox/mlx5/core/en_rx.c | 150 +++++++++++++++--- drivers/net/ethernet/mellanox/mlx5/core/wq.h | 17 ++ include/linux/mlx5/device.h | 6 + 6 files changed, 170 insertions(+), 23 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en.h +2 -0
@@ -344,6 +344,7 @@ enum {MLX5E_RQ_STATE_CSUM_FULL ,/* cqe_csum_full hw bit is set */ MLX5E_RQ_STATE_MINI_CQE_HW_STRIDX ,/* set when mini_cqe_resp_stride_index cap is used */ MLX5E_RQ_STATE_SHAMPO ,/* set when SHAMPO cap is used */ + MLX5E_RQ_STATE_MINI_CQE_ENHANCED, /* set when enhanced mini_cqe_cap is used */ }; struct mlx5e_cq {
@@ -370,6 +371,7 @@ struct mlx5e_cq_decomp {u8 mini_arr_idx;u16 left;u16 wqe_counter; +bool last_cqe_title; }____cacheline_aligned_in_smp ;enum mlx5e_dma_map_type {
drivers/net/ethernet/mellanox/mlx5/core/en/params.c +8 -2
@@ -608,13 +608,15 @@ void mlx5e_init_rq_type_params(struct mlx5_core_dev *mdev, MLX5E_PARAMS_MINIMUM_LOG_RQ_SIZE :MLX5E_PARAMS_DEFAULT_LOG_RQ_SIZE ; -mlx5_core_info (mdev,"MLX5E: StrdRq(%d) RqSz(%ld) StrdSz(%ld) RxCqeCmprss(%d)\n" , +mlx5_core_info (mdev,"MLX5E: StrdRq(%d) RqSz(%ld) StrdSz(%ld) RxCqeCmprss(%d %s)\n" , params->rq_wq_type ==MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ , params->rq_wq_type ==MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ ?BIT (mlx5e_mpwqe_get_log_rq_size (mdev, params,NULL )) :BIT (params->log_rq_mtu_frames),BIT (mlx5e_mpwqe_get_log_stride_size (mdev, params,NULL )), -MLX5E_GET_PFLAG (params,MLX5E_PFLAG_RX_CQE_COMPRESS )); +MLX5E_GET_PFLAG (params,MLX5E_PFLAG_RX_CQE_COMPRESS ), +MLX5_CAP_GEN (mdev, enhanced_cqe_compression) ? +"enhanced" :"basic" ); }void mlx5e_set_rq_type (struct mlx5_core_dev *mdev,struct mlx5e_params *params)
@@ -852,6 +854,10 @@ static void mlx5e_build_rx_cq_param(struct mlx5_core_dev *mdev,if (MLX5E_GET_PFLAG (params,MLX5E_PFLAG_RX_CQE_COMPRESS )) {MLX5_SET (cqc, cqc, mini_cqe_res_format, hw_stridx ?MLX5_CQE_FORMAT_CSUM_STRIDX :MLX5_CQE_FORMAT_CSUM ); +MLX5_SET (cqc, cqc, cqe_compression_layout, +MLX5_CAP_GEN (mdev, enhanced_cqe_compression) ? +MLX5_CQE_COMPRESS_LAYOUT_ENHANCED : +MLX5_CQE_COMPRESS_LAYOUT_BASIC );MLX5_SET (cqc, cqc, cqe_comp_en,1 ); }
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +8 -0
@@ -1205,6 +1205,13 @@ int mlx5e_open_rq(struct mlx5e_params *params, struct mlx5e_rq_param *param, MLX5_CAP_GEN(mdev, mini_cqe_resp_stride_index))__set_bit (MLX5E_RQ_STATE_MINI_CQE_HW_STRIDX , &rq->state); +/* For enhanced CQE compression packet processing. decompress +* session according to the enhanced layout. +*/ +if (MLX5E_GET_PFLAG (params,MLX5E_PFLAG_RX_CQE_COMPRESS ) && +MLX5_CAP_GEN (mdev, enhanced_cqe_compression)) +__set_bit (MLX5E_RQ_STATE_MINI_CQE_ENHANCED , &rq->state); +return 0 ; err_destroy_rq:
@@ -1895,6 +1902,7 @@ static int mlx5e_alloc_cq_common(struct mlx5e_priv *priv,struct mlx5_cqe64 *cqe =mlx5_cqwq_get_wqe (&cq->wq, i); cqe->op_own =0xf1 ; + cqe->validity_iteration_count =0xff ; } cq->mdev = mdev;
drivers/net/ethernet/mellanox/mlx5/core/en_rx.c +129 -21
193 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/wq.h +17 -0
@@ -243,6 +243,23 @@ static inline struct mlx5_cqe64 *mlx5_cqwq_get_cqe(struct mlx5_cqwq *wq)return cqe; } +static inline +struct mlx5_cqe64 *mlx5_cqwq_get_cqe_enahnced_comp (struct mlx5_cqwq *wq) +{ +u8 sw_validity_iteration_count =mlx5_cqwq_get_wrap_cnt (wq) &0xff ; +u32 ci =mlx5_cqwq_get_ci (wq); +struct mlx5_cqe64 *cqe; + + cqe =mlx5_cqwq_get_wqe (wq, ci); +if (cqe->validity_iteration_count != sw_validity_iteration_count) +return NULL ; + +/* ensure cqe content is read after cqe ownership bit/validity byte */ +dma_rmb (); + +return cqe; +} +static inline u32 mlx5_wq_ll_get_size (struct mlx5_wq_ll *wq) {return (u32 )wq->fbc.sz_m1 +1 ;
include/linux/mlx5/device.h +6 -0
@@ -882,6 +882,12 @@ static inline u8 get_cqe_opcode(struct mlx5_cqe64 *cqe)return cqe->op_own >>4 ; } +static inline u8 get_cqe_enhanced_num_mini_cqes (struct mlx5_cqe64 *cqe) +{ +/* num_of_mini_cqes is zero based */ +return get_cqe_opcode (cqe) +1 ; +} +static inline u8 get_cqe_lro_tcppsh (struct mlx5_cqe64 *cqe) {return (cqe->lro.tcppsh_abort_dupack >>6 ) &1 ;
Signature · 1 line
2.38.1
PATCH 8/15 net/mlx5e: Move params kernel log print to probe function
In reply to Saeed MahameedFrom: Tariq Toukan <[email protected]>
Params info print was meant to be printed on load. With time, new calls to mlx5e_init_rq_type_params and mlx5e_build_rq_params were added, mistakenly printing the params once again.
Move the print to were it belongs, in mlx5e_probe.
--- .../net/ethernet/mellanox/mlx5/core/en/params.c | 10 ---------- .../net/ethernet/mellanox/mlx5/core/en/params.h | 14 ++++++++++++++ drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 1 + 3 files changed, 15 insertions(+), 10 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en/params.c +0 -10
@@ -607,16 +607,6 @@ void mlx5e_init_rq_type_params(struct mlx5_core_dev *mdev, params->log_rq_mtu_frames =is_kdump_kernel () ?MLX5E_PARAMS_MINIMUM_LOG_RQ_SIZE :MLX5E_PARAMS_DEFAULT_LOG_RQ_SIZE ; - -mlx5_core_info (mdev,"MLX5E: StrdRq(%d) RqSz(%ld) StrdSz(%ld) RxCqeCmprss(%d %s)\n" , - params->rq_wq_type ==MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ , - params->rq_wq_type ==MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ ? -BIT (mlx5e_mpwqe_get_log_rq_size (mdev, params,NULL )) : -BIT (params->log_rq_mtu_frames), -BIT (mlx5e_mpwqe_get_log_stride_size (mdev, params,NULL )), -MLX5E_GET_PFLAG (params,MLX5E_PFLAG_RX_CQE_COMPRESS ), -MLX5_CAP_GEN (mdev, enhanced_cqe_compression) ? -"enhanced" :"basic" ); }void mlx5e_set_rq_type (struct mlx5_core_dev *mdev,struct mlx5e_params *params)
drivers/net/ethernet/mellanox/mlx5/core/en/params.h +14 -0
@@ -154,4 +154,18 @@ int mlx5e_build_channel_param(struct mlx5_core_dev *mdev,u16 mlx5e_calc_sq_stop_room (struct mlx5_core_dev *mdev,struct mlx5e_params *params);int mlx5e_validate_params (struct mlx5_core_dev *mdev,struct mlx5e_params *params); +static inline void mlx5e_params_print_info (struct mlx5_core_dev *mdev, +struct mlx5e_params *params) +{ +mlx5_core_info (mdev,"MLX5E: StrdRq(%d) RqSz(%ld) StrdSz(%ld) RxCqeCmprss(%d %s)\n" , + params->rq_wq_type ==MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ , + params->rq_wq_type ==MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ ? +BIT (mlx5e_mpwqe_get_log_rq_size (mdev, params,NULL )) : +BIT (params->log_rq_mtu_frames), +BIT (mlx5e_mpwqe_get_log_stride_size (mdev, params,NULL )), +MLX5E_GET_PFLAG (params,MLX5E_PFLAG_RX_CQE_COMPRESS ), +MLX5_CAP_GEN (mdev, enhanced_cqe_compression) ? +"enhanced" :"basic" ); +}; +#endif /* __MLX5_EN_PARAMS_H__ */
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +1 -0
@@ -5955,6 +5955,7 @@ static int mlx5e_probe(struct auxiliary_device *adev,mlx5e_dcbnl_init_app (priv);mlx5_uplink_netdev_set (mdev, netdev); +mlx5e_params_print_info (mdev, &priv->channels.params);return 0 ; err_resume:
Signature · 1 line
2.38.1
PATCH 9/15 net/mlx5e: Add error flow when failing update_rx
In reply to Saeed MahameedFrom: Guy Truzman <[email protected]>
Up until now, return value of update_rx was ignored. Therefore, flow continues even if it fails. Add error flow in case of update_rx fails in mlx5e_open_locked, mlx5i_open and mlx5i_pkey_open.
--- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 7 ++++++- drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c | 7 ++++++- drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib_vlan.c | 6 +++++- 3 files changed, 17 insertions(+), 3 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +6 -1
@@ -3069,7 +3069,10 @@ int mlx5e_open_locked(struct net_device *netdev)if (err) goto err_clear_state_opened_flag; - priv->profile->update_rx (priv); + err = priv->profile->update_rx (priv); +if (err) + goto err_close_channels; +mlx5e_selq_apply (&priv->selq);mlx5e_activate_priv_channels (priv);mlx5e_apply_traps (priv, true);
@@ -3079,6 +3082,8 @@ int mlx5e_open_locked(struct net_device *netdev)mlx5e_queue_update_stats (priv);return 0 ; +err_close_channels: +mlx5e_close_channels (&priv->channels); err_clear_state_opened_flag:clear_bit (MLX5E_STATE_OPENED , &priv->state);mlx5e_selq_cancel (&priv->selq);
drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c +6 -1
@@ -561,12 +561,17 @@ static int mlx5i_open(struct net_device *netdev)if (err) goto err_remove_fs_underlay_qp; - epriv->profile->update_rx (epriv); + err = epriv->profile->update_rx (epriv); +if (err) + goto err_close_channels; +mlx5e_activate_priv_channels (epriv);mutex_unlock (&epriv->state_lock);return 0 ; +err_close_channels: +mlx5e_close_channels (&epriv->channels); err_remove_fs_underlay_qp:mlx5_fs_remove_rx_underlay_qpn (mdev, ipriv->qpn); err_reset_qp:
drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib_vlan.c +5 -1
@@ -221,12 +221,16 @@ static int mlx5i_pkey_open(struct net_device *netdev)mlx5_core_warn (mdev,"opening child channels failed, %d\n" , err); goto err_clear_state_opened_flag; } - epriv->profile->update_rx (epriv); + err = epriv->profile->update_rx (epriv); +if (err) + goto err_close_channels;mlx5e_activate_priv_channels (epriv);mutex_unlock (&epriv->state_lock);return 0 ; +err_close_channels: +mlx5e_close_channels (&epriv->channels); err_clear_state_opened_flag:mlx5e_destroy_tis (mdev, epriv->tisn[0 ][0 ]); err_remove_rx_uderlay_qp:
Signature · 1 line
2.38.1
PATCH 10/15 net/mlx5e: TC, Remove redundant WARN_ON()
In reply to Saeed MahameedFrom: Roi Dayan <[email protected]>
The case where the packet is not offloaded and needs to be restored to slow path and couldn't find expected tunnel information should not dump a call trace to the user. there is a debug call.
--- drivers/net/ethernet/mellanox/mlx5/core/en/rep/tc.c | 1 - 1 file changed, 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/en/rep/tc.c +0 -1
@@ -690,7 +690,6 @@ static bool mlx5e_restore_tunnel(struct mlx5e_priv *priv, struct sk_buff *skb, err =mapping_find (uplink_priv->tunnel_mapping, tun_id, &key);if (err) { -WARN_ON_ONCE (true);netdev_dbg (priv->netdev,"Couldn't find tunnel for tun_id: %d, err: %d\n" , tun_id, err);
Signature · 1 line
2.38.1
PATCH 11/15 net/mlx5e: kTLS, Remove unused work field
In reply to Saeed MahameedFrom: Tariq Toukan <[email protected]>
Work field in struct mlx5e_async_ctx is not used. Remove it.
--- drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c | 1 - 1 file changed, 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c +0 -1
@@ -126,7 +126,6 @@ mlx5e_get_ktls_tx_priv_ctx(struct tls_context *tls_ctx)struct mlx5e_async_ctx {struct mlx5_async_work context;struct mlx5_async_ctx async_ctx; -struct work_struct work;struct mlx5e_ktls_offload_context_tx *priv_tx;struct completion complete;int err;
Signature · 1 line
2.38.1
PATCH 12/15 net/mlx5e: kTLS, Remove unnecessary per-callback completion
In reply to Saeed MahameedFrom: Tariq Toukan <[email protected]>
Waiting on a completion object for each callback before cleaning up their async contexts is not necessary, as this is already implied in the mlx5_cmd_cleanup_async_ctx() API.
--- .../ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c +1 -13
@@ -127,7 +127,6 @@ struct mlx5e_async_ctx {struct mlx5_async_work context;struct mlx5_async_ctx async_ctx;struct mlx5e_ktls_offload_context_tx *priv_tx; -struct completion complete;int err;union {u32 out_create[MLX5_ST_SZ_DW (create_tis_out)];
@@ -148,7 +147,6 @@ static struct mlx5e_async_ctx *mlx5e_bulk_async_init(struct mlx5_core_dev *mdev,struct mlx5e_async_ctx *async = &bulk_async[i];mlx5_cmd_init_async_ctx (mdev, &async->async_ctx); -init_completion (&async->complete); }return bulk_async;
@@ -175,12 +173,10 @@ static void create_tis_callback(int status, struct mlx5_async_work *context)if (status) { async->err = status; priv_tx->create_err =1 ; - goto out; +return ; } priv_tx->tisn =MLX5_GET (create_tis_out, async->out_create, tisn); -out: -complete (&async->complete); }static void destroy_tis_callback (int status,struct mlx5_async_work *context)
@@ -189,7 +185,6 @@ static void destroy_tis_callback(int status, struct mlx5_async_work *context) container_of(context, struct mlx5e_async_ctx, context);struct mlx5e_ktls_offload_context_tx *priv_tx = async->priv_tx; -complete (&async->complete);kfree (priv_tx); }
@@ -231,7 +226,6 @@ static void mlx5e_tls_priv_tx_cleanup(struct mlx5e_ktls_offload_context_tx *priv struct mlx5e_async_ctx *async) {if (priv_tx->create_err) { -complete (&async->complete);kfree (priv_tx);return ; }
@@ -259,11 +253,6 @@ static void mlx5e_tls_priv_tx_list_cleanup(struct mlx5_core_dev *mdev, i++; } -for (i =0 ; i < size; i++) { -struct mlx5e_async_ctx *async = &bulk_async[i]; - -wait_for_completion (&async->complete); - }mlx5e_bulk_async_cleanup (bulk_async, size); }
@@ -310,7 +299,6 @@ static void create_work(struct work_struct *work)for (j =0 ; j < i; j++) {struct mlx5e_async_ctx *async = &bulk_async[j]; -wait_for_completion (&async->complete);if (!err && async->err) err = async->err; }
Signature · 1 line
2.38.1
PATCH 13/15 net/mlx5e: kTLS, Use a single async context object per a callback bulk
In reply to Saeed MahameedFrom: Tariq Toukan <[email protected]>
A single async context object is sufficient to wait for the completions of many callbacks. Switch to using one instance per a bulk of commands.
--- .../mellanox/mlx5/core/en_accel/ktls_tx.c | 50 +++++++++---------- 1 file changed, 25 insertions(+), 25 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c +25 -25
@@ -125,7 +125,7 @@ mlx5e_get_ktls_tx_priv_ctx(struct tls_context *tls_ctx)/* struct for callback API management */ struct mlx5e_async_ctx {struct mlx5_async_work context; -struct mlx5_async_ctx async_ctx; +struct mlx5_async_ctx *async_ctx;struct mlx5e_ktls_offload_context_tx *priv_tx;int err;union {
@@ -134,33 +134,33 @@ struct mlx5e_async_ctx { }; }; -static struct mlx5e_async_ctx *mlx5e_bulk_async_init (struct mlx5_core_dev *mdev,int n) +struct mlx5e_bulk_async_ctx { +struct mlx5_async_ctx async_ctx; + DECLARE_FLEX_ARRAY(struct mlx5e_async_ctx, arr); +}; + +static struct mlx5e_bulk_async_ctx *mlx5e_bulk_async_init (struct mlx5_core_dev *mdev,int n) { -struct mlx5e_async_ctx *bulk_async; +struct mlx5e_bulk_async_ctx *bulk_async; +int sz;int i; - bulk_async =kvcalloc (n,sizeof (struct mlx5e_async_ctx ),GFP_KERNEL ); + sz =struct_size (bulk_async, arr, n); + bulk_async =kvzalloc (sz,GFP_KERNEL );if (!bulk_async)return NULL ; -for (i =0 ; i < n; i++) { -struct mlx5e_async_ctx *async = &bulk_async[i]; +mlx5_cmd_init_async_ctx (mdev, &bulk_async->async_ctx); -mlx5_cmd_init_async_ctx (mdev, &async->async_ctx); - } +for (i =0 ; i < n; i++) + bulk_async->arr[i].async_ctx = &bulk_async->async_ctx;return bulk_async; } -static void mlx5e_bulk_async_cleanup (struct mlx5e_async_ctx *bulk_async,int n) +static void mlx5e_bulk_async_cleanup (struct mlx5e_bulk_async_ctx *bulk_async) { -int i; - -for (i =0 ; i < n; i++) { -struct mlx5e_async_ctx *async = &bulk_async[i]; - -mlx5_cmd_cleanup_async_ctx (&async->async_ctx); - } +mlx5_cmd_cleanup_async_ctx (&bulk_async->async_ctx);kvfree (bulk_async); }
@@ -208,7 +208,7 @@ mlx5e_tls_priv_tx_init(struct mlx5_core_dev *mdev, struct mlx5e_tls_sw_stats *sw goto err_out; }else { async->priv_tx = priv_tx; - err =mlx5e_ktls_create_tis_cb (mdev, &async->async_ctx, + err =mlx5e_ktls_create_tis_cb (mdev, async->async_ctx, async->out_create,sizeof (async->out_create), create_tis_callback, &async->context);if (err)
@@ -231,7 +231,7 @@ static void mlx5e_tls_priv_tx_cleanup(struct mlx5e_ktls_offload_context_tx *priv } async->priv_tx = priv_tx;mlx5e_ktls_destroy_tis_cb (priv_tx->mdev, priv_tx->tisn, - &async->async_ctx, + async->async_ctx, async->out_destroy,sizeof (async->out_destroy), destroy_tis_callback, &async->context); }
@@ -240,7 +240,7 @@ static void mlx5e_tls_priv_tx_list_cleanup(struct mlx5_core_dev *mdev, struct list_head *list, int size) {struct mlx5e_ktls_offload_context_tx *obj, *n; -struct mlx5e_async_ctx *bulk_async; +struct mlx5e_bulk_async_ctx *bulk_async;int i; bulk_async =mlx5e_bulk_async_init (mdev, size);
@@ -249,11 +249,11 @@ static void mlx5e_tls_priv_tx_list_cleanup(struct mlx5_core_dev *mdev, i =0 ;list_for_each_entry_safe (obj, n, list, list_node) { -mlx5e_tls_priv_tx_cleanup (obj, &bulk_async[i]); +mlx5e_tls_priv_tx_cleanup (obj, &bulk_async->arr[i]); i++; } -mlx5e_bulk_async_cleanup (bulk_async, size); +mlx5e_bulk_async_cleanup (bulk_async); }/* Recycling pool API */
@@ -279,7 +279,7 @@ static void create_work(struct work_struct *work)struct mlx5e_tls_tx_pool *pool = container_of(work, struct mlx5e_tls_tx_pool, create_work);struct mlx5e_ktls_offload_context_tx *obj; -struct mlx5e_async_ctx *bulk_async; +struct mlx5e_bulk_async_ctx *bulk_async;LIST_HEAD (local_list);int i, j, err =0 ;
@@ -288,7 +288,7 @@ static void create_work(struct work_struct *work)return ;for (i =0 ; i <MLX5E_TLS_TX_POOL_BULK ; i++) { - obj =mlx5e_tls_priv_tx_init (pool->mdev, pool->sw_stats, &bulk_async[i]); + obj =mlx5e_tls_priv_tx_init (pool->mdev, pool->sw_stats, &bulk_async->arr[i]);if (IS_ERR (obj)) { err =PTR_ERR (obj);break ;
@@ -297,13 +297,13 @@ static void create_work(struct work_struct *work) }for (j =0 ; j < i; j++) { -struct mlx5e_async_ctx *async = &bulk_async[j]; +struct mlx5e_async_ctx *async = &bulk_async->arr[j];if (!err && async->err) err = async->err; }atomic64_add (i, &pool->sw_stats->tx_tls_pool_alloc); -mlx5e_bulk_async_cleanup (bulk_async,MLX5E_TLS_TX_POOL_BULK ); +mlx5e_bulk_async_cleanup (bulk_async);if (err) goto err_out;
Signature · 1 line
2.38.1
PATCH 14/15 net/mlx5e: CT, optimize pre_ct table lookup
In reply to Saeed MahameedFrom: Oz Shlomo <[email protected]>
The pre_ct table realizes in hardware the act_ct cache logic, bypassing the CT table if the ct state was already set by a previous ct lookup. As such, the pre_ct table will always miss for chain 0 filters.
Optimize the pre_ct table lookup for rules installed on chain 0.
--- .../ethernet/mellanox/mlx5/core/en/tc_ct.c | 89 ++++++++++++------- 1 file changed, 56 insertions(+), 33 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c +56 -33
@@ -1774,35 +1774,42 @@ mlx5_tc_ct_del_ft_cb(struct mlx5_tc_ct_priv *ct_priv, struct mlx5_ct_ft *ft)/* We translate the tc filter with CT action to the following HW model: * -* +---------------------+ -* + ft prio (tc chain) + -* + original match + -* +---------------------+ -* | set chain miss mapping -* | set fte_id -* | set tunnel_id -* | do decap -* v -* +---------------------+ -* + pre_ct/pre_ct_nat + if matches +-------------------------+ -* + zone+nat match +---------------->+ post_act (see below) + -* +---------------------+ set zone +-------------------------+ -* | set zone -* v -* +--------------------+ -* + CT (nat or no nat) + -* + tuple + zone match + -* +--------------------+ -* | set mark -* | set labels_id -* | set established -* | set zone_restore -* | do nat (if needed) -* v -* +--------------+ -* + post_act + original filter actions -* + fte_id match +------------------------> -* +--------------+ +* +---------------------+ +* + ft prio (tc chain) + +* + original match + +* +---------------------+ +* | set chain miss mapping +* | set fte_id +* | set tunnel_id +* | do decap +* | +* +-------------+ +* | Chain 0 | +* | optimization| +* | v +* | +---------------------+ +* | + pre_ct/pre_ct_nat + if matches +----------------------+ +* | + zone+nat match +---------------->+ post_act (see below) + +* | +---------------------+ set zone +----------------------+ +* | | +* +-------------+ set zone +* | +* v +* +--------------------+ +* + CT (nat or no nat) + +* + tuple + zone match + +* +--------------------+ +* | set mark +* | set labels_id +* | set established +* | set zone_restore +* | do nat (if needed) +* v +* +--------------+ +* + post_act + original filter actions +* + fte_id match +------------------------> +* +--------------+ +* */ static struct mlx5_flow_handle * __mlx5_tc_ct_flow_offload(struct mlx5_tc_ct_priv *ct_priv,
@@ -1818,6 +1825,7 @@ __mlx5_tc_ct_flow_offload(struct mlx5_tc_ct_priv *ct_priv,struct mlx5_ct_flow *ct_flow;int chain_mapping =0 , err;struct mlx5_ct_ft *ft; +u16 zone; ct_flow =kzalloc (sizeof (*ct_flow),GFP_KERNEL );if (!ct_flow) {
@@ -1884,6 +1892,25 @@ __mlx5_tc_ct_flow_offload(struct mlx5_tc_ct_priv *ct_priv, } } +/* Change original rule point to ct table +* Chain 0 sets the zone and jumps to ct table +* Other chains jump to pre_ct table to align with act_ct cached logic +*/ + pre_ct_attr->dest_chain =0 ; +if (!attr->chain) { + zone = ft->zone &MLX5_CT_ZONE_MASK ; + err =mlx5e_tc_match_to_reg_set (priv->mdev, pre_mod_acts, ct_priv->ns_type, +ZONE_TO_REG , zone); +if (err) { +ct_dbg ("Failed to set zone register mapping" ); + goto err_mapping; + } + + pre_ct_attr->dest_ft = nat ? ct_priv->ct_nat : ct_priv->ct; + }else { + pre_ct_attr->dest_ft = nat ? ft->pre_ct_nat.ft : ft->pre_ct.ft; + } + mod_hdr =mlx5_modify_header_alloc (priv->mdev, ct_priv->ns_type, pre_mod_acts->num_actions, pre_mod_acts->actions);
@@ -1893,10 +1920,6 @@ __mlx5_tc_ct_flow_offload(struct mlx5_tc_ct_priv *ct_priv, goto err_mapping; } pre_ct_attr->modify_hdr = mod_hdr; - -/* Change original rule point to ct table */ - pre_ct_attr->dest_chain =0 ; - pre_ct_attr->dest_ft = nat ? ft->pre_ct_nat.ft : ft->pre_ct.ft; ct_flow->pre_ct_rule =mlx5_tc_rule_insert (priv, orig_spec, pre_ct_attr);if (IS_ERR (ct_flow->pre_ct_rule)) {
Signature · 1 line
2.38.1
PATCH 15/15 net/mlx5e: ethtool: get_link_ext_stats for PHY down events
In reply to Saeed MahameedFrom: Saeed Mahameed <[email protected]>
Implement ethtool_op get_link_ext_stats for PHY down events
--- .../ethernet/mellanox/mlx5/core/en_ethtool.c | 1 + .../net/ethernet/mellanox/mlx5/core/en_stats.c | 17 +++++++++++++++++ .../net/ethernet/mellanox/mlx5/core/en_stats.h | 2 ++ 3 files changed, 20 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +1 -0
@@ -2463,4 +2463,5 @@ const struct ethtool_ops mlx5e_ethtool_ops = { .get_eth_mac_stats = mlx5e_get_eth_mac_stats, .get_eth_ctrl_stats = mlx5e_get_eth_ctrl_stats, .get_rmon_stats = mlx5e_get_rmon_stats, + .get_link_ext_stats = mlx5e_get_link_ext_stats };
drivers/net/ethernet/mellanox/mlx5/core/en_stats.c +17 -0
@@ -1241,6 +1241,23 @@ static MLX5E_DECLARE_STATS_GRP_OP_UPDATE_STATS(phy)mlx5_core_access_reg (mdev, in, sz, out, sz,MLX5_REG_PPCNT ,0 ,0 ); } +void mlx5e_get_link_ext_stats (struct net_device *dev, +struct ethtool_link_ext_stats *stats) +{ +struct mlx5e_priv *priv =netdev_priv (dev); +u32 out[MLX5_ST_SZ_DW (ppcnt_reg)] = {}; +u32 in[MLX5_ST_SZ_DW (ppcnt_reg)] = {}; +int sz =MLX5_ST_SZ_BYTES (ppcnt_reg); + +MLX5_SET (ppcnt_reg, in, local_port,1 ); +MLX5_SET (ppcnt_reg, in, grp,MLX5_PHYSICAL_LAYER_COUNTERS_GROUP ); +mlx5_core_access_reg (priv->mdev, in, sz, out, +MLX5_ST_SZ_BYTES (ppcnt_reg),MLX5_REG_PPCNT ,0 ,0 ); + + stats->link_down_events =MLX5_GET (ppcnt_reg, out, + counter_set.phys_layer_cntrs.link_down_events); +} +static int fec_num_lanes (struct mlx5_core_dev *dev) {u32 out[MLX5_ST_SZ_DW (pmlp_reg)] = {};
drivers/net/ethernet/mellanox/mlx5/core/en_stats.h +2 -0
@@ -126,6 +126,8 @@ void mlx5e_stats_eth_ctrl_get(struct mlx5e_priv *priv,void mlx5e_stats_rmon_get (struct mlx5e_priv *priv,struct ethtool_rmon_stats *rmon,const struct ethtool_rmon_hist_range **ranges); +void mlx5e_get_link_ext_stats (struct net_device *dev, +struct ethtool_link_ext_stats *stats);/* Concrete NIC Stats */
Signature · 1 line
2.38.1