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 9D4D543F15 for ; Fri, 26 Apr 2024 12:20:30 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 93CE743D6F; Fri, 26 Apr 2024 12:20:30 +0200 (CEST) Received: from mail.lysator.liu.se (mail.lysator.liu.se [130.236.254.3]) by mails.dpdk.org (Postfix) with ESMTP id 1727340289; Fri, 26 Apr 2024 12:20:28 +0200 (CEST) Received: from mail.lysator.liu.se (localhost [127.0.0.1]) by mail.lysator.liu.se (Postfix) with ESMTP id 08351134B2; Fri, 26 Apr 2024 12:20:27 +0200 (CEST) Received: by mail.lysator.liu.se (Postfix, from userid 1004) id EF713133CF; Fri, 26 Apr 2024 12:20:26 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on hermod.lysator.liu.se X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=ALL_TRUSTED,AWL, T_SCC_BODY_TEXT_LINE autolearn=disabled version=4.0.0 X-Spam-Score: -1.3 Received: from [192.168.1.59] (h-62-63-215-114.A163.priv.bahnhof.se [62.63.215.114]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.lysator.liu.se (Postfix) with ESMTPSA id 4CD2D133CE; Fri, 26 Apr 2024 12:20:25 +0200 (CEST) Message-ID: <8a54f534-e31d-426c-9eaf-0cc23811fdba@lysator.liu.se> Date: Fri, 26 Apr 2024 12:20:24 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] net/af_packet: cache align Rx/Tx structs To: Ferruh Yigit , =?UTF-8?Q?Mattias_R=C3=B6nnblom?= , dev@dpdk.org Cc: =?UTF-8?Q?Morten_Br=C3=B8rup?= , Stephen Hemminger , Thomas Monjalon , "John W . Linville" , stable@dpdk.org References: <20240423090813.94110-1-mattias.ronnblom@ericsson.com> <20240426073824.100386-1-mattias.ronnblom@ericsson.com> <6b207998-1219-459c-8099-77948744e9da@amd.com> Content-Language: en-US From: =?UTF-8?Q?Mattias_R=C3=B6nnblom?= In-Reply-To: <6b207998-1219-459c-8099-77948744e9da@amd.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: ClamAV using ClamSMTP X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org On 2024-04-26 10:27, Ferruh Yigit wrote: > 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 >> --- >> 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 >> #include >> #include >> #include >> @@ -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 { > ... > }; > ``` Right. Sorry, forgot about that. I've made a v3 (which is actually marked v3).