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 50019433ED; Tue, 28 Nov 2023 07:43:53 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1B4EA410DD; Tue, 28 Nov 2023 07:43:53 +0100 (CET) Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on2071.outbound.protection.outlook.com [40.107.15.71]) by mails.dpdk.org (Postfix) with ESMTP id B4FC240E54 for ; Tue, 28 Nov 2023 07:43:51 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=N340nwNyESJ5siLuW7aN8ndGlz13CYqL5xOYFx/4rvFHEgm91y+bEkh9XZehsSrzJJVpKDs3OqR6+dDPiXRucXtbNUzBaBL0RvozZOUHnShQzN/nO8XX43rINkrvPdyE1aDlthY3rroFcEFI2Wl2Q4ydW8HH/tvmyrr30tnSd0RBJcX+nQGTPbFvnt9pvNSTkcPNJ5gyjsO2pwQK0k3aMX0RSP1uq+gVZnEEXjoN6/lfMqE7Q+Sf6IBJvO6EOF8rRLsxv/lX/AJaqYsQ4EQeqdah0LCRlcp1EqJFVoK/EvoEyIAx9/7ILHs9Dt68XOmtHFoJILTkJDCmLxVBf84SVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=VxMhgn6PtM4ustcV0On5QpMWkuwrEmF6GpIpSwJbs6E=; b=FD9CiJjnF5zwrzR3jZcC1UVbzdW48ylHzvxKJYXMgqYRy+R5/xyhy17iHJpvo6NJKeGI2K1rXI1V34shiSLjTQ2qL1W5KSQHn/VNCxCXGXO9YoDXOZVzFcwPnNBN+pROg1oHadCbv7rRUToMJeUyBHOTGR4S/Jd0oG6zIy+REMo7itUxyJBi1S+ja2redeTGtYjBqCTP04sxRrStk1WWYCu5hPVP81Mc0M1HOk1zBGp7KwBxeGXLyar7rtaNt7ufM854D47NGt5kjjrDX/aty9fOjAr6j8d2biGtHuAUOHWPLzGjhsyCpat0wcZu6gOEqZsmBEn2TkTWEvdvJP1CXw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VxMhgn6PtM4ustcV0On5QpMWkuwrEmF6GpIpSwJbs6E=; b=sWqNiYzBF0cEwdeJMZTwjdlxmsCc8RsDOtf4WcW095c3UigfzKGx5FajF9UPj83kG2yMG0cLVWx6cIMWgPlS+/uwG87QOKof03qKcY7FImGOZVZ6vFcqffdMP0ksMN8cWgwbvO3bnUpOMDkbTjELshLG1vuDcB6HcQ0NwHc/T/k= Received: from PAXPR04MB9328.eurprd04.prod.outlook.com (2603:10a6:102:2b6::15) by AM9PR04MB7490.eurprd04.prod.outlook.com (2603:10a6:20b:2d9::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.21; Tue, 28 Nov 2023 06:43:50 +0000 Received: from PAXPR04MB9328.eurprd04.prod.outlook.com ([fe80::99b2:221d:bdda:3d6f]) by PAXPR04MB9328.eurprd04.prod.outlook.com ([fe80::99b2:221d:bdda:3d6f%5]) with mapi id 15.20.7046.015; Tue, 28 Nov 2023 06:43:50 +0000 From: Hemant Agrawal To: Stephen Hemminger CC: Tyler Retzlaff , "dev@dpdk.org" , Sachin Saxena , Gagandeep Singh Subject: RE: [PATCH v4 10/10] common/dpaxx: remove zero length array Thread-Topic: [PATCH v4 10/10] common/dpaxx: remove zero length array Thread-Index: AQHaG9RoX5hiMbAg/Uq1yUqincr6HLCEmQJggABj74CAAAjtgIAA6/DggAJaOYCABvD9AA== Date: Tue, 28 Nov 2023 06:43:50 +0000 Message-ID: References: <20230113215205.125767-1-stephen@networkplumber.org> <20231120170942.197172-1-stephen@networkplumber.org> <20231120170942.197172-11-stephen@networkplumber.org> <20231121084641.39e7b39b@hermes.local> <20231121171837.GA7518@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> <20231123111831.0d67fa44@hermes.local> In-Reply-To: <20231123111831.0d67fa44@hermes.local> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PAXPR04MB9328:EE_|AM9PR04MB7490:EE_ x-ms-office365-filtering-correlation-id: 04bb4d2b-03ea-4566-b2da-08dbefdd616c x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: EY4T+cC7ThGXJ6fkSW1qfSxf7sfE3WiQsteQIGLI7etjcqFf1QLf2ygChymNaUW/tBZFt6To8CuYru+m6N2uwQmT2qo3+Fd2V1HkaI/Z+9vvlkdJA8jDZS8gvTgt16e5aWuaPqVXfG9+N/QTofnfSBqYVw8PFdoRCVg8So4BkQUBmOLSNMom37agHDClavEgV4ig4T/NNF44o9R9x7E3XAPJ9DF5CAQIpFrAEaC5M7raeWmS8lNvwo20b+33GfH79yyF5iXRbkI4PUH0lDeCJ7qghwh42993INYJubLehFIx1wp7TqjAzDcNheUvds7YpexYAZd5ApUd8gX4aehPr67/5z5PQsjttgC7IResHXT6/Rq6Ko1nZd5Voyb9wIhupiSkrV94K0rgBga2ZtG0Hj+xaouSE8T2CdqT6CyyutoZYzqt//oeaI+jVkmjmOSdYcYt4Iq0XJ6cR4v22mkJwE1jlMwbEFVAL9wfBAU9sZ9LzEmo8v4Zv7zUoIP7XpKLXGK7bCyT9p7z3yu9SBl+q4YaznNguxZfN/r3sxbYzSgutVC0IaQ6zzNIfRKErFgRFbRMwPF5pG0ynhZ6+/5o76tODRjygBJRNqmKnAiLYYD/txFnfZixFJB5Syy4uUZ5 x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAXPR04MB9328.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(366004)(376002)(346002)(396003)(136003)(39860400002)(230922051799003)(1800799012)(64100799003)(451199024)(186009)(83380400001)(38100700002)(7696005)(122000001)(4326008)(8936002)(53546011)(55236004)(71200400001)(8676002)(6506007)(55016003)(66476007)(54906003)(66556008)(66946007)(66446008)(76116006)(316002)(5660300002)(52536014)(86362001)(44832011)(64756008)(478600001)(6916009)(2906002)(33656002)(9686003)(38070700009)(41300700001)(26005); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?TGJTPDZ6THIRbpKhKL+9mUZQbkzByJDZlzpc86z860YC0iV8vLGV2SSuSp8c?= =?us-ascii?Q?Sq0EEAAOZTekp31FMDYMODFbNMuKdI8VD61b2ul0/fdPtevr2R1+u8Lk7NxB?= =?us-ascii?Q?Kp4rOzwjE1JoiHWgcvL/8X4+LQyMcYLad2g3v0VilsbhCm/3eUw4OCaTrKiO?= =?us-ascii?Q?ziXQmwcgq1BUvbOzNAJKIcJSJt5wRuAv+Dl9mAI8ZbCJzSfh1uxwTPMpf3Ur?= =?us-ascii?Q?vjlHKt+eSWr/oklch7Ofz48PJljMwyjP1/x8jJ9oOFFQknZucBsoXmljwCur?= =?us-ascii?Q?bknZsk6573aXutsGTxjz/n6Nn/kHwIMgeDUy04qcehHcFwNCF2rjKchYSt3G?= =?us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+kYvM9WgqRrKySEdo38a5qPracZ?= =?us-ascii?Q?E+XfBuM77T4my8X1MfhUbim/jwf+9cpYBLaSc6jd+xTgvs8yYWen7DieMqWs?= =?us-ascii?Q?QbImQjNcMJiyEVvVjd6UXkE3Uy4JSrvI2bqgM6uZ5IsV0wBVIN+6S9xa34T3?= =?us-ascii?Q?DkxGqTwjtoV3AWlmgAP30j71/3U70eiXbQBgLx8VgqNxH8FkoGLsI/vLzQPZ?= =?us-ascii?Q?anoWQ1rCdzi6lG3CfJCzqan0Q97BizwbbQcBlOYtd7OoUbQVRBktCaFvDzm6?= =?us-ascii?Q?mcoYnhgjj70fBIwiWKaAYQ0UgaNLmShbLFn9WKdfNteOgvHtitCSPxP/J/jh?= =?us-ascii?Q?O2Pz1vx1HvzZ1EiArd07GjgS6/XMmrqAIQmMK4XG?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9328.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 04bb4d2b-03ea-4566-b2da-08dbefdd616c X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Nov 2023 06:43:50.3791 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 6SB24Oad0+ZiErc5uhvWAJZQ4o3Np5xrkOJ62j9VBhxLyGhfkKdoy6dlZO/vPyN650bZ09XVKwZhZ8yqqc3NjA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB7490 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 Acked-by: Hemant Agrawal > -----Original Message----- > From: Stephen Hemminger > Sent: Friday, November 24, 2023 12:49 AM > To: Hemant Agrawal > Cc: Tyler Retzlaff ; dev@dpdk.org; Sachin > Saxena ; Gagandeep Singh > Subject: Re: [PATCH v4 10/10] common/dpaxx: remove zero length array > Importance: High >=20 > This is a better alternative. >=20 > From 52c805b9526dbef62377276c4499c997fbc96268 Mon Sep 17 00:00:00 > 2001 > From: Stephen Hemminger > Date: Thu, 23 Nov 2023 11:12:02 -0800 > Subject: [PATCH] common/dpaxx: replace zero length array >=20 > The zero length ip_header is used as an overlay to the encap IP header. S= ince > the code is already assuming the layout of the structure, replace the arr= ay > with direct access. >=20 > Signed-off-by: Stephen Hemminger > --- > drivers/common/dpaax/caamflib/desc/ipsec.h | 20 ++++++++++++++------ > 1 file changed, 14 insertions(+), 6 deletions(-) >=20 > diff --git a/drivers/common/dpaax/caamflib/desc/ipsec.h > b/drivers/common/dpaax/caamflib/desc/ipsec.h > index 95fc3ea5ba3b..d1411cc6aab4 100644 > --- a/drivers/common/dpaax/caamflib/desc/ipsec.h > +++ b/drivers/common/dpaax/caamflib/desc/ipsec.h > @@ -334,9 +334,7 @@ struct ipsec_encap_gcm { > * @seq_num: IPsec sequence number > * @spi: IPsec SPI (Security Parameters Index) > * @ip_hdr_len: optional IP Header length (in bytes) > - * reserved - 16b > - * Opt. IP Hdr Len - 16b > - * @ip_hdr: optional IP Header content (only for IPsec legacy mode) > + * Ip header must follow directly after ipsec_encap_pdb > */ > struct ipsec_encap_pdb { > uint32_t options; > @@ -350,7 +348,6 @@ struct ipsec_encap_pdb { > }; > uint32_t spi; > uint32_t ip_hdr_len; > - uint8_t ip_hdr[0]; > }; >=20 > static inline unsigned int > @@ -776,7 +773,12 @@ cnstr_shdsc_ipsec_encap(uint32_t *descbuf, bool > ps, bool swap, > PROGRAM_SET_36BIT_ADDR(p); > phdr =3D SHR_HDR(p, share, hdr, 0); > __rta_copy_ipsec_encap_pdb(p, pdb, cipherdata->algtype); > - COPY_DATA(p, pdb->ip_hdr, pdb->ip_hdr_len); > + > + /* ip header if any follows the encap_pdb */ > + if (pdb->ip_hdr_len > 0) { > + void *ip_hdr =3D pdb + 1; > + COPY_DATA(p, ip_hdr, pdb->ip_hdr_len); > + } > SET_LABEL(p, hdr); > pkeyjmp =3D JUMP(p, keyjmp, LOCAL_JUMP, ALL_TRUE, BOTH|SHRD); > if (authdata->keylen) > @@ -913,7 +915,13 @@ cnstr_shdsc_ipsec_encap_des_aes_xcbc(uint32_t > *descbuf, > PROGRAM_CNTXT_INIT(p, descbuf, 0); > phdr =3D SHR_HDR(p, share, hdr, 0); > __rta_copy_ipsec_encap_pdb(p, pdb, cipherdata->algtype); > - COPY_DATA(p, pdb->ip_hdr, pdb->ip_hdr_len); > + > + /* ip header if any follows the encap_pdb */ > + if (pdb->ip_hdr_len > 0) { > + void *ip_hdr =3D pdb + 1; > + COPY_DATA(p, ip_hdr, pdb->ip_hdr_len); > + } > + > SET_LABEL(p, hdr); > pkeyjump =3D JUMP(p, keyjump, LOCAL_JUMP, ALL_TRUE, SHRD | > SELF); > /* > -- > 2.42.0