From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 0FB4C43745;
	Tue, 19 Dec 2023 10:51:11 +0100 (CET)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 8DBD5402DE;
	Tue, 19 Dec 2023 10:51:10 +0100 (CET)
Received: from frasgout.his.huawei.com (frasgout.his.huawei.com
 [185.176.79.56]) by mails.dpdk.org (Postfix) with ESMTP id 37B4040283
 for <dev@dpdk.org>; Tue, 19 Dec 2023 10:51:08 +0100 (CET)
Received: from mail.maildlp.com (unknown [172.18.186.216])
 by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4SvX3g0h1Bz6JB2K;
 Tue, 19 Dec 2023 17:49:51 +0800 (CST)
Received: from frapeml100006.china.huawei.com (unknown [7.182.85.201])
 by mail.maildlp.com (Postfix) with ESMTPS id 3C424140D26;
 Tue, 19 Dec 2023 17:51:07 +0800 (CST)
Received: from frapeml500007.china.huawei.com (7.182.85.172) by
 frapeml100006.china.huawei.com (7.182.85.201) with Microsoft SMTP Server
 (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id
 15.1.2507.35; Tue, 19 Dec 2023 10:51:07 +0100
Received: from frapeml500007.china.huawei.com ([7.182.85.172]) by
 frapeml500007.china.huawei.com ([7.182.85.172]) with mapi id 15.01.2507.035;
 Tue, 19 Dec 2023 10:51:07 +0100
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
Thread-Topic: [PATCH 1/2] examples/ipsec-secgw: fix width of variables
Thread-Index: AQHaMjx3zopsrDSFA0eCbMXPM4H0abCwXPlA
Date: Tue, 19 Dec 2023 09:51:07 +0000
Message-ID: <4f07890503b24e50adeb56a6b36066f5@huawei.com>
References: <20231219052923.196-1-anoobj@marvell.com>
In-Reply-To: <20231219052923.196-1-anoobj@marvell.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
x-originating-ip: [10.206.138.42]
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org


> '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.
>=20
> 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.
>=20
> Fixes: 4fbfa6c7c921 ("examples/ipsec-secgw: update eth header during rout=
e lookup")
>=20
> 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(-)
>=20
> diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ip=
sec-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_ct=
x,
>=20
>  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;
>=20
> @@ -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/i=
psec_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)
>=20
>  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 *p=
kts[],
>  }
>=20
>  static __rte_always_inline void
> -route6_pkts(struct rt_ctx *rt_ctx, struct rte_mbuf *pkts[], uint8_t nb_p=
kts)
> +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>
=20

> 2.25.1