Netdev List
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: netdev@vger.kernel.org
Cc: kaber@trash.net, hadi@cyberus.ca
Subject: [RFC]: Driver internal queue mapping
Date: Mon, 06 Aug 2007 00:16:40 -0700 (PDT)	[thread overview]
Message-ID: <20070806.001640.74747569.davem@davemloft.net> (raw)


In order to put some energy back into the "device selects
TX queue internally" discussion I've cooked up an example
patch below.

While tossing this together I noticed that the current code
paths seem to not check the queue status at the beginnig of
running the queue, f.e. via dev_queue_xmit(), it just blindly
invokes qdisc_run() which only checks the global queue stopped
status, not the mapped one.

This is cumbersome and isn't going to work very well when we
split up all the locking to be per-queue.

The problem is that qdisc_run() has not enough information.
Proper checks can't be made until we know what packet we are
going to process.

Anyways, here is a patch giving an example interface to let
the driver override skb->queue_mapping.  The drivers/net/sunvnet.c
driver would implement this as finding the port number for the
virtual channel that the packet should go over.

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 4a616d7..c2be6f7 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -474,6 +474,8 @@ struct net_device
 						    struct net_device *dev);
 	/* These may be needed for future network-power-down code. */
 	unsigned long		trans_start;	/* Time (in jiffies) of last Tx	*/
+	void			(*tx_queue_select)(struct sk_buff *skb,
+						   struct net_device *dev);
 
 	int			watchdog_timeo; /* used by dev_watchdog() */
 	struct timer_list	watchdog_timer;
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
index c81649c..ff8742c 100644
--- a/net/sched/sch_generic.c
+++ b/net/sched/sch_generic.c
@@ -141,6 +141,9 @@ static inline int qdisc_restart(struct net_device *dev)
 	if (unlikely((skb = dev_dequeue_skb(dev, q)) == NULL))
 		return 0;
 
+	if (dev->tx_queue_select)
+		dev->tx_queue_select(skb, dev);
+
 	/*
 	 * When the driver has LLTX set, it does its own locking in
 	 * start_xmit. These checks are worth it because even uncongested


                 reply	other threads:[~2007-08-06  7:16 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20070806.001640.74747569.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=hadi@cyberus.ca \
    --cc=kaber@trash.net \
    --cc=netdev@vger.kernel.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