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 ACC0A4571D; Fri, 2 Aug 2024 19:33:29 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3D5E940E22; Fri, 2 Aug 2024 19:33:29 +0200 (CEST) Received: from mail-pg1-f172.google.com (mail-pg1-f172.google.com [209.85.215.172]) by mails.dpdk.org (Postfix) with ESMTP id C8B9C40E0A for ; Fri, 2 Aug 2024 19:33:27 +0200 (CEST) Received: by mail-pg1-f172.google.com with SMTP id 41be03b00d2f7-6e7b121be30so5595649a12.1 for ; Fri, 02 Aug 2024 10:33:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1722620007; x=1723224807; 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=+8h9w4x4rBeVcChejNFBZZXxFAgYKBZH4i07lpVqepA=; b=1cDwR9gbCssmGU5Pprut2XVgZhHKoqHiAxASzoYJns7VHRU+cn7x/Ke+AyGtCKQfUI aqjAyIPVYk++zJZceH31NMCYGH6sF/gybW+f2N50w3Is/rhgO8TVnNmlxxVUTrsRrS8f P0pZYHTloFQ8+GoO6+md+Orua2VFTZSkgXJHrv0vMHF4Ok4Ut+r/Z1Xg5nbeLFkRIe+O j4OzgISyqsZQ3N1Y0Re2NfBiF4BbI6kv3M5Y52rWoPncqSfcK+4XScP2371Jwe51mM6D rbUrev25myQa+W2YFgl2dES6/yvUv7mPQMFbTo4LoWKL+LAVhDTYUpMTm/GkD9h1SdTh F0+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722620007; x=1723224807; 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=+8h9w4x4rBeVcChejNFBZZXxFAgYKBZH4i07lpVqepA=; b=G01usyQm+8bPq0yr63TLdecay/ZOjo4ZVAv4ATa3Mybl/831lDfEJF5FQebSVy464D QfRhy8bmIm2BW5U4y5M+waqvzeMxH0+jahh7M5SY9L/HofCc1q+elg2kzw2XY8cxKftQ gBRJj0j/60TZuMWEcFoX6EsLgs5KmbpSf4tFBFvYNDwTzeMZ9Ke7qhTQAC0gEwf3+f6m zDqdDgAHo6rmeZKcCjE2Eu61dYd8BBFyYpQ6boHp9gWnm8CDrjeHIinGvHfb/yHf/HNk BPffHMDithe/a83+G3Inh/NE9vrk89tPz1YN2kN4FOGWV53DAyE9RsuXK51FD8+9hMt8 za4A== X-Forwarded-Encrypted: i=1; AJvYcCUkEBqC2/rfVrC3eZsrQwWJXEh2/8mUpME0x3otMkuDsvn/SmHnXuGBIZtdJ1KAkNwF2smCQgMGXUkAZL8= X-Gm-Message-State: AOJu0Yz6Q7WM59h6YDZQ4WLoSpAYVQ356PkmfWcZD6C7x/Dt8+THKLhr 5Y9cTBg9Due12OqNh8cuj59XONoEVXgjBETwZoK+sm7INufSIthRXvtDaoHIipy4Ot+k0dR97h7 U X-Google-Smtp-Source: AGHT+IGah12zkazTsaq4wMt+u4nmsZ3UE0v++ptBswd7uivsZH/eAwyFv7Bjs3hoXXzUG+sSgRWatA== X-Received: by 2002:a17:90b:17c4:b0:2c7:f3de:27ef with SMTP id 98e67ed59e1d1-2cff95647eamr4733535a91.42.1722620006784; Fri, 02 Aug 2024 10:33:26 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2cffb36f07dsm2031697a91.37.2024.08.02.10.33.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Aug 2024 10:33:26 -0700 (PDT) Date: Fri, 2 Aug 2024 10:33:24 -0700 From: Stephen Hemminger To: Morten =?UTF-8?B?QnLDuHJ1cA==?= Cc: "Long Li" , "Wei Hu" , , , Subject: Re: [PATCH] netvsc: optimize stats counters performance Message-ID: <20240802103324.2e0903c8@hermes.local> In-Reply-To: <98CBD80474FA8B44BF855DF32C47DC35E9F5F3@smartserver.smartshare.dk> References: <20240802144048.270152-1-mb@smartsharesystems.com> <98CBD80474FA8B44BF855DF32C47DC35E9F5F3@smartserver.smartshare.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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 On Fri, 2 Aug 2024 19:28:26 +0200 Morten Br=C3=B8rup wrote: > > > ea =3D rte_pktmbuf_mtod(m, const struct rte_ether_addr *); > > > - if (rte_is_multicast_ether_addr(ea)) { > > > - if (rte_is_broadcast_ether_addr(ea)) > > > - stats->broadcast++; > > > - else > > > - stats->multicast++; > > > - } > > > + RTE_BUILD_BUG_ON(offsetof(struct hn_stats, broadcast) !=3D > > > + offsetof(struct hn_stats, multicast) + =20 > > sizeof(uint64_t)); =20 > > > + if (unlikely(rte_is_multicast_ether_addr(ea))) > > > + (&stats->multicast)[rte_is_broadcast_ether_addr(ea)]++; > > > } =20 > >=20 > > This makes the code a little harder to read. =20 >=20 > I agree it is somewhat convoluted. > It's a tradeoff... I preferred performance at the cost of making the code= somewhat harder to read. > The RTE_BUILD_BUG_ON() also helps showing what is going on with the weird= indexing. Optimizing for multicast packets is not worth bothering. Keep the original code it is simpler.