From: Patrick McHardy <kaber@trash.net>
To: hadi@cyberus.ca
Cc: "Waskiewicz Jr, Peter P" <peter.p.waskiewicz.jr@intel.com>,
Thomas Graf <tgraf@suug.ch>,
Herbert Xu <herbert@gondor.apana.org.au>,
David Miller <davem@davemloft.net>,
netdev@vger.kernel.org
Subject: Re: take 3 [RFC] make qdisc_restart more readable
Date: Sat, 12 May 2007 19:02:29 +0200 [thread overview]
Message-ID: <4645F325.3060607@trash.net> (raw)
In-Reply-To: <1178972280.4061.7.camel@localhost>
jamal wrote:
> diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
> index f671cd2..718d6fd 100644
> --- a/include/linux/netdevice.h
> +++ b/include/linux/netdevice.h
> @@ -83,6 +83,9 @@ struct wireless_dev;
> #define NETDEV_TX_OK 0 /* driver took care of packet */
> #define NETDEV_TX_BUSY 1 /* driver tx path was busy*/
> #define NETDEV_TX_LOCKED -1 /* driver tx lock was already taken */
> +#define NETDEV_TX_DROP -2 /* request caller to drop packet */
This shouldn't be a NETDEV_TX code since its only handled correctly
internally for handle_dev_cpu_collision().
> +#define NETDEV_TX_QUEUE -3 /* request caller to requeue packet */
How will this be used? The driver can simply stop the queue if
it doesn't want to receive more packets.
> +static inline int handle_dev_cpu_collision(struct net_device *dev)
> +{
> + if (dev->xmit_lock_owner == smp_processor_id()) {
unlikely would make sense here.
> +static inline int
> +handle_dev_requeue(struct sk_buff *skb, struct net_device *dev, struct Qdisc *q)
> +{
> +
> + if (unlikely(q == &noop_qdisc))
> + kfree_skb(skb);
Why is this special-casing needed? __qdisc_run already checks for
noop_qdisc and noop has a proper requeue function.
> + else if (skb->next)
> + dev->gso_skb = skb;
The gso_skb cases could probably also be marked unlikely.
> + else
> + q->ops->requeue(skb, q);
> + /* XXX: Could netif_schedule fail? Or is that fact we are
> + * requeueing imply the hardware path is closed
> + * and even if we fail, some interupt will wake us
> + */
> + netif_schedule(dev);
> + return 0;
> +}
> +
> +static inline struct sk_buff *
> +try_get_tx_pkt(struct net_device *dev, struct Qdisc *q)
> +{
> + struct sk_buff *skb = dev->gso_skb;
> +
> + if (skb)
> + dev->gso_skb = NULL;
> + else
> + skb = q->dequeue(q);
> +
> + return skb;
> +}
> +
> +static inline int
> +handle_tx_locked(struct sk_buff *skb, struct net_device *dev, struct Qdisc *q)
handle_.* sounds a bit like "I couldn't think of a better name" :)
How about dev_tx_locked()?
> +{
> + int ret = (dev);
> +
> + if (ret == NETDEV_TX_DROP) {
> + kfree_skb(skb);
> + return qdisc_qlen(q);
> + }
> +
> + return handle_dev_requeue(skb, dev, q);
> +}
> + if (unlikely (ret != NETDEV_TX_BUSY)) {
> + /* XXX: Do we need a ratelimit? or put a
> + * BUG_ON((int) ret != NETDEV_TX_BUSY) ?
> + **/
> + printk("BUG %s code %d qlen %d\n",dev->name, ret, q->q.qlen);
BUG_ON sounds a bit extreme, net_ratelimit() makes sense.
next prev parent reply other threads:[~2007-05-12 17:04 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-11 0:13 [RFC] make qdisc_restart more readable jamal
2007-05-11 15:56 ` Waskiewicz Jr, Peter P
2007-05-11 18:04 ` jamal
2007-05-11 18:13 ` Waskiewicz Jr, Peter P
2007-05-11 18:35 ` jamal
2007-05-11 18:46 ` Waskiewicz Jr, Peter P
2007-05-11 19:29 ` take 2 WAS (RE: " jamal
2007-05-11 22:01 ` Waskiewicz Jr, Peter P
2007-05-11 22:43 ` jamal
2007-05-12 9:46 ` Thomas Graf
2007-05-12 11:58 ` jamal
2007-05-12 12:18 ` take 3 " jamal
2007-05-12 17:02 ` Patrick McHardy [this message]
2007-05-12 19:56 ` jamal
2007-05-13 14:28 ` [LAST CALL] [PATCH] [NET_SCHED]make " jamal
2007-05-14 10:40 ` Patrick McHardy
2007-05-14 12:41 ` jamal
2007-05-14 12:43 ` Patrick McHardy
2007-05-14 13:30 ` jamal
2007-05-14 20:09 ` Waskiewicz Jr, Peter P
2007-05-16 22:55 ` jamal
2007-05-16 23:00 ` David Miller
2007-05-16 23:15 ` Sridhar Samudrala
2007-05-17 2:12 ` jamal
2007-05-11 17:01 ` [RFC] make " Thomas Graf
2007-05-11 18:11 ` 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=4645F325.3060607@trash.net \
--to=kaber@trash.net \
--cc=davem@davemloft.net \
--cc=hadi@cyberus.ca \
--cc=herbert@gondor.apana.org.au \
--cc=netdev@vger.kernel.org \
--cc=peter.p.waskiewicz.jr@intel.com \
--cc=tgraf@suug.ch \
/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).