DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Wei Hu (Xavier)" <xavier.huwei@huawei.com>
To: <dev@dpdk.org>
Cc: <xavier.huwei@huawei.com>
Subject: [dpdk-dev] [PATCH v3 2/4] net/hns3: support 200G speed rate
Date: Tue, 14 Jul 2020 14:16:07 +0800	[thread overview]
Message-ID: <1594707369-36270-3-git-send-email-xavier.huwei@huawei.com> (raw)
In-Reply-To: <1594707369-36270-1-git-send-email-xavier.huwei@huawei.com>

The 200G device has a new device id 0xA228, so adds this device id
to pci table for pci driver can probe it. Similar to the network port
with other speed, the hns3 PMD driver gets 200G speed information
from firmware, and passes them to DPDK framework.

Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
---
 drivers/net/hns3/hns3_cmd.h       |  1 +
 drivers/net/hns3/hns3_ethdev.c    | 12 +++++++++++-
 drivers/net/hns3/hns3_ethdev.h    |  1 +
 drivers/net/hns3/hns3_ethdev_vf.c |  1 +
 4 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/net/hns3/hns3_cmd.h b/drivers/net/hns3/hns3_cmd.h
index b203e66..d70f42e 100644
--- a/drivers/net/hns3/hns3_cmd.h
+++ b/drivers/net/hns3/hns3_cmd.h
@@ -622,6 +622,7 @@ struct hns3_config_mac_mode_cmd {
 #define HNS3_CFG_SPEED_40G		3
 #define HNS3_CFG_SPEED_50G		4
 #define HNS3_CFG_SPEED_100G		5
+#define HNS3_CFG_SPEED_200G		8
 
 #define HNS3_CFG_SPEED_S		0
 #define HNS3_CFG_SPEED_M		GENMASK(5, 0)
diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index f218fb8..4712cc2 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -2560,6 +2560,7 @@ hns3_dev_link_update(struct rte_eth_dev *eth_dev,
 	case ETH_SPEED_NUM_40G:
 	case ETH_SPEED_NUM_50G:
 	case ETH_SPEED_NUM_100G:
+	case ETH_SPEED_NUM_200G:
 		new_link.link_speed = mac->link_speed;
 		break;
 	default:
@@ -2789,6 +2790,9 @@ hns3_parse_speed(int speed_cmd, uint32_t *speed)
 	case HNS3_CFG_SPEED_100G:
 		*speed = ETH_SPEED_NUM_100G;
 		break;
+	case HNS3_CFG_SPEED_200G:
+		*speed = ETH_SPEED_NUM_200G;
+		break;
 	default:
 		return -EINVAL;
 	}
@@ -2811,7 +2815,8 @@ hns3_get_capability(struct hns3_hw *hw)
 
 	if (device_id == HNS3_DEV_ID_25GE_RDMA ||
 	    device_id == HNS3_DEV_ID_50GE_RDMA ||
-	    device_id == HNS3_DEV_ID_100G_RDMA_MACSEC)
+	    device_id == HNS3_DEV_ID_100G_RDMA_MACSEC ||
+	    device_id == HNS3_DEV_ID_200G_RDMA)
 		hns3_set_bit(hw->capability, HNS3_DEV_SUPPORT_DCB_B, 1);
 
 	/* Get PCI revision id */
@@ -3027,6 +3032,10 @@ hns3_cfg_mac_speed_dup_hw(struct hns3_hw *hw, uint32_t speed, uint8_t duplex)
 		hns3_set_field(req->speed_dup, HNS3_CFG_SPEED_M,
 			       HNS3_CFG_SPEED_S, HNS3_CFG_SPEED_100G);
 		break;
+	case ETH_SPEED_NUM_200G:
+		hns3_set_field(req->speed_dup, HNS3_CFG_SPEED_M,
+			       HNS3_CFG_SPEED_S, HNS3_CFG_SPEED_200G);
+		break;
 	default:
 		PMD_INIT_LOG(ERR, "invalid speed (%u)", speed);
 		return -EINVAL;
@@ -5589,6 +5598,7 @@ static const struct rte_pci_id pci_id_hns3_map[] = {
 	{ RTE_PCI_DEVICE(PCI_VENDOR_ID_HUAWEI, HNS3_DEV_ID_25GE_RDMA) },
 	{ RTE_PCI_DEVICE(PCI_VENDOR_ID_HUAWEI, HNS3_DEV_ID_50GE_RDMA) },
 	{ RTE_PCI_DEVICE(PCI_VENDOR_ID_HUAWEI, HNS3_DEV_ID_100G_RDMA_MACSEC) },
+	{ RTE_PCI_DEVICE(PCI_VENDOR_ID_HUAWEI, HNS3_DEV_ID_200G_RDMA) },
 	{ .vendor_id = 0, /* sentinel */ },
 };
 
diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h
index 31d34b0..0e665e5 100644
--- a/drivers/net/hns3/hns3_ethdev.h
+++ b/drivers/net/hns3/hns3_ethdev.h
@@ -23,6 +23,7 @@
 #define HNS3_DEV_ID_25GE_RDMA			0xA222
 #define HNS3_DEV_ID_50GE_RDMA			0xA224
 #define HNS3_DEV_ID_100G_RDMA_MACSEC		0xA226
+#define HNS3_DEV_ID_200G_RDMA			0xA228
 #define HNS3_DEV_ID_100G_VF			0xA22E
 #define HNS3_DEV_ID_100G_RDMA_PFC_VF		0xA22F
 
diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c
index 54e5dac..b881bbe 100644
--- a/drivers/net/hns3/hns3_ethdev_vf.c
+++ b/drivers/net/hns3/hns3_ethdev_vf.c
@@ -1893,6 +1893,7 @@ hns3vf_dev_link_update(struct rte_eth_dev *eth_dev,
 	case ETH_SPEED_NUM_40G:
 	case ETH_SPEED_NUM_50G:
 	case ETH_SPEED_NUM_100G:
+	case ETH_SPEED_NUM_200G:
 		new_link.link_speed = mac->link_speed;
 		break;
 	default:
-- 
2.7.4


  parent reply	other threads:[~2020-07-14  6:18 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-11 10:18 [dpdk-dev] [PATCH v2 0/4] updates for hns3 PMD driver Wei Hu (Xavier)
2020-07-11 10:18 ` [dpdk-dev] [PATCH v2 1/4] net/hns3: support copper media type Wei Hu (Xavier)
2020-07-14  6:16   ` [dpdk-dev] [PATCH v3 0/4] updates for hns3 PMD driver Wei Hu (Xavier)
2020-07-14  6:16     ` [dpdk-dev] [PATCH v3 1/4] net/hns3: support copper media type Wei Hu (Xavier)
2020-07-14  6:16     ` Wei Hu (Xavier) [this message]
2020-07-14  6:16     ` [dpdk-dev] [PATCH v3 3/4] net/hns3: support keeping CRC Wei Hu (Xavier)
2020-07-14  6:16     ` [dpdk-dev] [PATCH v3 4/4] net/hns3: fix RSS configuration when empty RSS type Wei Hu (Xavier)
2020-07-14 11:07     ` [dpdk-dev] [PATCH v3 0/4] updates for hns3 PMD driver Ferruh Yigit
2020-07-11 10:18 ` [dpdk-dev] [PATCH v2 2/4] net/hns3: support 200G speed rate Wei Hu (Xavier)
2020-07-11 10:18 ` [dpdk-dev] [PATCH v2 3/4] net/hns3: support keeping CRC Wei Hu (Xavier)
2020-07-11 10:18 ` [dpdk-dev] [PATCH v2 4/4] net/hns3: fix RSS configuration when empty RSS type Wei Hu (Xavier)

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=1594707369-36270-3-git-send-email-xavier.huwei@huawei.com \
    --to=xavier.huwei@huawei.com \
    --cc=dev@dpdk.org \
    /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 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).