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 1555942861; Thu, 30 Mar 2023 12:10:13 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A1488410D3; Thu, 30 Mar 2023 12:10:12 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id D7E0A40E25 for ; Thu, 30 Mar 2023 12:10:11 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 32U3lCd8020366; Thu, 30 Mar 2023 03:10:10 -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=pPfmonwWsaCn+z95rOf/HgZLhiHv2kzOhyDeMs6GfZw=; b=fClE4k6D9FGfvywVx2UoQsWaDsGaWjE/tC64gKey/vIXSqlcoo1HiYq5YAw2S1z/Hv8L 8mLgE2RG7i66S7N1/DnQkbXPtg9H8VGO4UQpl+g00L7T9BL5ePrDB4cecx2ClSRx4cmn 2xwZZp8eL0tZXJ3X1+BTzukI48yiMFftBQHj8DvapneCHfQ5Pz70+oRYd96rJ4eKKfQi L4/B4h1Kt+DoyWtG5E3MU75loNl/h8M/IxQqQ1cQGS4eSrBAwX/SkWYqVqP3xfVSoaMN O7Hx/XlT8k21Bkj7ASFxKM3aQXqUpX/gbuHAQO2VXGGAevB78Ogb91pfzofCDTcRoFjJ vw== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3pn2ty1pa8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 30 Mar 2023 03:10:10 -0700 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; Thu, 30 Mar 2023 03:10:09 -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.48 via Frontend Transport; Thu, 30 Mar 2023 03:10:09 -0700 Received: from localhost.localdomain (unknown [10.28.36.158]) by maili.marvell.com (Postfix) with ESMTP id ABFF05C68F5; Thu, 30 Mar 2023 03:10:05 -0700 (PDT) From: Rahul Bhansali To: , Radu Nicolau , Akhil Goyal CC: Rahul Bhansali Subject: [PATCH] examples/ipsec-secgw: fix zero address in ethernet header Date: Thu, 30 Mar 2023 15:39:06 +0530 Message-ID: <20230330100907.2186135-1-rbhansali@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: Bo4dNeRB8seeY40k5gHjalgVWRPIMjgK X-Proofpoint-ORIG-GUID: Bo4dNeRB8seeY40k5gHjalgVWRPIMjgK X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-30_04,2023-03-30_01,2023-02-09_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 During port init, src address stored in ethaddr_tbl is typecast which violates the stric-aliasing rule and not reflecting the updated source address in processed packets too. Fixes: 6eb3ba0399 ("examples/ipsec-secgw: support poll mode NEON LPM lookup") Signed-off-by: Rahul Bhansali --- examples/ipsec-secgw/ipsec-secgw.c | 20 ++++++++++---------- examples/ipsec-secgw/ipsec-secgw.h | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c index d2d9d85b4a..029749e522 100644 --- a/examples/ipsec-secgw/ipsec-secgw.c +++ b/examples/ipsec-secgw/ipsec-secgw.c @@ -99,10 +99,10 @@ uint32_t qp_desc_nb = 2048; #define MTU_TO_FRAMELEN(x) ((x) + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN) struct ethaddr_info ethaddr_tbl[RTE_MAX_ETHPORTS] = { - { 0, ETHADDR(0x00, 0x16, 0x3e, 0x7e, 0x94, 0x9a) }, - { 0, ETHADDR(0x00, 0x16, 0x3e, 0x22, 0xa1, 0xd9) }, - { 0, ETHADDR(0x00, 0x16, 0x3e, 0x08, 0x69, 0x26) }, - { 0, ETHADDR(0x00, 0x16, 0x3e, 0x49, 0x9e, 0xdd) } + { {{0}}, {{0x00, 0x16, 0x3e, 0x7e, 0x94, 0x9a}} }, + { {{0}}, {{0x00, 0x16, 0x3e, 0x22, 0xa1, 0xd9}} }, + { {{0}}, {{0x00, 0x16, 0x3e, 0x08, 0x69, 0x26}} }, + { {{0}}, {{0x00, 0x16, 0x3e, 0x49, 0x9e, 0xdd}} } }; struct offloads tx_offloads; @@ -1427,9 +1427,8 @@ add_dst_ethaddr(uint16_t port, const struct rte_ether_addr *addr) if (port >= RTE_DIM(ethaddr_tbl)) return -EINVAL; - ethaddr_tbl[port].dst = ETHADDR_TO_UINT64(addr); - rte_ether_addr_copy((struct rte_ether_addr *)ðaddr_tbl[port].dst, - (struct rte_ether_addr *)(val_eth + port)); + rte_ether_addr_copy(addr, ðaddr_tbl[port].dst); + rte_ether_addr_copy(addr, (struct rte_ether_addr *)(val_eth + port)); return 0; } @@ -1907,11 +1906,12 @@ port_init(uint16_t portid, uint64_t req_rx_offloads, uint64_t req_tx_offloads, "Error getting MAC address (port %u): %s\n", portid, rte_strerror(-ret)); - ethaddr_tbl[portid].src = ETHADDR_TO_UINT64(ðaddr); + rte_ether_addr_copy(ðaddr, ðaddr_tbl[portid].src); - rte_ether_addr_copy((struct rte_ether_addr *)ðaddr_tbl[portid].dst, + rte_ether_addr_copy(ðaddr_tbl[portid].dst, (struct rte_ether_addr *)(val_eth + portid)); - rte_ether_addr_copy((struct rte_ether_addr *)ðaddr_tbl[portid].src, + + rte_ether_addr_copy(ðaddr_tbl[portid].src, (struct rte_ether_addr *)(val_eth + portid) + 1); print_ethaddr("Address: ", ðaddr); diff --git a/examples/ipsec-secgw/ipsec-secgw.h b/examples/ipsec-secgw/ipsec-secgw.h index 0e0012d058..53665adf03 100644 --- a/examples/ipsec-secgw/ipsec-secgw.h +++ b/examples/ipsec-secgw/ipsec-secgw.h @@ -84,7 +84,7 @@ struct ipsec_traffic_nb { /* port/source ethernet addr and destination ethernet addr */ struct ethaddr_info { - uint64_t src, dst; + struct rte_ether_addr src, dst; }; struct ipsec_spd_stats { -- 2.25.1