Skip to content

Commit 4be1465

Browse files
committed
net: mana: Add support for Multi Vports on Bare metal
jira LE-4365 Rebuild_History Non-Buildable kernel-6.12.0-55.38.1.el10_0 commit-author Haiyang Zhang <haiyangz@microsoft.com> commit 290e5d3 To support Multi Vports on Bare metal, increase the device config response version. And, skip the register HW vport, and register filter steps, when the Bare metal hostmode is set. Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com> Link: https://patch.msgid.link/1747671636-5810-1-git-send-email-haiyangz@microsoft.com Signed-off-by: Paolo Abeni <pabeni@redhat.com> (cherry picked from commit 290e5d3) Signed-off-by: Jonathan Maple <jmaple@ciq.com>
1 parent ea2247f commit 4be1465

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

drivers/net/ethernet/microsoft/mana/mana_en.c

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -920,7 +920,7 @@ static void mana_pf_deregister_filter(struct mana_port_context *apc)
920920

921921
static int mana_query_device_cfg(struct mana_context *ac, u32 proto_major_ver,
922922
u32 proto_minor_ver, u32 proto_micro_ver,
923-
u16 *max_num_vports)
923+
u16 *max_num_vports, u8 *bm_hostmode)
924924
{
925925
struct gdma_context *gc = ac->gdma_dev->gdma_context;
926926
struct mana_query_device_cfg_resp resp = {};
@@ -931,7 +931,7 @@ static int mana_query_device_cfg(struct mana_context *ac, u32 proto_major_ver,
931931
mana_gd_init_req_hdr(&req.hdr, MANA_QUERY_DEV_CONFIG,
932932
sizeof(req), sizeof(resp));
933933

934-
req.hdr.resp.msg_version = GDMA_MESSAGE_V2;
934+
req.hdr.resp.msg_version = GDMA_MESSAGE_V3;
935935

936936
req.proto_major_ver = proto_major_ver;
937937
req.proto_minor_ver = proto_minor_ver;
@@ -955,11 +955,16 @@ static int mana_query_device_cfg(struct mana_context *ac, u32 proto_major_ver,
955955

956956
*max_num_vports = resp.max_num_vports;
957957

958-
if (resp.hdr.response.msg_version == GDMA_MESSAGE_V2)
958+
if (resp.hdr.response.msg_version >= GDMA_MESSAGE_V2)
959959
gc->adapter_mtu = resp.adapter_mtu;
960960
else
961961
gc->adapter_mtu = ETH_FRAME_LEN;
962962

963+
if (resp.hdr.response.msg_version >= GDMA_MESSAGE_V3)
964+
*bm_hostmode = resp.bm_hostmode;
965+
else
966+
*bm_hostmode = 0;
967+
963968
debugfs_create_u16("adapter-MTU", 0400, gc->mana_pci_debugfs, &gc->adapter_mtu);
964969

965970
return 0;
@@ -2440,7 +2445,7 @@ static void mana_destroy_vport(struct mana_port_context *apc)
24402445
mana_destroy_txq(apc);
24412446
mana_uncfg_vport(apc);
24422447

2443-
if (gd->gdma_context->is_pf)
2448+
if (gd->gdma_context->is_pf && !apc->ac->bm_hostmode)
24442449
mana_pf_deregister_hw_vport(apc);
24452450
}
24462451

@@ -2452,7 +2457,7 @@ static int mana_create_vport(struct mana_port_context *apc,
24522457

24532458
apc->default_rxobj = INVALID_MANA_HANDLE;
24542459

2455-
if (gd->gdma_context->is_pf) {
2460+
if (gd->gdma_context->is_pf && !apc->ac->bm_hostmode) {
24562461
err = mana_pf_register_hw_vport(apc);
24572462
if (err)
24582463
return err;
@@ -2688,7 +2693,7 @@ int mana_alloc_queues(struct net_device *ndev)
26882693
goto destroy_vport;
26892694
}
26902695

2691-
if (gd->gdma_context->is_pf) {
2696+
if (gd->gdma_context->is_pf && !apc->ac->bm_hostmode) {
26922697
err = mana_pf_register_filter(apc);
26932698
if (err)
26942699
goto destroy_vport;
@@ -2750,7 +2755,7 @@ static int mana_dealloc_queues(struct net_device *ndev)
27502755

27512756
mana_chn_setxdp(apc, NULL);
27522757

2753-
if (gd->gdma_context->is_pf)
2758+
if (gd->gdma_context->is_pf && !apc->ac->bm_hostmode)
27542759
mana_pf_deregister_filter(apc);
27552760

27562761
/* No packet can be transmitted now since apc->port_is_up is false.
@@ -2997,6 +3002,7 @@ int mana_probe(struct gdma_dev *gd, bool resuming)
29973002
struct gdma_context *gc = gd->gdma_context;
29983003
struct mana_context *ac = gd->driver_data;
29993004
struct device *dev = gc->dev;
3005+
u8 bm_hostmode = 0;
30003006
u16 num_ports = 0;
30013007
int err;
30023008
int i;
@@ -3025,10 +3031,12 @@ int mana_probe(struct gdma_dev *gd, bool resuming)
30253031
}
30263032

30273033
err = mana_query_device_cfg(ac, MANA_MAJOR_VERSION, MANA_MINOR_VERSION,
3028-
MANA_MICRO_VERSION, &num_ports);
3034+
MANA_MICRO_VERSION, &num_ports, &bm_hostmode);
30293035
if (err)
30303036
goto out;
30313037

3038+
ac->bm_hostmode = bm_hostmode;
3039+
30323040
if (!resuming) {
30333041
ac->num_ports = num_ports;
30343042
} else {

include/net/mana/mana.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,7 @@ struct mana_context {
408408
struct gdma_dev *gdma_dev;
409409

410410
u16 num_ports;
411+
u8 bm_hostmode;
411412

412413
struct mana_eq *eqs;
413414
struct dentry *mana_eqs_debugfs;
@@ -557,7 +558,8 @@ struct mana_query_device_cfg_resp {
557558
u64 pf_cap_flags4;
558559

559560
u16 max_num_vports;
560-
u16 reserved;
561+
u8 bm_hostmode; /* response v3: Bare Metal Host Mode */
562+
u8 reserved;
561563
u32 max_num_eqs;
562564

563565
/* response v2: */

0 commit comments

Comments
 (0)