netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jacob Keller <jacob.e.keller@intel.com>
To: Suman Ghosh <sumang@marvell.com>, <davem@davemloft.net>,
	<edumazet@google.com>, <kuba@kernel.org>, <pabeni@redhat.com>,
	<sgoutham@marvell.com>, <sbhatta@marvell.com>,
	<jerinj@marvell.com>, <gakula@marvell.com>, <hkelam@marvell.com>,
	<lcherian@marvell.com>, <netdev@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [net PATCH] octeontx2-af: Fix marking couple of structure as __packed
Date: Mon, 18 Dec 2023 12:44:23 -0800	[thread overview]
Message-ID: <c48b24d9-f05f-4c66-a0ca-5cd6f59bea0c@intel.com> (raw)
In-Reply-To: <20231218082758.247831-1-sumang@marvell.com>



On 12/18/2023 12:27 AM, Suman Ghosh wrote:
> Couple of structures was not marked as __packed which may have some
> performance implication. This patch fixes the same and mark them as
> __packed.

Not sure I follow why lack of __packed would have performance
implications? I get that __packed is important to ensure layout is
correct or to ensure the whole structure has the right size rather than
unexpected gaps. I'd guess maybe because the structures size would
include padding without __packed, leading to a lot of gaps when
combining several structures together...

I did test on my system with pahole, and even without __packed, I don't
get any gaps in the npc_lt_def_cfg structure:


> struct npc_lt_def_cfg {
>         struct npc_lt_def          rx_ol2;               /*     0     3 */
>         struct npc_lt_def          rx_oip4;              /*     3     3 */
>         struct npc_lt_def          rx_iip4;              /*     6     3 */
>         struct npc_lt_def          rx_oip6;              /*     9     3 */
>         struct npc_lt_def          rx_iip6;              /*    12     3 */
>         struct npc_lt_def          rx_otcp;              /*    15     3 */
>         struct npc_lt_def          rx_itcp;              /*    18     3 */
>         struct npc_lt_def          rx_oudp;              /*    21     3 */
>         struct npc_lt_def          rx_iudp;              /*    24     3 */
>         struct npc_lt_def          rx_osctp;             /*    27     3 */
>         struct npc_lt_def          rx_isctp;             /*    30     3 */
>         struct npc_lt_def_ipsec    rx_ipsec[2];          /*    33    10 */
>         struct npc_lt_def          pck_ol2;              /*    43     3 */
>         struct npc_lt_def          pck_oip4;             /*    46     3 */
>         struct npc_lt_def          pck_oip6;             /*    49     3 */
>         struct npc_lt_def          pck_iip4;             /*    52     3 */
>         struct npc_lt_def_apad     rx_apad0;             /*    55     4 */
>         struct npc_lt_def_apad     rx_apad1;             /*    59     4 */
>         struct npc_lt_def_color    ovlan;                /*    63     5 */
>         /* --- cacheline 1 boundary (64 bytes) was 4 bytes ago --- */
>         struct npc_lt_def_color    ivlan;                /*    68     5 */
>         struct npc_lt_def_color    rx_gen0_color;        /*    73     5 */
>         struct npc_lt_def_color    rx_gen1_color;        /*    78     5 */
>         struct npc_lt_def_et       rx_et[2];             /*    83    10 */
> 
>         /* size: 93, cachelines: 2, members: 23 */
>         /* last cacheline: 29 bytes */
> };


However that may not be true across all compilers etc. Also all the
other structures are __packed. Makes sense.

Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>

> 
> Fixes: 42006910b5ea ("octeontx2-af: cleanup KPU config data")
> Signed-off-by: Suman Ghosh <sumang@marvell.com>
> ---
>  drivers/net/ethernet/marvell/octeontx2/af/npc.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/marvell/octeontx2/af/npc.h b/drivers/net/ethernet/marvell/octeontx2/af/npc.h
> index ab3e39eef2eb..8c0732c9a7ee 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/af/npc.h
> +++ b/drivers/net/ethernet/marvell/octeontx2/af/npc.h
> @@ -528,7 +528,7 @@ struct npc_lt_def {
>  	u8	ltype_mask;
>  	u8	ltype_match;
>  	u8	lid;
> -};
> +} __packed;
>  
>  struct npc_lt_def_ipsec {
>  	u8	ltype_mask;
> @@ -536,7 +536,7 @@ struct npc_lt_def_ipsec {
>  	u8	lid;
>  	u8	spi_offset;
>  	u8	spi_nz;
> -};
> +} __packed;
>  
>  struct npc_lt_def_apad {
>  	u8	ltype_mask;

  reply	other threads:[~2023-12-18 20:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-18  8:27 [net PATCH] octeontx2-af: Fix marking couple of structure as __packed Suman Ghosh
2023-12-18 20:44 ` Jacob Keller [this message]
2023-12-19 14:22   ` [EXT] " Suman Ghosh
2023-12-19 15:26   ` David Laight
2023-12-19 21:05     ` Jacob Keller
2023-12-20 13:04       ` [EXT] " Suman Ghosh

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=c48b24d9-f05f-4c66-a0ca-5cd6f59bea0c@intel.com \
    --to=jacob.e.keller@intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=gakula@marvell.com \
    --cc=hkelam@marvell.com \
    --cc=jerinj@marvell.com \
    --cc=kuba@kernel.org \
    --cc=lcherian@marvell.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sbhatta@marvell.com \
    --cc=sgoutham@marvell.com \
    --cc=sumang@marvell.com \
    /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).