Skip to content

Commit 182c95a

Browse files
author
Maxim Levitsky
committed
net: mana: Add support for Multi Vports on Bare metal
JIRA: https://issues.redhat.com/browse/RHEL-80096 commit 290e5d3 Author: Haiyang Zhang <haiyangz@microsoft.com> Date: Mon May 19 09:20:36 2025 -0700 net: mana: Add support for Multi Vports on Bare metal 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> Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
1 parent e36b289 commit 182c95a

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
@@ -919,7 +919,7 @@ static void mana_pf_deregister_filter(struct mana_port_context *apc)
919919

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

933-
req.hdr.resp.msg_version = GDMA_MESSAGE_V2;
933+
req.hdr.resp.msg_version = GDMA_MESSAGE_V3;
934934

935935
req.proto_major_ver = proto_major_ver;
936936
req.proto_minor_ver = proto_minor_ver;
@@ -954,11 +954,16 @@ static int mana_query_device_cfg(struct mana_context *ac, u32 proto_major_ver,
954954

955955
*max_num_vports = resp.max_num_vports;
956956

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

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

964969
return 0;
@@ -2439,7 +2444,7 @@ static void mana_destroy_vport(struct mana_port_context *apc)
24392444
mana_destroy_txq(apc);
24402445
mana_uncfg_vport(apc);
24412446

2442-
if (gd->gdma_context->is_pf)
2447+
if (gd->gdma_context->is_pf && !apc->ac->bm_hostmode)
24432448
mana_pf_deregister_hw_vport(apc);
24442449
}
24452450

@@ -2451,7 +2456,7 @@ static int mana_create_vport(struct mana_port_context *apc,
24512456

24522457
apc->default_rxobj = INVALID_MANA_HANDLE;
24532458

2454-
if (gd->gdma_context->is_pf) {
2459+
if (gd->gdma_context->is_pf && !apc->ac->bm_hostmode) {
24552460
err = mana_pf_register_hw_vport(apc);
24562461
if (err)
24572462
return err;
@@ -2687,7 +2692,7 @@ int mana_alloc_queues(struct net_device *ndev)
26872692
goto destroy_vport;
26882693
}
26892694

2690-
if (gd->gdma_context->is_pf) {
2695+
if (gd->gdma_context->is_pf && !apc->ac->bm_hostmode) {
26912696
err = mana_pf_register_filter(apc);
26922697
if (err)
26932698
goto destroy_vport;
@@ -2749,7 +2754,7 @@ static int mana_dealloc_queues(struct net_device *ndev)
27492754

27502755
mana_chn_setxdp(apc, NULL);
27512756

2752-
if (gd->gdma_context->is_pf)
2757+
if (gd->gdma_context->is_pf && !apc->ac->bm_hostmode)
27532758
mana_pf_deregister_filter(apc);
27542759

27552760
/* No packet can be transmitted now since apc->port_is_up is false.
@@ -3060,6 +3065,7 @@ int mana_probe(struct gdma_dev *gd, bool resuming)
30603065
struct gdma_context *gc = gd->gdma_context;
30613066
struct mana_context *ac = gd->driver_data;
30623067
struct device *dev = gc->dev;
3068+
u8 bm_hostmode = 0;
30633069
u16 num_ports = 0;
30643070
int err;
30653071
int i;
@@ -3088,10 +3094,12 @@ int mana_probe(struct gdma_dev *gd, bool resuming)
30883094
}
30893095

30903096
err = mana_query_device_cfg(ac, MANA_MAJOR_VERSION, MANA_MINOR_VERSION,
3091-
MANA_MICRO_VERSION, &num_ports);
3097+
MANA_MICRO_VERSION, &num_ports, &bm_hostmode);
30923098
if (err)
30933099
goto out;
30943100

3101+
ac->bm_hostmode = bm_hostmode;
3102+
30953103
if (!resuming) {
30963104
ac->num_ports = num_ports;
30973105
} else {

include/net/mana/mana.h

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

408408
u16 num_ports;
409+
u8 bm_hostmode;
409410

410411
struct mana_eq *eqs;
411412
struct dentry *mana_eqs_debugfs;
@@ -558,7 +559,8 @@ struct mana_query_device_cfg_resp {
558559
u64 pf_cap_flags4;
559560

560561
u16 max_num_vports;
561-
u16 reserved;
562+
u8 bm_hostmode; /* response v3: Bare Metal Host Mode */
563+
u8 reserved;
562564
u32 max_num_eqs;
563565

564566
/* response v2: */

0 commit comments

Comments
 (0)