Skip to content

Commit 214baf2

Browse files
Maxim Mikityanskiykuba-moo
authored andcommitted
net/mlx5e: Support HTB offload
This commit adds support for HTB offload in the mlx5e driver. Performance: NIC: Mellanox ConnectX-6 Dx CPU: Intel(R) Xeon(R) CPU E5-2680 v3 @ 2.50GHz (24 cores with HT) 100 Gbit/s line rate, 500 UDP streams @ ~200 Mbit/s each 48 traffic classes, flower used for steering No shaping (rate limits set to 4 Gbit/s per TC) - checking for max throughput. Baseline: 98.7 Gbps, 8.25 Mpps HTB: 6.7 Gbps, 0.56 Mpps HTB offload: 95.6 Gbps, 8.00 Mpps Limitations: 1. 256 leaf nodes, 3 levels of depth. 2. Granularity for ceil is 1 Mbit/s. Rates are converted to weights, and the bandwidth is split among the siblings according to these weights. Other parameters for classes are not supported. Ethtool statistics support for QoS SQs are also added. The counters are called qos_txN_*, where N is the QoS queue number (starting from 0, the numeration is separate from the normal SQs), and * is the counter name (the counters are the same as for the normal SQs). Signed-off-by: Maxim Mikityanskiy <maximmi@mellanox.com> Reviewed-by: Tariq Toukan <tariqt@nvidia.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 8327158 commit 214baf2

File tree

15 files changed

+1516
-49
lines changed

15 files changed

+1516
-49
lines changed

drivers/net/ethernet/mellanox/mlx5/core/Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ mlx5_core-y := main.o cmd.o debugfs.o fw.o eq.o uar.o pagealloc.o \
1616
transobj.o vport.o sriov.o fs_cmd.o fs_core.o pci_irq.o \
1717
fs_counters.o rl.o lag.o dev.o events.o wq.o lib/gid.o \
1818
lib/devcom.o lib/pci_vsc.o lib/dm.o diag/fs_tracepoint.o \
19-
diag/fw_tracer.o diag/crdump.o devlink.o diag/rsc_dump.o fw_reset.o
19+
diag/fw_tracer.o diag/crdump.o devlink.o diag/rsc_dump.o \
20+
fw_reset.o qos.o
2021

2122
#
2223
# Netdev basic
@@ -25,7 +26,8 @@ mlx5_core-$(CONFIG_MLX5_CORE_EN) += en_main.o en_common.o en_fs.o en_ethtool.o \
2526
en_tx.o en_rx.o en_dim.o en_txrx.o en/xdp.o en_stats.o \
2627
en_selftest.o en/port.o en/monitor_stats.o en/health.o \
2728
en/reporter_tx.o en/reporter_rx.o en/params.o en/xsk/pool.o \
28-
en/xsk/setup.o en/xsk/rx.o en/xsk/tx.o en/devlink.o en/ptp.o
29+
en/xsk/setup.o en/xsk/rx.o en/xsk/tx.o en/devlink.o en/ptp.o \
30+
en/qos.o
2931

3032
#
3133
# Netdev extra

drivers/net/ethernet/mellanox/mlx5/core/en.h

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
#include "en_stats.h"
5656
#include "en/dcbnl.h"
5757
#include "en/fs.h"
58+
#include "en/qos.h"
5859
#include "lib/hv_vhca.h"
5960

6061
extern const struct net_device_ops mlx5e_netdev_ops;
@@ -161,6 +162,9 @@ do { \
161162
##__VA_ARGS__); \
162163
} while (0)
163164

165+
#define mlx5e_state_dereference(priv, p) \
166+
rcu_dereference_protected((p), lockdep_is_held(&(priv)->state_lock))
167+
164168
enum mlx5e_rq_group {
165169
MLX5E_RQ_GROUP_REGULAR,
166170
MLX5E_RQ_GROUP_XSK,
@@ -663,11 +667,13 @@ struct mlx5e_channel {
663667
struct mlx5e_xdpsq rq_xdpsq;
664668
struct mlx5e_txqsq sq[MLX5E_MAX_NUM_TC];
665669
struct mlx5e_icosq icosq; /* internal control operations */
670+
struct mlx5e_txqsq __rcu * __rcu *qos_sqs;
666671
bool xdp;
667672
struct napi_struct napi;
668673
struct device *pdev;
669674
struct net_device *netdev;
670675
__be32 mkey_be;
676+
u16 qos_sqs_size;
671677
u8 num_tc;
672678
u8 lag_port;
673679

@@ -756,6 +762,8 @@ struct mlx5e_modify_sq_param {
756762
int next_state;
757763
int rl_update;
758764
int rl_index;
765+
bool qos_update;
766+
u16 qos_queue_group_id;
759767
};
760768

761769
#if IS_ENABLED(CONFIG_PCI_HYPERV_INTERFACE)
@@ -788,10 +796,20 @@ struct mlx5e_scratchpad {
788796
cpumask_var_t cpumask;
789797
};
790798

799+
struct mlx5e_htb {
800+
DECLARE_HASHTABLE(qos_tc2node, order_base_2(MLX5E_QOS_MAX_LEAF_NODES));
801+
DECLARE_BITMAP(qos_used_qids, MLX5E_QOS_MAX_LEAF_NODES);
802+
struct mlx5e_sq_stats **qos_sq_stats;
803+
u16 max_qos_sqs;
804+
u16 maj_id;
805+
u16 defcls;
806+
};
807+
791808
struct mlx5e_priv {
792809
/* priv data path fields - start */
793810
/* +1 for port ptp ts */
794-
struct mlx5e_txqsq *txq2sq[(MLX5E_MAX_NUM_CHANNELS + 1) * MLX5E_MAX_NUM_TC];
811+
struct mlx5e_txqsq *txq2sq[(MLX5E_MAX_NUM_CHANNELS + 1) * MLX5E_MAX_NUM_TC +
812+
MLX5E_QOS_MAX_LEAF_NODES];
795813
int channel_tc2realtxq[MLX5E_MAX_NUM_CHANNELS][MLX5E_MAX_NUM_TC];
796814
int port_ptp_tc2realtxq[MLX5E_MAX_NUM_TC];
797815
#ifdef CONFIG_MLX5_CORE_EN_DCB
@@ -859,6 +877,7 @@ struct mlx5e_priv {
859877
struct mlx5e_hv_vhca_stats_agent stats_agent;
860878
#endif
861879
struct mlx5e_scratchpad scratchpad;
880+
struct mlx5e_htb htb;
862881
};
863882

864883
struct mlx5e_rx_handlers {
@@ -986,6 +1005,7 @@ int mlx5e_safe_switch_channels(struct mlx5e_priv *priv,
9861005
struct mlx5e_channels *new_chs,
9871006
mlx5e_fp_preactivate preactivate,
9881007
void *context);
1008+
int mlx5e_update_tx_netdev_queues(struct mlx5e_priv *priv);
9891009
int mlx5e_num_channels_changed(struct mlx5e_priv *priv);
9901010
int mlx5e_num_channels_changed_ctx(struct mlx5e_priv *priv, void *context);
9911011
void mlx5e_activate_priv_channels(struct mlx5e_priv *priv);
@@ -1010,6 +1030,9 @@ void mlx5e_deactivate_icosq(struct mlx5e_icosq *icosq);
10101030

10111031
int mlx5e_modify_sq(struct mlx5_core_dev *mdev, u32 sqn,
10121032
struct mlx5e_modify_sq_param *p);
1033+
int mlx5e_open_txqsq(struct mlx5e_channel *c, u32 tisn, int txq_ix,
1034+
struct mlx5e_params *params, struct mlx5e_sq_param *param,
1035+
struct mlx5e_txqsq *sq, int tc, u16 qos_queue_group_id, u16 qos_qid);
10131036
void mlx5e_activate_txqsq(struct mlx5e_txqsq *sq);
10141037
void mlx5e_deactivate_txqsq(struct mlx5e_txqsq *sq);
10151038
void mlx5e_free_txqsq(struct mlx5e_txqsq *sq);
@@ -1020,8 +1043,10 @@ struct mlx5e_create_sq_param;
10201043
int mlx5e_create_sq_rdy(struct mlx5_core_dev *mdev,
10211044
struct mlx5e_sq_param *param,
10221045
struct mlx5e_create_sq_param *csp,
1046+
u16 qos_queue_group_id,
10231047
u32 *sqn);
10241048
void mlx5e_tx_err_cqe_work(struct work_struct *recover_work);
1049+
void mlx5e_close_txqsq(struct mlx5e_txqsq *sq);
10251050

10261051
static inline bool mlx5_tx_swp_supported(struct mlx5_core_dev *mdev)
10271052
{

drivers/net/ethernet/mellanox/mlx5/core/en/params.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ void mlx5e_build_rq_param(struct mlx5e_priv *priv,
118118
struct mlx5e_rq_param *param);
119119
void mlx5e_build_sq_param_common(struct mlx5e_priv *priv,
120120
struct mlx5e_sq_param *param);
121+
void mlx5e_build_sq_param(struct mlx5e_priv *priv, struct mlx5e_params *params,
122+
struct mlx5e_sq_param *param);
121123
void mlx5e_build_rx_cq_param(struct mlx5e_priv *priv,
122124
struct mlx5e_params *params,
123125
struct mlx5e_xsk_param *xsk,

drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ static int mlx5e_ptp_open_txqsq(struct mlx5e_port_ptp *c, u32 tisn,
261261
csp.min_inline_mode = txqsq->min_inline_mode;
262262
csp.ts_cqe_to_dest_cqn = ptpsq->ts_cq.mcq.cqn;
263263

264-
err = mlx5e_create_sq_rdy(c->mdev, sqp, &csp, &txqsq->sqn);
264+
err = mlx5e_create_sq_rdy(c->mdev, sqp, &csp, 0, &txqsq->sqn);
265265
if (err)
266266
goto err_free_txqsq;
267267

0 commit comments

Comments
 (0)