DPDK patches and discussions
 help / color / mirror / Atom feed
From: Hemant Agrawal <hemant.agrawal@nxp.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: Tyler Retzlaff <roretzla@linux.microsoft.com>,
	"dev@dpdk.org" <dev@dpdk.org>,
	Sachin Saxena <sachin.saxena@nxp.com>,
	Gagandeep Singh <G.Singh@nxp.com>
Subject: RE: [PATCH v4 10/10] common/dpaxx: remove zero length array
Date: Tue, 28 Nov 2023 06:43:50 +0000	[thread overview]
Message-ID: <PAXPR04MB9328FD56BC7F746E6D58264889BCA@PAXPR04MB9328.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <20231123111831.0d67fa44@hermes.local>

Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>

> -----Original Message-----
> From: Stephen Hemminger <stephen@networkplumber.org>
> Sent: Friday, November 24, 2023 12:49 AM
> To: Hemant Agrawal <hemant.agrawal@nxp.com>
> Cc: Tyler Retzlaff <roretzla@linux.microsoft.com>; dev@dpdk.org; Sachin
> Saxena <sachin.saxena@nxp.com>; Gagandeep Singh <G.Singh@nxp.com>
> Subject: Re: [PATCH v4 10/10] common/dpaxx: remove zero length array
> Importance: High
> 
> This is a better alternative.
> 
> From 52c805b9526dbef62377276c4499c997fbc96268 Mon Sep 17 00:00:00
> 2001
> From: Stephen Hemminger <stephen@networkplumber.org>
> 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 <stephen@networkplumber.org>
> ---
>  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/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];
>  };
> 
>  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 = 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 = pdb + 1;
> +		COPY_DATA(p, ip_hdr, pdb->ip_hdr_len);
> +	}
>  	SET_LABEL(p, hdr);
>  	pkeyjmp = 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 = 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 = pdb + 1;
> +		COPY_DATA(p, ip_hdr, pdb->ip_hdr_len);
> +	}
> +
>  	SET_LABEL(p, hdr);
>  	pkeyjump = JUMP(p, keyjump, LOCAL_JUMP, ALL_TRUE, SHRD |
> SELF);
>  	/*
> --
> 2.42.0


  reply	other threads:[~2023-11-28  6:43 UTC|newest]

Thread overview: 84+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-13 21:51 [PATCH 0/7] replace zero length arrays Stephen Hemminger
2023-01-13 21:51 ` [PATCH 1/7] member: replace zero length array with flex array Stephen Hemminger
2023-01-14  0:19   ` Tyler Retzlaff
2023-01-14  0:36     ` Stephen Hemminger
2023-01-14  0:42       ` Tyler Retzlaff
2023-01-13 21:52 ` [PATCH 2/7] cryptodev: " Stephen Hemminger
2023-01-13 21:52 ` [PATCH 3/7] security: " Stephen Hemminger
2023-01-13 21:52 ` [PATCH 4/7] mlx5: " Stephen Hemminger
2023-01-14 17:08   ` Stephen Hemminger
2023-03-06 13:29     ` Slava Ovsiienko
2023-01-13 21:52 ` [PATCH 5/7] nfp: " Stephen Hemminger
2023-01-15 15:22   ` Niklas Söderlund
2023-01-13 21:52 ` [PATCH 6/7] enic: " Stephen Hemminger
2023-01-14  1:12   ` John Daley (johndale)
2023-01-13 21:52 ` [PATCH 7/7] dpaax: " Stephen Hemminger
2023-01-15 11:59   ` Hemant Agrawal
2023-01-14 10:43 ` [PATCH 0/7] replace zero length arrays Morten Brørup
2023-11-17  4:03 ` [PATCH v2 00/10] " Stephen Hemminger
2023-11-17  4:03   ` [PATCH v2 01/10] member: replace zero length array with flex array Stephen Hemminger
2023-11-17  4:17     ` Tyler Retzlaff
2023-11-17  4:03   ` [PATCH v2 02/10] cryptodev: " Stephen Hemminger
2023-11-17  4:18     ` Tyler Retzlaff
2023-11-17  4:03   ` [PATCH v2 03/10] security: " Stephen Hemminger
2023-11-17  4:18     ` Tyler Retzlaff
2023-11-17  4:03   ` [PATCH v2 04/10] pipeline: " Stephen Hemminger
2023-11-17  4:19     ` Tyler Retzlaff
2023-11-17  4:03   ` [PATCH v2 05/10] net/nfp: " Stephen Hemminger
2023-11-17  4:19     ` Tyler Retzlaff
2023-11-17  4:03   ` [PATCH v2 06/10] net/enic: " Stephen Hemminger
2023-11-17  4:20     ` Tyler Retzlaff
2023-11-17  4:03   ` [PATCH v2 07/10] net/mlx5: " Stephen Hemminger
2023-11-17  4:20     ` Tyler Retzlaff
2023-11-17  4:03   ` [PATCH v2 08/10] pdcp: " Stephen Hemminger
2023-11-17  4:20     ` Tyler Retzlaff
2023-11-17  5:28     ` [EXT] " Anoob Joseph
2023-11-17  4:03   ` [PATCH v2 09/10] net/cpfl: " Stephen Hemminger
2023-11-17  4:20     ` Tyler Retzlaff
2023-11-17  4:03   ` [PATCH v2 10/10] common/dpaxx: " Stephen Hemminger
2023-11-17  4:21     ` Tyler Retzlaff
2023-11-17  8:31   ` [PATCH v2 00/10] replace zero length arrays Morten Brørup
2023-11-17 16:18     ` Stephen Hemminger
2023-11-17 19:59       ` Tyler Retzlaff
2023-11-20 17:06 ` [PATCH v4 00/10] Replace " Stephen Hemminger
2023-11-20 17:06   ` [PATCH v4 01/10] member: replace zero length array with flex array Stephen Hemminger
2023-11-20 17:06   ` [PATCH v4 02/10] cryptodev: " Stephen Hemminger
2023-11-21  5:29     ` [EXT] " Anoob Joseph
2023-11-20 17:06   ` [PATCH v4 03/10] security: " Stephen Hemminger
2023-11-21  5:30     ` [EXT] " Anoob Joseph
2023-11-20 17:06   ` [PATCH v4 04/10] pipeline: " Stephen Hemminger
2023-11-20 17:07   ` [PATCH v4 05/10] net/nfp: " Stephen Hemminger
2023-11-21  1:14     ` Chaoyong He
2023-11-20 17:07   ` [PATCH v4 06/10] net/enic: " Stephen Hemminger
2023-11-20 17:07   ` [PATCH v4 07/10] net/mlx5: " Stephen Hemminger
2023-11-23 17:54     ` Dariusz Sosnowski
2023-11-20 17:07   ` [PATCH v4 08/10] pdcp: " Stephen Hemminger
2023-11-20 17:07   ` [PATCH v4 09/10] net/cpfl: " Stephen Hemminger
2023-11-20 17:07   ` [PATCH v4 10/10] common/dpaxx: remove zero length array Stephen Hemminger
2023-11-21 10:49     ` Hemant Agrawal
2023-11-21 16:46       ` Stephen Hemminger
2023-11-21 17:01         ` Stephen Hemminger
2023-11-21 17:18         ` Tyler Retzlaff
2023-11-22  7:23           ` Hemant Agrawal
2023-11-23  1:43             ` Stephen Hemminger
2023-11-23 19:18             ` Stephen Hemminger
2023-11-28  6:43               ` Hemant Agrawal [this message]
2023-11-21  7:26   ` [PATCH v4 00/10] Replace zero length arrays Morten Brørup
2023-11-21  8:30     ` fengchengwen
2023-11-29  2:39 ` [PATCH v5 " Stephen Hemminger
2023-11-29  2:39   ` [PATCH v5 01/10] member: replace zero length array with flex array Stephen Hemminger
2023-11-29  2:39   ` [PATCH v5 02/10] cryptodev: " Stephen Hemminger
2023-11-29  2:39   ` [PATCH v5 03/10] security: " Stephen Hemminger
2023-11-29  2:39   ` [PATCH v5 04/10] pipeline: " Stephen Hemminger
2023-11-29  2:39   ` [PATCH v5 05/10] net/nfp: " Stephen Hemminger
2023-11-30  1:21     ` Chaoyong He
2023-11-29  2:39   ` [PATCH v5 06/10] net/enic: " Stephen Hemminger
2023-11-29  2:39   ` [PATCH v5 07/10] net/mlx5: " Stephen Hemminger
2024-01-23  9:44     ` Thomas Monjalon
2024-01-23 10:28       ` Thomas Monjalon
2024-01-23 11:18         ` Dariusz Sosnowski
2023-11-29  2:39   ` [PATCH v5 08/10] pdcp: " Stephen Hemminger
2023-11-29  2:39   ` [PATCH v5 09/10] net/cpfl: " Stephen Hemminger
2023-11-29  2:39   ` [PATCH v5 10/10] common/dpaxx: replace zero length array Stephen Hemminger
2024-01-23  9:42     ` Thomas Monjalon
2024-01-23 10:48   ` [PATCH v5 00/10] Replace zero length arrays Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=PAXPR04MB9328FD56BC7F746E6D58264889BCA@PAXPR04MB9328.eurprd04.prod.outlook.com \
    --to=hemant.agrawal@nxp.com \
    --cc=G.Singh@nxp.com \
    --cc=dev@dpdk.org \
    --cc=roretzla@linux.microsoft.com \
    --cc=sachin.saxena@nxp.com \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).