Skip to content

Commit 0d2be75

Browse files
committed
Merge tag 'mlx5-fixes-2023-03-15' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux
Saeed Mahameed says: ==================== mlx5 fixes 2023-03-15 This series provides bug fixes to mlx5 driver. * tag 'mlx5-fixes-2023-03-15' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux: net/mlx5e: TC, Remove error message log print net/mlx5e: TC, fix cloned flow attribute net/mlx5e: TC, fix missing error code net/sched: TC, fix raw counter initialization net/mlx5e: Lower maximum allowed MTU in XSK to match XDP prerequisites net/mlx5: Set BREAK_FW_WAIT flag first when removing driver net/mlx5e: kTLS, Fix missing error unwind on unsupported cipher type net/mlx5e: Fix cleanup null-ptr deref on encap lock net/mlx5: E-switch, Fix missing set of split_count when forward to ovs internal port net/mlx5: E-switch, Fix wrong usage of source port rewrite in split rules net/mlx5: Disable eswitch before waiting for VF pages net/mlx5: Fix setting ec_function bit in MANAGE_PAGES net/mlx5e: Don't cache tunnel offloads capability net/mlx5e: Fix macsec ASO context alignment ==================== Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents 1b0120e + c7b7c64 commit 0d2be75

File tree

13 files changed

+81
-47
lines changed

13 files changed

+81
-47
lines changed

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,6 @@ struct mlx5e_params {
313313
} channel;
314314
} mqprio;
315315
bool rx_cqe_compress_def;
316-
bool tunneled_offload_en;
317316
struct dim_cq_moder rx_cq_moderation;
318317
struct dim_cq_moder tx_cq_moderation;
319318
struct mlx5e_packet_merge_param packet_merge;

drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/police.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,6 @@ tc_act_police_stats(struct mlx5e_priv *priv,
178178
meter = mlx5e_tc_meter_get(priv->mdev, &params);
179179
if (IS_ERR(meter)) {
180180
NL_SET_ERR_MSG_MOD(fl_act->extack, "Failed to get flow meter");
181-
mlx5_core_err(priv->mdev, "Failed to get flow meter %d\n", params.index);
182181
return PTR_ERR(meter);
183182
}
184183

drivers/net/ethernet/mellanox/mlx5/core/en/tc/act_stats.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ mlx5e_tc_act_stats_add(struct mlx5e_tc_act_stats_handle *handle,
6464
{
6565
struct mlx5e_tc_act_stats *act_stats, *old_act_stats;
6666
struct rhashtable *ht = &handle->ht;
67+
u64 lastused;
6768
int err = 0;
6869

6970
act_stats = kvzalloc(sizeof(*act_stats), GFP_KERNEL);
@@ -73,6 +74,10 @@ mlx5e_tc_act_stats_add(struct mlx5e_tc_act_stats_handle *handle,
7374
act_stats->tc_act_cookie = act_cookie;
7475
act_stats->counter = counter;
7576

77+
mlx5_fc_query_cached_raw(counter,
78+
&act_stats->lastbytes,
79+
&act_stats->lastpackets, &lastused);
80+
7681
rcu_read_lock();
7782
old_act_stats = rhashtable_lookup_get_insert_fast(ht,
7883
&act_stats->hash,

drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_rx.c

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -621,15 +621,6 @@ int mlx5e_ktls_add_rx(struct net_device *netdev, struct sock *sk,
621621
if (unlikely(!priv_rx))
622622
return -ENOMEM;
623623

624-
dek = mlx5_ktls_create_key(priv->tls->dek_pool, crypto_info);
625-
if (IS_ERR(dek)) {
626-
err = PTR_ERR(dek);
627-
goto err_create_key;
628-
}
629-
priv_rx->dek = dek;
630-
631-
INIT_LIST_HEAD(&priv_rx->list);
632-
spin_lock_init(&priv_rx->lock);
633624
switch (crypto_info->cipher_type) {
634625
case TLS_CIPHER_AES_GCM_128:
635626
priv_rx->crypto_info.crypto_info_128 =
@@ -642,9 +633,20 @@ int mlx5e_ktls_add_rx(struct net_device *netdev, struct sock *sk,
642633
default:
643634
WARN_ONCE(1, "Unsupported cipher type %u\n",
644635
crypto_info->cipher_type);
645-
return -EOPNOTSUPP;
636+
err = -EOPNOTSUPP;
637+
goto err_cipher_type;
646638
}
647639

640+
dek = mlx5_ktls_create_key(priv->tls->dek_pool, crypto_info);
641+
if (IS_ERR(dek)) {
642+
err = PTR_ERR(dek);
643+
goto err_cipher_type;
644+
}
645+
priv_rx->dek = dek;
646+
647+
INIT_LIST_HEAD(&priv_rx->list);
648+
spin_lock_init(&priv_rx->lock);
649+
648650
rxq = mlx5e_ktls_sk_get_rxq(sk);
649651
priv_rx->rxq = rxq;
650652
priv_rx->sk = sk;
@@ -677,7 +679,7 @@ int mlx5e_ktls_add_rx(struct net_device *netdev, struct sock *sk,
677679
mlx5e_tir_destroy(&priv_rx->tir);
678680
err_create_tir:
679681
mlx5_ktls_destroy_key(priv->tls->dek_pool, priv_rx->dek);
680-
err_create_key:
682+
err_cipher_type:
681683
kfree(priv_rx);
682684
return err;
683685
}

drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_tx.c

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -469,14 +469,6 @@ int mlx5e_ktls_add_tx(struct net_device *netdev, struct sock *sk,
469469
if (IS_ERR(priv_tx))
470470
return PTR_ERR(priv_tx);
471471

472-
dek = mlx5_ktls_create_key(priv->tls->dek_pool, crypto_info);
473-
if (IS_ERR(dek)) {
474-
err = PTR_ERR(dek);
475-
goto err_create_key;
476-
}
477-
priv_tx->dek = dek;
478-
479-
priv_tx->expected_seq = start_offload_tcp_sn;
480472
switch (crypto_info->cipher_type) {
481473
case TLS_CIPHER_AES_GCM_128:
482474
priv_tx->crypto_info.crypto_info_128 =
@@ -489,8 +481,18 @@ int mlx5e_ktls_add_tx(struct net_device *netdev, struct sock *sk,
489481
default:
490482
WARN_ONCE(1, "Unsupported cipher type %u\n",
491483
crypto_info->cipher_type);
492-
return -EOPNOTSUPP;
484+
err = -EOPNOTSUPP;
485+
goto err_pool_push;
493486
}
487+
488+
dek = mlx5_ktls_create_key(priv->tls->dek_pool, crypto_info);
489+
if (IS_ERR(dek)) {
490+
err = PTR_ERR(dek);
491+
goto err_pool_push;
492+
}
493+
494+
priv_tx->dek = dek;
495+
priv_tx->expected_seq = start_offload_tcp_sn;
494496
priv_tx->tx_ctx = tls_offload_ctx_tx(tls_ctx);
495497

496498
mlx5e_set_ktls_tx_priv_ctx(tls_ctx, priv_tx);
@@ -500,7 +502,7 @@ int mlx5e_ktls_add_tx(struct net_device *netdev, struct sock *sk,
500502

501503
return 0;
502504

503-
err_create_key:
505+
err_pool_push:
504506
pool_push(pool, priv_tx);
505507
return err;
506508
}

drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ struct mlx5e_macsec_rx_sc {
8989
};
9090

9191
struct mlx5e_macsec_umr {
92+
u8 __aligned(64) ctx[MLX5_ST_SZ_BYTES(macsec_aso)];
9293
dma_addr_t dma_addr;
93-
u8 ctx[MLX5_ST_SZ_BYTES(macsec_aso)];
9494
u32 mkey;
9595
};
9696

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

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4169,13 +4169,17 @@ static bool mlx5e_xsk_validate_mtu(struct net_device *netdev,
41694169
struct xsk_buff_pool *xsk_pool =
41704170
mlx5e_xsk_get_pool(&chs->params, chs->params.xsk, ix);
41714171
struct mlx5e_xsk_param xsk;
4172+
int max_xdp_mtu;
41724173

41734174
if (!xsk_pool)
41744175
continue;
41754176

41764177
mlx5e_build_xsk_param(xsk_pool, &xsk);
4178+
max_xdp_mtu = mlx5e_xdp_max_mtu(new_params, &xsk);
41774179

4178-
if (!mlx5e_validate_xsk_param(new_params, &xsk, mdev)) {
4180+
/* Validate XSK params and XDP MTU in advance */
4181+
if (!mlx5e_validate_xsk_param(new_params, &xsk, mdev) ||
4182+
new_params->sw_mtu > max_xdp_mtu) {
41794183
u32 hr = mlx5e_get_linear_rq_headroom(new_params, &xsk);
41804184
int max_mtu_frame, max_mtu_page, max_mtu;
41814185

@@ -4185,9 +4189,9 @@ static bool mlx5e_xsk_validate_mtu(struct net_device *netdev,
41854189
*/
41864190
max_mtu_frame = MLX5E_HW2SW_MTU(new_params, xsk.chunk_size - hr);
41874191
max_mtu_page = MLX5E_HW2SW_MTU(new_params, SKB_MAX_HEAD(0));
4188-
max_mtu = min(max_mtu_frame, max_mtu_page);
4192+
max_mtu = min3(max_mtu_frame, max_mtu_page, max_xdp_mtu);
41894193

4190-
netdev_err(netdev, "MTU %d is too big for an XSK running on channel %u. Try MTU <= %d\n",
4194+
netdev_err(netdev, "MTU %d is too big for an XSK running on channel %u or its redirection XDP program. Try MTU <= %d\n",
41914195
new_params->sw_mtu, ix, max_mtu);
41924196
return false;
41934197
}
@@ -4979,8 +4983,6 @@ void mlx5e_build_nic_params(struct mlx5e_priv *priv, struct mlx5e_xsk *xsk, u16
49794983
/* TX inline */
49804984
mlx5_query_min_inline(mdev, &params->tx_min_inline_mode);
49814985

4982-
params->tunneled_offload_en = mlx5_tunnel_inner_ft_supported(mdev);
4983-
49844986
/* AF_XDP */
49854987
params->xsk = xsk;
49864988

@@ -5285,7 +5287,7 @@ static int mlx5e_init_nic_rx(struct mlx5e_priv *priv)
52855287
}
52865288

52875289
features = MLX5E_RX_RES_FEATURE_PTP;
5288-
if (priv->channels.params.tunneled_offload_en)
5290+
if (mlx5_tunnel_inner_ft_supported(mdev))
52895291
features |= MLX5E_RX_RES_FEATURE_INNER_FT;
52905292
err = mlx5e_rx_res_init(priv->rx_res, priv->mdev, features,
52915293
priv->max_nch, priv->drop_rq.rqn,

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -755,7 +755,6 @@ static void mlx5e_build_rep_params(struct net_device *netdev)
755755
mlx5e_set_rx_cq_mode_params(params, cq_period_mode);
756756

757757
params->mqprio.num_tc = 1;
758-
params->tunneled_offload_en = false;
759758
if (rep->vport != MLX5_VPORT_UPLINK)
760759
params->vlan_strip_disable = true;
761760

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

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3752,7 +3752,7 @@ mlx5e_clone_flow_attr_for_post_act(struct mlx5_flow_attr *attr,
37523752
parse_attr->filter_dev = attr->parse_attr->filter_dev;
37533753
attr2->action = 0;
37543754
attr2->counter = NULL;
3755-
attr->tc_act_cookies_count = 0;
3755+
attr2->tc_act_cookies_count = 0;
37563756
attr2->flags = 0;
37573757
attr2->parse_attr = parse_attr;
37583758
attr2->dest_chain = 0;
@@ -4304,6 +4304,7 @@ int mlx5e_set_fwd_to_int_port_actions(struct mlx5e_priv *priv,
43044304

43054305
esw_attr->dest_int_port = dest_int_port;
43064306
esw_attr->dests[out_index].flags |= MLX5_ESW_DEST_CHAIN_WITH_SRC_PORT_CHANGE;
4307+
esw_attr->split_count = out_index;
43074308

43084309
/* Forward to root fdb for matching against the new source vport */
43094310
attr->dest_chain = 0;
@@ -5304,8 +5305,10 @@ int mlx5e_tc_nic_init(struct mlx5e_priv *priv)
53045305
mlx5e_tc_debugfs_init(tc, mlx5e_fs_get_debugfs_root(priv->fs));
53055306

53065307
tc->action_stats_handle = mlx5e_tc_act_stats_create();
5307-
if (IS_ERR(tc->action_stats_handle))
5308+
if (IS_ERR(tc->action_stats_handle)) {
5309+
err = PTR_ERR(tc->action_stats_handle);
53085310
goto err_act_stats;
5311+
}
53095312

53105313
return 0;
53115314

@@ -5440,8 +5443,10 @@ int mlx5e_tc_esw_init(struct mlx5_rep_uplink_priv *uplink_priv)
54405443
}
54415444

54425445
uplink_priv->action_stats_handle = mlx5e_tc_act_stats_create();
5443-
if (IS_ERR(uplink_priv->action_stats_handle))
5446+
if (IS_ERR(uplink_priv->action_stats_handle)) {
5447+
err = PTR_ERR(uplink_priv->action_stats_handle);
54445448
goto err_action_counter;
5449+
}
54455450

54465451
return 0;
54475452

@@ -5463,6 +5468,16 @@ int mlx5e_tc_esw_init(struct mlx5_rep_uplink_priv *uplink_priv)
54635468

54645469
void mlx5e_tc_esw_cleanup(struct mlx5_rep_uplink_priv *uplink_priv)
54655470
{
5471+
struct mlx5e_rep_priv *rpriv;
5472+
struct mlx5_eswitch *esw;
5473+
struct mlx5e_priv *priv;
5474+
5475+
rpriv = container_of(uplink_priv, struct mlx5e_rep_priv, uplink_priv);
5476+
priv = netdev_priv(rpriv->netdev);
5477+
esw = priv->mdev->priv.eswitch;
5478+
5479+
mlx5e_tc_clean_fdb_peer_flows(esw);
5480+
54665481
mlx5e_tc_tun_cleanup(uplink_priv->encap);
54675482

54685483
mapping_destroy(uplink_priv->tunnel_enc_opts_mapping);

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -723,11 +723,11 @@ mlx5_eswitch_add_fwd_rule(struct mlx5_eswitch *esw,
723723

724724
flow_act.action = MLX5_FLOW_CONTEXT_ACTION_FWD_DEST;
725725
for (i = 0; i < esw_attr->split_count; i++) {
726-
if (esw_is_indir_table(esw, attr))
727-
err = esw_setup_indir_table(dest, &flow_act, esw, attr, false, &i);
728-
else if (esw_is_chain_src_port_rewrite(esw, esw_attr))
729-
err = esw_setup_chain_src_port_rewrite(dest, &flow_act, esw, chains, attr,
730-
&i);
726+
if (esw_attr->dests[i].flags & MLX5_ESW_DEST_CHAIN_WITH_SRC_PORT_CHANGE)
727+
/* Source port rewrite (forward to ovs internal port or statck device) isn't
728+
* supported in the rule of split action.
729+
*/
730+
err = -EOPNOTSUPP;
731731
else
732732
esw_setup_vport_dest(dest, &flow_act, esw, esw_attr, i, i, false);
733733

0 commit comments

Comments
 (0)