From 7e5197e80d5d5f2cb8941b00b4793969f703a4c9 Mon Sep 17 00:00:00 2001 From: Dengdui Huang Date: Fri, 22 Mar 2024 17:48:56 +0800 Subject: [PATCH] sync some patch from upstreaming Sync some patches for hns3 about PFC and RSS - net/hns3: support new device - app/testpmd: fix RSS algorithm choice - net/hns3: enable PFC for all user priorities Signed-off-by: Dengdui Huang (cherry picked from commit d4966134474f40a98ddbdab4c281ef20bcc1e691) --- ...3-enable-PFC-for-all-user-priorities.patch | 54 +++++++++++++ ...app-testpmd-fix-RSS-algorithm-choice.patch | 35 ++++++++ 0035-net-hns3-support-new-device.patch | 79 +++++++++++++++++++ dpdk.spec | 12 ++- 4 files changed, 179 insertions(+), 1 deletion(-) create mode 100644 0033-net-hns3-enable-PFC-for-all-user-priorities.patch create mode 100644 0034-app-testpmd-fix-RSS-algorithm-choice.patch create mode 100644 0035-net-hns3-support-new-device.patch diff --git a/0033-net-hns3-enable-PFC-for-all-user-priorities.patch b/0033-net-hns3-enable-PFC-for-all-user-priorities.patch new file mode 100644 index 0000000..d6e4558 --- /dev/null +++ b/0033-net-hns3-enable-PFC-for-all-user-priorities.patch @@ -0,0 +1,54 @@ +From e74722646fa7b51d82812be26e8ae24a5010f9da Mon Sep 17 00:00:00 2001 +From: Jie Hai +Date: Wed, 6 Mar 2024 17:20:47 +0800 +Subject: [PATCH 31/33] net/hns3: enable PFC for all user priorities + +[ upstream commit aae6989df36c105b917cf69975c075dfde2e6b84 ] + +When user set TC number to 4 and enable PFC and ETS by dev_configure, +driver only enable user priority 0-3. +The packet with user priority 4-7 cannot trigger PFC frame. + +Fix by enabling PFC for all user priorities. + +By the way, the nb_tcs from user can never be 0 because of the ahead +check in driver. So remove this redundant code. + +Fixes: 62e3ccc2b94c ("net/hns3: support flow control") +Cc: stable@dpdk.org + +Signed-off-by: Jie Hai +--- + drivers/net/hns3/hns3_dcb.c | 9 ++------- + 1 file changed, 2 insertions(+), 7 deletions(-) + +diff --git a/drivers/net/hns3/hns3_dcb.c b/drivers/net/hns3/hns3_dcb.c +index 2831d3d..915e4eb 100644 +--- a/drivers/net/hns3/hns3_dcb.c ++++ b/drivers/net/hns3/hns3_dcb.c +@@ -1499,7 +1499,6 @@ hns3_dcb_info_update(struct hns3_adapter *hns, uint8_t num_tc) + static int + hns3_dcb_hw_configure(struct hns3_adapter *hns) + { +- struct rte_eth_dcb_rx_conf *dcb_rx_conf; + struct hns3_pf *pf = &hns->pf; + struct hns3_hw *hw = &hns->hw; + enum hns3_fc_status fc_status = hw->current_fc_status; +@@ -1519,12 +1518,8 @@ hns3_dcb_hw_configure(struct hns3_adapter *hns) + } + + if (hw->data->dev_conf.dcb_capability_en & RTE_ETH_DCB_PFC_SUPPORT) { +- dcb_rx_conf = &hw->data->dev_conf.rx_adv_conf.dcb_rx_conf; +- if (dcb_rx_conf->nb_tcs == 0) +- hw->dcb_info.pfc_en = 1; /* tc0 only */ +- else +- hw->dcb_info.pfc_en = +- RTE_LEN2MASK((uint8_t)dcb_rx_conf->nb_tcs, uint8_t); ++ hw->dcb_info.pfc_en = ++ RTE_LEN2MASK((uint8_t)HNS3_MAX_USER_PRIO, uint8_t); + + hw->dcb_info.hw_pfc_map = + hns3_dcb_undrop_tc_map(hw, hw->dcb_info.pfc_en); +-- +2.33.0 + diff --git a/0034-app-testpmd-fix-RSS-algorithm-choice.patch b/0034-app-testpmd-fix-RSS-algorithm-choice.patch new file mode 100644 index 0000000..ad47852 --- /dev/null +++ b/0034-app-testpmd-fix-RSS-algorithm-choice.patch @@ -0,0 +1,35 @@ +From 7934d8f5a33d2d8146ca429d33dabf3806c87c2d Mon Sep 17 00:00:00 2001 +From: Jie Hai +Date: Fri, 15 Mar 2024 11:00:53 +0800 +Subject: [PATCH 32/33] app/testpmd: fix RSS algorithm choice + +[ upstream commit 74345424a92f14acc608b36b09cb27b84e3a35aa ] + +The RSS algorithm from user is parsed but not passed to the +rte_eth_dev_rss_hash_update() API as we wanted, this patch +fixes it. + +Fixes: 3da59f30a23f ("app/testpmd: set RSS hash algorithm") +Cc: stable@dpdk.org + +Signed-off-by: Jie Hai +Reviewed-by: Ferruh Yigit +--- + app/test-pmd/cmdline.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c +index f704319..8ef116c 100644 +--- a/app/test-pmd/cmdline.c ++++ b/app/test-pmd/cmdline.c +@@ -2316,6 +2316,7 @@ cmd_config_rss_hash_algo_parsed(void *parsed_result, + return; + } + ++ rss_conf.algorithm = algorithm; + ret = rte_eth_dev_rss_hash_update(res->port_id, &rss_conf); + if (ret != 0) { + fprintf(stderr, "failed to set port %u RSS hash algorithm\n", +-- +2.33.0 + diff --git a/0035-net-hns3-support-new-device.patch b/0035-net-hns3-support-new-device.patch new file mode 100644 index 0000000..d3a04bf --- /dev/null +++ b/0035-net-hns3-support-new-device.patch @@ -0,0 +1,79 @@ +From dbf7316d5041c189e2b10fafc9b4e70ef81fa78b Mon Sep 17 00:00:00 2001 +From: Jie Hai +Date: Fri, 15 Mar 2024 10:54:48 +0800 +Subject: [PATCH 33/33] net/hns3: support new device + +[ upstream commit 3f1436d7006c2659232305ef2b8b186796319041 ] + +This patch introduces the new devices, which are on-chip network +interface controllers with RDMA/DCB/ROH supporting. One is 100GE +and the other is 200GE. Both can be found on HIP09/HIP10 SoCs. + +Cc: stable@dpdk.org + +Signed-off-by: Jie Hai +--- + doc/guides/nics/hns3.rst | 2 +- + drivers/net/hns3/hns3_cmd.c | 4 +++- + drivers/net/hns3/hns3_ethdev.c | 2 ++ + drivers/net/hns3/hns3_ethdev.h | 2 ++ + 4 files changed, 8 insertions(+), 2 deletions(-) + +diff --git a/doc/guides/nics/hns3.rst b/doc/guides/nics/hns3.rst +index 3b0613f..3e84d1f 100644 +--- a/doc/guides/nics/hns3.rst ++++ b/doc/guides/nics/hns3.rst +@@ -6,7 +6,7 @@ HNS3 Poll Mode Driver + + The hns3 PMD (**librte_net_hns3**) provides poll mode driver support + for the inbuilt HiSilicon Network Subsystem(HNS) network engine +-found in the HiSilicon Kunpeng 920 SoC and Kunpeng 930 SoC . ++found in the HiSilicon Kunpeng 920 SoC (HIP08) and Kunpeng 930 SoC (HIP09/HIP10). + + Features + -------- +diff --git a/drivers/net/hns3/hns3_cmd.c b/drivers/net/hns3/hns3_cmd.c +index 2c16644..001ff49 100644 +--- a/drivers/net/hns3/hns3_cmd.c ++++ b/drivers/net/hns3/hns3_cmd.c +@@ -545,7 +545,9 @@ hns3_set_dcb_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_200G_RDMA) ++ device_id == HNS3_DEV_ID_200G_RDMA || ++ device_id == HNS3_DEV_ID_100G_ROH || ++ device_id == HNS3_DEV_ID_200G_ROH) + hns3_set_bit(hw->capability, HNS3_DEV_SUPPORT_DCB_B, 1); + } + +diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c +index b10d121..9730b9a 100644 +--- a/drivers/net/hns3/hns3_ethdev.c ++++ b/drivers/net/hns3/hns3_ethdev.c +@@ -6649,6 +6649,8 @@ static const struct rte_pci_id pci_id_hns3_map[] = { + { 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) }, ++ { RTE_PCI_DEVICE(PCI_VENDOR_ID_HUAWEI, HNS3_DEV_ID_100G_ROH) }, ++ { RTE_PCI_DEVICE(PCI_VENDOR_ID_HUAWEI, HNS3_DEV_ID_200G_ROH) }, + { .vendor_id = 0, }, /* sentinel */ + }; + +diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h +index 12d8299..e70c5ff 100644 +--- a/drivers/net/hns3/hns3_ethdev.h ++++ b/drivers/net/hns3/hns3_ethdev.h +@@ -28,7 +28,9 @@ + #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_100G_ROH 0xA227 + #define HNS3_DEV_ID_200G_RDMA 0xA228 ++#define HNS3_DEV_ID_200G_ROH 0xA22C + #define HNS3_DEV_ID_100G_VF 0xA22E + #define HNS3_DEV_ID_100G_RDMA_PFC_VF 0xA22F + +-- +2.33.0 + diff --git a/dpdk.spec b/dpdk.spec index ed6f1f0..48679fc 100644 --- a/dpdk.spec +++ b/dpdk.spec @@ -10,7 +10,7 @@ Name: dpdk Version: 23.11 -Release: 9 +Release: 10 URL: http://dpdk.org Source: https://fast.dpdk.org/rel/dpdk-%{version}.tar.xz @@ -53,6 +53,10 @@ Patch9013: 0031-add-rte_eth_bond_link_monitoring_get-in-map.patch Patch9032: 0032-ethdev-fix-strict-aliasing-lead-to-link-cannot-be-up.patch +Patch6033: 0033-net-hns3-enable-PFC-for-all-user-priorities.patch +Patch6034: 0034-app-testpmd-fix-RSS-algorithm-choice.patch +Patch6035: 0035-net-hns3-support-new-device.patch + BuildRequires: meson BuildRequires: python3-pyelftools BuildRequires: diffutils @@ -219,6 +223,12 @@ strip -g $RPM_BUILD_ROOT/lib/modules/%{kern_devel_ver}/extra/dpdk/igb_uio.ko %endif %changelog +* Fri Apr 12 2024 huangdengdui - 23.11-10 + Sync some patches for hns3 about PFC and RSS + - net/hns3: support new device + - app/testpmd: fix RSS algorithm choice + - net/hns3: enable PFC for all user priorities + * Fri Apr 12 2024 huangdengdui - 23.11-9 fix strict aliasing lead to link cannot be up