From: "Morten Brørup" <mb@smartsharesystems.com>
To: "Long Li" <longli@microsoft.com>, "Wei Hu" <weh@microsoft.com>
Cc: <maxime.coquelin@redhat.com>, <chenbox@nvidia.com>,
<dev@dpdk.org>, "Stephen Hemminger" <stephen@networkplumber.org>
Subject: RE: [PATCH] netvsc: optimize stats counters performance
Date: Thu, 19 Sep 2024 15:51:12 +0200 [thread overview]
Message-ID: <98CBD80474FA8B44BF855DF32C47DC35E9F703@smartserver.smartshare.dk> (raw)
In-Reply-To: <20240802103324.2e0903c8@hermes.local>
> 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ørup <mb@smartsharesystems.com> wrote:
>
> > > > ea = 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) !=
> > > > + 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.
Similar patches have been accepted by other drivers:
[virtio]: https://patchwork.dpdk.org/project/dpdk/patch/20240801160312.205281-1-mb@smartsharesystems.com/
[vhost-user]: https://patchwork.dpdk.org/project/dpdk/patch/20240802143259.269827-1-mb@smartsharesystems.com/
>
> Optimizing for multicast packets is not worth bothering.
Optimizing for multicast/broadcast comes into play in multicast environments, and during network broadcast storms.
Although I don't know if any of those two scenarios are relevant for this specific driver.
> Keep the original code it is simpler.
Let's keep similar code similar across drivers.
@Long, @Wei, please Review/Ack, so the patch can be applied.
next prev parent reply other threads:[~2024-09-19 13:51 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-02 14:40 Morten Brørup
2024-08-02 16:48 ` Long Li
2024-08-02 17:28 ` Morten Brørup
2024-08-02 17:33 ` Stephen Hemminger
2024-09-19 13:51 ` Morten Brørup [this message]
2024-09-19 18:06 ` Long Li
2024-09-22 2:36 ` 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=98CBD80474FA8B44BF855DF32C47DC35E9F703@smartserver.smartshare.dk \
--to=mb@smartsharesystems.com \
--cc=chenbox@nvidia.com \
--cc=dev@dpdk.org \
--cc=longli@microsoft.com \
--cc=maxime.coquelin@redhat.com \
--cc=stephen@networkplumber.org \
--cc=weh@microsoft.com \
/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).