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 34E08433B9; Fri, 24 Nov 2023 17:53:17 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C9C80402CC; Fri, 24 Nov 2023 17:53:16 +0100 (CET) Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) by mails.dpdk.org (Postfix) with ESMTP id 3213040283 for ; Fri, 24 Nov 2023 17:53:16 +0100 (CET) Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-1cfa71b6029so4599685ad.1 for ; Fri, 24 Nov 2023 08:53:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1700844795; x=1701449595; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=PpE+luHHnmX2rt6IthsxKufkwkhzaFdIVOJAwnwHr14=; b=vYhES0ovmvH0Aae44dRYhUE/J/nMWoWWXqc017j0xwyWSPAwpp0RZp7OqQo4U2w/Gg dr15dQPmciigbYZjsBX5tpzRQ0o8Up5QMTIvzZ99hw0qZg8yjLomZr2N2KqKByht8BNo YBQXJJNqXWmtnC5Al83pWnTvXGqvXjkxr6czdnMCAETL/shKXObMC2VNbPGqYeifc6Nc TSHh+HYBKTpfDouqpnan+Wh3kO3Uclxo98Cc9cL7ayfgDQDNInuQmOMYtMdXh6z7krsL Oph+K3KnL1lQgt7NfSRBPJPhufBlQNic0OZjH0h3cBuKTKQmAb/BBTTTOSgwCatfxUCM kVvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700844795; x=1701449595; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PpE+luHHnmX2rt6IthsxKufkwkhzaFdIVOJAwnwHr14=; b=ZiAiCTl5BYEiwhsd7ReebSX1ggaJxuoC54KyzCMWUbEhM7YFDDhv7RDoBsOWJbuGDA lqmnujb89gP1FnHWyYumlE6ZW8e4gB1LCtZfuZtQrPHUQKo3pTLvIXhiAGuDuVeUAd4P rHY6NeufiuYe3Peh2NfTwtGjMBl0qSyY23xFgXcb+8sE1G+g/0GfS2T4IQfYQee565GT dLu3gYpkdYY4N450rMN4o4mnQC5VrQ7n+jW/5Qa650ierZAmxH+q+lWWV+DZJvXsvKzh ne6zCVuRY+b2LK/J9xlJ/kbI66GUPe8+Wld0D7qjinUrW+i+QxVYrhmZ4OD2wHeANl/q xijA== X-Gm-Message-State: AOJu0Yz5OPTQHe6mrrASU6RoeIwKO5I/BlnH6zZbM+7hwTCQ416SOo+t Cmm81vinSNq3eRiCR/RS2GXtaQ== X-Google-Smtp-Source: AGHT+IG7SDO5RsT5Bg+IPmpYQtlta0bzBMVIeBhYgv/bA2XApGkfhcCyM/LtUO5tx35ZBj/Wf4p6hg== X-Received: by 2002:a17:902:684e:b0:1cf:8a78:21f2 with SMTP id f14-20020a170902684e00b001cf8a7821f2mr3251555pln.38.1700844795331; Fri, 24 Nov 2023 08:53:15 -0800 (PST) Received: from hermes.local (204-195-123-141.wavecable.com. [204.195.123.141]) by smtp.gmail.com with ESMTPSA id d12-20020a170902cecc00b001cf69103b91sm3374699plg.130.2023.11.24.08.53.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Nov 2023 08:53:14 -0800 (PST) Date: Thu, 23 Nov 2023 11:18:31 -0800 From: Stephen Hemminger 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 Message-ID: <20231123111831.0d67fa44@hermes.local> In-Reply-To: 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> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable 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 This is a better alternative. =46rom 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 The zero length ip_header is used as an overlay to the encap IP header. Since the code is already assuming the layout of the structure, replace the array with direct access. Signed-off-by: Stephen Hemminger --- drivers/common/dpaax/caamflib/desc/ipsec.h | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/drivers/common/dpaax/caamflib/desc/ipsec.h b/drivers/common/dp= aax/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, bo= ol 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); /* --=20 2.42.0