Skip to contentSkip to conversation

: Driver internal queue mapping

RFC New David Miller 1 participant 1 message Aug 6, 2007

Subsystems (3)
lore
Share & tools
lore

David Miller

author maintainer
#0 lore raw

RFC 1/1 : Driver internal queue mapping

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.

include/linux/netdevice.h +2 -0
index 4a616d7..c2be6f7 100644
@@ -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;
net/sched/sch_generic.c +3 -0
index c81649c..ff8742c 100644
@@ -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