Skip to content

Commit 92de776

Browse files
committed
Merge tag 'mlx5-updates-2023-12-20' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux
Saeed Mahameed says: ==================== mlx5-updates-2023-12-20 mlx5 Socket direct support and management PF profile. Tariq Says: =========== Support Socket-Direct multi-dev netdev This series adds support for combining multiple devices (PFs) of the same port under one netdev instance. Passing traffic through different devices belonging to different NUMA sockets saves cross-numa traffic and allows apps running on the same netdev from different numas to still feel a sense of proximity to the device and achieve improved performance. We achieve this by grouping PFs together, and creating the netdev only once all group members are probed. Symmetrically, we destroy the netdev once any of the PFs is removed. The channels are distributed between all devices, a proper configuration would utilize the correct close numa when working on a certain app/cpu. We pick one device to be a primary (leader), and it fills a special role. The other devices (secondaries) are disconnected from the network in the chip level (set to silent mode). All RX/TX traffic is steered through the primary to/from the secondaries. Currently, we limit the support to PFs only, and up to two devices (sockets). =========== Armen Says: =========== Management PF support and module integration This patch rolls out comprehensive support for the Management Physical Function (MGMT PF) within the mlx5 driver. It involves updating the mlx5 interface header to introduce necessary definitions for MGMT PF and adding a new management PF netdev profile, which will allow the host side to communicate with the embedded linux on Blue-field devices. =========== ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents cd4d726 + 22c4640 commit 92de776

40 files changed

+1320
-192
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ mlx5_core-$(CONFIG_MLX5_CORE_EN) += en/rqt.o en/tir.o en/rss.o en/rx_res.o \
2929
en/reporter_tx.o en/reporter_rx.o en/params.o en/xsk/pool.o \
3030
en/xsk/setup.o en/xsk/rx.o en/xsk/tx.o en/devlink.o en/ptp.o \
3131
en/qos.o en/htb.o en/trap.o en/fs_tt_redirect.o en/selq.o \
32-
lib/crypto.o
32+
en/mgmt_pf.o lib/crypto.o lib/sd.o
3333

3434
#
3535
# Netdev extra

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,9 @@ bool mlx5_rdma_supported(struct mlx5_core_dev *dev)
190190
if (is_mp_supported(dev))
191191
return false;
192192

193+
if (mlx5_core_is_mgmt_pf(dev))
194+
return false;
195+
193196
return true;
194197
}
195198

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ int mlx5_ec_init(struct mlx5_core_dev *dev)
7575
if (!mlx5_core_is_ecpf(dev))
7676
return 0;
7777

78+
if (mlx5_core_is_mgmt_pf(dev))
79+
return 0;
80+
7881
return mlx5_host_pf_init(dev);
7982
}
8083

@@ -85,6 +88,9 @@ void mlx5_ec_cleanup(struct mlx5_core_dev *dev)
8588
if (!mlx5_core_is_ecpf(dev))
8689
return;
8790

91+
if (mlx5_core_is_mgmt_pf(dev))
92+
return;
93+
8894
mlx5_host_pf_cleanup(dev);
8995

9096
err = mlx5_wait_for_pages(dev, &dev->priv.page_counters[MLX5_HOST_PF]);

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

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,10 @@
6060
#include "lib/clock.h"
6161
#include "en/rx_res.h"
6262
#include "en/selq.h"
63+
#include "lib/sd.h"
6364

6465
extern const struct net_device_ops mlx5e_netdev_ops;
66+
extern const struct net_device_ops mlx5e_mgmt_netdev_ops;
6567
struct page_pool;
6668

6769
#define MLX5E_METADATA_ETHER_TYPE (0x8CE4)
@@ -791,6 +793,8 @@ struct mlx5e_channel {
791793
struct hwtstamp_config *tstamp;
792794
DECLARE_BITMAP(state, MLX5E_CHANNEL_NUM_STATES);
793795
int ix;
796+
int vec_ix;
797+
int sd_ix;
794798
int cpu;
795799
/* Sync between icosq recovery and XSK enable/disable. */
796800
struct mutex icosq_recovery_lock;
@@ -914,7 +918,7 @@ struct mlx5e_priv {
914918
bool tx_ptp_opened;
915919
bool rx_ptp_opened;
916920
struct hwtstamp_config tstamp;
917-
u16 q_counter;
921+
u16 q_counter[MLX5_SD_MAX_GROUP_SZ];
918922
u16 drop_rq_q_counter;
919923
struct notifier_block events_nb;
920924
struct notifier_block blocking_events_nb;
@@ -1029,12 +1033,12 @@ struct mlx5e_xsk_param;
10291033

10301034
struct mlx5e_rq_param;
10311035
int mlx5e_open_rq(struct mlx5e_params *params, struct mlx5e_rq_param *param,
1032-
struct mlx5e_xsk_param *xsk, int node,
1036+
struct mlx5e_xsk_param *xsk, int node, u16 q_counter,
10331037
struct mlx5e_rq *rq);
10341038
#define MLX5E_RQ_WQES_TIMEOUT 20000 /* msecs */
10351039
int mlx5e_wait_for_min_rx_wqes(struct mlx5e_rq *rq, int wait_time);
10361040
void mlx5e_close_rq(struct mlx5e_rq *rq);
1037-
int mlx5e_create_rq(struct mlx5e_rq *rq, struct mlx5e_rq_param *param);
1041+
int mlx5e_create_rq(struct mlx5e_rq *rq, struct mlx5e_rq_param *param, u16 q_counter);
10381042
void mlx5e_destroy_rq(struct mlx5e_rq *rq);
10391043

10401044
struct mlx5e_sq_param;
@@ -1122,9 +1126,10 @@ static inline bool mlx5_tx_swp_supported(struct mlx5_core_dev *mdev)
11221126
}
11231127

11241128
extern const struct ethtool_ops mlx5e_ethtool_ops;
1129+
extern const struct mlx5e_profile mlx5e_mgmt_pf_nic_profile;
11251130

11261131
int mlx5e_create_mkey(struct mlx5_core_dev *mdev, u32 pdn, u32 *mkey);
1127-
int mlx5e_create_mdev_resources(struct mlx5_core_dev *mdev);
1132+
int mlx5e_create_mdev_resources(struct mlx5_core_dev *mdev, bool create_tises);
11281133
void mlx5e_destroy_mdev_resources(struct mlx5_core_dev *mdev);
11291134
int mlx5e_refresh_tirs(struct mlx5e_priv *priv, bool enable_uc_lb,
11301135
bool enable_mc_lb);
@@ -1227,6 +1232,8 @@ netdev_features_t mlx5e_features_check(struct sk_buff *skb,
12271232
struct net_device *netdev,
12281233
netdev_features_t features);
12291234
int mlx5e_set_features(struct net_device *netdev, netdev_features_t features);
1235+
void mlx5e_nic_set_rx_mode(struct mlx5e_priv *priv);
1236+
12301237
#ifdef CONFIG_MLX5_ESWITCH
12311238
int mlx5e_set_vf_mac(struct net_device *dev, int vf, u8 *mac);
12321239
int mlx5e_set_vf_rate(struct net_device *dev, int vf, int min_tx_rate, int max_tx_rate);

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,26 @@ bool mlx5e_channels_is_xsk(struct mlx5e_channels *chs, unsigned int ix)
2323
return test_bit(MLX5E_CHANNEL_STATE_XSK, c->state);
2424
}
2525

26-
void mlx5e_channels_get_regular_rqn(struct mlx5e_channels *chs, unsigned int ix, u32 *rqn)
26+
void mlx5e_channels_get_regular_rqn(struct mlx5e_channels *chs, unsigned int ix, u32 *rqn,
27+
u32 *vhca_id)
2728
{
2829
struct mlx5e_channel *c = mlx5e_channels_get(chs, ix);
2930

3031
*rqn = c->rq.rqn;
32+
if (vhca_id)
33+
*vhca_id = MLX5_CAP_GEN(c->mdev, vhca_id);
3134
}
3235

33-
void mlx5e_channels_get_xsk_rqn(struct mlx5e_channels *chs, unsigned int ix, u32 *rqn)
36+
void mlx5e_channels_get_xsk_rqn(struct mlx5e_channels *chs, unsigned int ix, u32 *rqn,
37+
u32 *vhca_id)
3438
{
3539
struct mlx5e_channel *c = mlx5e_channels_get(chs, ix);
3640

3741
WARN_ON_ONCE(!test_bit(MLX5E_CHANNEL_STATE_XSK, c->state));
3842

3943
*rqn = c->xskrq.rqn;
44+
if (vhca_id)
45+
*vhca_id = MLX5_CAP_GEN(c->mdev, vhca_id);
4046
}
4147

4248
bool mlx5e_channels_get_ptp_rqn(struct mlx5e_channels *chs, u32 *rqn)

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ struct mlx5e_channels;
1010

1111
unsigned int mlx5e_channels_get_num(struct mlx5e_channels *chs);
1212
bool mlx5e_channels_is_xsk(struct mlx5e_channels *chs, unsigned int ix);
13-
void mlx5e_channels_get_regular_rqn(struct mlx5e_channels *chs, unsigned int ix, u32 *rqn);
14-
void mlx5e_channels_get_xsk_rqn(struct mlx5e_channels *chs, unsigned int ix, u32 *rqn);
13+
void mlx5e_channels_get_regular_rqn(struct mlx5e_channels *chs, unsigned int ix, u32 *rqn,
14+
u32 *vhca_id);
15+
void mlx5e_channels_get_xsk_rqn(struct mlx5e_channels *chs, unsigned int ix, u32 *rqn,
16+
u32 *vhca_id);
1517
bool mlx5e_channels_get_ptp_rqn(struct mlx5e_channels *chs, u32 *rqn);
1618

1719
#endif /* __MLX5_EN_CHANNELS_H__ */

0 commit comments

Comments
 (0)