From patchwork Tue Dec 19 05:29:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anoob Joseph X-Patchwork-Id: 135331 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org 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 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 Acked-by: Konstantin Ananyev Acked-by: Akhil Goyal --- 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]; From patchwork Tue Dec 19 05:29:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anoob Joseph X-Patchwork-Id: 135332 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6F6E743741; Tue, 19 Dec 2023 06:29:37 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9588F42DEF; Tue, 19 Dec 2023 06:29:33 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 27E7F402D8 for ; Tue, 19 Dec 2023 06:29:32 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 3BILKWYB029878; Mon, 18 Dec 2023 21:29:31 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= pfpt0220; bh=kAM1RLU2PCg+ujX5K8fdy5+6tufwD5gm3FiZjT7DjRU=; b=OUh fGkAkSO7CY/sectcsQi1ZOuse+6OS+i7wo8yRYzL3OxRdro37hWmb82cBe+SAUtH OT6ihjYbHap5AxQ4BtZ9fZ5C5JZQeu5SYusvZ+QeC9YwoQ2QYmSCx+sQ6ShNyQLT Zs+kaKKsLSiQ0t5nTB5x8tMsLXzlUkf+ccexdwR4DDO88doxacJGklfic+DmBAYf swl+WCl5cj/yT+wIW5DdWsZu6J34LYa+ZVtanPgT0Hfg8Q2QGXQzyavI+5IZ3myT 2llpF/bdGHyj3G+wKma0yyeyQAQOh7wGvrmgd9vec0lYJrpOIOmWgRKSMbASWucv 9/g9PICLqwEZbrCMoqg== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3v1c9ks5qw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 18 Dec 2023 21:29:31 -0800 (PST) Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Mon, 18 Dec 2023 21:29:29 -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:29 -0800 Received: from BG-LT92004.corp.innovium.com (unknown [10.28.163.189]) by maili.marvell.com (Postfix) with ESMTP id 03FDA3F708D; Mon, 18 Dec 2023 21:29:26 -0800 (PST) From: Anoob Joseph To: Radu Nicolau , Akhil Goyal CC: Konstantin Ananyev , Jerin Jacob , Subject: [PATCH 2/2] examples/ipsec-secgw: update stats when freeing packets Date: Tue, 19 Dec 2023 10:59:23 +0530 Message-ID: <20231219052923.196-2-anoobj@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231219052923.196-1-anoobj@marvell.com> References: <20231219052923.196-1-anoobj@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: jH4Qnxpo6fDXzKiyhfvR24QPyPE1aHxx X-Proofpoint-GUID: jH4Qnxpo6fDXzKiyhfvR24QPyPE1aHxx 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 Instead of freeing directly, use commonly used function which also updates stats. Signed-off-by: Anoob Joseph --- examples/ipsec-secgw/ipsec_process.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/ipsec-secgw/ipsec_process.c b/examples/ipsec-secgw/ipsec_process.c index b0cece3ad1..ddbe30745b 100644 --- a/examples/ipsec-secgw/ipsec_process.c +++ b/examples/ipsec-secgw/ipsec_process.c @@ -22,7 +22,7 @@ free_cops(struct rte_crypto_op *cop[], uint32_t n) uint32_t i; for (i = 0; i != n; i++) - rte_pktmbuf_free(cop[i]->sym->m_src); + free_pkts(&cop[i]->sym->m_src, 1); } /* helper routine to enqueue bulk of crypto ops */