From: Konstantin Ananyev <konstantin.ananyev@huawei.com>
To: Anoob Joseph <anoobj@marvell.com>,
Radu Nicolau <radu.nicolau@intel.com>,
Akhil Goyal <gakhil@marvell.com>
Cc: Konstantin Ananyev <konstantin.v.ananyev@yandex.ru>,
Jerin Jacob <jerinj@marvell.com>, "dev@dpdk.org" <dev@dpdk.org>
Subject: RE: [PATCH 1/2] examples/ipsec-secgw: fix width of variables
Date: Tue, 19 Dec 2023 09:51:07 +0000 [thread overview]
Message-ID: <4f07890503b24e50adeb56a6b36066f5@huawei.com> (raw)
In-Reply-To: <20231219052923.196-1-anoobj@marvell.com>
> 'rte_eth_rx_burst' returns uint16_t. The same value need to be passed
> to 'process_packets' functions which performs further processing. Having
> this function use 'uint8_t' can result in issues when MAX_PKT_BURST is
> larger.
>
> The route functions (route4_pkts & route6_pkts) take uint8_t as the
> argument. The caller can pass larger values as the field that is passed
> is of type uint32_t. And the function can work with uint32_t as it loops
> through the packets and sends it out. Using uint8_t can result in silent
> packet drops.
>
> Fixes: 4fbfa6c7c921 ("examples/ipsec-secgw: update eth header during route lookup")
>
> Signed-off-by: Anoob Joseph <anoobj@marvell.com>
> ---
> examples/ipsec-secgw/ipsec-secgw.c | 5 ++---
> examples/ipsec-secgw/ipsec_worker.h | 4 ++--
> 2 files changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c
> index bf98d2618b..a61bea400a 100644
> --- a/examples/ipsec-secgw/ipsec-secgw.c
> +++ b/examples/ipsec-secgw/ipsec-secgw.c
> @@ -568,7 +568,7 @@ process_pkts_outbound_nosp(struct ipsec_ctx *ipsec_ctx,
>
> static inline void
> process_pkts(struct lcore_conf *qconf, struct rte_mbuf **pkts,
> - uint8_t nb_pkts, uint16_t portid, void *ctx)
> + uint16_t nb_pkts, uint16_t portid, void *ctx)
> {
> struct ipsec_traffic traffic;
>
> @@ -695,8 +695,7 @@ ipsec_poll_mode_worker(void)
> struct rte_mbuf *pkts[MAX_PKT_BURST];
> uint32_t lcore_id;
> uint64_t prev_tsc, diff_tsc, cur_tsc;
> - int32_t i, nb_rx;
> - uint16_t portid;
> + uint16_t i, nb_rx, portid;
> uint8_t queueid;
> struct lcore_conf *qconf;
> int32_t rc, socket_id;
> diff --git a/examples/ipsec-secgw/ipsec_worker.h b/examples/ipsec-secgw/ipsec_worker.h
> index ac980b8bcf..8e937fda3e 100644
> --- a/examples/ipsec-secgw/ipsec_worker.h
> +++ b/examples/ipsec-secgw/ipsec_worker.h
> @@ -469,7 +469,7 @@ get_hop_for_offload_pkt(struct rte_mbuf *pkt, int is_ipv6)
>
> static __rte_always_inline void
> route4_pkts(struct rt_ctx *rt_ctx, struct rte_mbuf *pkts[],
> - uint8_t nb_pkts, uint64_t tx_offloads, bool ip_cksum)
> + uint32_t nb_pkts, uint64_t tx_offloads, bool ip_cksum)
> {
> uint32_t hop[MAX_PKT_BURST * 2];
> uint32_t dst_ip[MAX_PKT_BURST * 2];
> @@ -557,7 +557,7 @@ route4_pkts(struct rt_ctx *rt_ctx, struct rte_mbuf *pkts[],
> }
>
> static __rte_always_inline void
> -route6_pkts(struct rt_ctx *rt_ctx, struct rte_mbuf *pkts[], uint8_t nb_pkts)
> +route6_pkts(struct rt_ctx *rt_ctx, struct rte_mbuf *pkts[], uint32_t nb_pkts)
> {
> int32_t hop[MAX_PKT_BURST * 2];
> uint8_t dst_ip[MAX_PKT_BURST * 2][16];
> --
Acked-by: Konstantin Ananyev <konstantin.ananyev@huawei.com>
> 2.25.1
next prev parent reply other threads:[~2023-12-19 9:51 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-19 5:29 Anoob Joseph
2023-12-19 5:29 ` [PATCH 2/2] examples/ipsec-secgw: update stats when freeing packets Anoob Joseph
2023-12-19 17:18 ` Stephen Hemminger
2023-12-20 13:10 ` [EXT] " Anoob Joseph
2023-12-19 9:51 ` Konstantin Ananyev [this message]
2024-01-09 17:38 ` [PATCH 1/2] examples/ipsec-secgw: fix width of variables Akhil Goyal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4f07890503b24e50adeb56a6b36066f5@huawei.com \
--to=konstantin.ananyev@huawei.com \
--cc=anoobj@marvell.com \
--cc=dev@dpdk.org \
--cc=gakhil@marvell.com \
--cc=jerinj@marvell.com \
--cc=konstantin.v.ananyev@yandex.ru \
--cc=radu.nicolau@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).