From: Eric Dumazet <eric.dumazet@gmail.com>
To: Jiri Pirko <jpirko@redhat.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net,
bhutchings@solarflare.com, shemminger@vyatta.com,
fubar@us.ibm.com, andy@greyhouse.net, tgraf@infradead.org,
ebiederm@xmission.com, mirqus@gmail.com, kaber@trash.net,
greearb@candelatech.com, jesse@nicira.com, fbl@redhat.com,
benjamin.poirier@gmail.com, jzupka@redhat.com,
ivecera@redhat.com
Subject: Re: [REPOST patch net-next V6] net: introduce ethernet teaming device
Date: Thu, 10 Nov 2011 00:53:09 +0100 [thread overview]
Message-ID: <1320882789.5825.10.camel@edumazet-laptop> (raw)
In-Reply-To: <1320880355.5825.1.camel@edumazet-laptop>
Le jeudi 10 novembre 2011 à 00:12 +0100, Eric Dumazet a écrit :
> Le mercredi 09 novembre 2011 à 23:13 +0100, Jiri Pirko a écrit :
> > This patch introduces new network device called team. It supposes to be
> > very fast, simple, userspace-driven alternative to existing bonding
> > driver.
>
> ...
>
> > +/*
> > + * note: already called with rcu_read_lock
> > + */
> > +static netdev_tx_t team_xmit(struct sk_buff *skb, struct net_device *dev)
> > +{
> > + struct team *team = netdev_priv(dev);
> > + bool tx_success = false;
> > + unsigned int len = skb->len;
> > +
> > + /*
> > + * Ensure transmit function is called only in case there is at least
> > + * one port present.
> > + */
> > + if (likely(!list_empty(&team->port_list) && team->mode_ops.transmit))
> > + tx_success = team->mode_ops.transmit(team, skb);
Not clear why its so complex here.
When you manipulate team->port_list and make it empty, why dont you set
team->mode_ops.transmit to a helper function, freeing the skb and
returning false.
Also, instead of setting .transmit to NULL, you also could set it to
same helper function.
This way you could just do in fast path :
tx_succcess = team->mode_ops.transmit(team, skb);
Avoiding two tests
> > + if (tx_success) {
> > + struct team_pcpu_stats *pcpu_stats;
> > +
> > + pcpu_stats = this_cpu_ptr(team->pcpu_stats);
> > + u64_stats_update_begin(&pcpu_stats->syncp);
> > + pcpu_stats->tx_packets++;
> > + pcpu_stats->tx_bytes += len;
> > + u64_stats_update_end(&pcpu_stats->syncp);
> > + } else {
> > + this_cpu_inc(team->pcpu_stats->tx_dropped);
> > + }
> > +
> > + return NETDEV_TX_OK;
> > +}
> > +
>
next prev parent reply other threads:[~2011-11-09 23:53 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-09 22:13 [REPOST patch net-next V6] net: introduce ethernet teaming device Jiri Pirko
2011-11-09 23:12 ` Eric Dumazet
2011-11-09 23:53 ` Eric Dumazet [this message]
2011-11-10 6:51 ` Jiri Pirko
2011-11-10 6:48 ` Jiri Pirko
2011-11-10 6:53 ` Eric Dumazet
2011-11-10 7:02 ` Eric Dumazet
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=1320882789.5825.10.camel@edumazet-laptop \
--to=eric.dumazet@gmail.com \
--cc=andy@greyhouse.net \
--cc=benjamin.poirier@gmail.com \
--cc=bhutchings@solarflare.com \
--cc=davem@davemloft.net \
--cc=ebiederm@xmission.com \
--cc=fbl@redhat.com \
--cc=fubar@us.ibm.com \
--cc=greearb@candelatech.com \
--cc=ivecera@redhat.com \
--cc=jesse@nicira.com \
--cc=jpirko@redhat.com \
--cc=jzupka@redhat.com \
--cc=kaber@trash.net \
--cc=mirqus@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=shemminger@vyatta.com \
--cc=tgraf@infradead.org \
/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