Subject: Re: [PATCH net-next v01 1/9] hinic3: Add PF framework

From: Simon Horman <[email-masked]>
Date: Mon, 27 Oct 2025 10:00:32 +0000

On Wed, Oct 15, 2025 at 03:15:27PM +0800, Fan Gong wrote:
> Add support for PF framework based on the VF code.
> 
> Co-developed-by: Zhu Yikai <[email-masked]>
> Signed-off-by: Zhu Yikai <[email-masked]>
> Signed-off-by: Fan Gong <[email-masked]>

...

> diff --git a/drivers/net/ethernet/huawei/hinic3/hinic3_nic_cfg.c b/drivers/net/ethernet/huawei/hinic3/hinic3_nic_cfg.c
> index 979f47ca77f9..2b93026845ff 100644
> --- a/drivers/net/ethernet/huawei/hinic3/hinic3_nic_cfg.c
> +++ b/drivers/net/ethernet/huawei/hinic3/hinic3_nic_cfg.c
> @@ -117,17 +117,49 @@ int hinic3_set_port_mtu(struct net_device *netdev, u16 new_mtu)
>  					 &func_tbl_cfg);
>  }
>  
> +#define PF_SET_VF_MAC(hwdev, status) \
> +	(HINIC3_IS_VF(hwdev) && (status) == HINIC3_PF_SET_VF_ALREADY)
> +

nit: I think the above could be a function rather than a macro.

...

> @@ -157,9 +189,9 @@ int hinic3_set_mac(struct hinic3_hwdev *hwdev, const u8 *mac_addr, u16 vlan_id,
>  		return -EIO;
>  	}
>  
> -	if (mac_info.msg_head.status == MGMT_STATUS_PF_SET_VF_ALREADY) {
> +	if (PF_SET_VF_MAC(hwdev, mac_info.msg_head.status)) {
>  		dev_warn(hwdev->dev, "PF has already set VF mac, Ignore set operation\n");
> -		return 0;
> +		return HINIC3_PF_SET_VF_ALREADY;

It seems to me that this custom return value can be propagated up
and returned by the probe function. If so, this doesn't seem desirable.
And, overall, I would recommend against the custom calling convention
that custom return values imply.

>  	}
>  
>  	if (mac_info.msg_head.status == MGMT_STATUS_EXIST) {

...