From: Patrick McHardy <kaber@trash.net>
To: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, jgarzik@pobox.com,
cramerj@intel.com, auke-jan.h.kok@intel.com,
christopher.leech@intel.com
Subject: Re: [PATCH 2/3] NET: [UPDATED] Multiqueue network device support implementation.
Date: Fri, 13 Apr 2007 02:15:56 +0200 [thread overview]
Message-ID: <461ECBBC.3040400@trash.net> (raw)
In-Reply-To: <20070413001955.18763.35268.stgit@gitlost.site>
Peter P Waskiewicz Jr wrote:
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 219a57f..3ce449e 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -1471,6 +1471,8 @@ gso:
> q = dev->qdisc;
> if (q->enqueue) {
> rc = q->enqueue(skb, q);
> + /* reset queue_mapping to zero */
> + skb->queue_mapping = 0;
This must be done before enqueueing. At this point you don't even have
a valid reference to the skb anymore.
> @@ -3326,12 +3330,23 @@ struct net_device *alloc_netdev(int sizeof_priv, const char *name,
> if (sizeof_priv)
> dev->priv = netdev_priv(dev);
>
> + alloc_size = (sizeof(struct net_device_subqueue) * queue_count);
> +
> + p = kzalloc(alloc_size, GFP_KERNEL);
> + if (!p) {
> + printk(KERN_ERR "alloc_netdev: Unable to allocate queues.\n");
> + return NULL;
Still leaks the device
> diff --git a/net/sched/sch_prio.c b/net/sched/sch_prio.c
> index 5cfe60b..6a38905 100644
> --- a/net/sched/sch_prio.c
> +++ b/net/sched/sch_prio.c
> @@ -144,11 +152,17 @@ prio_dequeue(struct Qdisc* sch)
> struct Qdisc *qdisc;
>
> for (prio = 0; prio < q->bands; prio++) {
> - qdisc = q->queues[prio];
> - skb = qdisc->dequeue(qdisc);
> - if (skb) {
> - sch->q.qlen--;
> - return skb;
> + /* Check if the target subqueue is available before
> + * pulling an skb. This way we avoid excessive requeues
> + * for slower queues.
> + */
> + if (!netif_subqueue_stopped(sch->dev, q->band2queue[prio])) {
> + qdisc = q->queues[prio];
> + skb = qdisc->dequeue(qdisc);
> + if (skb) {
> + sch->q.qlen--;
> + return skb;
> + }
> }
> }
> return NULL;
> @@ -200,6 +214,10 @@ static int prio_tune(struct Qdisc *sch, struct rtattr *opt)
> struct prio_sched_data *q = qdisc_priv(sch);
> struct tc_prio_qopt *qopt = RTA_DATA(opt);
> int i;
> + int queue;
> + int qmapoffset;
> + int offset;
> + int mod;
>
> if (opt->rta_len < RTA_LENGTH(sizeof(*qopt)))
> return -EINVAL;
> @@ -242,6 +260,30 @@ static int prio_tune(struct Qdisc *sch, struct rtattr *opt)
> }
> }
> }
> + /* setup queue to band mapping */
> + if (q->bands < sch->dev->egress_subqueue_count) {
> + qmapoffset = 1;
> + mod = sch->dev->egress_subqueue_count;
> + } else {
> + mod = q->bands % sch->dev->egress_subqueue_count;
> + qmapoffset = q->bands / sch->dev->egress_subqueue_count +
> + ((mod) ? 1 : 0);
> + }
> +
> + queue = 0;
> + offset = 0;
> + for (i = 0; i < q->bands; i++) {
> + q->band2queue[i] = queue;
> + if ( ((i + 1) - offset) == qmapoffset) {
> + queue++;
> + offset += qmapoffset;
> + if (mod)
> + mod--;
> + qmapoffset = q->bands /
> + sch->dev->egress_subqueue_count +
> + ((mod) ? 1 : 0);
> + }
> + }
> return 0;
> }
I stand by my point, this needs to be explicitly enabled by the
user since it changes the behaviour of prio on multiqueue capable
device.
next prev parent reply other threads:[~2007-04-13 0:16 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-13 0:16 [PATCH 0/3] [UPDATED]: Multiqueue network device support Peter P Waskiewicz Jr
2007-04-13 0:19 ` [PATCH 1/3] NET: Multiqueue network device support documentation Peter P Waskiewicz Jr
2007-04-13 0:19 ` [PATCH 2/3] NET: [UPDATED] Multiqueue network device support implementation Peter P Waskiewicz Jr
2007-04-13 0:15 ` Patrick McHardy [this message]
2007-04-13 2:01 ` Waskiewicz Jr, Peter P
2007-04-13 2:19 ` Patrick McHardy
2007-04-13 0:19 ` [PATCH 3/3] NET: [e1000] Example implementation of multiqueue network device API Peter P Waskiewicz Jr
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=461ECBBC.3040400@trash.net \
--to=kaber@trash.net \
--cc=auke-jan.h.kok@intel.com \
--cc=christopher.leech@intel.com \
--cc=cramerj@intel.com \
--cc=davem@davemloft.net \
--cc=jgarzik@pobox.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=peter.p.waskiewicz.jr@intel.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).