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 43C22A0543; Wed, 24 Aug 2022 15:52:44 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9807241144; Wed, 24 Aug 2022 15:52:43 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 56BCA4067B; Wed, 24 Aug 2022 15:52:42 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 27O8HcIF013941; Wed, 24 Aug 2022 06:52:39 -0700 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=wVnbZCrvkjyvQwvrJTTRi/THE0HvDijqxr9B+lFjOHc=; b=WynrxdtOfTPDPLAHhn/pTf6EJsQ4vJLVwKl3ATIlro6VolV+oNNa25K8ZwQSBTXOVz+p FsU5QZeTTgyf3rpB2fnJqp6rz8afB7Em+7NCgSYYOwx3y6EASKQTjaq/O5MxrKMPPNtl 3ivXjDXQlN2iUI1ZVRzipaofuPcr1vdDPux8VmZKvwabTeuo9sdJW3cyGXTVf9EWKQnx 1B6vVu4I8W88zLK7aqh0ftRlbPcfL4yuo4U/Ow8aqgtQJiWMKc7kpL8Rud8PEIYPxRPc DYKX00ldzFw+2+iiUr+ly0GTimMBu0Hu8SF9mmt7LezyNjTmGd4FiQOvIiU7H7HByAJL dA== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3j5a67ad7m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 24 Aug 2022 06:52:38 -0700 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.18; Wed, 24 Aug 2022 06:52:36 -0700 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.18 via Frontend Transport; Wed, 24 Aug 2022 06:52:36 -0700 Received: from localhost.localdomain (unknown [10.28.36.157]) by maili.marvell.com (Postfix) with ESMTP id 532823F70EC; Wed, 24 Aug 2022 06:52:34 -0700 (PDT) From: Amit Prakash Shukla To: Radu Nicolau , Akhil Goyal , Ruifeng Wang CC: , , , "Amit Prakash Shukla" Subject: [PATCH] examples/ipsec-secgw: compilation fix for GCC-12 Date: Wed, 24 Aug 2022 19:22:30 +0530 Message-ID: <20220824135230.2581478-1-amitprakashs@marvell.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: tEEtbCpsujSWpeloSPdt38j7q7c3Uvaz X-Proofpoint-GUID: tEEtbCpsujSWpeloSPdt38j7q7c3Uvaz X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-08-24_07,2022-08-22_02,2022-06-22_01 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 Typecasting uint32_t array to uint16_t and accessing it as max array size(at time of declaration of uint32_t array) causes gcc-12 to throw an error. GCC 12 raises the following warning: In function 'send_multi_pkts', inlined from 'route6_pkts_neon' at ../examples/ipsec-secgw/ipsec_lpm_neon.h:170:2, inlined from 'ipsec_poll_mode_wrkr_inl_pr' at ../examples/ipsec-secgw/ipsec_worker.c:1257:4: ../examples/ipsec-secgw/ipsec_neon.h:261:21: error: 'dst_port' may be used uninitialized [-Werror=maybe-uninitialized] 261 | dlp = dst_port[i - 1]; | ~~~~^~~~~~~~~~~~~~~~~ In file included from ../examples/ipsec-secgw/ipsec_worker.c:16: ../examples/ipsec-secgw/ipsec_worker.c: In function 'ipsec_poll_mode_wrkr_inl_pr': ../examples/ipsec-secgw/ipsec_lpm_neon.h:118:17: note: 'dst_port' declared here 118 | int32_t dst_port[MAX_PKT_BURST]; | ^~~~~~~~ Fixes: ce23f7ceec6b ("examples/ipsec-secgw: add support of NEON with poll mode") Fixes: dcbf9ad5fdf4 ("examples/ipsec-secgw: move fast path helper functions") Cc: stable@dpdk.org Signed-off-by: Amit Prakash Shukla Change-Id: I083405d2c083cb1228e1a0126240937675a44cd9 --- examples/ipsec-secgw/ipsec.h | 2 ++ examples/ipsec-secgw/ipsec_lpm_neon.h | 8 +++----- examples/ipsec-secgw/ipsec_neon.h | 1 - examples/ipsec-secgw/ipsec_worker.h | 12 ++++++------ 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/examples/ipsec-secgw/ipsec.h b/examples/ipsec-secgw/ipsec.h index 2005ae8fec..2c37bb022d 100644 --- a/examples/ipsec-secgw/ipsec.h +++ b/examples/ipsec-secgw/ipsec.h @@ -43,6 +43,8 @@ (((t) & RTE_IPSEC_SATP_IPV_MASK) == RTE_IPSEC_SATP_IPV4)) || \ ((t) & RTE_IPSEC_SATP_MODE_MASK) == RTE_IPSEC_SATP_MODE_TUNLV4) +#define BAD_PORT ((uint16_t)-1) + struct rte_crypto_xform; struct ipsec_xform; struct rte_mbuf; diff --git a/examples/ipsec-secgw/ipsec_lpm_neon.h b/examples/ipsec-secgw/ipsec_lpm_neon.h index 959a5a8666..6c751b6aab 100644 --- a/examples/ipsec-secgw/ipsec_lpm_neon.h +++ b/examples/ipsec-secgw/ipsec_lpm_neon.h @@ -115,7 +115,7 @@ static inline void route6_pkts_neon(struct rt_ctx *rt_ctx, struct rte_mbuf **pkts, int nb_rx) { uint8_t dst_ip6[MAX_PKT_BURST][16]; - int32_t dst_port[MAX_PKT_BURST]; + uint16_t dst_port[MAX_PKT_BURST]; struct rte_ether_hdr *eth_hdr; struct rte_ipv6_hdr *ipv6_hdr; int32_t hop[MAX_PKT_BURST]; @@ -160,14 +160,12 @@ route6_pkts_neon(struct rt_ctx *rt_ctx, struct rte_mbuf **pkts, int nb_rx) dst_port[i] = get_hop_for_offload_pkt(pkt, 1); } else { /* Need to use hop returned by lookup */ - dst_port[i] = hop[lpm_pkts++]; + dst_port[i] = (uint16_t)hop[lpm_pkts++]; } - if (dst_port[i] == -1) - dst_port[i] = BAD_PORT; } /* Send packets */ - send_multi_pkts(pkts, (uint16_t *)dst_port, nb_rx, 0, 0, false); + send_multi_pkts(pkts, dst_port, nb_rx, 0, 0, false); } /* diff --git a/examples/ipsec-secgw/ipsec_neon.h b/examples/ipsec-secgw/ipsec_neon.h index 39e70ad275..9c04099a07 100644 --- a/examples/ipsec-secgw/ipsec_neon.h +++ b/examples/ipsec-secgw/ipsec_neon.h @@ -9,7 +9,6 @@ #include "neon/port_group.h" #define MAX_TX_BURST (MAX_PKT_BURST / 2) -#define BAD_PORT ((uint16_t)-1) extern xmm_t val_eth[RTE_MAX_ETHPORTS]; diff --git a/examples/ipsec-secgw/ipsec_worker.h b/examples/ipsec-secgw/ipsec_worker.h index 94f94d2236..107f5fc3e8 100644 --- a/examples/ipsec-secgw/ipsec_worker.h +++ b/examples/ipsec-secgw/ipsec_worker.h @@ -438,7 +438,7 @@ inbound_sp_sa(struct sp_ctx *sp, struct sa_ctx *sa, struct traffic_type *ip, ip->num = j; } -static __rte_always_inline int32_t +static __rte_always_inline uint32_t get_hop_for_offload_pkt(struct rte_mbuf *pkt, int is_ipv6) { struct ipsec_mbuf_metadata *priv; @@ -460,7 +460,7 @@ get_hop_for_offload_pkt(struct rte_mbuf *pkt, int is_ipv6) fail: if (is_ipv6) - return -1; + return BAD_PORT; /* else */ return 0; @@ -473,7 +473,7 @@ route4_pkts(struct rt_ctx *rt_ctx, struct rte_mbuf *pkts[], uint32_t hop[MAX_PKT_BURST * 2]; uint32_t dst_ip[MAX_PKT_BURST * 2]; struct rte_ether_hdr *ethhdr; - int32_t pkt_hop = 0; + uint32_t pkt_hop = 0; uint16_t i, offset; uint16_t lpm_pkts = 0; unsigned int lcoreid = rte_lcore_id(); @@ -562,7 +562,7 @@ route6_pkts(struct rt_ctx *rt_ctx, struct rte_mbuf *pkts[], uint8_t nb_pkts) uint8_t dst_ip[MAX_PKT_BURST * 2][16]; struct rte_ether_hdr *ethhdr; uint8_t *ip6_dst; - int32_t pkt_hop = 0; + uint32_t pkt_hop = 0; uint16_t i, offset; uint16_t lpm_pkts = 0; unsigned int lcoreid = rte_lcore_id(); @@ -602,10 +602,10 @@ route6_pkts(struct rt_ctx *rt_ctx, struct rte_mbuf *pkts[], uint8_t nb_pkts) pkt_hop = get_hop_for_offload_pkt(pkt, 1); } else { /* Need to use hop returned by lookup */ - pkt_hop = hop[lpm_pkts++]; + pkt_hop = (uint16_t)hop[lpm_pkts++]; } - if (pkt_hop == -1) { + if (pkt_hop == BAD_PORT) { core_statistics[lcoreid].lpm6.miss++; free_pkts(&pkt, 1); continue; -- 2.25.1