mlx5 updates 2021-03-29
From: Saeed Mahameed <[email protected]>
Hi Dave, Jakub,
This series removes the mlx5 netdev restriction of enabling both PTP time-stamping and CQE-Compression features.
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 d0922bf7981799fd86e248de330fb4152399d6c2:
hv_netvsc: Add error handling while switching data path (2021-03-29 16:35:59 -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-29
for you to fetch changes up to 885b8cfb161ed3d8f41e7b37e14d35bd8d3aaf6b:
net/mlx5e: Update ethtool setting of CQE compression (2021-03-29 21:21:54 -0700)
----------------------------------------------------------------
mlx5-updates-2021-03-29
Coexistence of CQE compression and HW PTP time-stamp:
From Aya this series improves mlx5 netdev driver to allow both mlx5 CQE compression (RX descriptor compression, that saves on PCI transactions) and HW time-stamp PTP to co-exist.
Prior to this series both features were mutually exclusive due to the nature of CQE compression which reduces the size of RX descriptor for the price of trimming some data, such as the time-stamp.
In order to allow CQE compression when PTP time stamping is enabled, We enable it on the regular performance critical RX queues which will service all the data path traffic that is not PTP.
PTP traffic will be re-directed to dedicated RX queues on which we will not enable CQE compression and thus keep the time-stamp intact.
Having both features is critical for systems with low PCI BW, e.g. Multi-Host.
The series will be adding:
1) Infrastructure to create a dedicated RX queue to service the PTP traffic
2) Flow steering plumbing to capture PTP traffic both UDP packets with destination port 319 and L2 packets with ethertype 0x88F7
3) Steer PTP traffic to the dedicated RX queue.
4) The feature will be enabled when PTP is being configured via the already existing PTP IOCTL when CQE compression is active, otherwise no change to the driver flow.
----------------------------------------------------------------
Aya Levin (12):
net/mlx5e: Add states to PTP channel
net/mlx5e: Add RQ to PTP channel
net/mlx5e: Add PTP-RX statistics
net:mlx5e: Add PTP-TIR and PTP-RQT
net/mlx5e: Refactor RX reporter diagnostics net/mlx5e: Add PTP RQ to RX reporter
net/mlx5e: Cleanup Flow Steering level
net/mlx5e: Introduce Flow Steering UDP API net/mlx5e: Introduce Flow Steering ANY API net/mlx5e: Add PTP Flow Steering support net/mlx5e: Allow coexistence of CQE compression and HW TS PTP net/mlx5e: Update ethtool setting of CQE compression
drivers/net/ethernet/mellanox/mlx5/core/Makefile | 2 +- drivers/net/ethernet/mellanox/mlx5/core/en.h | 6 + drivers/net/ethernet/mellanox/mlx5/core/en/fs.h | 13 +- .../mellanox/mlx5/core/en/fs_tt_redirect.c | 605 +++++++++++++++++++++ .../mellanox/mlx5/core/en/fs_tt_redirect.h | 26 + drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c | 331 ++++++++++- drivers/net/ethernet/mellanox/mlx5/core/en/ptp.h | 12 + .../ethernet/mellanox/mlx5/core/en/reporter_rx.c | 172 ++++-- .../ethernet/mellanox/mlx5/core/en/reporter_tx.c | 12 +- .../net/ethernet/mellanox/mlx5/core/en_ethtool.c | 14 +- drivers/net/ethernet/mellanox/mlx5/core/en_fs.c | 8 + drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 93 +++- drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 2 + drivers/net/ethernet/mellanox/mlx5/core/en_stats.c | 114 +++- drivers/net/ethernet/mellanox/mlx5/core/en_stats.h | 1 + drivers/net/ethernet/mellanox/mlx5/core/en_tx.c | 11 +- drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | 2 +- .../net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c | 1 + .../ethernet/mellanox/mlx5/core/ipoib/ipoib_vlan.c | 1 + 19 files changed, 1298 insertions(+), 128 deletions(-) create mode 100644 drivers/net/ethernet/mellanox/mlx5/core/en/fs_tt_redirect.c create mode 100644 drivers/net/ethernet/mellanox/mlx5/core/en/fs_tt_redirect.h
PATCH 1/12 net/mlx5e: Add states to PTP channel
From: Aya Levin <[email protected]>
Add PTP TX state to PTP channel, which indicates the corresponding SQ is available. Further patches in the set extend PTP channel to include RQ. The PTP channel state will be used for separation and coexistence of RX and TX PTP. Enhance conditions to verify the TX PTP state is set.
--- .../net/ethernet/mellanox/mlx5/core/en/ptp.c | 73 +++++++++++++------ .../net/ethernet/mellanox/mlx5/core/en/ptp.h | 6 ++ .../mellanox/mlx5/core/en/reporter_tx.c | 12 +-- .../net/ethernet/mellanox/mlx5/core/en_main.c | 3 + .../net/ethernet/mellanox/mlx5/core/en_tx.c | 11 ++- 5 files changed, 71 insertions(+), 34 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c +49 -24
@@ -134,9 +134,11 @@ static int mlx5e_ptp_napi_poll(struct napi_struct *napi, int budget) ch_stats->poll++; -for (i =0 ; i < c->num_tc; i++) { - busy |=mlx5e_poll_tx_cq (&c->ptpsq[i].txqsq.cq, budget); - busy |=mlx5e_ptp_poll_ts_cq (&c->ptpsq[i].ts_cq, budget); +if (test_bit (MLX5E_PTP_STATE_TX , c->state)) { +for (i =0 ; i < c->num_tc; i++) { + busy |=mlx5e_poll_tx_cq (&c->ptpsq[i].txqsq.cq, budget); + busy |=mlx5e_ptp_poll_ts_cq (&c->ptpsq[i].ts_cq, budget); + } }if (busy) {
@@ -149,9 +151,11 @@ static int mlx5e_ptp_napi_poll(struct napi_struct *napi, int budget) ch_stats->arm++; -for (i =0 ; i < c->num_tc; i++) { -mlx5e_cq_arm (&c->ptpsq[i].txqsq.cq); -mlx5e_cq_arm (&c->ptpsq[i].ts_cq); +if (test_bit (MLX5E_PTP_STATE_TX , c->state)) { +for (i =0 ; i < c->num_tc; i++) { +mlx5e_cq_arm (&c->ptpsq[i].txqsq.cq); +mlx5e_cq_arm (&c->ptpsq[i].ts_cq); + } } out:
@@ -422,9 +426,10 @@ static void mlx5e_ptp_build_params(struct mlx5e_ptp *c, params->num_tc = orig->num_tc;/* SQ */ - params->log_sq_size = orig->log_sq_size; - -mlx5e_ptp_build_sq_param (c->mdev, params, &cparams->txq_sq_param); +if (test_bit (MLX5E_PTP_STATE_TX , c->state)) { + params->log_sq_size = orig->log_sq_size; +mlx5e_ptp_build_sq_param (c->mdev, params, &cparams->txq_sq_param); + } } static int mlx5e_ptp_open_queues(struct mlx5e_ptp *c,
@@ -432,26 +437,38 @@ static int mlx5e_ptp_open_queues(struct mlx5e_ptp *c, {int err; - err =mlx5e_ptp_open_cqs (c, cparams); -if (err) -return err; - - err =mlx5e_ptp_open_txqsqs (c, cparams); -if (err) - goto close_cqs; +if (test_bit (MLX5E_PTP_STATE_TX , c->state)) { + err =mlx5e_ptp_open_cqs (c, cparams); +if (err) +return err; + err =mlx5e_ptp_open_txqsqs (c, cparams); +if (err) + goto close_cqs; + }return 0 ; close_cqs: -mlx5e_ptp_close_cqs (c); +if (test_bit (MLX5E_PTP_STATE_TX , c->state)) +mlx5e_ptp_close_cqs (c);return err; }static void mlx5e_ptp_close_queues (struct mlx5e_ptp *c) { -mlx5e_ptp_close_txqsqs (c); -mlx5e_ptp_close_cqs (c); +if (test_bit (MLX5E_PTP_STATE_TX , c->state)) { +mlx5e_ptp_close_txqsqs (c); +mlx5e_ptp_close_cqs (c); + } +} + +static int mlx5e_ptp_set_state (struct mlx5e_ptp *c,struct mlx5e_params *params) +{ +if (MLX5E_GET_PFLAG (params,MLX5E_PFLAG_TX_PORT_TS )) +__set_bit (MLX5E_PTP_STATE_TX , c->state); + +return bitmap_empty (c->state,MLX5E_PTP_STATE_NUM_STATES ) ? -EINVAL :0 ; } int mlx5e_ptp_open(struct mlx5e_priv *priv, struct mlx5e_params *params,
@@ -479,6 +496,10 @@ int mlx5e_ptp_open(struct mlx5e_priv *priv, struct mlx5e_params *params, c->stats = &priv->ptp_stats.ch; c->lag_port = lag_port; + err =mlx5e_ptp_set_state (c, params); +if (err) + goto err_free; +netif_napi_add (netdev, &c->napi, mlx5e_ptp_napi_poll,64 );mlx5e_ptp_build_params (c, cparams, params);
@@ -495,7 +516,7 @@ int mlx5e_ptp_open(struct mlx5e_priv *priv, struct mlx5e_params *params, err_napi_del:netif_napi_del (&c->napi); - +err_free:kvfree (cparams);kvfree (c);return err;
@@ -515,16 +536,20 @@ void mlx5e_ptp_activate_channel(struct mlx5e_ptp *c)napi_enable (&c->napi); -for (tc =0 ; tc < c->num_tc; tc++) -mlx5e_activate_txqsq (&c->ptpsq[tc].txqsq); +if (test_bit (MLX5E_PTP_STATE_TX , c->state)) { +for (tc =0 ; tc < c->num_tc; tc++) +mlx5e_activate_txqsq (&c->ptpsq[tc].txqsq); + } }void mlx5e_ptp_deactivate_channel (struct mlx5e_ptp *c) {int tc; -for (tc =0 ; tc < c->num_tc; tc++) -mlx5e_deactivate_txqsq (&c->ptpsq[tc].txqsq); +if (test_bit (MLX5E_PTP_STATE_TX , c->state)) { +for (tc =0 ; tc < c->num_tc; tc++) +mlx5e_deactivate_txqsq (&c->ptpsq[tc].txqsq); + }napi_disable (&c->napi); }
drivers/net/ethernet/mellanox/mlx5/core/en/ptp.h +6 -0
@@ -16,6 +16,11 @@ struct mlx5e_ptpsq {struct mlx5e_ptp_cq_stats *cq_stats; }; +enum { +MLX5E_PTP_STATE_TX , +MLX5E_PTP_STATE_NUM_STATES , +}; +struct mlx5e_ptp {/* data path */ struct mlx5e_ptpsq ptpsq[MLX5E_MAX_NUM_TC ];
@@ -33,6 +38,7 @@ struct mlx5e_ptp {struct mlx5e_priv *priv;struct mlx5_core_dev *mdev;struct hwtstamp_config *tstamp; +DECLARE_BITMAP (state,MLX5E_PTP_STATE_NUM_STATES ); }; int mlx5e_ptp_open(struct mlx5e_priv *priv, struct mlx5e_params *params,
drivers/net/ethernet/mellanox/mlx5/core/en/reporter_tx.c +6 -6
@@ -304,6 +304,7 @@ mlx5e_tx_reporter_diagnose_common_config(struct devlink_health_reporter *reporte {struct mlx5e_priv *priv =devlink_health_reporter_priv (reporter);struct mlx5e_txqsq *generic_sq = priv->txq2sq[0 ]; +struct mlx5e_ptp *ptp_ch = priv->channels.ptp;struct mlx5e_ptpsq *generic_ptpsq;int err;
@@ -315,12 +316,11 @@ mlx5e_tx_reporter_diagnose_common_config(struct devlink_health_reporter *reporteif (err)return err; - generic_ptpsq = priv->channels.ptp ? - &priv->channels.ptp->ptpsq[0 ] : -NULL ; -if (!generic_ptpsq) +if (!ptp_ch || !test_bit (MLX5E_PTP_STATE_TX , ptp_ch->state)) goto out; + generic_ptpsq = &ptp_ch->ptpsq[0 ]; + err =mlx5e_health_fmsg_named_obj_nest_start (fmsg,"PTP" );if (err)return err;
@@ -375,7 +375,7 @@ static int mlx5e_tx_reporter_diagnose(struct devlink_health_reporter *reporter, } } -if (!ptp_ch) +if (!ptp_ch || !test_bit (MLX5E_PTP_STATE_TX , ptp_ch->state)) goto close_sqs_nest;for (tc =0 ; tc < priv->channels.params.num_tc; tc++) {
@@ -497,7 +497,7 @@ static int mlx5e_tx_reporter_dump_all_sqs(struct mlx5e_priv *priv, } } -if (ptp_ch) { +if (ptp_ch &&test_bit (MLX5E_PTP_STATE_TX , ptp_ch->state)) {for (tc =0 ; tc < priv->channels.params.num_tc; tc++) {struct mlx5e_txqsq *sq = &ptp_ch->ptpsq[tc].txqsq;
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +3 -0
@@ -2759,6 +2759,9 @@ static void mlx5e_build_txq_maps(struct mlx5e_priv *priv)if (!priv->channels.ptp)return ; +if (!test_bit (MLX5E_PTP_STATE_TX , priv->channels.ptp->state)) +return ; +for (tc =0 ; tc < num_tc; tc++) {struct mlx5e_ptp *c = priv->channels.ptp;struct mlx5e_txqsq *sq = &c->ptpsq[tc].txqsq;
drivers/net/ethernet/mellanox/mlx5/core/en_tx.c +7 -4
@@ -133,6 +133,8 @@ u16 mlx5e_select_queue(struct net_device *dev, struct sk_buff *skb,/* Sync with mlx5e_update_num_tc_x_num_ch - avoid refetching. */ num_tc_x_num_ch =READ_ONCE (priv->num_tc_x_num_ch);if (unlikely (dev->real_num_tx_queues > num_tc_x_num_ch)) { +struct mlx5e_ptp *ptp_channel; +/* Order maj_id before defcls - pairs with mlx5e_htb_root_add. */ u16 htb_maj_id =smp_load_acquire (&priv->htb.maj_id);
@@ -142,10 +144,11 @@ u16 mlx5e_select_queue(struct net_device *dev, struct sk_buff *skb,return txq_ix; } -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); + ptp_channel =READ_ONCE (priv->channels.ptp); +if (unlikely (ptp_channel) && +test_bit (MLX5E_PTP_STATE_TX , ptp_channel->state) && +mlx5e_use_ptpsq (skb)) +return mlx5e_select_ptpsq (dev, skb); txq_ix =netdev_pick_tx (dev, skb,NULL );/* Fix netdev_pick_tx() not to choose ptp_channel and HTB txqs.
Signature · 1 line
2.30.2
Re: [net-next 01/12] net/mlx5e: Add states to PTP channel
This series was applied to netdev/net-next.git (refs/heads/master):
Hello:
This series was applied to netdev/net-next.git (refs/heads/master):
Quoted 8 lines · On Mon, 29 Mar 2021 21:27:30 -0700 you wrote:
From: Aya Levin <[email protected]>
Add PTP TX state to PTP channel, which indicates the corresponding SQ is available. Further patches in the set extend PTP channel to include RQ. The PTP channel state will be used for separation and coexistence of RX and TX PTP. Enhance conditions to verify the TX PTP state is set.
[...]
Here is the summary with links:
- [net-next,01/12] net/mlx5e: Add states to PTP channel
https://git.kernel.org/netdev/net-next/c/24c22dd0918b - [net-next,02/12] net/mlx5e: Add RQ to PTP channel https://git.kernel.org/netdev/net-next/c/a099da8ffcf6 - [net-next,03/12] net/mlx5e: Add PTP-RX statistics https://git.kernel.org/netdev/net-next/c/a28359e922c6 - [net-next,04/12] net:mlx5e: Add PTP-TIR and PTP-RQT https://git.kernel.org/netdev/net-next/c/3adb60b6a3ed - [net-next,05/12] net/mlx5e: Refactor RX reporter diagnostics https://git.kernel.org/netdev/net-next/c/19cfa36b18d8 - [net-next,06/12] net/mlx5e: Add PTP RQ to RX reporter https://git.kernel.org/netdev/net-next/c/b8fb10939ff4 - [net-next,07/12] net/mlx5e: Cleanup Flow Steering level https://git.kernel.org/netdev/net-next/c/c809cf665e28 - [net-next,08/12] net/mlx5e: Introduce Flow Steering UDP API https://git.kernel.org/netdev/net-next/c/1c80bd684388 - [net-next,09/12] net/mlx5e: Introduce Flow Steering ANY API https://git.kernel.org/netdev/net-next/c/0f575c20bf06 - [net-next,10/12] net/mlx5e: Add PTP Flow Steering support https://git.kernel.org/netdev/net-next/c/e5fe49465d46 - [net-next,11/12] net/mlx5e: Allow coexistence of CQE compression and HW TS PTP https://git.kernel.org/netdev/net-next/c/960fbfe222a4 - [net-next,12/12] net/mlx5e: Update ethtool setting of CQE compression https://git.kernel.org/netdev/net-next/c/885b8cfb161e
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
PATCH 2/12 net/mlx5e: Add RQ to PTP channel
In reply to Saeed MahameedFrom: Aya Levin <[email protected]>
Enhance PTP channel to allow PTP without disabling CQE compression. Add RQ, TIR and PTP_RX_STATE to PTP channel. When this bit is set, PTP channel manages its RQ, and PTP traffic is directed to the PTP-RQ which is not affected by compression.
--- drivers/net/ethernet/mellanox/mlx5/core/en.h | 1 + .../net/ethernet/mellanox/mlx5/core/en/ptp.c | 123 ++++++++++++++++-- .../net/ethernet/mellanox/mlx5/core/en/ptp.h | 2 + 3 files changed, 118 insertions(+), 8 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en.h +1 -0
@@ -730,6 +730,7 @@ 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 ]; +struct mlx5e_rq_stats rq; }____cacheline_aligned_in_smp ;enum {
drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c +115 -8
206 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/en/ptp.h +2 -0
@@ -18,12 +18,14 @@ struct mlx5e_ptpsq {enum {MLX5E_PTP_STATE_TX , +MLX5E_PTP_STATE_RX ,MLX5E_PTP_STATE_NUM_STATES , };struct mlx5e_ptp {/* data path */ struct mlx5e_ptpsq ptpsq[MLX5E_MAX_NUM_TC ]; +struct mlx5e_rq rq;struct napi_struct napi;struct device *pdev;struct net_device *netdev;
Signature · 1 line
2.30.2
PATCH 3/12 net/mlx5e: Add PTP-RX statistics
In reply to Saeed MahameedFrom: Aya Levin <[email protected]>
Like PTP-TX, once the PTP-RX is opened, corresponding statistics appear. Add indication that PTP-RX was ever opened: rx_ptp_opened. If any of the PTP RX or TX were opened, display the PTP channel's statistics.
--- drivers/net/ethernet/mellanox/mlx5/core/en.h | 1 + .../net/ethernet/mellanox/mlx5/core/en/ptp.c | 3 + .../net/ethernet/mellanox/mlx5/core/en_main.c | 7 ++ .../ethernet/mellanox/mlx5/core/en_stats.c | 114 ++++++++++++++---- .../ethernet/mellanox/mlx5/core/en_stats.h | 1 + 5 files changed, 100 insertions(+), 26 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en.h +1 -0
@@ -860,6 +860,7 @@ struct mlx5e_priv {u16 max_nch;u8 max_opened_tc;bool tx_ptp_opened; +bool rx_ptp_opened;struct hwtstamp_config tstamp;u16 q_counter;u16 drop_rq_q_counter;
drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c +3 -0
@@ -610,6 +610,9 @@ int mlx5e_ptp_open(struct mlx5e_priv *priv, struct mlx5e_params *params,if (unlikely (err)) goto err_napi_del; +if (test_bit (MLX5E_PTP_STATE_RX , c->state)) + priv->rx_ptp_opened = true; + *cp = c;kvfree (cparams);
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +7 -0
@@ -3496,6 +3496,13 @@ void mlx5e_fold_sw_stats64(struct mlx5e_priv *priv, struct rtnl_link_stats64 *s) s->tx_dropped += sq_stats->dropped; } } +if (priv->rx_ptp_opened) { +struct mlx5e_rq_stats *rq_stats = &priv->ptp_stats.rq; + + s->rx_packets += rq_stats->packets; + s->rx_bytes += rq_stats->bytes; + s->multicast += rq_stats->mcast_packets; + } }void
drivers/net/ethernet/mellanox/mlx5/core/en_stats.c +88 -26
170 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/en_stats.h +1 -0
@@ -54,6 +54,7 @@#define MLX5E_DECLARE_PTP_TX_STAT (type, fld) "ptp_tx%d_"#fld, offsetof(type, fld)#define MLX5E_DECLARE_PTP_CH_STAT (type, fld) "ptp_ch_"#fld, offsetof(type, fld)#define MLX5E_DECLARE_PTP_CQ_STAT (type, fld) "ptp_cq%d_"#fld, offsetof(type, fld) +#define MLX5E_DECLARE_PTP_RQ_STAT (type, fld) "ptp_rq%d_"#fld, offsetof(type, fld)#define MLX5E_DECLARE_QOS_TX_STAT (type, fld) "qos_tx%d_"#fld, offsetof(type, fld)
Signature · 1 line
2.30.2
PATCH 4/12 net:mlx5e: Add PTP-TIR and PTP-RQT
In reply to Saeed MahameedFrom: Aya Levin <[email protected]>
Add PTP-TIR and initiate its RQT to allow PTP-RQ to integrate into the safe-reopen flow on configuration change. Add rx_ptp_support flag on a profile and turn it on for ETH driver. With this flag set, create a redirect-RQT for PTP-RQ.
--- drivers/net/ethernet/mellanox/mlx5/core/en.h | 2 + .../net/ethernet/mellanox/mlx5/core/en/ptp.c | 9 +++++ .../net/ethernet/mellanox/mlx5/core/en/ptp.h | 1 + .../net/ethernet/mellanox/mlx5/core/en_main.c | 40 +++++++++++++++++-- .../net/ethernet/mellanox/mlx5/core/en_rep.c | 2 + .../ethernet/mellanox/mlx5/core/ipoib/ipoib.c | 1 + .../mellanox/mlx5/core/ipoib/ipoib_vlan.c | 1 + 7 files changed, 52 insertions(+), 4 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en.h +2 -0
@@ -837,6 +837,7 @@ struct mlx5e_priv {struct mlx5e_tir inner_indir_tir[MLX5E_NUM_INDIR_TIRS ];struct mlx5e_tir direct_tir[MLX5E_MAX_NUM_CHANNELS ];struct mlx5e_tir xsk_tir[MLX5E_MAX_NUM_CHANNELS ]; +struct mlx5e_tir ptp_tir;struct mlx5e_rss_params rss_params;u32 tx_rates[MLX5E_MAX_NUM_SQS ];
@@ -916,6 +917,7 @@ struct mlx5e_profile {const struct mlx5e_rx_handlers *rx_handlers;int max_tc;u8 rq_groups; +bool rx_ptp_support; };void mlx5e_build_ptys2ethtool_map (void );
drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c +9 -0
@@ -663,3 +663,12 @@ void mlx5e_ptp_deactivate_channel(struct mlx5e_ptp *c)napi_disable (&c->napi); } + +int mlx5e_ptp_get_rqn (struct mlx5e_ptp *c,u32 *rqn) +{ +if (!c || !test_bit (MLX5E_PTP_STATE_RX , c->state)) +return -EINVAL ; + + *rqn = c->rq.rqn; +return 0 ; +}
drivers/net/ethernet/mellanox/mlx5/core/en/ptp.h +1 -0
@@ -48,6 +48,7 @@ int mlx5e_ptp_open(struct mlx5e_priv *priv, struct mlx5e_params *params,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); +int mlx5e_ptp_get_rqn (struct mlx5e_ptp *c,u32 *rqn);enum {MLX5E_SKB_CB_CQE_HWTSTAMP =BIT (0 ),
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +36 -4
@@ -2329,7 +2329,8 @@ static u32 mlx5e_get_direct_rqn(struct mlx5e_priv *priv, int ix, }static void mlx5e_redirect_rqts (struct mlx5e_priv *priv, -struct mlx5e_redirect_rqt_param rrp) +struct mlx5e_redirect_rqt_param rrp, +struct mlx5e_redirect_rqt_param *ptp_rrp) {u32 rqtn;int ix;
@@ -2355,11 +2356,17 @@ static void mlx5e_redirect_rqts(struct mlx5e_priv *priv, rqtn = priv->direct_tir[ix].rqt.rqtn;mlx5e_redirect_rqt (priv, rqtn,1 , direct_rrp); } +if (ptp_rrp) { + rqtn = priv->ptp_tir.rqt.rqtn; +mlx5e_redirect_rqt (priv, rqtn,1 , *ptp_rrp); + } }static void mlx5e_redirect_rqts_to_channels (struct mlx5e_priv *priv,struct mlx5e_channels *chs) { +bool rx_ptp_support = priv->profile->rx_ptp_support; +struct mlx5e_redirect_rqt_param *ptp_rrp_p =NULL ;struct mlx5e_redirect_rqt_param rrp = { .is_rss = true, {
@@ -2369,12 +2376,22 @@ static void mlx5e_redirect_rqts_to_channels(struct mlx5e_priv *priv, } }, }; +struct mlx5e_redirect_rqt_param ptp_rrp; + +if (rx_ptp_support) { +u32 ptp_rqn; -mlx5e_redirect_rqts (priv, rrp); + ptp_rrp.is_rss = false; + ptp_rrp.rqn =mlx5e_ptp_get_rqn (priv->channels.ptp, &ptp_rqn) ? + priv->drop_rq.rqn : ptp_rqn; + ptp_rrp_p = &ptp_rrp; + } +mlx5e_redirect_rqts (priv, rrp, ptp_rrp_p); }static void mlx5e_redirect_rqts_to_drop (struct mlx5e_priv *priv) { +bool rx_ptp_support = priv->profile->rx_ptp_support;struct mlx5e_redirect_rqt_param drop_rrp = { .is_rss = false, {
@@ -2382,7 +2399,7 @@ static void mlx5e_redirect_rqts_to_drop(struct mlx5e_priv *priv) }, }; -mlx5e_redirect_rqts (priv, drop_rrp); +mlx5e_redirect_rqts (priv, drop_rrp, rx_ptp_support ? &drop_rrp :NULL ); }static const struct mlx5e_tirc_config tirc_default_config[MLX5E_NUM_INDIR_TIRS ] = {
@@ -4944,10 +4961,18 @@ static int mlx5e_init_nic_rx(struct mlx5e_priv *priv)if (unlikely (err)) goto err_destroy_xsk_rqts; + err =mlx5e_create_direct_rqts (priv, &priv->ptp_tir,1 ); +if (err) + goto err_destroy_xsk_tirs; + + err =mlx5e_create_direct_tirs (priv, &priv->ptp_tir,1 ); +if (err) + goto err_destroy_ptp_rqt; + err =mlx5e_create_flow_steering (priv);if (err) {mlx5_core_warn (mdev,"create flow steering failed, %d\n" , err); - goto err_destroy_xsk_tirs; + goto err_destroy_ptp_direct_tir; } err =mlx5e_tc_nic_init (priv);
@@ -4968,6 +4993,10 @@ static int mlx5e_init_nic_rx(struct mlx5e_priv *priv)mlx5e_tc_nic_cleanup (priv); err_destroy_flow_steering:mlx5e_destroy_flow_steering (priv); +err_destroy_ptp_direct_tir: +mlx5e_destroy_direct_tirs (priv, &priv->ptp_tir,1 ); +err_destroy_ptp_rqt: +mlx5e_destroy_direct_rqts (priv, &priv->ptp_tir,1 ); err_destroy_xsk_tirs:mlx5e_destroy_direct_tirs (priv, priv->xsk_tir, max_nch); err_destroy_xsk_rqts:
@@ -4994,6 +5023,8 @@ static void mlx5e_cleanup_nic_rx(struct mlx5e_priv *priv)mlx5e_accel_cleanup_rx (priv);mlx5e_tc_nic_cleanup (priv);mlx5e_destroy_flow_steering (priv); +mlx5e_destroy_direct_tirs (priv, &priv->ptp_tir,1 ); +mlx5e_destroy_direct_rqts (priv, &priv->ptp_tir,1 );mlx5e_destroy_direct_tirs (priv, priv->xsk_tir, max_nch);mlx5e_destroy_direct_rqts (priv, priv->xsk_tir, max_nch);mlx5e_destroy_direct_tirs (priv, priv->direct_tir, max_nch);
@@ -5106,6 +5137,7 @@ static const struct mlx5e_profile mlx5e_nic_profile = { .rq_groups = MLX5E_NUM_RQ_GROUPS(XSK), .stats_grps = mlx5e_nic_stats_grps, .stats_grps_num = mlx5e_nic_stats_grps_num, + .rx_ptp_support = true, };/* mlx5e generic netdev management API (move to en_common.c) */
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +2 -0
@@ -1062,6 +1062,7 @@ static const struct mlx5e_profile mlx5e_rep_profile = { .rq_groups = MLX5E_NUM_RQ_GROUPS(REGULAR), .stats_grps = mlx5e_rep_stats_grps, .stats_grps_num = mlx5e_rep_stats_grps_num, + .rx_ptp_support = false, };static const struct mlx5e_profile mlx5e_uplink_rep_profile = {
@@ -1082,6 +1083,7 @@ static const struct mlx5e_profile mlx5e_uplink_rep_profile = { .rq_groups = MLX5E_NUM_RQ_GROUPS(XSK), .stats_grps = mlx5e_ul_rep_stats_grps, .stats_grps_num = mlx5e_ul_rep_stats_grps_num, + .rx_ptp_support = false, };/* e-Switch vport representors */
drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c +1 -0
@@ -473,6 +473,7 @@ static const struct mlx5e_profile mlx5i_nic_profile = { .rq_groups = MLX5E_NUM_RQ_GROUPS(REGULAR), .stats_grps = mlx5i_stats_grps, .stats_grps_num = mlx5i_stats_grps_num, + .rx_ptp_support = false, };/* mlx5i netdev NDos */
drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib_vlan.c +1 -0
@@ -350,6 +350,7 @@ static const struct mlx5e_profile mlx5i_pkey_nic_profile = { .rx_handlers = &mlx5i_rx_handlers, .max_tc = MLX5I_MAX_NUM_TC, .rq_groups = MLX5E_NUM_RQ_GROUPS(REGULAR), + .rx_ptp_support = false, };const struct mlx5e_profile *mlx5i_pkey_get_profile (void )
Signature · 1 line
2.30.2
PATCH 5/12 net/mlx5e: Refactor RX reporter diagnostics
In reply to Saeed MahameedFrom: Aya Levin <[email protected]>
Break RX diagnostics function into smaller helpers. This enables easier enhancement in the next patch in the set.
--- .../mellanox/mlx5/core/en/reporter_rx.c | 104 +++++++++++------- 1 file changed, 66 insertions(+), 38 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en/reporter_rx.c +66 -38
@@ -230,8 +230,9 @@ static int mlx5e_reporter_icosq_diagnose(struct mlx5e_icosq *icosq, u8 hw_state,return mlx5e_health_fmsg_named_obj_nest_end (fmsg); } -static int mlx5e_rx_reporter_build_diagnose_output (struct mlx5e_rq *rq, -struct devlink_fmsg *fmsg) +static int +mlx5e_rx_reporter_build_diagnose_output_rq_common (struct mlx5e_rq *rq, +struct devlink_fmsg *fmsg) {u16 wqe_counter;int wqes_sz;
@@ -247,14 +248,6 @@ static int mlx5e_rx_reporter_build_diagnose_output(struct mlx5e_rq *rq, wq_head =mlx5e_rqwq_get_head (rq); wqe_counter =mlx5e_rqwq_get_wqe_counter (rq); - err =devlink_fmsg_obj_nest_start (fmsg); -if (err) -return err; - - err =devlink_fmsg_u32_pair_put (fmsg,"channel ix" , rq->ix); -if (err) -return err; - err =devlink_fmsg_u32_pair_put (fmsg,"rqn" , rq->rqn);if (err)return err;
@@ -300,61 +293,96 @@ static int mlx5e_rx_reporter_build_diagnose_output(struct mlx5e_rq *rq,return err; } - err =devlink_fmsg_obj_nest_end (fmsg); +return 0 ; +} + +static int mlx5e_rx_reporter_build_diagnose_output (struct mlx5e_rq *rq, +struct devlink_fmsg *fmsg) +{ +int err; + + err =devlink_fmsg_obj_nest_start (fmsg);if (err)return err; -return 0 ; + err =devlink_fmsg_u32_pair_put (fmsg,"channel ix" , rq->ix); +if (err) +return err; + + err =mlx5e_rx_reporter_build_diagnose_output_rq_common (rq, fmsg); +if (err) +return err; + +return devlink_fmsg_obj_nest_end (fmsg); } -static int mlx5e_rx_reporter_diagnose (struct devlink_health_reporter *reporter, -struct devlink_fmsg *fmsg, -struct netlink_ext_ack *extack) +static int mlx5e_rx_reporter_diagnose_generic_rq (struct mlx5e_rq *rq, +struct devlink_fmsg *fmsg) { -struct mlx5e_priv *priv =devlink_health_reporter_priv (reporter); -struct mlx5e_params *params = &priv->channels.params; -struct mlx5e_rq *generic_rq; +struct mlx5e_priv *priv = rq->priv; +struct mlx5e_params *params;u32 rq_stride, rq_sz; -int i, err =0 ; - -mutex_lock (&priv->state_lock); - -if (!test_bit (MLX5E_STATE_OPENED , &priv->state)) - goto unlock; +int err; - generic_rq = &priv->channels.c[0 ]->rq; - rq_sz =mlx5e_rqwq_get_size (generic_rq); + params = &priv->channels.params; + rq_sz =mlx5e_rqwq_get_size (rq); rq_stride =BIT (mlx5e_mpwqe_get_log_stride_size (priv->mdev, params,NULL )); - err =mlx5e_health_fmsg_named_obj_nest_start (fmsg,"Common config" ); -if (err) - goto unlock; - err =mlx5e_health_fmsg_named_obj_nest_start (fmsg,"RQ" );if (err) - goto unlock; +return err; err =devlink_fmsg_u8_pair_put (fmsg,"type" , params->rq_wq_type);if (err) - goto unlock; +return err; err =devlink_fmsg_u64_pair_put (fmsg,"stride size" , rq_stride);if (err) - goto unlock; +return err; err =devlink_fmsg_u32_pair_put (fmsg,"size" , rq_sz);if (err) - goto unlock; +return err; - err =mlx5e_health_cq_common_diag_fmsg (&generic_rq->cq, fmsg); + err =mlx5e_health_cq_common_diag_fmsg (&rq->cq, fmsg);if (err) - goto unlock; +return err; - err =mlx5e_health_fmsg_named_obj_nest_end (fmsg); +return mlx5e_health_fmsg_named_obj_nest_end (fmsg); +} + +static int +mlx5e_rx_reporter_diagnose_common_config (struct devlink_health_reporter *reporter, +struct devlink_fmsg *fmsg) +{ +struct mlx5e_priv *priv =devlink_health_reporter_priv (reporter); +struct mlx5e_rq *generic_rq = &priv->channels.c[0 ]->rq; +int err; + + err =mlx5e_health_fmsg_named_obj_nest_start (fmsg,"Common config" );if (err) +return err; + + err =mlx5e_rx_reporter_diagnose_generic_rq (generic_rq, fmsg); +if (err) +return err; + +return mlx5e_health_fmsg_named_obj_nest_end (fmsg); +} + +static int mlx5e_rx_reporter_diagnose (struct devlink_health_reporter *reporter, +struct devlink_fmsg *fmsg, +struct netlink_ext_ack *extack) +{ +struct mlx5e_priv *priv =devlink_health_reporter_priv (reporter); +int i, err =0 ; + +mutex_lock (&priv->state_lock); + +if (!test_bit (MLX5E_STATE_OPENED , &priv->state)) goto unlock; - err =mlx5e_health_fmsg_named_obj_nest_end (fmsg); + err =mlx5e_rx_reporter_diagnose_common_config (reporter, fmsg);if (err) goto unlock;
Signature · 1 line
2.30.2
PATCH 6/12 net/mlx5e: Add PTP RQ to RX reporter
In reply to Saeed MahameedFrom: Aya Levin <[email protected]>
When present, add the PTP RQ to the RX reporter.
--- .../mellanox/mlx5/core/en/reporter_rx.c | 68 ++++++++++++++++++- 1 file changed, 66 insertions(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en/reporter_rx.c +66 -2
@@ -5,6 +5,7 @@#include "params.h" #include "txrx.h" #include "devlink.h" +#include "ptp.h" static int mlx5e_query_rq_state (struct mlx5_core_dev *dev,u32 rqn,u8 *state) {
@@ -351,12 +352,34 @@ static int mlx5e_rx_reporter_diagnose_generic_rq(struct mlx5e_rq *rq,return mlx5e_health_fmsg_named_obj_nest_end (fmsg); } +static int +mlx5e_rx_reporter_diagnose_common_ptp_config (struct mlx5e_priv *priv,struct mlx5e_ptp *ptp_ch, +struct devlink_fmsg *fmsg) +{ +int err; + + err =mlx5e_health_fmsg_named_obj_nest_start (fmsg,"PTP" ); +if (err) +return err; + + err =devlink_fmsg_u32_pair_put (fmsg,"filter_type" , priv->tstamp.rx_filter); +if (err) +return err; + + err =mlx5e_rx_reporter_diagnose_generic_rq (&ptp_ch->rq, fmsg); +if (err) +return err; + +return mlx5e_health_fmsg_named_obj_nest_end (fmsg); +} +static int mlx5e_rx_reporter_diagnose_common_config (struct devlink_health_reporter *reporter,struct devlink_fmsg *fmsg) {struct mlx5e_priv *priv =devlink_health_reporter_priv (reporter);struct mlx5e_rq *generic_rq = &priv->channels.c[0 ]->rq; +struct mlx5e_ptp *ptp_ch = priv->channels.ptp;int err; err =mlx5e_health_fmsg_named_obj_nest_start (fmsg,"Common config" );
@@ -367,14 +390,45 @@ mlx5e_rx_reporter_diagnose_common_config(struct devlink_health_reporter *reporteif (err)return err; +if (ptp_ch &&test_bit (MLX5E_PTP_STATE_RX , ptp_ch->state)) { + err =mlx5e_rx_reporter_diagnose_common_ptp_config (priv, ptp_ch, fmsg); +if (err) +return err; + } +return mlx5e_health_fmsg_named_obj_nest_end (fmsg); } +static int mlx5e_rx_reporter_build_diagnose_output_ptp_rq (struct mlx5e_rq *rq, +struct devlink_fmsg *fmsg) +{ +int err; + + err =devlink_fmsg_obj_nest_start (fmsg); +if (err) +return err; + + err =devlink_fmsg_string_pair_put (fmsg,"channel" ,"ptp" ); +if (err) +return err; + + err =mlx5e_rx_reporter_build_diagnose_output_rq_common (rq, fmsg); +if (err) +return err; + + err =devlink_fmsg_obj_nest_end (fmsg); +if (err) +return err; + +return 0 ; +} +static int mlx5e_rx_reporter_diagnose (struct devlink_health_reporter *reporter,struct devlink_fmsg *fmsg,struct netlink_ext_ack *extack) {struct mlx5e_priv *priv =devlink_health_reporter_priv (reporter); +struct mlx5e_ptp *ptp_ch = priv->channels.ptp;int i, err =0 ;mutex_lock (&priv->state_lock);
@@ -397,9 +451,12 @@ static int mlx5e_rx_reporter_diagnose(struct devlink_health_reporter *reporter,if (err) goto unlock; } +if (ptp_ch &&test_bit (MLX5E_PTP_STATE_RX , ptp_ch->state)) { + err =mlx5e_rx_reporter_build_diagnose_output_ptp_rq (&ptp_ch->rq, fmsg); +if (err) + goto unlock; + } err =devlink_fmsg_arr_pair_nest_end (fmsg); -if (err) - goto unlock; unlock:mutex_unlock (&priv->state_lock);return err;
@@ -531,6 +588,7 @@ static int mlx5e_rx_reporter_dump_rq(struct mlx5e_priv *priv, struct devlink_fmsstatic int mlx5e_rx_reporter_dump_all_rqs (struct mlx5e_priv *priv,struct devlink_fmsg *fmsg) { +struct mlx5e_ptp *ptp_ch = priv->channels.ptp;struct mlx5_rsc_key key = {};int i, err;
@@ -563,6 +621,12 @@ static int mlx5e_rx_reporter_dump_all_rqs(struct mlx5e_priv *priv,return err; } +if (ptp_ch &&test_bit (MLX5E_PTP_STATE_RX , ptp_ch->state)) { + err =mlx5e_health_queue_dump (priv, fmsg, ptp_ch->rq.rqn,"PTP RQ" ); +if (err) +return err; + } +return devlink_fmsg_arr_pair_nest_end (fmsg); }
Signature · 1 line
2.30.2
PATCH 7/12 net/mlx5e: Cleanup Flow Steering level
In reply to Saeed MahameedFrom: Aya Levin <[email protected]>
Flow Steering levels are used to determine the order between the tables. As of today, each one of these tables follows the TTC table, and hijacks its traffic, and cannot be combined together for now. Putting them in the same layer better reflects the situation.
--- drivers/net/ethernet/mellanox/mlx5/core/en/fs.h | 4 ++-- drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en/fs.h +2 -2
@@ -138,10 +138,10 @@ enum { MLX5E_TTC_FT_LEVEL, MLX5E_INNER_TTC_FT_LEVEL,#ifdef CONFIG_MLX5_EN_TLS - MLX5E_ACCEL_FS_TCP_FT_LEVEL, + MLX5E_ACCEL_FS_TCP_FT_LEVEL = MLX5E_INNER_TTC_FT_LEVEL + 1,#endif #ifdef CONFIG_MLX5_EN_ARFS - MLX5E_ARFS_FT_LEVEL, + MLX5E_ARFS_FT_LEVEL = MLX5E_INNER_TTC_FT_LEVEL + 1,#endif #ifdef CONFIG_MLX5_EN_IPSEC MLX5E_ACCEL_FS_ESP_FT_LEVEL = MLX5E_INNER_TTC_FT_LEVEL + 1,
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c +1 -1
@@ -105,7 +105,7 @@#define ETHTOOL_PRIO_NUM_LEVELS 1#define ETHTOOL_NUM_PRIOS 11#define ETHTOOL_MIN_LEVEL (KERNEL_MIN_LEVEL + ETHTOOL_NUM_PRIOS) -/* Promiscuous, Vlan, mac, ttc, inner ttc, {aRFS/accel and esp/esp_err} */ +/* Promiscuous, Vlan, mac, ttc, inner ttc, {aRFS/accel/{esp, esp_err}} */ #define KERNEL_NIC_PRIO_NUM_LEVELS 7#define KERNEL_NIC_NUM_PRIOS 1/* One more level for tc */
Signature · 1 line
2.30.2
PATCH 8/12 net/mlx5e: Introduce Flow Steering UDP API
In reply to Saeed MahameedFrom: Aya Levin <[email protected]>
Add a new FS API which captures the UDP traffic from the traffic classifier into a dedicated FS table. This API handles both UDP over IPv4 and IPv6 in the same manner. The tables (one for UDPv4 and another for UDPv6) consist of a group matching the UDP destination port and a must-be-last group which contains a default rule redirecting the unmatched packets back to the RSS logic.
--- .../net/ethernet/mellanox/mlx5/core/Makefile | 2 +- .../net/ethernet/mellanox/mlx5/core/en/fs.h | 4 + .../mellanox/mlx5/core/en/fs_tt_redirect.c | 343 ++++++++++++++++++ .../mellanox/mlx5/core/en/fs_tt_redirect.h | 19 + .../net/ethernet/mellanox/mlx5/core/fs_core.c | 2 +- 5 files changed, 368 insertions(+), 2 deletions(-) create mode 100644 drivers/net/ethernet/mellanox/mlx5/core/en/fs_tt_redirect.c create mode 100644 drivers/net/ethernet/mellanox/mlx5/core/en/fs_tt_redirect.h
drivers/net/ethernet/mellanox/mlx5/core/Makefile +1 -1
@@ -27,7 +27,7 @@ mlx5_core-$(CONFIG_MLX5_CORE_EN) += en_main.o en_common.o en_fs.o en_ethtool.o \ en_selftest.o en/port.o en/monitor_stats.o en/health.o \ en/reporter_tx.o en/reporter_rx.o en/params.o en/xsk/pool.o \ en/xsk/setup.o en/xsk/rx.o en/xsk/tx.o en/devlink.o en/ptp.o \ - en/qos.o en/trap.o + en/qos.o en/trap.o en/fs_tt_redirect.o # # Netdev extra
drivers/net/ethernet/mellanox/mlx5/core/en/fs.h +4 -0
@@ -137,6 +137,7 @@ enum {MLX5E_L2_FT_LEVEL ,MLX5E_TTC_FT_LEVEL ,MLX5E_INNER_TTC_FT_LEVEL , +MLX5E_FS_TT_UDP_FT_LEVEL =MLX5E_INNER_TTC_FT_LEVEL +1 , #ifdef CONFIG_MLX5_EN_TLS MLX5E_ACCEL_FS_TCP_FT_LEVEL = MLX5E_INNER_TTC_FT_LEVEL + 1, #endif
@@ -241,6 +242,8 @@ static inline int mlx5e_arfs_disable(struct mlx5e_priv *priv) { return -EOPNOTSUstruct mlx5e_accel_fs_tcp ;#endif +struct mlx5e_fs_udp ; +struct mlx5e_flow_steering {struct mlx5_flow_namespace *ns;struct mlx5_flow_namespace *egress_ns;
@@ -259,6 +262,7 @@ struct mlx5e_flow_steering {#ifdef CONFIG_MLX5_EN_TLS struct mlx5e_accel_fs_tcp *accel_tcp;#endif +struct mlx5e_fs_udp *udp; };struct ttc_params {
drivers/net/ethernet/mellanox/mlx5/core/en/fs_tt_redirect.c new file +343 -0
343 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/en/fs_tt_redirect.h new file +19 -0
@@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */ +/* Copyright (c) 2021 Mellanox Technologies. */ + +#ifndef __MLX5E_FS_TT_REDIRECT_H__ +#define __MLX5E_FS_TT_REDIRECT_H__ + +#include "en.h" +#include "en/fs.h" + +void mlx5e_fs_tt_redirect_del_rule (struct mlx5_flow_handle *rule); + +/* UDP traffic type redirect */ +struct mlx5_flow_handle * +mlx5e_fs_tt_redirect_udp_add_rule (struct mlx5e_priv *priv, +enum mlx5e_traffic_types ttc_type, +u32 tir_num,u16 d_port); +void mlx5e_fs_tt_redirect_udp_destroy (struct mlx5e_priv *priv); +int mlx5e_fs_tt_redirect_udp_create (struct mlx5e_priv *priv); +#endif
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c +1 -1
@@ -105,7 +105,7 @@#define ETHTOOL_PRIO_NUM_LEVELS 1#define ETHTOOL_NUM_PRIOS 11#define ETHTOOL_MIN_LEVEL (KERNEL_MIN_LEVEL + ETHTOOL_NUM_PRIOS) -/* Promiscuous, Vlan, mac, ttc, inner ttc, {aRFS/accel/{esp, esp_err}} */ +/* Promiscuous, Vlan, mac, ttc, inner ttc, {UDP/aRFS/accel/{esp, esp_err}} */ #define KERNEL_NIC_PRIO_NUM_LEVELS 7#define KERNEL_NIC_NUM_PRIOS 1/* One more level for tc */
Signature · 1 line
2.30.2
PATCH 9/12 net/mlx5e: Introduce Flow Steering ANY API
In reply to Saeed MahameedFrom: Aya Levin <[email protected]>
Add a new FS API which captures the ANY traffic from the traffic classifier into a dedicated FS table. The table consists of a group matching the ethertype and a must-be-last group which contains a default rule redirecting the unmatched packets back to the RSS logic.
--- .../net/ethernet/mellanox/mlx5/core/en/fs.h | 3 + .../mellanox/mlx5/core/en/fs_tt_redirect.c | 262 ++++++++++++++++++ .../mellanox/mlx5/core/en/fs_tt_redirect.h | 7 + .../net/ethernet/mellanox/mlx5/core/fs_core.c | 2 +- 4 files changed, 273 insertions(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/en/fs.h +3 -0
@@ -138,6 +138,7 @@ enum {MLX5E_TTC_FT_LEVEL ,MLX5E_INNER_TTC_FT_LEVEL ,MLX5E_FS_TT_UDP_FT_LEVEL =MLX5E_INNER_TTC_FT_LEVEL +1 , +MLX5E_FS_TT_ANY_FT_LEVEL =MLX5E_INNER_TTC_FT_LEVEL +1 , #ifdef CONFIG_MLX5_EN_TLS MLX5E_ACCEL_FS_TCP_FT_LEVEL = MLX5E_INNER_TTC_FT_LEVEL + 1, #endif
@@ -243,6 +244,7 @@ struct mlx5e_accel_fs_tcp;#endif struct mlx5e_fs_udp ; +struct mlx5e_fs_any ;struct mlx5e_flow_steering {struct mlx5_flow_namespace *ns;
@@ -263,6 +265,7 @@ struct mlx5e_flow_steering {struct mlx5e_accel_fs_tcp *accel_tcp;#endif struct mlx5e_fs_udp *udp; +struct mlx5e_fs_any *any; };struct ttc_params {
drivers/net/ethernet/mellanox/mlx5/core/en/fs_tt_redirect.c +262 -0
271 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/en/fs_tt_redirect.h +7 -0
@@ -16,4 +16,11 @@ mlx5e_fs_tt_redirect_udp_add_rule(struct mlx5e_priv *priv, u32 tir_num, u16 d_port);void mlx5e_fs_tt_redirect_udp_destroy (struct mlx5e_priv *priv);int mlx5e_fs_tt_redirect_udp_create (struct mlx5e_priv *priv); + +/* ANY traffic type redirect*/ +struct mlx5_flow_handle * +mlx5e_fs_tt_redirect_any_add_rule (struct mlx5e_priv *priv, +u32 tir_num,u16 ether_type); +void mlx5e_fs_tt_redirect_any_destroy (struct mlx5e_priv *priv); +int mlx5e_fs_tt_redirect_any_create (struct mlx5e_priv *priv);#endif
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c +1 -1
@@ -105,7 +105,7 @@#define ETHTOOL_PRIO_NUM_LEVELS 1#define ETHTOOL_NUM_PRIOS 11#define ETHTOOL_MIN_LEVEL (KERNEL_MIN_LEVEL + ETHTOOL_NUM_PRIOS) -/* Promiscuous, Vlan, mac, ttc, inner ttc, {UDP/aRFS/accel/{esp, esp_err}} */ +/* Promiscuous, Vlan, mac, ttc, inner ttc, {UDP/ANY/aRFS/accel/{esp, esp_err}} */ #define KERNEL_NIC_PRIO_NUM_LEVELS 7#define KERNEL_NIC_NUM_PRIOS 1/* One more level for tc */
Signature · 1 line
2.30.2
PATCH 10/12 net/mlx5e: Add PTP Flow Steering support
In reply to Saeed MahameedFrom: Aya Levin <[email protected]>
When opening PTP channel with MLX5E_PTP_STATE_RX set, add the corresponding flow steering rules. Capture UDP packets with destination port 319 and L2 packets with ethertype 0x88F7 and steer them into the RQ of the PTP channel.
Add API that manages the flow steering rules to be used in the following patches via safe_reopen_channels mechanism.
--- .../net/ethernet/mellanox/mlx5/core/en/fs.h | 2 + .../net/ethernet/mellanox/mlx5/core/en/ptp.c | 134 +++++++++++++++++- .../net/ethernet/mellanox/mlx5/core/en/ptp.h | 3 + .../net/ethernet/mellanox/mlx5/core/en_fs.c | 8 ++ 4 files changed, 146 insertions(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/en/fs.h +2 -0
@@ -245,6 +245,7 @@ struct mlx5e_accel_fs_tcp;struct mlx5e_fs_udp ;struct mlx5e_fs_any ; +struct mlx5e_ptp_fs ;struct mlx5e_flow_steering {struct mlx5_flow_namespace *ns;
@@ -266,6 +267,7 @@ struct mlx5e_flow_steering {#endif struct mlx5e_fs_udp *udp;struct mlx5e_fs_any *any; +struct mlx5e_ptp_fs *ptp_fs; };struct ttc_params {
drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c +133 -1
159 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/en/ptp.h +3 -0
@@ -49,6 +49,9 @@ 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);int mlx5e_ptp_get_rqn (struct mlx5e_ptp *c,u32 *rqn); +int mlx5e_ptp_alloc_rx_fs (struct mlx5e_priv *priv); +void mlx5e_ptp_free_rx_fs (struct mlx5e_priv *priv); +int mlx5e_ptp_rx_manage_fs (struct mlx5e_priv *priv,bool set);enum {MLX5E_SKB_CB_CQE_HWTSTAMP =BIT (0 ),
drivers/net/ethernet/mellanox/mlx5/core/en_fs.c +8 -0
@@ -38,6 +38,7 @@#include "en.h" #include "en_rep.h" #include "lib/mpfs.h" +#include "en/ptp.h" static int mlx5e_add_l2_flow_rule (struct mlx5e_priv *priv,struct mlx5e_l2_rule *ai,int type);
@@ -1792,10 +1793,16 @@ int mlx5e_create_flow_steering(struct mlx5e_priv *priv) goto err_destroy_l2_table; } + err =mlx5e_ptp_alloc_rx_fs (priv); +if (err) + goto err_destory_vlan_table; +mlx5e_ethtool_init_steering (priv);return 0 ; +err_destory_vlan_table: +mlx5e_destroy_vlan_table (priv); err_destroy_l2_table:mlx5e_destroy_l2_table (priv); err_destroy_ttc_table:
@@ -1810,6 +1817,7 @@ int mlx5e_create_flow_steering(struct mlx5e_priv *priv)void mlx5e_destroy_flow_steering (struct mlx5e_priv *priv) { +mlx5e_ptp_free_rx_fs (priv);mlx5e_destroy_vlan_table (priv);mlx5e_destroy_l2_table (priv);mlx5e_destroy_ttc_table (priv, &priv->fs.ttc);
Signature · 1 line
2.30.2
PATCH 11/12 net/mlx5e: Allow coexistence of CQE compression and HW TS PTP
In reply to Saeed MahameedFrom: Aya Levin <[email protected]>
Update setting HW time-stamp to allow coexistence with CQE compression. Turn on RX PTP indication and try to reopen the channels. On success, coexistence with CQE compression is enabled. Otherwise, fall-back to turning off CQE compression.
--- drivers/net/ethernet/mellanox/mlx5/core/en.h | 1 + .../net/ethernet/mellanox/mlx5/core/en/ptp.c | 3 ++ .../net/ethernet/mellanox/mlx5/core/en_main.c | 43 +++++++++++++------ 3 files changed, 35 insertions(+), 12 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en.h +1 -0
@@ -269,6 +269,7 @@ struct mlx5e_params {struct mlx5e_xsk *xsk;unsigned int sw_mtu;int hard_mtu; +bool ptp_rx; };enum {
drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c +3 -0
@@ -579,6 +579,9 @@ static int mlx5e_ptp_set_state(struct mlx5e_ptp *c, struct mlx5e_params *params)if (MLX5E_GET_PFLAG (params,MLX5E_PFLAG_TX_PORT_TS ))__set_bit (MLX5E_PTP_STATE_TX , c->state); +if (params->ptp_rx) +__set_bit (MLX5E_PTP_STATE_RX , c->state); +return bitmap_empty (c->state,MLX5E_PTP_STATE_NUM_STATES ) ? -EINVAL :0 ; }
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +31 -12
85 lines not on this page · raw message
Signature · 1 line
2.30.2
PATCH 12/12 net/mlx5e: Update ethtool setting of CQE compression
In reply to Saeed MahameedFrom: Aya Levin <[email protected]>
Remove restriction blocking configuration of CQE compression when PTP rx filter is set. Instead turn on indication for RX PTP, and try to reopen the channels.
--- drivers/net/ethernet/mellanox/mlx5/core/en.h | 1 + .../net/ethernet/mellanox/mlx5/core/en_ethtool.c | 14 ++++++++------ drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en.h +1 -0
@@ -1023,6 +1023,7 @@ int mlx5e_num_channels_changed(struct mlx5e_priv *priv);int mlx5e_num_channels_changed_ctx (struct mlx5e_priv *priv,void *context);void mlx5e_activate_priv_channels (struct mlx5e_priv *priv);void mlx5e_deactivate_priv_channels (struct mlx5e_priv *priv); +int mlx5e_ptp_rx_manage_fs_ctx (struct mlx5e_priv *priv,void *ctx);void mlx5e_build_default_indir_rqt (u32 *indirection_rqt,int len,int num_channels);
drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +8 -6
@@ -34,6 +34,7 @@#include "en/port.h" #include "en/params.h" #include "en/xsk/pool.h" +#include "en/ptp.h" #include "lib/clock.h" void mlx5e_ethtool_get_drvinfo(struct mlx5e_priv *priv,
@@ -1865,13 +1866,19 @@ int mlx5e_modify_rx_cqe_compression_locked(struct mlx5e_priv *priv, bool new_val new_channels.params = priv->channels.params;MLX5E_SET_PFLAG (&new_channels.params,MLX5E_PFLAG_RX_CQE_COMPRESS , new_val); +if (priv->tstamp.rx_filter !=HWTSTAMP_FILTER_NONE ) + new_channels.params.ptp_rx = new_val;if (!test_bit (MLX5E_STATE_OPENED , &priv->state)) { priv->channels.params = new_channels.params;return 0 ; } - err =mlx5e_safe_switch_channels (priv, &new_channels,NULL ,NULL ); +if (new_channels.params.ptp_rx == priv->channels.params.ptp_rx) + err =mlx5e_safe_switch_channels (priv, &new_channels,NULL ,NULL ); +else + err =mlx5e_safe_switch_channels (priv, &new_channels, mlx5e_ptp_rx_manage_fs_ctx, + &new_channels.params.ptp_rx);if (err)return err;
@@ -1892,11 +1899,6 @@ static int set_pflag_rx_cqe_compress(struct net_device *netdev,if (!MLX5_CAP_GEN (mdev, cqe_compression))return -EOPNOTSUPP ; -if (enable && priv->tstamp.rx_filter !=HWTSTAMP_FILTER_NONE ) { -netdev_err (netdev,"Can't enable cqe compression while timestamping is enabled.\n" ); -return -EINVAL ; - } - err =mlx5e_modify_rx_cqe_compression_locked (priv, enable);if (err)return err;
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +1 -1
@@ -3970,7 +3970,7 @@ static int mlx5e_change_nic_mtu(struct net_device *netdev, int new_mtu)return mlx5e_change_mtu (netdev, new_mtu, mlx5e_set_dev_port_mtu_ctx); } -static int mlx5e_ptp_rx_manage_fs_ctx (struct mlx5e_priv *priv,void *ctx) +int mlx5e_ptp_rx_manage_fs_ctx (struct mlx5e_priv *priv,void *ctx) {bool set = *(bool *)ctx;
Signature · 1 line
2.30.2