Skip to content

Commit ff254da

Browse files
committed
Merge tag 'mlx5-updates-2021-04-19' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux
Saeed Mahameed says: ==================== mlx5-updates-2021-04-19 This patchset provides some updates to mlx5e and mlx5 SW steering drivers: 1) Tariq and Vladyslav they both provide some trivial update to mlx5e netdev. The next 12 patches in the patchset are focused toward mlx5 SW steering: 2) 3 trivial cleanup patches 3) Dynamic Flex parser support: Flex parser is a HW parser that can support protocols that are not natively supported by the HCA, such as Geneve (TLV options) and GTP-U. There are 8 such parsers, and each of them can be assigned to parse a specific set of protocols. 4) Enable matching on Geneve TLV options 5) Use Flex parser for MPLS over UDP/GRE 6) Enable matching on tunnel GTP-U and GTP-U first extension header using 7) Improved QoS for SW steering internal QPair for a better insertion rate ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 316bcff + aeacb52 commit ff254da

File tree

17 files changed

+1339
-173
lines changed

17 files changed

+1339
-173
lines changed

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,17 @@ void mlx5e_devlink_port_unregister(struct mlx5e_priv *priv)
5555
{
5656
struct devlink_port *dl_port = mlx5e_devlink_get_dl_port(priv);
5757

58-
devlink_port_unregister(dl_port);
58+
if (dl_port->registered)
59+
devlink_port_unregister(dl_port);
5960
}
6061

6162
struct devlink_port *mlx5e_get_devlink_port(struct net_device *dev)
6263
{
6364
struct mlx5e_priv *priv = netdev_priv(dev);
65+
struct devlink_port *port;
6466

65-
return mlx5e_devlink_get_dl_port(priv);
67+
port = mlx5e_devlink_get_dl_port(priv);
68+
if (port->registered)
69+
return port;
70+
return NULL;
6671
}

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

Lines changed: 59 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include "en/port.h"
77
#include "en_accel/en_accel.h"
88
#include "accel/ipsec.h"
9+
#include "fpga/ipsec.h"
910

1011
static bool mlx5e_rx_is_xdp(struct mlx5e_params *params,
1112
struct mlx5e_xsk_param *xsk)
@@ -89,30 +90,39 @@ bool mlx5e_rx_is_linear_skb(struct mlx5e_params *params,
8990
return !params->lro_en && linear_frag_sz <= PAGE_SIZE;
9091
}
9192

92-
#define MLX5_MAX_MPWQE_LOG_WQE_STRIDE_SZ ((BIT(__mlx5_bit_sz(wq, log_wqe_stride_size)) - 1) + \
93-
MLX5_MPWQE_LOG_STRIDE_SZ_BASE)
94-
bool mlx5e_rx_mpwqe_is_linear_skb(struct mlx5_core_dev *mdev,
95-
struct mlx5e_params *params,
96-
struct mlx5e_xsk_param *xsk)
93+
bool mlx5e_verify_rx_mpwqe_strides(struct mlx5_core_dev *mdev,
94+
u8 log_stride_sz, u8 log_num_strides)
9795
{
98-
u32 linear_frag_sz = mlx5e_rx_get_linear_frag_sz(params, xsk);
99-
s8 signed_log_num_strides_param;
100-
u8 log_num_strides;
96+
if (log_stride_sz + log_num_strides != MLX5_MPWRQ_LOG_WQE_SZ)
97+
return false;
10198

102-
if (!mlx5e_rx_is_linear_skb(params, xsk))
99+
if (log_stride_sz < MLX5_MPWQE_LOG_STRIDE_SZ_BASE ||
100+
log_stride_sz > MLX5_MPWQE_LOG_STRIDE_SZ_MAX)
103101
return false;
104102

105-
if (order_base_2(linear_frag_sz) > MLX5_MAX_MPWQE_LOG_WQE_STRIDE_SZ)
103+
if (log_num_strides > MLX5_MPWQE_LOG_NUM_STRIDES_MAX)
106104
return false;
107105

108106
if (MLX5_CAP_GEN(mdev, ext_stride_num_range))
109-
return true;
107+
return log_num_strides >= MLX5_MPWQE_LOG_NUM_STRIDES_EXT_BASE;
110108

111-
log_num_strides = MLX5_MPWRQ_LOG_WQE_SZ - order_base_2(linear_frag_sz);
112-
signed_log_num_strides_param =
113-
(s8)log_num_strides - MLX5_MPWQE_LOG_NUM_STRIDES_BASE;
109+
return log_num_strides >= MLX5_MPWQE_LOG_NUM_STRIDES_BASE;
110+
}
114111

115-
return signed_log_num_strides_param >= 0;
112+
bool mlx5e_rx_mpwqe_is_linear_skb(struct mlx5_core_dev *mdev,
113+
struct mlx5e_params *params,
114+
struct mlx5e_xsk_param *xsk)
115+
{
116+
s8 log_num_strides;
117+
u8 log_stride_sz;
118+
119+
if (!mlx5e_rx_is_linear_skb(params, xsk))
120+
return false;
121+
122+
log_stride_sz = order_base_2(mlx5e_rx_get_linear_frag_sz(params, xsk));
123+
log_num_strides = MLX5_MPWRQ_LOG_WQE_SZ - log_stride_sz;
124+
125+
return mlx5e_verify_rx_mpwqe_strides(mdev, log_stride_sz, log_num_strides);
116126
}
117127

118128
u8 mlx5e_mpwqe_get_log_rq_size(struct mlx5e_params *params,
@@ -282,7 +292,7 @@ bool mlx5e_striding_rq_possible(struct mlx5_core_dev *mdev,
282292
if (!mlx5e_check_fragmented_striding_rq_cap(mdev))
283293
return false;
284294

285-
if (MLX5_IPSEC_DEV(mdev))
295+
if (mlx5_fpga_is_ipsec_device(mdev))
286296
return false;
287297

288298
if (params->xdp_prog) {
@@ -364,7 +374,7 @@ static void mlx5e_build_rq_frags_info(struct mlx5_core_dev *mdev,
364374
u32 buf_size = 0;
365375
int i;
366376

367-
if (MLX5_IPSEC_DEV(mdev))
377+
if (mlx5_fpga_is_ipsec_device(mdev))
368378
byte_count += MLX5E_METADATA_ETHER_LEN;
369379

370380
if (mlx5e_rx_is_linear_skb(params, xsk)) {
@@ -461,26 +471,36 @@ static void mlx5e_build_rx_cq_param(struct mlx5_core_dev *mdev,
461471
param->cq_period_mode = params->rx_cq_moderation.cq_period_mode;
462472
}
463473

464-
void mlx5e_build_rq_param(struct mlx5_core_dev *mdev,
465-
struct mlx5e_params *params,
466-
struct mlx5e_xsk_param *xsk,
467-
u16 q_counter,
468-
struct mlx5e_rq_param *param)
474+
int mlx5e_build_rq_param(struct mlx5_core_dev *mdev,
475+
struct mlx5e_params *params,
476+
struct mlx5e_xsk_param *xsk,
477+
u16 q_counter,
478+
struct mlx5e_rq_param *param)
469479
{
470480
void *rqc = param->rqc;
471481
void *wq = MLX5_ADDR_OF(rqc, rqc, wq);
472482
int ndsegs = 1;
473483

474484
switch (params->rq_wq_type) {
475-
case MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ:
485+
case MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ: {
486+
u8 log_wqe_num_of_strides = mlx5e_mpwqe_get_log_num_strides(mdev, params, xsk);
487+
u8 log_wqe_stride_size = mlx5e_mpwqe_get_log_stride_size(mdev, params, xsk);
488+
489+
if (!mlx5e_verify_rx_mpwqe_strides(mdev, log_wqe_stride_size,
490+
log_wqe_num_of_strides)) {
491+
mlx5_core_err(mdev,
492+
"Bad RX MPWQE params: log_stride_size %u, log_num_strides %u\n",
493+
log_wqe_stride_size, log_wqe_num_of_strides);
494+
return -EINVAL;
495+
}
496+
476497
MLX5_SET(wq, wq, log_wqe_num_of_strides,
477-
mlx5e_mpwqe_get_log_num_strides(mdev, params, xsk) -
478-
MLX5_MPWQE_LOG_NUM_STRIDES_BASE);
498+
log_wqe_num_of_strides - MLX5_MPWQE_LOG_NUM_STRIDES_BASE);
479499
MLX5_SET(wq, wq, log_wqe_stride_size,
480-
mlx5e_mpwqe_get_log_stride_size(mdev, params, xsk) -
481-
MLX5_MPWQE_LOG_STRIDE_SZ_BASE);
500+
log_wqe_stride_size - MLX5_MPWQE_LOG_STRIDE_SZ_BASE);
482501
MLX5_SET(wq, wq, log_wq_sz, mlx5e_mpwqe_get_log_rq_size(params, xsk));
483502
break;
503+
}
484504
default: /* MLX5_WQ_TYPE_CYCLIC */
485505
MLX5_SET(wq, wq, log_wq_sz, params->log_rq_mtu_frames);
486506
mlx5e_build_rq_frags_info(mdev, params, xsk, &param->frags_info);
@@ -498,6 +518,8 @@ void mlx5e_build_rq_param(struct mlx5_core_dev *mdev,
498518

499519
param->wq.buf_numa_node = dev_to_node(mlx5_core_dma_dev(mdev));
500520
mlx5e_build_rx_cq_param(mdev, params, xsk, &param->cqp);
521+
522+
return 0;
501523
}
502524

503525
void mlx5e_build_drop_rq_param(struct mlx5_core_dev *mdev,
@@ -642,14 +664,17 @@ void mlx5e_build_xdpsq_param(struct mlx5_core_dev *mdev,
642664
mlx5e_build_tx_cq_param(mdev, params, &param->cqp);
643665
}
644666

645-
void mlx5e_build_channel_param(struct mlx5_core_dev *mdev,
646-
struct mlx5e_params *params,
647-
u16 q_counter,
648-
struct mlx5e_channel_param *cparam)
667+
int mlx5e_build_channel_param(struct mlx5_core_dev *mdev,
668+
struct mlx5e_params *params,
669+
u16 q_counter,
670+
struct mlx5e_channel_param *cparam)
649671
{
650672
u8 icosq_log_wq_sz, async_icosq_log_wq_sz;
673+
int err;
651674

652-
mlx5e_build_rq_param(mdev, params, NULL, q_counter, &cparam->rq);
675+
err = mlx5e_build_rq_param(mdev, params, NULL, q_counter, &cparam->rq);
676+
if (err)
677+
return err;
653678

654679
icosq_log_wq_sz = mlx5e_build_icosq_log_wq_sz(params, &cparam->rq);
655680
async_icosq_log_wq_sz = mlx5e_build_async_icosq_log_wq_sz(mdev);
@@ -658,4 +683,6 @@ void mlx5e_build_channel_param(struct mlx5_core_dev *mdev,
658683
mlx5e_build_xdpsq_param(mdev, params, &cparam->xdp_sq);
659684
mlx5e_build_icosq_param(mdev, icosq_log_wq_sz, &cparam->icosq);
660685
mlx5e_build_async_icosq_param(mdev, async_icosq_log_wq_sz, &cparam->async_icosq);
686+
687+
return 0;
661688
}

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

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ void mlx5e_build_rq_params(struct mlx5_core_dev *mdev, struct mlx5e_params *para
9696
void mlx5e_set_rq_type(struct mlx5_core_dev *mdev, struct mlx5e_params *params);
9797
void mlx5e_init_rq_type_params(struct mlx5_core_dev *mdev, struct mlx5e_params *params);
9898

99+
bool mlx5e_verify_rx_mpwqe_strides(struct mlx5_core_dev *mdev,
100+
u8 log_stride_sz, u8 log_num_strides);
99101
u16 mlx5e_get_linear_rq_headroom(struct mlx5e_params *params,
100102
struct mlx5e_xsk_param *xsk);
101103
u32 mlx5e_rx_get_min_frag_sz(struct mlx5e_params *params,
@@ -122,11 +124,11 @@ u16 mlx5e_get_rq_headroom(struct mlx5_core_dev *mdev,
122124
/* Build queue parameters */
123125

124126
void mlx5e_build_create_cq_param(struct mlx5e_create_cq_param *ccp, struct mlx5e_channel *c);
125-
void mlx5e_build_rq_param(struct mlx5_core_dev *mdev,
126-
struct mlx5e_params *params,
127-
struct mlx5e_xsk_param *xsk,
128-
u16 q_counter,
129-
struct mlx5e_rq_param *param);
127+
int mlx5e_build_rq_param(struct mlx5_core_dev *mdev,
128+
struct mlx5e_params *params,
129+
struct mlx5e_xsk_param *xsk,
130+
u16 q_counter,
131+
struct mlx5e_rq_param *param);
130132
void mlx5e_build_drop_rq_param(struct mlx5_core_dev *mdev,
131133
u16 q_counter,
132134
struct mlx5e_rq_param *param);
@@ -141,10 +143,10 @@ void mlx5e_build_tx_cq_param(struct mlx5_core_dev *mdev,
141143
void mlx5e_build_xdpsq_param(struct mlx5_core_dev *mdev,
142144
struct mlx5e_params *params,
143145
struct mlx5e_sq_param *param);
144-
void mlx5e_build_channel_param(struct mlx5_core_dev *mdev,
145-
struct mlx5e_params *params,
146-
u16 q_counter,
147-
struct mlx5e_channel_param *cparam);
146+
int mlx5e_build_channel_param(struct mlx5_core_dev *mdev,
147+
struct mlx5e_params *params,
148+
u16 q_counter,
149+
struct mlx5e_channel_param *cparam);
148150

149151
u16 mlx5e_calc_sq_stop_room(struct mlx5_core_dev *mdev, struct mlx5e_params *params);
150152
int mlx5e_validate_params(struct mlx5_core_dev *mdev, struct mlx5e_params *params);

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

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2086,7 +2086,10 @@ int mlx5e_open_channels(struct mlx5e_priv *priv,
20862086
if (!chs->c || !cparam)
20872087
goto err_free;
20882088

2089-
mlx5e_build_channel_param(priv->mdev, &chs->params, priv->q_counter, cparam);
2089+
err = mlx5e_build_channel_param(priv->mdev, &chs->params, priv->q_counter, cparam);
2090+
if (err)
2091+
goto err_free;
2092+
20902093
for (i = 0; i < chs->num; i++) {
20912094
struct xsk_buff_pool *xsk_pool = NULL;
20922095

@@ -4886,6 +4889,7 @@ static int mlx5e_nic_init(struct mlx5_core_dev *mdev,
48864889
struct net_device *netdev)
48874890
{
48884891
struct mlx5e_priv *priv = netdev_priv(netdev);
4892+
struct devlink_port *dl_port;
48894893
int err;
48904894

48914895
mlx5e_build_nic_params(priv, &priv->xsk, netdev->mtu);
@@ -4901,14 +4905,19 @@ static int mlx5e_nic_init(struct mlx5_core_dev *mdev,
49014905
if (err)
49024906
mlx5_core_err(mdev, "TLS initialization failed, %d\n", err);
49034907

4904-
mlx5e_health_create_reporters(priv);
4908+
dl_port = mlx5e_devlink_get_dl_port(priv);
4909+
if (dl_port->registered)
4910+
mlx5e_health_create_reporters(priv);
49054911

49064912
return 0;
49074913
}
49084914

49094915
static void mlx5e_nic_cleanup(struct mlx5e_priv *priv)
49104916
{
4911-
mlx5e_health_destroy_reporters(priv);
4917+
struct devlink_port *dl_port = mlx5e_devlink_get_dl_port(priv);
4918+
4919+
if (dl_port->registered)
4920+
mlx5e_health_destroy_reporters(priv);
49124921
mlx5e_tls_cleanup(priv);
49134922
mlx5e_ipsec_cleanup(priv);
49144923
}

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

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,16 @@ mlx5_eswitch_termtbl_create(struct mlx5_core_dev *dev,
8383
ft_attr.autogroup.max_num_groups = 1;
8484
tt->termtbl = mlx5_create_auto_grouped_flow_table(root_ns, &ft_attr);
8585
if (IS_ERR(tt->termtbl)) {
86-
esw_warn(dev, "Failed to create termination table\n");
86+
esw_warn(dev, "Failed to create termination table (error %d)\n",
87+
IS_ERR(tt->termtbl));
8788
return -EOPNOTSUPP;
8889
}
8990

9091
tt->rule = mlx5_add_flow_rules(tt->termtbl, NULL, flow_act,
9192
&tt->dest, 1);
9293
if (IS_ERR(tt->rule)) {
93-
esw_warn(dev, "Failed to create termination table rule\n");
94+
esw_warn(dev, "Failed to create termination table rule (error %d)\n",
95+
IS_ERR(tt->rule));
9496
goto add_flow_err;
9597
}
9698
return 0;
@@ -140,10 +142,9 @@ mlx5_eswitch_termtbl_get_create(struct mlx5_eswitch *esw,
140142
memcpy(&tt->flow_act, flow_act, sizeof(*flow_act));
141143

142144
err = mlx5_eswitch_termtbl_create(esw->dev, tt, flow_act);
143-
if (err) {
144-
esw_warn(esw->dev, "Failed to create termination table\n");
145+
if (err)
145146
goto tt_create_err;
146-
}
147+
147148
hash_add(esw->offloads.termtbl_tbl, &tt->termtbl_hlist, hash_key);
148149
tt_add_ref:
149150
tt->ref_count++;
@@ -282,7 +283,8 @@ mlx5_eswitch_add_termtbl_rule(struct mlx5_eswitch *esw,
282283
tt = mlx5_eswitch_termtbl_get_create(esw, &term_tbl_act,
283284
&dest[i], attr);
284285
if (IS_ERR(tt)) {
285-
esw_warn(esw->dev, "Failed to create termination table\n");
286+
esw_warn(esw->dev, "Failed to get termination table (error %d)\n",
287+
IS_ERR(tt));
286288
goto revert_changes;
287289
}
288290
attr->dests[num_vport_dests].termtbl = tt;

0 commit comments

Comments
 (0)