mlx5 updates 2021-03-24
From: Saeed Mahameed <[email protected]>
Hi Dave/Jakub,
This series provides update to mlx5 netdev driver, mostly refactoring. 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 9a255a0635fedda1499635f1c324347b9600ce70:
Merge git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next (2021-03-22 17:07:30 -0700)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux.git tags/mlx5-updates-2021-03-24
for you to fetch changes up to f926b20c0cb5b800d1d4a300d5d4270079aefaa6:
net/mlx5: Fix spelling mistakes in mlx5_core_info message (2021-03-24 22:02:55 -0700)
----------------------------------------------------------------
mlx5-updates-2021-03-24
mlx5e netdev driver updates:
1) Some cleanups from Colin, Tariq and Saeed.
2) Yevgeny Fixes a potential shift wrapping of 32-bit value
3) Aya made some trivial refactoring to cleanup and generalize PTP and RQ (Receive Queue) creation and management.
Mostly code decoupling and reducing dependencies between the different RX objects in the netdev driver.
This is a preparation series for upcoming PTP special RQ creation which will allow coexistence of CQE compression (important performance feature, especially in Multihost systems) and HW TS PTP.
----------------------------------------------------------------
Aya Levin (8):
net/mlx5e: Allow creating mpwqe info without channel net/mlx5: Add helper to set time-stamp translator on a queue net/mlx5e: Generalize open RQ
net/mlx5e: Generalize RQ activation
net/mlx5e: Generalize close RQ
net/mlx5e: Generalize direct-TIRs and direct-RQTs API net/mlx5e: Generalize PTP implementation net/mlx5e: Cleanup PTP
Colin Ian King (1):
net/mlx5: Fix spelling mistakes in mlx5_core_info message
Saeed Mahameed (1):
net/mlx5e: alloc the correct size for indirection_rqt
Tariq Toukan (4):
net/mlx5e: Enforce minimum value check for ICOSQ size net/mlx5e: Pass q_counter indentifier as parameter to rq_param builders net/mlx5e: Move params logic into its dedicated file net/mlx5e: Restrict usage of mlx5e_priv in params logic functions
Yevgeny Kliteynik (1):
net/mlx5: DR, Fix potential shift wrapping of 32-bit value in STEv1 getter
drivers/net/ethernet/mellanox/mlx5/core/en.h | 36 +- .../net/ethernet/mellanox/mlx5/core/en/params.c | 484 ++++++++++++++- .../net/ethernet/mellanox/mlx5/core/en/params.h | 44 +- drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c | 69 ++- drivers/net/ethernet/mellanox/mlx5/core/en/ptp.h | 20 +- drivers/net/ethernet/mellanox/mlx5/core/en/qos.c | 4 +- .../ethernet/mellanox/mlx5/core/en/reporter_tx.c | 8 +- drivers/net/ethernet/mellanox/mlx5/core/en/trap.c | 199 ++---- .../net/ethernet/mellanox/mlx5/core/en/xsk/setup.c | 56 +- .../net/ethernet/mellanox/mlx5/core/en_ethtool.c | 4 +- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 673 ++++----------------- drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 16 +- drivers/net/ethernet/mellanox/mlx5/core/en_stats.c | 18 +- drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 4 +- drivers/net/ethernet/mellanox/mlx5/core/en_tx.c | 2 +- drivers/net/ethernet/mellanox/mlx5/core/health.c | 2 +- .../net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c | 16 +- .../net/ethernet/mellanox/mlx5/core/lib/clock.h | 11 + .../mellanox/mlx5/core/steering/dr_ste_v1.c | 4 +- 19 files changed, 813 insertions(+), 857 deletions(-)
PATCH 1/15 net/mlx5e: Enforce minimum value check for ICOSQ size
From: Tariq Toukan <[email protected]>
The ICOSQ size should not go below MLX5E_PARAMS_MINIMUM_LOG_SQ_SIZE. Enforce this where it's missing.
--- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +3 -2
@@ -2368,8 +2368,9 @@ static u8 mlx5e_build_icosq_log_wq_sz(struct mlx5e_params *params, {switch (params->rq_wq_type) {case MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ : -return order_base_2 (MLX5E_UMR_WQEBBS ) + -mlx5e_get_rq_log_wq_sz (rqp->rqc); +return max_t (u8,MLX5E_PARAMS_MINIMUM_LOG_SQ_SIZE , +order_base_2 (MLX5E_UMR_WQEBBS ) + +mlx5e_get_rq_log_wq_sz (rqp->rqc));default :/* MLX5_WQ_TYPE_CYCLIC */ return MLX5E_PARAMS_MINIMUM_LOG_SQ_SIZE ; }
Signature · 1 line
2.30.2
PATCH 2/15 net/mlx5: DR, Fix potential shift wrapping of 32-bit value in STEv1 getter
In reply to Saeed MahameedFrom: Yevgeny Kliteynik <[email protected]>
Fix 32-bit variable shift wrapping in dr_ste_v1_get_miss_addr.
--- drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste_v1.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste_v1.c +2 -2
@@ -264,8 +264,8 @@ static void dr_ste_v1_set_miss_addr(u8 *hw_ste_p, u64 miss_addr)static u64 dr_ste_v1_get_miss_addr (u8 *hw_ste_p) {u64 index = - (MLX5_GET (ste_match_bwc_v1, hw_ste_p, miss_address_31_6) | -MLX5_GET (ste_match_bwc_v1, hw_ste_p, miss_address_39_32) <<26 ); + ((u64 )MLX5_GET (ste_match_bwc_v1, hw_ste_p, miss_address_31_6) | + ((u64 )MLX5_GET (ste_match_bwc_v1, hw_ste_p, miss_address_39_32)) <<26 );return index <<6 ; }
Signature · 1 line
2.30.2
PATCH 3/15 net/mlx5e: alloc the correct size for indirection_rqt
In reply to Saeed MahameedFrom: Saeed Mahameed <[email protected]>
The cited patch allocated the wrong size for the indirection_rqt table, fix that.
--- drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +2 -2
@@ -447,11 +447,11 @@ static void mlx5e_hairpin_destroy_transport(struct mlx5e_hairpin *hp)static int mlx5e_hairpin_fill_rqt_rqns (struct mlx5e_hairpin *hp,void *rqtc) { -u32 *indirection_rqt, rqn;struct mlx5e_priv *priv = hp->func_priv;int i, ix, sz =MLX5E_INDIR_RQT_SIZE ; +u32 *indirection_rqt, rqn; - indirection_rqt =kzalloc (sz,GFP_KERNEL ); + indirection_rqt =kcalloc (sz,sizeof (*indirection_rqt),GFP_KERNEL );if (!indirection_rqt)return -ENOMEM ;
Signature · 1 line
2.30.2
PATCH 4/15 net/mlx5e: Pass q_counter indentifier as parameter to rq_param builders
In reply to Saeed MahameedFrom: Tariq Toukan <[email protected]>
Pass q_counter idintifier, instead of reading it from mlx5e_priv parameter.
This is a step towards removing the mlx5e_priv parameter from all params function and logic in the next patches of the series.
--- drivers/net/ethernet/mellanox/mlx5/core/en/params.h | 1 + drivers/net/ethernet/mellanox/mlx5/core/en/trap.c | 2 +- .../net/ethernet/mellanox/mlx5/core/en/xsk/setup.c | 2 +- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 13 ++++++++----- 4 files changed, 11 insertions(+), 7 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en/params.h +1 -0
@@ -115,6 +115,7 @@ void mlx5e_build_create_cq_param(struct mlx5e_create_cq_param *ccp, struct mlx5evoid mlx5e_build_rq_param (struct mlx5e_priv *priv,struct mlx5e_params *params,struct mlx5e_xsk_param *xsk, +u16 q_counter,struct mlx5e_rq_param *param);void mlx5e_build_sq_param_common (struct mlx5e_priv *priv,struct mlx5e_sq_param *param);
drivers/net/ethernet/mellanox/mlx5/core/en/trap.c +1 -1
@@ -245,7 +245,7 @@ static void mlx5e_build_trap_params(struct mlx5e_priv *priv, struct mlx5e_trap * params->rq_wq_type =MLX5_WQ_TYPE_CYCLIC ;mlx5e_init_rq_type_params (priv->mdev, params); params->sw_mtu = priv->netdev->max_mtu; -mlx5e_build_rq_param (priv, params,NULL , &t->rq_param); +mlx5e_build_rq_param (priv, params,NULL , priv->q_counter, &t->rq_param); }static struct mlx5e_trap *mlx5e_open_trap (struct mlx5e_priv *priv)
drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c +1 -1
@@ -40,7 +40,7 @@ static void mlx5e_build_xsk_cparam(struct mlx5e_priv *priv,struct mlx5e_xsk_param *xsk, struct mlx5e_channel_param *cparam) { - mlx5e_build_rq_param(priv, params, xsk, &cparam->rq); + mlx5e_build_rq_param(priv, params, xsk, priv->q_counter, &cparam->rq);mlx5e_build_xdpsq_param (priv, params, &cparam->xdp_sq); }
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +8 -5
@@ -2190,6 +2190,7 @@ static u8 mlx5e_get_rq_log_wq_sz(void *rqc)void mlx5e_build_rq_param (struct mlx5e_priv *priv,struct mlx5e_params *params,struct mlx5e_xsk_param *xsk, +u16 q_counter,struct mlx5e_rq_param *param) {struct mlx5_core_dev *mdev = priv->mdev;
@@ -2218,7 +2219,7 @@ void mlx5e_build_rq_param(struct mlx5e_priv *priv,MLX5_SET (wq, wq, log_wq_stride,mlx5e_get_rqwq_log_stride (params->rq_wq_type, ndsegs));MLX5_SET (wq, wq, pd, mdev->mlx5e_res.hw_objs.pdn); -MLX5_SET (rqc, rqc, counter_set_id, priv->q_counter); +MLX5_SET (rqc, rqc, counter_set_id, q_counter);MLX5_SET (rqc, rqc, vsd, params->vlan_strip_disable);MLX5_SET (rqc, rqc, scatter_fcs, params->scatter_fcs_en);
@@ -2227,6 +2228,7 @@ void mlx5e_build_rq_param(struct mlx5e_priv *priv, }static void mlx5e_build_drop_rq_param (struct mlx5e_priv *priv, +u16 q_counter,struct mlx5e_rq_param *param) {struct mlx5_core_dev *mdev = priv->mdev;
@@ -2236,7 +2238,7 @@ static void mlx5e_build_drop_rq_param(struct mlx5e_priv *priv,MLX5_SET (wq, wq, wq_type,MLX5_WQ_TYPE_CYCLIC );MLX5_SET (wq, wq, log_wq_stride,mlx5e_get_rqwq_log_stride (MLX5_WQ_TYPE_CYCLIC ,1 )); -MLX5_SET (rqc, rqc, counter_set_id, priv->drop_rq_q_counter); +MLX5_SET (rqc, rqc, counter_set_id, q_counter); param->wq.buf_numa_node =dev_to_node (mlx5_core_dma_dev (mdev)); }
@@ -2386,11 +2388,12 @@ static u8 mlx5e_build_async_icosq_log_wq_sz(struct net_device *netdev)static void mlx5e_build_channel_param (struct mlx5e_priv *priv,struct mlx5e_params *params, +u16 q_counter,struct mlx5e_channel_param *cparam) {u8 icosq_log_wq_sz, async_icosq_log_wq_sz; -mlx5e_build_rq_param (priv, params,NULL , &cparam->rq); +mlx5e_build_rq_param (priv, params,NULL , q_counter, &cparam->rq); icosq_log_wq_sz =mlx5e_build_icosq_log_wq_sz (params, &cparam->rq); async_icosq_log_wq_sz =mlx5e_build_async_icosq_log_wq_sz (priv->netdev);
@@ -2415,7 +2418,7 @@ int mlx5e_open_channels(struct mlx5e_priv *priv,if (!chs->c || !cparam) goto err_free; -mlx5e_build_channel_param (priv, &chs->params, cparam); +mlx5e_build_channel_param (priv, &chs->params, priv->q_counter, cparam);for (i =0 ; i < chs->num; i++) {struct xsk_buff_pool *xsk_pool =NULL ;
@@ -3374,7 +3377,7 @@ int mlx5e_open_drop_rq(struct mlx5e_priv *priv,struct mlx5e_cq *cq = &drop_rq->cq;int err; -mlx5e_build_drop_rq_param (priv, &rq_param); +mlx5e_build_drop_rq_param (priv, priv->drop_rq_q_counter, &rq_param); err =mlx5e_alloc_drop_cq (priv, cq, &cq_param);if (err)
Signature · 1 line
2.30.2
PATCH 5/15 net/mlx5e: Move params logic into its dedicated file
In reply to Saeed MahameedFrom: Tariq Toukan <[email protected]>
Take params logic out of en_main.c, into the dedicated params.c. Some functions are now hidden and become static.
No functional change here.
--- drivers/net/ethernet/mellanox/mlx5/core/en.h | 12 - .../ethernet/mellanox/mlx5/core/en/params.c | 478 +++++++++++++++++- .../ethernet/mellanox/mlx5/core/en/params.h | 30 +- .../net/ethernet/mellanox/mlx5/core/en_main.c | 454 ----------------- .../net/ethernet/mellanox/mlx5/core/en_rep.c | 1 + .../ethernet/mellanox/mlx5/core/ipoib/ipoib.c | 1 + 6 files changed, 495 insertions(+), 481 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en.h +0 -12
@@ -918,8 +918,6 @@ struct mlx5e_profile {void mlx5e_build_ptys2ethtool_map (void );bool mlx5e_check_fragmented_striding_rq_cap (struct mlx5_core_dev *mdev); -bool mlx5e_striding_rq_possible (struct mlx5_core_dev *mdev, -struct mlx5e_params *params);void mlx5e_get_stats (struct net_device *dev,struct rtnl_link_stats64 *stats);void mlx5e_fold_sw_stats64 (struct mlx5e_priv *priv,struct rtnl_link_stats64 *s);
@@ -1023,14 +1021,6 @@ void mlx5e_deactivate_priv_channels(struct mlx5e_priv *priv);void mlx5e_build_default_indir_rqt (u32 *indirection_rqt,int len,int num_channels); -void mlx5e_reset_tx_moderation (struct mlx5e_params *params,u8 cq_period_mode); -void mlx5e_reset_rx_moderation (struct mlx5e_params *params,u8 cq_period_mode); -void mlx5e_set_tx_cq_mode_params (struct mlx5e_params *params,u8 cq_period_mode); -void mlx5e_set_rx_cq_mode_params (struct mlx5e_params *params,u8 cq_period_mode); - -void mlx5e_set_rq_type (struct mlx5_core_dev *mdev,struct mlx5e_params *params); -void mlx5e_init_rq_type_params (struct mlx5_core_dev *mdev, -struct mlx5e_params *params);int mlx5e_modify_rq_state (struct mlx5e_rq *rq,int curr_state,int next_state);void mlx5e_activate_rq (struct mlx5e_rq *rq);void mlx5e_deactivate_rq (struct mlx5e_rq *rq);
@@ -1176,8 +1166,6 @@ int mlx5e_netdev_change_profile(struct mlx5e_priv *priv,void mlx5e_netdev_attach_nic_profile (struct mlx5e_priv *priv);void mlx5e_set_netdev_mtu_boundaries (struct mlx5e_priv *priv);void mlx5e_build_nic_params (struct mlx5e_priv *priv,struct mlx5e_xsk *xsk,u16 mtu); -void mlx5e_build_rq_params (struct mlx5_core_dev *mdev, -struct mlx5e_params *params);void mlx5e_build_rss_params (struct mlx5e_rss_params *rss_params,u16 num_channels);void mlx5e_rx_dim_work (struct work_struct *work);
drivers/net/ethernet/mellanox/mlx5/core/en/params.c +475 -3
493 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/en/params.h +18 -12
@@ -84,12 +84,21 @@ static inline bool mlx5e_qid_validate(const struct mlx5e_profile *profile,/* Parameter calculations */ +void mlx5e_reset_tx_moderation (struct mlx5e_params *params,u8 cq_period_mode); +void mlx5e_reset_rx_moderation (struct mlx5e_params *params,u8 cq_period_mode); +void mlx5e_set_tx_cq_mode_params (struct mlx5e_params *params,u8 cq_period_mode); +void mlx5e_set_rx_cq_mode_params (struct mlx5e_params *params,u8 cq_period_mode); + +bool slow_pci_heuristic (struct mlx5_core_dev *mdev); +bool mlx5e_striding_rq_possible (struct mlx5_core_dev *mdev,struct mlx5e_params *params); +void mlx5e_build_rq_params (struct mlx5_core_dev *mdev,struct mlx5e_params *params); +void mlx5e_set_rq_type (struct mlx5_core_dev *mdev,struct mlx5e_params *params); +void mlx5e_init_rq_type_params (struct mlx5_core_dev *mdev,struct mlx5e_params *params); +u16 mlx5e_get_linear_rq_headroom (struct mlx5e_params *params,struct mlx5e_xsk_param *xsk);u32 mlx5e_rx_get_min_frag_sz (struct mlx5e_params *params,struct mlx5e_xsk_param *xsk); -u32 mlx5e_rx_get_linear_frag_sz (struct mlx5e_params *params, -struct mlx5e_xsk_param *xsk);u8 mlx5e_mpwqe_log_pkts_per_wqe (struct mlx5e_params *params,struct mlx5e_xsk_param *xsk); bool mlx5e_rx_is_linear_skb(struct mlx5e_params *params,
@@ -117,26 +126,23 @@ void mlx5e_build_rq_param(struct mlx5e_priv *priv,struct mlx5e_xsk_param *xsk, u16 q_counter, struct mlx5e_rq_param *param); +void mlx5e_build_drop_rq_param (struct mlx5e_priv *priv, +u16 q_counter, +struct mlx5e_rq_param *param);void mlx5e_build_sq_param_common (struct mlx5e_priv *priv,struct mlx5e_sq_param *param);void mlx5e_build_sq_param (struct mlx5e_priv *priv,struct mlx5e_params *params,struct mlx5e_sq_param *param); -void mlx5e_build_rx_cq_param (struct mlx5e_priv *priv, -struct mlx5e_params *params, -struct mlx5e_xsk_param *xsk, -struct mlx5e_cq_param *param);void mlx5e_build_tx_cq_param (struct mlx5e_priv *priv,struct mlx5e_params *params,struct mlx5e_cq_param *param); -void mlx5e_build_ico_cq_param (struct mlx5e_priv *priv, -u8 log_wq_size, -struct mlx5e_cq_param *param); -void mlx5e_build_icosq_param (struct mlx5e_priv *priv, -u8 log_wq_size, -struct mlx5e_sq_param *param);void mlx5e_build_xdpsq_param (struct mlx5e_priv *priv,struct mlx5e_params *params,struct mlx5e_sq_param *param); +void mlx5e_build_channel_param (struct mlx5e_priv *priv, +struct mlx5e_params *params, +u16 q_counter, +struct mlx5e_channel_param *cparam);u16 mlx5e_calc_sq_stop_room (struct mlx5_core_dev *mdev,struct mlx5e_params *params);int mlx5e_validate_params (struct mlx5e_priv *priv,struct mlx5e_params *params);
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +0 -454
484 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +1 -0
@@ -40,6 +40,7 @@#include "eswitch.h" #include "en.h" #include "en_rep.h" +#include "en/params.h" #include "en/txrx.h" #include "en_tc.h" #include "en/rep/tc.h"
drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c +1 -0
@@ -33,6 +33,7 @@#include <rdma/ib_verbs.h> #include <linux/mlx5/fs.h> #include "en.h" +#include "en/params.h" #include "ipoib.h" #define IB_DEFAULT_Q_KEY 0xb1b
Signature · 1 line
2.30.2
PATCH 7/15 net/mlx5e: Allow creating mpwqe info without channel
In reply to Saeed MahameedFrom: Aya Levin <[email protected]>
Change the signature of mlx5e_rq_alloc_mpwqe_info from receiving channel pointer to receive the NUMA node. This allows creating mpwqe_info in context of different channels types.
--- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +4 -5
@@ -214,18 +214,17 @@ static inline void mlx5e_build_umr_wqe(struct mlx5e_rq *rq, ucseg->mkey_mask =cpu_to_be64 (MLX5_MKEY_MASK_FREE ); } -static int mlx5e_rq_alloc_mpwqe_info (struct mlx5e_rq *rq, -struct mlx5e_channel *c) +static int mlx5e_rq_alloc_mpwqe_info (struct mlx5e_rq *rq,int node) {int wq_sz =mlx5_wq_ll_get_size (&rq->mpwqe.wq); rq->mpwqe.info =kvzalloc_node (array_size (wq_sz,sizeof (*rq->mpwqe.info)), -GFP_KERNEL ,cpu_to_node (c->cpu)); +GFP_KERNEL , node);if (!rq->mpwqe.info)return -ENOMEM ; -mlx5e_build_umr_wqe (rq, &c->icosq, &rq->mpwqe.umr_wqe); +mlx5e_build_umr_wqe (rq, rq->icosq, &rq->mpwqe.umr_wqe);return 0 ; }
@@ -459,7 +458,7 @@ static int mlx5e_alloc_rq(struct mlx5e_channel *c, goto err_rq_drop_page; rq->mkey_be =cpu_to_be32 (rq->umr_mkey.key); - err =mlx5e_rq_alloc_mpwqe_info (rq, c); + err =mlx5e_rq_alloc_mpwqe_info (rq,cpu_to_node (c->cpu));if (err) goto err_rq_mkey;break ;
Signature · 1 line
2.30.2
PATCH 6/15 net/mlx5e: Restrict usage of mlx5e_priv in params logic functions
In reply to Saeed MahameedFrom: Tariq Toukan <[email protected]>
Do not use generic struct mlx5e_priv as a parameter to param functions, as it is too generic. All calculations of the channel's param should be mainly based on struct mlx5_core_dev and struct mlx5e_params. Additional info can be explicitly passed.
--- .../ethernet/mellanox/mlx5/core/en/params.c | 94 +++++++++---------- .../ethernet/mellanox/mlx5/core/en/params.h | 17 ++-- .../net/ethernet/mellanox/mlx5/core/en/ptp.c | 8 +- .../net/ethernet/mellanox/mlx5/core/en/qos.c | 4 +- .../net/ethernet/mellanox/mlx5/core/en/trap.c | 12 ++- .../mellanox/mlx5/core/en/xsk/setup.c | 9 +- .../ethernet/mellanox/mlx5/core/en_ethtool.c | 2 +- .../net/ethernet/mellanox/mlx5/core/en_main.c | 6 +- 8 files changed, 77 insertions(+), 75 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en/params.c +46 -48
@@ -174,15 +174,15 @@ u16 mlx5e_calc_sq_stop_room(struct mlx5_core_dev *mdev, struct mlx5e_params *parreturn stop_room; } -int mlx5e_validate_params (struct mlx5e_priv *priv,struct mlx5e_params *params) +int mlx5e_validate_params (struct mlx5_core_dev *mdev,struct mlx5e_params *params) {size_t sq_size =1 << params->log_sq_size;u16 stop_room; - stop_room =mlx5e_calc_sq_stop_room (priv->mdev, params); + stop_room =mlx5e_calc_sq_stop_room (mdev, params);if (stop_room >= sq_size) { -netdev_err (priv->netdev,"Stop room %u is bigger than the SQ size %zu\n" , - stop_room, sq_size); +mlx5_core_err (mdev,"Stop room %u is bigger than the SQ size %zu\n" , + stop_room, sq_size);return -EINVAL ; }
@@ -421,22 +421,21 @@ static inline u8 mlx5e_get_rqwq_log_stride(u8 wq_type, int ndsegs)return order_base_2 (sz); } -static void mlx5e_build_common_cq_param (struct mlx5e_priv *priv, +static void mlx5e_build_common_cq_param (struct mlx5_core_dev *mdev,struct mlx5e_cq_param *param) {void *cqc = param->cqc; -MLX5_SET (cqc, cqc, uar_page, priv->mdev->priv.uar->index); -if (MLX5_CAP_GEN (priv->mdev, cqe_128_always) &&cache_line_size () >=128 ) +MLX5_SET (cqc, cqc, uar_page, mdev->priv.uar->index); +if (MLX5_CAP_GEN (mdev, cqe_128_always) &&cache_line_size () >=128 )MLX5_SET (cqc, cqc, cqe_sz,CQE_STRIDE_128_PAD ); } -static void mlx5e_build_rx_cq_param (struct mlx5e_priv *priv, +static void mlx5e_build_rx_cq_param (struct mlx5_core_dev *mdev,struct mlx5e_params *params,struct mlx5e_xsk_param *xsk,struct mlx5e_cq_param *param) { -struct mlx5_core_dev *mdev = priv->mdev;bool hw_stridx = false;void *cqc = param->cqc;u8 log_cq_size;
@@ -458,17 +457,16 @@ static void mlx5e_build_rx_cq_param(struct mlx5e_priv *priv,MLX5_SET (cqc, cqc, cqe_comp_en,1 ); } -mlx5e_build_common_cq_param (priv, param); +mlx5e_build_common_cq_param (mdev, param); param->cq_period_mode = params->rx_cq_moderation.cq_period_mode; } -void mlx5e_build_rq_param (struct mlx5e_priv *priv, +void mlx5e_build_rq_param (struct mlx5_core_dev *mdev,struct mlx5e_params *params,struct mlx5e_xsk_param *xsk,u16 q_counter,struct mlx5e_rq_param *param) { -struct mlx5_core_dev *mdev = priv->mdev;void *rqc = param->rqc;void *wq =MLX5_ADDR_OF (rqc, rqc, wq);int ndsegs =1 ;
@@ -499,14 +497,13 @@ void mlx5e_build_rq_param(struct mlx5e_priv *priv,MLX5_SET (rqc, rqc, scatter_fcs, params->scatter_fcs_en); param->wq.buf_numa_node =dev_to_node (mlx5_core_dma_dev (mdev)); -mlx5e_build_rx_cq_param (priv, params, xsk, ¶m->cqp); +mlx5e_build_rx_cq_param (mdev, params, xsk, ¶m->cqp); } -void mlx5e_build_drop_rq_param (struct mlx5e_priv *priv, +void mlx5e_build_drop_rq_param (struct mlx5_core_dev *mdev,u16 q_counter,struct mlx5e_rq_param *param) { -struct mlx5_core_dev *mdev = priv->mdev;void *rqc = param->rqc;void *wq =MLX5_ADDR_OF (rqc, rqc, wq);
@@ -518,7 +515,7 @@ void mlx5e_build_drop_rq_param(struct mlx5e_priv *priv, param->wq.buf_numa_node =dev_to_node (mlx5_core_dma_dev (mdev)); } -void mlx5e_build_tx_cq_param (struct mlx5e_priv *priv, +void mlx5e_build_tx_cq_param (struct mlx5_core_dev *mdev,struct mlx5e_params *params,struct mlx5e_cq_param *param) {
@@ -526,40 +523,41 @@ void mlx5e_build_tx_cq_param(struct mlx5e_priv *priv,MLX5_SET (cqc, cqc, log_cq_size, params->log_sq_size); -mlx5e_build_common_cq_param (priv, param); +mlx5e_build_common_cq_param (mdev, param); param->cq_period_mode = params->tx_cq_moderation.cq_period_mode; } -void mlx5e_build_sq_param_common (struct mlx5e_priv *priv, +void mlx5e_build_sq_param_common (struct mlx5_core_dev *mdev,struct mlx5e_sq_param *param) {void *sqc = param->sqc;void *wq =MLX5_ADDR_OF (sqc, sqc, wq);MLX5_SET (wq, wq, log_wq_stride,ilog2 (MLX5_SEND_WQE_BB )); -MLX5_SET (wq, wq, pd, priv->mdev->mlx5e_res.hw_objs.pdn); +MLX5_SET (wq, wq, pd, mdev->mlx5e_res.hw_objs.pdn); - param->wq.buf_numa_node =dev_to_node (mlx5_core_dma_dev (priv->mdev)); + param->wq.buf_numa_node =dev_to_node (mlx5_core_dma_dev (mdev)); } -void mlx5e_build_sq_param (struct mlx5e_priv *priv,struct mlx5e_params *params, +void mlx5e_build_sq_param (struct mlx5_core_dev *mdev, +struct mlx5e_params *params,struct mlx5e_sq_param *param) {void *sqc = param->sqc;void *wq =MLX5_ADDR_OF (sqc, sqc, wq);bool allow_swp; - allow_swp =mlx5_geneve_tx_allowed (priv->mdev) || - !!MLX5_IPSEC_DEV (priv->mdev); -mlx5e_build_sq_param_common (priv, param); + allow_swp =mlx5_geneve_tx_allowed (mdev) || + !!MLX5_IPSEC_DEV (mdev); +mlx5e_build_sq_param_common (mdev, param);MLX5_SET (wq, wq, log_wq_sz, params->log_sq_size);MLX5_SET (sqc, sqc, allow_swp, allow_swp); param->is_mpw =MLX5E_GET_PFLAG (params,MLX5E_PFLAG_SKB_TX_MPWQE ); - param->stop_room =mlx5e_calc_sq_stop_room (priv->mdev, params); -mlx5e_build_tx_cq_param (priv, params, ¶m->cqp); + param->stop_room =mlx5e_calc_sq_stop_room (mdev, params); +mlx5e_build_tx_cq_param (mdev, params, ¶m->cqp); } -static void mlx5e_build_ico_cq_param (struct mlx5e_priv *priv, +static void mlx5e_build_ico_cq_param (struct mlx5_core_dev *mdev,u8 log_wq_size,struct mlx5e_cq_param *param) {
@@ -567,7 +565,7 @@ static void mlx5e_build_ico_cq_param(struct mlx5e_priv *priv,MLX5_SET (cqc, cqc, log_cq_size, log_wq_size); -mlx5e_build_common_cq_param (priv, param); +mlx5e_build_common_cq_param (mdev, param); param->cq_period_mode =DIM_CQ_PERIOD_MODE_START_FROM_EQE ; }
@@ -592,69 +590,69 @@ static u8 mlx5e_build_icosq_log_wq_sz(struct mlx5e_params *params, } } -static u8 mlx5e_build_async_icosq_log_wq_sz (struct net_device *netdev) +static u8 mlx5e_build_async_icosq_log_wq_sz (struct mlx5_core_dev *mdev) { -if (netdev->hw_features &NETIF_F_HW_TLS_RX ) +if (mlx5_accel_is_ktls_rx (mdev))return MLX5E_PARAMS_DEFAULT_LOG_SQ_SIZE ;return MLX5E_PARAMS_MINIMUM_LOG_SQ_SIZE ; } -static void mlx5e_build_icosq_param (struct mlx5e_priv *priv, +static void mlx5e_build_icosq_param (struct mlx5_core_dev *mdev,u8 log_wq_size,struct mlx5e_sq_param *param) {void *sqc = param->sqc;void *wq =MLX5_ADDR_OF (sqc, sqc, wq); -mlx5e_build_sq_param_common (priv, param); +mlx5e_build_sq_param_common (mdev, param);MLX5_SET (wq, wq, log_wq_sz, log_wq_size); -MLX5_SET (sqc, sqc, reg_umr,MLX5_CAP_ETH (priv->mdev, reg_umr_sq)); -mlx5e_build_ico_cq_param (priv, log_wq_size, ¶m->cqp); +MLX5_SET (sqc, sqc, reg_umr,MLX5_CAP_ETH (mdev, reg_umr_sq)); +mlx5e_build_ico_cq_param (mdev, log_wq_size, ¶m->cqp); } -static void mlx5e_build_async_icosq_param (struct mlx5e_priv *priv, +static void mlx5e_build_async_icosq_param (struct mlx5_core_dev *mdev,u8 log_wq_size,struct mlx5e_sq_param *param) {void *sqc = param->sqc;void *wq =MLX5_ADDR_OF (sqc, sqc, wq); -mlx5e_build_sq_param_common (priv, param); +mlx5e_build_sq_param_common (mdev, param); param->stop_room =mlx5e_stop_room_for_wqe (1 );/* for XSK NOP */ -MLX5_SET (sqc, sqc, reg_umr,MLX5_CAP_ETH (priv->mdev, reg_umr_sq)); +MLX5_SET (sqc, sqc, reg_umr,MLX5_CAP_ETH (mdev, reg_umr_sq));MLX5_SET (wq, wq, log_wq_sz, log_wq_size); -mlx5e_build_ico_cq_param (priv, log_wq_size, ¶m->cqp); +mlx5e_build_ico_cq_param (mdev, log_wq_size, ¶m->cqp); } -void mlx5e_build_xdpsq_param (struct mlx5e_priv *priv, +void mlx5e_build_xdpsq_param (struct mlx5_core_dev *mdev,struct mlx5e_params *params,struct mlx5e_sq_param *param) {void *sqc = param->sqc;void *wq =MLX5_ADDR_OF (sqc, sqc, wq); -mlx5e_build_sq_param_common (priv, param); +mlx5e_build_sq_param_common (mdev, param);MLX5_SET (wq, wq, log_wq_sz, params->log_sq_size); param->is_mpw =MLX5E_GET_PFLAG (params,MLX5E_PFLAG_XDP_TX_MPWQE ); -mlx5e_build_tx_cq_param (priv, params, ¶m->cqp); +mlx5e_build_tx_cq_param (mdev, params, ¶m->cqp); } -void mlx5e_build_channel_param (struct mlx5e_priv *priv, +void mlx5e_build_channel_param (struct mlx5_core_dev *mdev,struct mlx5e_params *params,u16 q_counter,struct mlx5e_channel_param *cparam) {u8 icosq_log_wq_sz, async_icosq_log_wq_sz; -mlx5e_build_rq_param (priv, params,NULL , q_counter, &cparam->rq); +mlx5e_build_rq_param (mdev, params,NULL , q_counter, &cparam->rq); icosq_log_wq_sz =mlx5e_build_icosq_log_wq_sz (params, &cparam->rq); - async_icosq_log_wq_sz =mlx5e_build_async_icosq_log_wq_sz (priv->netdev); + async_icosq_log_wq_sz =mlx5e_build_async_icosq_log_wq_sz (mdev); -mlx5e_build_sq_param (priv, params, &cparam->txq_sq); -mlx5e_build_xdpsq_param (priv, params, &cparam->xdp_sq); -mlx5e_build_icosq_param (priv, icosq_log_wq_sz, &cparam->icosq); -mlx5e_build_async_icosq_param (priv, async_icosq_log_wq_sz, &cparam->async_icosq); +mlx5e_build_sq_param (mdev, params, &cparam->txq_sq); +mlx5e_build_xdpsq_param (mdev, params, &cparam->xdp_sq); +mlx5e_build_icosq_param (mdev, icosq_log_wq_sz, &cparam->icosq); +mlx5e_build_async_icosq_param (mdev, async_icosq_log_wq_sz, &cparam->async_icosq); }
drivers/net/ethernet/mellanox/mlx5/core/en/params.h +9 -8
@@ -121,30 +121,31 @@ u16 mlx5e_get_rq_headroom(struct mlx5_core_dev *mdev,/* Build queue parameters */ void mlx5e_build_create_cq_param (struct mlx5e_create_cq_param *ccp,struct mlx5e_channel *c); -void mlx5e_build_rq_param (struct mlx5e_priv *priv, +void mlx5e_build_rq_param (struct mlx5_core_dev *mdev,struct mlx5e_params *params,struct mlx5e_xsk_param *xsk,u16 q_counter,struct mlx5e_rq_param *param); -void mlx5e_build_drop_rq_param (struct mlx5e_priv *priv, +void mlx5e_build_drop_rq_param (struct mlx5_core_dev *mdev,u16 q_counter,struct mlx5e_rq_param *param); -void mlx5e_build_sq_param_common (struct mlx5e_priv *priv, +void mlx5e_build_sq_param_common (struct mlx5_core_dev *mdev,struct mlx5e_sq_param *param); -void mlx5e_build_sq_param (struct mlx5e_priv *priv,struct mlx5e_params *params, +void mlx5e_build_sq_param (struct mlx5_core_dev *mdev, +struct mlx5e_params *params,struct mlx5e_sq_param *param); -void mlx5e_build_tx_cq_param (struct mlx5e_priv *priv, +void mlx5e_build_tx_cq_param (struct mlx5_core_dev *mdev,struct mlx5e_params *params,struct mlx5e_cq_param *param); -void mlx5e_build_xdpsq_param (struct mlx5e_priv *priv, +void mlx5e_build_xdpsq_param (struct mlx5_core_dev *mdev,struct mlx5e_params *params,struct mlx5e_sq_param *param); -void mlx5e_build_channel_param (struct mlx5e_priv *priv, +void mlx5e_build_channel_param (struct mlx5_core_dev *mdev,struct mlx5e_params *params,u16 q_counter,struct mlx5e_channel_param *cparam);u16 mlx5e_calc_sq_stop_room (struct mlx5_core_dev *mdev,struct mlx5e_params *params); -int mlx5e_validate_params (struct mlx5e_priv *priv,struct mlx5e_params *params); +int mlx5e_validate_params (struct mlx5_core_dev *mdev,struct mlx5e_params *params);#endif /* __MLX5_EN_PARAMS_H__ */
drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c +4 -4
@@ -389,19 +389,19 @@ static void mlx5e_ptp_close_cqs(struct mlx5e_port_ptp *c)mlx5e_close_cq (&c->ptpsq[tc].txqsq.cq); } -static void mlx5e_ptp_build_sq_param (struct mlx5e_priv *priv, +static void mlx5e_ptp_build_sq_param (struct mlx5_core_dev *mdev,struct mlx5e_params *params,struct mlx5e_sq_param *param) {void *sqc = param->sqc;void *wq; -mlx5e_build_sq_param_common (priv, param); +mlx5e_build_sq_param_common (mdev, param); wq =MLX5_ADDR_OF (sqc, sqc, wq);MLX5_SET (wq, wq, log_wq_sz, params->log_sq_size); param->stop_room =mlx5e_stop_room_for_wqe (MLX5_SEND_WQE_MAX_WQEBBS ); -mlx5e_build_tx_cq_param (priv, params, ¶m->cqp); +mlx5e_build_tx_cq_param (mdev, params, ¶m->cqp); } static void mlx5e_ptp_build_params(struct mlx5e_port_ptp *c,
@@ -419,7 +419,7 @@ static void mlx5e_ptp_build_params(struct mlx5e_port_ptp *c,/* SQ */ params->log_sq_size = orig->log_sq_size; -mlx5e_ptp_build_sq_param (c->priv, params, &cparams->txq_sq_param); +mlx5e_ptp_build_sq_param (c->mdev, params, &cparams->txq_sq_param); } static int mlx5e_ptp_open_queues(struct mlx5e_port_ptp *c,
drivers/net/ethernet/mellanox/mlx5/core/en/qos.c +2 -2
@@ -232,8 +232,8 @@ static int mlx5e_open_qos_sq(struct mlx5e_priv *priv, struct mlx5e_channels *chsmemset (¶m_sq,0 ,sizeof (param_sq));memset (¶m_cq,0 ,sizeof (param_cq)); -mlx5e_build_sq_param (priv, params, ¶m_sq); -mlx5e_build_tx_cq_param (priv, params, ¶m_cq); +mlx5e_build_sq_param (priv->mdev, params, ¶m_sq); +mlx5e_build_tx_cq_param (priv->mdev, params, ¶m_cq); err =mlx5e_open_cq (priv, params->tx_cq_moderation, ¶m_cq, &ccp, &sq->cq);if (err) goto err_free_sq;
drivers/net/ethernet/mellanox/mlx5/core/en/trap.c +7 -5
@@ -238,14 +238,16 @@ static void mlx5e_deactivate_trap_rq(struct mlx5e_rq *rq)clear_bit (MLX5E_RQ_STATE_ENABLED , &rq->state); } -static void mlx5e_build_trap_params (struct mlx5e_priv *priv,struct mlx5e_trap *t) +static void mlx5e_build_trap_params (struct mlx5_core_dev *mdev, +int max_mtu,u16 q_counter, +struct mlx5e_trap *t) {struct mlx5e_params *params = &t->params; params->rq_wq_type =MLX5_WQ_TYPE_CYCLIC ; -mlx5e_init_rq_type_params (priv->mdev, params); - params->sw_mtu = priv->netdev->max_mtu; -mlx5e_build_rq_param (priv, params,NULL , priv->q_counter, &t->rq_param); +mlx5e_init_rq_type_params (mdev, params); + params->sw_mtu = max_mtu; +mlx5e_build_rq_param (mdev, params,NULL , q_counter, &t->rq_param); }static struct mlx5e_trap *mlx5e_open_trap (struct mlx5e_priv *priv)
@@ -259,7 +261,7 @@ static struct mlx5e_trap *mlx5e_open_trap(struct mlx5e_priv *priv)if (!t)return ERR_PTR (-ENOMEM ); -mlx5e_build_trap_params (priv, t); +mlx5e_build_trap_params (priv->mdev, netdev->max_mtu, priv->q_counter, t); t->priv = priv; t->mdev = priv->mdev;
drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c +5 -4
@@ -35,13 +35,14 @@ bool mlx5e_validate_xsk_param(struct mlx5e_params *params, } } -static void mlx5e_build_xsk_cparam (struct mlx5e_priv *priv, +static void mlx5e_build_xsk_cparam (struct mlx5_core_dev *mdev,struct mlx5e_params *params,struct mlx5e_xsk_param *xsk, +u16 q_counter,struct mlx5e_channel_param *cparam) { -mlx5e_build_rq_param (priv, params, xsk, priv->q_counter, &cparam->rq); -mlx5e_build_xdpsq_param (priv, params, &cparam->xdp_sq); +mlx5e_build_rq_param (mdev, params, xsk, q_counter, &cparam->rq); +mlx5e_build_xdpsq_param (mdev, params, &cparam->xdp_sq); } int mlx5e_open_xsk(struct mlx5e_priv *priv, struct mlx5e_params *params,
@@ -61,7 +62,7 @@ int mlx5e_open_xsk(struct mlx5e_priv *priv, struct mlx5e_params *params,if (!cparam)return -ENOMEM ; -mlx5e_build_xsk_cparam (priv, params, xsk, cparam); +mlx5e_build_xsk_cparam (priv->mdev, params, xsk, priv->q_counter, cparam); err =mlx5e_open_cq (c->priv, params->rx_cq_moderation, &cparam->rq.cqp, &ccp, &c->xskrq.cq);
drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +1 -1
@@ -368,7 +368,7 @@ int mlx5e_ethtool_set_ringparam(struct mlx5e_priv *priv, new_channels.params.log_rq_mtu_frames = log_rq_size; new_channels.params.log_sq_size = log_sq_size; - err =mlx5e_validate_params (priv, &new_channels.params); + err =mlx5e_validate_params (priv->mdev, &new_channels.params);if (err) goto unlock;
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +3 -3
@@ -2070,7 +2070,7 @@ int mlx5e_open_channels(struct mlx5e_priv *priv,if (!chs->c || !cparam) goto err_free; -mlx5e_build_channel_param (priv, &chs->params, priv->q_counter, cparam); +mlx5e_build_channel_param (priv->mdev, &chs->params, priv->q_counter, cparam);for (i =0 ; i < chs->num; i++) {struct xsk_buff_pool *xsk_pool =NULL ;
@@ -3029,7 +3029,7 @@ int mlx5e_open_drop_rq(struct mlx5e_priv *priv,struct mlx5e_cq *cq = &drop_rq->cq;int err; -mlx5e_build_drop_rq_param (priv, priv->drop_rq_q_counter, &rq_param); +mlx5e_build_drop_rq_param (mdev, priv->drop_rq_q_counter, &rq_param); err =mlx5e_alloc_drop_cq (priv, cq, &cq_param);if (err)
@@ -3856,7 +3856,7 @@ int mlx5e_change_mtu(struct net_device *netdev, int new_mtu, new_channels.params = *params; new_channels.params.sw_mtu = new_mtu; - err =mlx5e_validate_params (priv, &new_channels.params); + err =mlx5e_validate_params (priv->mdev, &new_channels.params);if (err) goto out;
Signature · 1 line
2.30.2
PATCH 8/15 net/mlx5: Add helper to set time-stamp translator on a queue
In reply to Saeed MahameedFrom: Aya Levin <[email protected]>
Translation method on the time-stamp is set by the capabilities. Avoid code duplication by using a helper to set ptp_cyc2time callback on a queue.
--- drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c | 4 +--- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 8 ++------ drivers/net/ethernet/mellanox/mlx5/core/lib/clock.h | 11 +++++++++++ 3 files changed, 14 insertions(+), 9 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c +1 -3
@@ -183,9 +183,7 @@ static int mlx5e_ptp_alloc_txqsq(struct mlx5e_port_ptp *c, int txq_ix,if (!MLX5_CAP_ETH (mdev, wqe_vlan_insert))set_bit (MLX5E_SQ_STATE_VLAN_NEED_L2_INLINE , &sq->state); sq->stop_room = param->stop_room; - sq->ptp_cyc2time =mlx5_is_real_time_sq (mdev) ? - mlx5_real_time_cyc2time : - mlx5_timecounter_cyc2time; + sq->ptp_cyc2time =mlx5_sq_ts_translator (mdev); node =dev_to_node (mlx5_core_dma_dev (mdev));
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +2 -6
@@ -404,9 +404,7 @@ static int mlx5e_alloc_rq(struct mlx5e_channel *c, rq->hw_mtu =MLX5E_SW2HW_MTU (params, params->sw_mtu); rq->xdpsq = &c->rq_xdpsq; rq->xsk_pool = xsk_pool; - rq->ptp_cyc2time =mlx5_is_real_time_rq (mdev) ? - mlx5_real_time_cyc2time : - mlx5_timecounter_cyc2time; + rq->ptp_cyc2time =mlx5_rq_ts_translator (mdev);if (rq->xsk_pool) rq->stats = &c->priv->channel_stats[c->ix].xskrq;
@@ -1141,9 +1139,7 @@ static int mlx5e_alloc_txqsq(struct mlx5e_channel *c,if (param->is_mpw)set_bit (MLX5E_SQ_STATE_MPWQE , &sq->state); sq->stop_room = param->stop_room; - sq->ptp_cyc2time =mlx5_is_real_time_sq (mdev) ? - mlx5_real_time_cyc2time : - mlx5_timecounter_cyc2time; + sq->ptp_cyc2time =mlx5_sq_ts_translator (mdev); param->wq.db_numa_node =cpu_to_node (c->cpu); err =mlx5_wq_cyc_create (mdev, ¶m->wq, sqc_wq, wq, &sq->wq_ctrl);
drivers/net/ethernet/mellanox/mlx5/core/lib/clock.h +11 -0
@@ -105,4 +105,15 @@ static inline ktime_t mlx5_real_time_cyc2time(struct mlx5_clock *clock, }#endif +static inline cqe_ts_to_ns mlx5_rq_ts_translator (struct mlx5_core_dev *mdev) +{ +return mlx5_is_real_time_rq (mdev) ? mlx5_real_time_cyc2time : + mlx5_timecounter_cyc2time; +} + +static inline cqe_ts_to_ns mlx5_sq_ts_translator (struct mlx5_core_dev *mdev) +{ +return mlx5_is_real_time_sq (mdev) ? mlx5_real_time_cyc2time : + mlx5_timecounter_cyc2time; +}#endif
Signature · 1 line
2.30.2
PATCH 9/15 net/mlx5e: Generalize open RQ
In reply to Saeed MahameedFrom: Aya Levin <[email protected]>
Unify RQ creation for different RQ types. For each RQ type add a separate open helper which initializes the RQ specific values and trigger a call for generic open RQ function. Avoid passing the mlx5e_channel pointer to the generic open RQ as a container, since the RQ may reside under a different type of channel.
--- drivers/net/ethernet/mellanox/mlx5/core/en.h | 6 +- .../net/ethernet/mellanox/mlx5/core/en/trap.c | 170 ++++-------------- .../mellanox/mlx5/core/en/xsk/setup.c | 47 ++++- .../net/ethernet/mellanox/mlx5/core/en_main.c | 126 ++++++------- 4 files changed, 147 insertions(+), 202 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en.h +3 -3
@@ -960,9 +960,9 @@ struct mlx5e_tirc_config mlx5e_tirc_get_default_config(enum mlx5e_traffic_typesstruct mlx5e_xsk_param ;struct mlx5e_rq_param ; -int mlx5e_open_rq (struct mlx5e_channel *c,struct mlx5e_params *params, -struct mlx5e_rq_param *param,struct mlx5e_xsk_param *xsk, -struct xsk_buff_pool *xsk_pool,struct mlx5e_rq *rq); +int mlx5e_open_rq (struct mlx5e_params *params,struct mlx5e_rq_param *param, +struct mlx5e_xsk_param *xsk,int node, +struct mlx5e_rq *rq);int mlx5e_wait_for_min_rx_wqes (struct mlx5e_rq *rq,int wait_time);void mlx5e_deactivate_rq (struct mlx5e_rq *rq);void mlx5e_close_rq (struct mlx5e_rq *rq);
drivers/net/ethernet/mellanox/mlx5/core/en/trap.c +33 -137
207 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c +46 -1
59 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +65 -61
235 lines not on this page · raw message
Signature · 1 line
2.30.2
PATCH 10/15 net/mlx5e: Generalize RQ activation
In reply to Saeed MahameedFrom: Aya Levin <[email protected]>
Support RQ activation for RQs without an ICOSQ in the main flow, like existing trap-RQ and like PTP-RQ that will be introduced in the coming patches in the patchset.
With this patch, remove the wrapper in traps to deactivate the trap-RQ.
--- drivers/net/ethernet/mellanox/mlx5/core/en/trap.c | 15 ++------------- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 5 ++++- 2 files changed, 6 insertions(+), 14 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en/trap.c +2 -13
@@ -128,16 +128,6 @@ static void mlx5e_destroy_trap_direct_rq_tir(struct mlx5_core_dev *mdev, structmlx5e_destroy_tir (mdev, tir); } -static void mlx5e_activate_trap_rq (struct mlx5e_rq *rq) -{ -set_bit (MLX5E_RQ_STATE_ENABLED , &rq->state); -} - -static void mlx5e_deactivate_trap_rq (struct mlx5e_rq *rq) -{ -clear_bit (MLX5E_RQ_STATE_ENABLED , &rq->state); -} -static void mlx5e_build_trap_params (struct mlx5_core_dev *mdev,int max_mtu,u16 q_counter,struct mlx5e_trap *t)
@@ -202,15 +192,14 @@ void mlx5e_close_trap(struct mlx5e_trap *trap)static void mlx5e_activate_trap (struct mlx5e_trap *trap) {napi_enable (&trap->napi); -mlx5e_activate_trap_rq (&trap->rq); -napi_schedule (&trap->napi); +mlx5e_activate_rq (&trap->rq); }void mlx5e_deactivate_trap (struct mlx5e_priv *priv) {struct mlx5e_trap *trap = priv->en_trap; -mlx5e_deactivate_trap_rq (&trap->rq); +mlx5e_deactivate_rq (&trap->rq);napi_disable (&trap->napi); }
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +4 -1
@@ -886,7 +886,10 @@ int mlx5e_open_rq(struct mlx5e_params *params, struct mlx5e_rq_param *param,void mlx5e_activate_rq (struct mlx5e_rq *rq) {set_bit (MLX5E_RQ_STATE_ENABLED , &rq->state); -mlx5e_trigger_irq (rq->icosq); +if (rq->icosq) +mlx5e_trigger_irq (rq->icosq); +else +napi_schedule (rq->cq.napi); }void mlx5e_deactivate_rq (struct mlx5e_rq *rq)
Signature · 1 line
2.30.2
PATCH 11/15 net/mlx5e: Generalize close RQ
In reply to Saeed MahameedFrom: Aya Levin <[email protected]>
Allow different flavours of RQ to use the same close flow. Add validity checks to support different RQ types which not necessarily initialize all the RQ's functionality.
--- drivers/net/ethernet/mellanox/mlx5/core/en/trap.c | 12 +----------- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 13 ++++++++----- 2 files changed, 9 insertions(+), 16 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en/trap.c +1 -11
@@ -30,14 +30,6 @@ static int mlx5e_trap_napi_poll(struct napi_struct *napi, int budget)return work_done; } -static void mlx5e_free_trap_rq (struct mlx5e_rq *rq) -{ -page_pool_destroy (rq->page_pool); -mlx5e_free_di_list (rq); -kvfree (rq->wqe.frags); -mlx5_wq_destroy (&rq->wq_ctrl); -} -static void mlx5e_init_trap_rq (struct mlx5e_trap *t,struct mlx5e_params *params,struct mlx5e_rq *rq) {
@@ -93,9 +85,7 @@ static int mlx5e_open_trap_rq(struct mlx5e_priv *priv, struct mlx5e_trap *t)static void mlx5e_close_trap_rq (struct mlx5e_rq *rq) { -mlx5e_destroy_rq (rq); -mlx5e_free_rx_descs (rq); -mlx5e_free_trap_rq (rq); +mlx5e_close_rq (rq);mlx5e_close_cq (&rq->cq); }
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +8 -5
@@ -592,10 +592,12 @@ static void mlx5e_free_rq(struct mlx5e_rq *rq)struct bpf_prog *old_prog;int i; - old_prog =rcu_dereference_protected (rq->xdp_prog, -lockdep_is_held (&rq->priv->state_lock)); -if (old_prog) -bpf_prog_put (old_prog); +if (xdp_rxq_info_is_reg (&rq->xdp_rxq)) { + old_prog =rcu_dereference_protected (rq->xdp_prog, +lockdep_is_held (&rq->priv->state_lock)); +if (old_prog) +bpf_prog_put (old_prog); + }switch (rq->wq_type) {case MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ :
@@ -901,7 +903,8 @@ void mlx5e_deactivate_rq(struct mlx5e_rq *rq)void mlx5e_close_rq (struct mlx5e_rq *rq) {cancel_work_sync (&rq->dim.work); -cancel_work_sync (&rq->icosq->recover_work); +if (rq->icosq) +cancel_work_sync (&rq->icosq->recover_work);cancel_work_sync (&rq->recover_work);mlx5e_destroy_rq (rq);mlx5e_free_rx_descs (rq);
Signature · 1 line
2.30.2
PATCH 12/15 net/mlx5e: Generalize direct-TIRs and direct-RQTs API
In reply to Saeed MahameedFrom: Aya Levin <[email protected]>
Add input parameter indicating the size of direct-TIRs/direct-RQTs array to be created/destroyed. This allows next patches in the patch-set to handle a single direct-TIR pointing to a direct-RQT with a single entry.
--- drivers/net/ethernet/mellanox/mlx5/core/en.h | 8 ++-- .../net/ethernet/mellanox/mlx5/core/en_main.c | 43 ++++++++++--------- .../net/ethernet/mellanox/mlx5/core/en_rep.c | 15 ++++--- .../ethernet/mellanox/mlx5/core/ipoib/ipoib.c | 15 ++++--- 4 files changed, 45 insertions(+), 36 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en.h +4 -4
@@ -1079,10 +1079,10 @@ int mlx5e_create_indirect_rqt(struct mlx5e_priv *priv);int mlx5e_create_indirect_tirs (struct mlx5e_priv *priv,bool inner_ttc);void mlx5e_destroy_indirect_tirs (struct mlx5e_priv *priv); -int mlx5e_create_direct_rqts (struct mlx5e_priv *priv,struct mlx5e_tir *tirs); -void mlx5e_destroy_direct_rqts (struct mlx5e_priv *priv,struct mlx5e_tir *tirs); -int mlx5e_create_direct_tirs (struct mlx5e_priv *priv,struct mlx5e_tir *tirs); -void mlx5e_destroy_direct_tirs (struct mlx5e_priv *priv,struct mlx5e_tir *tirs); +int mlx5e_create_direct_rqts (struct mlx5e_priv *priv,struct mlx5e_tir *tirs,int n); +void mlx5e_destroy_direct_rqts (struct mlx5e_priv *priv,struct mlx5e_tir *tirs,int n); +int mlx5e_create_direct_tirs (struct mlx5e_priv *priv,struct mlx5e_tir *tirs,int n); +void mlx5e_destroy_direct_tirs (struct mlx5e_priv *priv,struct mlx5e_tir *tirs,int n);void mlx5e_destroy_rqt (struct mlx5e_priv *priv,struct mlx5e_rqt *rqt);int mlx5e_create_tis (struct mlx5_core_dev *mdev,void *in,u32 *tisn);
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +23 -20
128 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +9 -6
@@ -753,6 +753,7 @@ int mlx5e_rep_bond_update(struct mlx5e_priv *priv, bool cleanup)static int mlx5e_init_rep_rx (struct mlx5e_priv *priv) {struct mlx5_core_dev *mdev = priv->mdev; +u16 max_nch = priv->max_nch;int err;mlx5e_init_l2_addr (priv);
@@ -767,7 +768,7 @@ static int mlx5e_init_rep_rx(struct mlx5e_priv *priv)if (err) goto err_close_drop_rq; - err =mlx5e_create_direct_rqts (priv, priv->direct_tir); + err =mlx5e_create_direct_rqts (priv, priv->direct_tir, max_nch);if (err) goto err_destroy_indirect_rqts;
@@ -775,7 +776,7 @@ static int mlx5e_init_rep_rx(struct mlx5e_priv *priv)if (err) goto err_destroy_direct_rqts; - err =mlx5e_create_direct_tirs (priv, priv->direct_tir); + err =mlx5e_create_direct_tirs (priv, priv->direct_tir, max_nch);if (err) goto err_destroy_indirect_tirs;
@@ -800,11 +801,11 @@ static int mlx5e_init_rep_rx(struct mlx5e_priv *priv) err_destroy_ttc_table:mlx5e_destroy_ttc_table (priv, &priv->fs.ttc); err_destroy_direct_tirs: -mlx5e_destroy_direct_tirs (priv, priv->direct_tir); +mlx5e_destroy_direct_tirs (priv, priv->direct_tir, max_nch); err_destroy_indirect_tirs:mlx5e_destroy_indirect_tirs (priv); err_destroy_direct_rqts: -mlx5e_destroy_direct_rqts (priv, priv->direct_tir); +mlx5e_destroy_direct_rqts (priv, priv->direct_tir, max_nch); err_destroy_indirect_rqts:mlx5e_destroy_rqt (priv, &priv->indir_rqt); err_close_drop_rq:
@@ -814,13 +815,15 @@ static int mlx5e_init_rep_rx(struct mlx5e_priv *priv)static void mlx5e_cleanup_rep_rx (struct mlx5e_priv *priv) { +u16 max_nch = priv->max_nch; +mlx5e_ethtool_cleanup_steering (priv);rep_vport_rx_rule_destroy (priv);mlx5e_destroy_rep_root_ft (priv);mlx5e_destroy_ttc_table (priv, &priv->fs.ttc); -mlx5e_destroy_direct_tirs (priv, priv->direct_tir); +mlx5e_destroy_direct_tirs (priv, priv->direct_tir, max_nch);mlx5e_destroy_indirect_tirs (priv); -mlx5e_destroy_direct_rqts (priv, priv->direct_tir); +mlx5e_destroy_direct_rqts (priv, priv->direct_tir, max_nch);mlx5e_destroy_rqt (priv, &priv->indir_rqt);mlx5e_close_drop_rq (&priv->drop_rq); }
drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c +9 -6
@@ -372,6 +372,7 @@ static void mlx5i_destroy_flow_steering(struct mlx5e_priv *priv)static int mlx5i_init_rx (struct mlx5e_priv *priv) {struct mlx5_core_dev *mdev = priv->mdev; +u16 max_nch = priv->max_nch;int err;mlx5e_create_q_counters (priv);
@@ -386,7 +387,7 @@ static int mlx5i_init_rx(struct mlx5e_priv *priv)if (err) goto err_close_drop_rq; - err =mlx5e_create_direct_rqts (priv, priv->direct_tir); + err =mlx5e_create_direct_rqts (priv, priv->direct_tir, max_nch);if (err) goto err_destroy_indirect_rqts;
@@ -394,7 +395,7 @@ static int mlx5i_init_rx(struct mlx5e_priv *priv)if (err) goto err_destroy_direct_rqts; - err =mlx5e_create_direct_tirs (priv, priv->direct_tir); + err =mlx5e_create_direct_tirs (priv, priv->direct_tir, max_nch);if (err) goto err_destroy_indirect_tirs;
@@ -405,11 +406,11 @@ static int mlx5i_init_rx(struct mlx5e_priv *priv)return 0 ; err_destroy_direct_tirs: -mlx5e_destroy_direct_tirs (priv, priv->direct_tir); +mlx5e_destroy_direct_tirs (priv, priv->direct_tir, max_nch); err_destroy_indirect_tirs:mlx5e_destroy_indirect_tirs (priv); err_destroy_direct_rqts: -mlx5e_destroy_direct_rqts (priv, priv->direct_tir); +mlx5e_destroy_direct_rqts (priv, priv->direct_tir, max_nch); err_destroy_indirect_rqts:mlx5e_destroy_rqt (priv, &priv->indir_rqt); err_close_drop_rq:
@@ -421,10 +422,12 @@ static int mlx5i_init_rx(struct mlx5e_priv *priv)static void mlx5i_cleanup_rx (struct mlx5e_priv *priv) { +u16 max_nch = priv->max_nch; +mlx5i_destroy_flow_steering (priv); -mlx5e_destroy_direct_tirs (priv, priv->direct_tir); +mlx5e_destroy_direct_tirs (priv, priv->direct_tir, max_nch);mlx5e_destroy_indirect_tirs (priv); -mlx5e_destroy_direct_rqts (priv, priv->direct_tir); +mlx5e_destroy_direct_rqts (priv, priv->direct_tir, max_nch);mlx5e_destroy_rqt (priv, &priv->indir_rqt);mlx5e_close_drop_rq (&priv->drop_rq);mlx5e_destroy_q_counters (priv);
Signature · 1 line
2.30.2
PATCH 13/15 net/mlx5e: Generalize PTP implementation
In reply to Saeed MahameedFrom: Aya Levin <[email protected]>
Following patches in the set add support for RX PTP. Rename PTP prefix from %s/port_ptp/ptp/g to include RX PTP too.
In addition rename indication (used in statistics context) that PTP-SQ was opened: %s/port_ptp_opened/tx_ptp_opened/g. This will simplify adding indication that PTP-RQ was opened.
--- drivers/net/ethernet/mellanox/mlx5/core/en.h | 10 ++--- .../net/ethernet/mellanox/mlx5/core/en/ptp.c | 39 +++++++++---------- .../net/ethernet/mellanox/mlx5/core/en/ptp.h | 12 +++--- .../mellanox/mlx5/core/en/reporter_tx.c | 8 ++-- .../ethernet/mellanox/mlx5/core/en_ethtool.c | 2 +- .../net/ethernet/mellanox/mlx5/core/en_main.c | 23 ++++++----- .../ethernet/mellanox/mlx5/core/en_stats.c | 18 ++++----- .../net/ethernet/mellanox/mlx5/core/en_tx.c | 2 +- 8 files changed, 56 insertions(+), 58 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en.h +5 -5
@@ -706,11 +706,11 @@ struct mlx5e_channel {int cpu; }; -struct mlx5e_port_ptp ; +struct mlx5e_ptp ;struct mlx5e_channels {struct mlx5e_channel **c; -struct mlx5e_port_ptp *port_ptp; +struct mlx5e_ptp *ptp;unsigned int num;struct mlx5e_params params; };
@@ -725,7 +725,7 @@ struct mlx5e_channel_stats {struct mlx5e_xdpsq_stats xsksq; }____cacheline_aligned_in_smp ; -struct mlx5e_port_ptp_stats { +struct mlx5e_ptp_stats {struct mlx5e_ch_stats ch;struct mlx5e_sq_stats sq[MLX5E_MAX_NUM_TC ];struct mlx5e_ptp_cq_stats cq[MLX5E_MAX_NUM_TC ];
@@ -854,10 +854,10 @@ struct mlx5e_priv {struct mlx5e_stats stats;struct mlx5e_channel_stats channel_stats[MLX5E_MAX_NUM_CHANNELS ];struct mlx5e_channel_stats trap_stats; -struct mlx5e_port_ptp_stats port_ptp_stats; +struct mlx5e_ptp_stats ptp_stats;u16 max_nch;u8 max_opened_tc; -bool port_ptp_opened; +bool tx_ptp_opened;struct hwtstamp_config tstamp;u16 q_counter;u16 drop_rq_q_counter;
drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c +19 -20
@@ -116,8 +116,7 @@ static bool mlx5e_ptp_poll_ts_cq(struct mlx5e_cq *cq, int budget)static int mlx5e_ptp_napi_poll (struct napi_struct *napi,int budget) { - struct mlx5e_port_ptp *c = container_of(napi, struct mlx5e_port_ptp, - napi); + struct mlx5e_ptp *c = container_of(napi, struct mlx5e_ptp, napi);struct mlx5e_ch_stats *ch_stats = c->stats;bool busy = false;int work_done =0 ;
@@ -153,7 +152,7 @@ static int mlx5e_ptp_napi_poll(struct napi_struct *napi, int budget)return work_done; } -static int mlx5e_ptp_alloc_txqsq(struct mlx5e_port_ptp *c, int txq_ix, +static int mlx5e_ptp_alloc_txqsq(struct mlx5e_ptp *c, int txq_ix, struct mlx5e_params *params, struct mlx5e_sq_param *param, struct mlx5e_txqsq *sq, int tc,
@@ -177,7 +176,7 @@ static int mlx5e_ptp_alloc_txqsq(struct mlx5e_port_ptp *c, int txq_ix, sq->uar_map = mdev->mlx5e_res.hw_objs.bfreg.map; sq->min_inline_mode = params->tx_min_inline_mode; sq->hw_mtu =MLX5E_SW2HW_MTU (params, params->sw_mtu); - sq->stats = &c->priv->port_ptp_stats.sq[tc]; + sq->stats = &c->priv->ptp_stats.sq[tc]; sq->ptpsq = ptpsq;INIT_WORK (&sq->recover_work, mlx5e_tx_err_cqe_work);if (!MLX5_CAP_ETH (mdev, wqe_vlan_insert))
@@ -241,7 +240,7 @@ static void mlx5e_ptp_free_traffic_db(struct mlx5e_skb_fifo *skb_fifo)kvfree (skb_fifo->fifo); } -static int mlx5e_ptp_open_txqsq (struct mlx5e_port_ptp *c,u32 tisn, +static int mlx5e_ptp_open_txqsq (struct mlx5e_ptp *c,u32 tisn,int txq_ix,struct mlx5e_ptp_params *cparams,int tc,struct mlx5e_ptpsq *ptpsq) {
@@ -291,7 +290,7 @@ static void mlx5e_ptp_close_txqsq(struct mlx5e_ptpsq *ptpsq)mlx5e_free_txqsq (sq); } -static int mlx5e_ptp_open_txqsqs (struct mlx5e_port_ptp *c, +static int mlx5e_ptp_open_txqsqs (struct mlx5e_ptp *c,struct mlx5e_ptp_params *cparams) {struct mlx5e_params *params = &cparams->params;
@@ -319,7 +318,7 @@ static int mlx5e_ptp_open_txqsqs(struct mlx5e_port_ptp *c,return err; } -static void mlx5e_ptp_close_txqsqs (struct mlx5e_port_ptp *c) +static void mlx5e_ptp_close_txqsqs (struct mlx5e_ptp *c) {int tc;
@@ -327,7 +326,7 @@ static void mlx5e_ptp_close_txqsqs(struct mlx5e_port_ptp *c)mlx5e_ptp_close_txqsq (&c->ptpsq[tc]); } -static int mlx5e_ptp_open_cqs (struct mlx5e_port_ptp *c, +static int mlx5e_ptp_open_cqs (struct mlx5e_ptp *c,struct mlx5e_ptp_params *cparams) {struct mlx5e_params *params = &cparams->params;
@@ -360,7 +359,7 @@ static int mlx5e_ptp_open_cqs(struct mlx5e_port_ptp *c,if (err) goto out_err_ts_cq; - ptpsq->cq_stats = &c->priv->port_ptp_stats.cq[tc]; + ptpsq->cq_stats = &c->priv->ptp_stats.cq[tc]; }return 0 ;
@@ -376,7 +375,7 @@ static int mlx5e_ptp_open_cqs(struct mlx5e_port_ptp *c,return err; } -static void mlx5e_ptp_close_cqs (struct mlx5e_port_ptp *c) +static void mlx5e_ptp_close_cqs (struct mlx5e_ptp *c) {int tc;
@@ -402,7 +401,7 @@ static void mlx5e_ptp_build_sq_param(struct mlx5_core_dev *mdev,mlx5e_build_tx_cq_param (mdev, params, ¶m->cqp); } -static void mlx5e_ptp_build_params (struct mlx5e_port_ptp *c, +static void mlx5e_ptp_build_params (struct mlx5e_ptp *c,struct mlx5e_ptp_params *cparams,struct mlx5e_params *orig) {
@@ -420,7 +419,7 @@ static void mlx5e_ptp_build_params(struct mlx5e_port_ptp *c,mlx5e_ptp_build_sq_param (c->mdev, params, &cparams->txq_sq_param); } -static int mlx5e_ptp_open_queues (struct mlx5e_port_ptp *c, +static int mlx5e_ptp_open_queues (struct mlx5e_ptp *c,struct mlx5e_ptp_params *cparams) {int err;
@@ -441,19 +440,19 @@ static int mlx5e_ptp_open_queues(struct mlx5e_port_ptp *c,return err; } -static void mlx5e_ptp_close_queues (struct mlx5e_port_ptp *c) +static void mlx5e_ptp_close_queues (struct mlx5e_ptp *c) {mlx5e_ptp_close_txqsqs (c);mlx5e_ptp_close_cqs (c); } -int mlx5e_port_ptp_open (struct mlx5e_priv *priv,struct mlx5e_params *params, -u8 lag_port,struct mlx5e_port_ptp **cp) +int mlx5e_ptp_open (struct mlx5e_priv *priv,struct mlx5e_params *params, +u8 lag_port,struct mlx5e_ptp **cp) {struct net_device *netdev = priv->netdev;struct mlx5_core_dev *mdev = priv->mdev;struct mlx5e_ptp_params *cparams; -struct mlx5e_port_ptp *c; +struct mlx5e_ptp *c;unsigned int irq;int err;int eqn;
@@ -475,7 +474,7 @@ int mlx5e_port_ptp_open(struct mlx5e_priv *priv, struct mlx5e_params *params, c->netdev = priv->netdev; c->mkey_be =cpu_to_be32 (priv->mdev->mlx5e_res.hw_objs.mkey.key); c->num_tc = params->num_tc; - c->stats = &priv->port_ptp_stats.ch; + c->stats = &priv->ptp_stats.ch; c->lag_port = lag_port;netif_napi_add (netdev, &c->napi, mlx5e_ptp_napi_poll,64 );
@@ -500,7 +499,7 @@ int mlx5e_port_ptp_open(struct mlx5e_priv *priv, struct mlx5e_params *params,return err; } -void mlx5e_port_ptp_close (struct mlx5e_port_ptp *c) +void mlx5e_ptp_close (struct mlx5e_ptp *c) {mlx5e_ptp_close_queues (c);netif_napi_del (&c->napi);
@@ -508,7 +507,7 @@ void mlx5e_port_ptp_close(struct mlx5e_port_ptp *c)kvfree (c); } -void mlx5e_ptp_activate_channel (struct mlx5e_port_ptp *c) +void mlx5e_ptp_activate_channel (struct mlx5e_ptp *c) {int tc;
@@ -518,7 +517,7 @@ void mlx5e_ptp_activate_channel(struct mlx5e_port_ptp *c)mlx5e_activate_txqsq (&c->ptpsq[tc].txqsq); } -void mlx5e_ptp_deactivate_channel (struct mlx5e_port_ptp *c) +void mlx5e_ptp_deactivate_channel (struct mlx5e_ptp *c) {int tc;
drivers/net/ethernet/mellanox/mlx5/core/en/ptp.h +6 -6
@@ -17,7 +17,7 @@ struct mlx5e_ptpsq {struct mlx5e_ptp_cq_stats *cq_stats; }; -struct mlx5e_port_ptp { +struct mlx5e_ptp {/* data path */ struct mlx5e_ptpsq ptpsq[MLX5E_MAX_NUM_TC ];struct napi_struct napi;
@@ -43,11 +43,11 @@ struct mlx5e_ptp_params {struct mlx5e_sq_param txq_sq_param; }; -int mlx5e_port_ptp_open (struct mlx5e_priv *priv,struct mlx5e_params *params, -u8 lag_port,struct mlx5e_port_ptp **cp); -void mlx5e_port_ptp_close (struct mlx5e_port_ptp *c); -void mlx5e_ptp_activate_channel (struct mlx5e_port_ptp *c); -void mlx5e_ptp_deactivate_channel (struct mlx5e_port_ptp *c); +int mlx5e_ptp_open (struct mlx5e_priv *priv,struct mlx5e_params *params, +u8 lag_port,struct mlx5e_ptp **cp); +void mlx5e_ptp_close (struct mlx5e_ptp *c); +void mlx5e_ptp_activate_channel (struct mlx5e_ptp *c); +void mlx5e_ptp_deactivate_channel (struct mlx5e_ptp *c);enum {MLX5E_SKB_CB_CQE_HWTSTAMP =BIT (0 ),
drivers/net/ethernet/mellanox/mlx5/core/en/reporter_tx.c +4 -4
@@ -315,8 +315,8 @@ mlx5e_tx_reporter_diagnose_common_config(struct devlink_health_reporter *reporteif (err)return err; - generic_ptpsq = priv->channels.port_ptp ? - &priv->channels.port_ptp->ptpsq[0 ] : + generic_ptpsq = priv->channels.ptp ? + &priv->channels.ptp->ptpsq[0 ] :NULL ;if (!generic_ptpsq) goto out;
@@ -346,7 +346,7 @@ static int mlx5e_tx_reporter_diagnose(struct devlink_health_reporter *reporter, struct netlink_ext_ack *extack) {struct mlx5e_priv *priv =devlink_health_reporter_priv (reporter); -struct mlx5e_port_ptp *ptp_ch = priv->channels.port_ptp; +struct mlx5e_ptp *ptp_ch = priv->channels.ptp;int i, tc, err =0 ;
@@ -460,7 +460,7 @@ static int mlx5e_tx_reporter_dump_sq(struct mlx5e_priv *priv, struct devlink_fmsstatic int mlx5e_tx_reporter_dump_all_sqs (struct mlx5e_priv *priv,struct devlink_fmsg *fmsg) { -struct mlx5e_port_ptp *ptp_ch = priv->channels.port_ptp; +struct mlx5e_ptp *ptp_ch = priv->channels.ptp;struct mlx5_rsc_key key = {};int i, tc, err;
drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +1 -1
@@ -2023,7 +2023,7 @@ static int set_pflag_tx_port_ts(struct net_device *netdev, bool enable) mlx5e_num_channels_changed_ctx, NULL); out:if (!err) - priv->port_ptp_opened = true; + priv->tx_ptp_opened = true;return err; }
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +11 -12
@@ -2088,8 +2088,7 @@ int mlx5e_open_channels(struct mlx5e_priv *priv, }if (MLX5E_GET_PFLAG (&chs->params,MLX5E_PFLAG_TX_PORT_TS )) { - err =mlx5e_port_ptp_open (priv, &chs->params, chs->c[0 ]->lag_port, - &chs->port_ptp); + err =mlx5e_ptp_open (priv, &chs->params, chs->c[0 ]->lag_port, &chs->ptp);if (err) goto err_close_channels; }
@@ -2103,8 +2102,8 @@ int mlx5e_open_channels(struct mlx5e_priv *priv,return 0 ; err_close_ptp: -if (chs->port_ptp) -mlx5e_port_ptp_close (chs->port_ptp); +if (chs->ptp) +mlx5e_ptp_close (chs->ptp); err_close_channels:for (i--; i >=0 ; i--)
@@ -2124,8 +2123,8 @@ static void mlx5e_activate_channels(struct mlx5e_channels *chs)for (i =0 ; i < chs->num; i++)mlx5e_activate_channel (chs->c[i]); -if (chs->port_ptp) -mlx5e_ptp_activate_channel (chs->port_ptp); +if (chs->ptp) +mlx5e_ptp_activate_channel (chs->ptp); }#define MLX5E_RQ_WQES_TIMEOUT 20000/* msecs */
@@ -2152,8 +2151,8 @@ static void mlx5e_deactivate_channels(struct mlx5e_channels *chs) {int i; -if (chs->port_ptp) -mlx5e_ptp_deactivate_channel (chs->port_ptp); +if (chs->ptp) +mlx5e_ptp_deactivate_channel (chs->ptp);for (i =0 ; i < chs->num; i++)mlx5e_deactivate_channel (chs->c[i]);
@@ -2163,8 +2162,8 @@ void mlx5e_close_channels(struct mlx5e_channels *chs) {int i; -if (chs->port_ptp) -mlx5e_port_ptp_close (chs->port_ptp); +if (chs->ptp) +mlx5e_ptp_close (chs->ptp);for (i =0 ; i < chs->num; i++)mlx5e_close_channel (chs->c[i]);
@@ -2756,11 +2755,11 @@ static void mlx5e_build_txq_maps(struct mlx5e_priv *priv) } } -if (!priv->channels.port_ptp) +if (!priv->channels.ptp)return ;for (tc =0 ; tc < num_tc; tc++) { -struct mlx5e_port_ptp *c = priv->channels.port_ptp; +struct mlx5e_ptp *c = priv->channels.ptp;struct mlx5e_txqsq *sq = &c->ptpsq[tc].txqsq; priv->txq2sq[sq->txq_ix] = sq;
drivers/net/ethernet/mellanox/mlx5/core/en_stats.c +9 -9
@@ -407,13 +407,13 @@ static void mlx5e_stats_grp_sw_update_stats_ptp(struct mlx5e_priv *priv, {int i; -if (!priv->port_ptp_opened) +if (!priv->tx_ptp_opened)return ; -mlx5e_stats_grp_sw_update_stats_ch_stats (s, &priv->port_ptp_stats.ch); +mlx5e_stats_grp_sw_update_stats_ch_stats (s, &priv->ptp_stats.ch);for (i =0 ; i < priv->max_opened_tc; i++) { -mlx5e_stats_grp_sw_update_stats_sq (s, &priv->port_ptp_stats.sq[i]); +mlx5e_stats_grp_sw_update_stats_sq (s, &priv->ptp_stats.sq[i]);/* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92657 */ barrier ();
@@ -1851,7 +1851,7 @@ static MLX5E_DECLARE_STATS_GRP_OP_UPDATE_STATS(qos) { return; }static MLX5E_DECLARE_STATS_GRP_OP_NUM_STATS (ptp) { -return priv->port_ptp_opened ? +return priv->tx_ptp_opened ?NUM_PTP_CH_STATS + ((NUM_PTP_SQ_STATS +NUM_PTP_CQ_STATS ) * priv->max_opened_tc) :0 ;
@@ -1861,7 +1861,7 @@ static MLX5E_DECLARE_STATS_GRP_OP_FILL_STRS(ptp) {int i, tc; -if (!priv->port_ptp_opened) +if (!priv->tx_ptp_opened)return idx;for (i =0 ; i <NUM_PTP_CH_STATS ; i++)
@@ -1884,24 +1884,24 @@ static MLX5E_DECLARE_STATS_GRP_OP_FILL_STATS(ptp) {int i, tc; -if (!priv->port_ptp_opened) +if (!priv->tx_ptp_opened)return idx;for (i =0 ; i <NUM_PTP_CH_STATS ; i++) data[idx++] = -MLX5E_READ_CTR64_CPU (&priv->port_ptp_stats.ch, +MLX5E_READ_CTR64_CPU (&priv->ptp_stats.ch, ptp_ch_stats_desc, i);for (tc =0 ; tc < priv->max_opened_tc; tc++)for (i =0 ; i <NUM_PTP_SQ_STATS ; i++) data[idx++] = -MLX5E_READ_CTR64_CPU (&priv->port_ptp_stats.sq[tc], +MLX5E_READ_CTR64_CPU (&priv->ptp_stats.sq[tc], ptp_sq_stats_desc, i);for (tc =0 ; tc < priv->max_opened_tc; tc++)for (i =0 ; i <NUM_PTP_CQ_STATS ; i++) data[idx++] = -MLX5E_READ_CTR64_CPU (&priv->port_ptp_stats.cq[tc], +MLX5E_READ_CTR64_CPU (&priv->ptp_stats.cq[tc], ptp_cq_stats_desc, i);return idx;
drivers/net/ethernet/mellanox/mlx5/core/en_tx.c +1 -1
@@ -142,7 +142,7 @@ u16 mlx5e_select_queue(struct net_device *dev, struct sk_buff *skb,return txq_ix; } -if (unlikely (priv->channels.port_ptp)) +if (unlikely (priv->channels.ptp))if (unlikely (skb_shinfo (skb)->tx_flags &SKBTX_HW_TSTAMP ) &&mlx5e_use_ptpsq (skb))return mlx5e_select_ptpsq (dev, skb);
Signature · 1 line
2.30.2
PATCH 15/15 net/mlx5: Fix spelling mistakes in mlx5_core_info message
In reply to Saeed MahameedFrom: Colin Ian King <[email protected]>
There are two spelling mistakes in a mlx5_core_info message. Fix them.
--- drivers/net/ethernet/mellanox/mlx5/core/health.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/health.c +1 -1
@@ -340,7 +340,7 @@ static int mlx5_health_try_recover(struct mlx5_core_dev *dev)return -EIO ; } -mlx5_core_info (dev,"health revovery succeded\n" ); +mlx5_core_info (dev,"health recovery succeeded\n" );return 0 ; }
Signature · 1 line
2.30.2
PATCH 14/15 net/mlx5e: Cleanup PTP
In reply to Saeed MahameedFrom: Aya Levin <[email protected]>
Reduce scope of mlx5e_ptp_params, move to its c file. Remove unneeded variables from mlx5e_ptp_open and state bitmap from PTP channel. In addition, remove channel index from PTP channel since it is set to a hard coded value, use define instead.
--- .../net/ethernet/mellanox/mlx5/core/en/ptp.c | 18 ++++++++++-------- .../net/ethernet/mellanox/mlx5/core/en/ptp.h | 8 -------- 2 files changed, 10 insertions(+), 16 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c +10 -8
@@ -3,6 +3,14 @@#include "en/ptp.h" #include "en/txrx.h" +#include "en/params.h" + +#define MLX5E_PTP_CHANNEL_IX 0 + +struct mlx5e_ptp_params { +struct mlx5e_params params; +struct mlx5e_sq_param txq_sq_param; +};struct mlx5e_skb_cb_hwtstamp {ktime_t cqe_hwtstamp;
@@ -171,7 +179,7 @@ static int mlx5e_ptp_alloc_txqsq(struct mlx5e_ptp *c, int txq_ix, sq->netdev = c->netdev; sq->priv = c->priv; sq->mdev = mdev; - sq->ch_ix = c->ix; + sq->ch_ix =MLX5E_PTP_CHANNEL_IX ; sq->txq_ix = txq_ix; sq->uar_map = mdev->mlx5e_res.hw_objs.bfreg.map; sq->min_inline_mode = params->tx_min_inline_mode;
@@ -339,7 +347,7 @@ static int mlx5e_ptp_open_cqs(struct mlx5e_ptp *c, ccp.node =dev_to_node (mlx5_core_dma_dev (c->mdev)); ccp.ch_stats = c->stats; ccp.napi = &c->napi; - ccp.ix = c->ix; + ccp.ix =MLX5E_PTP_CHANNEL_IX ; cq_param = &cparams->txq_sq_param.cqp;
@@ -453,13 +461,8 @@ int mlx5e_ptp_open(struct mlx5e_priv *priv, struct mlx5e_params *params,struct mlx5_core_dev *mdev = priv->mdev;struct mlx5e_ptp_params *cparams;struct mlx5e_ptp *c; -unsigned int irq;int err; -int eqn; - err =mlx5_vector2eqn (priv->mdev,0 , &eqn, &irq); -if (err) -return err; c =kvzalloc_node (sizeof (*c),GFP_KERNEL ,dev_to_node (mlx5_core_dma_dev (mdev))); cparams =kvzalloc (sizeof (*cparams),GFP_KERNEL );
@@ -469,7 +472,6 @@ int mlx5e_ptp_open(struct mlx5e_priv *priv, struct mlx5e_params *params, c->priv = priv; c->mdev = priv->mdev; c->tstamp = &priv->tstamp; - c->ix =0 ; c->pdev =mlx5_core_dma_dev (priv->mdev); c->netdev = priv->netdev; c->mkey_be =cpu_to_be32 (priv->mdev->mlx5e_res.hw_objs.mkey.key);
drivers/net/ethernet/mellanox/mlx5/core/en/ptp.h +0 -8
@@ -5,7 +5,6 @@#define __MLX5_EN_PTP_H__#include "en.h" -#include "en/params.h" #include "en_stats.h" struct mlx5e_ptpsq {
@@ -34,13 +33,6 @@ struct mlx5e_ptp {struct mlx5e_priv *priv;struct mlx5_core_dev *mdev;struct hwtstamp_config *tstamp; -DECLARE_BITMAP (state,MLX5E_CHANNEL_NUM_STATES ); -int ix; -}; - -struct mlx5e_ptp_params { -struct mlx5e_params params; -struct mlx5e_sq_param txq_sq_param; }; int mlx5e_ptp_open(struct mlx5e_priv *priv, struct mlx5e_params *params,
Signature · 1 line
2.30.2
David Miller
maintainerFrom: Saeed Mahameed <[email protected]>
Date: Wed, 24 Mar 2021 22:04:23 -0700
Quoted 8 lines
From: Saeed Mahameed <[email protected]>
Hi Dave/Jakub,
This series provides update to mlx5 netdev driver, mostly refactoring. For more information please see tag log below.
Please pull and let me know if there is any problem.
Please respin as this gives conflicts against net-next right now, thank you.
David Miller
maintainerRe: [net-next 05/15] net/mlx5e: Move params logic into its dedicated file
In reply to Saeed MahameedFrom: Saeed Mahameed <[email protected]>
Date: Wed, 24 Mar 2021 22:04:28 -0700
Quoted 1 line
+static inline u8
mlx5e_get_rqwq_log_stride(u8 wq_type, int ndsegs)
Please no inline in foo.c files.
Thasnk you.