patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Ferruh Yigit <ferruh.yigit@amd.com>
To: "Mattias Rönnblom" <mattias.ronnblom@ericsson.com>, dev@dpdk.org
Cc: hofors@lysator.liu.se, "Morten Brørup" <mb@smartsharesystems.com>,
	"Stephen Hemminger" <stephen@networkplumber.org>,
	"Thomas Monjalon" <thomas@monjalon.net>,
	"John W . Linville" <linville@tuxdriver.com>,
	stable@dpdk.org
Subject: Re: [PATCH] net/af_packet: cache align Rx/Tx structs
Date: Fri, 26 Apr 2024 09:27:20 +0100	[thread overview]
Message-ID: <6b207998-1219-459c-8099-77948744e9da@amd.com> (raw)
In-Reply-To: <20240426073824.100386-1-mattias.ronnblom@ericsson.com>

On 4/26/2024 8:38 AM, Mattias Rönnblom wrote:
> Cache align Rx and Tx queue struct to avoid false sharing.
> 
> RX struct happens to be 64 bytes on x86_64 already, so cache alignment
> has no effect there, but it does on 32-bit ISAs.
> 
> TX struct is 56 bytes on x86_64.
> 
> Both structs keep counters, and in the RX case they are updated even
> for empty polls.
> 
> Fixes: 364e08f2bbc0 ("af_packet: add PMD for AF_PACKET-based virtual devices")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
> ---
>  drivers/net/af_packet/rte_eth_af_packet.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
> index 397a32db58..28aeb7d08e 100644
> --- a/drivers/net/af_packet/rte_eth_af_packet.c
> +++ b/drivers/net/af_packet/rte_eth_af_packet.c
> @@ -6,6 +6,7 @@
>   * All rights reserved.
>   */
>  
> +#include <rte_common.h>
>  #include <rte_string_fns.h>
>  #include <rte_mbuf.h>
>  #include <ethdev_driver.h>
> @@ -53,7 +54,7 @@ struct pkt_rx_queue {
>  
>  	volatile unsigned long rx_pkts;
>  	volatile unsigned long rx_bytes;
> -};
> +} __rte_cache_aligned;
>  
>  struct pkt_tx_queue {
>  	int sockfd;
> @@ -67,7 +68,7 @@ struct pkt_tx_queue {
>  	volatile unsigned long tx_pkts;
>  	volatile unsigned long err_pkts;
>  	volatile unsigned long tx_bytes;
> -};
> +} __rte_cache_aligned;
>  
>  struct pmd_internals {
>  	unsigned nb_queues;

Hi Mattias,

I guess my comment missed, location of '__rte_cache_aligned' tag changed
for MSVC support, it should be like:
```
struct __rte_cache_aligned pkt_rx_queue {
...
};
```

  reply	other threads:[~2024-04-26  8:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20240423090813.94110-1-mattias.ronnblom@ericsson.com>
2024-04-26  7:38 ` Mattias Rönnblom
2024-04-26  8:27   ` Ferruh Yigit [this message]
2024-04-26 10:20     ` Mattias Rönnblom
2024-04-26  9:05   ` [PATCH v3] " Mattias Rönnblom
2024-04-26  9:22     ` Morten Brørup
2024-04-26 15:10     ` Stephen Hemminger
2024-04-26 15:41     ` Tyler Retzlaff
2024-04-29  8:46       ` Ferruh Yigit

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=6b207998-1219-459c-8099-77948744e9da@amd.com \
    --to=ferruh.yigit@amd.com \
    --cc=dev@dpdk.org \
    --cc=hofors@lysator.liu.se \
    --cc=linville@tuxdriver.com \
    --cc=mattias.ronnblom@ericsson.com \
    --cc=mb@smartsharesystems.com \
    --cc=stable@dpdk.org \
    --cc=stephen@networkplumber.org \
    --cc=thomas@monjalon.net \
    /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).