ACK/Cmt: [SRU][N:linux-azure-nvidia][PATCH 1/1] net: mana: Add support for Multi Vports on Bare metal

Magali Lemes magali.lemes at canonical.com
Fri May 30 22:54:15 UTC 2025


On 30/05/2025 17:32, Vinicius Peixoto wrote:
> From: Haiyang Zhang <haiyangz at microsoft.com>
> 
> BugLink: https://bugs.launchpad.net/bugs/2112213
> 
> 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 at microsoft.com>
> Link: https://patch.msgid.link/1747671636-5810-1-git-send-email-haiyangz@microsoft.com
> Signed-off-by: Paolo Abeni <pabeni at redhat.com>
> (cherry picked from commit 290e5d3c49f687c1567bde634dc33d57b0674919 net-next)

Seems to already be on mailine, so net-next could be dropped

> Signed-off-by: Vinicius Peixoto <vinicius.peixoto at canonical.com>
> ---
>   drivers/net/ethernet/microsoft/mana/mana_en.c | 24 ++++++++++++-------
>   include/net/mana/mana.h                       |  4 +++-
>   2 files changed, 19 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/net/ethernet/microsoft/mana/mana_en.c b/drivers/net/ethernet/microsoft/mana/mana_en.c
> index 5f55074ca34f..9f13e19bd12d 100644
> --- a/drivers/net/ethernet/microsoft/mana/mana_en.c
> +++ b/drivers/net/ethernet/microsoft/mana/mana_en.c
> @@ -1018,7 +1018,7 @@ static void mana_pf_deregister_filter(struct mana_port_context *apc)
>   
>   static int mana_query_device_cfg(struct mana_context *ac, u32 proto_major_ver,
>   				 u32 proto_minor_ver, u32 proto_micro_ver,
> -				 u16 *max_num_vports)
> +				 u16 *max_num_vports, u8 *bm_hostmode)
>   {
>   	struct gdma_context *gc = ac->gdma_dev->gdma_context;
>   	struct mana_query_device_cfg_resp resp = {};
> @@ -1029,7 +1029,7 @@ static int mana_query_device_cfg(struct mana_context *ac, u32 proto_major_ver,
>   	mana_gd_init_req_hdr(&req.hdr, MANA_QUERY_DEV_CONFIG,
>   			     sizeof(req), sizeof(resp));
>   
> -	req.hdr.resp.msg_version = GDMA_MESSAGE_V2;
> +	req.hdr.resp.msg_version = GDMA_MESSAGE_V3;
>   
>   	req.proto_major_ver = proto_major_ver;
>   	req.proto_minor_ver = proto_minor_ver;
> @@ -1053,11 +1053,16 @@ static int mana_query_device_cfg(struct mana_context *ac, u32 proto_major_ver,
>   
>   	*max_num_vports = resp.max_num_vports;
>   
> -	if (resp.hdr.response.msg_version == GDMA_MESSAGE_V2)
> +	if (resp.hdr.response.msg_version >= GDMA_MESSAGE_V2)
>   		gc->adapter_mtu = resp.adapter_mtu;
>   	else
>   		gc->adapter_mtu = ETH_FRAME_LEN;
>   
> +	if (resp.hdr.response.msg_version >= GDMA_MESSAGE_V3)
> +		*bm_hostmode = resp.bm_hostmode;
> +	else
> +		*bm_hostmode = 0;
> +
>   	debugfs_create_u16("adapter-MTU", 0400, gc->mana_pci_debugfs, &gc->adapter_mtu);
>   
>   	return 0;
> @@ -2627,7 +2632,7 @@ static void mana_destroy_vport(struct mana_port_context *apc)
>   	mana_destroy_txq(apc);
>   	mana_uncfg_vport(apc);
>   
> -	if (gd->gdma_context->is_pf)
> +	if (gd->gdma_context->is_pf && !apc->ac->bm_hostmode)
>   		mana_pf_deregister_hw_vport(apc);
>   }
>   
> @@ -2639,7 +2644,7 @@ static int mana_create_vport(struct mana_port_context *apc,
>   
>   	apc->default_rxobj = INVALID_MANA_HANDLE;
>   
> -	if (gd->gdma_context->is_pf) {
> +	if (gd->gdma_context->is_pf && !apc->ac->bm_hostmode) {
>   		err = mana_pf_register_hw_vport(apc);
>   		if (err)
>   			return err;
> @@ -2843,7 +2848,7 @@ int mana_alloc_queues(struct net_device *ndev)
>   	if (err)
>   		goto destroy_vport;
>   
> -	if (gd->gdma_context->is_pf) {
> +	if (gd->gdma_context->is_pf && !apc->ac->bm_hostmode) {
>   		err = mana_pf_register_filter(apc);
>   		if (err)
>   			goto destroy_vport;
> @@ -2905,7 +2910,7 @@ static int mana_dealloc_queues(struct net_device *ndev)
>   
>   	mana_chn_setxdp(apc, NULL);
>   
> -	if (gd->gdma_context->is_pf)
> +	if (gd->gdma_context->is_pf && !apc->ac->bm_hostmode)
>   		mana_pf_deregister_filter(apc);
>   
>   	/* No packet can be transmitted now since apc->port_is_up is false.
> @@ -3142,6 +3147,7 @@ int mana_probe(struct gdma_dev *gd, bool resuming)
>   	struct gdma_context *gc = gd->gdma_context;
>   	struct mana_context *ac = gd->driver_data;
>   	struct device *dev = gc->dev;
> +	u8 bm_hostmode = 0;
>   	u16 num_ports = 0;
>   	int err;
>   	int i;
> @@ -3168,10 +3174,12 @@ int mana_probe(struct gdma_dev *gd, bool resuming)
>   		goto out;
>   
>   	err = mana_query_device_cfg(ac, MANA_MAJOR_VERSION, MANA_MINOR_VERSION,
> -				    MANA_MICRO_VERSION, &num_ports);
> +				    MANA_MICRO_VERSION, &num_ports, &bm_hostmode);
>   	if (err)
>   		goto out;
>   
> +	ac->bm_hostmode = bm_hostmode;
> +
>   	if (!resuming) {
>   		ac->num_ports = num_ports;
>   	} else {
> diff --git a/include/net/mana/mana.h b/include/net/mana/mana.h
> index cb9b6d7c3e5f..cd49ed285672 100644
> --- a/include/net/mana/mana.h
> +++ b/include/net/mana/mana.h
> @@ -408,6 +408,7 @@ struct mana_context {
>   	struct gdma_dev *gdma_dev;
>   
>   	u16 num_ports;
> +	u8 bm_hostmode;
>   
>   	struct mana_eq *eqs;
>   	struct dentry *mana_eqs_debugfs;
> @@ -592,7 +593,8 @@ struct mana_query_device_cfg_resp {
>   	u64 pf_cap_flags4;
>   
>   	u16 max_num_vports;
> -	u16 reserved;
> +	u8 bm_hostmode; /* response v3: Bare Metal Host Mode */
> +	u8 reserved;
>   	u32 max_num_eqs;
>   
>   	/* response v2: */

Acked-by: Magali Lemes <magali.lemes at canonical.com>




More information about the kernel-team mailing list