Hi, FYI, your patch has been queued to stable release 21.11.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/15/22. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/d8898f07630888dc4ae7979204193d0759d89490 Thanks. Kevin --- From d8898f07630888dc4ae7979204193d0759d89490 Mon Sep 17 00:00:00 2001 From: David Marchand <david.marchand@redhat.com> Date: Tue, 5 Apr 2022 15:48:58 +0200 Subject: [PATCH] eal/windows: add missing C++ include guards [ upstream commit 1e230b9be8866939ef7ce9f7f16b8c8369b7bc28 ] Add missing 'extern "C"' to file. Fixes: 1db72630da0c ("eal/windows: do not expose private facilities") Signed-off-by: David Marchand <david.marchand@redhat.com> Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com> --- lib/eal/windows/include/rte_windows.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/eal/windows/include/rte_windows.h b/lib/eal/windows/include/rte_windows.h index 0063b5d78c..83730c3d2e 100644 --- a/lib/eal/windows/include/rte_windows.h +++ b/lib/eal/windows/include/rte_windows.h @@ -6,4 +6,8 @@ #define _RTE_WINDOWS_H_ +#ifdef __cplusplus +extern "C" { +#endif + /** * @file Windows-specific facilities @@ -49,3 +53,7 @@ RTE_FMT_TAIL(__VA_ARGS__,))) +#ifdef __cplusplus +} +#endif + #endif /* _RTE_WINDOWS_H_ */ -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-05-10 13:24:21.650533573 +0100 +++ 0001-eal-windows-add-missing-C-include-guards.patch 2022-05-10 13:24:21.547646287 +0100 @@ -1 +1 @@ -From 1e230b9be8866939ef7ce9f7f16b8c8369b7bc28 Mon Sep 17 00:00:00 2001 +From d8898f07630888dc4ae7979204193d0759d89490 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 1e230b9be8866939ef7ce9f7f16b8c8369b7bc28 ] + @@ -9 +10,0 @@ -Cc: stable@dpdk.org
Hi, FYI, your patch has been queued to stable release 21.11.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/15/22. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/9c267cbd10950651dee13efe1280830b2c2bd7f8 Thanks. Kevin --- From 9c267cbd10950651dee13efe1280830b2c2bd7f8 Mon Sep 17 00:00:00 2001 From: Tianli Lai <laitianli@tom.com> Date: Wed, 30 Mar 2022 06:01:07 +0800 Subject: [PATCH] net/dpaa2: fix dpdmux default interface [ upstream commit 0b5da8cc52b3b4be9046ef1eabe2381d5566a8f8 ] if dpdmux objects created by restool tools with the argument "--default-if=<if-id-number>", this function would change it to 1 Fixes: 1def64c2d79e ("net/dpaa2: add dpdmux initialization and configuration") Signed-off-by: Tianli Lai <laitianli@tom.com> Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com> --- drivers/net/dpaa2/dpaa2_mux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/dpaa2/dpaa2_mux.c b/drivers/net/dpaa2/dpaa2_mux.c index cd2f7b8aa5..54f53b7ea0 100644 --- a/drivers/net/dpaa2/dpaa2_mux.c +++ b/drivers/net/dpaa2/dpaa2_mux.c @@ -297,5 +297,5 @@ dpaa2_create_dpdmux_device(int vdev_fd __rte_unused, ret = dpdmux_if_set_default(&dpdmux_dev->dpdmux, CMD_PRI_LOW, - dpdmux_dev->token, 1); + dpdmux_dev->token, attr.default_if); if (ret) { DPAA2_PMD_ERR("setting default interface failed in %s", -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-05-10 13:24:21.669924613 +0100 +++ 0002-net-dpaa2-fix-dpdmux-default-interface.patch 2022-05-10 13:24:21.548646288 +0100 @@ -1 +1 @@ -From 0b5da8cc52b3b4be9046ef1eabe2381d5566a8f8 Mon Sep 17 00:00:00 2001 +From 9c267cbd10950651dee13efe1280830b2c2bd7f8 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 0b5da8cc52b3b4be9046ef1eabe2381d5566a8f8 ] + @@ -11 +12,0 @@ -Cc: stable@dpdk.org @@ -20 +21 @@ -index bd4596b891..e8689a7832 100644 +index cd2f7b8aa5..54f53b7ea0 100644
Hi, FYI, your patch has been queued to stable release 21.11.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/15/22. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/6da5f268db91b8de98626486c84547410ba0fd22 Thanks. Kevin --- From 6da5f268db91b8de98626486c84547410ba0fd22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20R=C3=B6nnblom?= <mattias.ronnblom@ericsson.com> Date: Mon, 11 Apr 2022 17:15:59 +0200 Subject: [PATCH] examples/bond: fix invalid use of trylock MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [ upstream commit 03382cf4115019e6a82d6fca51a16a34a0824a90 ] The conditional rte_spinlock_trylock() was used as if it is an unconditional lock operation in a number of places. Fixes: cc7e8ae84faa ("examples/bond: add example application for link bonding mode 6") Signed-off-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com> Acked-by: Bruce Richardson <bruce.richardson@intel.com> Acked-by: Min Hu (Connor) <humin29@huawei.com> Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com> --- examples/bond/main.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/examples/bond/main.c b/examples/bond/main.c index 335bde5c8d..4efebb3902 100644 --- a/examples/bond/main.c +++ b/examples/bond/main.c @@ -374,5 +374,5 @@ static int lcore_main(__rte_unused void *arg1) (BOND_IP_3 << 16) | (BOND_IP_4 << 24); - rte_spinlock_trylock(&global_flag_stru_p->lock); + rte_spinlock_lock(&global_flag_stru_p->lock); while (global_flag_stru_p->LcoreMainIsRunning) { @@ -457,5 +457,5 @@ static int lcore_main(__rte_unused void *arg1) rte_pktmbuf_free(pkts[i]); } - rte_spinlock_trylock(&global_flag_stru_p->lock); + rte_spinlock_lock(&global_flag_stru_p->lock); } rte_spinlock_unlock(&global_flag_stru_p->lock); @@ -572,5 +572,5 @@ static void cmd_start_parsed(__rte_unused void *parsed_result, int worker_core_id = rte_lcore_id(); - rte_spinlock_trylock(&global_flag_stru_p->lock); + rte_spinlock_lock(&global_flag_stru_p->lock); if (global_flag_stru_p->LcoreMainIsRunning == 0) { if (rte_eal_get_lcore_state(global_flag_stru_p->LcoreMainCore) @@ -592,5 +592,5 @@ static void cmd_start_parsed(__rte_unused void *parsed_result, return; - rte_spinlock_trylock(&global_flag_stru_p->lock); + rte_spinlock_lock(&global_flag_stru_p->lock); global_flag_stru_p->LcoreMainIsRunning = 1; rte_spinlock_unlock(&global_flag_stru_p->lock); @@ -660,5 +660,5 @@ static void cmd_stop_parsed(__rte_unused void *parsed_result, __rte_unused void *data) { - rte_spinlock_trylock(&global_flag_stru_p->lock); + rte_spinlock_lock(&global_flag_stru_p->lock); if (global_flag_stru_p->LcoreMainIsRunning == 0) { cmdline_printf(cl, @@ -701,5 +701,5 @@ static void cmd_quit_parsed(__rte_unused void *parsed_result, __rte_unused void *data) { - rte_spinlock_trylock(&global_flag_stru_p->lock); + rte_spinlock_lock(&global_flag_stru_p->lock); if (global_flag_stru_p->LcoreMainIsRunning == 0) { cmdline_printf(cl, @@ -763,5 +763,5 @@ static void cmd_show_parsed(__rte_unused void *parsed_result, } - rte_spinlock_trylock(&global_flag_stru_p->lock); + rte_spinlock_lock(&global_flag_stru_p->lock); cmdline_printf(cl, "Active_slaves:%d " -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-05-10 13:24:21.689693753 +0100 +++ 0003-examples-bond-fix-invalid-use-of-trylock.patch 2022-05-10 13:24:21.549646290 +0100 @@ -1 +1 @@ -From 03382cf4115019e6a82d6fca51a16a34a0824a90 Mon Sep 17 00:00:00 2001 +From 6da5f268db91b8de98626486c84547410ba0fd22 Mon Sep 17 00:00:00 2001 @@ -8,0 +9,2 @@ +[ upstream commit 03382cf4115019e6a82d6fca51a16a34a0824a90 ] + @@ -13 +14,0 @@ -Cc: stable@dpdk.org
Hi, FYI, your patch has been queued to stable release 21.11.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/15/22. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/a25197930d58fc754bd9c91d55db31d521ddcb5f Thanks. Kevin --- From a25197930d58fc754bd9c91d55db31d521ddcb5f Mon Sep 17 00:00:00 2001 From: Tyler Retzlaff <roretzla@linux.microsoft.com> Date: Tue, 22 Mar 2022 00:12:35 -0700 Subject: [PATCH] test/bpf: skip test if libpcap is unavailable [ upstream commit 55ae8965bf8eecd5ebec36663bb0f36018abf64b ] test_bpf_convert is being conditionally registered depending on the presence of RTE_HAS_LIBPCAP except the UT unconditionally lists it as a test to run. When the UT runs test_bpf_convert test-dpdk can't find the registration and assumes the DPDK_TEST environment variable hasn't been defined resulting in test-dpdk dropping to interactive mode and subsequently waiting for the remainder of the UT fast-test timeout period before reporting the test as having timed out. * unconditionally register test_bpf_convert, * if ! RTE_HAS_LIBPCAP provide a stub test_bpf_convert that reports the test is skipped similar to that done with the test_bpf test. Fixes: 2eccf6afbea9 ("bpf: add function to convert classic BPF to DPDK BPF") Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com> Acked-by: Stephen Hemminger <stephen@networkplumber.org> Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com> --- app/test/test_bpf.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/app/test/test_bpf.c b/app/test/test_bpf.c index c422fedf1f..d70bb0fe85 100644 --- a/app/test/test_bpf.c +++ b/app/test/test_bpf.c @@ -3251,5 +3251,14 @@ test_bpf(void) REGISTER_TEST_COMMAND(bpf_autotest, test_bpf); -#ifdef RTE_HAS_LIBPCAP +#ifndef RTE_HAS_LIBPCAP + +static int +test_bpf_convert(void) +{ + printf("BPF convert RTE_HAS_LIBPCAP is undefined, skipping test\n"); + return TEST_SKIPPED; +} + +#else #include <pcap/pcap.h> @@ -3449,4 +3458,5 @@ test_bpf_convert(void) } -REGISTER_TEST_COMMAND(bpf_convert_autotest, test_bpf_convert); #endif /* RTE_HAS_LIBPCAP */ + +REGISTER_TEST_COMMAND(bpf_convert_autotest, test_bpf_convert); -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-05-10 13:24:21.709057716 +0100 +++ 0004-test-bpf-skip-test-if-libpcap-is-unavailable.patch 2022-05-10 13:24:21.551646292 +0100 @@ -1 +1 @@ -From 55ae8965bf8eecd5ebec36663bb0f36018abf64b Mon Sep 17 00:00:00 2001 +From a25197930d58fc754bd9c91d55db31d521ddcb5f Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 55ae8965bf8eecd5ebec36663bb0f36018abf64b ] + @@ -21 +22,0 @@ -Cc: stable@dpdk.org @@ -31 +32 @@ -index 805cce6406..97f500809e 100644 +index c422fedf1f..d70bb0fe85 100644 @@ -34 +35 @@ -@@ -3265,5 +3265,14 @@ test_bpf(void) +@@ -3251,5 +3251,14 @@ test_bpf(void) @@ -50 +51 @@ -@@ -3463,4 +3472,5 @@ test_bpf_convert(void) +@@ -3449,4 +3458,5 @@ test_bpf_convert(void)
Hi, FYI, your patch has been queued to stable release 21.11.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/15/22. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/8ae457cbf54dd2b29491c6dceaa941d292777d45 Thanks. Kevin --- From 8ae457cbf54dd2b29491c6dceaa941d292777d45 Mon Sep 17 00:00:00 2001 From: Wenjun Wu <wenjun1.wu@intel.com> Date: Mon, 28 Feb 2022 15:36:07 +0800 Subject: [PATCH] net/ice: improve performance of Rx timestamp offload [ upstream commit 5543827fc6df39eabd51e2ca81f4462c291ea8d9 ] Previously, each time a burst of packets is received, SW reads HW register and assembles it and the timestamp from descriptor together to get the complete 64 bits timestamp. This patch optimizes the algorithm. The SW only needs to check the monotonicity of the low 32bits timestamp to avoid crossing borders. Each time before SW receives a burst of packets, it should check the time difference between current time and last update time to avoid the low 32 bits timestamp cycling twice. The patch proved a 50% ~ 70% single core performance improvement on a main stream Xeon server, this fix the performance gap for some use cases. Fixes: f9c561ffbccc ("net/ice: fix performance for Rx timestamp") Signed-off-by: Wenjun Wu <wenjun1.wu@intel.com> Acked-by: Qi Zhang <qi.z.zhang@intel.com> --- drivers/net/ice/ice_ethdev.h | 3 + drivers/net/ice/ice_rxtx.c | 118 +++++++++++++++++++++++++---------- 2 files changed, 88 insertions(+), 33 deletions(-) diff --git a/drivers/net/ice/ice_ethdev.h b/drivers/net/ice/ice_ethdev.h index 1242177b42..c0d1baa1ec 100644 --- a/drivers/net/ice/ice_ethdev.h +++ b/drivers/net/ice/ice_ethdev.h @@ -530,4 +530,7 @@ struct ice_adapter { bool ptp_ena; uint64_t time_hw; + uint32_t hw_time_high; /* high 32 bits of timestamp */ + uint32_t hw_time_low; /* low 32 bits of timestamp */ + uint64_t hw_time_update; /* SW time of HW record updating */ struct ice_fdir_prof_info fdir_prof_info[ICE_MAX_PTGS]; struct ice_rss_prof_info rss_prof_info[ICE_MAX_PTGS]; diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c index 041f4bc91f..2dd2637fbb 100644 --- a/drivers/net/ice/ice_rxtx.c +++ b/drivers/net/ice/ice_rxtx.c @@ -1575,7 +1575,8 @@ ice_rx_scan_hw_ring(struct ice_rx_queue *rxq) uint32_t *ptype_tbl = rxq->vsi->adapter->ptype_tbl; #ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC + bool is_tsinit = false; + uint64_t ts_ns; struct ice_vsi *vsi = rxq->vsi; struct ice_hw *hw = ICE_VSI_TO_HW(vsi); - uint64_t ts_ns; struct ice_adapter *ad = rxq->vsi->adapter; #endif @@ -1589,6 +1590,12 @@ ice_rx_scan_hw_ring(struct ice_rx_queue *rxq) return 0; - if (rxq->offloads & RTE_ETH_RX_OFFLOAD_TIMESTAMP) - rxq->hw_register_set = 1; +#ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC + if (rxq->offloads & RTE_ETH_RX_OFFLOAD_TIMESTAMP) { + uint64_t sw_cur_time = rte_get_timer_cycles() / (rte_get_timer_hz() / 1000); + + if (unlikely(sw_cur_time - ad->hw_time_update > 4)) + is_tsinit = 1; + } +#endif /** @@ -1626,12 +1633,24 @@ ice_rx_scan_hw_ring(struct ice_rx_queue *rxq) #ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC if (ice_timestamp_dynflag > 0) { - ts_ns = ice_tstamp_convert_32b_64b(hw, ad, - rxq->hw_register_set, - rte_le_to_cpu_32(rxdp[j].wb.flex_ts.ts_high)); - rxq->hw_register_set = 0; + rxq->time_high = + rte_le_to_cpu_32(rxdp[j].wb.flex_ts.ts_high); + if (unlikely(is_tsinit)) { + ts_ns = ice_tstamp_convert_32b_64b(hw, ad, 1, + rxq->time_high); + ad->hw_time_low = (uint32_t)ts_ns; + ad->hw_time_high = (uint32_t)(ts_ns >> 32); + is_tsinit = false; + } else { + if (rxq->time_high < ad->hw_time_low) + ad->hw_time_high += 1; + ts_ns = (uint64_t)ad->hw_time_high << 32 | rxq->time_high; + ad->hw_time_low = rxq->time_high; + } + ad->hw_time_update = rte_get_timer_cycles() / + (rte_get_timer_hz() / 1000); *RTE_MBUF_DYNFIELD(mb, - ice_timestamp_dynfield_offset, - rte_mbuf_timestamp_t *) = ts_ns; - mb->ol_flags |= ice_timestamp_dynflag; + ice_timestamp_dynfield_offset, + rte_mbuf_timestamp_t *) = ts_ns; + pkt_flags |= ice_timestamp_dynflag; } @@ -1832,13 +1851,18 @@ ice_recv_scattered_pkts(void *rx_queue, uint32_t *ptype_tbl = rxq->vsi->adapter->ptype_tbl; #ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC + bool is_tsinit = false; + uint64_t ts_ns; struct ice_vsi *vsi = rxq->vsi; struct ice_hw *hw = ICE_VSI_TO_HW(vsi); - uint64_t ts_ns; struct ice_adapter *ad = rxq->vsi->adapter; + + if (rxq->offloads & RTE_ETH_RX_OFFLOAD_TIMESTAMP) { + uint64_t sw_cur_time = rte_get_timer_cycles() / (rte_get_timer_hz() / 1000); + + if (unlikely(sw_cur_time - ad->hw_time_update > 4)) + is_tsinit = true; + } #endif - if (rxq->offloads & RTE_ETH_RX_OFFLOAD_TIMESTAMP) - rxq->hw_register_set = 1; - while (nb_rx < nb_pkts) { rxdp = &rx_ring[rx_id]; @@ -1952,12 +1976,23 @@ ice_recv_scattered_pkts(void *rx_queue, #ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC if (ice_timestamp_dynflag > 0) { - ts_ns = ice_tstamp_convert_32b_64b(hw, ad, - rxq->hw_register_set, - rte_le_to_cpu_32(rxd.wb.flex_ts.ts_high)); - rxq->hw_register_set = 0; - *RTE_MBUF_DYNFIELD(first_seg, - ice_timestamp_dynfield_offset, - rte_mbuf_timestamp_t *) = ts_ns; - first_seg->ol_flags |= ice_timestamp_dynflag; + rxq->time_high = + rte_le_to_cpu_32(rxd.wb.flex_ts.ts_high); + if (unlikely(is_tsinit)) { + ts_ns = ice_tstamp_convert_32b_64b(hw, ad, 1, rxq->time_high); + ad->hw_time_low = (uint32_t)ts_ns; + ad->hw_time_high = (uint32_t)(ts_ns >> 32); + is_tsinit = false; + } else { + if (rxq->time_high < ad->hw_time_low) + ad->hw_time_high += 1; + ts_ns = (uint64_t)ad->hw_time_high << 32 | rxq->time_high; + ad->hw_time_low = rxq->time_high; + } + ad->hw_time_update = rte_get_timer_cycles() / + (rte_get_timer_hz() / 1000); + *RTE_MBUF_DYNFIELD(rxm, + (ice_timestamp_dynfield_offset), + rte_mbuf_timestamp_t *) = ts_ns; + pkt_flags |= ice_timestamp_dynflag; } @@ -2326,13 +2361,18 @@ ice_recv_pkts(void *rx_queue, uint32_t *ptype_tbl = rxq->vsi->adapter->ptype_tbl; #ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC + bool is_tsinit = false; + uint64_t ts_ns; struct ice_vsi *vsi = rxq->vsi; struct ice_hw *hw = ICE_VSI_TO_HW(vsi); - uint64_t ts_ns; struct ice_adapter *ad = rxq->vsi->adapter; + + if (rxq->offloads & RTE_ETH_RX_OFFLOAD_TIMESTAMP) { + uint64_t sw_cur_time = rte_get_timer_cycles() / (rte_get_timer_hz() / 1000); + + if (unlikely(sw_cur_time - ad->hw_time_update > 4)) + is_tsinit = 1; + } #endif - if (rxq->offloads & RTE_ETH_RX_OFFLOAD_TIMESTAMP) - rxq->hw_register_set = 1; - while (nb_rx < nb_pkts) { rxdp = &rx_ring[rx_id]; @@ -2387,12 +2427,23 @@ ice_recv_pkts(void *rx_queue, #ifndef RTE_LIBRTE_ICE_16BYTE_RX_DESC if (ice_timestamp_dynflag > 0) { - ts_ns = ice_tstamp_convert_32b_64b(hw, ad, - rxq->hw_register_set, - rte_le_to_cpu_32(rxd.wb.flex_ts.ts_high)); - rxq->hw_register_set = 0; + rxq->time_high = + rte_le_to_cpu_32(rxd.wb.flex_ts.ts_high); + if (unlikely(is_tsinit)) { + ts_ns = ice_tstamp_convert_32b_64b(hw, ad, 1, rxq->time_high); + ad->hw_time_low = (uint32_t)ts_ns; + ad->hw_time_high = (uint32_t)(ts_ns >> 32); + is_tsinit = false; + } else { + if (rxq->time_high < ad->hw_time_low) + ad->hw_time_high += 1; + ts_ns = (uint64_t)ad->hw_time_high << 32 | rxq->time_high; + ad->hw_time_low = rxq->time_high; + } + ad->hw_time_update = rte_get_timer_cycles() / + (rte_get_timer_hz() / 1000); *RTE_MBUF_DYNFIELD(rxm, - ice_timestamp_dynfield_offset, - rte_mbuf_timestamp_t *) = ts_ns; - rxm->ol_flags |= ice_timestamp_dynflag; + (ice_timestamp_dynfield_offset), + rte_mbuf_timestamp_t *) = ts_ns; + pkt_flags |= ice_timestamp_dynflag; } @@ -2409,4 +2460,5 @@ ice_recv_pkts(void *rx_queue, rx_pkts[nb_rx++] = rxm; } + rxq->rx_tail = rx_id; /** -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-05-10 13:24:21.730231744 +0100 +++ 0005-net-ice-improve-performance-of-Rx-timestamp-offload.patch 2022-05-10 13:24:21.555646297 +0100 @@ -1 +1 @@ -From 5543827fc6df39eabd51e2ca81f4462c291ea8d9 Mon Sep 17 00:00:00 2001 +From 8ae457cbf54dd2b29491c6dceaa941d292777d45 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 5543827fc6df39eabd51e2ca81f4462c291ea8d9 ] + @@ -20 +21,0 @@ -Cc: stable@dpdk.org @@ -30 +31 @@ -index 09cfb60b0f..3ab310628f 100644 +index 1242177b42..c0d1baa1ec 100644 @@ -33 +34 @@ -@@ -555,4 +555,7 @@ struct ice_adapter { +@@ -530,4 +530,7 @@ struct ice_adapter {
Hi, FYI, your patch has been queued to stable release 21.11.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/15/22. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/91355ad5b2cd9a61b63f6825884190a24c8e0b28 Thanks. Kevin --- From 91355ad5b2cd9a61b63f6825884190a24c8e0b28 Mon Sep 17 00:00:00 2001 From: Mike Pattrick <mkp@redhat.com> Date: Mon, 21 Mar 2022 23:19:37 -0400 Subject: [PATCH] net/i40e: populate error in flow director parser [ upstream commit 87063aaff3752470af21f3b80b257262d9d4a314 ] Errors from i40e_flow_parse_fdir_pattern() can bubble up to rte_flow_create. If rte_flow_error is not initialized a caller may dereference error->message. This may be uninitialized memory, leading to a segemntation fault. Fixes: 4a072ad43442 ("net/i40e: fix flow director config after flow validate") Signed-off-by: Mike Pattrick <mkp@redhat.com> Reviewed-by: David Marchand <david.marchand@redhat.com> --- drivers/net/i40e/i40e_flow.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c index e0cf996200..4f3808cb5f 100644 --- a/drivers/net/i40e/i40e_flow.c +++ b/drivers/net/i40e/i40e_flow.c @@ -3143,6 +3143,9 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev, if (i40e_validate_input_set(pctype, RTE_ETH_FILTER_FDIR, input_set) != 0) { - PMD_DRV_LOG(ERR, "Invalid input set"); - return -EINVAL; + rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ITEM, + item, + "Invalid input set"); + return -rte_errno; } -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-05-10 13:24:21.752294900 +0100 +++ 0006-net-i40e-populate-error-in-flow-director-parser.patch 2022-05-10 13:24:21.558646301 +0100 @@ -1 +1 @@ -From 87063aaff3752470af21f3b80b257262d9d4a314 Mon Sep 17 00:00:00 2001 +From 91355ad5b2cd9a61b63f6825884190a24c8e0b28 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 87063aaff3752470af21f3b80b257262d9d4a314 ] + @@ -12 +13,0 @@ -Cc: stable@dpdk.org
Hi, FYI, your patch has been queued to stable release 21.11.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/15/22. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/bb6683a89feda52605235c0f2fcb01d36072c83f Thanks. Kevin --- From bb6683a89feda52605235c0f2fcb01d36072c83f Mon Sep 17 00:00:00 2001 From: Michael Pfeiffer <michael.pfeiffer@tu-ilmenau.de> Date: Mon, 4 Apr 2022 16:41:44 +0200 Subject: [PATCH] net/ice: add missing Tx burst mode name [ upstream commit c415bfb2dd7b4c15a9f914102a2674ac0cb4bd3b ] The function ice_xmit_pkts_vec_avx2_offload was left out in the list of tx functions for ice_tx_burst_mode_get. Fixes: 52ccdcf2fd41 ("net/ice: add AVX2 offload Tx") Signed-off-by: Michael Pfeiffer <michael.pfeiffer@tu-ilmenau.de> Suggested-by: Michael Rossberg <michael.rossberg@tu-ilmenau.de> Acked-by: Qi Zhang <qi.z.zhang@intel.com> --- drivers/net/ice/ice_rxtx.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c index 2dd2637fbb..91cdc560f2 100644 --- a/drivers/net/ice/ice_rxtx.c +++ b/drivers/net/ice/ice_rxtx.c @@ -3605,6 +3605,7 @@ static const struct { { ice_xmit_pkts_vec_avx512_offload, "Offload Vector AVX512" }, #endif - { ice_xmit_pkts_vec_avx2, "Vector AVX2" }, - { ice_xmit_pkts_vec, "Vector SSE" }, + { ice_xmit_pkts_vec_avx2, "Vector AVX2" }, + { ice_xmit_pkts_vec_avx2_offload, "Offload Vector AVX2" }, + { ice_xmit_pkts_vec, "Vector SSE" }, #endif }; -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-05-10 13:24:21.774809678 +0100 +++ 0007-net-ice-add-missing-Tx-burst-mode-name.patch 2022-05-10 13:24:21.560646304 +0100 @@ -1 +1 @@ -From c415bfb2dd7b4c15a9f914102a2674ac0cb4bd3b Mon Sep 17 00:00:00 2001 +From bb6683a89feda52605235c0f2fcb01d36072c83f Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit c415bfb2dd7b4c15a9f914102a2674ac0cb4bd3b ] + @@ -10 +11,0 @@ -Cc: stable@dpdk.org
Hi, FYI, your patch has been queued to stable release 21.11.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/15/22. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/aedf24edbb04a77fe2fcde21967a47a2c306515e Thanks. Kevin --- From aedf24edbb04a77fe2fcde21967a47a2c306515e Mon Sep 17 00:00:00 2001 From: Qi Zhang <qi.z.zhang@intel.com> Date: Thu, 7 Apr 2022 12:06:14 -0400 Subject: [PATCH] net/ice: refactor parser usage [ upstream commit 531d2555c8a644030f1ee7d3c9edf1db9c35d6ef ] Not necessary to create / destroy a parser instance for every raw packet rule. A global parser instance will be created in ice_flow_init and be destroyed in ice_flow_uninit. Also, ice_dev_udp_tunnel_port_add has been hooked to perform corresponding parser configure. This also fix the issue that RSS engine can't support VXLAN inner through raw packet filter. Fixes: 1b9c68120a1c ("net/ice: enable protocol agnostic flow offloading in RSS") Signed-off-by: Qi Zhang <qi.z.zhang@intel.com> Acked-by: Xu Ting <ting.xu@intel.com> --- drivers/net/ice/ice_ethdev.c | 10 ++++++++++ drivers/net/ice/ice_ethdev.h | 1 + drivers/net/ice/ice_fdir_filter.c | 14 ++++---------- drivers/net/ice/ice_generic_flow.c | 8 ++++++++ drivers/net/ice/ice_hash.c | 9 ++++----- 5 files changed, 27 insertions(+), 15 deletions(-) diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index 2ae25b16f6..ab3976a319 100644 --- a/drivers/net/ice/ice_ethdev.c +++ b/drivers/net/ice/ice_ethdev.c @@ -5455,4 +5455,6 @@ ice_dev_udp_tunnel_port_add(struct rte_eth_dev *dev, int ret = 0; struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private); + struct ice_adapter *ad = + ICE_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private); if (udp_tunnel == NULL) @@ -5462,4 +5464,7 @@ ice_dev_udp_tunnel_port_add(struct rte_eth_dev *dev, case RTE_ETH_TUNNEL_TYPE_VXLAN: ret = ice_create_tunnel(hw, TNL_VXLAN, udp_tunnel->udp_port); + if (!ret && ad->psr != NULL) + ice_parser_vxlan_tunnel_set(ad->psr, + udp_tunnel->udp_port, true); break; default: @@ -5479,4 +5484,6 @@ ice_dev_udp_tunnel_port_del(struct rte_eth_dev *dev, int ret = 0; struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private); + struct ice_adapter *ad = + ICE_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private); if (udp_tunnel == NULL) @@ -5486,4 +5493,7 @@ ice_dev_udp_tunnel_port_del(struct rte_eth_dev *dev, case RTE_ETH_TUNNEL_TYPE_VXLAN: ret = ice_destroy_tunnel(hw, udp_tunnel->udp_port, 0); + if (!ret && ad->psr != NULL) + ice_parser_vxlan_tunnel_set(ad->psr, + udp_tunnel->udp_port, false); break; default: diff --git a/drivers/net/ice/ice_ethdev.h b/drivers/net/ice/ice_ethdev.h index c0d1baa1ec..56e53a6df3 100644 --- a/drivers/net/ice/ice_ethdev.h +++ b/drivers/net/ice/ice_ethdev.h @@ -537,4 +537,5 @@ struct ice_adapter { /* True if DCF state of the associated PF is on */ bool dcf_state_on; + struct ice_parser *psr; #ifdef RTE_ARCH_X86 bool rx_use_avx2; diff --git a/drivers/net/ice/ice_fdir_filter.c b/drivers/net/ice/ice_fdir_filter.c index ff1cee1195..99053978a9 100644 --- a/drivers/net/ice/ice_fdir_filter.c +++ b/drivers/net/ice/ice_fdir_filter.c @@ -1829,5 +1829,4 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, struct ice_fdir_v6 *p_v6 = NULL; struct ice_parser_result rslt; - struct ice_parser *psr; uint8_t item_num = 0; @@ -1864,4 +1863,7 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, switch (item_type) { case RTE_FLOW_ITEM_TYPE_RAW: { + if (ad->psr == NULL) + return -rte_errno; + raw_spec = item->spec; raw_mask = item->mask; @@ -1875,5 +1877,4 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, unsigned char *tmp_mask = (uint8_t *)(uintptr_t)raw_mask->pattern; - uint16_t udp_port = 0; uint16_t tmp_val = 0; uint8_t pkt_len = 0; @@ -1924,13 +1925,6 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, pkt_len /= 2; - if (ice_parser_create(&ad->hw, &psr)) + if (ice_parser_run(ad->psr, tmp_spec, pkt_len, &rslt)) return -rte_errno; - if (ice_get_open_tunnel_port(&ad->hw, TNL_VXLAN, - &udp_port)) - ice_parser_vxlan_tunnel_set(psr, udp_port, - true); - if (ice_parser_run(psr, tmp_spec, pkt_len, &rslt)) - return -rte_errno; - ice_parser_destroy(psr); if (!tmp_mask) diff --git a/drivers/net/ice/ice_generic_flow.c b/drivers/net/ice/ice_generic_flow.c index 406a0a953f..f9be3a5c94 100644 --- a/drivers/net/ice/ice_generic_flow.c +++ b/drivers/net/ice/ice_generic_flow.c @@ -1827,4 +1827,7 @@ ice_flow_init(struct ice_adapter *ad) rte_spinlock_init(&pf->flow_ops_lock); + if (ice_parser_create(&ad->hw, &ad->psr) != ICE_SUCCESS) + PMD_INIT_LOG(WARNING, "Failed to initialize DDP parser, raw packet filter will not be supported"); + RTE_TAILQ_FOREACH_SAFE(engine, &engine_list, node, temp) { if (engine->init == NULL) { @@ -1881,4 +1884,9 @@ ice_flow_uninit(struct ice_adapter *ad) rte_free(p_parser); } + + if (ad->psr != NULL) { + ice_parser_destroy(ad->psr); + ad->psr = NULL; + } } diff --git a/drivers/net/ice/ice_hash.c b/drivers/net/ice/ice_hash.c index afbb357fa3..f35727856e 100644 --- a/drivers/net/ice/ice_hash.c +++ b/drivers/net/ice/ice_hash.c @@ -654,5 +654,4 @@ ice_hash_parse_raw_pattern(struct ice_adapter *ad, struct ice_parser_profile prof; struct ice_parser_result rslt; - struct ice_parser *psr; uint8_t *pkt_buf, *msk_buf; uint8_t spec_len, pkt_len; @@ -661,4 +660,7 @@ ice_hash_parse_raw_pattern(struct ice_adapter *ad, int i, j; + if (ad->psr == NULL) + return -rte_errno; + raw_spec = item->spec; raw_mask = item->mask; @@ -714,9 +716,6 @@ ice_hash_parse_raw_pattern(struct ice_adapter *ad, } - if (ice_parser_create(&ad->hw, &psr)) + if (ice_parser_run(ad->psr, pkt_buf, pkt_len, &rslt)) return -rte_errno; - if (ice_parser_run(psr, pkt_buf, pkt_len, &rslt)) - return -rte_errno; - ice_parser_destroy(psr); if (ice_parser_profile_init(&rslt, pkt_buf, msk_buf, -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-05-10 13:24:21.796636308 +0100 +++ 0008-net-ice-refactor-parser-usage.patch 2022-05-10 13:24:21.569646315 +0100 @@ -1 +1 @@ -From 531d2555c8a644030f1ee7d3c9edf1db9c35d6ef Mon Sep 17 00:00:00 2001 +From aedf24edbb04a77fe2fcde21967a47a2c306515e Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 531d2555c8a644030f1ee7d3c9edf1db9c35d6ef ] + @@ -15 +16,0 @@ -Cc: stable@dpdk.org @@ -28 +29 @@ -index 73e550f5fb..8bb34b874b 100644 +index 2ae25b16f6..ab3976a319 100644 @@ -31 +32 @@ -@@ -5622,4 +5622,6 @@ ice_dev_udp_tunnel_port_add(struct rte_eth_dev *dev, +@@ -5455,4 +5455,6 @@ ice_dev_udp_tunnel_port_add(struct rte_eth_dev *dev, @@ -38 +39 @@ -@@ -5629,4 +5631,7 @@ ice_dev_udp_tunnel_port_add(struct rte_eth_dev *dev, +@@ -5462,4 +5464,7 @@ ice_dev_udp_tunnel_port_add(struct rte_eth_dev *dev, @@ -46 +47 @@ -@@ -5646,4 +5651,6 @@ ice_dev_udp_tunnel_port_del(struct rte_eth_dev *dev, +@@ -5479,4 +5484,6 @@ ice_dev_udp_tunnel_port_del(struct rte_eth_dev *dev, @@ -53 +54 @@ -@@ -5653,4 +5660,7 @@ ice_dev_udp_tunnel_port_del(struct rte_eth_dev *dev, +@@ -5486,4 +5493,7 @@ ice_dev_udp_tunnel_port_del(struct rte_eth_dev *dev, @@ -62 +63 @@ -index 3ab310628f..3d8427225f 100644 +index c0d1baa1ec..56e53a6df3 100644 @@ -65 +66 @@ -@@ -562,4 +562,5 @@ struct ice_adapter { +@@ -537,4 +537,5 @@ struct ice_adapter { @@ -72 +73 @@ -index 7954c6d8ea..0982478feb 100644 +index ff1cee1195..99053978a9 100644 @@ -75 +76 @@ -@@ -1827,5 +1827,4 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, +@@ -1829,5 +1829,4 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, @@ -81 +82 @@ -@@ -1862,4 +1861,7 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, +@@ -1864,4 +1863,7 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, @@ -89 +90 @@ -@@ -1873,5 +1875,4 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, +@@ -1875,5 +1877,4 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, @@ -95 +96 @@ -@@ -1922,13 +1923,6 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, +@@ -1924,13 +1925,6 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, @@ -111 +112 @@ -index 53b1c0b69a..57eb002bde 100644 +index 406a0a953f..f9be3a5c94 100644 @@ -114 +115 @@ -@@ -1832,4 +1832,7 @@ ice_flow_init(struct ice_adapter *ad) +@@ -1827,4 +1827,7 @@ ice_flow_init(struct ice_adapter *ad) @@ -122 +123 @@ -@@ -1886,4 +1889,9 @@ ice_flow_uninit(struct ice_adapter *ad) +@@ -1881,4 +1884,9 @@ ice_flow_uninit(struct ice_adapter *ad)
Hi, FYI, your patch has been queued to stable release 21.11.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/15/22. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/21edf23c6d7a93fb6ca6a4e2eceb8cc3025fb291 Thanks. Kevin --- From 21edf23c6d7a93fb6ca6a4e2eceb8cc3025fb291 Mon Sep 17 00:00:00 2001 From: Ting Xu <ting.xu@intel.com> Date: Mon, 18 Apr 2022 14:59:08 +0800 Subject: [PATCH] net/ice: fix raw flow input pattern parsing [ upstream commit 848de9572c83142e989394a699064d728eb892c3 ] When parsing raw flow pattern in FDIR, the input parameter spec and mask are used directly and the original value will be changed. It will cause error if these values are used in other functions. In this patch, temporary variables are created to store the spec and mask. Fixes: 25be39cc1760 ("net/ice: enable protocol agnostic flow offloading in FDIR") Signed-off-by: Ting Xu <ting.xu@intel.com> Acked-by: Junfeng Guo <junfeng.guo@intel.com> --- drivers/net/ice/ice_fdir_filter.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/drivers/net/ice/ice_fdir_filter.c b/drivers/net/ice/ice_fdir_filter.c index 99053978a9..72c8bd8f02 100644 --- a/drivers/net/ice/ice_fdir_filter.c +++ b/drivers/net/ice/ice_fdir_filter.c @@ -1873,8 +1873,9 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, /* convert raw spec & mask from byte string to int */ - unsigned char *tmp_spec = + unsigned char *spec_pattern = (uint8_t *)(uintptr_t)raw_spec->pattern; - unsigned char *tmp_mask = + unsigned char *mask_pattern = (uint8_t *)(uintptr_t)raw_mask->pattern; + uint8_t *tmp_spec, *tmp_mask; uint16_t tmp_val = 0; uint8_t pkt_len = 0; @@ -1887,6 +1888,16 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, return -rte_errno; + tmp_spec = rte_zmalloc(NULL, pkt_len / 2, 0); + if (!tmp_spec) + return -rte_errno; + + tmp_mask = rte_zmalloc(NULL, pkt_len / 2, 0); + if (!tmp_mask) { + rte_free(tmp_spec); + return -rte_errno; + } + for (i = 0, j = 0; i < pkt_len; i += 2, j++) { - tmp = tmp_spec[i]; + tmp = spec_pattern[i]; if (tmp >= 'a' && tmp <= 'f') tmp_val = tmp - 'a' + 10; @@ -1897,5 +1908,5 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, tmp_val *= 16; - tmp = tmp_spec[i + 1]; + tmp = spec_pattern[i + 1]; if (tmp >= 'a' && tmp <= 'f') tmp_spec[j] = tmp_val + tmp - 'a' + 10; @@ -1905,5 +1916,5 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, tmp_spec[j] = tmp_val + tmp - '0'; - tmp = tmp_mask[i]; + tmp = mask_pattern[i]; if (tmp >= 'a' && tmp <= 'f') tmp_val = tmp - 'a' + 10; @@ -1914,5 +1925,5 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, tmp_val *= 16; - tmp = tmp_mask[i + 1]; + tmp = mask_pattern[i + 1]; if (tmp >= 'a' && tmp <= 'f') tmp_mask[j] = tmp_val + tmp - 'a' + 10; @@ -1950,4 +1961,6 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, filter->parser_ena = true; + rte_free(tmp_spec); + rte_free(tmp_mask); break; } -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-05-10 13:24:21.822050019 +0100 +++ 0009-net-ice-fix-raw-flow-input-pattern-parsing.patch 2022-05-10 13:24:21.571646318 +0100 @@ -1 +1 @@ -From 848de9572c83142e989394a699064d728eb892c3 Mon Sep 17 00:00:00 2001 +From 21edf23c6d7a93fb6ca6a4e2eceb8cc3025fb291 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 848de9572c83142e989394a699064d728eb892c3 ] + @@ -12 +13,0 @@ -Cc: stable@dpdk.org @@ -21 +22 @@ -index 0982478feb..7914ba9407 100644 +index 99053978a9..72c8bd8f02 100644 @@ -24 +25 @@ -@@ -1871,8 +1871,9 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, +@@ -1873,8 +1873,9 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, @@ -36 +37 @@ -@@ -1885,6 +1886,16 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, +@@ -1887,6 +1888,16 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, @@ -54 +55 @@ -@@ -1895,5 +1906,5 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, +@@ -1897,5 +1908,5 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, @@ -61 +62 @@ -@@ -1903,5 +1914,5 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, +@@ -1905,5 +1916,5 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, @@ -68 +69 @@ -@@ -1912,5 +1923,5 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, +@@ -1914,5 +1925,5 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, @@ -75 +76 @@ -@@ -1948,4 +1959,6 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, +@@ -1950,4 +1961,6 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,
Hi, FYI, your patch has been queued to stable release 21.11.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/15/22. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/550f0d82881008e4240fc1f9839e04283aae4b0b Thanks. Kevin --- From 550f0d82881008e4240fc1f9839e04283aae4b0b Mon Sep 17 00:00:00 2001 From: Long Li <longli@microsoft.com> Date: Thu, 24 Mar 2022 10:46:08 -0700 Subject: [PATCH] net/netvsc: fix calculation of checksums based on mbuf flag [ upstream commit 559a1f2eeaaddccc83e1668a8ee375c34699e48b ] The netvsc should use RTE_MBUF_F_TX_L4_MASK and check the masked value to decide the correct way to calculate checksums. Not checking for RTE_MBUF_F_TX_L4_MASK results in incorrect RNDIS packets sent to VSP and incorrect checksums calculated by the VSP. Fixes: 4e9c73e96e ("net/netvsc: add Hyper-V network device") Signed-off-by: Long Li <longli@microsoft.com> Acked-by: Stephen Hemminger <stephen@networkplumber.org> Reviewed-by: Ferruh Yigit <ferruh.yigit@xilinx.com> --- drivers/net/netvsc/hn_rxtx.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/net/netvsc/hn_rxtx.c b/drivers/net/netvsc/hn_rxtx.c index 50ca1710ef..bf33bb031e 100644 --- a/drivers/net/netvsc/hn_rxtx.c +++ b/drivers/net/netvsc/hn_rxtx.c @@ -1349,6 +1349,9 @@ static void hn_encap(struct rndis_packet_msg *pkt, m->tso_segsz); } - } else if (m->ol_flags & - (RTE_MBUF_F_TX_TCP_CKSUM | RTE_MBUF_F_TX_UDP_CKSUM | RTE_MBUF_F_TX_IP_CKSUM)) { + } else if ((m->ol_flags & RTE_MBUF_F_TX_L4_MASK) == + RTE_MBUF_F_TX_TCP_CKSUM || + (m->ol_flags & RTE_MBUF_F_TX_L4_MASK) == + RTE_MBUF_F_TX_UDP_CKSUM || + (m->ol_flags & RTE_MBUF_F_TX_IP_CKSUM)) { pi_data = hn_rndis_pktinfo_append(pkt, NDIS_TXCSUM_INFO_SIZE, NDIS_PKTINFO_TYPE_CSUM); @@ -1364,7 +1367,9 @@ static void hn_encap(struct rndis_packet_msg *pkt, } - if (m->ol_flags & RTE_MBUF_F_TX_TCP_CKSUM) + if ((m->ol_flags & RTE_MBUF_F_TX_L4_MASK) == + RTE_MBUF_F_TX_TCP_CKSUM) *pi_data |= NDIS_TXCSUM_INFO_MKTCPCS(hlen); - else if (m->ol_flags & RTE_MBUF_F_TX_UDP_CKSUM) + else if ((m->ol_flags & RTE_MBUF_F_TX_L4_MASK) == + RTE_MBUF_F_TX_UDP_CKSUM) *pi_data |= NDIS_TXCSUM_INFO_MKUDPCS(hlen); } -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-05-10 13:24:21.843134234 +0100 +++ 0010-net-netvsc-fix-calculation-of-checksums-based-on-mbu.patch 2022-05-10 13:24:21.572646319 +0100 @@ -1 +1 @@ -From 559a1f2eeaaddccc83e1668a8ee375c34699e48b Mon Sep 17 00:00:00 2001 +From 550f0d82881008e4240fc1f9839e04283aae4b0b Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 559a1f2eeaaddccc83e1668a8ee375c34699e48b ] + @@ -13 +14,0 @@ -Cc: stable@dpdk.org @@ -23 +24 @@ -index 3e3488f1b8..1afc14f280 100644 +index 50ca1710ef..bf33bb031e 100644 @@ -26 +27 @@ -@@ -1347,6 +1347,9 @@ static void hn_encap(struct rndis_packet_msg *pkt, +@@ -1349,6 +1349,9 @@ static void hn_encap(struct rndis_packet_msg *pkt, @@ -38 +39 @@ -@@ -1362,7 +1365,9 @@ static void hn_encap(struct rndis_packet_msg *pkt, +@@ -1364,7 +1367,9 @@ static void hn_encap(struct rndis_packet_msg *pkt,
Hi, FYI, your patch has been queued to stable release 21.11.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/15/22. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/72691359faa37e4ae67027bee6ea7231ac8dfac9 Thanks. Kevin --- From 72691359faa37e4ae67027bee6ea7231ac8dfac9 Mon Sep 17 00:00:00 2001 From: Dmitry Kozlyuk <dkozlyuk@nvidia.com> Date: Thu, 31 Mar 2022 17:33:16 +0300 Subject: [PATCH] common/mlx5: fix memory region range calculation [ upstream commit 8113251862a0813e171d76a6a56b7f93987690ce ] MR end for a mempool chunk may be calculated incorrectly. For example, for chunk with addr=1.5M and len=1M with 2M page size the range would be [0, 2M), while the proper result is [0, 4M). Fix the calculation. Fixes: 690b2a88c2f7 ("common/mlx5: add mempool registration facilities") Signed-off-by: Dmitry Kozlyuk <dkozlyuk@nvidia.com> Acked-by: Matan Azrad <matan@nvidia.com> --- drivers/common/mlx5/mlx5_common_mr.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/common/mlx5/mlx5_common_mr.c b/drivers/common/mlx5/mlx5_common_mr.c index 5f7e4f6734..4a5936bcdf 100644 --- a/drivers/common/mlx5/mlx5_common_mr.c +++ b/drivers/common/mlx5/mlx5_common_mr.c @@ -1291,9 +1291,10 @@ mlx5_range_from_mempool_chunk(struct rte_mempool *mp, void *opaque, { struct mlx5_range *ranges = opaque, *range = &ranges[idx]; + uintptr_t start = (uintptr_t)memhdr->addr; uint64_t page_size = rte_mem_page_size(); RTE_SET_USED(mp); - range->start = RTE_ALIGN_FLOOR((uintptr_t)memhdr->addr, page_size); - range->end = RTE_ALIGN_CEIL(range->start + memhdr->len, page_size); + range->start = RTE_ALIGN_FLOOR(start, page_size); + range->end = RTE_ALIGN_CEIL(start + memhdr->len, page_size); } -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-05-10 13:24:21.862450102 +0100 +++ 0011-common-mlx5-fix-memory-region-range-calculation.patch 2022-05-10 13:24:21.573646321 +0100 @@ -1 +1 @@ -From 8113251862a0813e171d76a6a56b7f93987690ce Mon Sep 17 00:00:00 2001 +From 72691359faa37e4ae67027bee6ea7231ac8dfac9 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 8113251862a0813e171d76a6a56b7f93987690ce ] + @@ -12 +13,0 @@ -Cc: stable@dpdk.org @@ -21 +22 @@ -index fa27bd98de..06e4c8f187 100644 +index 5f7e4f6734..4a5936bcdf 100644 @@ -24 +25 @@ -@@ -1290,9 +1290,10 @@ mlx5_range_from_mempool_chunk(struct rte_mempool *mp, void *opaque, +@@ -1291,9 +1291,10 @@ mlx5_range_from_mempool_chunk(struct rte_mempool *mp, void *opaque,
Hi, FYI, your patch has been queued to stable release 21.11.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/15/22. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/1430ccb1db805caf522e9a0d5a210f22b9684361 Thanks. Kevin --- From 1430ccb1db805caf522e9a0d5a210f22b9684361 Mon Sep 17 00:00:00 2001 From: Dmitry Kozlyuk <dkozlyuk@nvidia.com> Date: Thu, 31 Mar 2022 17:38:41 +0300 Subject: [PATCH] net/mlx5: fix Tx when inlining is impossible [ upstream commit e2259f93ef455c75bfeda9a7349689b7e9be5981 ] When txq_inline_max is too large and an mbuf is multi-segment it may be impossible to inline data and build a valid WQE, because WQE length would be larger then HW can represent. It is impossible to detect misconfiguration at startup, because the condition depends on the mbuf composition. The check on the data path to prevent the error treated the length limit as expressed in 64B units, while the calculated length and limit are in 16B units. Fix the condition to avoid subsequent TxQ failure and recovery. Fixes: 18a1c20044c0 ("net/mlx5: implement Tx burst template") Signed-off-by: Dmitry Kozlyuk <dkozlyuk@nvidia.com> Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com> --- drivers/net/mlx5/mlx5_tx.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/mlx5/mlx5_tx.h b/drivers/net/mlx5/mlx5_tx.h index 398cadfeaa..6be3684bb3 100644 --- a/drivers/net/mlx5/mlx5_tx.h +++ b/drivers/net/mlx5/mlx5_tx.h @@ -2019,5 +2019,5 @@ do_build: return MLX5_TXCMP_CODE_EXIT; /* Check for maximal WQE size. */ - if (unlikely((MLX5_WQE_SIZE_MAX / MLX5_WSEG_SIZE) < ((ds + 3) / 4))) + if (unlikely((MLX5_WQE_SIZE_MAX / MLX5_WSEG_SIZE) < ds)) return MLX5_TXCMP_CODE_ERROR; #ifdef MLX5_PMD_SOFT_COUNTERS -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-05-10 13:24:21.918564773 +0100 +++ 0012-net-mlx5-fix-Tx-when-inlining-is-impossible.patch 2022-05-10 13:24:21.576646325 +0100 @@ -1 +1 @@ -From e2259f93ef455c75bfeda9a7349689b7e9be5981 Mon Sep 17 00:00:00 2001 +From 1430ccb1db805caf522e9a0d5a210f22b9684361 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit e2259f93ef455c75bfeda9a7349689b7e9be5981 ] + @@ -17 +18,0 @@ -Cc: stable@dpdk.org @@ -26 +27 @@ -index 89dac0c65a..dfa04612ff 100644 +index 398cadfeaa..6be3684bb3 100644 @@ -29 +30 @@ -@@ -2071,5 +2071,5 @@ do_build: +@@ -2019,5 +2019,5 @@ do_build:
Hi, FYI, your patch has been queued to stable release 21.11.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/15/22. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/99ba358268c8bd8d1bb387ea842a88ca45ffdbe1 Thanks. Kevin --- From 99ba358268c8bd8d1bb387ea842a88ca45ffdbe1 Mon Sep 17 00:00:00 2001 From: Rongwei Liu <rongweil@nvidia.com> Date: Wed, 6 Apr 2022 10:12:24 +0300 Subject: [PATCH] net/mlx5: fix probing with secondary bonding member [ upstream commit f956d3d4c33cdfac5e352f457050029bd5c9b8a8 ] Users can probe primary or secondary PCIe id when bonding is configured. 1. -a 0a:00.0,representor=pf[0-1]vf[0-1], PMD probes 5 ports totally: bonding device plus 4 representor ports. 2. -a 0a:00.1,representor=pf[0-1]vf[0-1], PMD only probes 2 representor ports. Under the 2nd condition, bonding IB device doesn't have the same PCIe id and PMD needs to check bonding relationship otherwise probe failure. Fixes: 6856efa54eea ("net/mlx5: fix PF leak on PCI probing failure") Signed-off-by: Rongwei Liu <rongweil@nvidia.com> Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com> --- drivers/common/mlx5/linux/mlx5_common_os.c | 26 ++++++++++++++++------ drivers/net/mlx5/linux/mlx5_os.c | 24 ++++++++++---------- 2 files changed, 31 insertions(+), 19 deletions(-) diff --git a/drivers/common/mlx5/linux/mlx5_common_os.c b/drivers/common/mlx5/linux/mlx5_common_os.c index 25e09bb55b..eeb583a553 100644 --- a/drivers/common/mlx5/linux/mlx5_common_os.c +++ b/drivers/common/mlx5/linux/mlx5_common_os.c @@ -457,19 +457,31 @@ mlx5_os_get_ibv_device(const struct rte_pci_addr *addr) struct ibv_device **ibv_list = mlx5_glue->get_device_list(&n); struct ibv_device *ibv_match = NULL; + uint8_t guid1[32] = {0}; + uint8_t guid2[32] = {0}; + int ret1, ret2 = -1; + struct rte_pci_addr paddr; - if (ibv_list == NULL) { + if (ibv_list == NULL || !n) { rte_errno = ENOSYS; + if (ibv_list) + mlx5_glue->free_device_list(ibv_list); return NULL; } + ret1 = mlx5_get_device_guid(addr, guid1, sizeof(guid1)); while (n-- > 0) { - struct rte_pci_addr paddr; - DRV_LOG(DEBUG, "Checking device \"%s\"..", ibv_list[n]->name); if (mlx5_get_pci_addr(ibv_list[n]->ibdev_path, &paddr) != 0) continue; - if (rte_pci_addr_cmp(addr, &paddr) != 0) - continue; - ibv_match = ibv_list[n]; - break; + if (ret1 > 0) + ret2 = mlx5_get_device_guid(&paddr, guid2, sizeof(guid2)); + /* Bond device can bond secondary PCIe */ + if ((strstr(ibv_list[n]->name, "bond") && + ((ret1 > 0 && ret2 > 0 && !memcmp(guid1, guid2, sizeof(guid1))) || + (addr->domain == paddr.domain && addr->bus == paddr.bus && + addr->devid == paddr.devid))) || + !rte_pci_addr_cmp(addr, &paddr)) { + ibv_match = ibv_list[n]; + break; + } } if (ibv_match == NULL) { diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c index 6c76a30e8c..792dd2cb22 100644 --- a/drivers/net/mlx5/linux/mlx5_os.c +++ b/drivers/net/mlx5/linux/mlx5_os.c @@ -2190,7 +2190,7 @@ mlx5_os_pci_probe_pf(struct mlx5_common_device *cdev, /* No device matches, just complain and bail out. */ DRV_LOG(WARNING, - "No Verbs device matches PCI device " PCI_PRI_FMT "," + "PF %u doesn't have Verbs device matches PCI device " PCI_PRI_FMT "," " are kernel drivers loaded?", - owner_pci.domain, owner_pci.bus, + owner_id, owner_pci.domain, owner_pci.bus, owner_pci.devid, owner_pci.function); rte_errno = ENOENT; @@ -2613,14 +2613,14 @@ mlx5_os_pci_probe(struct mlx5_common_device *cdev) ret = mlx5_os_pci_probe_pf(cdev, ð_da, eth_da.ports[p]); - if (ret) - break; - } - if (ret) { - DRV_LOG(ERR, "Probe of PCI device " PCI_PRI_FMT " " - "aborted due to prodding failure of PF %u", - pci_dev->addr.domain, pci_dev->addr.bus, - pci_dev->addr.devid, pci_dev->addr.function, - eth_da.ports[p]); - mlx5_net_remove(cdev); + if (ret) { + DRV_LOG(INFO, "Probe of PCI device " PCI_PRI_FMT " " + "aborted due to proding failure of PF %u", + pci_dev->addr.domain, pci_dev->addr.bus, + pci_dev->addr.devid, pci_dev->addr.function, + eth_da.ports[p]); + mlx5_net_remove(cdev); + if (p != 0) + break; + } } } else { -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-05-10 13:24:21.965977325 +0100 +++ 0013-net-mlx5-fix-probing-with-secondary-bonding-member.patch 2022-05-10 13:24:21.579646328 +0100 @@ -1 +1 @@ -From f956d3d4c33cdfac5e352f457050029bd5c9b8a8 Mon Sep 17 00:00:00 2001 +From 99ba358268c8bd8d1bb387ea842a88ca45ffdbe1 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit f956d3d4c33cdfac5e352f457050029bd5c9b8a8 ] + @@ -18 +19,0 @@ -Cc: stable@dpdk.org @@ -28 +29 @@ -index 030ceb561f..d40cfd5cd1 100644 +index 25e09bb55b..eeb583a553 100644 @@ -31 +32 @@ -@@ -560,19 +560,31 @@ mlx5_os_get_ibv_device(const struct rte_pci_addr *addr) +@@ -457,19 +457,31 @@ mlx5_os_get_ibv_device(const struct rte_pci_addr *addr) @@ -71 +72 @@ -index ff65efb2a2..a821153b35 100644 +index 6c76a30e8c..792dd2cb22 100644 @@ -74 +75 @@ -@@ -1980,7 +1980,7 @@ mlx5_os_pci_probe_pf(struct mlx5_common_device *cdev, +@@ -2190,7 +2190,7 @@ mlx5_os_pci_probe_pf(struct mlx5_common_device *cdev, @@ -84 +85 @@ -@@ -2388,14 +2388,14 @@ mlx5_os_pci_probe(struct mlx5_common_device *cdev, +@@ -2613,14 +2613,14 @@ mlx5_os_pci_probe(struct mlx5_common_device *cdev) @@ -86 +87 @@ - eth_da.ports[p], mkvlist); + eth_da.ports[p]);
Hi, FYI, your patch has been queued to stable release 21.11.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/15/22. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/c08c6247f23e2147c8191741c42c2d3c6d240b83 Thanks. Kevin --- From c08c6247f23e2147c8191741c42c2d3c6d240b83 Mon Sep 17 00:00:00 2001 From: Shun Hao <shunh@nvidia.com> Date: Wed, 6 Apr 2022 11:54:01 +0300 Subject: [PATCH] net/mlx5: fix counter in non-termination meter [ upstream commit 4fa1452bcaa452f7fa0214b78a2e0e2032deed40 ] In rte_flow, if a counter action is before a meter which has non-termination policy, the counter value only includes packets not being dropped. This patch fixes this issue by differentiating the order of counter and non-termination meter: 1. counter + meter, counts all packets hitting this flow. 2. meter + counter, only counts packets not being dropped. Fixes: 51ec04dc7bcf ("net/mlx5: connect meter policy to created flows") Signed-off-by: Shun Hao <shunh@nvidia.com> Acked-by: Matan Azrad <matan@nvidia.com> --- drivers/net/mlx5/mlx5_flow.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index 1ea6d030f3..3574358c72 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -5044,4 +5044,5 @@ flow_meter_split_prep(struct rte_eth_dev *dev, uint32_t flow_id_reversed = 0; uint8_t flow_id_bits = 0; + bool after_meter = false; int shift; @@ -5110,4 +5111,5 @@ flow_meter_split_prep(struct rte_eth_dev *dev, action_cur = actions_pre++; } + after_meter = true; break; case RTE_FLOW_ACTION_TYPE_VXLAN_DECAP: @@ -5138,4 +5140,9 @@ flow_meter_split_prep(struct rte_eth_dev *dev, } break; + case RTE_FLOW_ACTION_TYPE_COUNT: + if (fm->def_policy) + action_cur = after_meter ? + actions_sfx++ : actions_pre++; + break; default: break; @@ -6168,6 +6175,8 @@ flow_create_split_meter(struct rte_eth_dev *dev, (!has_modify || !fm->drop_cnt)) set_mtr_reg = false; - /* Prefix actions: meter, decap, encap, tag, jump, end. */ - act_size = sizeof(struct rte_flow_action) * (actions_n + 6) + + /* Prefix actions: meter, decap, encap, tag, jump, end, cnt. */ +#define METER_PREFIX_ACTION 7 + act_size = (sizeof(struct rte_flow_action) * + (actions_n + METER_PREFIX_ACTION)) + sizeof(struct mlx5_rte_flow_action_set_tag); /* Suffix items: tag, vlan, port id, end. */ -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-05-10 13:24:21.994006492 +0100 +++ 0014-net-mlx5-fix-counter-in-non-termination-meter.patch 2022-05-10 13:24:21.587646339 +0100 @@ -1 +1 @@ -From 4fa1452bcaa452f7fa0214b78a2e0e2032deed40 Mon Sep 17 00:00:00 2001 +From c08c6247f23e2147c8191741c42c2d3c6d240b83 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 4fa1452bcaa452f7fa0214b78a2e0e2032deed40 ] + @@ -16 +17,0 @@ -Cc: stable@dpdk.org @@ -25 +26 @@ -index 78cb38d42b..28afdfe011 100644 +index 1ea6d030f3..3574358c72 100644 @@ -28 +29 @@ -@@ -5272,4 +5272,5 @@ flow_meter_split_prep(struct rte_eth_dev *dev, +@@ -5044,4 +5044,5 @@ flow_meter_split_prep(struct rte_eth_dev *dev, @@ -34 +35 @@ -@@ -5338,4 +5339,5 @@ flow_meter_split_prep(struct rte_eth_dev *dev, +@@ -5110,4 +5111,5 @@ flow_meter_split_prep(struct rte_eth_dev *dev, @@ -40 +41 @@ -@@ -5366,4 +5368,9 @@ flow_meter_split_prep(struct rte_eth_dev *dev, +@@ -5138,4 +5140,9 @@ flow_meter_split_prep(struct rte_eth_dev *dev, @@ -50 +51 @@ -@@ -6394,6 +6401,8 @@ flow_create_split_meter(struct rte_eth_dev *dev, +@@ -6168,6 +6175,8 @@ flow_create_split_meter(struct rte_eth_dev *dev,
Hi, FYI, your patch has been queued to stable release 21.11.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/15/22. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/b3896dba13eae6b410733af101a80b403a474416 Thanks. Kevin --- From b3896dba13eae6b410733af101a80b403a474416 Mon Sep 17 00:00:00 2001 From: Michael Baum <michaelba@nvidia.com> Date: Sun, 10 Apr 2022 12:25:27 +0300 Subject: [PATCH] net/mlx5: restrict Rx queue array access to boundary [ upstream commit 1573b07284caf92cad5479b539213c508d5583a6 ] The mlx5_rxq_get() function gets RxQ index and return RxQ priv accordingly. When it gets an invalid index, it accesses out of array bounds which might cause undefined behavior. This patch adds a check for invalid indexes before accessing to array. Fixes: 0cedf34da78f ("net/mlx5: move Rx queue reference count") Signed-off-by: Michael Baum <michaelba@nvidia.com> Acked-by: Matan Azrad <matan@nvidia.com> --- drivers/net/mlx5/mlx5_rxq.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index fe72cf49d3..a5a96c9a60 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -2049,4 +2049,6 @@ mlx5_rxq_get(struct rte_eth_dev *dev, uint16_t idx) struct mlx5_priv *priv = dev->data->dev_private; + if (idx >= priv->rxqs_n) + return NULL; MLX5_ASSERT(priv->rxq_privs != NULL); return (*priv->rxq_privs)[idx]; -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-05-10 13:24:22.024999526 +0100 +++ 0015-net-mlx5-restrict-Rx-queue-array-access-to-boundary.patch 2022-05-10 13:24:21.590646343 +0100 @@ -1 +1 @@ -From 1573b07284caf92cad5479b539213c508d5583a6 Mon Sep 17 00:00:00 2001 +From b3896dba13eae6b410733af101a80b403a474416 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 1573b07284caf92cad5479b539213c508d5583a6 ] + @@ -15 +16,0 @@ -Cc: stable@dpdk.org @@ -24 +25 @@ -index 925544ae3d..38fde939e1 100644 +index fe72cf49d3..a5a96c9a60 100644 @@ -27 +28 @@ -@@ -2050,4 +2050,6 @@ mlx5_rxq_get(struct rte_eth_dev *dev, uint16_t idx) +@@ -2049,4 +2049,6 @@ mlx5_rxq_get(struct rte_eth_dev *dev, uint16_t idx)
Hi, FYI, your patch has been queued to stable release 21.11.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/15/22. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/b0e6a9c183201568074cff6da46c2279054f4631 Thanks. Kevin --- From b0e6a9c183201568074cff6da46c2279054f4631 Mon Sep 17 00:00:00 2001 From: Dariusz Sosnowski <dsosnowski@nvidia.com> Date: Wed, 13 Apr 2022 11:18:31 +0000 Subject: [PATCH] net/mlx5: fix GTP handling in header modify action [ upstream commit 26f22fa64e9fd66fbdba560c177ea5c9baacba5c ] GTP items were ignored during conversion of modify header actions. This caused modify TTL action to generate a wrong modify header command when tunnel and inner headers used different IP versions. This patch adds GTP item handling to modify header action conversion. Fixes: 04233f36c712 ("net/mlx5: fix layer type in header modify action") Signed-off-by: Dariusz Sosnowski <dsosnowski@nvidia.com> Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com> --- drivers/net/mlx5/mlx5_flow_dv.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 462d498a4b..8a3d9b5b6f 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -163,4 +163,5 @@ flow_dv_attr_init(const struct rte_flow_item *item, union flow_dv_attr *attr, case RTE_FLOW_ITEM_TYPE_GENEVE: case RTE_FLOW_ITEM_TYPE_MPLS: + case RTE_FLOW_ITEM_TYPE_GTP: if (tunnel_decap) attr->attr = 0; -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-05-10 13:24:22.049036196 +0100 +++ 0016-net-mlx5-fix-GTP-handling-in-header-modify-action.patch 2022-05-10 13:24:21.604646361 +0100 @@ -1 +1 @@ -From 26f22fa64e9fd66fbdba560c177ea5c9baacba5c Mon Sep 17 00:00:00 2001 +From b0e6a9c183201568074cff6da46c2279054f4631 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 26f22fa64e9fd66fbdba560c177ea5c9baacba5c ] + @@ -13 +14,0 @@ -Cc: stable@dpdk.org @@ -22 +23 @@ -index 1e9bd63635..da2ddd58cd 100644 +index 462d498a4b..8a3d9b5b6f 100644
Hi, FYI, your patch has been queued to stable release 21.11.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/15/22. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/c7e0471948eccde862b20f566e4d153b3ab7fb13 Thanks. Kevin --- From c7e0471948eccde862b20f566e4d153b3ab7fb13 Mon Sep 17 00:00:00 2001 From: Raja Zidane <rzidane@nvidia.com> Date: Wed, 20 Apr 2022 18:32:17 +0300 Subject: [PATCH] net/mlx5: fix Rx/Tx stats concurrency [ upstream commit 773a7de21a984bb7bdb6396a659ccc585a44a806 ] Queue statistics are being continuously updated in Rx/Tx burst routines while handling traffic. In addition to that, statistics can be reset (written with zeroes) on statistics reset in other threads, causing a race condition, which in turn could result in wrong stats. The patch provides an approach with reference values, allowing the actual counters to be writable within Rx/Tx burst threads only, and updating reference values on stats reset. Fixes: 87011737b715 ("mlx5: add software counters") Signed-off-by: Raja Zidane <rzidane@nvidia.com> Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com> --- drivers/net/mlx5/mlx5_rx.h | 1 + drivers/net/mlx5/mlx5_stats.c | 40 +++++++++++++++++++++-------------- drivers/net/mlx5/mlx5_tx.h | 1 + 3 files changed, 26 insertions(+), 16 deletions(-) diff --git a/drivers/net/mlx5/mlx5_rx.h b/drivers/net/mlx5/mlx5_rx.h index cb5d51340d..423d80e4a7 100644 --- a/drivers/net/mlx5/mlx5_rx.h +++ b/drivers/net/mlx5/mlx5_rx.h @@ -126,4 +126,5 @@ struct mlx5_rxq_data { uint16_t idx; /* Queue index. */ struct mlx5_rxq_stats stats; + struct mlx5_rxq_stats stats_reset; /* stats on last reset. */ rte_xmm_t mbuf_initializer; /* Default rearm/flags for vectorized Rx. */ struct rte_mbuf fake_mbuf; /* elts padding for vectorized Rx. */ diff --git a/drivers/net/mlx5/mlx5_stats.c b/drivers/net/mlx5/mlx5_stats.c index 732775954a..f64fa3587b 100644 --- a/drivers/net/mlx5/mlx5_stats.c +++ b/drivers/net/mlx5/mlx5_stats.c @@ -115,16 +115,21 @@ mlx5_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) if (idx < RTE_ETHDEV_QUEUE_STAT_CNTRS) { #ifdef MLX5_PMD_SOFT_COUNTERS - tmp.q_ipackets[idx] += rxq->stats.ipackets; - tmp.q_ibytes[idx] += rxq->stats.ibytes; + tmp.q_ipackets[idx] += rxq->stats.ipackets - + rxq->stats_reset.ipackets; + tmp.q_ibytes[idx] += rxq->stats.ibytes - + rxq->stats_reset.ibytes; #endif tmp.q_errors[idx] += (rxq->stats.idropped + - rxq->stats.rx_nombuf); + rxq->stats.rx_nombuf) - + (rxq->stats_reset.idropped + + rxq->stats_reset.rx_nombuf); } #ifdef MLX5_PMD_SOFT_COUNTERS - tmp.ipackets += rxq->stats.ipackets; - tmp.ibytes += rxq->stats.ibytes; + tmp.ipackets += rxq->stats.ipackets - rxq->stats_reset.ipackets; + tmp.ibytes += rxq->stats.ibytes - rxq->stats_reset.ibytes; #endif - tmp.ierrors += rxq->stats.idropped; - tmp.rx_nombuf += rxq->stats.rx_nombuf; + tmp.ierrors += rxq->stats.idropped - rxq->stats_reset.idropped; + tmp.rx_nombuf += rxq->stats.rx_nombuf - + rxq->stats_reset.rx_nombuf; } for (i = 0; (i != priv->txqs_n); ++i) { @@ -136,13 +141,15 @@ mlx5_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) if (idx < RTE_ETHDEV_QUEUE_STAT_CNTRS) { #ifdef MLX5_PMD_SOFT_COUNTERS - tmp.q_opackets[idx] += txq->stats.opackets; - tmp.q_obytes[idx] += txq->stats.obytes; + tmp.q_opackets[idx] += txq->stats.opackets - + txq->stats_reset.opackets; + tmp.q_obytes[idx] += txq->stats.obytes - + txq->stats_reset.obytes; #endif } #ifdef MLX5_PMD_SOFT_COUNTERS - tmp.opackets += txq->stats.opackets; - tmp.obytes += txq->stats.obytes; + tmp.opackets += txq->stats.opackets - txq->stats_reset.opackets; + tmp.obytes += txq->stats.obytes - txq->stats_reset.obytes; #endif - tmp.oerrors += txq->stats.oerrors; + tmp.oerrors += txq->stats.oerrors - txq->stats_reset.oerrors; } ret = mlx5_os_read_dev_stat(priv, "out_of_buffer", &tmp.imissed); @@ -186,11 +193,12 @@ mlx5_stats_reset(struct rte_eth_dev *dev) if (rxq_data == NULL) continue; - memset(&rxq_data->stats, 0, sizeof(struct mlx5_rxq_stats)); + rxq_data->stats_reset = rxq_data->stats; } for (i = 0; (i != priv->txqs_n); ++i) { - if ((*priv->txqs)[i] == NULL) + struct mlx5_txq_data *txq_data = (*priv->txqs)[i]; + + if (txq_data == NULL) continue; - memset(&(*priv->txqs)[i]->stats, 0, - sizeof(struct mlx5_txq_stats)); + txq_data->stats_reset = txq_data->stats; } mlx5_os_read_dev_stat(priv, "out_of_buffer", &stats_ctrl->imissed_base); diff --git a/drivers/net/mlx5/mlx5_tx.h b/drivers/net/mlx5/mlx5_tx.h index 6be3684bb3..6ed00f722e 100644 --- a/drivers/net/mlx5/mlx5_tx.h +++ b/drivers/net/mlx5/mlx5_tx.h @@ -162,4 +162,5 @@ struct mlx5_txq_data { struct mlx5_dev_ctx_shared *sh; /* Shared context. */ struct mlx5_txq_stats stats; /* TX queue counters. */ + struct mlx5_txq_stats stats_reset; /* stats on last reset. */ struct mlx5_uar_data uar_data; struct rte_mbuf *elts[0]; -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-05-10 13:24:22.082870081 +0100 +++ 0017-net-mlx5-fix-Rx-Tx-stats-concurrency.patch 2022-05-10 13:24:21.607646365 +0100 @@ -1 +1 @@ -From 773a7de21a984bb7bdb6396a659ccc585a44a806 Mon Sep 17 00:00:00 2001 +From c7e0471948eccde862b20f566e4d153b3ab7fb13 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 773a7de21a984bb7bdb6396a659ccc585a44a806 ] + @@ -17 +18,0 @@ -Cc: stable@dpdk.org @@ -28 +29 @@ -index 5bf88b6181..e715ed6b62 100644 +index cb5d51340d..423d80e4a7 100644 @@ -31 +32 @@ -@@ -127,4 +127,5 @@ struct mlx5_rxq_data { +@@ -126,4 +126,5 @@ struct mlx5_rxq_data { @@ -109 +110 @@ -index dfa04612ff..20776919c2 100644 +index 6be3684bb3..6ed00f722e 100644 @@ -112 +113 @@ -@@ -165,4 +165,5 @@ struct mlx5_txq_data { +@@ -162,4 +162,5 @@ struct mlx5_txq_data {
Hi, FYI, your patch has been queued to stable release 21.11.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/15/22. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/65855b2d37a2f4821a0faad4c08711eaf35160bd Thanks. Kevin --- From 65855b2d37a2f4821a0faad4c08711eaf35160bd Mon Sep 17 00:00:00 2001 From: Vladimir Medvedkin <vladimir.medvedkin@intel.com> Date: Thu, 21 Apr 2022 17:35:27 +0000 Subject: [PATCH] test/table: fix buffer overflow on lpm entry [ upstream commit a6699a6eb22a763ad4bc7498ca53cf89ab9917dd ] This patch fixes stack buffer overflow reported by ASan. Bugzilla ID: 820 Fixes: 5205954791cb ("app/test: packet framework unit tests") Signed-off-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com> Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com> --- app/test/test_table_tables.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/test/test_table_tables.c b/app/test/test_table_tables.c index 4ff6ab16aa..494fb6ffaa 100644 --- a/app/test/test_table_tables.c +++ b/app/test/test_table_tables.c @@ -291,8 +291,8 @@ test_table_lpm(void) void *table; char *entries[RTE_PORT_IN_BURST_SIZE_MAX]; - char entry; + uint64_t entry; void *entry_ptr; int key_found; - uint32_t entry_size = 1; + uint32_t entry_size = sizeof(entry); /* Initialize params and create tables */ @@ -356,5 +356,5 @@ test_table_lpm(void) lpm_key.ip = 0xadadadad; - table = rte_table_lpm_ops.f_create(&lpm_params, 0, 1); + table = rte_table_lpm_ops.f_create(&lpm_params, 0, entry_size); if (table == NULL) return -9; @@ -457,8 +457,8 @@ test_table_lpm_ipv6(void) void *table; char *entries[RTE_PORT_IN_BURST_SIZE_MAX]; - char entry; + uint64_t entry; void *entry_ptr; int key_found; - uint32_t entry_size = 1; + uint32_t entry_size = sizeof(entry); /* Initialize params and create tables */ -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-05-10 13:24:22.105519909 +0100 +++ 0018-test-table-fix-buffer-overflow-on-lpm-entry.patch 2022-05-10 13:24:21.608646366 +0100 @@ -1 +1 @@ -From a6699a6eb22a763ad4bc7498ca53cf89ab9917dd Mon Sep 17 00:00:00 2001 +From 65855b2d37a2f4821a0faad4c08711eaf35160bd Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit a6699a6eb22a763ad4bc7498ca53cf89ab9917dd ] + @@ -10 +11,0 @@ -Cc: stable@dpdk.org @@ -19 +20 @@ -index d5c5a426bc..010dd5a794 100644 +index 4ff6ab16aa..494fb6ffaa 100644 @@ -22 +23 @@ -@@ -293,8 +293,8 @@ test_table_lpm(void) +@@ -291,8 +291,8 @@ test_table_lpm(void) @@ -33 +34 @@ -@@ -358,5 +358,5 @@ test_table_lpm(void) +@@ -356,5 +356,5 @@ test_table_lpm(void) @@ -40 +41 @@ -@@ -459,8 +459,8 @@ test_table_lpm_ipv6(void) +@@ -457,8 +457,8 @@ test_table_lpm_ipv6(void)
Hi, FYI, your patch has been queued to stable release 21.11.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/15/22. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/804b2e64eb2f09c46e2521271ac3735624512e86 Thanks. Kevin --- From 804b2e64eb2f09c46e2521271ac3735624512e86 Mon Sep 17 00:00:00 2001 From: Deepak Khandelwal <deepak.khandelwal@intel.com> Date: Thu, 21 Apr 2022 14:41:21 +0530 Subject: [PATCH] mem: skip attaching external memory in secondary process [ upstream commit 90bf3f89ed33f78e9f41818caf123e13e508dee7 ] Currently, EAL init in secondary processes will attach all fbarrays in the memconfig to have access to the primary process's page tables. However, fbarrays corresponding to external memory segments should not be attached at initialization, because this will happen as part of `rte_extmem_attach` [1] or `rte_malloc_heap_memory_attach` [2] calls. 1: https://doc.dpdk.org/api/rte__memory_8h.html#a2796da68de6825f8edf53759f8e4d230 2: https://doc.dpdk.org/api/rte__malloc_8h.html#af6360dea35bdf162feeb2b62cf149fd3 Fixes: ff3619d6244b ("malloc: allow attaching to external memory chunks") Suggested-by: Anatoly Burakov <anatoly.burakov@intel.com> Signed-off-by: Deepak Khandelwal <deepak.khandelwal@intel.com> Acked-by: Anatoly Burakov <anatoly.burakov@intel.com> --- lib/eal/freebsd/eal_memory.c | 4 ++-- lib/eal/linux/eal_memory.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/eal/freebsd/eal_memory.c b/lib/eal/freebsd/eal_memory.c index 78ac142b82..17ab10e0ca 100644 --- a/lib/eal/freebsd/eal_memory.c +++ b/lib/eal/freebsd/eal_memory.c @@ -447,6 +447,6 @@ memseg_secondary_init(void) msl = &mcfg->memsegs[msl_idx]; - /* skip empty memseg lists */ - if (msl->memseg_arr.len == 0) + /* skip empty and external memseg lists */ + if (msl->memseg_arr.len == 0 || msl->external) continue; diff --git a/lib/eal/linux/eal_memory.c b/lib/eal/linux/eal_memory.c index 03a4f2dd2d..fda6a159d5 100644 --- a/lib/eal/linux/eal_memory.c +++ b/lib/eal/linux/eal_memory.c @@ -1884,6 +1884,6 @@ memseg_secondary_init(void) msl = &mcfg->memsegs[msl_idx]; - /* skip empty memseg lists */ - if (msl->memseg_arr.len == 0) + /* skip empty and external memseg lists */ + if (msl->memseg_arr.len == 0 || msl->external) continue; -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-05-10 13:24:22.126717131 +0100 +++ 0019-mem-skip-attaching-external-memory-in-secondary-proc.patch 2022-05-10 13:24:21.610646369 +0100 @@ -1 +1 @@ -From 90bf3f89ed33f78e9f41818caf123e13e508dee7 Mon Sep 17 00:00:00 2001 +From 804b2e64eb2f09c46e2521271ac3735624512e86 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 90bf3f89ed33f78e9f41818caf123e13e508dee7 ] + @@ -16 +17,0 @@ -Cc: stable@dpdk.org @@ -40 +41 @@ -index ee1a9e6800..c890c42106 100644 +index 03a4f2dd2d..fda6a159d5 100644 @@ -43 +44 @@ -@@ -1875,6 +1875,6 @@ memseg_secondary_init(void) +@@ -1884,6 +1884,6 @@ memseg_secondary_init(void)
Hi, FYI, your patch has been queued to stable release 21.11.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/15/22. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/de48c79f3bc2af6a9ac271e575f73bcb66b20c9c Thanks. Kevin --- From de48c79f3bc2af6a9ac271e575f73bcb66b20c9c Mon Sep 17 00:00:00 2001 From: Anatoly Burakov <anatoly.burakov@intel.com> Date: Wed, 4 May 2022 14:31:58 +0000 Subject: [PATCH] malloc: fix ASan handling for unmapped memory [ upstream commit 4d8bdd8b56a102fbe7d8ca167d5044625f4dbb32 ] Currently, when we free previously allocated memory, we mark the area as "freed" for ASan purposes (flag 0xfd). However, sometimes, freeing a malloc element will cause pages to be unmapped from memory and re-backed with anonymous memory again. This may cause ASan's "use-after-free" error down the line, because the allocator will try to write into memory areas recently marked as "freed". To fix this, we need to mark the unmapped memory area as "available", and fixup surrounding malloc element header/trailers to enable later malloc routines to safely write into new malloc elements' headers or trailers. Bugzilla ID: 994 Fixes: 6cc51b1293ce ("mem: instrument allocator for ASan") Reported-by: David Marchand <david.marchand@redhat.com> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com> --- lib/eal/common/malloc_elem.h | 4 ++++ lib/eal/common/malloc_heap.c | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/lib/eal/common/malloc_elem.h b/lib/eal/common/malloc_elem.h index 15d8ba7af2..c5f26ffd2f 100644 --- a/lib/eal/common/malloc_elem.h +++ b/lib/eal/common/malloc_elem.h @@ -273,4 +273,8 @@ old_malloc_size(struct malloc_elem *elem) #define __rte_no_asan +static inline void +asan_set_zone(void *ptr __rte_unused, size_t len __rte_unused, + uint32_t val __rte_unused) { } + static inline void asan_set_freezone(void *ptr __rte_unused, size_t size __rte_unused) { } diff --git a/lib/eal/common/malloc_heap.c b/lib/eal/common/malloc_heap.c index 55aad2711b..1ca01e0901 100644 --- a/lib/eal/common/malloc_heap.c +++ b/lib/eal/common/malloc_heap.c @@ -861,4 +861,5 @@ malloc_heap_free(struct malloc_elem *elem) unsigned int i, n_segs, before_space, after_space; int ret; + bool unmapped = false; const struct internal_config *internal_conf = eal_get_internal_configuration(); @@ -1027,4 +1028,7 @@ malloc_heap_free(struct malloc_elem *elem) } + /* we didn't exit early, meaning we have unmapped some pages */ + unmapped = true; + RTE_LOG(DEBUG, EAL, "Heap on socket %d was shrunk by %zdMB\n", msl->socket_id, aligned_len >> 20ULL); @@ -1034,4 +1038,35 @@ free_unlock: asan_set_freezone(asan_ptr, asan_data_len); + /* if we unmapped some memory, we need to do additional work for ASan */ + if (unmapped) { + void *asan_end = RTE_PTR_ADD(asan_ptr, asan_data_len); + void *aligned_end = RTE_PTR_ADD(aligned_start, aligned_len); + void *aligned_trailer = RTE_PTR_SUB(aligned_start, + MALLOC_ELEM_TRAILER_LEN); + + /* + * There was a memory area that was unmapped. This memory area + * will have to be marked as available for ASan, because we will + * want to use it next time it gets mapped again. The OS memory + * protection should trigger a fault on access to these areas + * anyway, so we are not giving up any protection. + */ + asan_set_zone(aligned_start, aligned_len, 0x00); + + /* + * ...however, when we unmap pages, we create new free elements + * which might have been marked as "freed" with an earlier + * `asan_set_freezone` call. So, if there is an area past the + * unmapped space that was marked as freezone for ASan, we need + * to mark the malloc header as available. + */ + if (asan_end > aligned_end) + asan_set_zone(aligned_end, MALLOC_ELEM_HEADER_LEN, 0x00); + + /* if there's space before unmapped memory, mark as available */ + if (asan_ptr < aligned_start) + asan_set_zone(aligned_trailer, MALLOC_ELEM_TRAILER_LEN, 0x00); + } + rte_spinlock_unlock(&(heap->lock)); return ret; -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-05-10 13:24:22.147587271 +0100 +++ 0020-malloc-fix-ASan-handling-for-unmapped-memory.patch 2022-05-10 13:24:21.611646370 +0100 @@ -1 +1 @@ -From 4d8bdd8b56a102fbe7d8ca167d5044625f4dbb32 Mon Sep 17 00:00:00 2001 +From de48c79f3bc2af6a9ac271e575f73bcb66b20c9c Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 4d8bdd8b56a102fbe7d8ca167d5044625f4dbb32 ] + @@ -20 +21,0 @@ -Cc: stable@dpdk.org @@ -30 +31 @@ -index f2aa98821b..c5f65895e1 100644 +index 15d8ba7af2..c5f26ffd2f 100644 @@ -33 +34 @@ -@@ -279,4 +279,8 @@ old_malloc_size(struct malloc_elem *elem) +@@ -273,4 +273,8 @@ old_malloc_size(struct malloc_elem *elem) @@ -43 +44 @@ -index 6c572b6f2c..a3d26fcbea 100644 +index 55aad2711b..1ca01e0901 100644 @@ -46 +47 @@ -@@ -862,4 +862,5 @@ malloc_heap_free(struct malloc_elem *elem) +@@ -861,4 +861,5 @@ malloc_heap_free(struct malloc_elem *elem) @@ -52 +53 @@ -@@ -1028,4 +1029,7 @@ malloc_heap_free(struct malloc_elem *elem) +@@ -1027,4 +1028,7 @@ malloc_heap_free(struct malloc_elem *elem) @@ -60 +61 @@ -@@ -1035,4 +1039,35 @@ free_unlock: +@@ -1034,4 +1038,35 @@ free_unlock:
Hi, FYI, your patch has been queued to stable release 21.11.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/15/22. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/f343d3b4ed76c826928cde54e8818680859cf50d Thanks. Kevin --- From f343d3b4ed76c826928cde54e8818680859cf50d Mon Sep 17 00:00:00 2001 From: Tianhao Chai <cth451@gmail.com> Date: Wed, 4 May 2022 23:39:35 -0500 Subject: [PATCH] eal: fix C++ include for device event and DMA [ upstream commit 28c5d600723a9bb384a4b2f79bf6af8c40950bba ] Currently the "extern C" section ends right before rte_dev_dma_unmap and other DMA function declarations, causing some C++ compilers to produce C++ mangled symbols to rte_dev_dma_unmap instead of C symbols. This leads to build failures later when linking a final executable against this object. Fixes: a753e53d517b ("eal: add device event monitor framework") Signed-off-by: Tianhao Chai <cth451@gmail.com> Acked-by: Bruce Richardson <bruce.richardson@intel.com> Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com> --- lib/eal/include/rte_dev.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/eal/include/rte_dev.h b/lib/eal/include/rte_dev.h index 448a41cb0e..e6ff1218f9 100644 --- a/lib/eal/include/rte_dev.h +++ b/lib/eal/include/rte_dev.h @@ -321,8 +321,4 @@ rte_dev_iterator_next(struct rte_dev_iterator *it); dev = rte_dev_iterator_next(it)) -#ifdef __cplusplus -} -#endif - /** * @warning @@ -497,3 +493,7 @@ rte_dev_dma_unmap(struct rte_device *dev, void *addr, uint64_t iova, size_t len); +#ifdef __cplusplus +} +#endif + #endif /* _RTE_DEV_H_ */ -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-05-10 13:24:22.169362865 +0100 +++ 0021-eal-fix-C-include-for-device-event-and-DMA.patch 2022-05-10 13:24:21.612646371 +0100 @@ -1 +1 @@ -From 28c5d600723a9bb384a4b2f79bf6af8c40950bba Mon Sep 17 00:00:00 2001 +From f343d3b4ed76c826928cde54e8818680859cf50d Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 28c5d600723a9bb384a4b2f79bf6af8c40950bba ] + @@ -13 +14,0 @@ -Cc: stable@dpdk.org
Hi, FYI, your patch has been queued to stable release 21.11.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/15/22. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/bb386a9f91965323768ba47188a8a875da555e94 Thanks. Kevin --- From bb386a9f91965323768ba47188a8a875da555e94 Mon Sep 17 00:00:00 2001 From: Gagandeep Singh <g.singh@nxp.com> Date: Thu, 17 Mar 2022 14:25:58 +0530 Subject: [PATCH] crypto/dpaa_sec: fix digest size [ upstream commit 841147ef973b415e8e21b6521e93361001ee2fc1 ] DPAA crypto driver can support 64 bytes size digest size for SHA512-HMAC. This patch changes the value of macro max supported digest size to 64. Fixes: c3e85bdcc6e6 ("crypto/dpaa_sec: add crypto driver for NXP DPAA platform") Signed-off-by: Gagandeep Singh <g.singh@nxp.com> --- drivers/crypto/dpaa_sec/dpaa_sec.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.h b/drivers/crypto/dpaa_sec/dpaa_sec.h index 7890687828..b3f2258ead 100644 --- a/drivers/crypto/dpaa_sec/dpaa_sec.h +++ b/drivers/crypto/dpaa_sec/dpaa_sec.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause * - * Copyright 2016-2021 NXP + * Copyright 2016-2022 NXP * */ @@ -232,5 +232,5 @@ struct dpaa_sec_job { }; -#define DPAA_MAX_NB_MAX_DIGEST 32 +#define DPAA_MAX_NB_MAX_DIGEST 64 struct dpaa_sec_op_ctx { struct dpaa_sec_job job; -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-05-10 13:24:22.190679238 +0100 +++ 0022-crypto-dpaa_sec-fix-digest-size.patch 2022-05-10 13:24:21.613646372 +0100 @@ -1 +1 @@ -From 841147ef973b415e8e21b6521e93361001ee2fc1 Mon Sep 17 00:00:00 2001 +From bb386a9f91965323768ba47188a8a875da555e94 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 841147ef973b415e8e21b6521e93361001ee2fc1 ] + @@ -12 +13,0 @@ -Cc: stable@dpdk.org
Hi, FYI, your patch has been queued to stable release 21.11.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/15/22. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/be6637f158eaf3b4d1843decb4b25aad940c95c1 Thanks. Kevin --- From be6637f158eaf3b4d1843decb4b25aad940c95c1 Mon Sep 17 00:00:00 2001 From: Anoob Joseph <anoobj@marvell.com> Date: Wed, 27 Apr 2022 11:31:45 +0530 Subject: [PATCH] security: fix SA lifetime comments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [ upstream commit 99783e212140878153b1abfb65c10c975ca45201 ] Fix comments to reflect the hard expiry fields. Fixes: ad7515a39f2a ("security: add SA lifetime configuration") Reported-by: Thomas Monjalon <thomas@monjalon.net> Signed-off-by: Anoob Joseph <anoobj@marvell.com> Reviewed-by: Morten Brørup <mb@smartsharesystems.com> --- lib/security/rte_security.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/security/rte_security.h b/lib/security/rte_security.h index 1228b6c8b1..1a15e95267 100644 --- a/lib/security/rte_security.h +++ b/lib/security/rte_security.h @@ -302,7 +302,7 @@ struct rte_security_ipsec_lifetime { /**< Soft expiry limit in bytes */ uint64_t packets_hard_limit; - /**< Soft expiry limit in number of packets */ + /**< Hard expiry limit in number of packets */ uint64_t bytes_hard_limit; - /**< Soft expiry limit in bytes */ + /**< Hard expiry limit in bytes */ }; -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-05-10 13:24:22.210704514 +0100 +++ 0023-security-fix-SA-lifetime-comments.patch 2022-05-10 13:24:21.613646372 +0100 @@ -1 +1 @@ -From 99783e212140878153b1abfb65c10c975ca45201 Mon Sep 17 00:00:00 2001 +From be6637f158eaf3b4d1843decb4b25aad940c95c1 Mon Sep 17 00:00:00 2001 @@ -8,0 +9,2 @@ +[ upstream commit 99783e212140878153b1abfb65c10c975ca45201 ] + @@ -12 +13,0 @@ -Cc: stable@dpdk.org @@ -22 +23 @@ -index 2a43cbe811..675db940eb 100644 +index 1228b6c8b1..1a15e95267 100644 @@ -25 +26 @@ -@@ -312,7 +312,7 @@ struct rte_security_ipsec_lifetime { +@@ -302,7 +302,7 @@ struct rte_security_ipsec_lifetime {
Hi, FYI, your patch has been queued to stable release 21.11.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/15/22. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/8bad3a05f1b36f84717072dcf483fe11b705ac7d Thanks. Kevin --- From 8bad3a05f1b36f84717072dcf483fe11b705ac7d Mon Sep 17 00:00:00 2001 From: Raja Zidane <rzidane@nvidia.com> Date: Mon, 18 Apr 2022 14:05:16 +0300 Subject: [PATCH] crypto/mlx5: fix login cleanup [ upstream commit 146fe289de25cc3553894ed451066da6bc8b2789 ] In case of a probing failure caused by wrong devarg provided, login isn't destroyed when exiting. Destroy login on failure. Fixes: ba707cdb6da2 ("crypto/mlx5: fix queue size configuration") Signed-off-by: Raja Zidane <rzidane@nvidia.com> Acked-by: Matan Azrad <matan@nvidia.com> --- drivers/crypto/mlx5/mlx5_crypto.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/crypto/mlx5/mlx5_crypto.c b/drivers/crypto/mlx5/mlx5_crypto.c index 421c23748a..36db31aae5 100644 --- a/drivers/crypto/mlx5/mlx5_crypto.c +++ b/drivers/crypto/mlx5/mlx5_crypto.c @@ -953,4 +953,5 @@ mlx5_crypto_dev_probe(struct mlx5_common_device *cdev) cdev->config.hca_attr.max_wqe_sz_sq, devarg_prms.max_segs_num); if (ret) { + claim_zero(mlx5_devx_cmd_destroy(priv->login_obj)); mlx5_devx_uar_release(&priv->uar); rte_cryptodev_pmd_destroy(priv->crypto_dev); -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-05-10 13:24:22.231360583 +0100 +++ 0024-crypto-mlx5-fix-login-cleanup.patch 2022-05-10 13:24:21.614646374 +0100 @@ -1 +1 @@ -From 146fe289de25cc3553894ed451066da6bc8b2789 Mon Sep 17 00:00:00 2001 +From 8bad3a05f1b36f84717072dcf483fe11b705ac7d Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 146fe289de25cc3553894ed451066da6bc8b2789 ] + @@ -12 +13,0 @@ -Cc: stable@dpdk.org @@ -21 +22 @@ -index e14f867797..d0901f3b7c 100644 +index 421c23748a..36db31aae5 100644 @@ -24 +25 @@ -@@ -948,4 +948,5 @@ mlx5_crypto_dev_probe(struct mlx5_common_device *cdev, +@@ -953,4 +953,5 @@ mlx5_crypto_dev_probe(struct mlx5_common_device *cdev)
Hi, FYI, your patch has been queued to stable release 21.11.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/15/22. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/f72e482fec5398317d6eb012f05a8508b38cd612 Thanks. Kevin --- From f72e482fec5398317d6eb012f05a8508b38cd612 Mon Sep 17 00:00:00 2001 From: Gagandeep Singh <g.singh@nxp.com> Date: Thu, 28 Apr 2022 17:17:20 +0530 Subject: [PATCH] crypto/dpaa2_sec: fix fle buffer leak [ upstream commit 6a2b01a4106402be0aa50e3e3b1e5098e3a9b646 ] Driver allocates a fle buffer for each packet before enqueue and free the buffer on dequeue. But in case if there are enqueue failures, then code should free the fle buffers. Fixes: 4562de326d30 ("crypto/dpaa2_sec: support ordered queue") Fixes: 3ffce51a1f04 ("crypto/dpaa2_sec: add enqueue retry timeout") Signed-off-by: Gagandeep Singh <g.singh@nxp.com> Acked-by: Akhil Goyal <gakhil@marvell.com> --- drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 29 ++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c index 5b5c4f3639..9b461357c0 100644 --- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c +++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c @@ -2,5 +2,5 @@ * * Copyright (c) 2016 Freescale Semiconductor, Inc. All rights reserved. - * Copyright 2016-2021 NXP + * Copyright 2016-2022 NXP * */ @@ -53,4 +53,25 @@ uint8_t cryptodev_driver_id; +static inline void +free_fle(const struct qbman_fd *fd) +{ + struct qbman_fle *fle; + struct rte_crypto_op *op; + struct ctxt_priv *priv; + +#ifdef RTE_LIB_SECURITY + if (DPAA2_FD_GET_FORMAT(fd) == qbman_fd_single) + return; +#endif + fle = (struct qbman_fle *)DPAA2_IOVA_TO_VADDR(DPAA2_GET_FD_ADDR(fd)); + op = (struct rte_crypto_op *)DPAA2_GET_FLE_ADDR((fle - 1)); + /* free the fle memory */ + if (likely(rte_pktmbuf_is_contiguous(op->sym->m_src))) { + priv = (struct ctxt_priv *)(size_t)DPAA2_GET_FLE_CTXT(fle - 1); + rte_mempool_put(priv->fle_pool, (void *)(fle-1)); + } else + rte_free((void *)(fle-1)); +} + #ifdef RTE_LIB_SECURITY static inline int @@ -1502,4 +1523,10 @@ dpaa2_sec_enqueue_burst(void *qp, struct rte_crypto_op **ops, num_tx += loop; nb_ops -= loop; + DPAA2_SEC_DP_DEBUG("Enqueue fail\n"); + /* freeing the fle buffers */ + while (loop < frames_to_send) { + free_fle(&fd_arr[loop]); + loop++; + } goto skip_tx; } -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-05-10 13:24:22.251517466 +0100 +++ 0025-crypto-dpaa2_sec-fix-fle-buffer-leak.patch 2022-05-10 13:24:21.617646377 +0100 @@ -1 +1 @@ -From 6a2b01a4106402be0aa50e3e3b1e5098e3a9b646 Mon Sep 17 00:00:00 2001 +From f72e482fec5398317d6eb012f05a8508b38cd612 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 6a2b01a4106402be0aa50e3e3b1e5098e3a9b646 ] + @@ -12 +13,0 @@ -Cc: stable@dpdk.org @@ -17,2 +18,2 @@ - drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 35 ++++++++++++++++++++- - 1 file changed, 34 insertions(+), 1 deletion(-) + drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 29 ++++++++++++++++++++- + 1 file changed, 28 insertions(+), 1 deletion(-) @@ -21 +22 @@ -index e62d04852b..03fef5e500 100644 +index 5b5c4f3639..9b461357c0 100644 @@ -31,2 +32,2 @@ -@@ -65,4 +65,25 @@ uint8_t cryptodev_driver_id; - uint8_t dpaa2_sec_dp_dump = DPAA2_SEC_DP_ERR_DUMP; +@@ -53,4 +53,25 @@ + uint8_t cryptodev_driver_id; @@ -57,12 +58 @@ -@@ -1514,4 +1535,10 @@ dpaa2_sec_enqueue_burst(void *qp, struct rte_crypto_op **ops, - num_tx += loop; - nb_ops -= loop; -+ DPAA2_SEC_DP_DEBUG("Enqueue fail\n"); -+ /* freeing the fle buffers */ -+ while (loop < frames_to_send) { -+ free_fle(&fd_arr[loop]); -+ loop++; -+ } - goto skip_tx; - } -@@ -1855,4 +1882,10 @@ dpaa2_sec_enqueue_burst_ordered(void *qp, struct rte_crypto_op **ops, +@@ -1502,4 +1523,10 @@ dpaa2_sec_enqueue_burst(void *qp, struct rte_crypto_op **ops,
Hi, FYI, your patch has been queued to stable release 21.11.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/15/22. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/86ba4e206ec094503816b47b825752e14ca7c302 Thanks. Kevin --- From 86ba4e206ec094503816b47b825752e14ca7c302 Mon Sep 17 00:00:00 2001 From: Gagandeep Singh <g.singh@nxp.com> Date: Thu, 28 Apr 2022 17:17:21 +0530 Subject: [PATCH] crypto/dpaa2_sec: fix buffer pool ID check [ upstream commit e2b70a309f901b6aa947087a318ba0be3ea8782b ] Simple fd rely on bpid of the buffers whereas other FD types can support buffers without bpid of pool. So moving the bpid check to simple fd to mbuf conversion function. Fixes: 8d1f3a5d751b ("crypto/dpaa2_sec: support crypto operation") Signed-off-by: Gagandeep Singh <g.singh@nxp.com> Acked-by: Akhil Goyal <gakhil@marvell.com> --- drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c index 9b461357c0..c7651c3d6d 100644 --- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c +++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c @@ -1555,4 +1555,8 @@ sec_simple_fd_to_mbuf(const struct qbman_fd *fd) dpaa2_sec_session *sess_priv __rte_unused; + if (unlikely(DPAA2_GET_FD_IVP(fd))) { + DPAA2_SEC_ERR("error: non inline buffer"); + return NULL; + } struct rte_mbuf *mbuf = DPAA2_INLINE_MBUF_FROM_BUF( DPAA2_IOVA_TO_VADDR(DPAA2_GET_FD_ADDR(fd)), @@ -1601,9 +1605,4 @@ sec_fd_to_mbuf(const struct qbman_fd *fd) */ - if (unlikely(DPAA2_GET_FD_IVP(fd))) { - /* TODO complete it. */ - DPAA2_SEC_ERR("error: non inline buffer"); - return NULL; - } op = (struct rte_crypto_op *)DPAA2_GET_FLE_ADDR((fle - 1)); -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-05-10 13:24:22.274153225 +0100 +++ 0026-crypto-dpaa2_sec-fix-buffer-pool-ID-check.patch 2022-05-10 13:24:21.620646382 +0100 @@ -1 +1 @@ -From e2b70a309f901b6aa947087a318ba0be3ea8782b Mon Sep 17 00:00:00 2001 +From 86ba4e206ec094503816b47b825752e14ca7c302 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit e2b70a309f901b6aa947087a318ba0be3ea8782b ] + @@ -14 +15,0 @@ -Cc: stable@dpdk.org @@ -23 +24 @@ -index 03fef5e500..2374d67978 100644 +index 9b461357c0..c7651c3d6d 100644 @@ -26 +27 @@ -@@ -1567,4 +1567,8 @@ sec_simple_fd_to_mbuf(const struct qbman_fd *fd) +@@ -1555,4 +1555,8 @@ sec_simple_fd_to_mbuf(const struct qbman_fd *fd) @@ -35 +36 @@ -@@ -1613,9 +1617,4 @@ sec_fd_to_mbuf(const struct qbman_fd *fd) +@@ -1601,9 +1605,4 @@ sec_fd_to_mbuf(const struct qbman_fd *fd)
Hi, FYI, your patch has been queued to stable release 21.11.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/15/22. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/bee2c296c83b630a1d1bd809c232bc8e78f7f945 Thanks. Kevin --- From bee2c296c83b630a1d1bd809c232bc8e78f7f945 Mon Sep 17 00:00:00 2001 From: Gagandeep Singh <g.singh@nxp.com> Date: Thu, 28 Apr 2022 17:17:22 +0530 Subject: [PATCH] crypto/dpaa_sec: fix chained FD length in raw datapath [ upstream commit b5e761fc6be268f3894ca0bba1030fc53c2b3183 ] DPAA sec raw driver is calculating the wrong lengths while creating the FD for chain. This patch fixes lengths for chain FD. Fixes: 78156d38e112 ("crypto/dpaa_sec: support authonly and chain with raw API") Signed-off-by: Gagandeep Singh <g.singh@nxp.com> Acked-by: Akhil Goyal <gakhil@marvell.com> --- drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c b/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c index 522685f8cf..29f4e6d40b 100644 --- a/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c +++ b/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c @@ -1,4 +1,4 @@ /* SPDX-License-Identifier: BSD-3-Clause - * Copyright 2021 NXP + * Copyright 2021-2022 NXP */ @@ -398,6 +398,6 @@ build_dpaa_raw_dp_chain_fd(uint8_t *drv_ctx, uint16_t auth_hdr_len = ofs.ofs.cipher.head - ofs.ofs.auth.head; - uint16_t auth_tail_len = ofs.ofs.auth.tail; - uint32_t auth_only_len = (auth_tail_len << 16) | auth_hdr_len; + uint16_t auth_tail_len; + uint32_t auth_only_len; int data_len = 0, auth_len = 0, cipher_len = 0; @@ -407,4 +407,6 @@ build_dpaa_raw_dp_chain_fd(uint8_t *drv_ctx, cipher_len = data_len - ofs.ofs.cipher.head - ofs.ofs.cipher.tail; auth_len = data_len - ofs.ofs.auth.head - ofs.ofs.auth.tail; + auth_tail_len = auth_len - cipher_len - auth_hdr_len; + auth_only_len = (auth_tail_len << 16) | auth_hdr_len; if (sgl->num > MAX_SG_ENTRIES) { @@ -449,4 +451,5 @@ build_dpaa_raw_dp_chain_fd(uint8_t *drv_ctx, sg->length = dest_sgl->vec[i].len; } + sg->length -= ofs.ofs.cipher.tail; } else { qm_sg_entry_set64(sg, sgl->vec[0].iova); @@ -461,4 +464,5 @@ build_dpaa_raw_dp_chain_fd(uint8_t *drv_ctx, sg->length = sgl->vec[i].len; } + sg->length -= ofs.ofs.cipher.tail; } -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-05-10 13:24:22.296961238 +0100 +++ 0027-crypto-dpaa_sec-fix-chained-FD-length-in-raw-datapat.patch 2022-05-10 13:24:21.620646382 +0100 @@ -1 +1 @@ -From b5e761fc6be268f3894ca0bba1030fc53c2b3183 Mon Sep 17 00:00:00 2001 +From bee2c296c83b630a1d1bd809c232bc8e78f7f945 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit b5e761fc6be268f3894ca0bba1030fc53c2b3183 ] + @@ -11 +12,0 @@ -Cc: stable@dpdk.org
Hi, FYI, your patch has been queued to stable release 21.11.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/15/22. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/15a3ae1a5f67dd8d3f489a259191f9bd52587072 Thanks. Kevin --- From 15a3ae1a5f67dd8d3f489a259191f9bd52587072 Mon Sep 17 00:00:00 2001 From: Gagandeep Singh <g.singh@nxp.com> Date: Thu, 28 Apr 2022 17:17:23 +0530 Subject: [PATCH] crypto/dpaa2_sec: fix chained FD length in raw datapath [ upstream commit 46cc6dcc4112f9dbf4a3affbb37ea186e1c6c58f ] DPAA2 sec raw driver is calculating the wrong lengths while creating the FD for chain. This patch fixes lengths for chain FD. Fixes: aa6ec1fd8443 ("crypto/dpaa2_sec: support authenc with raw buffer API") Signed-off-by: Gagandeep Singh <g.singh@nxp.com> Acked-by: Akhil Goyal <gakhil@marvell.com> --- drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c index 74f2045637..e68a4875dd 100644 --- a/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c +++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c @@ -1,4 +1,4 @@ /* SPDX-License-Identifier: BSD-3-Clause - * Copyright 2021 NXP + * Copyright 2021-2022 NXP */ @@ -45,6 +45,6 @@ build_raw_dp_chain_fd(uint8_t *drv_ctx, ofs.ofs.auth.head; - uint16_t auth_tail_len = ofs.ofs.auth.tail; - uint32_t auth_only_len = (auth_tail_len << 16) | auth_hdr_len; + uint16_t auth_tail_len; + uint32_t auth_only_len; int icv_len = sess->digest_length; uint8_t *old_icv; @@ -56,4 +56,6 @@ build_raw_dp_chain_fd(uint8_t *drv_ctx, cipher_len = data_len - ofs.ofs.cipher.head - ofs.ofs.cipher.tail; auth_len = data_len - ofs.ofs.auth.head - ofs.ofs.auth.tail; + auth_tail_len = auth_len - cipher_len - auth_hdr_len; + auth_only_len = (auth_tail_len << 16) | auth_hdr_len; /* first FLE entry used to store session ctxt */ fle = (struct qbman_fle *)rte_malloc(NULL, @@ -105,4 +107,5 @@ build_raw_dp_chain_fd(uint8_t *drv_ctx, sge->length = dest_sgl->vec[i].len; } + sge->length -= ofs.ofs.cipher.tail; } else { /* Configure Output SGE for Encap/Decap */ @@ -118,4 +121,5 @@ build_raw_dp_chain_fd(uint8_t *drv_ctx, sge->length = sgl->vec[i].len; } + sge->length -= ofs.ofs.cipher.tail; } -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-05-10 13:24:22.316885583 +0100 +++ 0028-crypto-dpaa2_sec-fix-chained-FD-length-in-raw-datapa.patch 2022-05-10 13:24:21.621646383 +0100 @@ -1 +1 @@ -From 46cc6dcc4112f9dbf4a3affbb37ea186e1c6c58f Mon Sep 17 00:00:00 2001 +From 15a3ae1a5f67dd8d3f489a259191f9bd52587072 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 46cc6dcc4112f9dbf4a3affbb37ea186e1c6c58f ] + @@ -11 +12,0 @@ -Cc: stable@dpdk.org
Hi, FYI, your patch has been queued to stable release 21.11.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/15/22. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/4644779034e8d626bdf6e11c493ce75f6e5c72e4 Thanks. Kevin --- From 4644779034e8d626bdf6e11c493ce75f6e5c72e4 Mon Sep 17 00:00:00 2001 From: Vanshika Shukla <vanshika.shukla@nxp.com> Date: Thu, 28 Apr 2022 17:17:27 +0530 Subject: [PATCH] crypto/dpaa_sec: fix secondary process probing [ upstream commit 96ec64f12db163b47c4a69613c7e7347919ff54f ] DPAA hardware supports non-i/o performing secondary applications only. So we do not have to probe crypto devices in secondary applications. Fixes: c3e85bdcc6e6 ("crypto/dpaa_sec: add crypto driver for NXP DPAA platform") Signed-off-by: Vanshika Shukla <vanshika.shukla@nxp.com> Acked-by: Akhil Goyal <gakhil@marvell.com> --- drivers/crypto/dpaa_sec/dpaa_sec.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c index 98bc495c35..0a6126ad97 100644 --- a/drivers/crypto/dpaa_sec/dpaa_sec.c +++ b/drivers/crypto/dpaa_sec/dpaa_sec.c @@ -3555,4 +3555,7 @@ cryptodev_dpaa_sec_probe(struct rte_dpaa_driver *dpaa_drv __rte_unused, int retval; + if (rte_eal_process_type() != RTE_PROC_PRIMARY) + return 0; + snprintf(cryptodev_name, sizeof(cryptodev_name), "%s", dpaa_dev->name); @@ -3561,15 +3564,13 @@ cryptodev_dpaa_sec_probe(struct rte_dpaa_driver *dpaa_drv __rte_unused, return -ENOMEM; - if (rte_eal_process_type() == RTE_PROC_PRIMARY) { - cryptodev->data->dev_private = rte_zmalloc_socket( - "cryptodev private structure", - sizeof(struct dpaa_sec_dev_private), - RTE_CACHE_LINE_SIZE, - rte_socket_id()); + cryptodev->data->dev_private = rte_zmalloc_socket( + "cryptodev private structure", + sizeof(struct dpaa_sec_dev_private), + RTE_CACHE_LINE_SIZE, + rte_socket_id()); - if (cryptodev->data->dev_private == NULL) - rte_panic("Cannot allocate memzone for private " - "device data"); - } + if (cryptodev->data->dev_private == NULL) + rte_panic("Cannot allocate memzone for private " + "device data"); dpaa_dev->crypto_dev = cryptodev; @@ -3613,6 +3614,5 @@ cryptodev_dpaa_sec_probe(struct rte_dpaa_driver *dpaa_drv __rte_unused, out: /* In case of error, cleanup is done */ - if (rte_eal_process_type() == RTE_PROC_PRIMARY) - rte_free(cryptodev->data->dev_private); + rte_free(cryptodev->data->dev_private); rte_cryptodev_pmd_release_device(cryptodev); -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-05-10 13:24:22.336874110 +0100 +++ 0029-crypto-dpaa_sec-fix-secondary-process-probing.patch 2022-05-10 13:24:21.623646385 +0100 @@ -1 +1 @@ -From 96ec64f12db163b47c4a69613c7e7347919ff54f Mon Sep 17 00:00:00 2001 +From 4644779034e8d626bdf6e11c493ce75f6e5c72e4 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 96ec64f12db163b47c4a69613c7e7347919ff54f ] + @@ -11 +12,0 @@ -Cc: stable@dpdk.org @@ -20 +21 @@ -index 23a94d7e41..6f2b4baf57 100644 +index 98bc495c35..0a6126ad97 100644 @@ -23 +24 @@ -@@ -3767,4 +3767,7 @@ cryptodev_dpaa_sec_probe(struct rte_dpaa_driver *dpaa_drv __rte_unused, +@@ -3555,4 +3555,7 @@ cryptodev_dpaa_sec_probe(struct rte_dpaa_driver *dpaa_drv __rte_unused, @@ -31 +32 @@ -@@ -3773,15 +3776,13 @@ cryptodev_dpaa_sec_probe(struct rte_dpaa_driver *dpaa_drv __rte_unused, +@@ -3561,15 +3564,13 @@ cryptodev_dpaa_sec_probe(struct rte_dpaa_driver *dpaa_drv __rte_unused, @@ -55 +56 @@ -@@ -3825,6 +3826,5 @@ cryptodev_dpaa_sec_probe(struct rte_dpaa_driver *dpaa_drv __rte_unused, +@@ -3613,6 +3614,5 @@ cryptodev_dpaa_sec_probe(struct rte_dpaa_driver *dpaa_drv __rte_unused,
Hi, FYI, your patch has been queued to stable release 21.11.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/15/22. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/5e3a3f48d133a89176e07ce9ce91472c45acc673 Thanks. Kevin --- From 5e3a3f48d133a89176e07ce9ce91472c45acc673 Mon Sep 17 00:00:00 2001 From: Gagandeep Singh <g.singh@nxp.com> Date: Thu, 28 Apr 2022 17:17:29 +0530 Subject: [PATCH] crypto/dpaa2_sec: fix crypto operation pointer [ upstream commit e3d264383b560a447806d9ff478bad234fda5675 ] Driver is filling the crypto_op variable with an invalid value for atomic and ordered events which can results into segmentation fault. This patch assigning the correct crypto_op and event buffer pointers by extracting from FD. Fixes: a77db24643b7 ("crypto/dpaa2_sec: support atomic queues") Fixes: 4562de326d30 ("crypto/dpaa2_sec: support ordered queue") Signed-off-by: Gagandeep Singh <g.singh@nxp.com> Acked-by: Akhil Goyal <gakhil@marvell.com> --- drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c index c7651c3d6d..3bb78fa044 100644 --- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c +++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c @@ -3752,5 +3752,5 @@ dpaa2_sec_process_atomic_event(struct qbman_swp *swp __rte_unused, { uint8_t dqrr_index; - struct rte_crypto_op *crypto_op = (struct rte_crypto_op *)ev->event_ptr; + struct rte_crypto_op *crypto_op; /* Prefetching mbuf */ rte_prefetch0((void *)(size_t)(DPAA2_GET_FD_ADDR(fd)- @@ -3768,5 +3768,5 @@ dpaa2_sec_process_atomic_event(struct qbman_swp *swp __rte_unused, ev->priority = rxq->ev.priority; - ev->event_ptr = sec_fd_to_mbuf(fd); + crypto_op = sec_fd_to_mbuf(fd); dqrr_index = qbman_get_dqrr_idx(dq); *dpaa2_seqn(crypto_op->sym->m_src) = dqrr_index + 1; @@ -3774,4 +3774,5 @@ dpaa2_sec_process_atomic_event(struct qbman_swp *swp __rte_unused, DPAA2_PER_LCORE_DQRR_HELD |= 1 << dqrr_index; DPAA2_PER_LCORE_DQRR_MBUF(dqrr_index) = crypto_op->sym->m_src; + ev->event_ptr = crypto_op; } -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-05-10 13:24:22.360244950 +0100 +++ 0030-crypto-dpaa2_sec-fix-crypto-operation-pointer.patch 2022-05-10 13:24:21.626646389 +0100 @@ -1 +1 @@ -From e3d264383b560a447806d9ff478bad234fda5675 Mon Sep 17 00:00:00 2001 +From 5e3a3f48d133a89176e07ce9ce91472c45acc673 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit e3d264383b560a447806d9ff478bad234fda5675 ] + @@ -15 +16,0 @@ -Cc: stable@dpdk.org @@ -20,2 +21,2 @@ - drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 10 ++++++---- - 1 file changed, 6 insertions(+), 4 deletions(-) + drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) @@ -24 +25 @@ -index 86c8df241b..9f2b384af9 100644 +index c7651c3d6d..3bb78fa044 100644 @@ -27 +28,2 @@ -@@ -4020,5 +4020,5 @@ dpaa2_sec_process_atomic_event(struct qbman_swp *swp __rte_unused, +@@ -3752,5 +3752,5 @@ dpaa2_sec_process_atomic_event(struct qbman_swp *swp __rte_unused, + { @@ -29 +30,0 @@ - struct dpaa2_sec_qp *qp; @@ -34 +35 @@ -@@ -4037,5 +4037,5 @@ dpaa2_sec_process_atomic_event(struct qbman_swp *swp __rte_unused, +@@ -3768,5 +3768,5 @@ dpaa2_sec_process_atomic_event(struct qbman_swp *swp __rte_unused, @@ -37,2 +38,2 @@ -- ev->event_ptr = sec_fd_to_mbuf(fd, qp); -+ crypto_op = sec_fd_to_mbuf(fd, qp); +- ev->event_ptr = sec_fd_to_mbuf(fd); ++ crypto_op = sec_fd_to_mbuf(fd); @@ -40,2 +41,2 @@ - *dpaa2_seqn(crypto_op->sym->m_src) = QBMAN_ENQUEUE_FLAG_DCA | dqrr_index; -@@ -4043,4 +4043,5 @@ dpaa2_sec_process_atomic_event(struct qbman_swp *swp __rte_unused, + *dpaa2_seqn(crypto_op->sym->m_src) = dqrr_index + 1; +@@ -3774,4 +3774,5 @@ dpaa2_sec_process_atomic_event(struct qbman_swp *swp __rte_unused, @@ -44,20 +44,0 @@ -+ ev->event_ptr = crypto_op; - } - -@@ -4052,5 +4053,5 @@ dpaa2_sec_process_ordered_event(struct qbman_swp *swp, - struct rte_event *ev) - { -- struct rte_crypto_op *crypto_op = (struct rte_crypto_op *)ev->event_ptr; -+ struct rte_crypto_op *crypto_op; - struct dpaa2_sec_qp *qp; - -@@ -4070,5 +4071,5 @@ dpaa2_sec_process_ordered_event(struct qbman_swp *swp, - ev->queue_id = rxq->ev.queue_id; - ev->priority = rxq->ev.priority; -- ev->event_ptr = sec_fd_to_mbuf(fd, qp); -+ crypto_op = sec_fd_to_mbuf(fd, qp); - - *dpaa2_seqn(crypto_op->sym->m_src) = DPAA2_ENQUEUE_FLAG_ORP; -@@ -4079,4 +4080,5 @@ dpaa2_sec_process_ordered_event(struct qbman_swp *swp, - - qbman_swp_dqrr_consume(swp, dq);
Hi, FYI, your patch has been queued to stable release 21.11.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/15/22. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/5a9af71a6dc325a517585c6c53d9a57c7835a9ac Thanks. Kevin --- From 5a9af71a6dc325a517585c6c53d9a57c7835a9ac Mon Sep 17 00:00:00 2001 From: Gagandeep Singh <g.singh@nxp.com> Date: Thu, 28 Apr 2022 17:17:30 +0530 Subject: [PATCH] crypto/dpaa2_sec: fix operation status for simple FD [ upstream commit 04408e461e9dde8c921c851e0ad1611b178ce630 ] Driver is not filling the operation status on dequeue in case the FD is simple. So setting the status as per the results. Fixes: 0a23d4b6f4c2 ("crypto/dpaa2_sec: support protocol offload IPsec") Signed-off-by: Gagandeep Singh <g.singh@nxp.com> Acked-by: Akhil Goyal <gakhil@marvell.com> --- drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c index 3bb78fa044..c9745f1db0 100644 --- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c +++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c @@ -1577,4 +1577,12 @@ sec_simple_fd_to_mbuf(const struct qbman_fd *fd) mbuf->data_off += SEC_FLC_DHR_INBOUND; + if (unlikely(fd->simple.frc)) { + DPAA2_SEC_ERR("SEC returned Error - %x", + fd->simple.frc); + op->status = RTE_CRYPTO_OP_STATUS_ERROR; + } else { + op->status = RTE_CRYPTO_OP_STATUS_SUCCESS; + } + return op; } -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-05-10 13:24:22.382600447 +0100 +++ 0031-crypto-dpaa2_sec-fix-operation-status-for-simple-FD.patch 2022-05-10 13:24:21.628646392 +0100 @@ -1 +1 @@ -From 04408e461e9dde8c921c851e0ad1611b178ce630 Mon Sep 17 00:00:00 2001 +From 5a9af71a6dc325a517585c6c53d9a57c7835a9ac Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 04408e461e9dde8c921c851e0ad1611b178ce630 ] + @@ -12 +13,0 @@ -Cc: stable@dpdk.org @@ -21 +22 @@ -index 9f2b384af9..8444f1a795 100644 +index 3bb78fa044..c9745f1db0 100644 @@ -24 +25 @@ -@@ -1592,4 +1592,12 @@ sec_simple_fd_to_mbuf(const struct qbman_fd *fd) +@@ -1577,4 +1577,12 @@ sec_simple_fd_to_mbuf(const struct qbman_fd *fd)
Hi, FYI, your patch has been queued to stable release 21.11.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/15/22. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/aeca5959dde58d307e6c0016b651222638cd041c Thanks. Kevin --- From aeca5959dde58d307e6c0016b651222638cd041c Mon Sep 17 00:00:00 2001 From: Gagandeep Singh <g.singh@nxp.com> Date: Thu, 28 Apr 2022 17:17:33 +0530 Subject: [PATCH] common/dpaax: fix short MAC-I IV calculation for ZUC [ upstream commit c54fb3f7f77fa919673966227fd8964dbfbb3781 ] Fixing the IV calculation for ZUC based short MAC-I as per the HW security engine guidelines. Fixes: 73a24060cd70 ("crypto/dpaa2_sec: add sample PDCP descriptor APIs") Signed-off-by: Gagandeep Singh <g.singh@nxp.com> Acked-by: Akhil Goyal <gakhil@marvell.com> --- drivers/common/dpaax/caamflib/desc/pdcp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/common/dpaax/caamflib/desc/pdcp.h b/drivers/common/dpaax/caamflib/desc/pdcp.h index 8e8daf5ba8..2c9c631cfd 100644 --- a/drivers/common/dpaax/caamflib/desc/pdcp.h +++ b/drivers/common/dpaax/caamflib/desc/pdcp.h @@ -3796,5 +3796,5 @@ cnstr_shdsc_pdcp_short_mac(uint32_t *descbuf, } iv[0] = 0xFFFFFFFF; - iv[1] = swap ? swab32(0xFC000000) : 0xFC000000; + iv[1] = swab32(0xFC000000); iv[2] = 0x00000000; /* unused */ -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-05-10 13:24:22.404926814 +0100 +++ 0032-common-dpaax-fix-short-MAC-I-IV-calculation-for-ZUC.patch 2022-05-10 13:24:21.630646394 +0100 @@ -1 +1 @@ -From c54fb3f7f77fa919673966227fd8964dbfbb3781 Mon Sep 17 00:00:00 2001 +From aeca5959dde58d307e6c0016b651222638cd041c Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit c54fb3f7f77fa919673966227fd8964dbfbb3781 ] + @@ -10 +11,0 @@ -Cc: stable@dpdk.org @@ -19 +20 @@ -index 46153b9c29..289ee2a7d5 100644 +index 8e8daf5ba8..2c9c631cfd 100644 @@ -22,2 +23,2 @@ -@@ -3067,5 +3067,5 @@ cnstr_shdsc_pdcp_short_mac(uint32_t *descbuf, - case PDCP_AUTH_TYPE_ZUC: +@@ -3796,5 +3796,5 @@ cnstr_shdsc_pdcp_short_mac(uint32_t *descbuf, + }
Hi, FYI, your patch has been queued to stable release 21.11.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/15/22. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/28ecf49a60347951323c3e7e2246b63bcc2320a8 Thanks. Kevin --- From 28ecf49a60347951323c3e7e2246b63bcc2320a8 Mon Sep 17 00:00:00 2001 From: Raja Zidane <rzidane@nvidia.com> Date: Thu, 7 Apr 2022 14:42:49 +0300 Subject: [PATCH] examples/l2fwd-crypto: fix stats refresh rate [ upstream commit af676be9e6671b25c69af2aa5fc2d40d562137f6 ] TIMER_MILLISECOND is defined as the number of cpu cycles per millisecond, current definition is correct for cores with frequency of 2GHZ, for cores with different frequency, it caused different periods between refresh, (i.e. the definition is about 14ms on ARM cores). The devarg that stated the period between stats print was not used, instead, it was always defaulted to 10 seconds (on 2GHZ core). Use DPDK API to get CPU frequency, to define TIMER_MILLISECOND. Use the refresh period devarg instead of defaulting to 10s always. Fixes: 387259bd6c67 ("examples/l2fwd-crypto: add sample application") Signed-off-by: Raja Zidane <rzidane@nvidia.com> Acked-by: Matan Azrad <matan@nvidia.com> Acked-by: Akhil Goyal <gakhil@marvell.com> --- examples/l2fwd-crypto/main.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c index bbdb263143..b1e2613ccf 100644 --- a/examples/l2fwd-crypto/main.c +++ b/examples/l2fwd-crypto/main.c @@ -253,9 +253,7 @@ struct l2fwd_crypto_statistics crypto_statistics[RTE_CRYPTO_MAX_DEVS]; /* A tsc-based timer responsible for triggering statistics printout */ -#define TIMER_MILLISECOND 2000000ULL /* around 1ms at 2 Ghz */ +#define TIMER_MILLISECOND (rte_get_tsc_hz() / 1000) #define MAX_TIMER_PERIOD 86400UL /* 1 day max */ - -/* default period is 10 seconds */ -static int64_t timer_period = 10 * TIMER_MILLISECOND * 1000; +#define DEFAULT_TIMER_PERIOD 10UL /* Print out statistics on packets dropped */ @@ -895,5 +893,5 @@ l2fwd_main_loop(struct l2fwd_crypto_options *options) /* if timer is enabled */ - if (timer_period > 0) { + if (options->refresh_period > 0) { /* advance the timer */ @@ -902,9 +900,8 @@ l2fwd_main_loop(struct l2fwd_crypto_options *options) /* if timer has reached its timeout */ if (unlikely(timer_tsc >= - (uint64_t)timer_period)) { + options->refresh_period)) { /* do this only on main core */ - if (lcore_id == rte_get_main_lcore() - && options->refresh_period) { + if (lcore_id == rte_get_main_lcore()) { print_stats(); timer_tsc = 0; @@ -1482,5 +1479,6 @@ l2fwd_crypto_default_options(struct l2fwd_crypto_options *options) options->portmask = 0xffffffff; options->nb_ports_per_lcore = 1; - options->refresh_period = 10000; + options->refresh_period = DEFAULT_TIMER_PERIOD * + TIMER_MILLISECOND * 1000; options->single_lcore = 0; options->sessionless = 0; -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-05-10 13:24:22.426246248 +0100 +++ 0033-examples-l2fwd-crypto-fix-stats-refresh-rate.patch 2022-05-10 13:24:21.632646397 +0100 @@ -1 +1 @@ -From af676be9e6671b25c69af2aa5fc2d40d562137f6 Mon Sep 17 00:00:00 2001 +From 28ecf49a60347951323c3e7e2246b63bcc2320a8 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit af676be9e6671b25c69af2aa5fc2d40d562137f6 ] + @@ -17 +18,0 @@ -Cc: stable@dpdk.org