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 75CB445707; Thu, 1 Aug 2024 01:45:41 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4D652402BD; Thu, 1 Aug 2024 01:45:41 +0200 (CEST) Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) by mails.dpdk.org (Postfix) with ESMTP id B01F54027E for ; Thu, 1 Aug 2024 01:45:39 +0200 (CEST) Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-1fc47abc040so42814225ad.0 for ; Wed, 31 Jul 2024 16:45:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1722469539; x=1723074339; 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=EoQUtv/lQrAD0OXM+NDDayLBpqK9rnEKfoCHNWEK/PU=; b=tYGcD2meItLRe1Y0pQgDnW1y7aP/88p/pL1Ryyr6neUr6Frt8ANNZaqNs6Wu1lZTR1 tf4rjdVO8/JwNS5xK811LSL2ezgYppZgdqjrhcpxP5fC/SQfs3ZtFO8KIqgAJsRK3uME XnriRsx5e3SyNo5eVUzHOF4J7gEkHQbkkxODr1YiItcJQmMnDUDn7poMHy84RJOuH1FT PrCyPkQ4gwGXYWK47xCJj2sEs7Lmh2CVh/VsWNIuptYs9hqRpim+DAUdub157ZAh6Z5k xMuJiCQByUksQuWsCUBCGRtIXlnbUDA1kIhT+6/pN3T6sJKlOQozLy7GXW7oETSiANJH Ueeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722469539; x=1723074339; 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=EoQUtv/lQrAD0OXM+NDDayLBpqK9rnEKfoCHNWEK/PU=; b=P/mz1DTksDjOZmtSQDIKrTmDo3RXpyH4d7TkAJkODz2GgA6k4+WhFhllKJSYyDz8RA YjUY8t1yT/gUcxSgvJmcWEwawf/3lcph/4VVbWKl6zg3RQbKAOZJAqwjaSdRWIHPgNWz k9TCTa+7L6v4nytjrRXpGH5TjSr2mR/X4qjlExorsMiS/cvIL5jssTgd+QtKhdlHYVZn MB+AHHeS0Y4BWUNB19MjYKelxRtTqaz4+d5z+UiQajnUYIJvw9x2p/G4HjjWe6WUKaaW I+OZjt0uRyOw/X+HM/6ZVy0paeEzPxtJ69RTkUQKlhJefu3nczlk5xy8uzmPlQggBD74 HTnw== X-Forwarded-Encrypted: i=1; AJvYcCUX8Cqzlp0NWnOi9IbfCPo3+MmprFi5BjMUAt28F+f0kD3wUz9wOyZqZnRvUKubzvZsezUwGtKqJfILlaY= X-Gm-Message-State: AOJu0YzxEFSqNNUvPZw16N7ssApgif5MxRzi7nychXXMw96ip9cmDCN3 +TODIaMbw7igv8XZlRpPVqfBpMB0z5uGUOJemS2Od0QQD/kGLqDcdrESqQil6kA= X-Google-Smtp-Source: AGHT+IEvvj7caTDxQEsaO2fjIOx+hOvFJsFJ3gLGbXMfJaoswq5cAimaIY//WE+NbjjLnt9hzXpw0Q== X-Received: by 2002:a17:902:ecc9:b0:1fd:a769:fcaf with SMTP id d9443c01a7336-1ff4d261361mr9890675ad.61.1722469538670; Wed, 31 Jul 2024 16:45:38 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1fed7c7fb04sm126152415ad.43.2024.07.31.16.45.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jul 2024 16:45:38 -0700 (PDT) Date: Wed, 31 Jul 2024 16:45:35 -0700 From: Stephen Hemminger To: Morten =?UTF-8?B?QnLDuHJ1cA==?= Cc: maxime.coquelin@redhat.com, chenbox@nvidia.com, dev@dpdk.org Subject: Re: [PATCH v4] virtio: optimize stats counters performance Message-ID: <20240731164535.319944c0@hermes.local> In-Reply-To: <20240731225816.39567-1-mb@smartsharesystems.com> References: <20240731131744.36448-1-mb@smartsharesystems.com> <20240731225816.39567-1-mb@smartsharesystems.com> 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 Wed, 31 Jul 2024 22:58:16 +0000 Morten Br=C3=B8rup wrote: > + > +static inline void > +virtio_update_packet_stats(struct virtnet_stats *const stats, const stru= ct rte_mbuf *const mbuf) > +{ > + uint32_t s =3D mbuf->pkt_len; > + const struct rte_ether_addr *ea =3D rte_pktmbuf_mtod(mbuf, const struct= rte_ether_addr *); > + > + stats->bytes +=3D s; > + > + if (s >=3D 1024) > + stats->size_bins[6 + (s > 1518)]++; > + else if (s <=3D 64) > + stats->size_bins[s >> 6]++; > + else > + stats->size_bins[32UL - rte_clz32(s) - 5]++; > + > + RTE_BUILD_BUG_ON(offsetof(struct virtnet_stats, broadcast) !=3D > + offsetof(struct virtnet_stats, multicast) + sizeof(uint64_t)); > + if (unlikely(rte_is_multicast_ether_addr(ea))) > + (&stats->multicast)[rte_is_broadcast_ether_addr(ea)]++; > +} > =20 Why move it to virtio_rxtx.h it was fine where it was.