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 302D7459D8; Thu, 19 Sep 2024 20:06:33 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EB82F406FF; Thu, 19 Sep 2024 20:06:32 +0200 (CEST) Received: from SN4PR2101CU001.outbound.protection.outlook.com (mail-southcentralusazon11022114.outbound.protection.outlook.com [40.93.195.114]) by mails.dpdk.org (Postfix) with ESMTP id 22DC14026B for ; Thu, 19 Sep 2024 20:06:31 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=lONyz1fzLPTNNPlvzMhBgfkzHNdZxZCKoz0v/df5sgmBUiETptFx0qaSFQM3NzweyM3l/MNQRi4M/LXre2GlT/syD3mGe3gbkRZCFGxX+vTQP637Bt//wJjRwbqh6Gc+ET7UKajMEXhmjpYcYEbkIhP+G9R2N86K8ESJUpjFV+BpUpBfEMv/+3Lf9Z1e4crV4phQIL+hGxbZ/EhQf0x7Rp/DPEp92hq6l6rdhGtUPXPEOufcZGtlO5AEMv86bi36aiyjNEGgBdL9mAqbpHOCtyvgxv7lQcqdNxCHji/72g338UovL+S2W+agsrFoB5hMpBtOrG2dqBbYW+QvITP8oQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=EovmaJiAcxroB+K7pzYwpHKFwfm7s8M+WQkZwFdVYJM=; b=u2Nt1yVSAcpU1m0JES44oV78lnJ1GCyF3ZBZmI3rnAnQbuGeVQmzop0/uts5rKNVocOCv8vjJYVepvkLIPl4h0tDwle4AMw2MlL41zo47eGppAlukXSrR7yG/i53qvpzo9tVWWefW1jxTPvhVWsmNSLkFt6gNN5i8/q2/Zhbzd/Tg5MMBPYUMYovxbq8foRnp+8i1cxzwJcZ30emQkPGRrXaTER/RzRFRAw8KkdYsrUtWIzPr/wXUnk+u40nrhsxC1+yqtyyAt1reqNE66RatVyXAvhx3NzwjAc2+FAPLEVT5JMtE3azSOvIGq/ryVQHBBI5RHXF9+ryNUIQpPtgaQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microsoft.com; dmarc=pass action=none header.from=microsoft.com; dkim=pass header.d=microsoft.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=EovmaJiAcxroB+K7pzYwpHKFwfm7s8M+WQkZwFdVYJM=; b=iZ38EFXlh0TkHuMD4DsQQlt4wrSx5ibQwwbnrgaWS7F2ADxwS/J5bXeU3P4+sShkyvehdk736m3BqXxzcFlfPBdt3W1a0yFoCq9c5R5cV3y1yluBbLjQyDlEQoxCfmgkdCBYLwejp523uC1UXlQrda+Qk0aA/wBJULe4wn59icc= Received: from PH0PR21MB4456.namprd21.prod.outlook.com (2603:10b6:510:337::12) by SN7PR21MB3884.namprd21.prod.outlook.com (2603:10b6:806:2e6::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8005.5; Thu, 19 Sep 2024 18:06:25 +0000 Received: from PH0PR21MB4456.namprd21.prod.outlook.com ([fe80::3a57:1b5a:a61f:eb1c]) by PH0PR21MB4456.namprd21.prod.outlook.com ([fe80::3a57:1b5a:a61f:eb1c%5]) with mapi id 15.20.8005.001; Thu, 19 Sep 2024 18:06:25 +0000 From: Long Li To: =?iso-8859-1?Q?Morten_Br=F8rup?= , Wei Hu CC: "maxime.coquelin@redhat.com" , "chenbox@nvidia.com" , "dev@dpdk.org" , Stephen Hemminger Subject: RE: [PATCH] netvsc: optimize stats counters performance Thread-Topic: [PATCH] netvsc: optimize stats counters performance Thread-Index: AQHa5On7Gn55khEDqUSxonnBGhTFxbIULTMAgAAC8FCAAAovAIBLMdMAgABHS5A= Date: Thu, 19 Sep 2024 18:06:24 +0000 Message-ID: References: <20240802144048.270152-1-mb@smartsharesystems.com><98CBD80474FA8B44BF855DF32C47DC35E9F5F3@smartserver.smartshare.dk> <20240802103324.2e0903c8@hermes.local> <98CBD80474FA8B44BF855DF32C47DC35E9F703@smartserver.smartshare.dk> In-Reply-To: <98CBD80474FA8B44BF855DF32C47DC35E9F703@smartserver.smartshare.dk> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ActionId=da0e0c1e-859e-4ca1-8c74-335291bf45d0; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ContentBits=0; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Enabled=true; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Method=Standard; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Name=Internal; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SetDate=2024-09-19T18:06:21Z; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SiteId=72f988bf-86f1-41af-91ab-2d7cd011db47; authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=microsoft.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PH0PR21MB4456:EE_|SN7PR21MB3884:EE_ x-ms-office365-filtering-correlation-id: 869c4c68-cfa5-42a3-5492-08dcd8d5c686 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230040|366016|1800799024|376014|38070700018; x-microsoft-antispam-message-info: =?iso-8859-1?Q?saR/Aa74ZSkxT+xkubO/ntRRg02w8FLmCWH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?Q?b/KqcEAzin+GSqPIsFAxMw3SIv4XwDR1mX0bx2oUKNmFmWiPvJ+eea3A6k?= =?iso-8859-1?Q?YzHvIAu8RP0Tgqf2qVHhkNetC351+PQNYZHO3xNBxIgjqLXbspVuOkhvFm?= =?iso-8859-1?Q?4xr3K6OsOAyGpAZu44GmbF31rLs+abbK4ESKZq/DiL8E0750aHI3keXKZl?= =?iso-8859-1?Q?SLGAMOOy3xDltd48HyzOuIYgeersePoScP2nrdSswLHpR0CZP63l7Fy42z?= =?iso-8859-1?Q?lEbD0hdWwc0XVW2W/ferGACK1XfCPMfCI6Wy1YncjGqmkF+BXeE7JgSdry?= =?iso-8859-1?Q?hwXxv1eFRgYyDe12Q7ubioVfkkEFLE5XHX2Ikz40c7GT3+EIdWixYeqfJA?= =?iso-8859-1?Q?tY3lu0yWKrtyKz/MnyTOBgCiEjtdjNXhN1Zd7CSUkNIswVDpgTvyolfqOZ?= =?iso-8859-1?Q?boJlOhFbeJDR1D3+yiZ/pXX2aSS6bp34BEE2oZyH3jVvE3VX6Hsx6/Ps7S?= =?iso-8859-1?Q?XefS7seq63J+soZcG2MXc2Wpv1LttxBw=3D=3D?= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH0PR21MB4456.namprd21.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(1800799024)(376014)(38070700018); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?1c6tWhtvcLYXFONZFywFphuaCu8EiFUwXQ8Il7al/k4LTtBHtOwe0z757j?= =?iso-8859-1?Q?iSoLyRo/uLI44A0s6YSCwQm6bPS7CvSnK9n0s4rKtS4IamZisP0KyT2hl+?= =?iso-8859-1?Q?knNrkbiIhx9j4huvbmON5t7DX8NAK0Xp/H7c9gqaBY+4zW09nid4Uq3Qa1?= =?iso-8859-1?Q?jbEW+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-8859-1?Q?2nu29s/iITCm4+nxJWpykwE5jxbqQt7hfbwaurTnf6v/sVn0+ElhX3PPzs?= =?iso-8859-1?Q?nbg/Xh+FzWA+UrgTvLOpqfHZPGgMI0RHMsyQkWvL18dBaO1tMWPmEAu/hi?= =?iso-8859-1?Q?7ejz3dopeysSzWmORYK8uNFaS30nWGuipu3aswphny2cdguG1dDrnCjazI?= =?iso-8859-1?Q?1XkhmRFs7Sv0ZWYrUThfBdcETAK75RygqIdw5OSDuZceZnqvOAn0dMMHDf?= =?iso-8859-1?Q?0pwgqTdYvYwuBR8RXZaJsAq1KOJYdSLeLyIkxuKzw0ynsVpFulXaqBzhjG?= =?iso-8859-1?Q?7COHig0wyXp/AngPCg/NEjpduyun8FrZS+gsFSlc2Cc2JRnBM5Bnk5tM2Z?= =?iso-8859-1?Q?5HL5aHiHnXhwqmOBlOVepL2fKPx3KtogUraOlvJjLWdgNOqUlUEcrQC42K?= =?iso-8859-1?Q?S5ohJZ9x6AR0VYFDV9E/+Xduwpw08pMKTYE1ovP624KTByfDaQsUV6s+ow?= =?iso-8859-1?Q?oJttF1MotGhPK1n831Jxm8p6YQ6uuL0aWuBO0DSqdVmVvcAccd45DbVXb1?= =?iso-8859-1?Q?Qj/WaEssCWFQQ19/wyBumV0PUD7Ifmkaex?= Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PH0PR21MB4456.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 869c4c68-cfa5-42a3-5492-08dcd8d5c686 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Sep 2024 18:06:24.9934 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 0K15NS+jRb4WfusYz3rHlN479dn1qdYG4lrVQtAVNla2lIdWiDlvuOe+NKZUG9sUzwJCmYw/YcmMEJG+O4RhBw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR21MB3884 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 > Subject: RE: [PATCH] netvsc: optimize stats counters performance >=20 > > From: Stephen Hemminger [mailto:stephen@networkplumber.org] > > Sent: Friday, 2 August 2024 19.33 > > > > On Fri, 2 Aug 2024 19:28:26 +0200 > > Morten Br=F8rup 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) + > > > > sizeof(uint64_t)); > > > > > + if (unlikely(rte_is_multicast_ether_addr(ea))) > > > > > + (&stats- > >multicast)[rte_is_broadcast_ether_addr(ea)]++; > > > > > } > > > > > > > > This makes the code a little harder to read. > > > > > > 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. >=20 > Similar patches have been accepted by other drivers: > [virtio]: > https://nam06.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fpatch= wor > k.dpdk.org%2Fproject%2Fdpdk%2Fpatch%2F20240801160312.205281-1- > mb%40smartsharesystems.com%2F&data=3D05%7C02%7Clongli%40microsoft.com > %7C014c845ad8ec4ea25fb508dcd8b22474%7C72f988bf86f141af91ab2d7cd011 > db47%7C1%7C0%7C638623506854135960%7CUnknown%7CTWFpbGZsb3d8eyJ > WIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0 > %7C%7C%7C&sdata=3DDrVP6TuTruREAxAoSEBED11TOapSqDN5stsDJJTuux0%3D&r > eserved=3D0 > [vhost-user]: > https://nam06.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fpatch= wor > k.dpdk.org%2Fproject%2Fdpdk%2Fpatch%2F20240802143259.269827-1- > mb%40smartsharesystems.com%2F&data=3D05%7C02%7Clongli%40microsoft.com > %7C014c845ad8ec4ea25fb508dcd8b22474%7C72f988bf86f141af91ab2d7cd011 > db47%7C1%7C0%7C638623506854150865%7CUnknown%7CTWFpbGZsb3d8eyJ > WIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0 > %7C%7C%7C&sdata=3D85T9qnC4nbAwU53sxnfQ2lMayp5soX8BMEJsbB58ZBw%3D > &reserved=3D0 >=20 > > > > Optimizing for multicast packets is not worth bothering. >=20 > Optimizing for multicast/broadcast comes into play in multicast environme= nts, > and during network broadcast storms. > Although I don't know if any of those two scenarios are relevant for this= specific > driver. >=20 > > Keep the original code it is simpler. >=20 > Let's keep similar code similar across drivers. >=20 > @Long, @Wei, please Review/Ack, so the patch can be applied. Reviewed-by: Long Li