From 35e5a9a419746351c8ebe6a1d41dbcfbc3731ff5 Mon Sep 17 00:00:00 2001 From: chenyi Date: Mon, 5 Aug 2024 14:57:27 +0800 Subject: [PATCH] sync some patch from upstream about bugfix Sync some patch from upstream about bugfix, modifies are as follow: - net/hns3: check Rx DMA address alignmnent --- ...hns3-check-Rx-DMA-address-alignmnent.patch | 144 ++++++++++++++++++ dpdk.spec | 13 +- 2 files changed, 153 insertions(+), 4 deletions(-) create mode 100644 0434-net-hns3-check-Rx-DMA-address-alignmnent.patch diff --git a/0434-net-hns3-check-Rx-DMA-address-alignmnent.patch b/0434-net-hns3-check-Rx-DMA-address-alignmnent.patch new file mode 100644 index 0000000..ba8f8a7 --- /dev/null +++ b/0434-net-hns3-check-Rx-DMA-address-alignmnent.patch @@ -0,0 +1,144 @@ +From 06fda40b1c8ded9516caac092fbf9c0a3aa81cf5 Mon Sep 17 00:00:00 2001 +From: Chengwen Feng +Date: Mon, 15 Jul 2024 10:04:39 +0800 +Subject: [PATCH] net/hns3: check Rx DMA address alignmnent + +[ upstream commit d14c995b775a9b5910c51c3ab3685b320736f3f6 ] + +The network engine has Rx DMA address align requirement, if this +requirement is violated, the Rx function will be abnormal. The detail +requirement is: +1) For HIP08 platform, require 64-bytes alignment. +2) For later platform, require 128-bytes alignment. + +The setup Rx DMA address exists both on the control and data plane, to +ensure performance, the alignment check is added only on the control +plane. + +Fixes: bba636698316 ("net/hns3: support Rx/Tx and related operations") +Cc: stable@dpdk.org + +Signed-off-by: Chengwen Feng +Signed-off-by: Jie Hai +Signed-off-by: chenyi +--- + drivers/net/hns3/hns3_ethdev.c | 2 ++ + drivers/net/hns3/hns3_ethdev.h | 8 ++++++++ + drivers/net/hns3/hns3_ethdev_vf.c | 2 ++ + drivers/net/hns3/hns3_rxtx.c | 21 +++++++++++++++++++++ + 4 files changed, 33 insertions(+) + +diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c +index 325e745797..4d554a4cdb 100644 +--- a/drivers/net/hns3/hns3_ethdev.c ++++ b/drivers/net/hns3/hns3_ethdev.c +@@ -2738,6 +2738,7 @@ hns3_get_capability(struct hns3_hw *hw) + hw->rss_info.ipv6_sctp_offload_supported = false; + hw->udp_cksum_mode = HNS3_SPECIAL_PORT_SW_CKSUM_MODE; + pf->support_multi_tc_pause = false; ++ hw->rx_dma_addr_align = HNS3_RX_DMA_ADDR_ALIGN_64; + return 0; + } + +@@ -2758,6 +2759,7 @@ hns3_get_capability(struct hns3_hw *hw) + hw->rss_info.ipv6_sctp_offload_supported = true; + hw->udp_cksum_mode = HNS3_SPECIAL_PORT_HW_CKSUM_MODE; + pf->support_multi_tc_pause = true; ++ hw->rx_dma_addr_align = HNS3_RX_DMA_ADDR_ALIGN_128; + + return 0; + } +diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h +index e70c5fff2a..c190d5109b 100644 +--- a/drivers/net/hns3/hns3_ethdev.h ++++ b/drivers/net/hns3/hns3_ethdev.h +@@ -487,6 +487,9 @@ struct hns3_queue_intr { + #define HNS3_PKTS_DROP_STATS_MODE1 0 + #define HNS3_PKTS_DROP_STATS_MODE2 1 + ++#define HNS3_RX_DMA_ADDR_ALIGN_128 128 ++#define HNS3_RX_DMA_ADDR_ALIGN_64 64 ++ + struct hns3_hw { + struct rte_eth_dev_data *data; + void *io_base; +@@ -554,6 +557,11 @@ struct hns3_hw { + * direction. + */ + uint8_t min_tx_pkt_len; ++ /* ++ * The required alignment of the DMA address of the RX buffer. ++ * See HNS3_RX_DMA_ADDR_ALIGN_XXX for available values. ++ */ ++ uint16_t rx_dma_addr_align; + + struct hns3_queue_intr intr; + /* +diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c +index a6f0d77104..d3efa5a4e5 100644 +--- a/drivers/net/hns3/hns3_ethdev_vf.c ++++ b/drivers/net/hns3/hns3_ethdev_vf.c +@@ -788,6 +788,7 @@ hns3vf_get_capability(struct hns3_hw *hw) + hw->min_tx_pkt_len = HNS3_HIP08_MIN_TX_PKT_LEN; + hw->rss_info.ipv6_sctp_offload_supported = false; + hw->promisc_mode = HNS3_UNLIMIT_PROMISC_MODE; ++ hw->rx_dma_addr_align = HNS3_RX_DMA_ADDR_ALIGN_64; + return 0; + } + +@@ -805,6 +806,7 @@ hns3vf_get_capability(struct hns3_hw *hw) + hw->drop_stats_mode = HNS3_PKTS_DROP_STATS_MODE2; + hw->rss_info.ipv6_sctp_offload_supported = true; + hw->promisc_mode = HNS3_LIMIT_PROMISC_MODE; ++ hw->rx_dma_addr_align = HNS3_RX_DMA_ADDR_ALIGN_128; + + return 0; + } +diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c +index 5cf2b3af33..62d1f87391 100644 +--- a/drivers/net/hns3/hns3_rxtx.c ++++ b/drivers/net/hns3/hns3_rxtx.c +@@ -273,12 +273,27 @@ hns3_free_all_queues(struct rte_eth_dev *dev) + hns3_free_tx_queues(dev); + } + ++static int ++hns3_check_rx_dma_addr(struct hns3_hw *hw, uint64_t dma_addr) ++{ ++ uint64_t rem; ++ ++ rem = dma_addr & (hw->rx_dma_addr_align - 1); ++ if (rem > 0) { ++ hns3_err(hw, "The IO address of the beginning of the mbuf data " ++ "must be %u-byte aligned", hw->rx_dma_addr_align); ++ return -EINVAL; ++ } ++ return 0; ++} ++ + static int + hns3_alloc_rx_queue_mbufs(struct hns3_hw *hw, struct hns3_rx_queue *rxq) + { + struct rte_mbuf *mbuf; + uint64_t dma_addr; + uint16_t i; ++ int ret; + + for (i = 0; i < rxq->nb_rx_desc; i++) { + mbuf = rte_mbuf_raw_alloc(rxq->mb_pool); +@@ -299,6 +314,12 @@ hns3_alloc_rx_queue_mbufs(struct hns3_hw *hw, struct hns3_rx_queue *rxq) + dma_addr = rte_cpu_to_le_64(rte_mbuf_data_iova_default(mbuf)); + rxq->rx_ring[i].addr = dma_addr; + rxq->rx_ring[i].rx.bd_base_info = 0; ++ ++ ret = hns3_check_rx_dma_addr(hw, dma_addr); ++ if (ret != 0) { ++ hns3_rx_queue_release_mbufs(rxq); ++ return ret; ++ } + } + + return 0; +-- +2.33.0 + diff --git a/dpdk.spec b/dpdk.spec index fb41c3f..2193c96 100644 --- a/dpdk.spec +++ b/dpdk.spec @@ -1,6 +1,6 @@ Name: dpdk Version: 21.11 -Release: 69 +Release: 70 Packager: packaging@6wind.com URL: http://dpdk.org %global source_version 21.11 @@ -466,7 +466,8 @@ Patch6429: 0430-app-testpmd-fix-crash-in-multi-process-forwarding.patch Patch6430: 0431-dma-hisilicon-remove-support-for-HIP09-platform.patch Patch6431: 0432-net-hns3-support-new-device.patch -patch6432: 0433-fix-mode4-with-dedicated-queues.patch +Patch6432: 0433-fix-mode4-with-dedicated-queues.patch +Patch6433: 0434-net-hns3-check-Rx-DMA-address-alignmnent.patch patch6434: 0434-net-af_xdp-fix-build-with-Wunused-function.patch patch6435: 0435-net-af_xdp-use-libxdp-if-available.patch @@ -511,7 +512,6 @@ patch6476: 0476-net-af_xdp-parse-UMEM-map-info-from-mempool.patch patch6477: 0477-ethdev-move-driver-interface-functions-to-its-own-fi.patch patch6478: 0478-adapt-libbpf-0.8.0.patch - Summary: Data Plane Development Kit core Group: System Environment/Libraries License: BSD and LGPLv2 and GPLv2 @@ -669,7 +669,7 @@ strip -g $RPM_BUILD_ROOT/lib/modules/%{kern_devel_ver}/extra/dpdk/igb_uio.ko /usr/sbin/depmod %changelog -* Fri Sep 6 2024 hankangknag - 21.11-69 +* Fri Sep 6 2024 hankangknag - 21.11-70 Sync some patches from upstream about bugfix, modifies are as follow: - net/af_xdp: parse UMEM map info from mempool - bpf: disable on 32-bit x86 @@ -710,6 +710,11 @@ strip -g $RPM_BUILD_ROOT/lib/modules/%{kern_devel_ver}/extra/dpdk/igb_uio.ko - net/af_xdp: use libxdp if available - net/af_xdp: fix build with -Wunused-function +* Tue Aug 13 2024 chenyi - 21.11-69 + Sync some patches from upstream about bugfix, modifies + are as follow: + - net/hns3: check Rx DMA address alignmnent + * Thu Jul 11 2024 hankangknag - 21.11-68 Sync some patches from upstream about bugfix, modifies are as follow: -- Gitee