From: Eric Dumazet <eric.dumazet@gmail.com>
To: Changli Gao <xiaosuo@gmail.com>
Cc: Jamal Hadi Salim <hadi@cyberus.ca>,
"David S. Miller" <davem@davemloft.net>,
netdev@vger.kernel.org
Subject: Re: [PATCH 4/5] ifb: add multiqueue support
Date: Mon, 13 Dec 2010 18:05:31 +0100 [thread overview]
Message-ID: <1292259931.2759.66.camel@edumazet-laptop> (raw)
In-Reply-To: <1292251414-5154-4-git-send-email-xiaosuo@gmail.com>
Le lundi 13 décembre 2010 à 22:43 +0800, Changli Gao a écrit :
> Each ifb NIC has nr_cpu_ids rx queues and nr_cpu_ids queues. Packets
> transmitted to ifb are enqueued to the corresponding per cpu tx queues,
> and processed in the corresponding per cpu tasklet latter.
>
> The stats are converted to the u64 ones.
>
> tq is a stack variable now. It makes ifb_q_private smaller and tx queue
> locked only once in ri_tasklet.
>
> Signed-off-by: Changli Gao <xiaosuo@gmail.com>
> ---
> drivers/net/ifb.c | 211 ++++++++++++++++++++++++++++++++++++------------------
> 1 file changed, 141 insertions(+), 70 deletions(-)
> diff --git a/drivers/net/ifb.c b/drivers/net/ifb.c
> index 57c5cfb..16c767b 100644
> --- a/drivers/net/ifb.c
> +++ b/drivers/net/ifb.c
> @@ -37,56 +37,63 @@
> #include <net/net_namespace.h>
>
> #define TX_Q_LIMIT 32
> +struct ifb_q_private {
> + struct tasklet_struct ifb_tasklet;
> + struct sk_buff_head rq;
> + struct u64_stats_sync syncp;
> + u64 rx_packets;
> + u64 rx_bytes;
> + u64 rx_dropped;
> +};
> +
> struct ifb_private {
> - struct tasklet_struct ifb_tasklet;
> - int tasklet_pending;
> - struct sk_buff_head rq;
> - struct sk_buff_head tq;
> + struct ifb_q_private __percpu *q;
> };
>
> static int numifbs = 2;
>
> -static void ri_tasklet(unsigned long dev)
> +static void ri_tasklet(unsigned long _dev)
> {
> -
> - struct net_device *_dev = (struct net_device *)dev;
> - struct ifb_private *dp = netdev_priv(_dev);
> - struct net_device_stats *stats = &_dev->stats;
> + struct net_device *dev = (struct net_device *)_dev;
> + struct ifb_private *p = netdev_priv(dev);
> + struct ifb_q_private *qp;
> struct netdev_queue *txq;
> struct sk_buff *skb;
> -
> - txq = netdev_get_tx_queue(_dev, 0);
> - skb = skb_peek(&dp->tq);
> - if (skb == NULL) {
> - if (__netif_tx_trylock(txq)) {
> - skb_queue_splice_tail_init(&dp->rq, &dp->tq);
> - __netif_tx_unlock(txq);
> - } else {
> - /* reschedule */
> - goto resched;
> - }
> + struct sk_buff_head tq;
> +
> + __skb_queue_head_init(&tq);
> + txq = netdev_get_tx_queue(dev, raw_smp_processor_id());
> + qp = per_cpu_ptr(p->q, raw_smp_processor_id());
Hmm, this wont work with CPU HOTPLUG.
When we put a cpu offline, we can transfert tasklets from this cpu to
another 'online cpu'
To solve this, you need that ri_tasklet() not use a "device pointer"
parameter but a pointer to 'cpu' private data, since it can be different
than the data of the current cpu.
static void ri_tasklet(unsigned long arg)
{
struct ifb_q_private *qp = (struct ifb_q_private *)arg;
...
}
next prev parent reply other threads:[~2010-12-13 17:05 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-13 14:43 [PATCH 1/5] ifb: remove function declarations Changli Gao
2010-12-13 14:43 ` [PATCH 2/5] ifb: code cleanup Changli Gao
2010-12-15 12:32 ` jamal
2010-12-13 14:43 ` [PATCH 3/5] ifb: fix tx_queue_len overlimit Changli Gao
2010-12-15 12:33 ` jamal
2010-12-15 12:36 ` Changli Gao
2010-12-15 12:42 ` jamal
2010-12-13 14:43 ` [PATCH 4/5] ifb: add multiqueue support Changli Gao
2010-12-13 16:26 ` Eric Dumazet
2010-12-13 23:42 ` Changli Gao
2010-12-13 17:05 ` Eric Dumazet [this message]
2010-12-13 23:46 ` Changli Gao
2010-12-15 12:34 ` jamal
2010-12-13 14:43 ` [PATCH 5/5] net: add skb.old_queue_mapping Changli Gao
2010-12-13 16:56 ` Eric Dumazet
2010-12-13 17:58 ` David Miller
2010-12-13 23:58 ` Changli Gao
2010-12-15 2:59 ` Changli Gao
2010-12-15 12:40 ` jamal
2010-12-15 12:52 ` Changli Gao
2010-12-15 12:31 ` [PATCH 1/5] ifb: remove function declarations jamal
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=1292259931.2759.66.camel@edumazet-laptop \
--to=eric.dumazet@gmail.com \
--cc=davem@davemloft.net \
--cc=hadi@cyberus.ca \
--cc=netdev@vger.kernel.org \
--cc=xiaosuo@gmail.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