Skip to content

Commit 0c88564

Browse files
committed
net: mana: Add support for Multi Vports on Bare metal
jira LE-3208 feature net_mana commit-author Haiyang Zhang <[email protected]> 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 <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Paolo Abeni <[email protected]> (cherry picked from commit 290e5d3) Signed-off-by: Jonathan Maple <[email protected]> Signed-off-by: Jonathan Maple <[email protected]>
1 parent 3381775 commit 0c88564

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

926926
static int mana_query_device_cfg(struct mana_context *ac, u32 proto_major_ver,
927927
u32 proto_minor_ver, u32 proto_micro_ver,
928-
u16 *max_num_vports)
928+
u16 *max_num_vports, u8 *bm_hostmode)
929929
{
930930
struct gdma_context *gc = ac->gdma_dev->gdma_context;
931931
struct mana_query_device_cfg_resp resp = {};
@@ -936,7 +936,7 @@ static int mana_query_device_cfg(struct mana_context *ac, u32 proto_major_ver,
936936
mana_gd_init_req_hdr(&req.hdr, MANA_QUERY_DEV_CONFIG,
937937
sizeof(req), sizeof(resp));
938938

939-
req.hdr.resp.msg_version = GDMA_MESSAGE_V2;
939+
req.hdr.resp.msg_version = GDMA_MESSAGE_V3;
940940

941941
req.proto_major_ver = proto_major_ver;
942942
req.proto_minor_ver = proto_minor_ver;
@@ -960,11 +960,16 @@ static int mana_query_device_cfg(struct mana_context *ac, u32 proto_major_ver,
960960

961961
*max_num_vports = resp.max_num_vports;
962962

963-
if (resp.hdr.response.msg_version == GDMA_MESSAGE_V2)
963+
if (resp.hdr.response.msg_version >= GDMA_MESSAGE_V2)
964964
gc->adapter_mtu = resp.adapter_mtu;
965965
else
966966
gc->adapter_mtu = ETH_FRAME_LEN;
967967

968+
if (resp.hdr.response.msg_version >= GDMA_MESSAGE_V3)
969+
*bm_hostmode = resp.bm_hostmode;
970+
else
971+
*bm_hostmode = 0;
972+
968973
debugfs_create_u16("adapter-MTU", 0400, gc->mana_pci_debugfs, &gc->adapter_mtu);
969974

970975
return 0;
@@ -2450,7 +2455,7 @@ static void mana_destroy_vport(struct mana_port_context *apc)
24502455
mana_destroy_txq(apc);
24512456
mana_uncfg_vport(apc);
24522457

2453-
if (gd->gdma_context->is_pf)
2458+
if (gd->gdma_context->is_pf && !apc->ac->bm_hostmode)
24542459
mana_pf_deregister_hw_vport(apc);
24552460
}
24562461

@@ -2462,7 +2467,7 @@ static int mana_create_vport(struct mana_port_context *apc,
24622467

24632468
apc->default_rxobj = INVALID_MANA_HANDLE;
24642469

2465-
if (gd->gdma_context->is_pf) {
2470+
if (gd->gdma_context->is_pf && !apc->ac->bm_hostmode) {
24662471
err = mana_pf_register_hw_vport(apc);
24672472
if (err)
24682473
return err;
@@ -2686,7 +2691,7 @@ int mana_alloc_queues(struct net_device *ndev)
26862691
if (err)
26872692
goto destroy_vport;
26882693

2689-
if (gd->gdma_context->is_pf) {
2694+
if (gd->gdma_context->is_pf && !apc->ac->bm_hostmode) {
26902695
err = mana_pf_register_filter(apc);
26912696
if (err)
26922697
goto destroy_vport;
@@ -2748,7 +2753,7 @@ static int mana_dealloc_queues(struct net_device *ndev)
27482753

27492754
mana_chn_setxdp(apc, NULL);
27502755

2751-
if (gd->gdma_context->is_pf)
2756+
if (gd->gdma_context->is_pf && !apc->ac->bm_hostmode)
27522757
mana_pf_deregister_filter(apc);
27532758

27542759
/* No packet can be transmitted now since apc->port_is_up is false.
@@ -2989,6 +2994,7 @@ int mana_probe(struct gdma_dev *gd, bool resuming)
29892994
struct gdma_context *gc = gd->gdma_context;
29902995
struct mana_context *ac = gd->driver_data;
29912996
struct device *dev = gc->dev;
2997+
u8 bm_hostmode = 0;
29922998
u16 num_ports = 0;
29932999
int err;
29943000
int i;
@@ -3015,10 +3021,12 @@ int mana_probe(struct gdma_dev *gd, bool resuming)
30153021
goto out;
30163022

30173023
err = mana_query_device_cfg(ac, MANA_MAJOR_VERSION, MANA_MINOR_VERSION,
3018-
MANA_MICRO_VERSION, &num_ports);
3024+
MANA_MICRO_VERSION, &num_ports, &bm_hostmode);
30193025
if (err)
30203026
goto out;
30213027

3028+
ac->bm_hostmode = bm_hostmode;
3029+
30223030
if (!resuming) {
30233031
ac->num_ports = num_ports;
30243032
} 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)