From d1c19aae07fc1940cea32a797e9bc9b23377f317 Mon Sep 17 00:00:00 2001 From: jiangheng12 Date: Wed, 12 Jul 2023 11:47:47 +0800 Subject: [PATCH] fix build with GCC 12 --- ...sking-wrong-warning-array-subscript-.patch | 46 +++ 0315-net-cnxk-fix-build-with-GCC-12.patch | 108 ++++++ ...net-cnxk-fix-build-with-optimization.patch | 44 +++ ...rypto-ipsec_mb-fix-build-with-GCC-12.patch | 73 ++++ 0318-net-ena-fix-build-with-GCC-12.patch | 65 ++++ 0319-net-enetfec-fix-build-with-GCC-12.patch | 71 ++++ 0320-net-ice-fix-build-with-GCC-12.patch | 56 +++ 0321-vdpa-ifc-fix-build-with-GCC-12.patch | 49 +++ ...-app-flow-perf-fix-build-with-GCC-12.patch | 134 +++++++ 0323-common-cpt-fix-build-with-GCC-12.patch | 113 ++++++ 0324-crypto-cnxk-fix-build-with-GCC-12.patch | 90 +++++ 0325-test-ipsec-fix-build-with-GCC-12.patch | 152 ++++++++ 0326-vhost-crypto-fix-build-with-GCC-12.patch | 221 ++++++++++++ ...ost-crypto-fix-descriptor-processing.patch | 40 +++ 0328-net-ice-base-fix-build-with-GCC-12.patch | 82 +++++ 0329-net-qede-fix-build-with-GCC-12.patch | 155 +++++++++ ...ormance-thread-fix-build-with-GCC-12.patch | 62 ++++ 0331-net-mvneta-fix-build-with-GCC-12.patch | 41 +++ 0332-test-ipsec-fix-build-with-GCC-12.patch | 58 +++ 0333-ipsec-fix-build-with-GCC-12.patch | 75 ++++ 0334-crypto-qat-fix-build-with-GCC-12.patch | 70 ++++ 0335-vhost-fix-build-with-GCC-12.patch | 100 ++++++ ...net-i40e-fix-build-with-MinGW-GCC-12.patch | 50 +++ ...de-base-fix-32-bit-build-with-GCC-12.patch | 53 +++ ...FNI-implementation-build-with-GCC-12.patch | 104 ++++++ ...amples-cmdline-fix-build-with-GCC-12.patch | 53 +++ ...-mlx5-fix-build-with-GCC-12-and-ASan.patch | 70 ++++ 0341-pdump-fix-build-with-GCC-12.patch | 84 +++++ ...ngling-pointer-by-mailbox-access-rew.patch | 329 ++++++++++++++++++ ...ples-l3fwd-fix-buffer-overflow-in-Tx.patch | 54 +++ dpdk.spec | 35 +- 31 files changed, 2736 insertions(+), 1 deletion(-) create mode 100644 0023-example-l3fwd-masking-wrong-warning-array-subscript-.patch create mode 100644 0315-net-cnxk-fix-build-with-GCC-12.patch create mode 100644 0316-net-cnxk-fix-build-with-optimization.patch create mode 100644 0317-crypto-ipsec_mb-fix-build-with-GCC-12.patch create mode 100644 0318-net-ena-fix-build-with-GCC-12.patch create mode 100644 0319-net-enetfec-fix-build-with-GCC-12.patch create mode 100644 0320-net-ice-fix-build-with-GCC-12.patch create mode 100644 0321-vdpa-ifc-fix-build-with-GCC-12.patch create mode 100644 0322-app-flow-perf-fix-build-with-GCC-12.patch create mode 100644 0323-common-cpt-fix-build-with-GCC-12.patch create mode 100644 0324-crypto-cnxk-fix-build-with-GCC-12.patch create mode 100644 0325-test-ipsec-fix-build-with-GCC-12.patch create mode 100644 0326-vhost-crypto-fix-build-with-GCC-12.patch create mode 100644 0327-vhost-crypto-fix-descriptor-processing.patch create mode 100644 0328-net-ice-base-fix-build-with-GCC-12.patch create mode 100644 0329-net-qede-fix-build-with-GCC-12.patch create mode 100644 0330-examples-performance-thread-fix-build-with-GCC-12.patch create mode 100644 0331-net-mvneta-fix-build-with-GCC-12.patch create mode 100644 0332-test-ipsec-fix-build-with-GCC-12.patch create mode 100644 0333-ipsec-fix-build-with-GCC-12.patch create mode 100644 0334-crypto-qat-fix-build-with-GCC-12.patch create mode 100644 0335-vhost-fix-build-with-GCC-12.patch create mode 100644 0336-net-i40e-fix-build-with-MinGW-GCC-12.patch create mode 100644 0337-net-qede-base-fix-32-bit-build-with-GCC-12.patch create mode 100644 0338-hash-fix-GFNI-implementation-build-with-GCC-12.patch create mode 100644 0339-examples-cmdline-fix-build-with-GCC-12.patch create mode 100644 0340-net-mlx5-fix-build-with-GCC-12-and-ASan.patch create mode 100644 0341-pdump-fix-build-with-GCC-12.patch create mode 100644 0342-net-cxgbe-fix-dangling-pointer-by-mailbox-access-rew.patch create mode 100644 0343-examples-l3fwd-fix-buffer-overflow-in-Tx.patch diff --git a/0023-example-l3fwd-masking-wrong-warning-array-subscript-.patch b/0023-example-l3fwd-masking-wrong-warning-array-subscript-.patch new file mode 100644 index 0000000..11d404e --- /dev/null +++ b/0023-example-l3fwd-masking-wrong-warning-array-subscript-.patch @@ -0,0 +1,46 @@ +From 2889419e10a68fad89df35350a1ea5e41e4cbf35 Mon Sep 17 00:00:00 2001 +From: j00660176 +Date: Wed, 12 Jul 2023 16:39:56 +0800 +Subject: [PATCH] example/l3fwd: masking wrong warning array subscript [0] is + partly outside array bounds + +GCC 12 raises the following warning: +In file included from ../examples/l3fwd/l3fwd_lpm_neon.h:11, + from ../examples/l3fwd/l3fwd_lpm.c:135: +../examples/l3fwd/l3fwd_neon.h: In function 'port_groupx4': +../examples/l3fwd/l3fwd_neon.h:95:21: error: array subscript 'union [0]' is partly outside array bounds of 'uint16_t[5]' {aka 'short unsigned int[5]'} [-Werror=array-bounds] + 95 | pnum->u64 = gptbl[v].pnum; + | ^~ +../examples/l3fwd/l3fwd_neon.h:74:23: note: object 'pn' of size [0, 10] + 74 | port_groupx4(uint16_t pn[FWDSTEP + 1], uint16_t *lp, uint16x8_t dp1, + | ~~~~~~~~~^~~~~~~~~~~~~~~ +../examples/l3fwd/l3fwd_neon.h:96:21: error: array subscript 'union [0]' is partly outside array bounds of 'uint16_t[5]' {aka 'short unsigned int[5]'} [-Werror=array-bounds] + 96 | pnum->u16[FWDSTEP] = 1; + | ^~ +../examples/l3fwd/l3fwd_neon.h:74:23: note: object 'pn' of size [0, 10] + 74 | port_groupx4(uint16_t pn[FWDSTEP + 1], uint16_t *lp, uint16x8_t dp1, + | ~~~~~~~~~^~~~~~~~~~~~~~~ +cc1: all warnings being treated as errors + +according to the code review, this is a wrong warning: +pnum's size is uint16_t * 5 = 10, FWDSTEP is 4, line 96 access pnum->[4]; lin95 access accesses a 64-bit value, taking up the first four elements of a number. +due to patch 0002-dpdk-add-secure-compile-option-and-fPIC-option.patch, it treats warnings as errors. so the l3fwd compilation fails. +--- + examples/l3fwd/meson.build | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/examples/l3fwd/meson.build b/examples/l3fwd/meson.build +index 0830b3e..827206e 100644 +--- a/examples/l3fwd/meson.build ++++ b/examples/l3fwd/meson.build +@@ -7,6 +7,8 @@ + # DPDK instance, use 'make' + + allow_experimental_apis = true ++cflags += ['-Wno-array-bounds'] ++ + deps += ['hash', 'lpm', 'fib', 'eventdev'] + sources = files( + 'l3fwd_em.c', +-- +2.33.0 diff --git a/0315-net-cnxk-fix-build-with-GCC-12.patch b/0315-net-cnxk-fix-build-with-GCC-12.patch new file mode 100644 index 0000000..a5b08b3 --- /dev/null +++ b/0315-net-cnxk-fix-build-with-GCC-12.patch @@ -0,0 +1,108 @@ +From b8bfbcd1a04b143151da9688eaefc9f7b72ccc12 Mon Sep 17 00:00:00 2001 +From: Rakesh Kudurumalla +Date: Wed, 23 Feb 2022 15:25:40 +0530 +Subject: [PATCH] net/cnxk: fix build with GCC 12 + +[ upstream commit b526599020ef06811dd08c4f15c0cdf049d7f9f2 ] + +Resolve following compilation error with gcc 12 version. +error: storing the address of local variable message in *error.message + +Fixes: 26b034f78ca7 ("net/cnxk: support to validate meter policy") + +Reported-by: Ferruh Yigit +Signed-off-by: Rakesh Kudurumalla +Acked-by: Jerin Jacob +--- + drivers/net/cnxk/cnxk_ethdev_mtr.c | 59 ++++++++++++++++++++++-------- + 1 file changed, 44 insertions(+), 15 deletions(-) + +diff --git a/drivers/net/cnxk/cnxk_ethdev_mtr.c b/drivers/net/cnxk/cnxk_ethdev_mtr.c +index 39d8563826..6d14c88e7d 100644 +--- a/drivers/net/cnxk/cnxk_ethdev_mtr.c ++++ b/drivers/net/cnxk/cnxk_ethdev_mtr.c +@@ -277,15 +277,54 @@ cnxk_nix_mtr_profile_delete(struct rte_eth_dev *eth_dev, uint32_t profile_id, + return 0; + } + ++static int ++update_mtr_err(uint32_t act_color, struct rte_mtr_error *error, bool action) ++{ ++ const char *str; ++ switch (act_color) { ++ case RTE_COLOR_GREEN: ++ if (action) { ++ str = "Green action is not valid"; ++ goto notsup; ++ } else { ++ str = "Green action is null"; ++ goto notvalid; ++ } ++ break; ++ case RTE_COLOR_YELLOW: ++ if (action) { ++ str = "Yellow action is not valid"; ++ goto notsup; ++ } else { ++ str = "Yellow action is null"; ++ goto notvalid; ++ } ++ break; ++ case RTE_COLOR_RED: ++ if (action) { ++ str = "Red action is not valid"; ++ goto notsup; ++ } else { ++ str = "Red action is null"; ++ goto notvalid; ++ } ++ break; ++ } ++notsup: ++ return -rte_mtr_error_set(error, ENOTSUP, ++ RTE_MTR_ERROR_TYPE_METER_POLICY, NULL, str); ++notvalid: ++ return -rte_mtr_error_set(error, EINVAL, ++ RTE_MTR_ERROR_TYPE_METER_POLICY, NULL, str); ++} ++ + static int + cnxk_nix_mtr_policy_validate(struct rte_eth_dev *dev, + struct rte_mtr_meter_policy_params *policy, + struct rte_mtr_error *error) + { +- static const char *const action_color[] = {"Green", "Yellow", "Red"}; + bool supported[RTE_COLORS] = {false, false, false}; + const struct rte_flow_action *action; +- char message[1024]; + uint32_t i; + + RTE_SET_USED(dev); +@@ -304,21 +343,11 @@ cnxk_nix_mtr_policy_validate(struct rte_eth_dev *dev, + if (action->type == RTE_FLOW_ACTION_TYPE_DROP) + supported[i] = true; + +- if (!supported[i]) { +- sprintf(message, +- "%s action is not valid", +- action_color[i]); +- return -rte_mtr_error_set(error, +- ENOTSUP, +- RTE_MTR_ERROR_TYPE_METER_POLICY, NULL, +- message); +- } ++ if (!supported[i]) ++ return update_mtr_err(i, error, true); + } + } else { +- sprintf(message, "%s action is null", action_color[i]); +- return -rte_mtr_error_set(error, EINVAL, +- RTE_MTR_ERROR_TYPE_METER_POLICY, NULL, +- message); ++ return update_mtr_err(i, error, false); + } + } + +-- +2.23.0 + diff --git a/0316-net-cnxk-fix-build-with-optimization.patch b/0316-net-cnxk-fix-build-with-optimization.patch new file mode 100644 index 0000000..70981ed --- /dev/null +++ b/0316-net-cnxk-fix-build-with-optimization.patch @@ -0,0 +1,44 @@ +From 213001231857c9af72f8f0288c43773b1ac2d580 Mon Sep 17 00:00:00 2001 +From: Rakesh Kudurumalla +Date: Fri, 4 Mar 2022 19:53:37 +0530 +Subject: [PATCH] net/cnxk: fix build with optimization +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +[ upstream commit 68f8a52a6b0ad6b77772d4564928aebb21c2ca66 ] + +Fix the following build error seen with --optimization=1 and +GCC 10.3.0. + +drivers/net/cnxk/cnxk_ethdev_mtr.c: In function +‘cnxk_nix_mtr_policy_validate’: +lib/ethdev/rte_mtr_driver.h:188:10: error: ‘str’ may be used +uninitialized in this function [-Werror=maybe-uninitialized] + +Bugzilla ID: 939 +Bugzilla ID: 992 +Fixes: b526599020ef ("net/cnxk: fix build with GCC 12") + +Reported-by: Ferruh Yigit +Signed-off-by: Rakesh Kudurumalla +--- + drivers/net/cnxk/cnxk_ethdev_mtr.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/cnxk/cnxk_ethdev_mtr.c b/drivers/net/cnxk/cnxk_ethdev_mtr.c +index 6d14c88e7d..b6ccccdc39 100644 +--- a/drivers/net/cnxk/cnxk_ethdev_mtr.c ++++ b/drivers/net/cnxk/cnxk_ethdev_mtr.c +@@ -280,7 +280,7 @@ cnxk_nix_mtr_profile_delete(struct rte_eth_dev *eth_dev, uint32_t profile_id, + static int + update_mtr_err(uint32_t act_color, struct rte_mtr_error *error, bool action) + { +- const char *str; ++ const char *str = NULL; + switch (act_color) { + case RTE_COLOR_GREEN: + if (action) { +-- +2.23.0 + diff --git a/0317-crypto-ipsec_mb-fix-build-with-GCC-12.patch b/0317-crypto-ipsec_mb-fix-build-with-GCC-12.patch new file mode 100644 index 0000000..782ec22 --- /dev/null +++ b/0317-crypto-ipsec_mb-fix-build-with-GCC-12.patch @@ -0,0 +1,73 @@ +From c86456efc916bff6ecb9b6ab9664c9409d1a3fe2 Mon Sep 17 00:00:00 2001 +From: David Marchand +Date: Wed, 18 May 2022 12:16:48 +0200 +Subject: [PATCH] crypto/ipsec_mb: fix build with GCC 12 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +[ upstream commit 468f31eb71c4c2aa454841b316766514cabd0f02 ] + +GCC 12 raises the following warning: + +In function ‘__rte_ring_enqueue_elems_64’, + inlined from ‘__rte_ring_enqueue_elems’ at + ../lib/ring/rte_ring_elem_pvt.h:130:3, + inlined from ‘__rte_ring_do_hts_enqueue_elem’ at + ../lib/ring/rte_ring_hts_elem_pvt.h:196:3, + inlined from ‘rte_ring_mp_hts_enqueue_burst_elem’ at + ../lib/ring/rte_ring_hts.h:110:9, + inlined from ‘rte_ring_enqueue_burst_elem’ at + ../lib/ring/rte_ring_elem.h:577:10, + inlined from ‘rte_ring_enqueue_burst’ at + ../lib/ring/rte_ring.h:738:9, + inlined from ‘process_op_bit’ at + ../drivers/crypto/ipsec_mb/pmd_snow3g.c:425:16, + inlined from ‘snow3g_pmd_dequeue_burst’ at + ../drivers/crypto/ipsec_mb/pmd_snow3g.c:484:20: +../lib/ring/rte_ring_elem_pvt.h:68:44: error: array subscript 1 is + outside array bounds of ‘struct rte_crypto_op[0]’ + [-Werror=array-bounds] + 68 | ring[idx + 1] = obj[i + 1]; + | ~~~^~~~~~~ +../drivers/crypto/ipsec_mb/pmd_snow3g.c: In function + ‘snow3g_pmd_dequeue_burst’: +../drivers/crypto/ipsec_mb/pmd_snow3g.c:434:1: note: + at offset 8 into object ‘op’ of size 8 + 434 | snow3g_pmd_dequeue_burst(void *queue_pair, + | ^~~~~~~~~~~~~~~~~~~~~~~~ + +Validate that one (exactly) op has been processed or return early. + +Fixes: b537abdbee74 ("crypto/snow3g: support bit-level operations") + +Signed-off-by: David Marchand +Acked-by: Stephen Hemminger +--- + drivers/crypto/ipsec_mb/pmd_snow3g.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/drivers/crypto/ipsec_mb/pmd_snow3g.c b/drivers/crypto/ipsec_mb/pmd_snow3g.c +index ebc9a0b562..9a85f46721 100644 +--- a/drivers/crypto/ipsec_mb/pmd_snow3g.c ++++ b/drivers/crypto/ipsec_mb/pmd_snow3g.c +@@ -422,12 +422,13 @@ process_op_bit(struct rte_crypto_op *op, struct snow3g_session *session, + op->sym->session = NULL; + } + +- enqueued_op = rte_ring_enqueue_burst(qp->ingress_queue, +- (void **)&op, processed_op, NULL); ++ if (unlikely(processed_op != 1)) ++ return 0; ++ enqueued_op = rte_ring_enqueue(qp->ingress_queue, op); + qp->stats.enqueued_count += enqueued_op; + *accumulated_enqueued_ops += enqueued_op; + +- return enqueued_op; ++ return 1; + } + + static uint16_t +-- +2.23.0 + diff --git a/0318-net-ena-fix-build-with-GCC-12.patch b/0318-net-ena-fix-build-with-GCC-12.patch new file mode 100644 index 0000000..0dba83d --- /dev/null +++ b/0318-net-ena-fix-build-with-GCC-12.patch @@ -0,0 +1,65 @@ +From 9c1822f59fc41558231b6e67d6feac5a225fcbdb Mon Sep 17 00:00:00 2001 +From: David Marchand +Date: Wed, 18 May 2022 12:16:49 +0200 +Subject: [PATCH] net/ena: fix build with GCC 12 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +[ upstream commit 2449949584667fbb275df1ea5a5ceeead1a65786 ] + +GCC 12 raises the following warning: + +In file included from ../lib/mempool/rte_mempool.h:46, + from ../lib/mbuf/rte_mbuf.h:38, + from ../lib/net/rte_ether.h:22, + from ../drivers/net/ena/ena_ethdev.h:10, + from ../drivers/net/ena/ena_rss.c:6: +../drivers/net/ena/ena_rss.c: In function ‘ena_rss_key_fill’: +../lib/eal/x86/include/rte_memcpy.h:370:9: warning: array subscript 64 is + outside array bounds of ‘uint8_t[40]’ + {aka ‘unsigned char[40]’} [-Warray-bounds] + 370 | rte_mov32((uint8_t *)dst + 2 * 32, (const uint8_t *)src + 2 * 32); + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +../drivers/net/ena/ena_rss.c:51:24: note: while referencing ‘default_key’ + 51 | static uint8_t default_key[ENA_HASH_KEY_SIZE]; + | ^~~~~~~~~~~ + +This is a false positive because the copied size is checked against +ENA_HASH_KEY_SIZE in a (build) assert. +Silence this warning by calling memcpy with the minimal size. + +Bugzilla ID: 849 + +Signed-off-by: David Marchand +Acked-by: Stephen Hemminger +--- + drivers/net/ena/ena_rss.c | 7 +++---- + 1 file changed, 3 insertions(+), 4 deletions(-) + +diff --git a/drivers/net/ena/ena_rss.c b/drivers/net/ena/ena_rss.c +index be4007e3f3..8193eaf6fc 100644 +--- a/drivers/net/ena/ena_rss.c ++++ b/drivers/net/ena/ena_rss.c +@@ -51,15 +51,14 @@ void ena_rss_key_fill(void *key, size_t size) + static uint8_t default_key[ENA_HASH_KEY_SIZE]; + size_t i; + +- RTE_ASSERT(size <= ENA_HASH_KEY_SIZE); +- + if (!key_generated) { +- for (i = 0; i < ENA_HASH_KEY_SIZE; ++i) ++ for (i = 0; i < RTE_DIM(default_key); ++i) + default_key[i] = rte_rand() & 0xff; + key_generated = true; + } + +- rte_memcpy(key, default_key, size); ++ RTE_ASSERT(size <= sizeof(default_key)); ++ rte_memcpy(key, default_key, RTE_MIN(size, sizeof(default_key))); + } + + int ena_rss_reta_update(struct rte_eth_dev *dev, +-- +2.23.0 + diff --git a/0319-net-enetfec-fix-build-with-GCC-12.patch b/0319-net-enetfec-fix-build-with-GCC-12.patch new file mode 100644 index 0000000..2bc13e4 --- /dev/null +++ b/0319-net-enetfec-fix-build-with-GCC-12.patch @@ -0,0 +1,71 @@ +From ac8e3a7546ecf4c0b0a753c1efd8327e3a3e96f1 Mon Sep 17 00:00:00 2001 +From: David Marchand +Date: Wed, 18 May 2022 12:16:50 +0200 +Subject: [PATCH] net/enetfec: fix build with GCC 12 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +[ upstream commit 7c3c0d0f290cfc03dc0e75013af8035b450ee114 ] + +GCC 12 raises the following warning: + +../drivers/net/enetfec/enet_ethdev.c: In function + ‘enetfec_rx_queue_setup’: +../drivers/net/enetfec/enet_ethdev.c:473:9: error: array + subscript 1 is + above array bounds of ‘uint32_t[1]’ {aka ‘unsigned int[1]’} + [-Werror=array-bounds] + 473 | rte_write32(rte_cpu_to_le_32(fep->bd_addr_p_r[queue_idx]), + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 474 | (uint8_t *)fep->hw_baseaddr_v + ENETFEC_RD_START(queue_idx)); + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +In file included from ../drivers/net/enetfec/enet_ethdev.c:9: +../drivers/net/enetfec/enet_ethdev.h:113:33: note: while referencing + ‘bd_addr_p_r’ + 113 | uint32_t bd_addr_p_r[ENETFEC_MAX_Q]; + | ^~~~~~~~~~~ + +This driver properly announces that it only supports 1 rxq. +Silence this warning by adding an explicit check on the queue id. + +Signed-off-by: David Marchand +Acked-by: Stephen Hemminger +Acked-by: Sachin Saxena +--- + drivers/net/enetfec/enet_ethdev.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/drivers/net/enetfec/enet_ethdev.c b/drivers/net/enetfec/enet_ethdev.c +index 714f8ac7ec..c938e58204 100644 +--- a/drivers/net/enetfec/enet_ethdev.c ++++ b/drivers/net/enetfec/enet_ethdev.c +@@ -2,9 +2,12 @@ + * Copyright 2020-2021 NXP + */ + ++#include ++ + #include + #include + #include ++ + #include "enet_pmd_logs.h" + #include "enet_ethdev.h" + #include "enet_regs.h" +@@ -454,6 +457,12 @@ enetfec_rx_queue_setup(struct rte_eth_dev *dev, + return -EINVAL; + } + ++ if (queue_idx >= ENETFEC_MAX_Q) { ++ ENETFEC_PMD_ERR("Invalid queue id %" PRIu16 ", max %d\n", ++ queue_idx, ENETFEC_MAX_Q); ++ return -EINVAL; ++ } ++ + /* allocate receive queue */ + rxq = rte_zmalloc(NULL, sizeof(*rxq), RTE_CACHE_LINE_SIZE); + if (rxq == NULL) { +-- +2.23.0 + diff --git a/0320-net-ice-fix-build-with-GCC-12.patch b/0320-net-ice-fix-build-with-GCC-12.patch new file mode 100644 index 0000000..a1fedd7 --- /dev/null +++ b/0320-net-ice-fix-build-with-GCC-12.patch @@ -0,0 +1,56 @@ +From ec6a2fa05c425c42071d164c82d46d0f62ff2e1c Mon Sep 17 00:00:00 2001 +From: David Marchand +Date: Wed, 18 May 2022 12:16:51 +0200 +Subject: [PATCH] net/ice: fix build with GCC 12 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +[ upstream commit 20d6a017e148cc1944d85d4c80a0151a5b4c6436 ] + +GCC 12 raises the following warning: + +In file included from ../lib/mempool/rte_mempool.h:46, + from ../lib/mbuf/rte_mbuf.h:38, + from ../lib/net/rte_ether.h:22, + from ../lib/ethdev/rte_ethdev.h:172, + from ../lib/ethdev/ethdev_driver.h:22, + from ../lib/ethdev/ethdev_pci.h:17, + from ../drivers/net/ice/ice_ethdev.c:6: +../drivers/net/ice/ice_ethdev.c: In function ‘ice_dev_configure’: +../lib/eal/x86/include/rte_memcpy.h:370:9: warning: array subscript 64 is + outside array bounds of ‘struct ice_aqc_get_set_rss_keys[1]’ + [-Warray-bounds] + 370 | rte_mov32((uint8_t *)dst + 2 * 32, (const uint8_t *)src + 2 * 32); + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +../drivers/net/ice/ice_ethdev.c:3202:41: note: while referencing ‘key’ + 3202 | struct ice_aqc_get_set_rss_keys key; + | ^~~ + +Restrict copy to minimum size. + +Bugzilla ID: 850 + +Signed-off-by: David Marchand +Acked-by: Stephen Hemminger +--- + drivers/net/ice/ice_ethdev.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c +index ab3976a319..7df1b4ec19 100644 +--- a/drivers/net/ice/ice_ethdev.c ++++ b/drivers/net/ice/ice_ethdev.c +@@ -3235,7 +3235,8 @@ static int ice_init_rss(struct ice_pf *pf) + RTE_MIN(rss_conf->rss_key_len, + vsi->rss_key_size)); + +- rte_memcpy(key.standard_rss_key, vsi->rss_key, vsi->rss_key_size); ++ rte_memcpy(key.standard_rss_key, vsi->rss_key, ++ RTE_MIN(sizeof(key.standard_rss_key), vsi->rss_key_size)); + ret = ice_aq_set_rss_key(hw, vsi->idx, &key); + if (ret) + goto out; +-- +2.23.0 + diff --git a/0321-vdpa-ifc-fix-build-with-GCC-12.patch b/0321-vdpa-ifc-fix-build-with-GCC-12.patch new file mode 100644 index 0000000..608843f --- /dev/null +++ b/0321-vdpa-ifc-fix-build-with-GCC-12.patch @@ -0,0 +1,49 @@ +From f85d0fc3975bb20a6cdbbef21408f3d8d00e2a3f Mon Sep 17 00:00:00 2001 +From: David Marchand +Date: Wed, 18 May 2022 12:16:54 +0200 +Subject: [PATCH] vdpa/ifc: fix build with GCC 12 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +[ upstream commit 2a213b794fdd255fde7581a7c9bd034ab39e9b6a ] + +GCC 12 raises the following warning: + +../drivers/vdpa/ifc/ifcvf_vdpa.c: In function ‘vdpa_enable_vfio_intr’: +../drivers/vdpa/ifc/ifcvf_vdpa.c:383:62: error: writing 4 bytes into a + region of size 0 [-Werror=stringop-overflow=] + 383 | fd_ptr[RTE_INTR_VEC_RXTX_OFFSET + i] = fd; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~ +../drivers/vdpa/ifc/ifcvf_vdpa.c:348:14: note: at offset 32 into + destination object ‘irq_set_buf’ of size 32 + 348 | char irq_set_buf[MSIX_IRQ_SET_BUF_LEN]; + | ^~~~~~~~~~~ + +Validate number of vrings to avoid out of bound access. + +Bugzilla ID: 855 + +Signed-off-by: David Marchand +Acked-by: Xiao Wang +Acked-by: Stephen Hemminger +--- + drivers/vdpa/ifc/ifcvf_vdpa.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.c +index 3853c4cf7e..6a915b0d5e 100644 +--- a/drivers/vdpa/ifc/ifcvf_vdpa.c ++++ b/drivers/vdpa/ifc/ifcvf_vdpa.c +@@ -356,6 +356,8 @@ vdpa_enable_vfio_intr(struct ifcvf_internal *internal, bool m_rx) + vring.callfd = -1; + + nr_vring = rte_vhost_get_vring_num(internal->vid); ++ if (nr_vring > IFCVF_MAX_QUEUES * 2) ++ return -1; + + irq_set = (struct vfio_irq_set *)irq_set_buf; + irq_set->argsz = sizeof(irq_set_buf); +-- +2.23.0 + diff --git a/0322-app-flow-perf-fix-build-with-GCC-12.patch b/0322-app-flow-perf-fix-build-with-GCC-12.patch new file mode 100644 index 0000000..faf27f7 --- /dev/null +++ b/0322-app-flow-perf-fix-build-with-GCC-12.patch @@ -0,0 +1,134 @@ +From 675b5bdf2c1434493f508f6cf909e33ed0e019b5 Mon Sep 17 00:00:00 2001 +From: David Marchand +Date: Wed, 18 May 2022 12:16:56 +0200 +Subject: [PATCH] app/flow-perf: fix build with GCC 12 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +[ upstream commit 5fc2eece8d4530988e5681fdc8a35e14d69b2a6f ] + +GCC 12 raises the following warning: + +../app/test-flow-perf/main.c: In function ‘start_forwarding’: +../app/test-flow-perf/main.c:1737:28: error: ‘sprintf’ may write a + terminating nul past the end of the destination + [-Werror=format-overflow=] + 1737 | sprintf(p[i++], "%d", (int)n); + | ^ +In function ‘pretty_number’, + inlined from ‘packet_per_second_stats’ at + ../app/test-flow-perf/main.c:1792:4, + inlined from ‘start_forwarding’ at + ../app/test-flow-perf/main.c:1831:3: +[...] + +We can simplify this code and rely on libc integer formatting via +this system locales. + +Bugzilla ID: 856 + +Signed-off-by: David Marchand +Acked-by: Bruce Richardson +Acked-by: Stephen Hemminger +--- + app/test-flow-perf/main.c | 48 ++++++++------------------------------- + 1 file changed, 9 insertions(+), 39 deletions(-) + +diff --git a/app/test-flow-perf/main.c b/app/test-flow-perf/main.c +index 56d43734e3..f375097028 100644 +--- a/app/test-flow-perf/main.c ++++ b/app/test-flow-perf/main.c +@@ -16,6 +16,7 @@ + * gives packet per second measurement. + */ + ++#include + #include + #include + #include +@@ -1713,36 +1714,6 @@ do_tx(struct lcore_info *li, uint16_t cnt, uint16_t tx_port, + rte_pktmbuf_free(li->pkts[i]); + } + +-/* +- * Method to convert numbers into pretty numbers that easy +- * to read. The design here is to add comma after each three +- * digits and set all of this inside buffer. +- * +- * For example if n = 1799321, the output will be +- * 1,799,321 after this method which is easier to read. +- */ +-static char * +-pretty_number(uint64_t n, char *buf) +-{ +- char p[6][4]; +- int i = 0; +- int off = 0; +- +- while (n > 1000) { +- sprintf(p[i], "%03d", (int)(n % 1000)); +- n /= 1000; +- i += 1; +- } +- +- sprintf(p[i++], "%d", (int)n); +- +- while (i--) +- off += sprintf(buf + off, "%s,", p[i]); +- buf[strlen(buf) - 1] = '\0'; +- +- return buf; +-} +- + static void + packet_per_second_stats(void) + { +@@ -1764,7 +1735,6 @@ packet_per_second_stats(void) + uint64_t total_rx_pkts = 0; + uint64_t total_tx_drops = 0; + uint64_t tx_delta, rx_delta, drops_delta; +- char buf[3][32]; + int nr_valid_core = 0; + + sleep(1); +@@ -1789,10 +1759,8 @@ packet_per_second_stats(void) + tx_delta = li->tx_pkts - oli->tx_pkts; + rx_delta = li->rx_pkts - oli->rx_pkts; + drops_delta = li->tx_drops - oli->tx_drops; +- printf("%6d %16s %16s %16s\n", i, +- pretty_number(tx_delta, buf[0]), +- pretty_number(drops_delta, buf[1]), +- pretty_number(rx_delta, buf[2])); ++ printf("%6d %'16"PRId64" %'16"PRId64" %'16"PRId64"\n", ++ i, tx_delta, drops_delta, rx_delta); + + total_tx_pkts += tx_delta; + total_rx_pkts += rx_delta; +@@ -1803,10 +1771,9 @@ packet_per_second_stats(void) + } + + if (nr_valid_core > 1) { +- printf("%6s %16s %16s %16s\n", "total", +- pretty_number(total_tx_pkts, buf[0]), +- pretty_number(total_tx_drops, buf[1]), +- pretty_number(total_rx_pkts, buf[2])); ++ printf("%6s %'16"PRId64" %'16"PRId64" %'16"PRId64"\n", ++ "total", total_tx_pkts, total_tx_drops, ++ total_rx_pkts); + nr_lines += 1; + } + +@@ -2139,6 +2106,9 @@ main(int argc, char **argv) + if (argc > 1) + args_parse(argc, argv); + ++ /* For more fancy, localised integer formatting. */ ++ setlocale(LC_NUMERIC, ""); ++ + init_port(); + + nb_lcores = rte_lcore_count(); +-- +2.23.0 + diff --git a/0323-common-cpt-fix-build-with-GCC-12.patch b/0323-common-cpt-fix-build-with-GCC-12.patch new file mode 100644 index 0000000..ed498bb --- /dev/null +++ b/0323-common-cpt-fix-build-with-GCC-12.patch @@ -0,0 +1,113 @@ +From 978835ed87a361a24e0c4424f1a352d13fb7bfac Mon Sep 17 00:00:00 2001 +From: Ankur Dwivedi +Date: Fri, 17 Jun 2022 19:09:29 +0530 +Subject: [PATCH] common/cpt: fix build with GCC 12 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +[ upstream commit 3aa16821ab3e0a21052880fbf4dcb76801380c31 ] + +The following warning is observed with GCC 12 compilation: + +In function ‘fill_sg_comp_from_iov’, + inlined from ‘cpt_zuc_snow3g_enc_prep’ at + ../drivers/common/cpt/cpt_ucode.h:1672:9, + inlined from ‘cpt_fc_enc_hmac_prep’ at + ../drivers/common/cpt/cpt_ucode.h:2472:3, + inlined from ‘fill_digest_params’ at + ../drivers/common/cpt/cpt_ucode.h:3548:14, + inlined from ‘otx_cpt_enq_single_sym’ at + ../drivers/crypto/octeontx/otx_cryptodev_ops.c:541:9, + inlined from ‘otx_cpt_enq_single_sym_sessless’ at + ../drivers/crypto/octeontx/otx_cryptodev_ops.c:584:8, + inlined from ‘otx_cpt_enq_single’ at + ../drivers/crypto/octeontx/otx_cryptodev_ops.c:611:11, + inlined from ‘otx_cpt_pkt_enqueue’ at + ../drivers/crypto/octeontx/otx_cryptodev_ops.c:643:9, + inlined from ‘otx_cpt_enqueue_sym’ at + ../drivers/crypto/octeontx/otx_cryptodev_ops.c:668:9: +../drivers/common/cpt/cpt_ucode.h:415:36: warning: array subscript 0 is +outside array bounds of ‘buf_ptr_t[0]’ {aka ‘struct buf_ptr[]’} +[-Warray-bounds] + 415 | e_dma_addr = bufs[j].dma_addr; + | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ +../drivers/common/cpt/cpt_ucode.h:416:48: warning: array subscript 0 is +outside array bounds of ‘buf_ptr_t[0]’ {aka ‘struct buf_ptr[]’} +[-Warray-bounds] + 416 | e_len = (size > bufs[j].size) ? + | ~~~~~~~^~~~~ + +This patch resolves the warning. + +Bugzilla ID: 861 +Fixes: 9be415daf469 ("common/cpt: add common defines for microcode") +Fixes: b74652f3a91f ("common/cpt: add microcode interface for encryption") + +Signed-off-by: Ankur Dwivedi +Reviewed-by: Anoob Joseph +Reviewed-by: Jerin Jacob +Tested-by: David Marchand +--- + drivers/common/cpt/cpt_mcode_defines.h | 2 +- + drivers/common/cpt/cpt_ucode.h | 21 ++++++++++----------- + 2 files changed, 11 insertions(+), 12 deletions(-) + +diff --git a/drivers/common/cpt/cpt_mcode_defines.h b/drivers/common/cpt/cpt_mcode_defines.h +index f16ee44297..e6dcb7674c 100644 +--- a/drivers/common/cpt/cpt_mcode_defines.h ++++ b/drivers/common/cpt/cpt_mcode_defines.h +@@ -387,7 +387,7 @@ typedef struct buf_ptr { + /* IOV Pointer */ + typedef struct{ + int buf_cnt; +- buf_ptr_t bufs[0]; ++ buf_ptr_t bufs[]; + } iov_ptr_t; + + typedef struct fc_params { +diff --git a/drivers/common/cpt/cpt_ucode.h b/drivers/common/cpt/cpt_ucode.h +index e1f2f6005d..22aabab6ac 100644 +--- a/drivers/common/cpt/cpt_ucode.h ++++ b/drivers/common/cpt/cpt_ucode.h +@@ -394,27 +394,26 @@ fill_sg_comp_from_iov(sg_comp_t *list, + int32_t j; + uint32_t extra_len = extra_buf ? extra_buf->size : 0; + uint32_t size = *psize; +- buf_ptr_t *bufs; + +- bufs = from->bufs; + for (j = 0; (j < from->buf_cnt) && size; j++) { ++ phys_addr_t dma_addr = from->bufs[j].dma_addr; ++ uint32_t buf_sz = from->bufs[j].size; ++ sg_comp_t *to = &list[i >> 2]; + phys_addr_t e_dma_addr; + uint32_t e_len; +- sg_comp_t *to = &list[i >> 2]; + + if (unlikely(from_offset)) { +- if (from_offset >= bufs[j].size) { +- from_offset -= bufs[j].size; ++ if (from_offset >= buf_sz) { ++ from_offset -= buf_sz; + continue; + } +- e_dma_addr = bufs[j].dma_addr + from_offset; +- e_len = (size > (bufs[j].size - from_offset)) ? +- (bufs[j].size - from_offset) : size; ++ e_dma_addr = dma_addr + from_offset; ++ e_len = (size > (buf_sz - from_offset)) ? ++ (buf_sz - from_offset) : size; + from_offset = 0; + } else { +- e_dma_addr = bufs[j].dma_addr; +- e_len = (size > bufs[j].size) ? +- bufs[j].size : size; ++ e_dma_addr = dma_addr; ++ e_len = (size > buf_sz) ? buf_sz : size; + } + + to->u.s.len[i % 4] = rte_cpu_to_be_16(e_len); +-- +2.23.0 + diff --git a/0324-crypto-cnxk-fix-build-with-GCC-12.patch b/0324-crypto-cnxk-fix-build-with-GCC-12.patch new file mode 100644 index 0000000..02b8985 --- /dev/null +++ b/0324-crypto-cnxk-fix-build-with-GCC-12.patch @@ -0,0 +1,90 @@ +From e0bff8480fce6437124558f49f608f214c9092be Mon Sep 17 00:00:00 2001 +From: Ankur Dwivedi +Date: Fri, 17 Jun 2022 19:09:30 +0530 +Subject: [PATCH] crypto/cnxk: fix build with GCC 12 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +[ upstream commit d82d2db2659411059c047a96e867666625a0f1f2 ] + +The following warning is observed with GCC 12 compilation: + +In file included from ../drivers/crypto/cnxk/cn10k_cryptodev_ops.c:17: +In function ‘fill_sg_comp_from_iov’, + inlined from ‘cpt_pdcp_chain_alg_prep’ at + ../drivers/crypto/cnxk/cnxk_se.h:1194:8, + inlined from ‘cpt_fc_enc_hmac_prep’ at + ../drivers/crypto/cnxk/cnxk_se.h:1871:9, + inlined from ‘fill_digest_params’ at + ../drivers/crypto/cnxk/cnxk_se.h:2829:8, + inlined from ‘cpt_sym_inst_fill’ at + ../drivers/crypto/cnxk/cn10k_cryptodev_ops.c:92:9, + inlined from ‘cn10k_cpt_fill_inst.constprop’ at + ../drivers/crypto/cnxk/cn10k_cryptodev_ops.c:146:10: +../drivers/crypto/cnxk/cnxk_se.h:222:52: warning: array subscript 0 is +outside array bounds of ‘struct roc_se_buf_ptr[0]’ [-Warray-bounds] + 222 | e_vaddr = (uint64_t)bufs[j].vaddr; + | ~~~~~~~^~~~~~ +../drivers/crypto/cnxk/cnxk_se.h:223:48: warning: array subscript 0 is +outside array bounds of ‘struct roc_se_buf_ptr[0]’ [-Warray-bounds] + 223 | e_len = (size > bufs[j].size) ? bufs[j].size : size; + | ~~~~~~~^~~~~ + +This patch resolves the warning. + +Fixes: 3de331795f73 ("crypto/cnxk: add flexi cipher encryption") + +Signed-off-by: Ankur Dwivedi +Reviewed-by: Anoob Joseph +Reviewed-by: Jerin Jacob +Tested-by: David Marchand +--- + drivers/crypto/cnxk/cnxk_se.h | 20 ++++++++++---------- + 1 file changed, 10 insertions(+), 10 deletions(-) + +diff --git a/drivers/crypto/cnxk/cnxk_se.h b/drivers/crypto/cnxk/cnxk_se.h +index 37237de21a..99a2894fa6 100644 +--- a/drivers/crypto/cnxk/cnxk_se.h ++++ b/drivers/crypto/cnxk/cnxk_se.h +@@ -179,27 +179,27 @@ fill_sg_comp_from_iov(struct roc_se_sglist_comp *list, uint32_t i, + int32_t j; + uint32_t extra_len = extra_buf ? extra_buf->size : 0; + uint32_t size = *psize; +- struct roc_se_buf_ptr *bufs; + +- bufs = from->bufs; + for (j = 0; (j < from->buf_cnt) && size; j++) { ++ struct roc_se_sglist_comp *to = &list[i >> 2]; ++ uint32_t buf_sz = from->bufs[j].size; ++ void *vaddr = from->bufs[j].vaddr; + uint64_t e_vaddr; + uint32_t e_len; +- struct roc_se_sglist_comp *to = &list[i >> 2]; + + if (unlikely(from_offset)) { +- if (from_offset >= bufs[j].size) { +- from_offset -= bufs[j].size; ++ if (from_offset >= buf_sz) { ++ from_offset -= buf_sz; + continue; + } +- e_vaddr = (uint64_t)bufs[j].vaddr + from_offset; +- e_len = (size > (bufs[j].size - from_offset)) ? +- (bufs[j].size - from_offset) : ++ e_vaddr = (uint64_t)vaddr + from_offset; ++ e_len = (size > (buf_sz - from_offset)) ? ++ (buf_sz - from_offset) : + size; + from_offset = 0; + } else { +- e_vaddr = (uint64_t)bufs[j].vaddr; +- e_len = (size > bufs[j].size) ? bufs[j].size : size; ++ e_vaddr = (uint64_t)vaddr; ++ e_len = (size > buf_sz) ? buf_sz : size; + } + + to->u.s.len[i % 4] = rte_cpu_to_be_16(e_len); +-- +2.23.0 + diff --git a/0325-test-ipsec-fix-build-with-GCC-12.patch b/0325-test-ipsec-fix-build-with-GCC-12.patch new file mode 100644 index 0000000..e74fae9 --- /dev/null +++ b/0325-test-ipsec-fix-build-with-GCC-12.patch @@ -0,0 +1,152 @@ +From 9445fcf1388068915ae4c0cebbac527482b39215 Mon Sep 17 00:00:00 2001 +From: David Marchand +Date: Thu, 16 Jun 2022 11:33:20 +0200 +Subject: [PATCH] test/ipsec: fix build with GCC 12 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +[ upstream commit 6e108b6a7c0c0699e6304f7b5706736b34d32607 ] + +GCC 12 raises the following warning: + +In function ‘_mm256_loadu_si256’, + inlined from ‘rte_mov32’ at + ../lib/eal/x86/include/rte_memcpy.h:319:9, + inlined from ‘rte_mov128’ at + ../lib/eal/x86/include/rte_memcpy.h:344:2, + inlined from ‘rte_memcpy_generic’ at + ../lib/eal/x86/include/rte_memcpy.h:438:4, + inlined from ‘rte_memcpy’ at + ../lib/eal/x86/include/rte_memcpy.h:882:10, + inlined from ‘setup_test_string.constprop’ at + ../app/test/test_ipsec.c:572:4: +/usr/lib/gcc/x86_64-redhat-linux/12/include/avxintrin.h:929:10: error: + array subscript ‘__m256i_u[3]’ is partly outside array bounds of + ‘const char[108]’ [-Werror=array-bounds] + 929 | return *__P; + | ^~~~ +../app/test/test_ipsec.c: In function ‘setup_test_string.constprop’: +../app/test/test_ipsec.c:539:12: note: at offset 96 into object + ‘null_plain_data’ of size 108 + 539 | const char null_plain_data[] = + | ^~~~~~~~~~~~~~~ + +Add a hint so that the compiler understands the copied data is within +the passed string boundaries. + +Bugzilla ID: 848 +Fixes: 05fe65eb66b2 ("test/ipsec: introduce functional test") + +Signed-off-by: David Marchand +--- + app/test/test_ipsec.c | 35 ++++++++++++++++++++++------------- + 1 file changed, 22 insertions(+), 13 deletions(-) + +diff --git a/app/test/test_ipsec.c b/app/test/test_ipsec.c +index bc2a3dbc2e..3c6dcdc604 100644 +--- a/app/test/test_ipsec.c ++++ b/app/test/test_ipsec.c +@@ -543,12 +543,14 @@ struct rte_ipv4_hdr ipv4_outer = { + }; + + static struct rte_mbuf * +-setup_test_string(struct rte_mempool *mpool, +- const char *string, size_t len, uint8_t blocksize) ++setup_test_string(struct rte_mempool *mpool, const char *string, ++ size_t string_len, size_t len, uint8_t blocksize) + { + struct rte_mbuf *m = rte_pktmbuf_alloc(mpool); + size_t t_len = len - (blocksize ? (len % blocksize) : 0); + ++ RTE_VERIFY(len <= string_len); ++ + if (m) { + memset(m->buf_addr, 0, m->buf_len); + char *dst = rte_pktmbuf_append(m, t_len); +@@ -1354,7 +1356,8 @@ test_ipsec_crypto_outb_burst_null_null(int i) + /* Generate input mbuf data */ + for (j = 0; j < num_pkts && rc == 0; j++) { + ut_params->ibuf[j] = setup_test_string(ts_params->mbuf_pool, +- null_plain_data, test_cfg[i].pkt_sz, 0); ++ null_plain_data, sizeof(null_plain_data), ++ test_cfg[i].pkt_sz, 0); + if (ut_params->ibuf[j] == NULL) + rc = TEST_FAILED; + else { +@@ -1472,7 +1475,8 @@ test_ipsec_inline_crypto_inb_burst_null_null(int i) + /* Generate test mbuf data */ + ut_params->obuf[j] = setup_test_string( + ts_params->mbuf_pool, +- null_plain_data, test_cfg[i].pkt_sz, 0); ++ null_plain_data, sizeof(null_plain_data), ++ test_cfg[i].pkt_sz, 0); + if (ut_params->obuf[j] == NULL) + rc = TEST_FAILED; + } +@@ -1540,16 +1544,17 @@ test_ipsec_inline_proto_inb_burst_null_null(int i) + + /* Generate inbound mbuf data */ + for (j = 0; j < num_pkts && rc == 0; j++) { +- ut_params->ibuf[j] = setup_test_string( +- ts_params->mbuf_pool, +- null_plain_data, test_cfg[i].pkt_sz, 0); ++ ut_params->ibuf[j] = setup_test_string(ts_params->mbuf_pool, ++ null_plain_data, sizeof(null_plain_data), ++ test_cfg[i].pkt_sz, 0); + if (ut_params->ibuf[j] == NULL) + rc = TEST_FAILED; + else { + /* Generate test mbuf data */ + ut_params->obuf[j] = setup_test_string( + ts_params->mbuf_pool, +- null_plain_data, test_cfg[i].pkt_sz, 0); ++ null_plain_data, sizeof(null_plain_data), ++ test_cfg[i].pkt_sz, 0); + if (ut_params->obuf[j] == NULL) + rc = TEST_FAILED; + } +@@ -1649,7 +1654,8 @@ test_ipsec_inline_crypto_outb_burst_null_null(int i) + /* Generate test mbuf data */ + for (j = 0; j < num_pkts && rc == 0; j++) { + ut_params->ibuf[j] = setup_test_string(ts_params->mbuf_pool, +- null_plain_data, test_cfg[i].pkt_sz, 0); ++ null_plain_data, sizeof(null_plain_data), ++ test_cfg[i].pkt_sz, 0); + if (ut_params->ibuf[0] == NULL) + rc = TEST_FAILED; + +@@ -1727,15 +1733,17 @@ test_ipsec_inline_proto_outb_burst_null_null(int i) + /* Generate test mbuf data */ + for (j = 0; j < num_pkts && rc == 0; j++) { + ut_params->ibuf[j] = setup_test_string(ts_params->mbuf_pool, +- null_plain_data, test_cfg[i].pkt_sz, 0); ++ null_plain_data, sizeof(null_plain_data), ++ test_cfg[i].pkt_sz, 0); + if (ut_params->ibuf[0] == NULL) + rc = TEST_FAILED; + + if (rc == 0) { + /* Generate test tunneled mbuf data for comparison */ + ut_params->obuf[j] = setup_test_string( +- ts_params->mbuf_pool, +- null_plain_data, test_cfg[i].pkt_sz, 0); ++ ts_params->mbuf_pool, null_plain_data, ++ sizeof(null_plain_data), test_cfg[i].pkt_sz, ++ 0); + if (ut_params->obuf[j] == NULL) + rc = TEST_FAILED; + } +@@ -1804,7 +1812,8 @@ test_ipsec_lksd_proto_inb_burst_null_null(int i) + for (j = 0; j < num_pkts && rc == 0; j++) { + /* packet with sequence number 0 is invalid */ + ut_params->ibuf[j] = setup_test_string(ts_params->mbuf_pool, +- null_encrypted_data, test_cfg[i].pkt_sz, 0); ++ null_encrypted_data, sizeof(null_encrypted_data), ++ test_cfg[i].pkt_sz, 0); + if (ut_params->ibuf[j] == NULL) + rc = TEST_FAILED; + } +-- +2.23.0 + diff --git a/0326-vhost-crypto-fix-build-with-GCC-12.patch b/0326-vhost-crypto-fix-build-with-GCC-12.patch new file mode 100644 index 0000000..e177c3f --- /dev/null +++ b/0326-vhost-crypto-fix-build-with-GCC-12.patch @@ -0,0 +1,221 @@ +From f69a61bde0e2d72021fd3c609fd4b62edc8f8951 Mon Sep 17 00:00:00 2001 +From: David Marchand +Date: Thu, 16 Jun 2022 16:46:50 +0200 +Subject: [PATCH] vhost/crypto: fix build with GCC 12 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +[ upstream commit 4414bb67010dfec2559af52efe8f479b26d55447 ] + +GCC 12 raises the following warning: + +In file included from ../lib/mempool/rte_mempool.h:46, + from ../lib/mbuf/rte_mbuf.h:38, + from ../lib/vhost/vhost_crypto.c:7: +../lib/vhost/vhost_crypto.c: In function ‘rte_vhost_crypto_fetch_requests’: +../lib/eal/x86/include/rte_memcpy.h:371:9: warning: array subscript 1 is + outside array bounds of ‘struct virtio_crypto_op_data_req[1]’ + [-Warray-bounds] + 371 | rte_mov32((uint8_t *)dst + 3 * 32, (const uint8_t *)src + 3 * 32); + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +../lib/vhost/vhost_crypto.c:1178:42: note: while referencing ‘req’ + 1178 | struct virtio_crypto_op_data_req req; + | ^~~ + +Split this function and separate the per descriptor copy. +This makes the code clearer, and the compiler happier. + +Note: logs for errors have been moved to callers to avoid duplicates. + +Fixes: 3c79609fda7c ("vhost/crypto: handle virtually non-contiguous buffers") + +Signed-off-by: David Marchand +Reviewed-by: Maxime Coquelin +--- + lib/vhost/vhost_crypto.c | 123 +++++++++++++++------------------------ + 1 file changed, 46 insertions(+), 77 deletions(-) + +diff --git a/lib/vhost/vhost_crypto.c b/lib/vhost/vhost_crypto.c +index 926b5c0bd9..293960d350 100644 +--- a/lib/vhost/vhost_crypto.c ++++ b/lib/vhost/vhost_crypto.c +@@ -565,94 +565,58 @@ get_data_ptr(struct vhost_crypto_data_req *vc_req, + return data; + } + +-static __rte_always_inline int +-copy_data(void *dst_data, struct vhost_crypto_data_req *vc_req, +- struct vhost_crypto_desc *head, +- struct vhost_crypto_desc **cur_desc, +- uint32_t size, uint32_t max_n_descs) ++static __rte_always_inline uint32_t ++copy_data_from_desc(void *dst, struct vhost_crypto_data_req *vc_req, ++ struct vhost_crypto_desc *desc, uint32_t size) + { +- struct vhost_crypto_desc *desc = *cur_desc; +- uint64_t remain, addr, dlen, len; +- uint32_t to_copy; +- uint8_t *data = dst_data; +- uint8_t *src; +- int left = size; +- +- to_copy = RTE_MIN(desc->len, (uint32_t)left); +- dlen = to_copy; +- src = IOVA_TO_VVA(uint8_t *, vc_req, desc->addr, &dlen, +- VHOST_ACCESS_RO); +- if (unlikely(!src || !dlen)) +- return -1; ++ uint64_t remain; ++ uint64_t addr; ++ ++ remain = RTE_MIN(desc->len, size); ++ addr = desc->addr; ++ do { ++ uint64_t len; ++ void *src; ++ ++ len = remain; ++ src = IOVA_TO_VVA(void *, vc_req, addr, &len, VHOST_ACCESS_RO); ++ if (unlikely(src == NULL || len == 0)) ++ return 0; + +- rte_memcpy((uint8_t *)data, src, dlen); +- data += dlen; ++ rte_memcpy(dst, src, len); ++ remain -= len; ++ /* cast is needed for 32-bit architecture */ ++ dst = RTE_PTR_ADD(dst, (size_t)len); ++ addr += len; ++ } while (unlikely(remain != 0)); + +- if (unlikely(dlen < to_copy)) { +- remain = to_copy - dlen; +- addr = desc->addr + dlen; ++ return RTE_MIN(desc->len, size); ++} + +- while (remain) { +- len = remain; +- src = IOVA_TO_VVA(uint8_t *, vc_req, addr, &len, +- VHOST_ACCESS_RO); +- if (unlikely(!src || !len)) { +- VC_LOG_ERR("Failed to map descriptor"); +- return -1; +- } + +- rte_memcpy(data, src, len); +- addr += len; +- remain -= len; +- data += len; +- } +- } ++static __rte_always_inline int ++copy_data(void *data, struct vhost_crypto_data_req *vc_req, ++ struct vhost_crypto_desc *head, struct vhost_crypto_desc **cur_desc, ++ uint32_t size, uint32_t max_n_descs) ++{ ++ struct vhost_crypto_desc *desc = *cur_desc; ++ uint32_t left = size; + +- left -= to_copy; ++ do { ++ uint32_t copied; + +- while (desc >= head && desc - head < (int)max_n_descs && left) { +- desc++; +- to_copy = RTE_MIN(desc->len, (uint32_t)left); +- dlen = to_copy; +- src = IOVA_TO_VVA(uint8_t *, vc_req, desc->addr, &dlen, +- VHOST_ACCESS_RO); +- if (unlikely(!src || !dlen)) { +- VC_LOG_ERR("Failed to map descriptor"); ++ copied = copy_data_from_desc(data, vc_req, desc, left); ++ if (copied == 0) + return -1; +- } +- +- rte_memcpy(data, src, dlen); +- data += dlen; +- +- if (unlikely(dlen < to_copy)) { +- remain = to_copy - dlen; +- addr = desc->addr + dlen; +- +- while (remain) { +- len = remain; +- src = IOVA_TO_VVA(uint8_t *, vc_req, addr, &len, +- VHOST_ACCESS_RO); +- if (unlikely(!src || !len)) { +- VC_LOG_ERR("Failed to map descriptor"); +- return -1; +- } +- +- rte_memcpy(data, src, len); +- addr += len; +- remain -= len; +- data += len; +- } +- } +- +- left -= to_copy; +- } ++ left -= copied; ++ data = RTE_PTR_ADD(data, copied); ++ desc++; ++ } while (desc < head + max_n_descs && left != 0); + +- if (unlikely(left > 0)) { +- VC_LOG_ERR("Incorrect virtio descriptor"); ++ if (unlikely(left != 0)) + return -1; +- } + +- if (unlikely(desc - head == (int)max_n_descs)) ++ if (unlikely(desc == head + max_n_descs)) + *cur_desc = NULL; + else + *cur_desc = desc + 1; +@@ -852,6 +816,7 @@ prepare_sym_cipher_op(struct vhost_crypto *vcrypto, struct rte_crypto_op *op, + /* iv */ + if (unlikely(copy_data(iv_data, vc_req, head, &desc, + cipher->para.iv_len, max_n_descs))) { ++ VC_LOG_ERR("Incorrect virtio descriptor"); + ret = VIRTIO_CRYPTO_BADMSG; + goto error_exit; + } +@@ -883,6 +848,7 @@ prepare_sym_cipher_op(struct vhost_crypto *vcrypto, struct rte_crypto_op *op, + if (unlikely(copy_data(rte_pktmbuf_mtod(m_src, uint8_t *), + vc_req, head, &desc, cipher->para.src_data_len, + max_n_descs) < 0)) { ++ VC_LOG_ERR("Incorrect virtio descriptor"); + ret = VIRTIO_CRYPTO_BADMSG; + goto error_exit; + } +@@ -1006,6 +972,7 @@ prepare_sym_chain_op(struct vhost_crypto *vcrypto, struct rte_crypto_op *op, + /* iv */ + if (unlikely(copy_data(iv_data, vc_req, head, &desc, + chain->para.iv_len, max_n_descs) < 0)) { ++ VC_LOG_ERR("Incorrect virtio descriptor"); + ret = VIRTIO_CRYPTO_BADMSG; + goto error_exit; + } +@@ -1037,6 +1004,7 @@ prepare_sym_chain_op(struct vhost_crypto *vcrypto, struct rte_crypto_op *op, + if (unlikely(copy_data(rte_pktmbuf_mtod(m_src, uint8_t *), + vc_req, head, &desc, chain->para.src_data_len, + max_n_descs) < 0)) { ++ VC_LOG_ERR("Incorrect virtio descriptor"); + ret = VIRTIO_CRYPTO_BADMSG; + goto error_exit; + } +@@ -1121,6 +1089,7 @@ prepare_sym_chain_op(struct vhost_crypto *vcrypto, struct rte_crypto_op *op, + if (unlikely(copy_data(digest_addr, vc_req, head, &digest_desc, + chain->para.hash_result_len, + max_n_descs) < 0)) { ++ VC_LOG_ERR("Incorrect virtio descriptor"); + ret = VIRTIO_CRYPTO_BADMSG; + goto error_exit; + } +-- +2.23.0 + diff --git a/0327-vhost-crypto-fix-descriptor-processing.patch b/0327-vhost-crypto-fix-descriptor-processing.patch new file mode 100644 index 0000000..96f47e3 --- /dev/null +++ b/0327-vhost-crypto-fix-descriptor-processing.patch @@ -0,0 +1,40 @@ +From d6e4e0f46e27a5eae66ce436b522c7602accf346 Mon Sep 17 00:00:00 2001 +From: David Marchand +Date: Wed, 22 Jun 2022 17:30:20 +0200 +Subject: [PATCH] vhost/crypto: fix descriptor processing + +[ upstream commit 2fbada91545c004f04449500af0c6276900317ab ] + +copy_data was returning a pointer to an increased (off by one) descriptor. +Subsequent calls to copy_data in the library were then failing. +Fix this by incrementing the descriptor only if there is some left data +to copy. + +Fixes: 4414bb67010d ("vhost/crypto: fix build with GCC 12") + +Reported-by: Jakub Poczatek +Signed-off-by: David Marchand +Reviewed-by: Maxime Coquelin +Tested-by: Jakub Poczatek +Acked-by: Fan Zhang +--- + lib/vhost/vhost_crypto.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/lib/vhost/vhost_crypto.c b/lib/vhost/vhost_crypto.c +index 293960d350..7d1d6a1861 100644 +--- a/lib/vhost/vhost_crypto.c ++++ b/lib/vhost/vhost_crypto.c +@@ -610,8 +610,7 @@ copy_data(void *data, struct vhost_crypto_data_req *vc_req, + return -1; + left -= copied; + data = RTE_PTR_ADD(data, copied); +- desc++; +- } while (desc < head + max_n_descs && left != 0); ++ } while (left != 0 && ++desc < head + max_n_descs); + + if (unlikely(left != 0)) + return -1; +-- +2.23.0 + diff --git a/0328-net-ice-base-fix-build-with-GCC-12.patch b/0328-net-ice-base-fix-build-with-GCC-12.patch new file mode 100644 index 0000000..1559b6c --- /dev/null +++ b/0328-net-ice-base-fix-build-with-GCC-12.patch @@ -0,0 +1,82 @@ +From cca0819d488f62311320a08fbd669a21fccf4818 Mon Sep 17 00:00:00 2001 +From: Wenxuan Wu +Date: Thu, 23 Jun 2022 17:01:05 +0800 +Subject: [PATCH] net/ice/base: fix build with GCC 12 + +[ upstream commit 3e87e12dc8bcb1d06dafcb302b056fee51deb090 ] + +GCC 12 with -O2 flag would raise the following warning: +../drivers/net/ice/base/ice_switch.c:7220:61: error: writing 1 byte into a +region of size 0 [-Werror=stringop-overflow=] + 7220 | buf[recps].content.lkup_indx[i + 1] = entry->fv_idx[i]; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ + +This patch changed the type of fv_idx in struct ice_recp_grp_entry to +align with its callers which are also u8 type. + +Fixes: 04b8ec1ea807 ("net/ice/base: add protocol structures and defines") + +Signed-off-by: Wenxuan Wu +Acked-by: Qi Zhang +--- + drivers/net/ice/base/ice_flex_pipe.c | 2 +- + drivers/net/ice/base/ice_flex_pipe.h | 2 +- + drivers/net/ice/base/ice_protocol_type.h | 2 +- + drivers/net/ice/base/ice_switch.h | 2 +- + 4 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/drivers/net/ice/base/ice_flex_pipe.c b/drivers/net/ice/base/ice_flex_pipe.c +index f6a29f87c5..3918169001 100644 +--- a/drivers/net/ice/base/ice_flex_pipe.c ++++ b/drivers/net/ice/base/ice_flex_pipe.c +@@ -2564,7 +2564,7 @@ enum ice_status ice_destroy_tunnel(struct ice_hw *hw, u16 port, bool all) + * @off: variable to receive the protocol offset + */ + enum ice_status +-ice_find_prot_off(struct ice_hw *hw, enum ice_block blk, u8 prof, u16 fv_idx, ++ice_find_prot_off(struct ice_hw *hw, enum ice_block blk, u8 prof, u8 fv_idx, + u8 *prot, u16 *off) + { + struct ice_fv_word *fv_ext; +diff --git a/drivers/net/ice/base/ice_flex_pipe.h b/drivers/net/ice/base/ice_flex_pipe.h +index 23ba45564a..ab897de4f3 100644 +--- a/drivers/net/ice/base/ice_flex_pipe.h ++++ b/drivers/net/ice/base/ice_flex_pipe.h +@@ -25,7 +25,7 @@ enum ice_status + ice_acquire_change_lock(struct ice_hw *hw, enum ice_aq_res_access_type access); + void ice_release_change_lock(struct ice_hw *hw); + enum ice_status +-ice_find_prot_off(struct ice_hw *hw, enum ice_block blk, u8 prof, u16 fv_idx, ++ice_find_prot_off(struct ice_hw *hw, enum ice_block blk, u8 prof, u8 fv_idx, + u8 *prot, u16 *off); + enum ice_status + ice_find_label_value(struct ice_seg *ice_seg, char const *name, u32 type, +diff --git a/drivers/net/ice/base/ice_protocol_type.h b/drivers/net/ice/base/ice_protocol_type.h +index 7dcc983707..d27ef46713 100644 +--- a/drivers/net/ice/base/ice_protocol_type.h ++++ b/drivers/net/ice/base/ice_protocol_type.h +@@ -423,7 +423,7 @@ struct ice_recp_grp_entry { + #define ICE_INVAL_CHAIN_IND 0xFF + u16 rid; + u8 chain_idx; +- u16 fv_idx[ICE_NUM_WORDS_RECIPE]; ++ u8 fv_idx[ICE_NUM_WORDS_RECIPE]; + u16 fv_mask[ICE_NUM_WORDS_RECIPE]; + struct ice_pref_recipe_group r_group; + }; +diff --git a/drivers/net/ice/base/ice_switch.h b/drivers/net/ice/base/ice_switch.h +index a2b3c80107..c67cd09d21 100644 +--- a/drivers/net/ice/base/ice_switch.h ++++ b/drivers/net/ice/base/ice_switch.h +@@ -203,7 +203,7 @@ struct ice_fltr_info { + + struct ice_update_recipe_lkup_idx_params { + u16 rid; +- u16 fv_idx; ++ u8 fv_idx; + bool ignore_valid; + u16 mask; + bool mask_valid; +-- +2.23.0 + diff --git a/0329-net-qede-fix-build-with-GCC-12.patch b/0329-net-qede-fix-build-with-GCC-12.patch new file mode 100644 index 0000000..ebf8b8e --- /dev/null +++ b/0329-net-qede-fix-build-with-GCC-12.patch @@ -0,0 +1,155 @@ +From e4939398dfe939e8f1c91c04734ea83f335a8d37 Mon Sep 17 00:00:00 2001 +From: Stephen Hemminger +Date: Tue, 7 Jun 2022 10:17:40 -0700 +Subject: [PATCH] net/qede: fix build with GCC 12 + +[ upstream commit 4200c4d62586985d70ad69ed7bee526a282b8777 ] + +The x86 version of rte_memcpy can cause warnings. The driver does +not need to use rte_memcpy for everything. Standard memcpy is +just as fast and safer; the compiler and static analysis tools +treat memcpy specially. + +Signed-off-by: Stephen Hemminger +--- + drivers/net/qede/base/bcm_osal.h | 3 +-- + drivers/net/qede/qede_ethdev.c | 2 +- + drivers/net/qede/qede_filter.c | 16 ++++++---------- + drivers/net/qede/qede_main.c | 13 ++++++------- + drivers/net/qede/qede_sriov.c | 6 +++--- + 5 files changed, 17 insertions(+), 23 deletions(-) + +diff --git a/drivers/net/qede/base/bcm_osal.h b/drivers/net/qede/base/bcm_osal.h +index c5b5399282..9ea579bfc8 100644 +--- a/drivers/net/qede/base/bcm_osal.h ++++ b/drivers/net/qede/base/bcm_osal.h +@@ -14,7 +14,6 @@ + #include + #include + #include +-#include + #include + #include + #include +@@ -99,7 +98,7 @@ typedef intptr_t osal_int_ptr_t; + } while (0) + #define OSAL_VFREE(dev, memory) OSAL_FREE(dev, memory) + #define OSAL_MEM_ZERO(mem, size) bzero(mem, size) +-#define OSAL_MEMCPY(dst, src, size) rte_memcpy(dst, src, size) ++#define OSAL_MEMCPY(dst, src, size) memcpy(dst, src, size) + #define OSAL_MEMCMP(s1, s2, size) memcmp(s1, s2, size) + #define OSAL_MEMSET(dst, val, length) \ + memset(dst, val, length) +diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c +index a1122a297e..2a3123f0c8 100644 +--- a/drivers/net/qede/qede_ethdev.c ++++ b/drivers/net/qede/qede_ethdev.c +@@ -358,7 +358,7 @@ qede_assign_rxtx_handlers(struct rte_eth_dev *dev, bool is_dummy) + static void + qede_alloc_etherdev(struct qede_dev *qdev, struct qed_dev_eth_info *info) + { +- rte_memcpy(&qdev->dev_info, info, sizeof(*info)); ++ qdev->dev_info = *info; + qdev->ops = qed_ops; + } + +diff --git a/drivers/net/qede/qede_filter.c b/drivers/net/qede/qede_filter.c +index 440440423a..ca3165d972 100644 +--- a/drivers/net/qede/qede_filter.c ++++ b/drivers/net/qede/qede_filter.c +@@ -388,10 +388,8 @@ qede_arfs_construct_pkt(struct rte_eth_dev *eth_dev, + ip6->vtc_flow = + rte_cpu_to_be_32(QEDE_FDIR_IPV6_DEFAULT_VTC_FLOW); + +- rte_memcpy(&ip6->src_addr, arfs->tuple.src_ipv6, +- IPV6_ADDR_LEN); +- rte_memcpy(&ip6->dst_addr, arfs->tuple.dst_ipv6, +- IPV6_ADDR_LEN); ++ memcpy(&ip6->src_addr, arfs->tuple.src_ipv6, IPV6_ADDR_LEN); ++ memcpy(&ip6->dst_addr, arfs->tuple.dst_ipv6, IPV6_ADDR_LEN); + len += sizeof(struct rte_ipv6_hdr); + params->ipv6 = true; + +@@ -821,12 +819,10 @@ qede_flow_parse_pattern(__rte_unused struct rte_eth_dev *dev, + const struct rte_flow_item_ipv6 *spec; + + spec = pattern->spec; +- rte_memcpy(flow->entry.tuple.src_ipv6, +- spec->hdr.src_addr, +- IPV6_ADDR_LEN); +- rte_memcpy(flow->entry.tuple.dst_ipv6, +- spec->hdr.dst_addr, +- IPV6_ADDR_LEN); ++ memcpy(flow->entry.tuple.src_ipv6, ++ spec->hdr.src_addr, IPV6_ADDR_LEN); ++ memcpy(flow->entry.tuple.dst_ipv6, ++ spec->hdr.dst_addr, IPV6_ADDR_LEN); + flow->entry.tuple.eth_proto = + RTE_ETHER_TYPE_IPV6; + } +diff --git a/drivers/net/qede/qede_main.c b/drivers/net/qede/qede_main.c +index 2d1f70693a..c5afdb00d5 100644 +--- a/drivers/net/qede/qede_main.c ++++ b/drivers/net/qede/qede_main.c +@@ -373,7 +373,7 @@ qed_fill_dev_info(struct ecore_dev *edev, struct qed_dev_info *dev_info) + dev_info->mtu = ECORE_LEADING_HWFN(edev)->hw_info.mtu; + dev_info->dev_type = edev->type; + +- rte_memcpy(&dev_info->hw_mac, &edev->hwfns[0].hw_info.hw_mac_addr, ++ memcpy(&dev_info->hw_mac, &edev->hwfns[0].hw_info.hw_mac_addr, + RTE_ETHER_ADDR_LEN); + + dev_info->fw_major = FW_MAJOR_VERSION; +@@ -441,7 +441,7 @@ qed_fill_eth_dev_info(struct ecore_dev *edev, struct qed_dev_eth_info *info) + info->num_vlan_filters = RESC_NUM(&edev->hwfns[0], ECORE_VLAN) - + max_vf_vlan_filters; + +- rte_memcpy(&info->port_mac, &edev->hwfns[0].hw_info.hw_mac_addr, ++ memcpy(&info->port_mac, &edev->hwfns[0].hw_info.hw_mac_addr, + RTE_ETHER_ADDR_LEN); + } else { + ecore_vf_get_num_rxqs(ECORE_LEADING_HWFN(edev), +@@ -472,7 +472,7 @@ static void qed_set_name(struct ecore_dev *edev, char name[NAME_SIZE]) + { + int i; + +- rte_memcpy(edev->name, name, NAME_SIZE); ++ memcpy(edev->name, name, NAME_SIZE); + for_each_hwfn(edev, i) { + snprintf(edev->hwfns[i].name, NAME_SIZE, "%s-%d", name, i); + } +@@ -514,10 +514,9 @@ static void qed_fill_link(struct ecore_hwfn *hwfn, + + /* Prepare source inputs */ + if (IS_PF(hwfn->p_dev)) { +- rte_memcpy(¶ms, ecore_mcp_get_link_params(hwfn), +- sizeof(params)); +- rte_memcpy(&link, ecore_mcp_get_link_state(hwfn), sizeof(link)); +- rte_memcpy(&link_caps, ecore_mcp_get_link_capabilities(hwfn), ++ memcpy(¶ms, ecore_mcp_get_link_params(hwfn), sizeof(params)); ++ memcpy(&link, ecore_mcp_get_link_state(hwfn), sizeof(link)); ++ memcpy(&link_caps, ecore_mcp_get_link_capabilities(hwfn), + sizeof(link_caps)); + } else { + ecore_vf_read_bulletin(hwfn, &change); +diff --git a/drivers/net/qede/qede_sriov.c b/drivers/net/qede/qede_sriov.c +index 0b99a8d6fe..937d339fb8 100644 +--- a/drivers/net/qede/qede_sriov.c ++++ b/drivers/net/qede/qede_sriov.c +@@ -203,10 +203,10 @@ void qed_inform_vf_link_state(struct ecore_hwfn *hwfn) + if (!hwfn->pf_iov_info) + return; + +- rte_memcpy(¶ms, ecore_mcp_get_link_params(lead_hwfn), ++ memcpy(¶ms, ecore_mcp_get_link_params(lead_hwfn), + sizeof(params)); +- rte_memcpy(&link, ecore_mcp_get_link_state(lead_hwfn), sizeof(link)); +- rte_memcpy(&caps, ecore_mcp_get_link_capabilities(lead_hwfn), ++ memcpy(&link, ecore_mcp_get_link_state(lead_hwfn), sizeof(link)); ++ memcpy(&caps, ecore_mcp_get_link_capabilities(lead_hwfn), + sizeof(caps)); + + /* Update bulletin of all future possible VFs with link configuration */ +-- +2.23.0 + diff --git a/0330-examples-performance-thread-fix-build-with-GCC-12.patch b/0330-examples-performance-thread-fix-build-with-GCC-12.patch new file mode 100644 index 0000000..4715122 --- /dev/null +++ b/0330-examples-performance-thread-fix-build-with-GCC-12.patch @@ -0,0 +1,62 @@ +From 125a65cb03f845d1b6d5f7078670aa1a49d62513 Mon Sep 17 00:00:00 2001 +From: Kevin Traynor +Date: Wed, 24 Aug 2022 10:17:07 +0100 +Subject: [PATCH] examples/performance-thread: fix build with GCC 12 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +[1/2] Compiling C object examples/dpdk-pthrea... +formance-thread_pthread_shim_pthread_shim.c.o +../examples/performance-thread/pthread_shim/pthread_shim.c: +In function ‘pthread_setspecific’: +../examples/performance-thread/pthread_shim/pthread_shim.c:592:27: +warning: ‘data’ may be used uninitialized [-Wmaybe-uninitialized] +592 | int rv = lthread_setspecific((unsigned int)key, data); + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +../examples/performance-thread/pthread_shim/pthread_shim.c:589:56: +note: accessing argument 2 of a function declared with attribute +‘access (none, 2)’ +589 | int pthread_setspecific(pthread_key_t key, const void *data) + | ~~~~~~~~~~~~^~~~ + +This is a false positive as pthread_setspecific() does not read from +the (const void *) so we can squash the warning. + +performance-thread example is already removed from DPDK main branch. + +Signed-off-by: Kevin Traynor +--- + examples/performance-thread/pthread_shim/pthread_shim.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/examples/performance-thread/pthread_shim/pthread_shim.c b/examples/performance-thread/pthread_shim/pthread_shim.c +index bbc076584b..a44cb8244d 100644 +--- a/examples/performance-thread/pthread_shim/pthread_shim.c ++++ b/examples/performance-thread/pthread_shim/pthread_shim.c +@@ -586,6 +586,11 @@ pthread_t pthread_self(void) + return _sys_pthread_funcs.f_pthread_self(); + } + ++#if defined(RTE_TOOLCHAIN_GCC) && (GCC_VERSION >= 120000) ++#pragma GCC diagnostic push ++#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" ++#endif ++ + int pthread_setspecific(pthread_key_t key, const void *data) + { + if (override) { +@@ -595,6 +600,10 @@ int pthread_setspecific(pthread_key_t key, const void *data) + return _sys_pthread_funcs.f_pthread_setspecific(key, data); + } + ++#if defined(RTE_TOOLCHAIN_GCC) && (GCC_VERSION >= 120000) ++#pragma GCC diagnostic pop ++#endif ++ + int pthread_spin_init(pthread_spinlock_t *a, int b) + { + NOT_IMPLEMENTED; +-- +2.23.0 + diff --git a/0331-net-mvneta-fix-build-with-GCC-12.patch b/0331-net-mvneta-fix-build-with-GCC-12.patch new file mode 100644 index 0000000..bd2788f --- /dev/null +++ b/0331-net-mvneta-fix-build-with-GCC-12.patch @@ -0,0 +1,41 @@ +From 6d030554f1a6a0f2d82bb3371ebb1c5458a49491 Mon Sep 17 00:00:00 2001 +From: Amit Prakash Shukla +Date: Thu, 1 Sep 2022 14:01:18 +0530 +Subject: [PATCH] net/mvneta: fix build with GCC 12 + +[ upstream commit d7b080f1e72d833d668a66199fe99ccda6c81a36 ] + +./drivers/net/mvneta/mvneta_rxtx.c:89:42: + error: 'mbufs' may be used uninitialized [-Werror=maybe-uninitialized] + 89 | MVNETA_SET_COOKIE_HIGH_ADDR(mbufs[0]); + | ^ +../drivers/net/mvneta/mvneta_rxtx.c:77:26: note: 'mbufs' declared here + 77 | struct rte_mbuf *mbufs[MRVL_NETA_BUF_RELEASE_BURST_SIZE_MAX]; + | ^~~~~ + +Fixes: ce7ea764597e ("net/mvneta: support Rx/Tx") + +Signed-off-by: Amit Prakash Shukla +Acked-by: Liron Himi +--- + drivers/net/mvneta/mvneta_rxtx.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/drivers/net/mvneta/mvneta_rxtx.c b/drivers/net/mvneta/mvneta_rxtx.c +index 6e4a7896b4..952e982275 100644 +--- a/drivers/net/mvneta/mvneta_rxtx.c ++++ b/drivers/net/mvneta/mvneta_rxtx.c +@@ -79,6 +79,10 @@ mvneta_buffs_refill(struct mvneta_priv *priv, struct mvneta_rxq *rxq, u16 *num) + int i, ret; + uint16_t nb_desc = *num; + ++ /* To prevent GCC-12 warning. */ ++ if (unlikely(nb_desc == 0)) ++ return -1; ++ + ret = rte_pktmbuf_alloc_bulk(rxq->mp, mbufs, nb_desc); + if (ret) { + MVNETA_LOG(ERR, "Failed to allocate %u mbufs.", nb_desc); +-- +2.23.0 + diff --git a/0332-test-ipsec-fix-build-with-GCC-12.patch b/0332-test-ipsec-fix-build-with-GCC-12.patch new file mode 100644 index 0000000..d8250f9 --- /dev/null +++ b/0332-test-ipsec-fix-build-with-GCC-12.patch @@ -0,0 +1,58 @@ +From fdebff6b5aadd85e417a10c234b4159d1d0620f5 Mon Sep 17 00:00:00 2001 +From: Amit Prakash Shukla +Date: Thu, 4 Aug 2022 19:10:53 +0530 +Subject: [PATCH] test/ipsec: fix build with GCC 12 + +[ upstream commit 250cbb8d5dd2ffcb4c8a871332f9ec8e5a59242f ] + +GCC-12 raises following warning: + +In function '_mm_loadu_si128', + inlined from 'rte_mov16' at + ../lib/eal/x86/include/rte_memcpy.h:507:9, + inlined from 'rte_mov128' at + ../lib/eal/x86/include/rte_memcpy.h:549:2, + inlined from 'rte_memcpy_generic' at + ../lib/eal/x86/include/rte_memcpy.h:732:4, + inlined from 'rte_memcpy' at + ../lib/eal/x86/include/rte_memcpy.h:882:10, + inlined from 'setup_test_string_tunneled' at + ../app/test/test_ipsec.c:617:3: +/usr/lib/gcc/x86_64-pc-linux-gnu/12.1.1/include/emmintrin.h:703:10: error: + array subscript '__m128i_u[15]' is partly outside array bounds of + 'const uint8_t[255]' {aka 'const unsigned char[255]'} + [-Werror=array-bounds] + 703 | return *__P; + | ^~~~ +../app/test/test_ipsec.c: In function 'setup_test_string_tunneled': +../app/test/test_ipsec.c:491:22: note: at offset 240 into object + 'esp_pad_bytes' of size 255 + 491 | static const uint8_t esp_pad_bytes[IPSEC_MAX_PAD_SIZE] = { + +This patch restrict the copy to minimum size. + +Fixes: 05fe65eb66b2 ("test/ipsec: introduce functional test") + +Signed-off-by: Amit Prakash Shukla +Acked-by: Akhil Goyal +--- + app/test/test_ipsec.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/app/test/test_ipsec.c b/app/test/test_ipsec.c +index 6d5431843f..584c132f37 100644 +--- a/app/test/test_ipsec.c ++++ b/app/test/test_ipsec.c +@@ -618,7 +618,8 @@ setup_test_string_tunneled(struct rte_mempool *mpool, const char *string, + rte_memcpy(dst, string, len); + dst += len; + /* copy pad bytes */ +- rte_memcpy(dst, esp_pad_bytes, padlen); ++ rte_memcpy(dst, esp_pad_bytes, RTE_MIN(padlen, ++ sizeof(esp_pad_bytes))); + dst += padlen; + /* copy ESP tail header */ + rte_memcpy(dst, &espt, sizeof(espt)); +-- +2.23.0 + diff --git a/0333-ipsec-fix-build-with-GCC-12.patch b/0333-ipsec-fix-build-with-GCC-12.patch new file mode 100644 index 0000000..9f43e7d --- /dev/null +++ b/0333-ipsec-fix-build-with-GCC-12.patch @@ -0,0 +1,75 @@ +From db9f8c23a4bc89764433efa58bf256f4bb95c10c Mon Sep 17 00:00:00 2001 +From: Amit Prakash Shukla +Date: Thu, 4 Aug 2022 19:10:54 +0530 +Subject: [PATCH] ipsec: fix build with GCC 12 + +[ upstream commit 2be383423e433b5d42324cb450589b46d057c2ed ] + +GCC 12 raises the following warning: + +In function '_mm_loadu_si128', + inlined from 'rte_mov16' at + ../lib/eal/x86/include/rte_memcpy.h:507:9, + inlined from 'rte_mov128' at + ../lib/eal/x86/include/rte_memcpy.h:549:2, + inlined from 'rte_memcpy_generic' at + ../lib/eal/x86/include/rte_memcpy.h:732:4, + inlined from 'rte_memcpy' at + ../lib/eal/x86/include/rte_memcpy.h:882:10, + inlined from 'outb_tun_pkt_prepare' at + ../lib/ipsec/esp_outb.c:224:2: +/usr/lib/gcc/x86_64-pc-linux-gnu/12.1.1/include/emmintrin.h:703:10: error: + array subscript '__m128i_u[15]' is partly outside array bounds of + 'const uint8_t[255]' {aka 'const unsigned char[255]'} + [-Werror=array-bounds] + 703 | return *__P; + | ^~~~ +In file included from ../lib/ipsec/esp_outb.c:17: +../lib/ipsec/pad.h: In function 'outb_tun_pkt_prepare': +../lib/ipsec/pad.h:10:22: note: at offset 240 into object 'esp_pad_bytes' + of size 255 + 10 | static const uint8_t esp_pad_bytes[IPSEC_MAX_PAD_SIZE] = { + | ^~~~~~~~~~~~~ + +This patch restrict copy to minimum size. + +Bugzilla ID: 1060 +Fixes: 6015e6a13398 ("ipsec: move inbound and outbound code") + +Signed-off-by: Amit Prakash Shukla +Acked-by: Konstantin Ananyev +--- + lib/ipsec/esp_outb.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/lib/ipsec/esp_outb.c b/lib/ipsec/esp_outb.c +index 28bd58e3c7..1b0eeed07f 100644 +--- a/lib/ipsec/esp_outb.c ++++ b/lib/ipsec/esp_outb.c +@@ -220,8 +220,10 @@ outb_tun_pkt_prepare(struct rte_ipsec_sa *sa, rte_be64_t sqc, + /* pad length */ + pdlen -= sizeof(*espt); + ++ RTE_ASSERT(pdlen <= sizeof(esp_pad_bytes)); ++ + /* copy padding data */ +- rte_memcpy(pt, esp_pad_bytes, pdlen); ++ rte_memcpy(pt, esp_pad_bytes, RTE_MIN(pdlen, sizeof(esp_pad_bytes))); + + /* update esp trailer */ + espt = (struct rte_esp_tail *)(pt + pdlen); +@@ -417,8 +419,10 @@ outb_trs_pkt_prepare(struct rte_ipsec_sa *sa, rte_be64_t sqc, + /* pad length */ + pdlen -= sizeof(*espt); + ++ RTE_ASSERT(pdlen <= sizeof(esp_pad_bytes)); ++ + /* copy padding data */ +- rte_memcpy(pt, esp_pad_bytes, pdlen); ++ rte_memcpy(pt, esp_pad_bytes, RTE_MIN(pdlen, sizeof(esp_pad_bytes))); + + /* update esp trailer */ + espt = (struct rte_esp_tail *)(pt + pdlen); +-- +2.23.0 + diff --git a/0334-crypto-qat-fix-build-with-GCC-12.patch b/0334-crypto-qat-fix-build-with-GCC-12.patch new file mode 100644 index 0000000..875b02d --- /dev/null +++ b/0334-crypto-qat-fix-build-with-GCC-12.patch @@ -0,0 +1,70 @@ +From 29b6bd601428a25e37b282f09e4b4a2244e111d9 Mon Sep 17 00:00:00 2001 +From: Amit Prakash Shukla +Date: Thu, 4 Aug 2022 19:10:55 +0530 +Subject: [PATCH] crypto/qat: fix build with GCC 12 + +[ upstream commit 04361fe2aca8998ea06fb4823dceb965698e147c ] + +GCC 12 raises the following warning: + +In function '_mm_storeu_si128', + inlined from 'rte_mov16' at + ../lib/eal/x86/include/rte_memcpy.h:508:2, + inlined from 'rte_mov128' at + ../lib/eal/x86/include/rte_memcpy.h:542:2, + inlined from 'rte_memcpy_generic' at + ../lib/eal/x86/include/rte_memcpy.h:732:4, + inlined from 'rte_memcpy' at + ../lib/eal/x86/include/rte_memcpy.h:882:10, + inlined from 'qat_sym_do_precomputes.constprop' at + ../drivers/crypto/qat/qat_sym_session.c:1434:2: +/usr/lib/gcc/x86_64-pc-linux-gnu/12.1.1/include/emmintrin.h:739:8: error: + array subscript 8 is outside array bounds of 'unsigned char[128]' + [-Werror=array-bounds] + 739 | *__P = __B; + | ~~~~~^~~~~ + +../drivers/crypto/qat/qat_sym_session.c: + In function 'qat_sym_do_precomputes.constprop': +../drivers/crypto/qat/qat_sym_session.c:1305:17: note: + at offset 192 into object 'opad.750' of size 128 + 1305 | uint8_t + opad[qat_hash_get_block_size(ICP_QAT_HW_AUTH_ALGO_DELIMITER)]; + | ^~~~ + +../drivers/crypto/qat/qat_sym_session.c: + In function 'qat_sym_do_precomputes.constprop': +../drivers/crypto/qat/qat_sym_session.c:1304:17: note: + at offset 128 into object 'ipad.749' of size 128 + 1304 | uint8_t + ipad[qat_hash_get_block_size(ICP_QAT_HW_AUTH_ALGO_DELIMITER)]; + | ^~~~ + +Added a check to prevent compiler warnings. + +Fixes: 1703e94ac5ce ("qat: add driver for QuickAssist devices") + +Signed-off-by: Amit Prakash Shukla +Acked-by: Fan Zhang +--- + drivers/crypto/qat/qat_sym_session.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/drivers/crypto/qat/qat_sym_session.c b/drivers/crypto/qat/qat_sym_session.c +index 80d6fbfa46..3697a038e5 100644 +--- a/drivers/crypto/qat/qat_sym_session.c ++++ b/drivers/crypto/qat/qat_sym_session.c +@@ -1435,6 +1435,10 @@ static int qat_sym_do_precomputes(enum icp_qat_hw_auth_algo hash_alg, + QAT_LOG(ERR, "invalid keylen %u", auth_keylen); + return -EFAULT; + } ++ ++ RTE_VERIFY(auth_keylen <= sizeof(ipad)); ++ RTE_VERIFY(auth_keylen <= sizeof(opad)); ++ + rte_memcpy(ipad, auth_key, auth_keylen); + rte_memcpy(opad, auth_key, auth_keylen); + +-- +2.23.0 + diff --git a/0335-vhost-fix-build-with-GCC-12.patch b/0335-vhost-fix-build-with-GCC-12.patch new file mode 100644 index 0000000..4602c9c --- /dev/null +++ b/0335-vhost-fix-build-with-GCC-12.patch @@ -0,0 +1,100 @@ +From 54a98eecdb81d95d958998c3ecb85b20cde03837 Mon Sep 17 00:00:00 2001 +From: Maxime Coquelin +Date: Wed, 5 Oct 2022 22:35:24 +0200 +Subject: [PATCH] vhost: fix build with GCC 12 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +[ upstream commit 4226aa9caca9511bf95a093b6ad9c1f8727a4d43 ] + +This patch fixes a compilation issue met with GCC 12 on +LoongArch64: + +In function ‘mbuf_to_desc’, + inlined from ‘vhost_enqueue_async_packed’ + inlined from ‘virtio_dev_rx_async_packed’ + inlined from ‘virtio_dev_rx_async_submit_packed’ +lib/vhost/virtio_net.c:1159:18: error: + ‘buf_vec[0].buf_addr’ may be used uninitialized + 1159 | buf_addr = buf_vec[vec_idx].buf_addr; + | ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~ +lib/vhost/virtio_net.c: In function ‘virtio_dev_rx_async_submit_packed’: +lib/vhost/virtio_net.c:1834:27: note: ‘buf_vec’ declared here + 1834 | struct buf_vector buf_vec[BUF_VECTOR_MAX]; + | ^~~~~~~ + +It happens because the compiler assumes that 'size' +variable in vhost_enqueue_async_packed could wrap to 0 since +'size' is uint32_t and pkt->pkt_len too. + +In practice, it would never happen since 'pkt->pkt_len' is +unlikely to be close to UINT32_MAX, but let's just change +'size' to uint64_t to make the compiler happy without +having to add runtime checks. + +This patch also fixes similar patterns in three other +places, including one that also produces similar build +issue on ARM64 in vhost_enqueue_single_packed(). + +Fixes: 873e8dad6f49 ("vhost: support packed ring in async datapath") + +Signed-off-by: Maxime Coquelin +Reviewed-by: David Marchand +Tested-by: Amit Prakash Shukla +--- + lib/vhost/virtio_net.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/lib/vhost/virtio_net.c b/lib/vhost/virtio_net.c +index bf4d75b4bd..64460e3e8c 100644 +--- a/lib/vhost/virtio_net.c ++++ b/lib/vhost/virtio_net.c +@@ -599,7 +599,7 @@ fill_vec_buf_split(struct virtio_net *dev, struct vhost_virtqueue *vq, + */ + static inline int + reserve_avail_buf_split(struct virtio_net *dev, struct vhost_virtqueue *vq, +- uint32_t size, struct buf_vector *buf_vec, ++ uint64_t size, struct buf_vector *buf_vec, + uint16_t *num_buffers, uint16_t avail_head, + uint16_t *nr_vec) + { +@@ -1069,7 +1069,7 @@ vhost_enqueue_single_packed(struct virtio_net *dev, + uint16_t buf_id = 0; + uint32_t len = 0; + uint16_t desc_count; +- uint32_t size = pkt->pkt_len + sizeof(struct virtio_net_hdr_mrg_rxbuf); ++ uint64_t size = pkt->pkt_len + sizeof(struct virtio_net_hdr_mrg_rxbuf); + uint16_t num_buffers = 0; + uint32_t buffer_len[vq->size]; + uint16_t buffer_buf_id[vq->size]; +@@ -1137,7 +1137,7 @@ virtio_dev_rx_split(struct virtio_net *dev, struct vhost_virtqueue *vq, + rte_prefetch0(&vq->avail->ring[vq->last_avail_idx & (vq->size - 1)]); + + for (pkt_idx = 0; pkt_idx < count; pkt_idx++) { +- uint32_t pkt_len = pkts[pkt_idx]->pkt_len + dev->vhost_hlen; ++ uint64_t pkt_len = pkts[pkt_idx]->pkt_len + dev->vhost_hlen; + uint16_t nr_vec = 0; + + if (unlikely(reserve_avail_buf_split(dev, vq, +@@ -1485,7 +1485,7 @@ virtio_dev_rx_async_submit_split(struct virtio_net *dev, + async_iter_reset(async); + + for (pkt_idx = 0; pkt_idx < count; pkt_idx++) { +- uint32_t pkt_len = pkts[pkt_idx]->pkt_len + dev->vhost_hlen; ++ uint64_t pkt_len = pkts[pkt_idx]->pkt_len + dev->vhost_hlen; + uint16_t nr_vec = 0; + + if (unlikely(reserve_avail_buf_split(dev, vq, pkt_len, buf_vec, +@@ -1575,7 +1575,7 @@ vhost_enqueue_async_packed(struct virtio_net *dev, + uint16_t buf_id = 0; + uint32_t len = 0; + uint16_t desc_count = 0; +- uint32_t size = pkt->pkt_len + sizeof(struct virtio_net_hdr_mrg_rxbuf); ++ uint64_t size = pkt->pkt_len + sizeof(struct virtio_net_hdr_mrg_rxbuf); + uint32_t buffer_len[vq->size]; + uint16_t buffer_buf_id[vq->size]; + uint16_t buffer_desc_count[vq->size]; +-- +2.23.0 + diff --git a/0336-net-i40e-fix-build-with-MinGW-GCC-12.patch b/0336-net-i40e-fix-build-with-MinGW-GCC-12.patch new file mode 100644 index 0000000..9e5339e --- /dev/null +++ b/0336-net-i40e-fix-build-with-MinGW-GCC-12.patch @@ -0,0 +1,50 @@ +From 9ba87edbe69cac90bf8aff9714e3724519c633bf Mon Sep 17 00:00:00 2001 +From: Amit Prakash Shukla +Date: Wed, 24 Aug 2022 19:33:38 +0530 +Subject: [PATCH] net/i40e: fix build with MinGW GCC 12 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +[ upstream commit eb440cea1e05245f362ec7fca932f2d977f12359 ] + +When compiling with MinGW GCC 12, +the rte_flow_item array is seen as read out of bound: + +net/i40e/i40e_hash.c:389:47: error: + array subscript 50 is above array bounds of ‘const uint64_t[50]’ + {aka ‘const long long unsigned int[50]’} [-Werror=array-bounds] + 389 | item_hdr = pattern_item_header[last_item_type]; + | ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~ + +It seems the assert check done above this line has no impact. +A real check is added to make the compiler happy. + +Fixes: ef4c16fd9148 ("net/i40e: refactor RSS flow") + +Signed-off-by: Amit Prakash Shukla +Acked-by: Thomas Monjalon +--- + drivers/net/i40e/i40e_hash.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/i40e/i40e_hash.c b/drivers/net/i40e/i40e_hash.c +index 8962e9d97a..a1ff85fceb 100644 +--- a/drivers/net/i40e/i40e_hash.c ++++ b/drivers/net/i40e/i40e_hash.c +@@ -384,8 +384,10 @@ i40e_hash_get_pattern_type(const struct rte_flow_item pattern[], + } + + prev_item_type = last_item_type; +- assert(last_item_type < (enum rte_flow_item_type) +- RTE_DIM(pattern_item_header)); ++ if (last_item_type >= (enum rte_flow_item_type) ++ RTE_DIM(pattern_item_header)) ++ goto not_sup; ++ + item_hdr = pattern_item_header[last_item_type]; + assert(item_hdr); + +-- +2.23.0 + diff --git a/0337-net-qede-base-fix-32-bit-build-with-GCC-12.patch b/0337-net-qede-base-fix-32-bit-build-with-GCC-12.patch new file mode 100644 index 0000000..5cef6a9 --- /dev/null +++ b/0337-net-qede-base-fix-32-bit-build-with-GCC-12.patch @@ -0,0 +1,53 @@ +From 4d4b866a158e5079dcac3f6533c06c4acdf2dd69 Mon Sep 17 00:00:00 2001 +From: Amit Prakash Shukla +Date: Wed, 24 Aug 2022 19:33:39 +0530 +Subject: [PATCH] net/qede/base: fix 32-bit build with GCC 12 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +[ upstream commit acc0ed087cd1ce6464f63489ab17eca52b0c94b2 ] + +A pointer is passed to a macro and it seems mistakenly referenced. +This issue is seen only when compiling with GCC 12 for 32-bit: + +drivers/net/qede/base/ecore_init_fw_funcs.c:1418:25: + error: array subscript 1 is outside array bounds of ‘u32[1]’ + {aka ‘unsigned int[1]’} [-Werror=array-bounds] + 1418 | ecore_wr(dev, ptt, ((addr) + (4 * i)), \ + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 1419 | ((u32 *)&(arr))[i]); \ + | ~~~~~~~~~~~~~~~~~~~ +drivers/net/qede/base/ecore_init_fw_funcs.c:1465:17: + note: in expansion of macro ‘ARR_REG_WR’ + 1465 | ARR_REG_WR(p_hwfn, p_ptt, addr, pData, len_in_dwords); + | ^~~~~~~~~~ +drivers/net/qede/base/ecore_init_fw_funcs.c:1439:35: + note: at offset 4 into object ‘pData’ of size 4 + 1439 | u32 *pData, + | ~~~~~^~~~~ + +Fixes: 3b307c55f2ac ("net/qede/base: update FW to 8.40.25.0") + +Signed-off-by: Amit Prakash Shukla +Acked-by: Thomas Monjalon +--- + drivers/net/qede/base/ecore_init_fw_funcs.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/qede/base/ecore_init_fw_funcs.c b/drivers/net/qede/base/ecore_init_fw_funcs.c +index 6a52f32cc9..4e4d1dc374 100644 +--- a/drivers/net/qede/base/ecore_init_fw_funcs.c ++++ b/drivers/net/qede/base/ecore_init_fw_funcs.c +@@ -1416,7 +1416,7 @@ void ecore_init_brb_ram(struct ecore_hwfn *p_hwfn, + u32 i; \ + for (i = 0; i < (arr_size); i++) \ + ecore_wr(dev, ptt, ((addr) + (4 * i)), \ +- ((u32 *)&(arr))[i]); \ ++ ((u32 *)(arr))[i]); \ + } while (0) + + #ifndef DWORDS_TO_BYTES +-- +2.23.0 + diff --git a/0338-hash-fix-GFNI-implementation-build-with-GCC-12.patch b/0338-hash-fix-GFNI-implementation-build-with-GCC-12.patch new file mode 100644 index 0000000..f75a193 --- /dev/null +++ b/0338-hash-fix-GFNI-implementation-build-with-GCC-12.patch @@ -0,0 +1,104 @@ +From 47951ef1dc21882215a531472d055c58a7618cb0 Mon Sep 17 00:00:00 2001 +From: David Marchand +Date: Mon, 9 Jan 2023 11:03:37 +0100 +Subject: [PATCH] hash: fix GFNI implementation build with GCC 12 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +[ upstream commit fe2c18a0a8b22703dec3add385a371ad819d7872 ] + +On a system that has AVX512F and GFNI, compiling fails with: + +In file included from /usr/lib/gcc/x86_64-redhat-linux/12/include/immintrin.h:71, + from /usr/lib/gcc/x86_64-redhat-linux/12/include/x86intrin.h:32, + from ../../../git/pub/dpdk.org/main/lib/eal/x86/include/rte_vect.h:31, + from ../../../git/pub/dpdk.org/main/lib/eal/x86/include/rte_memcpy.h:17, + from ../../../git/pub/dpdk.org/main/lib/mempool/rte_mempool.h:48, + from ../../../git/pub/dpdk.org/main/lib/mbuf/rte_mbuf.h:38, + from ../../../git/pub/dpdk.org/main/lib/net/rte_ip.h:33, + from ../../../git/pub/dpdk.org/main/lib/hash/rte_thash.h:25, + from ../../../git/pub/dpdk.org/main/lib/hash/rte_thash.c:7: +In function ‘_mm512_mask_permutexvar_epi8’, + inlined from ‘__rte_thash_gfni’ at + ../../../git/pub/dpdk.org/main/lib/hash/rte_thash_x86_gfni.h:142:17, + inlined from ‘rte_thash_gfni’ at + ../../../git/pub/dpdk.org/main/lib/hash/rte_thash_x86_gfni.h:182:20, + inlined from ‘rte_thash_adjust_tuple’ at + ../../../git/pub/dpdk.org/main/lib/hash/rte_thash.c:784:11: +/usr/lib/gcc/x86_64-redhat-linux/12/include/avx512vbmiintrin.h:97:20: + error: ‘tuple_bytes’ may be used uninitialized [-Werror=maybe-uninitialized] + 97 | return (__m512i) __builtin_ia32_permvarqi512_mask ((__v64qi) __B, + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 98 | (__v64qi) __A, + | ~~~~~~~~~~~~~~ + 99 | (__v64qi) __W, + | ~~~~~~~~~~~~~~ + 100 | (__mmask64) __M); + | ~~~~~~~~~~~~~~~~ + +And: + +In file included from ../../../git/pub/dpdk.org/main/lib/hash/rte_thash_gfni.h:17, + from ../../../git/pub/dpdk.org/main/lib/hash/rte_thash.h:27: +../../../git/pub/dpdk.org/main/lib/hash/rte_thash_x86_gfni.h: + In function ‘rte_thash_adjust_tuple’: +../../../git/pub/dpdk.org/main/lib/hash/rte_thash_x86_gfni.h:91:33: + note: ‘tuple_bytes’ was declared here + 91 | __m512i vals, matrixes, tuple_bytes, tuple_bytes_2; + | ^~~~~~~~~~~ +In function ‘_mm512_mask_permutexvar_epi8’, + inlined from ‘__rte_thash_gfni’ at + ../../../git/pub/dpdk.org/main/lib/hash/rte_thash_x86_gfni.h:142:17, + inlined from ‘rte_thash_gfni’ at + ../../../git/pub/dpdk.org/main/lib/hash/rte_thash_x86_gfni.h:182:20, + inlined from ‘rte_thash_adjust_tuple’ at + ../../../git/pub/dpdk.org/main/lib/hash/rte_thash.c:784:11: +/usr/lib/gcc/x86_64-redhat-linux/12/include/avx512vbmiintrin.h:97:20: + error: ‘permute_mask’ may be used uninitialized [-Werror=maybe-uninitialized] + 97 | return (__m512i) __builtin_ia32_permvarqi512_mask ((__v64qi) __B, + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 98 | (__v64qi) __A, + | ~~~~~~~~~~~~~~ + 99 | (__v64qi) __W, + | ~~~~~~~~~~~~~~ + 100 | (__mmask64) __M); + | ~~~~~~~~~~~~~~~~ +../../../git/pub/dpdk.org/main/lib/hash/rte_thash_x86_gfni.h: + In function ‘rte_thash_adjust_tuple’: +../../../git/pub/dpdk.org/main/lib/hash/rte_thash_x86_gfni.h:92:30: + note: ‘permute_mask’ was declared here + 92 | __mmask64 load_mask, permute_mask, permute_mask_2; + | ^~~~~~~~~~~~ +cc1: all warnings being treated as errors + +Set those variables to 0. + +Fixes: 4fd8c4cb0de1 ("hash: add new Toeplitz hash implementation") + +Signed-off-by: David Marchand +Acked-by: Bruce Richardson +--- + lib/hash/rte_thash_x86_gfni.h | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/lib/hash/rte_thash_x86_gfni.h b/lib/hash/rte_thash_x86_gfni.h +index 657b1862c3..0583f64793 100644 +--- a/lib/hash/rte_thash_x86_gfni.h ++++ b/lib/hash/rte_thash_x86_gfni.h +@@ -87,8 +87,10 @@ __rte_thash_gfni(const uint64_t *mtrx, const uint8_t *tuple, + const __m512i shift_8 = _mm512_set1_epi8(8); + __m512i xor_acc = _mm512_setzero_si512(); + __m512i perm_bytes = _mm512_setzero_si512(); +- __m512i vals, matrixes, tuple_bytes, tuple_bytes_2; +- __mmask64 load_mask, permute_mask, permute_mask_2; ++ __m512i vals, matrixes, tuple_bytes_2; ++ __m512i tuple_bytes = _mm512_setzero_si512(); ++ __mmask64 load_mask, permute_mask_2; ++ __mmask64 permute_mask = 0; + int chunk_len = 0, i = 0; + uint8_t mtrx_msk; + const int prepend = 3; +-- +2.23.0 + diff --git a/0339-examples-cmdline-fix-build-with-GCC-12.patch b/0339-examples-cmdline-fix-build-with-GCC-12.patch new file mode 100644 index 0000000..0cef1a7 --- /dev/null +++ b/0339-examples-cmdline-fix-build-with-GCC-12.patch @@ -0,0 +1,53 @@ +From 661f5540c3785104258dc1b9f169ccd6dd770472 Mon Sep 17 00:00:00 2001 +From: Bruce Richardson +Date: Wed, 18 Jan 2023 16:11:11 +0000 +Subject: [PATCH] examples/cmdline: fix build with GCC 12 + +[ upstream commit 2ba8d0adb06f92ef73bc8e3953ca45b7d322c823 ] + +When building the example without libbsd and using the DPDK-provided +strlcpy function, a compiler warning is emitted by GCC 12 about the copy +of the parsed string into the resulting object. This is because the +source from cmdline library is 128 bytes and the destination buffer is +64-bytes. + +commands.c: In function 'cmd_obj_add_parsed': +rte_string_fns.h:61:24: warning: '%s' directive output may be truncated +writing up to 127 bytes into a region of size 64 [-Wformat-truncation=] + 61 | return (size_t)snprintf(dst, size, "%s", src); + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +In file included from /usr/include/stdio.h:894, + from commands.c:7: +/usr/include/x86_64-linux-gnu/bits/stdio2.h:71:10: note: +'__builtin_snprintf' output between 1 and 128 bytes into a destination of size 64 + +Multiple options are possible to fix this, but the one taken in this +patch is to ensure truncation never occurs by setting the destination +buffer size to be the same as that used by the cmdline library. + +Fixes: af75078fece3 ("first public release") + +Signed-off-by: Bruce Richardson +Acked-by: Olivier Matz +--- + examples/cmdline/parse_obj_list.h | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/examples/cmdline/parse_obj_list.h b/examples/cmdline/parse_obj_list.h +index 6516d3e2c2..1223ac1e8b 100644 +--- a/examples/cmdline/parse_obj_list.h ++++ b/examples/cmdline/parse_obj_list.h +@@ -12,8 +12,9 @@ + + #include + #include ++#include + +-#define OBJ_NAME_LEN_MAX 64 ++#define OBJ_NAME_LEN_MAX sizeof(cmdline_fixed_string_t) + + struct object { + SLIST_ENTRY(object) next; +-- +2.23.0 + diff --git a/0340-net-mlx5-fix-build-with-GCC-12-and-ASan.patch b/0340-net-mlx5-fix-build-with-GCC-12-and-ASan.patch new file mode 100644 index 0000000..a212cac --- /dev/null +++ b/0340-net-mlx5-fix-build-with-GCC-12-and-ASan.patch @@ -0,0 +1,70 @@ +From c3a4fd09f9a348e9b7394b2a9d498c815f1efaac Mon Sep 17 00:00:00 2001 +From: David Marchand +Date: Wed, 22 Mar 2023 18:06:27 +0100 +Subject: [PATCH] net/mlx5: fix build with GCC 12 and ASan +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +[ upstream commit e17840756179410283ef03660578310874432f40 ] + +Building with gcc 12 and ASan raises this warning: + +../drivers/net/mlx5/mlx5_txpp.c: In function ‘mlx5_txpp_xstats_get_names’: +../drivers/net/mlx5/mlx5_txpp.c:1066:25: error: ‘strncpy’ specified bound + 64 equals destination size [-Werror=stringop-truncation] + 1066 | strncpy(xstats_names[i + n_used].name, + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 1067 | mlx5_txpp_stat_names[i], + | ~~~~~~~~~~~~~~~~~~~~~~~~ + 1068 | RTE_ETH_XSTATS_NAME_SIZE); + | ~~~~~~~~~~~~~~~~~~~~~~~~~ +cc1: all warnings being treated as errors + +Prefer strlcpy for xstats. + +Fixes: 3b025c0ca425 ("net/mlx5: provide send scheduling error statistics") + +Signed-off-by: David Marchand +Acked-by: Raslan Darawsheh +--- + drivers/net/mlx5/mlx5_stats.c | 3 +-- + drivers/net/mlx5/mlx5_txpp.c | 4 +--- + 2 files changed, 2 insertions(+), 5 deletions(-) + +diff --git a/drivers/net/mlx5/mlx5_stats.c b/drivers/net/mlx5/mlx5_stats.c +index f64fa3587b..615e1d073d 100644 +--- a/drivers/net/mlx5/mlx5_stats.c ++++ b/drivers/net/mlx5/mlx5_stats.c +@@ -288,10 +288,9 @@ mlx5_xstats_get_names(struct rte_eth_dev *dev, + + if (n >= mlx5_xstats_n && xstats_names) { + for (i = 0; i != mlx5_xstats_n; ++i) { +- strncpy(xstats_names[i].name, ++ strlcpy(xstats_names[i].name, + xstats_ctrl->info[i].dpdk_name, + RTE_ETH_XSTATS_NAME_SIZE); +- xstats_names[i].name[RTE_ETH_XSTATS_NAME_SIZE - 1] = 0; + } + } + mlx5_xstats_n = mlx5_txpp_xstats_get_names(dev, xstats_names, +diff --git a/drivers/net/mlx5/mlx5_txpp.c b/drivers/net/mlx5/mlx5_txpp.c +index af77e91e4c..83d17997d1 100644 +--- a/drivers/net/mlx5/mlx5_txpp.c ++++ b/drivers/net/mlx5/mlx5_txpp.c +@@ -1064,11 +1064,9 @@ int mlx5_txpp_xstats_get_names(struct rte_eth_dev *dev __rte_unused, + + if (n >= n_used + n_txpp && xstats_names) { + for (i = 0; i < n_txpp; ++i) { +- strncpy(xstats_names[i + n_used].name, ++ strlcpy(xstats_names[i + n_used].name, + mlx5_txpp_stat_names[i], + RTE_ETH_XSTATS_NAME_SIZE); +- xstats_names[i + n_used].name +- [RTE_ETH_XSTATS_NAME_SIZE - 1] = 0; + } + } + return n_used + n_txpp; +-- +2.23.0 + diff --git a/0341-pdump-fix-build-with-GCC-12.patch b/0341-pdump-fix-build-with-GCC-12.patch new file mode 100644 index 0000000..cf4c996 --- /dev/null +++ b/0341-pdump-fix-build-with-GCC-12.patch @@ -0,0 +1,84 @@ +From 606474e9d0143ea0fb2863e64d2267b569e1fb89 Mon Sep 17 00:00:00 2001 +From: Joyce Kong +Date: Mon, 27 Mar 2023 07:07:12 +0000 +Subject: [PATCH] pdump: fix build with GCC 12 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +[ upstream commit b182466683a5c76657efb4b6b8d43e7d71979034 ] + +The following warning is observed with GCC12 compilation +with release 20.11: + +In function ‘__rte_ring_enqueue_elems_64’, + inlined from ‘__rte_ring_enqueue_elems’ at + ../lib/librte_ring/rte_ring_elem.h:225:3, + inlined from ‘__rte_ring_do_enqueue_elem’ at + ../lib/librte_ring/rte_ring_elem.h:424:2, + inlined from ‘rte_ring_mp_enqueue_burst_elem’ at + ../lib/librte_ring/rte_ring_elem.h:884:9, + inlined from ‘rte_ring_enqueue_burst_elem’ at + ../lib/librte_ring/rte_ring_elem.h:946:10, + inlined from ‘rte_ring_enqueue_burst’ at + ../lib/librte_ring/rte_ring.h:721:9, + inlined from ‘pdump_copy’ at + ../lib/librte_pdump/rte_pdump.c:94:13: +../lib/librte_ring/rte_ring_elem.h:162:40: warning: ‘*dup_bufs.36_42 ++ _89’ may be used uninitialized [-Wmaybe-uninitialized] + 162 | ring[idx] = obj[i]; + | ~~~^~~ +../lib/librte_ring/rte_ring_elem.h:163:44: warning: ‘*dup_bufs.36_42 ++ _98’ may be used uninitialized [-Wmaybe-uninitialized] + 163 | ring[idx + 1] = obj[i + 1]; + | ~~~^~~~~~~ +../lib/librte_ring/rte_ring_elem.h:164:44: warning: ‘*dup_bufs.36_42 ++ _107’ may be used uninitialized [-Wmaybe-uninitialized] + 164 | ring[idx + 2] = obj[i + 2]; + | ~~~^~~~~~~ +../lib/librte_ring/rte_ring_elem.h:165:44: warning: ‘*dup_bufs.36_42 ++ _116’ may be used uninitialized [-Wmaybe-uninitialized] + 165 | ring[idx + 3] = obj[i + 3]; + | ~~~^~~~~~~ +../lib/librte_ring/rte_ring_elem.h:169:42: warning: ‘*dup_bufs.36_42 ++ _129’ may be used uninitialized [-Wmaybe-uninitialized] + 169 | ring[idx++] = obj[i++]; /* fallthrough */ + | ~~~^~~~~ +../lib/librte_ring/rte_ring_elem.h:171:42: warning: ‘*dup_bufs.36_42 ++ _139’ may be used uninitialized [-Wmaybe-uninitialized] + 171 | ring[idx++] = obj[i++]; /* fallthrough */ + | ~~~^~~~~ +../lib/librte_ring/rte_ring_elem.h:173:42: warning: ‘*dup_bufs.36_42 ++ _149’ may be used uninitialized [-Wmaybe-uninitialized] + 173 | ring[idx++] = obj[i++]; + +Actually, this is an alias warning as -O3 enables strict alias. +This patch fixes it by replacing 'dup_bufs' with '&dup_bufs[0]' +as the compiler represents them differently. + +Fixes: 278f945402c5 ("pdump: add new library for packet capture") + +Signed-off-by: Joyce Kong +Reviewed-by: Ruifeng Wang +Acked-by: Reshma Pattan +Acked-by: Tyler Retzlaff +--- + lib/pdump/rte_pdump.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/lib/pdump/rte_pdump.c b/lib/pdump/rte_pdump.c +index f0dee81e77..805d12236c 100644 +--- a/lib/pdump/rte_pdump.c ++++ b/lib/pdump/rte_pdump.c +@@ -133,7 +133,7 @@ pdump_copy(uint16_t port_id, uint16_t queue, + + __atomic_fetch_add(&stats->accepted, d_pkts, __ATOMIC_RELAXED); + +- ring_enq = rte_ring_enqueue_burst(ring, (void *)dup_bufs, d_pkts, NULL); ++ ring_enq = rte_ring_enqueue_burst(ring, (void *)&dup_bufs[0], d_pkts, NULL); + if (unlikely(ring_enq < d_pkts)) { + unsigned int drops = d_pkts - ring_enq; + +-- +2.23.0 + diff --git a/0342-net-cxgbe-fix-dangling-pointer-by-mailbox-access-rew.patch b/0342-net-cxgbe-fix-dangling-pointer-by-mailbox-access-rew.patch new file mode 100644 index 0000000..e7063b3 --- /dev/null +++ b/0342-net-cxgbe-fix-dangling-pointer-by-mailbox-access-rew.patch @@ -0,0 +1,329 @@ +From 699c30f8534c136926df9b6fb5b97ed06c1f34a0 Mon Sep 17 00:00:00 2001 +From: Rahul Lakkireddy +Date: Thu, 20 Jan 2022 03:26:40 +0530 +Subject: [PATCH] net/cxgbe: fix dangling pointer by mailbox access rework +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +[ upstream commit 19cafed99ac573662045424e559cee444c175b63 ] + +Rework mailbox access serialization to dynamically allocate and +free mbox entry. Also remove unnecessary temp memory and macros. + +Observed with: gcc-12.0 (GCC) 12.0.1 20220118 (experimental) + +In file included from ../lib/eal/linux/include/rte_os.h:14, + from ../lib/eal/include/rte_common.h:28, + from ../lib/eal/include/rte_log.h:25, + from ../lib/ethdev/rte_ethdev.h:164, + from ../lib/ethdev/ethdev_driver.h:18, + from ../drivers/net/cxgbe/base/t4vf_hw.c:6: +In function ‘t4_os_atomic_add_tail’, + inlined from ‘t4vf_wr_mbox_core’ at + ../drivers/net/cxgbe/base/t4vf_hw.c:115:2: +../drivers/net/cxgbe/base/adapter.h:742:9: + warning: storing the address of local variable ‘entry’ in + ‘((struct mbox_list *)adapter)[96].tqh_last’ [-Wdangling-pointer=] + 742 | TAILQ_INSERT_TAIL(head, entry, next); + | ^~~~~~~~~~~~~~~~~ +../drivers/net/cxgbe/base/t4vf_hw.c: In function ‘t4vf_wr_mbox_core’: +../drivers/net/cxgbe/base/t4vf_hw.c:86:27: note: ‘entry’ declared here + 86 | struct mbox_entry entry; + | ^~~~~ +../drivers/net/cxgbe/base/t4vf_hw.c:86:27: note: ‘adapter’ declared here + +Fixes: 3bd122eef2cc ("cxgbe/base: add hardware API for Chelsio T5 series adapters") + +Reported-by: Ferruh Yigit +Signed-off-by: Rahul Lakkireddy +--- + drivers/net/cxgbe/base/adapter.h | 2 - + drivers/net/cxgbe/base/t4_hw.c | 83 ++++++++++++-------------------- + drivers/net/cxgbe/base/t4vf_hw.c | 28 +++++++---- + 3 files changed, 49 insertions(+), 64 deletions(-) + +diff --git a/drivers/net/cxgbe/base/adapter.h b/drivers/net/cxgbe/base/adapter.h +index 1c7c8afe16..97963422bf 100644 +--- a/drivers/net/cxgbe/base/adapter.h ++++ b/drivers/net/cxgbe/base/adapter.h +@@ -291,8 +291,6 @@ struct sge { + u32 fl_starve_thres; /* Free List starvation threshold */ + }; + +-#define T4_OS_NEEDS_MBOX_LOCKING 1 +- + /* + * OS Lock/List primitives for those interfaces in the Common Code which + * need this. +diff --git a/drivers/net/cxgbe/base/t4_hw.c b/drivers/net/cxgbe/base/t4_hw.c +index cdcd7e5510..645833765a 100644 +--- a/drivers/net/cxgbe/base/t4_hw.c ++++ b/drivers/net/cxgbe/base/t4_hw.c +@@ -263,17 +263,6 @@ static void fw_asrt(struct adapter *adap, u32 mbox_addr) + + #define X_CIM_PF_NOACCESS 0xeeeeeeee + +-/* +- * If the Host OS Driver needs locking arround accesses to the mailbox, this +- * can be turned on via the T4_OS_NEEDS_MBOX_LOCKING CPP define ... +- */ +-/* makes single-statement usage a bit cleaner ... */ +-#ifdef T4_OS_NEEDS_MBOX_LOCKING +-#define T4_OS_MBOX_LOCKING(x) x +-#else +-#define T4_OS_MBOX_LOCKING(x) do {} while (0) +-#endif +- + /** + * t4_wr_mbox_meat_timeout - send a command to FW through the given mailbox + * @adap: the adapter +@@ -314,28 +303,17 @@ int t4_wr_mbox_meat_timeout(struct adapter *adap, int mbox, + 1, 1, 3, 5, 10, 10, 20, 50, 100 + }; + +- u32 v; +- u64 res; +- int i, ms; +- unsigned int delay_idx; +- __be64 *temp = (__be64 *)malloc(size * sizeof(char)); +- __be64 *p = temp; + u32 data_reg = PF_REG(mbox, A_CIM_PF_MAILBOX_DATA); + u32 ctl_reg = PF_REG(mbox, A_CIM_PF_MAILBOX_CTRL); +- u32 ctl; +- struct mbox_entry entry; +- u32 pcie_fw = 0; +- +- if (!temp) +- return -ENOMEM; ++ struct mbox_entry *entry; ++ u32 v, ctl, pcie_fw = 0; ++ unsigned int delay_idx; ++ const __be64 *p; ++ int i, ms, ret; ++ u64 res; + +- if ((size & 15) || size > MBOX_LEN) { +- free(temp); ++ if ((size & 15) != 0 || size > MBOX_LEN) + return -EINVAL; +- } +- +- memset(p, 0, size); +- memcpy(p, (const __be64 *)cmd, size); + + /* + * If we have a negative timeout, that implies that we can't sleep. +@@ -345,14 +323,17 @@ int t4_wr_mbox_meat_timeout(struct adapter *adap, int mbox, + timeout = -timeout; + } + +-#ifdef T4_OS_NEEDS_MBOX_LOCKING ++ entry = t4_os_alloc(sizeof(*entry)); ++ if (entry == NULL) ++ return -ENOMEM; ++ + /* + * Queue ourselves onto the mailbox access list. When our entry is at + * the front of the list, we have rights to access the mailbox. So we + * wait [for a while] till we're at the front [or bail out with an + * EBUSY] ... + */ +- t4_os_atomic_add_tail(&entry, &adap->mbox_list, &adap->mbox_lock); ++ t4_os_atomic_add_tail(entry, &adap->mbox_list, &adap->mbox_lock); + + delay_idx = 0; + ms = delay[0]; +@@ -367,18 +348,18 @@ int t4_wr_mbox_meat_timeout(struct adapter *adap, int mbox, + */ + pcie_fw = t4_read_reg(adap, A_PCIE_FW); + if (i > 4 * timeout || (pcie_fw & F_PCIE_FW_ERR)) { +- t4_os_atomic_list_del(&entry, &adap->mbox_list, ++ t4_os_atomic_list_del(entry, &adap->mbox_list, + &adap->mbox_lock); + t4_report_fw_error(adap); +- free(temp); +- return (pcie_fw & F_PCIE_FW_ERR) ? -ENXIO : -EBUSY; ++ ret = ((pcie_fw & F_PCIE_FW_ERR) != 0) ? -ENXIO : -EBUSY; ++ goto out_free; + } + + /* + * If we're at the head, break out and start the mailbox + * protocol. + */ +- if (t4_os_list_first_entry(&adap->mbox_list) == &entry) ++ if (t4_os_list_first_entry(&adap->mbox_list) == entry) + break; + + /* +@@ -393,7 +374,6 @@ int t4_wr_mbox_meat_timeout(struct adapter *adap, int mbox, + rte_delay_ms(ms); + } + } +-#endif /* T4_OS_NEEDS_MBOX_LOCKING */ + + /* + * Attempt to gain access to the mailbox. +@@ -410,12 +390,11 @@ int t4_wr_mbox_meat_timeout(struct adapter *adap, int mbox, + * mailbox atomic access list and report the error to our caller. + */ + if (v != X_MBOWNER_PL) { +- T4_OS_MBOX_LOCKING(t4_os_atomic_list_del(&entry, +- &adap->mbox_list, +- &adap->mbox_lock)); ++ t4_os_atomic_list_del(entry, &adap->mbox_list, ++ &adap->mbox_lock); + t4_report_fw_error(adap); +- free(temp); +- return (v == X_MBOWNER_FW ? -EBUSY : -ETIMEDOUT); ++ ret = (v == X_MBOWNER_FW) ? -EBUSY : -ETIMEDOUT; ++ goto out_free; + } + + /* +@@ -441,7 +420,7 @@ int t4_wr_mbox_meat_timeout(struct adapter *adap, int mbox, + /* + * Copy in the new mailbox command and send it on its way ... + */ +- for (i = 0; i < size; i += 8, p++) ++ for (i = 0, p = cmd; i < size; i += 8, p++) + t4_write_reg64(adap, data_reg + i, be64_to_cpu(*p)); + + CXGBE_DEBUG_MBOX(adap, "%s: mbox %u: %016llx %016llx %016llx %016llx " +@@ -512,11 +491,10 @@ int t4_wr_mbox_meat_timeout(struct adapter *adap, int mbox, + get_mbox_rpl(adap, rpl, size / 8, data_reg); + } + t4_write_reg(adap, ctl_reg, V_MBOWNER(X_MBOWNER_NONE)); +- T4_OS_MBOX_LOCKING( +- t4_os_atomic_list_del(&entry, &adap->mbox_list, +- &adap->mbox_lock)); +- free(temp); +- return -G_FW_CMD_RETVAL((int)res); ++ t4_os_atomic_list_del(entry, &adap->mbox_list, ++ &adap->mbox_lock); ++ ret = -G_FW_CMD_RETVAL((int)res); ++ goto out_free; + } + } + +@@ -527,12 +505,13 @@ int t4_wr_mbox_meat_timeout(struct adapter *adap, int mbox, + */ + dev_err(adap, "command %#x in mailbox %d timed out\n", + *(const u8 *)cmd, mbox); +- T4_OS_MBOX_LOCKING(t4_os_atomic_list_del(&entry, +- &adap->mbox_list, +- &adap->mbox_lock)); ++ t4_os_atomic_list_del(entry, &adap->mbox_list, &adap->mbox_lock); + t4_report_fw_error(adap); +- free(temp); +- return (pcie_fw & F_PCIE_FW_ERR) ? -ENXIO : -ETIMEDOUT; ++ ret = ((pcie_fw & F_PCIE_FW_ERR) != 0) ? -ENXIO : -ETIMEDOUT; ++ ++out_free: ++ t4_os_free(entry); ++ return ret; + } + + int t4_wr_mbox_meat(struct adapter *adap, int mbox, const void *cmd, int size, +diff --git a/drivers/net/cxgbe/base/t4vf_hw.c b/drivers/net/cxgbe/base/t4vf_hw.c +index 561d759dbc..7dbd4deb79 100644 +--- a/drivers/net/cxgbe/base/t4vf_hw.c ++++ b/drivers/net/cxgbe/base/t4vf_hw.c +@@ -83,7 +83,7 @@ int t4vf_wr_mbox_core(struct adapter *adapter, + + u32 mbox_ctl = T4VF_CIM_BASE_ADDR + A_CIM_VF_EXT_MAILBOX_CTRL; + __be64 cmd_rpl[MBOX_LEN / 8]; +- struct mbox_entry entry; ++ struct mbox_entry *entry; + unsigned int delay_idx; + u32 v, mbox_data; + const __be64 *p; +@@ -106,13 +106,17 @@ int t4vf_wr_mbox_core(struct adapter *adapter, + size > NUM_CIM_VF_MAILBOX_DATA_INSTANCES * 4) + return -EINVAL; + ++ entry = t4_os_alloc(sizeof(*entry)); ++ if (entry == NULL) ++ return -ENOMEM; ++ + /* + * Queue ourselves onto the mailbox access list. When our entry is at + * the front of the list, we have rights to access the mailbox. So we + * wait [for a while] till we're at the front [or bail out with an + * EBUSY] ... + */ +- t4_os_atomic_add_tail(&entry, &adapter->mbox_list, &adapter->mbox_lock); ++ t4_os_atomic_add_tail(entry, &adapter->mbox_list, &adapter->mbox_lock); + + delay_idx = 0; + ms = delay[0]; +@@ -125,17 +129,17 @@ int t4vf_wr_mbox_core(struct adapter *adapter, + * contend on access to the mailbox ... + */ + if (i > (2 * FW_CMD_MAX_TIMEOUT)) { +- t4_os_atomic_list_del(&entry, &adapter->mbox_list, ++ t4_os_atomic_list_del(entry, &adapter->mbox_list, + &adapter->mbox_lock); + ret = -EBUSY; +- return ret; ++ goto out_free; + } + + /* + * If we're at the head, break out and start the mailbox + * protocol. + */ +- if (t4_os_list_first_entry(&adapter->mbox_list) == &entry) ++ if (t4_os_list_first_entry(&adapter->mbox_list) == entry) + break; + + /* +@@ -160,10 +164,10 @@ int t4vf_wr_mbox_core(struct adapter *adapter, + v = G_MBOWNER(t4_read_reg(adapter, mbox_ctl)); + + if (v != X_MBOWNER_PL) { +- t4_os_atomic_list_del(&entry, &adapter->mbox_list, ++ t4_os_atomic_list_del(entry, &adapter->mbox_list, + &adapter->mbox_lock); + ret = (v == X_MBOWNER_FW) ? -EBUSY : -ETIMEDOUT; +- return ret; ++ goto out_free; + } + + /* +@@ -224,7 +228,7 @@ int t4vf_wr_mbox_core(struct adapter *adapter, + get_mbox_rpl(adapter, cmd_rpl, size / 8, mbox_data); + t4_write_reg(adapter, mbox_ctl, + V_MBOWNER(X_MBOWNER_NONE)); +- t4_os_atomic_list_del(&entry, &adapter->mbox_list, ++ t4_os_atomic_list_del(entry, &adapter->mbox_list, + &adapter->mbox_lock); + + /* return value in high-order host-endian word */ +@@ -236,7 +240,8 @@ int t4vf_wr_mbox_core(struct adapter *adapter, + & F_FW_CMD_REQUEST) == 0); + memcpy(rpl, cmd_rpl, size); + } +- return -((int)G_FW_CMD_RETVAL(v)); ++ ret = -((int)G_FW_CMD_RETVAL(v)); ++ goto out_free; + } + } + +@@ -246,8 +251,11 @@ int t4vf_wr_mbox_core(struct adapter *adapter, + dev_err(adapter, "command %#x timed out\n", + *(const u8 *)cmd); + dev_err(adapter, " Control = %#x\n", t4_read_reg(adapter, mbox_ctl)); +- t4_os_atomic_list_del(&entry, &adapter->mbox_list, &adapter->mbox_lock); ++ t4_os_atomic_list_del(entry, &adapter->mbox_list, &adapter->mbox_lock); + ret = -ETIMEDOUT; ++ ++out_free: ++ t4_os_free(entry); + return ret; + } + +-- +2.23.0 + diff --git a/0343-examples-l3fwd-fix-buffer-overflow-in-Tx.patch b/0343-examples-l3fwd-fix-buffer-overflow-in-Tx.patch new file mode 100644 index 0000000..71a09f9 --- /dev/null +++ b/0343-examples-l3fwd-fix-buffer-overflow-in-Tx.patch @@ -0,0 +1,54 @@ +From 0490d69d58d9d75c37e780966c837a062658f528 Mon Sep 17 00:00:00 2001 +From: Rahul Bhansali +Date: Tue, 11 Jan 2022 18:20:05 +0530 +Subject: [PATCH] examples/l3fwd: fix buffer overflow in Tx + +This patch fixes the stack buffer overflow error reported +from AddressSanitizer. +Function send_packetsx4() tries to access out of bound data +from rte_mbuf and fill it into TX buffer even in the case +where no pending packets (len = 0). +Performance impact:- No + +ASAN error report:- +==819==ERROR: AddressSanitizer: stack-buffer-overflow on address +0xffffe2c0dcf0 at pc 0x0000005e791c bp 0xffffe2c0d7e0 sp 0xffffe2c0d800 +READ of size 8 at 0xffffe2c0dcf0 thread T0 + #0 0x5e7918 in send_packetsx4 ../examples/l3fwd/l3fwd_common.h:251 + #1 0x5e7918 in send_packets_multi ../examples/l3fwd/l3fwd_neon.h:226 + +Fixes: 96ff445371e0 ("examples/l3fwd: reorganise and optimize LPM code path") +Cc: stable@dpdk.org + +Signed-off-by: Rahul Bhansali +Reviewed-by: Conor Walsh +Acked-by: Konstantin Ananyev +--- + examples/l3fwd/l3fwd_common.h | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/examples/l3fwd/l3fwd_common.h b/examples/l3fwd/l3fwd_common.h +index cbaab79f5b..8e4c27218f 100644 +--- a/examples/l3fwd/l3fwd_common.h ++++ b/examples/l3fwd/l3fwd_common.h +@@ -236,6 +236,9 @@ send_packetsx4(struct lcore_conf *qconf, uint16_t port, struct rte_mbuf *m[], + + /* copy rest of the packets into the TX buffer. */ + len = num - n; ++ if (len == 0) ++ goto exit; ++ + j = 0; + switch (len % FWDSTEP) { + while (j < len) { +@@ -258,6 +261,7 @@ send_packetsx4(struct lcore_conf *qconf, uint16_t port, struct rte_mbuf *m[], + } + } + ++exit: + qconf->tx_mbufs[port].len = len; + } + +-- +2.23.0 + diff --git a/dpdk.spec b/dpdk.spec index d190845..9281276 100644 --- a/dpdk.spec +++ b/dpdk.spec @@ -1,6 +1,6 @@ Name: dpdk Version: 21.11 -Release: 52 +Release: 53 Packager: packaging@6wind.com URL: http://dpdk.org %global source_version 21.11 @@ -339,6 +339,36 @@ Patch6314: 0314-net-ixgbe-add-proper-memory-barriers-in-Rx.patch Patch9020: 0020-pdump-fix-pcap_dump-coredump-caused-by-incorrect-pkt_len.patch Patch9021: 0021-gro-fix-gro-with-tcp-push-flag.patch Patch9022: 0022-eal-loongarch-support-LoongArch-architecture.patch +Patch9023: 0023-example-l3fwd-masking-wrong-warning-array-subscript-.patch + +Patch6315: 0315-net-cnxk-fix-build-with-GCC-12.patch +Patch6316: 0316-net-cnxk-fix-build-with-optimization.patch +Patch6317: 0317-crypto-ipsec_mb-fix-build-with-GCC-12.patch +Patch6318: 0318-net-ena-fix-build-with-GCC-12.patch +Patch6319: 0319-net-enetfec-fix-build-with-GCC-12.patch +Patch6320: 0320-net-ice-fix-build-with-GCC-12.patch +Patch6321: 0321-vdpa-ifc-fix-build-with-GCC-12.patch +Patch6322: 0322-app-flow-perf-fix-build-with-GCC-12.patch +Patch6323: 0323-common-cpt-fix-build-with-GCC-12.patch +Patch6324: 0324-crypto-cnxk-fix-build-with-GCC-12.patch +Patch6325: 0325-test-ipsec-fix-build-with-GCC-12.patch +Patch6326: 0326-vhost-crypto-fix-build-with-GCC-12.patch +Patch6327: 0327-vhost-crypto-fix-descriptor-processing.patch +Patch6328: 0328-net-ice-base-fix-build-with-GCC-12.patch +Patch6329: 0329-net-qede-fix-build-with-GCC-12.patch +Patch6330: 0330-examples-performance-thread-fix-build-with-GCC-12.patch +Patch6331: 0331-net-mvneta-fix-build-with-GCC-12.patch +Patch6332: 0332-test-ipsec-fix-build-with-GCC-12.patch +Patch6333: 0333-ipsec-fix-build-with-GCC-12.patch +Patch6334: 0334-crypto-qat-fix-build-with-GCC-12.patch +Patch6335: 0335-vhost-fix-build-with-GCC-12.patch +Patch6336: 0336-net-i40e-fix-build-with-MinGW-GCC-12.patch +Patch6337: 0337-net-qede-base-fix-32-bit-build-with-GCC-12.patch +Patch6338: 0338-hash-fix-GFNI-implementation-build-with-GCC-12.patch +Patch6339: 0339-examples-cmdline-fix-build-with-GCC-12.patch +Patch6340: 0340-net-mlx5-fix-build-with-GCC-12-and-ASan.patch +Patch6341: 0341-pdump-fix-build-with-GCC-12.patch +Patch6342: 0342-net-cxgbe-fix-dangling-pointer-by-mailbox-access-rew.patch Summary: Data Plane Development Kit core Group: System Environment/Libraries @@ -484,6 +514,9 @@ strip -g $RPM_BUILD_ROOT/lib/modules/%{kern_devel_ver}/extra/dpdk/igb_uio.ko /usr/sbin/depmod %changelog +* Wed Jul 12 2023 jiangheng - 21.11-53 +- fix build with GCC 12 + * Tue Jul 4 2023 zhoumin - 21.11-52 - EAL: support LoongArch architecture - Backport bugfixes for ixgbe driver needed by LoongArch -- Gitee