patches for DPDK stable branches
 help / color / mirror / Atom feed
* [PATCH 0/2] net/hns3: support backplane media type
@ 2022-06-11  7:42 Dongdong Liu
  2022-06-11  7:42 ` [PATCH 1/2] net/hns3: fix fail to obtain VF LSC capability Dongdong Liu
  2022-06-11  7:42 ` [PATCH 2/2] net/hns3: support backplane media type Dongdong Liu
  0 siblings, 2 replies; 11+ messages in thread
From: Dongdong Liu @ 2022-06-11  7:42 UTC (permalink / raw)
  To: dev; +Cc: stable, Dongdong Liu

This patchset include two patches:
1. net/hns3: fix fail to obtain VF LSC capability.
2. net/hns3: support backplane media type.

Chengwen Feng (1):
  net/hns3: support backplane media type

Huisong Li (1):
  net/hns3: fix fail to obtain VF LSC capability

 drivers/net/hns3/hns3_ethdev.c    | 54 +++++++++++++++++--------------
 drivers/net/hns3/hns3_ethdev_vf.c |  8 +++++
 2 files changed, 38 insertions(+), 24 deletions(-)

--
2.22.0


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 1/2] net/hns3: fix fail to obtain VF LSC capability
  2022-06-11  7:42 [PATCH 0/2] net/hns3: support backplane media type Dongdong Liu
@ 2022-06-11  7:42 ` Dongdong Liu
  2022-06-24 12:01   ` Ferruh Yigit
  2022-06-11  7:42 ` [PATCH 2/2] net/hns3: support backplane media type Dongdong Liu
  1 sibling, 1 reply; 11+ messages in thread
From: Dongdong Liu @ 2022-06-11  7:42 UTC (permalink / raw)
  To: dev
  Cc: stable, Huisong Li, Dongdong Liu, Min Hu (Connor),
	Yisen Zhuang, Lijun Ou, Chengwen Feng

From: Huisong Li <lihuisong@huawei.com>

Currently, the VF LSC capability is obtained from PF driver in
the interrupt mailbox interrupt thread, it is asynchronous.
The VF driver waits for 500ms to get this capability in probe
process.

The primary process will receive a message and do probe in the
interrupt thread context when attach a device in the secondary
process. At this case, VF driver never obtains this capability
from PF.

The root cause is that 'vf->pf_push_lsc_cap' is not updated by
the handling mailbox thread until finishing probe. The reason
this update wouldn't be done is that the handling mailbox interrupt
thread and the probe alarm thread are both in epool thread, and
the probe alarm thread is before the mailbox interrupt thread.

Fixes: 9bc2289fe5ea ("net/hns3: refactor VF LSC event report")
Cc: stable@dpdk.org

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
---
 drivers/net/hns3/hns3_ethdev_vf.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c
index bebfaa6417..3abd4aafcb 100644
--- a/drivers/net/hns3/hns3_ethdev_vf.c
+++ b/drivers/net/hns3/hns3_ethdev_vf.c
@@ -777,6 +777,14 @@ hns3vf_get_push_lsc_cap(struct hns3_hw *hw)
 
 	while (remain_ms > 0) {
 		rte_delay_ms(HNS3_POLL_RESPONE_MS);
+		/*
+		 * The probe process may perform in interrupt thread context.
+		 * For example, users attach a device in the secondary process.
+		 * At the moment, the handling mailbox task will be blocked. So
+		 * driver has to actively handle the HNS3_MBX_LINK_STAT_CHANGE
+		 * mailbox from PF driver to get this capability.
+		 */
+		hns3_dev_handle_mbx_msg(hw);
 		if (__atomic_load_n(&vf->pf_push_lsc_cap, __ATOMIC_ACQUIRE) !=
 			HNS3_PF_PUSH_LSC_CAP_UNKNOWN)
 			break;
-- 
2.22.0


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 2/2] net/hns3: support backplane media type
  2022-06-11  7:42 [PATCH 0/2] net/hns3: support backplane media type Dongdong Liu
  2022-06-11  7:42 ` [PATCH 1/2] net/hns3: fix fail to obtain VF LSC capability Dongdong Liu
@ 2022-06-11  7:42 ` Dongdong Liu
  2022-06-21 12:57   ` Ferruh Yigit
                     ` (2 more replies)
  1 sibling, 3 replies; 11+ messages in thread
From: Dongdong Liu @ 2022-06-11  7:42 UTC (permalink / raw)
  To: dev
  Cc: stable, Chengwen Feng, Dongdong Liu, Min Hu (Connor),
	Yisen Zhuang, Lijun Ou

From: Chengwen Feng <fengchengwen@huawei.com>

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.

Cc: stable@dpdk.org

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
---
 drivers/net/hns3/hns3_ethdev.c | 54 +++++++++++++++++++---------------
 1 file changed, 30 insertions(+), 24 deletions(-)

diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index 6c77c8b964..b17a3e8669 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -2787,11 +2787,8 @@ hns3_check_media_type(struct hns3_hw *hw, uint8_t media_type)
 		}
 		break;
 	case HNS3_MEDIA_TYPE_FIBER:
-		ret = 0;
-		break;
 	case HNS3_MEDIA_TYPE_BACKPLANE:
-		PMD_INIT_LOG(ERR, "Media type is Backplane, not supported.");
-		ret = -EOPNOTSUPP;
+		ret = 0;
 		break;
 	default:
 		PMD_INIT_LOG(ERR, "Unknown media type = %u!", media_type);
@@ -4244,14 +4241,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)
-		ret = hns3_update_copper_link_info(hw);
-	else if (hw->mac.media_type == HNS3_MEDIA_TYPE_FIBER)
-		ret = hns3_update_fiber_link_info(hw);
+		return hns3_update_copper_link_info(hw);
 
-	return ret;
+	return hns3_update_fiber_link_info(hw);
 }
 
 static int
@@ -4544,11 +4538,13 @@ hns3_get_port_supported_speed(struct rte_eth_dev *eth_dev)
 	if (ret)
 		return ret;
 
-	if (mac->media_type == HNS3_MEDIA_TYPE_FIBER) {
+	if (mac->media_type == HNS3_MEDIA_TYPE_FIBER ||
+	    mac->media_type == HNS3_MEDIA_TYPE_BACKPLANE) {
 		/*
 		 * Some firmware does not support the report of supported_speed,
-		 * and only report the effective speed of SFP. In this case, it
-		 * is necessary to use the SFP's speed as the supported_speed.
+		 * and only report the effective speed of SFP/backplane. In this
+		 * case, it is necessary to use the SFP/backplane's speed as the
+		 * supported_speed.
 		 */
 		if (mac->supported_speed == 0)
 			mac->supported_speed =
@@ -4810,7 +4806,7 @@ hns3_check_port_speed(struct hns3_hw *hw, uint32_t link_speeds)
 
 	if (mac->media_type == HNS3_MEDIA_TYPE_COPPER)
 		speed_bit = hns3_convert_link_speeds2bitmap_copper(link_speeds);
-	else if (mac->media_type == HNS3_MEDIA_TYPE_FIBER)
+	else
 		speed_bit = hns3_convert_link_speeds2bitmap_fiber(link_speeds);
 
 	if (!(speed_bit & supported_speed)) {
@@ -4954,6 +4950,19 @@ hns3_set_fiber_port_link_speed(struct hns3_hw *hw,
 	return hns3_cfg_mac_speed_dup(hw, cfg->speed, cfg->duplex);
 }
 
+static const char *
+hns3_get_media_type_name(uint8_t media_type)
+{
+	if (media_type == HNS3_MEDIA_TYPE_FIBER)
+		return "fiber";
+	else if (media_type == HNS3_MEDIA_TYPE_COPPER)
+		return "copper";
+	else if (media_type == HNS3_MEDIA_TYPE_BACKPLANE)
+		return "backplane";
+	else
+		return "unknown";
+}
+
 static int
 hns3_set_port_link_speed(struct hns3_hw *hw,
 			 struct hns3_set_link_speed_cfg *cfg)
@@ -4968,18 +4977,15 @@ hns3_set_port_link_speed(struct hns3_hw *hw,
 #endif
 
 		ret = hns3_set_copper_port_link_speed(hw, cfg);
-		if (ret) {
-			hns3_err(hw, "failed to set copper port link speed,"
-				 "ret = %d.", ret);
-			return ret;
-		}
-	} else if (hw->mac.media_type == HNS3_MEDIA_TYPE_FIBER) {
+	} else {
 		ret = hns3_set_fiber_port_link_speed(hw, cfg);
-		if (ret) {
-			hns3_err(hw, "failed to set fiber port link speed,"
-				 "ret = %d.", ret);
-			return ret;
-		}
+	}
+
+	if (ret) {
+		hns3_err(hw, "failed to set %s port link speed, ret = %d.",
+			 hns3_get_media_type_name(hw->mac.media_type),
+			 ret);
+		return ret;
 	}
 
 	return 0;
-- 
2.22.0


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/2] net/hns3: support backplane media type
  2022-06-11  7:42 ` [PATCH 2/2] net/hns3: support backplane media type Dongdong Liu
@ 2022-06-21 12:57   ` Ferruh Yigit
  2022-06-22  2:45     ` Dongdong Liu
  2022-06-22  3:09   ` [PATCH V2 " Dongdong Liu
  2022-06-22 10:59   ` [PATCH V3 " Dongdong Liu
  2 siblings, 1 reply; 11+ messages in thread
From: Ferruh Yigit @ 2022-06-21 12:57 UTC (permalink / raw)
  To: Dongdong Liu, dev
  Cc: stable, Chengwen Feng, Min Hu (Connor), Yisen Zhuang, Lijun Ou

On 6/11/2022 8:42 AM, Dongdong Liu wrote:
> From: Chengwen Feng<fengchengwen@huawei.com>
> 
> 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.
> 
> Cc:stable@dpdk.org
> 
> Signed-off-by: Chengwen Feng<fengchengwen@huawei.com>
> Signed-off-by: Dongdong Liu<liudongdong3@huawei.com>

What do you think to document new 'backplane' media type support in 
release notes?

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/2] net/hns3: support backplane media type
  2022-06-21 12:57   ` Ferruh Yigit
@ 2022-06-22  2:45     ` Dongdong Liu
  0 siblings, 0 replies; 11+ messages in thread
From: Dongdong Liu @ 2022-06-22  2:45 UTC (permalink / raw)
  To: Ferruh Yigit, dev; +Cc: stable, Chengwen Feng, Min Hu (Connor), Yisen Zhuang

Hi Ferruh

Many thanks for your review
On 2022/6/21 20:57, Ferruh Yigit wrote:
> On 6/11/2022 8:42 AM, Dongdong Liu wrote:
>> From: Chengwen Feng<fengchengwen@huawei.com>
>>
>> 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.
>>
>> Cc:stable@dpdk.org
>>
>> Signed-off-by: Chengwen Feng<fengchengwen@huawei.com>
>> Signed-off-by: Dongdong Liu<liudongdong3@huawei.com>
>
> What do you think to document new 'backplane' media type support in
> release notes?
Good point, will do.

Thanks,
Dongdong
> .
>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH V2 2/2] net/hns3: support backplane media type
  2022-06-11  7:42 ` [PATCH 2/2] net/hns3: support backplane media type Dongdong Liu
  2022-06-21 12:57   ` Ferruh Yigit
@ 2022-06-22  3:09   ` Dongdong Liu
  2022-06-22 10:06     ` Ferruh Yigit
  2022-06-22 10:59   ` [PATCH V3 " Dongdong Liu
  2 siblings, 1 reply; 11+ messages in thread
From: Dongdong Liu @ 2022-06-22  3:09 UTC (permalink / raw)
  To: dev, ferruh.yigit, andrew.rybchenko, thomas
  Cc: stable, Chengwen Feng, Dongdong Liu, Min Hu (Connor),
	Yisen Zhuang, Lijun Ou

From: Chengwen Feng <fengchengwen@huawei.com>

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.

Cc: stable@dpdk.org

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
---
v1->v2:
- document new 'backplane' media type support in release notes.
---
 doc/guides/rel_notes/release_22_07.rst |  4 ++
 drivers/net/hns3/hns3_ethdev.c         | 54 ++++++++++++++------------
 2 files changed, 34 insertions(+), 24 deletions(-)

diff --git a/doc/guides/rel_notes/release_22_07.rst b/doc/guides/rel_notes/release_22_07.rst
index dd371952c3..7884ecfd09 100644
--- a/doc/guides/rel_notes/release_22_07.rst
+++ b/doc/guides/rel_notes/release_22_07.rst
@@ -172,6 +172,10 @@ New Features
 
   * Added support for yt8531s PHY.
 
+* **Updated HiSilicon hns3 driver.**
+
+  * Added support for backplane media type.
+
 * **Added Elliptic Curve Diffie-Hellman (ECDH) algorithm in cryptodev.**
 
   Added support for Elliptic Curve Diffie Hellman (ECDH) asymmetric
diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index 6c77c8b964..b17a3e8669 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -2787,11 +2787,8 @@ hns3_check_media_type(struct hns3_hw *hw, uint8_t media_type)
 		}
 		break;
 	case HNS3_MEDIA_TYPE_FIBER:
-		ret = 0;
-		break;
 	case HNS3_MEDIA_TYPE_BACKPLANE:
-		PMD_INIT_LOG(ERR, "Media type is Backplane, not supported.");
-		ret = -EOPNOTSUPP;
+		ret = 0;
 		break;
 	default:
 		PMD_INIT_LOG(ERR, "Unknown media type = %u!", media_type);
@@ -4244,14 +4241,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)
-		ret = hns3_update_copper_link_info(hw);
-	else if (hw->mac.media_type == HNS3_MEDIA_TYPE_FIBER)
-		ret = hns3_update_fiber_link_info(hw);
+		return hns3_update_copper_link_info(hw);
 
-	return ret;
+	return hns3_update_fiber_link_info(hw);
 }
 
 static int
@@ -4544,11 +4538,13 @@ hns3_get_port_supported_speed(struct rte_eth_dev *eth_dev)
 	if (ret)
 		return ret;
 
-	if (mac->media_type == HNS3_MEDIA_TYPE_FIBER) {
+	if (mac->media_type == HNS3_MEDIA_TYPE_FIBER ||
+	    mac->media_type == HNS3_MEDIA_TYPE_BACKPLANE) {
 		/*
 		 * Some firmware does not support the report of supported_speed,
-		 * and only report the effective speed of SFP. In this case, it
-		 * is necessary to use the SFP's speed as the supported_speed.
+		 * and only report the effective speed of SFP/backplane. In this
+		 * case, it is necessary to use the SFP/backplane's speed as the
+		 * supported_speed.
 		 */
 		if (mac->supported_speed == 0)
 			mac->supported_speed =
@@ -4810,7 +4806,7 @@ hns3_check_port_speed(struct hns3_hw *hw, uint32_t link_speeds)
 
 	if (mac->media_type == HNS3_MEDIA_TYPE_COPPER)
 		speed_bit = hns3_convert_link_speeds2bitmap_copper(link_speeds);
-	else if (mac->media_type == HNS3_MEDIA_TYPE_FIBER)
+	else
 		speed_bit = hns3_convert_link_speeds2bitmap_fiber(link_speeds);
 
 	if (!(speed_bit & supported_speed)) {
@@ -4954,6 +4950,19 @@ hns3_set_fiber_port_link_speed(struct hns3_hw *hw,
 	return hns3_cfg_mac_speed_dup(hw, cfg->speed, cfg->duplex);
 }
 
+static const char *
+hns3_get_media_type_name(uint8_t media_type)
+{
+	if (media_type == HNS3_MEDIA_TYPE_FIBER)
+		return "fiber";
+	else if (media_type == HNS3_MEDIA_TYPE_COPPER)
+		return "copper";
+	else if (media_type == HNS3_MEDIA_TYPE_BACKPLANE)
+		return "backplane";
+	else
+		return "unknown";
+}
+
 static int
 hns3_set_port_link_speed(struct hns3_hw *hw,
 			 struct hns3_set_link_speed_cfg *cfg)
@@ -4968,18 +4977,15 @@ hns3_set_port_link_speed(struct hns3_hw *hw,
 #endif
 
 		ret = hns3_set_copper_port_link_speed(hw, cfg);
-		if (ret) {
-			hns3_err(hw, "failed to set copper port link speed,"
-				 "ret = %d.", ret);
-			return ret;
-		}
-	} else if (hw->mac.media_type == HNS3_MEDIA_TYPE_FIBER) {
+	} else {
 		ret = hns3_set_fiber_port_link_speed(hw, cfg);
-		if (ret) {
-			hns3_err(hw, "failed to set fiber port link speed,"
-				 "ret = %d.", ret);
-			return ret;
-		}
+	}
+
+	if (ret) {
+		hns3_err(hw, "failed to set %s port link speed, ret = %d.",
+			 hns3_get_media_type_name(hw->mac.media_type),
+			 ret);
+		return ret;
 	}
 
 	return 0;
-- 
2.22.0


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH V2 2/2] net/hns3: support backplane media type
  2022-06-22  3:09   ` [PATCH V2 " Dongdong Liu
@ 2022-06-22 10:06     ` Ferruh Yigit
  2022-06-22 10:29       ` Dongdong Liu
  0 siblings, 1 reply; 11+ messages in thread
From: Ferruh Yigit @ 2022-06-22 10:06 UTC (permalink / raw)
  To: Dongdong Liu, dev, andrew.rybchenko, thomas
  Cc: stable, Chengwen Feng, Min Hu (Connor), Yisen Zhuang, Lijun Ou

On 6/22/2022 4:09 AM, Dongdong Liu wrote:
> From: Chengwen Feng <fengchengwen@huawei.com>
> 
> 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.
> 
> Cc: stable@dpdk.org
> 
> Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
> Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
> ---
> v1->v2:
> - document new 'backplane' media type support in release notes.
> ---
>   doc/guides/rel_notes/release_22_07.rst |  4 ++
>   drivers/net/hns3/hns3_ethdev.c         | 54 ++++++++++++++------------
>   2 files changed, 34 insertions(+), 24 deletions(-)
> 
> diff --git a/doc/guides/rel_notes/release_22_07.rst b/doc/guides/rel_notes/release_22_07.rst
> index dd371952c3..7884ecfd09 100644
> --- a/doc/guides/rel_notes/release_22_07.rst
> +++ b/doc/guides/rel_notes/release_22_07.rst
> @@ -172,6 +172,10 @@ New Features
>   
>     * Added support for yt8531s PHY.
>   
> +* **Updated HiSilicon hns3 driver.**
> +
> +  * Added support for backplane media type.
> +

We are sorting PMD updates on vendor name, so can you please move update 
above Intel updates.

Except above minor release notes location order, patch looks good to me, 
but it requires hns3 maintainers ack/review to proceed. (Same for both 
patches.)

Thanks,
ferruh

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH V2 2/2] net/hns3: support backplane media type
  2022-06-22 10:06     ` Ferruh Yigit
@ 2022-06-22 10:29       ` Dongdong Liu
  0 siblings, 0 replies; 11+ messages in thread
From: Dongdong Liu @ 2022-06-22 10:29 UTC (permalink / raw)
  To: Ferruh Yigit, dev, andrew.rybchenko, thomas
  Cc: stable, Chengwen Feng, Min Hu (Connor), Yisen Zhuang, Lijun Ou

Hi Ferruh

On 2022/6/22 18:06, Ferruh Yigit wrote:
> On 6/22/2022 4:09 AM, Dongdong Liu wrote:
>> From: Chengwen Feng <fengchengwen@huawei.com>
>>
>> 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.
>>
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
>> Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
>> ---
>> v1->v2:
>> - document new 'backplane' media type support in release notes.
>> ---
>>   doc/guides/rel_notes/release_22_07.rst |  4 ++
>>   drivers/net/hns3/hns3_ethdev.c         | 54 ++++++++++++++------------
>>   2 files changed, 34 insertions(+), 24 deletions(-)
>>
>> diff --git a/doc/guides/rel_notes/release_22_07.rst
>> b/doc/guides/rel_notes/release_22_07.rst
>> index dd371952c3..7884ecfd09 100644
>> --- a/doc/guides/rel_notes/release_22_07.rst
>> +++ b/doc/guides/rel_notes/release_22_07.rst
>> @@ -172,6 +172,10 @@ New Features
>>       * Added support for yt8531s PHY.
>>   +* **Updated HiSilicon hns3 driver.**
>> +
>> +  * Added support for backplane media type.
>> +
>
> We are sorting PMD updates on vendor name, so can you please move update
> above Intel updates.
will do
>
> Except above minor release notes location order, patch looks good to me,
> but it requires hns3 maintainers ack/review to proceed. (Same for both
> patches.)

Lijun Ou and Min Hu current do not work for the hns3 driver.
I will do the work. I will send a patch to update the hns3 maintainers.

Thanks,
Dongdong
>
> Thanks,
> ferruh
> .
>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH V3 2/2] net/hns3: support backplane media type
  2022-06-11  7:42 ` [PATCH 2/2] net/hns3: support backplane media type Dongdong Liu
  2022-06-21 12:57   ` Ferruh Yigit
  2022-06-22  3:09   ` [PATCH V2 " Dongdong Liu
@ 2022-06-22 10:59   ` Dongdong Liu
  2022-06-24 12:02     ` Ferruh Yigit
  2 siblings, 1 reply; 11+ messages in thread
From: Dongdong Liu @ 2022-06-22 10:59 UTC (permalink / raw)
  To: dev, ferruh.yigit, andrew.rybchenko, thomas
  Cc: stable, Chengwen Feng, Dongdong Liu, Yisen Zhuang

From: Chengwen Feng <fengchengwen@huawei.com>

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.

Cc: stable@dpdk.org

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
---
v2->v3:
- move the HiSilicon update above Intel updates.
v1->v2:
- document new 'backplane' media type support in release notes.
---
 doc/guides/rel_notes/release_22_07.rst |  4 ++
 drivers/net/hns3/hns3_ethdev.c         | 54 ++++++++++++++------------
 2 files changed, 34 insertions(+), 24 deletions(-)

diff --git a/doc/guides/rel_notes/release_22_07.rst b/doc/guides/rel_notes/release_22_07.rst
index dd371952c3..395fb6cad8 100644
--- a/doc/guides/rel_notes/release_22_07.rst
+++ b/doc/guides/rel_notes/release_22_07.rst
@@ -122,6 +122,10 @@ New Features
   * Added support for Atomic Rules PCI device IDs ``0x101a, 0x101b, 0x101c``.
   * Added PMD support for virtual functions and vfio_pci driver.
 
+* **Updated HiSilicon hns3 driver.**
+
+  * Added support for backplane media type.
+
 * **Updated Intel iavf driver.**
 
   * Added Tx QoS queue rate limitation support.
diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index 6c77c8b964..b17a3e8669 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -2787,11 +2787,8 @@ hns3_check_media_type(struct hns3_hw *hw, uint8_t media_type)
 		}
 		break;
 	case HNS3_MEDIA_TYPE_FIBER:
-		ret = 0;
-		break;
 	case HNS3_MEDIA_TYPE_BACKPLANE:
-		PMD_INIT_LOG(ERR, "Media type is Backplane, not supported.");
-		ret = -EOPNOTSUPP;
+		ret = 0;
 		break;
 	default:
 		PMD_INIT_LOG(ERR, "Unknown media type = %u!", media_type);
@@ -4244,14 +4241,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)
-		ret = hns3_update_copper_link_info(hw);
-	else if (hw->mac.media_type == HNS3_MEDIA_TYPE_FIBER)
-		ret = hns3_update_fiber_link_info(hw);
+		return hns3_update_copper_link_info(hw);
 
-	return ret;
+	return hns3_update_fiber_link_info(hw);
 }
 
 static int
@@ -4544,11 +4538,13 @@ hns3_get_port_supported_speed(struct rte_eth_dev *eth_dev)
 	if (ret)
 		return ret;
 
-	if (mac->media_type == HNS3_MEDIA_TYPE_FIBER) {
+	if (mac->media_type == HNS3_MEDIA_TYPE_FIBER ||
+	    mac->media_type == HNS3_MEDIA_TYPE_BACKPLANE) {
 		/*
 		 * Some firmware does not support the report of supported_speed,
-		 * and only report the effective speed of SFP. In this case, it
-		 * is necessary to use the SFP's speed as the supported_speed.
+		 * and only report the effective speed of SFP/backplane. In this
+		 * case, it is necessary to use the SFP/backplane's speed as the
+		 * supported_speed.
 		 */
 		if (mac->supported_speed == 0)
 			mac->supported_speed =
@@ -4810,7 +4806,7 @@ hns3_check_port_speed(struct hns3_hw *hw, uint32_t link_speeds)
 
 	if (mac->media_type == HNS3_MEDIA_TYPE_COPPER)
 		speed_bit = hns3_convert_link_speeds2bitmap_copper(link_speeds);
-	else if (mac->media_type == HNS3_MEDIA_TYPE_FIBER)
+	else
 		speed_bit = hns3_convert_link_speeds2bitmap_fiber(link_speeds);
 
 	if (!(speed_bit & supported_speed)) {
@@ -4954,6 +4950,19 @@ hns3_set_fiber_port_link_speed(struct hns3_hw *hw,
 	return hns3_cfg_mac_speed_dup(hw, cfg->speed, cfg->duplex);
 }
 
+static const char *
+hns3_get_media_type_name(uint8_t media_type)
+{
+	if (media_type == HNS3_MEDIA_TYPE_FIBER)
+		return "fiber";
+	else if (media_type == HNS3_MEDIA_TYPE_COPPER)
+		return "copper";
+	else if (media_type == HNS3_MEDIA_TYPE_BACKPLANE)
+		return "backplane";
+	else
+		return "unknown";
+}
+
 static int
 hns3_set_port_link_speed(struct hns3_hw *hw,
 			 struct hns3_set_link_speed_cfg *cfg)
@@ -4968,18 +4977,15 @@ hns3_set_port_link_speed(struct hns3_hw *hw,
 #endif
 
 		ret = hns3_set_copper_port_link_speed(hw, cfg);
-		if (ret) {
-			hns3_err(hw, "failed to set copper port link speed,"
-				 "ret = %d.", ret);
-			return ret;
-		}
-	} else if (hw->mac.media_type == HNS3_MEDIA_TYPE_FIBER) {
+	} else {
 		ret = hns3_set_fiber_port_link_speed(hw, cfg);
-		if (ret) {
-			hns3_err(hw, "failed to set fiber port link speed,"
-				 "ret = %d.", ret);
-			return ret;
-		}
+	}
+
+	if (ret) {
+		hns3_err(hw, "failed to set %s port link speed, ret = %d.",
+			 hns3_get_media_type_name(hw->mac.media_type),
+			 ret);
+		return ret;
 	}
 
 	return 0;
-- 
2.22.0


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/2] net/hns3: fix fail to obtain VF LSC capability
  2022-06-11  7:42 ` [PATCH 1/2] net/hns3: fix fail to obtain VF LSC capability Dongdong Liu
@ 2022-06-24 12:01   ` Ferruh Yigit
  0 siblings, 0 replies; 11+ messages in thread
From: Ferruh Yigit @ 2022-06-24 12:01 UTC (permalink / raw)
  To: Dongdong Liu
  Cc: stable, Huisong Li, Min Hu (Connor),
	Yisen Zhuang, Lijun Ou, Chengwen Feng, dev

On 6/11/2022 8:42 AM, Dongdong Liu wrote:
> From: Huisong Li <lihuisong@huawei.com>
> 
> Currently, the VF LSC capability is obtained from PF driver in
> the interrupt mailbox interrupt thread, it is asynchronous.
> The VF driver waits for 500ms to get this capability in probe
> process.
> 
> The primary process will receive a message and do probe in the
> interrupt thread context when attach a device in the secondary
> process. At this case, VF driver never obtains this capability
> from PF.
> 
> The root cause is that 'vf->pf_push_lsc_cap' is not updated by
> the handling mailbox thread until finishing probe. The reason
> this update wouldn't be done is that the handling mailbox interrupt
> thread and the probe alarm thread are both in epool thread, and
> the probe alarm thread is before the mailbox interrupt thread.
> 
> Fixes: 9bc2289fe5ea ("net/hns3: refactor VF LSC event report")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Huisong Li <lihuisong@huawei.com>
> Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>

Applied to dpdk-next-net/main, thanks.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH V3 2/2] net/hns3: support backplane media type
  2022-06-22 10:59   ` [PATCH V3 " Dongdong Liu
@ 2022-06-24 12:02     ` Ferruh Yigit
  0 siblings, 0 replies; 11+ messages in thread
From: Ferruh Yigit @ 2022-06-24 12:02 UTC (permalink / raw)
  To: Dongdong Liu, andrew.rybchenko, thomas
  Cc: stable, Chengwen Feng, Yisen Zhuang, dev

On 6/22/2022 11:59 AM, Dongdong Liu wrote:
> From: Chengwen Feng <fengchengwen@huawei.com>
> 
> 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.
> 
> Cc: stable@dpdk.org
> 
> Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
> Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>

Applied to dpdk-next-net/main, thanks.

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2022-06-24 12:02 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-11  7:42 [PATCH 0/2] net/hns3: support backplane media type Dongdong Liu
2022-06-11  7:42 ` [PATCH 1/2] net/hns3: fix fail to obtain VF LSC capability Dongdong Liu
2022-06-24 12:01   ` Ferruh Yigit
2022-06-11  7:42 ` [PATCH 2/2] net/hns3: support backplane media type Dongdong Liu
2022-06-21 12:57   ` Ferruh Yigit
2022-06-22  2:45     ` Dongdong Liu
2022-06-22  3:09   ` [PATCH V2 " Dongdong Liu
2022-06-22 10:06     ` Ferruh Yigit
2022-06-22 10:29       ` Dongdong Liu
2022-06-22 10:59   ` [PATCH V3 " Dongdong Liu
2022-06-24 12:02     ` Ferruh Yigit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).