From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id CBEA743741; Tue, 19 Dec 2023 06:29:31 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6A2B040283; Tue, 19 Dec 2023 06:29:31 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 3EAC740265 for ; Tue, 19 Dec 2023 06:29:29 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 3BJ3eAhI031642; Mon, 18 Dec 2023 21:29:28 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding:content-type; s=pfpt0220; bh=6ZNI7y16 HyasYU9Fg4AVo8vZc5Yo1w06aMD8PwHGP4I=; b=UBlfb0gFHGAbhdjPhI5+SV7X 6M4apr8KQuppNPhsPm0tJ2vTtZvMBRJW/XcXMBS2upYt5UQOYaVQF9TSEoNs/E7i W/NHbUWzT5oCpfUZeDbPJ/WFAvDQSCe0BNw2IOVSTWQ35pfJvBmvtS331jlrTPLf haiLXwe1SObg2H5rN5rKXIWwQTzpIsUhjXNZ305gupaEo7u1yrwUHvpRyC5VSNiF 9QiD1qHj1YiuHoiUpGho3e/HbVofYsN1sD8CA8WEwPbnFxdV5KtUNUm1i0pxA2eO JHGdDs/Fu/FG6TIxK0sa08+SjSLso6hIeneq4ybg6nfySt/AIZC2aPB1ZK5zeA== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3v33fng83b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 18 Dec 2023 21:29:28 -0800 (PST) Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Mon, 18 Dec 2023 21:29:26 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Mon, 18 Dec 2023 21:29:26 -0800 Received: from BG-LT92004.corp.innovium.com (unknown [10.28.163.189]) by maili.marvell.com (Postfix) with ESMTP id 722763F708C; Mon, 18 Dec 2023 21:29:24 -0800 (PST) From: Anoob Joseph To: Radu Nicolau , Akhil Goyal CC: Konstantin Ananyev , Jerin Jacob , Subject: [PATCH 1/2] examples/ipsec-secgw: fix width of variables Date: Tue, 19 Dec 2023 10:59:22 +0530 Message-ID: <20231219052923.196-1-anoobj@marvell.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: 0vilRl7RhHc_YwzQdGzCmcFzWsKksRCs X-Proofpoint-ORIG-GUID: 0vilRl7RhHc_YwzQdGzCmcFzWsKksRCs X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-12-09_02,2023-12-07_01,2023-05-22_02 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-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. 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 --- 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]; -- 2.25.1