[PATCH 20.11] net/hns3: support backplane media type

Xueming(Steven) Li xuemingl at nvidia.com
Fri Aug 12 09:11:31 CEST 2022


Thanks, applied.

> -----Original Message-----
> From: Huisong Li <lihuisong at huawei.com>
> Sent: Thursday, August 11, 2022 6:35 PM
> To: stable at dpdk.org; Xueming(Steven) Li <xuemingl at nvidia.com>
> Cc: liudongdong3 at huawei.com; fengchengwen at huawei.com; huangdaode at huawei.com; lihuisong at huawei.com
> Subject: [PATCH 20.11] net/hns3: support backplane media type
> 
> From: Chengwen Feng <fengchengwen at huawei.com>
> 
> [ upstream commit 916508f002ae887942ab3b970db33c0cc7fc6c02 ]
> 
> The 802.11 physical PMA sub-layer defines three media: copper, fiber and backplane. For PMD, the backplane is similar to the fiber, the
> main differences are that backplane doesn't have optical module.
> 
> Because the interface of firmware fiber is also applicable to the backplane, this patch supports the backplane only through simple extension.
> 
> Signed-off-by: Chengwen Feng <fengchengwen at huawei.com>
> Signed-off-by: Dongdong Liu <liudongdong3 at huawei.com>
> ---
>  drivers/net/hns3/hns3_ethdev.c | 41 ++++++++++++++++++++++++++--------
>  1 file changed, 32 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c index b2ff59ef62..f5fdcafa4f 100644
> --- a/drivers/net/hns3/hns3_ethdev.c
> +++ b/drivers/net/hns3/hns3_ethdev.c
> @@ -3139,6 +3139,34 @@ hns3_get_capability(struct hns3_hw *hw)
>  	return 0;
>  }
> 
> +static int
> +hns3_check_media_type(struct hns3_hw *hw, uint8_t media_type) {
> +	int ret;
> +
> +	switch (media_type) {
> +	case HNS3_MEDIA_TYPE_COPPER:
> +		if (!hns3_dev_copper_supported(hw)) {
> +			PMD_INIT_LOG(ERR,
> +				     "Media type is copper, not supported.");
> +			ret = -EOPNOTSUPP;
> +		} else {
> +			ret = 0;
> +		}
> +		break;
> +	case HNS3_MEDIA_TYPE_FIBER:
> +	case HNS3_MEDIA_TYPE_BACKPLANE:
> +		ret = 0;
> +		break;
> +	default:
> +		PMD_INIT_LOG(ERR, "Unknown media type = %u!", media_type);
> +		ret = -EINVAL;
> +		break;
> +	}
> +
> +	return ret;
> +}
> +
>  static int
>  hns3_get_board_configuration(struct hns3_hw *hw)  { @@ -3153,11 +3181,9 @@ hns3_get_board_configuration(struct hns3_hw *hw)
>  		return ret;
>  	}
> 
> -	if (cfg.media_type == HNS3_MEDIA_TYPE_COPPER &&
> -	    !hns3_dev_copper_supported(hw)) {
> -		PMD_INIT_LOG(ERR, "media type is copper, not supported.");
> -		return -EOPNOTSUPP;
> -	}
> +	ret = hns3_check_media_type(hw, cfg.media_type);
> +	if (ret)
> +		return ret;
> 
>  	hw->mac.media_type = cfg.media_type;
>  	hw->rss_size_max = cfg.rss_size_max;
> @@ -4488,14 +4514,11 @@ hns3_update_link_info(struct rte_eth_dev *eth_dev)  {
>  	struct hns3_adapter *hns = eth_dev->data->dev_private;
>  	struct hns3_hw *hw = &hns->hw;
> -	int ret = 0;
> 
>  	if (hw->mac.media_type == HNS3_MEDIA_TYPE_COPPER)
>  		return 0;
> -	else if (hw->mac.media_type == HNS3_MEDIA_TYPE_FIBER)
> -		ret = hns3_update_fiber_link_info(hw);
> 
> -	return ret;
> +	return hns3_update_fiber_link_info(hw);
>  }
> 
>  static int
> --
> 2.22.0



More information about the stable mailing list