Skip to content

Commit 488e5b3

Browse files
committed
Merge tag 'mlx5-updates-2017-11-04' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux
Saeed Mahameed says: ==================== mlx5-updates-2017-11-04 This series includes: From Huy: dscp to priority mapping for Ethernet packet. =================================================== First six patches enable differentiated services code point (dscp) to priority mapping for Ethernet packet. Once this feature is enabled, the packet is routed to the corresponding priority based on its dscp. User can combine this feature with priority flow control (pfc) feature to have priority flow control based on the dscp. Firmware interface: Mellanox firmware provides two control knobs for this feature: QPTS register allow changing the trust state between dscp and pcp mode. The default is pcp mode. Once in dscp mode, firmware will route the packet based on its dscp value if the dscp field exists. QPDPM register allow mapping a specific dscp (0 to 63) to a specific priority (0 to 7). By default, all the dscps are mapped to priority zero. Software interface: This feature is controlled via application priority TLV. IEEE specification P802.1Qcd/D2.1 defines priority selector id 5 for application priority TLV. This APP TLV selector defines DSCP to priority map. This APP TLV can be sent by the switch or can be set locally using software such as lldptool. In mlx5 drivers, we add the support for net dcb's getapp and setapp call back. Mlx5 driver only handles the selector id 5 application entry (dscp application priority application entry). If user sends multiple dscp to priority APP TLV entries on the same dscp, the last sent one will take effect. All the previous sent will be deleted. The firmware trust state (in QPTS register) is changed based on the number of dscp to priority application entries. When the first dscp to priority application entry is added by the user, the trust state is changed to dscp. When the last dscp to priority application entry is deleted by the user, the trust state is changed to pcp. When the port is in DSCP trust state, the transmit queue is selected based on the dscp of the skb. When the port is in DSCP trust state and vport inline mode is not NONE, firmware requires mlx5 driver to copy the IP header to the wqe ethernet segment inline header if the skb has it. This is done by changing the transmit queue sq's min inline mode to L3. Note that the min inline mode of sqs that belong to other features such as xdpsq, icosq are not modified. =================================================== Plus to the dscp series, some small misc changes are include as well: From Inbar, Ethtool msglvl support and some debug prints in DCBNL logic From Or Gerlitz, Enlarge the NIC TC offload table size From Rabie, Initialize destination_flow struct to 0 From Feras, Add inner TTC table to IPoIB flow steering From Tal, Enable CQE based moderation on TX CQ ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents bfe26ba + 0088cbb commit 488e5b3

File tree

22 files changed

+696
-53
lines changed

22 files changed

+696
-53
lines changed

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

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
#define MLX5E_HW2SW_MTU(priv, hwmtu) ((hwmtu) - ((priv)->hard_mtu))
5858
#define MLX5E_SW2HW_MTU(priv, swmtu) ((swmtu) + ((priv)->hard_mtu))
5959

60+
#define MLX5E_MAX_DSCP 64
6061
#define MLX5E_MAX_NUM_TC 8
6162

6263
#define MLX5E_PARAMS_MINIMUM_LOG_SQ_SIZE 0x6
@@ -105,6 +106,7 @@
105106
#define MLX5E_PARAMS_DEFAULT_RX_CQ_MODERATION_USEC_FROM_CQE 0x3
106107
#define MLX5E_PARAMS_DEFAULT_RX_CQ_MODERATION_PKTS 0x20
107108
#define MLX5E_PARAMS_DEFAULT_TX_CQ_MODERATION_USEC 0x10
109+
#define MLX5E_PARAMS_DEFAULT_TX_CQ_MODERATION_USEC_FROM_CQE 0x10
108110
#define MLX5E_PARAMS_DEFAULT_TX_CQ_MODERATION_PKTS 0x20
109111
#define MLX5E_PARAMS_DEFAULT_MIN_RX_WQES 0x80
110112
#define MLX5E_PARAMS_DEFAULT_MIN_RX_WQES_MPW 0x2
@@ -126,6 +128,16 @@
126128

127129
#define MLX5E_NUM_MAIN_GROUPS 9
128130

131+
#define MLX5E_MSG_LEVEL NETIF_MSG_LINK
132+
133+
#define mlx5e_dbg(mlevel, priv, format, ...) \
134+
do { \
135+
if (NETIF_MSG_##mlevel & (priv)->msglevel) \
136+
netdev_warn(priv->netdev, format, \
137+
##__VA_ARGS__); \
138+
} while (0)
139+
140+
129141
static inline u16 mlx5_min_rx_wqes(int wq_type, u32 wq_size)
130142
{
131143
switch (wq_type) {
@@ -187,12 +199,14 @@ extern const char mlx5e_self_tests[][ETH_GSTRING_LEN];
187199

188200
static const char mlx5e_priv_flags[][ETH_GSTRING_LEN] = {
189201
"rx_cqe_moder",
202+
"tx_cqe_moder",
190203
"rx_cqe_compress",
191204
};
192205

193206
enum mlx5e_priv_flag {
194207
MLX5E_PFLAG_RX_CQE_BASED_MODER = (1 << 0),
195-
MLX5E_PFLAG_RX_CQE_COMPRESS = (1 << 1),
208+
MLX5E_PFLAG_TX_CQE_BASED_MODER = (1 << 1),
209+
MLX5E_PFLAG_RX_CQE_COMPRESS = (1 << 2),
196210
};
197211

198212
#define MLX5E_SET_PFLAG(params, pflag, enable) \
@@ -212,6 +226,7 @@ enum mlx5e_priv_flag {
212226
struct mlx5e_cq_moder {
213227
u16 usec;
214228
u16 pkts;
229+
u8 cq_period_mode;
215230
};
216231

217232
struct mlx5e_params {
@@ -223,7 +238,6 @@ struct mlx5e_params {
223238
u8 log_rq_size;
224239
u16 num_channels;
225240
u8 num_tc;
226-
u8 rx_cq_period_mode;
227241
bool rx_cqe_compress_def;
228242
struct mlx5e_cq_moder rx_cq_moderation;
229243
struct mlx5e_cq_moder tx_cq_moderation;
@@ -260,11 +274,17 @@ enum {
260274
struct mlx5e_dcbx {
261275
enum mlx5_dcbx_oper_mode mode;
262276
struct mlx5e_cee_config cee_cfg; /* pending configuration */
277+
u8 dscp_app_cnt;
263278

264279
/* The only setting that cannot be read from FW */
265280
u8 tc_tsa[IEEE_8021QAZ_MAX_TCS];
266281
u8 cap;
267282
};
283+
284+
struct mlx5e_dcbx_dp {
285+
u8 dscp2prio[MLX5E_MAX_DSCP];
286+
u8 trust_state;
287+
};
268288
#endif
269289

270290
enum {
@@ -742,8 +762,12 @@ struct mlx5e_priv {
742762
/* priv data path fields - start */
743763
struct mlx5e_txqsq *txq2sq[MLX5E_MAX_NUM_CHANNELS * MLX5E_MAX_NUM_TC];
744764
int channel_tc2txq[MLX5E_MAX_NUM_CHANNELS][MLX5E_MAX_NUM_TC];
765+
#ifdef CONFIG_MLX5_CORE_EN_DCB
766+
struct mlx5e_dcbx_dp dcbx_dp;
767+
#endif
745768
/* priv data path fields - end */
746769

770+
u32 msglevel;
747771
unsigned long state;
748772
struct mutex state_lock; /* Protects Interface state */
749773
struct mlx5e_rq drop_rq;
@@ -800,6 +824,8 @@ struct mlx5e_profile {
800824
mlx5e_fp_handle_rx_cqe handle_rx_cqe;
801825
mlx5e_fp_handle_rx_cqe handle_rx_cqe_mpwqe;
802826
} rx_handlers;
827+
void (*netdev_registered_init)(struct mlx5e_priv *priv);
828+
void (*netdev_registered_remove)(struct mlx5e_priv *priv);
803829
int max_tc;
804830
};
805831

@@ -903,6 +929,8 @@ void mlx5e_build_default_indir_rqt(u32 *indirection_rqt, int len,
903929
int num_channels);
904930
int mlx5e_get_max_linkspeed(struct mlx5_core_dev *mdev, u32 *speed);
905931

932+
void mlx5e_set_tx_cq_mode_params(struct mlx5e_params *params,
933+
u8 cq_period_mode);
906934
void mlx5e_set_rx_cq_mode_params(struct mlx5e_params *params,
907935
u8 cq_period_mode);
908936
void mlx5e_set_rq_type_params(struct mlx5_core_dev *mdev,
@@ -968,6 +996,8 @@ extern const struct ethtool_ops mlx5e_ethtool_ops;
968996
extern const struct dcbnl_rtnl_ops mlx5e_dcbnl_ops;
969997
int mlx5e_dcbnl_ieee_setets_core(struct mlx5e_priv *priv, struct ieee_ets *ets);
970998
void mlx5e_dcbnl_initialize(struct mlx5e_priv *priv);
999+
void mlx5e_dcbnl_init_app(struct mlx5e_priv *priv);
1000+
void mlx5e_dcbnl_delete_app(struct mlx5e_priv *priv);
9711001
#endif
9721002

9731003
#ifndef CONFIG_RFS_ACCEL
@@ -1020,6 +1050,9 @@ void mlx5e_destroy_rqt(struct mlx5e_priv *priv, struct mlx5e_rqt *rqt);
10201050
int mlx5e_create_ttc_table(struct mlx5e_priv *priv);
10211051
void mlx5e_destroy_ttc_table(struct mlx5e_priv *priv);
10221052

1053+
int mlx5e_create_inner_ttc_table(struct mlx5e_priv *priv);
1054+
void mlx5e_destroy_inner_ttc_table(struct mlx5e_priv *priv);
1055+
10231056
int mlx5e_create_tis(struct mlx5_core_dev *mdev, int tc,
10241057
u32 underlay_qpn, u32 *tisn);
10251058
void mlx5e_destroy_tis(struct mlx5_core_dev *mdev, u32 tisn);
@@ -1069,5 +1102,5 @@ void mlx5e_destroy_netdev(struct mlx5e_priv *priv);
10691102
void mlx5e_build_nic_params(struct mlx5_core_dev *mdev,
10701103
struct mlx5e_params *params,
10711104
u16 max_channels);
1072-
1105+
u8 mlx5e_params_calculate_tx_min_inline(struct mlx5_core_dev *mdev);
10731106
#endif /* __MLX5_EN_H__ */

drivers/net/ethernet/mellanox/mlx5/core/en_arfs.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ static enum mlx5e_traffic_types arfs_get_tt(enum arfs_type type)
9292

9393
static int arfs_disable(struct mlx5e_priv *priv)
9494
{
95-
struct mlx5_flow_destination dest;
95+
struct mlx5_flow_destination dest = {};
9696
struct mlx5e_tir *tir = priv->indir_tir;
9797
int err = 0;
9898
int tt;
@@ -126,7 +126,7 @@ int mlx5e_arfs_disable(struct mlx5e_priv *priv)
126126

127127
int mlx5e_arfs_enable(struct mlx5e_priv *priv)
128128
{
129-
struct mlx5_flow_destination dest;
129+
struct mlx5_flow_destination dest = {};
130130
int err = 0;
131131
int tt;
132132
int i;
@@ -175,7 +175,7 @@ static int arfs_add_default_rule(struct mlx5e_priv *priv,
175175
{
176176
struct arfs_table *arfs_t = &priv->fs.arfs.arfs_tables[type];
177177
struct mlx5e_tir *tir = priv->indir_tir;
178-
struct mlx5_flow_destination dest;
178+
struct mlx5_flow_destination dest = {};
179179
MLX5_DECLARE_FLOW_ACT(flow_act);
180180
struct mlx5_flow_spec *spec;
181181
enum mlx5e_traffic_types tt;
@@ -466,7 +466,7 @@ static struct mlx5_flow_handle *arfs_add_rule(struct mlx5e_priv *priv,
466466
struct mlx5e_arfs_tables *arfs = &priv->fs.arfs;
467467
struct arfs_tuple *tuple = &arfs_rule->tuple;
468468
struct mlx5_flow_handle *rule = NULL;
469-
struct mlx5_flow_destination dest;
469+
struct mlx5_flow_destination dest = {};
470470
MLX5_DECLARE_FLOW_ACT(flow_act);
471471
struct arfs_table *arfs_table;
472472
struct mlx5_flow_spec *spec;
@@ -557,7 +557,7 @@ static struct mlx5_flow_handle *arfs_add_rule(struct mlx5e_priv *priv,
557557
static void arfs_modify_rule_rq(struct mlx5e_priv *priv,
558558
struct mlx5_flow_handle *rule, u16 rxq)
559559
{
560-
struct mlx5_flow_destination dst;
560+
struct mlx5_flow_destination dst = {};
561561
int err = 0;
562562

563563
dst.type = MLX5_FLOW_DESTINATION_TYPE_TIR;

drivers/net/ethernet/mellanox/mlx5/core/en_common.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,3 +171,15 @@ int mlx5e_refresh_tirs(struct mlx5e_priv *priv, bool enable_uc_lb)
171171

172172
return err;
173173
}
174+
175+
u8 mlx5e_params_calculate_tx_min_inline(struct mlx5_core_dev *mdev)
176+
{
177+
u8 min_inline_mode;
178+
179+
mlx5_query_min_inline(mdev, &min_inline_mode);
180+
if (min_inline_mode == MLX5_INLINE_MODE_NONE &&
181+
!MLX5_CAP_ETH(mdev, wqe_vlan_insert))
182+
min_inline_mode = MLX5_INLINE_MODE_L2;
183+
184+
return min_inline_mode;
185+
}

0 commit comments

Comments
 (0)