All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Min Hu (Connor)" <humin29@huawei.com>
To: <dev@dpdk.org>
Cc: <ferruh.yigit@intel.com>
Subject: [dpdk-dev] [PATCH 1/9] net/hns3: fix supported speed of copper ports
Date: Tue, 13 Apr 2021 21:47:11 +0800	[thread overview]
Message-ID: <1618321639-57642-2-git-send-email-humin29@huawei.com> (raw)
In-Reply-To: <1618321639-57642-1-git-send-email-humin29@huawei.com>

From: Huisong Li <lihuisong@huawei.com>

The "supported" obtaining from firmware on copper ports includes the
speed capability, auto-negotiation capability, and flow control
capability. Therefore, this patch changes "supported_capa" to
"supported_speed" and parses the speed capability supported by the
driver from the "supported".

Fixes: 2e4859f3b362 ("net/hns3: support PF device with copper PHYs")

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
---
 drivers/net/hns3/hns3_ethdev.c | 11 +++++++----
 drivers/net/hns3/hns3_ethdev.h |  2 +-
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index 846e5a2..d7766e1 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -4612,7 +4612,10 @@ hns3_update_fiber_link_info(struct hns3_hw *hw)
 static void
 hns3_parse_copper_phy_params(struct hns3_cmd_desc *desc, struct hns3_mac *mac)
 {
+#define HNS3_PHY_SUPPORTED_SPEED_MASK   0x2f
+
 	struct hns3_phy_params_bd0_cmd *req;
+	uint32_t supported;
 
 	req = (struct hns3_phy_params_bd0_cmd *)desc[0].data;
 	mac->link_speed = rte_le_to_cpu_32(req->speed);
@@ -4620,11 +4623,11 @@ hns3_parse_copper_phy_params(struct hns3_cmd_desc *desc, struct hns3_mac *mac)
 					   HNS3_PHY_DUPLEX_CFG_B);
 	mac->link_autoneg = hns3_get_bit(req->autoneg,
 					   HNS3_PHY_AUTONEG_CFG_B);
-	mac->supported_capa = rte_le_to_cpu_32(req->supported);
 	mac->advertising = rte_le_to_cpu_32(req->advertising);
 	mac->lp_advertising = rte_le_to_cpu_32(req->lp_advertising);
-	mac->support_autoneg = !!(mac->supported_capa &
-				HNS3_PHY_LINK_MODE_AUTONEG_BIT);
+	supported = rte_le_to_cpu_32(req->supported);
+	mac->supported_speed = supported & HNS3_PHY_SUPPORTED_SPEED_MASK;
+	mac->support_autoneg = !!(supported & HNS3_PHY_LINK_MODE_AUTONEG_BIT);
 }
 
 static int
@@ -4673,7 +4676,7 @@ hns3_update_copper_link_info(struct hns3_hw *hw)
 	mac->link_speed = mac_info.link_speed;
 	mac->link_duplex = mac_info.link_duplex;
 	mac->link_autoneg = mac_info.link_autoneg;
-	mac->supported_capa = mac_info.supported_capa;
+	mac->supported_speed = mac_info.supported_speed;
 	mac->advertising = mac_info.advertising;
 	mac->lp_advertising = mac_info.lp_advertising;
 	mac->support_autoneg = mac_info.support_autoneg;
diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h
index 72d718c..cbeadc0 100644
--- a/drivers/net/hns3/hns3_ethdev.h
+++ b/drivers/net/hns3/hns3_ethdev.h
@@ -183,7 +183,7 @@ struct hns3_mac {
 	uint8_t link_autoneg : 1; /* ETH_LINK_[AUTONEG/FIXED] */
 	uint8_t link_status  : 1; /* ETH_LINK_[DOWN/UP] */
 	uint32_t link_speed;      /* ETH_SPEED_NUM_ */
-	uint32_t supported_capa;  /* supported capability for current media */
+	uint32_t supported_speed;  /* supported speed for current media type */
 	uint32_t advertising;     /* advertised capability in the local part */
 	/* advertised capability in the link partner */
 	uint32_t lp_advertising;
-- 
2.7.4


  reply	other threads:[~2021-04-13 13:47 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-13 13:47 [dpdk-dev] [PATCH 0/9] support speed capability and autoneg report Min Hu (Connor)
2021-04-13 13:47 ` Min Hu (Connor) [this message]
2021-04-13 13:47 ` [dpdk-dev] [PATCH 2/9] net/hns3: add 1000M speed bit for copper PHYs Min Hu (Connor)
2021-04-13 13:47 ` [dpdk-dev] [PATCH 3/9] net/hns3: fix flow control mode Min Hu (Connor)
2021-04-13 13:47 ` [dpdk-dev] [PATCH 4/9] net/hns3: fix firmware compatibility configuration Min Hu (Connor)
2021-04-13 13:47 ` [dpdk-dev] [PATCH 5/9] net/hns3: obtain the supported speed for fiber port Min Hu (Connor)
2021-04-13 13:47 ` [dpdk-dev] [PATCH 6/9] net/hns3: report the speed capability for PF Min Hu (Connor)
2021-04-15  0:39   ` Ferruh Yigit
2021-04-15  0:57     ` Ferruh Yigit
2021-04-15  1:16       ` Min Hu (Connor)
2021-04-13 13:47 ` [dpdk-dev] [PATCH 7/9] net/hns3: support link speed autoneg " Min Hu (Connor)
2021-04-13 13:47 ` [dpdk-dev] [PATCH 8/9] net/hns3: support flow control autoneg for copper port Min Hu (Connor)
2021-04-13 13:47 ` [dpdk-dev] [PATCH 9/9] net/hns3: add the configuration of fixed speed Min Hu (Connor)
2021-04-15  0:55 ` [dpdk-dev] [PATCH 0/9] support speed capability and autoneg report Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1618321639-57642-2-git-send-email-humin29@huawei.com \
    --to=humin29@huawei.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.