netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] REPOST: Multiqueue network device support
@ 2007-04-09 21:27 Peter P Waskiewicz Jr
  2007-04-09 21:28 ` [PATCH 1/2] NET: Multiqueue network device support documentation Peter P Waskiewicz Jr
  2007-04-09 21:28 ` [PATCH 2/2] NET: Multiqueue network device support implementation Peter P Waskiewicz Jr
  0 siblings, 2 replies; 9+ messages in thread
From: Peter P Waskiewicz Jr @ 2007-04-09 21:27 UTC (permalink / raw)
  To: davem
  Cc: netdev, linux-kernel, jgarzik, cramerj, auke-jan.h.kok,
	christopher.leech

Reposting due to the patches getting bounced by majordomo:

This is a redesign and repost of the multiqueue network device support
patches.  The new API for base drivers allows multiqueue-capable devices to
manage their individual queues in the network stack.  The stack now handles
both non-multiqueue and multiqueue devices on the same codepath.  Also,
allocation and deallocation of the queues is handled by the kernel instead
of the driver.

Documentation is also included describing in more detail how this works, as
well as how a base driver can use the API to implement multiple queues.

These patches can also be pulled from my git repository at:

        git-pull git://lost.foo-projects.org/~ppwaskie/git/net-2.6.22 mq

--
Peter P. Waskiewicz Jr.
peter.p.waskiewicz.jr@intel.com

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/2] NET: Multiqueue network device support documentation.
  2007-04-09 21:27 [PATCH 0/2] REPOST: Multiqueue network device support Peter P Waskiewicz Jr
@ 2007-04-09 21:28 ` Peter P Waskiewicz Jr
  2007-04-09 21:28 ` [PATCH 2/2] NET: Multiqueue network device support implementation Peter P Waskiewicz Jr
  1 sibling, 0 replies; 9+ messages in thread
From: Peter P Waskiewicz Jr @ 2007-04-09 21:28 UTC (permalink / raw)
  To: davem
  Cc: netdev, linux-kernel, jgarzik, cramerj, auke-jan.h.kok,
	christopher.leech

From: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>

Adding documentation for the new multiqueue API.

Signed-off-by: Peter P. Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com>
---

 Documentation/networking/multiqueue.txt |   97 +++++++++++++++++++++++++++++++
 1 files changed, 97 insertions(+), 0 deletions(-)

diff --git a/Documentation/networking/multiqueue.txt b/Documentation/networking/multiqueue.txt
new file mode 100644
index 0000000..c32ed83
--- /dev/null
+++ b/Documentation/networking/multiqueue.txt
@@ -0,0 +1,97 @@
+
+		HOWTO for multiqueue network device support
+		===========================================
+
+Section 1: Base driver requirements for implementing multiqueue support
+Section 2: Qdisc support for multiqueue devices
+Section 3: Brief howto using PRIO for multiqueue devices
+
+
+Intro: Kernel support for multiqueue devices
+---------------------------------------------------------
+
+Kernel support for multiqueue devices is only an API that is presented to the
+netdevice layer for base drivers to implement.  This feature is part of the
+core networking stack, and all network devices will be running on the
+multiqueue-aware stack.  If a base driver only has one queue, then these
+changes are transparent to that driver.
+
+
+Section 2: Base driver requirements for implementing multiqueue support
+-----------------------------------------------------------------------
+
+Base drivers are required to use the new alloc_etherdev_mq() or
+alloc_netdev_mq() functions to allocate the subqueues for the device.  The
+underlying kernel API will take care of the allocation and deallocation of
+the subqueue memory, as well as netdev configuration of where the queues
+exist in memory.
+
+The base driver will also need to manage the queues as it does the global
+netdev->queue_lock today.  Therefore base drivers should use the
+netif_{start|stop|wake}_subqueue() functions to manage each queue while the
+device is still operational.  netdev->queue_lock is still used when the device
+comes online or when it's completely shut down (unregister_netdev(), etc.).
+
+Finally, the base driver should indicate that it is a multiqueue device.  The
+feature flag NETIF_F_MULTI_QUEUE should be added to the netdev->features
+bitmap on device initialization.  Below is an example from e1000:
+
+#ifdef CONFIG_E1000_MQ
+	if ( (adapter->hw.mac.type == e1000_82571) ||
+	     (adapter->hw.mac.type == e1000_82572) ||
+	     (adapter->hw.mac.type == e1000_80003es2lan))
+		netdev->features |= NETIF_F_MULTI_QUEUE;
+#endif
+
+
+Section 3: Qdisc support for multiqueue devices
+-----------------------------------------------
+
+Currently two qdiscs support multiqueue devices.  The default qdisc, pfifo_fast,
+and the PRIO qdisc.  The qdisc is responsible for classifying the skb's to
+bands and queues, and will store the queue mapping into skb->queue_mapping.
+Use this field in the base driver to determine which queue to send the skb
+to.
+
+pfifo_fast, being the default qdisc when a device is brought online, will not
+assign a queue mapping, therefore the skb will have a value of zero.  We
+cannot assume anything about the device itself, how many queues it really has,
+etc.  Therefore sending all traffic to queue 0 is the safest thing to do here.
+
+The PRIO qdisc naturally plugs into a multiqueue device.  Upon load of the
+qdisc, PRIO will make a best-effort assignment of queue to PRIO band to evenly
+distribute traffic flows.  The algorithm can be found in prio_tune() in
+net/sched/sch_prio.c.  Once the association is made, any skb that is
+classified will have skb->queue_mapping set, which will allow the driver to
+properly queue skb's to multiple queues.
+
+
+Section 4: Brief howto using PRIO for multiqueue devices
+--------------------------------------------------------
+
+The userspace command 'tc,' part of the iproute2 package, is used to configure
+qdiscs.  To add the PRIO qdisc to your network device, assuming the device is
+called eth0, run the following command:
+
+# tc qdisc add dev eth0 root handle 1: prio
+
+This will create 3 bands, 0 being highest priority, and associate those bands
+to the queues on your NIC.  Assuming eth0 has 2 Tx queues, the band mapping
+would look like:
+
+band 0 => queue 0
+band 1 => queue 1
+band 2 => queue 1
+
+Traffic will begin flowing through each queue if your TOS values are assigning
+traffic across the various bands.  For example, ssh traffic will always try to
+go out band 0 based on TOS -> Linux priority conversion (realtime traffic),
+so it will be sent out queue 0.  ICMP traffic (pings) fall into the "normal"
+traffic classification, which is band 1.  Therefore pings will be send out
+queue 1 on the NIC.
+
+The behavior of tc filters remains the same, where it will override TOS priority
+classification.
+
+
+Author: Peter P. Waskiewicz Jr. <peter.p.waskiewicz.jr@intel.com>


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/2] NET: Multiqueue network device support implementation.
  2007-04-09 21:27 [PATCH 0/2] REPOST: Multiqueue network device support Peter P Waskiewicz Jr
  2007-04-09 21:28 ` [PATCH 1/2] NET: Multiqueue network device support documentation Peter P Waskiewicz Jr
@ 2007-04-09 21:28 ` Peter P Waskiewicz Jr
  2007-04-09 21:33   ` Jan Engelhardt
  2007-04-10  8:20   ` Evgeniy Polyakov
  1 sibling, 2 replies; 9+ messages in thread
From: Peter P Waskiewicz Jr @ 2007-04-09 21:28 UTC (permalink / raw)
  To: davem
  Cc: netdev, linux-kernel, jgarzik, cramerj, auke-jan.h.kok,
	christopher.leech

From: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>

Added an API and associated supporting routines for multiqueue network devices.
This allows network devices supporting multiple TX queues to configure each
queue within the netdevice and manage each queue independantly.  Changes to the
PRIO Qdisc also allow a user to map multiple flows to individual TX queues,
taking advantage of each queue on the device.

Removed typecast when assigning net_device_subqueue in alloc_etherdev_mq.

Signed-off-by: Peter P. Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com>
---

 include/linux/etherdevice.h |    3 +-
 include/linux/netdevice.h   |   66 ++++++++++++++++++++++++++++++++++++++++++-
 include/linux/skbuff.h      |    2 +
 net/core/dev.c              |   25 +++++++++++++---
 net/core/skbuff.c           |    3 ++
 net/ethernet/eth.c          |    9 +++---
 net/sched/sch_generic.c     |    4 +--
 net/sched/sch_prio.c        |   55 +++++++++++++++++++++++++++++++-----
 8 files changed, 146 insertions(+), 21 deletions(-)

diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index 745c988..446de39 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -39,7 +39,8 @@ extern void		eth_header_cache_update(struct hh_cache *hh, struct net_device *dev
 extern int		eth_header_cache(struct neighbour *neigh,
 					 struct hh_cache *hh);
 
-extern struct net_device *alloc_etherdev(int sizeof_priv);
+extern struct net_device *alloc_etherdev_mq(int sizeof_priv, int queue_count);
+#define alloc_etherdev(sizeof_priv) alloc_etherdev_mq(sizeof_priv, 1)
 static inline void eth_copy_and_sum (struct sk_buff *dest, 
 				     const unsigned char *src, 
 				     int len, int base)
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 71fc8ff..db06169 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -106,6 +106,14 @@ struct netpoll_info;
 #define MAX_HEADER (LL_MAX_HEADER + 48)
 #endif
 
+struct net_device_subqueue
+{
+	/* Give a control state for each queue.  This struct may contain
+	 * per-queue locks in the future.
+	 */
+	unsigned long	state;
+};
+
 /*
  *	Network device statistics. Akin to the 2.0 ether stats but
  *	with byte counters.
@@ -324,6 +332,7 @@ struct net_device
 #define NETIF_F_GSO		2048	/* Enable software GSO. */
 #define NETIF_F_LLTX		4096	/* LockLess TX */
 #define NETIF_F_INTERNAL_STATS	8192	/* Use stats structure in net_device */
+#define NETIF_F_MULTI_QUEUE	16384	/* Has multiple TX/RX queues */
 
 	/* Segmentation offload features */
 #define NETIF_F_GSO_SHIFT	16
@@ -534,6 +543,14 @@ struct net_device
 	struct device		dev;
 	/* space for optional statistics and wireless sysfs groups */
 	struct attribute_group  *sysfs_groups[3];
+
+	/* To retrieve statistics per subqueue - FOR FUTURE USE */
+	struct net_device_stats* (*get_subqueue_stats)(struct net_device *dev,
+							int queue_index);
+
+	/* The TX queue control structures */
+	struct net_device_subqueue	*egress_subqueue;
+	int				egress_subqueue_count;
 };
 #define to_net_dev(d) container_of(d, struct net_device, dev)
 
@@ -675,6 +692,48 @@ static inline int netif_running(const struct net_device *dev)
 	return test_bit(__LINK_STATE_START, &dev->state);
 }
 
+/*
+ * Routines to manage the subqueues on a device.  We only need start
+ * stop, and a check if it's stopped.  All other device management is
+ * done at the overall netdevice level.
+ * Also test the device if we're multiqueue.
+ */
+static inline void netif_start_subqueue(struct net_device *dev, u16 queue_index)
+{
+	clear_bit(__LINK_STATE_XOFF, &dev->egress_subqueue[queue_index].state);
+}
+
+static inline void netif_stop_subqueue(struct net_device *dev, u16 queue_index)
+{
+#ifdef CONFIG_NETPOLL_TRAP
+	if (netpoll_trap())
+		return;
+#endif
+	set_bit(__LINK_STATE_XOFF, &dev->egress_subqueue[queue_index].state);
+}
+
+static inline int netif_subqueue_stopped(const struct net_device *dev,
+                                         u16 queue_index)
+{
+	return test_bit(__LINK_STATE_XOFF,
+	                &dev->egress_subqueue[queue_index].state);
+}
+
+static inline void netif_wake_subqueue(struct net_device *dev, u16 queue_index)
+{
+#ifdef CONFIG_NETPOLL_TRAP
+	if (netpoll_trap())
+		return;
+#endif
+	if (test_and_clear_bit(__LINK_STATE_XOFF,
+	                       &dev->egress_subqueue[queue_index].state))
+		__netif_schedule(dev);
+}
+
+static inline int netif_is_multiqueue(const struct net_device *dev)
+{
+	return (!!(NETIF_F_MULTI_QUEUE & dev->features));
+}
 
 /* Use this variant when it is known for sure that it
  * is executing from interrupt context.
@@ -968,8 +1027,11 @@ static inline void netif_tx_disable(struct net_device *dev)
 extern void		ether_setup(struct net_device *dev);
 
 /* Support for loadable net-drivers */
-extern struct net_device *alloc_netdev(int sizeof_priv, const char *name,
-				       void (*setup)(struct net_device *));
+extern struct net_device *alloc_netdev_mq(int sizeof_priv, const char *name,
+					  void (*setup)(struct net_device *),
+					  int queue_count);
+#define alloc_netdev(sizeof_priv, name, setup) \
+	alloc_netdev_mq(sizeof_priv, name, setup, 1)
 extern int		register_netdev(struct net_device *dev);
 extern void		unregister_netdev(struct net_device *dev);
 /* Functions used for multicast support */
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 08fa5c8..96fd263 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -212,6 +212,7 @@ typedef unsigned char *sk_buff_data_t;
  *	@pkt_type: Packet class
  *	@fclone: skbuff clone status
  *	@ip_summed: Driver fed us an IP checksum
+ *	@queue_mapping: Queue mapping for multiqueue devices
  *	@priority: Packet queueing priority
  *	@users: User count - see {datagram,tcp}.c
  *	@protocol: Packet protocol from driver
@@ -264,6 +265,7 @@ struct sk_buff {
 		__wsum		csum;
 		__u32		csum_offset;
 	};
+	__u16			queue_mapping;
 	__u32			priority;
 	__u8			local_df:1,
 				cloned:1,
diff --git a/net/core/dev.c b/net/core/dev.c
index 219a57f..86c9a89 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3292,16 +3292,18 @@ static struct net_device_stats *maybe_internal_stats(struct net_device *dev)
 }
 
 /**
- *	alloc_netdev - allocate network device
+ *	alloc_netdev_mq - allocate network device
  *	@sizeof_priv:	size of private data to allocate space for
  *	@name:		device name format string
  *	@setup:		callback to initialize device
+ *	@queue_count:	the number of subqueues to allocate
  *
  *	Allocates a struct net_device with private data area for driver use
- *	and performs basic initialization.
+ *	and performs basic initialization.  Also allocates subqueue structs
+ *	for each queue on the device.
  */
-struct net_device *alloc_netdev(int sizeof_priv, const char *name,
-		void (*setup)(struct net_device *))
+struct net_device *alloc_netdev_mq(int sizeof_priv, const char *name,
+		void (*setup)(struct net_device *), int queue_count)
 {
 	void *p;
 	struct net_device *dev;
@@ -3326,12 +3328,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;
+ 	}
+ 
+ 	dev->egress_subqueue = p;
+ 	dev->egress_subqueue_count = queue_count;
+
 	dev->get_stats = maybe_internal_stats;
 	setup(dev);
 	strcpy(dev->name, name);
 	return dev;
 }
-EXPORT_SYMBOL(alloc_netdev);
+EXPORT_SYMBOL(alloc_netdev_mq);
 
 /**
  *	free_netdev - free network device
@@ -3345,6 +3358,7 @@ void free_netdev(struct net_device *dev)
 {
 #ifdef CONFIG_SYSFS
 	/*  Compatibility with error handling in drivers */
+	kfree((char *)dev->egress_subqueue);
 	if (dev->reg_state == NETREG_UNINITIALIZED) {
 		kfree((char *)dev - dev->padded);
 		return;
@@ -3356,6 +3370,7 @@ void free_netdev(struct net_device *dev)
 	/* will free via device release */
 	put_device(&dev->dev);
 #else
+	kfree((char *)dev->egress_subqueue);
 	kfree((char *)dev - dev->padded);
 #endif
 }
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index e60864e..642aab9 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -474,6 +474,7 @@ struct sk_buff *skb_clone(struct sk_buff *skb, gfp_t gfp_mask)
 	n->nohdr = 0;
 	C(pkt_type);
 	C(ip_summed);
+	C(queue_mapping);
 	C(priority);
 #if defined(CONFIG_IP_VS) || defined(CONFIG_IP_VS_MODULE)
 	C(ipvs_property);
@@ -516,6 +517,7 @@ static void copy_skb_header(struct sk_buff *new, const struct sk_buff *old)
 #endif
 	new->sk		= NULL;
 	new->dev	= old->dev;
+	new->queue_mapping = old->queue_mapping;
 	new->priority	= old->priority;
 	new->protocol	= old->protocol;
 	new->dst	= dst_clone(old->dst);
@@ -1974,6 +1976,7 @@ struct sk_buff *skb_segment(struct sk_buff *skb, int features)
 		tail = nskb;
 
 		nskb->dev = skb->dev;
+		nskb->queue_mapping = skb->queue_mapping;
 		nskb->priority = skb->priority;
 		nskb->protocol = skb->protocol;
 		nskb->dst = dst_clone(skb->dst);
diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c
index 0ac2524..87a509c 100644
--- a/net/ethernet/eth.c
+++ b/net/ethernet/eth.c
@@ -316,9 +316,10 @@ void ether_setup(struct net_device *dev)
 EXPORT_SYMBOL(ether_setup);
 
 /**
- * alloc_etherdev - Allocates and sets up an Ethernet device
+ * alloc_etherdev_mq - Allocates and sets up an Ethernet device
  * @sizeof_priv: Size of additional driver-private structure to be allocated
  *	for this Ethernet device
+ * @queue_count: The number of queues this device has.
  *
  * Fill in the fields of the device structure with Ethernet-generic
  * values. Basically does everything except registering the device.
@@ -328,8 +329,8 @@ EXPORT_SYMBOL(ether_setup);
  * this private data area.
  */
 
-struct net_device *alloc_etherdev(int sizeof_priv)
+struct net_device *alloc_etherdev_mq(int sizeof_priv, int queue_count)
 {
-	return alloc_netdev(sizeof_priv, "eth%d", ether_setup);
+	return alloc_netdev_mq(sizeof_priv, "eth%d", ether_setup, queue_count);
 }
-EXPORT_SYMBOL(alloc_etherdev);
+EXPORT_SYMBOL(alloc_etherdev_mq);
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
index 52eb343..8f0063a 100644
--- a/net/sched/sch_generic.c
+++ b/net/sched/sch_generic.c
@@ -133,7 +133,8 @@ static inline int qdisc_restart(struct net_device *dev)
 			/* And release queue */
 			spin_unlock(&dev->queue_lock);
 
-			if (!netif_queue_stopped(dev)) {
+			if (!netif_queue_stopped(dev) &&
+			    !netif_subqueue_stopped(dev, skb->queue_mapping)) {
 				int ret;
 
 				ret = dev_hard_start_xmit(skb, dev);
@@ -149,7 +150,6 @@ static inline int qdisc_restart(struct net_device *dev)
 					goto collision;
 				}
 			}
-
 			/* NETDEV_TX_BUSY - we need to requeue */
 			/* Release the driver */
 			if (!nolock) {
diff --git a/net/sched/sch_prio.c b/net/sched/sch_prio.c
index 5cfe60b..7365621 100644
--- a/net/sched/sch_prio.c
+++ b/net/sched/sch_prio.c
@@ -43,6 +43,7 @@ struct prio_sched_data
 	struct tcf_proto *filter_list;
 	u8  prio2band[TC_PRIO_MAX+1];
 	struct Qdisc *queues[TCQ_PRIO_BANDS];
+	u16 band2queue[TC_PRIO_MAX + 1];
 };
 
 
@@ -63,20 +64,26 @@ prio_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr)
 		case TC_ACT_SHOT:
 			return NULL;
 		};
-
 		if (!q->filter_list ) {
 #else
 		if (!q->filter_list || tc_classify(skb, q->filter_list, &res)) {
 #endif
 			if (TC_H_MAJ(band))
 				band = 0;
+			skb->queue_mapping =
+				  q->prio2band[q->band2queue[band&TC_PRIO_MAX]];
+
 			return q->queues[q->prio2band[band&TC_PRIO_MAX]];
 		}
 		band = res.classid;
 	}
 	band = TC_H_MIN(band) - 1;
-	if (band > q->bands)
+	if (band > q->bands) {
+		skb->queue_mapping = q->prio2band[q->band2queue[0]];
 		return q->queues[q->prio2band[0]];
+	}
+
+	skb->queue_mapping = q->band2queue[band];
 
 	return q->queues[band];
 }
@@ -144,11 +151,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 +213,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 +259,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 = 0;
+	} 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;
 }
 


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] NET: Multiqueue network device support implementation.
  2007-04-09 21:28 ` [PATCH 2/2] NET: Multiqueue network device support implementation Peter P Waskiewicz Jr
@ 2007-04-09 21:33   ` Jan Engelhardt
  2007-04-09 21:52     ` Waskiewicz Jr, Peter P
  2007-04-10  8:20   ` Evgeniy Polyakov
  1 sibling, 1 reply; 9+ messages in thread
From: Jan Engelhardt @ 2007-04-09 21:33 UTC (permalink / raw)
  To: Peter P Waskiewicz Jr
  Cc: davem, netdev, linux-kernel, jgarzik, cramerj, auke-jan.h.kok,
	christopher.leech

Hi,


On Apr 9 2007 14:28, Peter P Waskiewicz Jr wrote:
>@@ -3345,6 +3358,7 @@ void free_netdev(struct net_device *dev)
> {
> #ifdef CONFIG_SYSFS
> 	/*  Compatibility with error handling in drivers */
>+	kfree((char *)dev->egress_subqueue);
> 	if (dev->reg_state == NETREG_UNINITIALIZED) {
> 		kfree((char *)dev - dev->padded);
> 		return;
>@@ -3356,6 +3370,7 @@ void free_netdev(struct net_device *dev)
> 	/* will free via device release */
> 	put_device(&dev->dev);
> #else
>+	kfree((char *)dev->egress_subqueue);
> 	kfree((char *)dev - dev->padded);
> #endif
> }

Ahem. Explain that cast.



Jan
-- 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: [PATCH 2/2] NET: Multiqueue network device support implementation.
  2007-04-09 21:33   ` Jan Engelhardt
@ 2007-04-09 21:52     ` Waskiewicz Jr, Peter P
  2007-04-10 11:04       ` Herbert Xu
  0 siblings, 1 reply; 9+ messages in thread
From: Waskiewicz Jr, Peter P @ 2007-04-09 21:52 UTC (permalink / raw)
  To: Jan Engelhardt
  Cc: davem, netdev, linux-kernel, jgarzik, cramerj, Kok, Auke-jan H,
	Leech, Christopher

> Hi,
> 
> 
> On Apr 9 2007 14:28, Peter P Waskiewicz Jr wrote:
> >@@ -3345,6 +3358,7 @@ void free_netdev(struct net_device *dev)  {  
> >#ifdef CONFIG_SYSFS
> > 	/*  Compatibility with error handling in drivers */
> >+	kfree((char *)dev->egress_subqueue);
> > 	if (dev->reg_state == NETREG_UNINITIALIZED) {
> > 		kfree((char *)dev - dev->padded);
> > 		return;
> >@@ -3356,6 +3370,7 @@ void free_netdev(struct net_device *dev)
> > 	/* will free via device release */
> > 	put_device(&dev->dev);
> > #else
> >+	kfree((char *)dev->egress_subqueue);
> > 	kfree((char *)dev - dev->padded);
> > #endif
> > }
> 
> Ahem. Explain that cast.

Jan,
	This can be removed if needed; however, I'm just copying what
the other kfree()'s are doing in this function.  Any instance of a
typecast that I introduced in these patches are just following what
others have done in that section of the code.  So the cast is just for
consistency in this particular area.  If you'd like me to remove it, I
can do that.

Thanks,

-PJ Waskiewicz

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] NET: Multiqueue network device support implementation.
  2007-04-09 21:28 ` [PATCH 2/2] NET: Multiqueue network device support implementation Peter P Waskiewicz Jr
  2007-04-09 21:33   ` Jan Engelhardt
@ 2007-04-10  8:20   ` Evgeniy Polyakov
  2007-04-10 15:41     ` Waskiewicz Jr, Peter P
  1 sibling, 1 reply; 9+ messages in thread
From: Evgeniy Polyakov @ 2007-04-10  8:20 UTC (permalink / raw)
  To: Peter P Waskiewicz Jr
  Cc: davem, netdev, linux-kernel, jgarzik, cramerj, auke-jan.h.kok,
	christopher.leech

On Mon, Apr 09, 2007 at 02:28:41PM -0700, Peter P Waskiewicz Jr (peter.p.waskiewicz.jr@intel.com) wrote:
> + 	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;

I think you either do not want to print it, or want additional details
about device...

> + 	}
> + 
> + 	dev->egress_subqueue = p;
> + 	dev->egress_subqueue_count = queue_count;
> +
>  	dev->get_stats = maybe_internal_stats;
>  	setup(dev);
>  	strcpy(dev->name, name);
>  	return dev;
>  }
> -EXPORT_SYMBOL(alloc_netdev);
> +EXPORT_SYMBOL(alloc_netdev_mq);
>  
>  /**
>   *	free_netdev - free network device
> @@ -3345,6 +3358,7 @@ void free_netdev(struct net_device *dev)
>  {
>  #ifdef CONFIG_SYSFS
>  	/*  Compatibility with error handling in drivers */
> +	kfree((char *)dev->egress_subqueue);
>  	if (dev->reg_state == NETREG_UNINITIALIZED) {
>  		kfree((char *)dev - dev->padded);
>  		return;
> @@ -3356,6 +3370,7 @@ void free_netdev(struct net_device *dev)
>  	/* will free via device release */
>  	put_device(&dev->dev);
>  #else
> +	kfree((char *)dev->egress_subqueue);

Still casting :)


-- 
	Evgeniy Polyakov

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] NET: Multiqueue network device support implementation.
  2007-04-09 21:52     ` Waskiewicz Jr, Peter P
@ 2007-04-10 11:04       ` Herbert Xu
  0 siblings, 0 replies; 9+ messages in thread
From: Herbert Xu @ 2007-04-10 11:04 UTC (permalink / raw)
  To: Waskiewicz Jr, Peter P
  Cc: jengelh, davem, netdev, linux-kernel, jgarzik, cramerj,
	auke-jan.h.kok, christopher.leech

Waskiewicz Jr, Peter P <peter.p.waskiewicz.jr@intel.com> wrote:
>
>> >@@ -3356,6 +3370,7 @@ void free_netdev(struct net_device *dev)
>> >     /* will free via device release */
>> >     put_device(&dev->dev);
>> > #else
>> >+    kfree((char *)dev->egress_subqueue);
>> >     kfree((char *)dev - dev->padded);
>> > #endif
>> > }
>> 
>> Ahem. Explain that cast.
> 
>        This can be removed if needed; however, I'm just copying what
> the other kfree()'s are doing in this function.  Any instance of a
> typecast that I introduced in these patches are just following what
> others have done in that section of the code.  So the cast is just for
> consistency in this particular area.  If you'd like me to remove it, I
> can do that.

The other cast is there for the subtraction, not the kfree...

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: [PATCH 2/2] NET: Multiqueue network device support implementation.
  2007-04-10  8:20   ` Evgeniy Polyakov
@ 2007-04-10 15:41     ` Waskiewicz Jr, Peter P
  2007-04-10 15:54       ` Evgeniy Polyakov
  0 siblings, 1 reply; 9+ messages in thread
From: Waskiewicz Jr, Peter P @ 2007-04-10 15:41 UTC (permalink / raw)
  To: Evgeniy Polyakov
  Cc: davem, netdev, linux-kernel, jgarzik, cramerj, Kok, Auke-jan H,
	Leech, Christopher

> On Mon, Apr 09, 2007 at 02:28:41PM -0700, Peter P Waskiewicz 
> Jr (peter.p.waskiewicz.jr@intel.com) wrote:
> > + 	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;
> 
> I think you either do not want to print it, or want 
> additional details about device...

Ok.  This is essentially the same output printed if the netdev itself
cannot be allocated.  Should I update both strings to have more
device-specific information?

> 
> > + 	}
> > + 
> > + 	dev->egress_subqueue = p;
> > + 	dev->egress_subqueue_count = queue_count;
> > +
> >  	dev->get_stats = maybe_internal_stats;
> >  	setup(dev);
> >  	strcpy(dev->name, name);
> >  	return dev;
> >  }
> > -EXPORT_SYMBOL(alloc_netdev);
> > +EXPORT_SYMBOL(alloc_netdev_mq);
> >  
> >  /**
> >   *	free_netdev - free network device
> > @@ -3345,6 +3358,7 @@ void free_netdev(struct net_device *dev)  {  
> > #ifdef CONFIG_SYSFS
> >  	/*  Compatibility with error handling in drivers */
> > +	kfree((char *)dev->egress_subqueue);
> >  	if (dev->reg_state == NETREG_UNINITIALIZED) {
> >  		kfree((char *)dev - dev->padded);
> >  		return;
> > @@ -3356,6 +3370,7 @@ void free_netdev(struct net_device *dev)
> >  	/* will free via device release */
> >  	put_device(&dev->dev);
> >  #else
> > +	kfree((char *)dev->egress_subqueue);
> 
> Still casting :)

The latest repost removes these casts.


Thanks for the feedback,

-PJ Waskiewicz

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] NET: Multiqueue network device support implementation.
  2007-04-10 15:41     ` Waskiewicz Jr, Peter P
@ 2007-04-10 15:54       ` Evgeniy Polyakov
  0 siblings, 0 replies; 9+ messages in thread
From: Evgeniy Polyakov @ 2007-04-10 15:54 UTC (permalink / raw)
  To: Waskiewicz Jr, Peter P
  Cc: davem, netdev, linux-kernel, jgarzik, cramerj, Kok, Auke-jan H,
	Leech, Christopher

On Tue, Apr 10, 2007 at 08:41:49AM -0700, Waskiewicz Jr, Peter P (peter.p.waskiewicz.jr@intel.com) wrote:
> > On Mon, Apr 09, 2007 at 02:28:41PM -0700, Peter P Waskiewicz 
> > Jr (peter.p.waskiewicz.jr@intel.com) wrote:
> > > + 	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;
> > 
> > I think you either do not want to print it, or want 
> > additional details about device...
> 
> Ok.  This is essentially the same output printed if the netdev itself
> cannot be allocated.  Should I update both strings to have more
> device-specific information?

I wonder, if it is ever possible with gfp_kernel...

I think different patch would be ok.

-- 
	Evgeniy Polyakov

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2007-04-10 16:10 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-09 21:27 [PATCH 0/2] REPOST: Multiqueue network device support Peter P Waskiewicz Jr
2007-04-09 21:28 ` [PATCH 1/2] NET: Multiqueue network device support documentation Peter P Waskiewicz Jr
2007-04-09 21:28 ` [PATCH 2/2] NET: Multiqueue network device support implementation Peter P Waskiewicz Jr
2007-04-09 21:33   ` Jan Engelhardt
2007-04-09 21:52     ` Waskiewicz Jr, Peter P
2007-04-10 11:04       ` Herbert Xu
2007-04-10  8:20   ` Evgeniy Polyakov
2007-04-10 15:41     ` Waskiewicz Jr, Peter P
2007-04-10 15:54       ` Evgeniy Polyakov

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).