Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH 3/3] deinline a few large functions in vlan code - v3
From: David S. Miller @ 2006-04-11  7:58 UTC (permalink / raw)
  To: vda; +Cc: linux-kernel, linux-net, netdev
In-Reply-To: <200604111047.36941.vda@ilport.com.ua>

From: Denis Vlasenko <vda@ilport.com.ua>
Date: Tue, 11 Apr 2006 10:47:36 +0300

> On Tuesday 11 April 2006 10:44, Denis Vlasenko wrote:
> On Tuesday 11 April 2006 10:43, Denis Vlasenko wrote:
> > These patches exclude VLAN code from netdevice drivers
> > and from bonding module, and even remove vlan-related
> > members of struct netdevice if VLAN is not configured.
> > 
> > Compile tested on allyesconfig kernel with CONFIG_8021Q=y,m,n.
> 
> This one add #ifdefs around vlan_rx_* members of struct netdevice,
> and moves large inlines out-of-line.

This is not very nice, there is no way I'm applying these patches.

I think the current situation is far better than the large pile of
ifdefs these patches are adding to the tree.

Let's just leave things the way they are ok?

^ permalink raw reply

* [PATCH 3/3] deinline a few large functions in vlan code - v3
From: Denis Vlasenko @ 2006-04-11  7:47 UTC (permalink / raw)
  To: David S. Miller; +Cc: linux-kernel, linux-net, netdev
In-Reply-To: <200604111044.05847.vda@ilport.com.ua>

[-- Attachment #1: Type: text/plain, Size: 458 bytes --]

On Tuesday 11 April 2006 10:44, Denis Vlasenko wrote:
On Tuesday 11 April 2006 10:43, Denis Vlasenko wrote:
> These patches exclude VLAN code from netdevice drivers
> and from bonding module, and even remove vlan-related
> members of struct netdevice if VLAN is not configured.
> 
> Compile tested on allyesconfig kernel with CONFIG_8021Q=y,m,n.

This one add #ifdefs around vlan_rx_* members of struct netdevice,
and moves large inlines out-of-line.
--
vda

[-- Attachment #2: 2.6.16.vlan_inline5_core.patch --]
[-- Type: text/x-diff, Size: 7579 bytes --]

diff -urpN linux-2.6.16.org/include/linux/if_vlan.h linux-2.6.16.vlan/include/linux/if_vlan.h
--- linux-2.6.16.org/include/linux/if_vlan.h	Mon Mar 20 07:53:29 2006
+++ linux-2.6.16.vlan/include/linux/if_vlan.h	Tue Apr 11 10:15:59 2006
@@ -149,49 +149,9 @@ struct vlan_skb_tx_cookie {
 #define vlan_tx_tag_get(__skb)	(VLAN_TX_SKB_CB(__skb)->vlan_tag)
 
 /* VLAN rx hw acceleration helper.  This acts like netif_{rx,receive_skb}(). */
-static inline int __vlan_hwaccel_rx(struct sk_buff *skb,
+int __vlan_hwaccel_rx(struct sk_buff *skb,
 				    struct vlan_group *grp,
-				    unsigned short vlan_tag, int polling)
-{
-	struct net_device_stats *stats;
-
-	skb->dev = grp->vlan_devices[vlan_tag & VLAN_VID_MASK];
-	if (skb->dev == NULL) {
-		dev_kfree_skb_any(skb);
-
-		/* Not NET_RX_DROP, this is not being dropped
-		 * due to congestion.
-		 */
-		return 0;
-	}
-
-	skb->dev->last_rx = jiffies;
-
-	stats = vlan_dev_get_stats(skb->dev);
-	stats->rx_packets++;
-	stats->rx_bytes += skb->len;
-
-	skb->priority = vlan_get_ingress_priority(skb->dev, vlan_tag);
-	switch (skb->pkt_type) {
-	case PACKET_BROADCAST:
-		break;
-
-	case PACKET_MULTICAST:
-		stats->multicast++;
-		break;
-
-	case PACKET_OTHERHOST:
-		/* Our lower layer thinks this is not local, let's make sure.
-		 * This allows the VLAN to have a different MAC than the underlying
-		 * device, and still route correctly.
-		 */
-		if (!memcmp(eth_hdr(skb)->h_dest, skb->dev->dev_addr, ETH_ALEN))
-			skb->pkt_type = PACKET_HOST;
-		break;
-	};
-
-	return (polling ? netif_receive_skb(skb) : netif_rx(skb));
-}
+				    unsigned short vlan_tag, int polling);
 
 static inline int vlan_hwaccel_rx(struct sk_buff *skb,
 				  struct vlan_group *grp,
@@ -218,43 +178,7 @@ static inline int vlan_hwaccel_receive_s
  * Following the skb_unshare() example, in case of error, the calling function
  * doesn't have to worry about freeing the original skb.
  */
-static inline struct sk_buff *__vlan_put_tag(struct sk_buff *skb, unsigned short tag)
-{
-	struct vlan_ethhdr *veth;
-
-	if (skb_headroom(skb) < VLAN_HLEN) {
-		struct sk_buff *sk_tmp = skb;
-		skb = skb_realloc_headroom(sk_tmp, VLAN_HLEN);
-		kfree_skb(sk_tmp);
-		if (!skb) {
-			printk(KERN_ERR "vlan: failed to realloc headroom\n");
-			return NULL;
-		}
-	} else {
-		skb = skb_unshare(skb, GFP_ATOMIC);
-		if (!skb) {
-			printk(KERN_ERR "vlan: failed to unshare skbuff\n");
-			return NULL;
-		}
-	}
-
-	veth = (struct vlan_ethhdr *)skb_push(skb, VLAN_HLEN);
-
-	/* Move the mac addresses to the beginning of the new header. */
-	memmove(skb->data, skb->data + VLAN_HLEN, 2 * VLAN_ETH_ALEN);
-
-	/* first, the ethernet type */
-	veth->h_vlan_proto = __constant_htons(ETH_P_8021Q);
-
-	/* now, the tag */
-	veth->h_vlan_TCI = htons(tag);
-
-	skb->protocol = __constant_htons(ETH_P_8021Q);
-	skb->mac.raw -= VLAN_HLEN;
-	skb->nh.raw -= VLAN_HLEN;
-
-	return skb;
-}
+struct sk_buff *__vlan_put_tag(struct sk_buff *skb, unsigned short tag);
 
 /**
  * __vlan_hwaccel_put_tag - hardware accelerated VLAN inserting
diff -urpN linux-2.6.16.org/include/linux/netdevice.h linux-2.6.16.vlan/include/linux/netdevice.h
--- linux-2.6.16.org/include/linux/netdevice.h	Mon Mar 20 07:53:29 2006
+++ linux-2.6.16.vlan/include/linux/netdevice.h	Tue Apr 11 10:15:59 2006
@@ -475,12 +475,14 @@ struct net_device
 #define HAVE_TX_TIMEOUT
 	void			(*tx_timeout) (struct net_device *dev);
 
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 	void			(*vlan_rx_register)(struct net_device *dev,
 						    struct vlan_group *grp);
 	void			(*vlan_rx_add_vid)(struct net_device *dev,
 						   unsigned short vid);
 	void			(*vlan_rx_kill_vid)(struct net_device *dev,
 						    unsigned short vid);
+#endif
 
 	int			(*hard_header_parse)(struct sk_buff *skb,
 						     unsigned char *haddr);
diff -urpN linux-2.6.16.org/net/core/Makefile linux-2.6.16.vlan/net/core/Makefile
--- linux-2.6.16.org/net/core/Makefile	Mon Mar 20 07:53:29 2006
+++ linux-2.6.16.vlan/net/core/Makefile	Tue Apr 11 10:15:59 2006
@@ -7,7 +7,7 @@ obj-y := sock.o request_sock.o skbuff.o 
 
 obj-$(CONFIG_SYSCTL) += sysctl_net_core.o
 
-obj-y		     += dev.o ethtool.o dev_mcast.o dst.o \
+obj-y		     += dev.o ethtool.o dev_mcast.o dev_vlan.o dst.o \
 			neighbour.o rtnetlink.o utils.o link_watch.o filter.o
 
 obj-$(CONFIG_XFRM) += flow.o
diff -urpN linux-2.6.16.org/net/core/dev_vlan.c linux-2.6.16.vlan/net/core/dev_vlan.c
--- linux-2.6.16.org/net/core/dev_vlan.c	Thu Jan  1 03:00:00 1970
+++ linux-2.6.16.vlan/net/core/dev_vlan.c	Tue Apr 11 10:15:59 2006
@@ -0,0 +1,110 @@
+/* 802.1q helpers.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
+#if defined(CONFIG_VLAN_8021Q) || defined (CONFIG_VLAN_8021Q_MODULE)
+
+#include <linux/skbuff.h>
+#include <linux/if_vlan.h>
+
+/* VLAN rx hw acceleration helper.  This acts like netif_{rx,receive_skb}(). */
+int __vlan_hwaccel_rx(struct sk_buff *skb,
+				    struct vlan_group *grp,
+				    unsigned short vlan_tag, int polling)
+{
+	struct net_device_stats *stats;
+
+	skb->dev = grp->vlan_devices[vlan_tag & VLAN_VID_MASK];
+	if (skb->dev == NULL) {
+		dev_kfree_skb_any(skb);
+
+		/* Not NET_RX_DROP, this is not being dropped
+		 * due to congestion.
+		 */
+		return 0;
+	}
+
+	skb->dev->last_rx = jiffies;
+
+	stats = vlan_dev_get_stats(skb->dev);
+	stats->rx_packets++;
+	stats->rx_bytes += skb->len;
+
+	skb->priority = vlan_get_ingress_priority(skb->dev, vlan_tag);
+	switch (skb->pkt_type) {
+	case PACKET_BROADCAST:
+		break;
+
+	case PACKET_MULTICAST:
+		stats->multicast++;
+		break;
+
+	case PACKET_OTHERHOST:
+		/* Our lower layer thinks this is not local, let's make sure.
+		 * This allows the VLAN to have a different MAC than the underlying
+		 * device, and still route correctly.
+		 */
+		if (!memcmp(eth_hdr(skb)->h_dest, skb->dev->dev_addr, ETH_ALEN))
+			skb->pkt_type = PACKET_HOST;
+		break;
+	};
+
+	return (polling ? netif_receive_skb(skb) : netif_rx(skb));
+}
+EXPORT_SYMBOL(__vlan_hwaccel_rx);
+
+/**
+ * __vlan_put_tag - regular VLAN tag inserting
+ * @skb: skbuff to tag
+ * @tag: VLAN tag to insert
+ *
+ * Inserts the VLAN tag into @skb as part of the payload
+ * Returns a VLAN tagged skb. If a new skb is created, @skb is freed.
+ * 
+ * Following the skb_unshare() example, in case of error, the calling function
+ * doesn't have to worry about freeing the original skb.
+ */
+struct sk_buff *__vlan_put_tag(struct sk_buff *skb, unsigned short tag)
+{
+	struct vlan_ethhdr *veth;
+
+	if (skb_headroom(skb) < VLAN_HLEN) {
+		struct sk_buff *sk_tmp = skb;
+		skb = skb_realloc_headroom(sk_tmp, VLAN_HLEN);
+		kfree_skb(sk_tmp);
+		if (!skb) {
+			printk(KERN_ERR "vlan: failed to realloc headroom\n");
+			return NULL;
+		}
+	} else {
+		skb = skb_unshare(skb, GFP_ATOMIC);
+		if (!skb) {
+			printk(KERN_ERR "vlan: failed to unshare skbuff\n");
+			return NULL;
+		}
+	}
+
+	veth = (struct vlan_ethhdr *)skb_push(skb, VLAN_HLEN);
+
+	/* Move the mac addresses to the beginning of the new header. */
+	memmove(skb->data, skb->data + VLAN_HLEN, 2 * VLAN_ETH_ALEN);
+
+	/* first, the ethernet type */
+	veth->h_vlan_proto = __constant_htons(ETH_P_8021Q);
+
+	/* now, the tag */
+	veth->h_vlan_TCI = htons(tag);
+
+	skb->protocol = __constant_htons(ETH_P_8021Q);
+	skb->mac.raw -= VLAN_HLEN;
+	skb->nh.raw -= VLAN_HLEN;
+
+	return skb;
+}
+EXPORT_SYMBOL(__vlan_put_tag);
+
+#endif

^ permalink raw reply

* [PATCH 2/3] deinline a few large functions in vlan code - v3
From: Denis Vlasenko @ 2006-04-11  7:44 UTC (permalink / raw)
  To: David S. Miller; +Cc: jgarzik, linux-kernel, linux-net, netdev
In-Reply-To: <200604111043.13605.vda@ilport.com.ua>

[-- Attachment #1: Type: text/plain, Size: 356 bytes --]

On Tuesday 11 April 2006 10:43, Denis Vlasenko wrote:
> These patches exclude VLAN code from netdevice drivers
> and from bonding module, and even remove vlan-related
> members of struct netdevice if VLAN is not configured.
> 
> Compile tested on allyesconfig kernel with CONFIG_8021Q=y,m,n.

This one takes care of drivers/net/bonding/bonding.[ch]
--
vda

[-- Attachment #2: 2.6.16.vlan_inline5_bonding.patch --]
[-- Type: text/x-diff, Size: 12407 bytes --]

diff -urpN linux-2.6.16.org/drivers/net/bonding/bond_alb.c linux-2.6.16.vlan/drivers/net/bonding/bond_alb.c
--- linux-2.6.16.org/drivers/net/bonding/bond_alb.c	Mon Mar 20 07:53:29 2006
+++ linux-2.6.16.vlan/drivers/net/bonding/bond_alb.c	Tue Apr 11 10:15:58 2006
@@ -502,6 +502,7 @@ static void rlb_update_client(struct rlb
 
 		skb->dev = client_info->slave->dev;
 
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 		if (client_info->tag) {
 			skb = vlan_put_tag(skb, client_info->vlan_id);
 			if (!skb) {
@@ -511,7 +512,7 @@ static void rlb_update_client(struct rlb
 				continue;
 			}
 		}
-
+#endif
 		arp_xmit(skb);
 	}
 }
@@ -671,6 +672,7 @@ static struct slave *rlb_choose_channel(
 			client_info->ntt = 0;
 		}
 
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 		if (!list_empty(&bond->vlan_list)) {
 			unsigned short vlan_id;
 			int res = vlan_get_tag(skb, &vlan_id);
@@ -679,6 +681,7 @@ static struct slave *rlb_choose_channel(
 				client_info->vlan_id = vlan_id;
 			}
 		}
+#endif
 
 		if (!client_info->assigned) {
 			u32 prev_tbl_head = bond_info->rx_hashtbl_head;
@@ -833,6 +836,7 @@ static void rlb_deinitialize(struct bond
 	_unlock_rx_hashtbl(bond);
 }
 
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 static void rlb_clear_vlan(struct bonding *bond, unsigned short vlan_id)
 {
 	struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond));
@@ -865,12 +869,15 @@ static void rlb_clear_vlan(struct bondin
 
 	_unlock_rx_hashtbl(bond);
 }
+#endif
 
 /*********************** tlb/rlb shared functions *********************/
 
 static void alb_send_learning_packets(struct slave *slave, u8 mac_addr[])
 {
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 	struct bonding *bond = bond_get_bond_by_slave(slave);
+#endif
 	struct learning_pkt pkt;
 	int size = sizeof(struct learning_pkt);
 	int i;
@@ -898,6 +905,7 @@ static void alb_send_learning_packets(st
 		skb->priority = TC_PRIO_CONTROL;
 		skb->dev = slave->dev;
 
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 		if (!list_empty(&bond->vlan_list)) {
 			struct vlan_entry *vlan;
 
@@ -918,7 +926,7 @@ static void alb_send_learning_packets(st
 				continue;
 			}
 		}
-
+#endif
 		dev_queue_xmit(skb);
 	}
 }
@@ -1665,6 +1673,7 @@ int bond_alb_set_mac_address(struct net_
 	return 0;
 }
 
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 void bond_alb_clear_vlan(struct bonding *bond, unsigned short vlan_id)
 {
 	if (bond->alb_info.current_alb_vlan &&
@@ -1676,4 +1685,4 @@ void bond_alb_clear_vlan(struct bonding 
 		rlb_clear_vlan(bond, vlan_id);
 	}
 }
-
+#endif
diff -urpN linux-2.6.16.org/drivers/net/bonding/bond_main.c linux-2.6.16.vlan/drivers/net/bonding/bond_main.c
--- linux-2.6.16.org/drivers/net/bonding/bond_main.c	Mon Mar 20 07:53:29 2006
+++ linux-2.6.16.vlan/drivers/net/bonding/bond_main.c	Tue Apr 11 10:15:58 2006
@@ -199,6 +199,7 @@ const char *bond_mode_name(int mode)
 	}
 }
 
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 /*---------------------------------- VLAN -----------------------------------*/
 
 /**
@@ -349,6 +350,7 @@ struct vlan_entry *bond_next_vlan(struct
 
 	return next;
 }
+#endif
 
 /**
  * bond_dev_queue_xmit - Prepare skb for xmit.
@@ -366,6 +368,7 @@ struct vlan_entry *bond_next_vlan(struct
  */
 int bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb, struct net_device *slave_dev)
 {
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 	unsigned short vlan_id;
 
 	if (!list_empty(&bond->vlan_list) &&
@@ -380,9 +383,9 @@ int bond_dev_queue_xmit(struct bonding *
 			 */
 			return 0;
 		}
-	} else {
+	} else
+#endif
 		skb->dev = slave_dev;
-	}
 
 	skb->priority = 1;
 	dev_queue_xmit(skb);
@@ -390,6 +393,7 @@ int bond_dev_queue_xmit(struct bonding *
 	return 0;
 }
 
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 /*
  * In the following 3 functions, bond_vlan_rx_register(), bond_vlan_rx_add_vid
  * and bond_vlan_rx_kill_vid, We don't protect the slave list iteration with a
@@ -555,6 +559,7 @@ unreg:
 out:
 	write_unlock_bh(&bond->lock);
 }
+#endif /* defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) */
 
 /*------------------------------- Link status -------------------------------*/
 
@@ -1215,6 +1220,7 @@ int bond_enslave(struct net_device *bond
 		return -EBUSY;
 	}
 
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 	/* vlan challenged mutual exclusion */
 	/* no need to lock since we're protected by rtnl_lock */
 	if (slave_dev->features & NETIF_F_VLAN_CHALLENGED) {
@@ -1244,6 +1250,7 @@ int bond_enslave(struct net_device *bond
 			bond_dev->features &= ~NETIF_F_VLAN_CHALLENGED;
 		}
 	}
+#endif
 
 	/*
 	 * Old ifenslave binaries are no longer supported.  These can
@@ -1356,7 +1363,9 @@ int bond_enslave(struct net_device *bond
 		dev_mc_add(slave_dev, lacpdu_multicast, ETH_ALEN, 0);
 	}
 
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 	bond_add_vlans_on_slave(bond, slave_dev);
+#endif
 
 	write_lock_bh(&bond->lock);
 
@@ -1667,6 +1676,7 @@ int bond_release(struct net_device *bond
 		 */
 		memset(bond_dev->dev_addr, 0, bond_dev->addr_len);
 
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 		if (list_empty(&bond->vlan_list)) {
 			bond_dev->features |= NETIF_F_VLAN_CHALLENGED;
 		} else {
@@ -1686,6 +1696,7 @@ int bond_release(struct net_device *bond
 		       "left bond %s. VLAN blocking is removed\n",
 		       bond_dev->name, slave_dev->name, bond_dev->name);
 		bond_dev->features &= ~NETIF_F_VLAN_CHALLENGED;
+#endif
 	}
 
 	write_unlock_bh(&bond->lock);
@@ -1693,7 +1704,9 @@ int bond_release(struct net_device *bond
 	/* must do this from outside any spinlocks */
 	bond_destroy_slave_symlinks(bond_dev, slave_dev);
 
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 	bond_del_vlans_from_slave(bond, slave_dev);
+#endif
 
 	/* If the mode USES_PRIMARY, then we should only remove its
 	 * promisc and mc settings if it was the curr_active_slave, but that was
@@ -1785,8 +1798,9 @@ static int bond_release_all(struct net_d
 		write_unlock_bh(&bond->lock);
 
 		bond_destroy_slave_symlinks(bond_dev, slave_dev);
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 		bond_del_vlans_from_slave(bond, slave_dev);
-
+#endif
 		/* If the mode USES_PRIMARY, then we should only remove its
 		 * promisc and mc settings if it was the curr_active_slave, but that was
 		 * already taken care of above when we detached the slave
@@ -1835,6 +1849,7 @@ static int bond_release_all(struct net_d
 	 */
 	memset(bond_dev->dev_addr, 0, bond_dev->addr_len);
 
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 	if (list_empty(&bond->vlan_list)) {
 		bond_dev->features |= NETIF_F_VLAN_CHALLENGED;
 	} else {
@@ -1847,6 +1862,7 @@ static int bond_release_all(struct net_d
 		       "HW address matches its VLANs'.\n",
 		       bond_dev->name);
 	}
+#endif
 
 	printk(KERN_INFO DRV_NAME
 	       ": %s: released all slaves\n",
@@ -2234,11 +2250,14 @@ out:
 
 static int bond_has_ip(struct bonding *bond)
 {
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 	struct vlan_entry *vlan, *vlan_next;
+#endif
 
 	if (bond->master_ip)
 		return 1;
 
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 	if (list_empty(&bond->vlan_list))
 		return 0;
 
@@ -2247,6 +2266,7 @@ static int bond_has_ip(struct bonding *b
 		if (vlan->vlan_ip)
 			return 1;
 	}
+#endif
 
 	return 0;
 }
@@ -2270,6 +2290,7 @@ static void bond_arp_send(struct net_dev
 		printk(KERN_ERR DRV_NAME ": ARP packet allocation failed\n");
 		return;
 	}
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 	if (vlan_id) {
 		skb = vlan_put_tag(skb, vlan_id);
 		if (!skb) {
@@ -2277,30 +2298,38 @@ static void bond_arp_send(struct net_dev
 			return;
 		}
 	}
+#endif
 	arp_xmit(skb);
 }
 
 
 static void bond_arp_send_all(struct bonding *bond, struct slave *slave)
 {
-	int i, vlan_id, rv;
+	int i;
 	u32 *targets = bond->params.arp_targets;
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
+	int vlan_id, rv;
 	struct vlan_entry *vlan, *vlan_next;
 	struct net_device *vlan_dev;
 	struct flowi fl;
 	struct rtable *rt;
+#endif
 
 	for (i = 0; (i < BOND_MAX_ARP_TARGETS); i++) {
 		if (!targets[i])
 			continue;
 		dprintk("basa: target %x\n", targets[i]);
-		if (list_empty(&bond->vlan_list)) {
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
+		if (list_empty(&bond->vlan_list))
+#endif
+		{
 			dprintk("basa: empty vlan: arp_send\n");
 			bond_arp_send(slave->dev, ARPOP_REQUEST, targets[i],
 				      bond->master_ip, 0);
 			continue;
 		}
 
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 		/*
 		 * If VLANs are configured, we do a route lookup to
 		 * determine which VLAN interface would be used, so we
@@ -2357,6 +2386,7 @@ static void bond_arp_send_all(struct bon
 			       rt->u.dst.dev ? rt->u.dst.dev->name : "NULL");
 		}
 		ip_rt_put(rt);
+#endif
 	}
 }
 
@@ -2367,9 +2397,10 @@ static void bond_arp_send_all(struct bon
 static void bond_send_gratuitous_arp(struct bonding *bond)
 {
 	struct slave *slave = bond->curr_active_slave;
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 	struct vlan_entry *vlan;
 	struct net_device *vlan_dev;
-
+#endif
 	dprintk("bond_send_grat_arp: bond %s slave %s\n", bond->dev->name,
 				slave ? slave->dev->name : "NULL");
 	if (!slave)
@@ -2380,6 +2411,7 @@ static void bond_send_gratuitous_arp(str
 				  bond->master_ip, 0);
 	}
 
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 	list_for_each_entry(vlan, &bond->vlan_list, vlan_list) {
 		vlan_dev = bond->vlgrp->vlan_devices[vlan->vlan_id];
 		if (vlan->vlan_ip) {
@@ -2387,6 +2419,7 @@ static void bond_send_gratuitous_arp(str
 				      vlan->vlan_ip, vlan->vlan_id);
 		}
 	}
+#endif
 }
 
 /*
@@ -3197,9 +3230,12 @@ static int bond_netdev_event(struct noti
 static int bond_inetaddr_event(struct notifier_block *this, unsigned long event, void *ptr)
 {
 	struct in_ifaddr *ifa = ptr;
-	struct net_device *vlan_dev, *event_dev = ifa->ifa_dev->dev;
+	struct net_device *event_dev = ifa->ifa_dev->dev;
 	struct bonding *bond, *bond_next;
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 	struct vlan_entry *vlan, *vlan_next;
+	struct net_device *vlan_dev;
+#endif
 
 	list_for_each_entry_safe(bond, bond_next, &bond_dev_list, bond_list) {
 		if (bond->dev == event_dev) {
@@ -3215,6 +3251,7 @@ static int bond_inetaddr_event(struct no
 			}
 		}
 
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 		if (list_empty(&bond->vlan_list))
 			continue;
 
@@ -3235,6 +3272,7 @@ static int bond_inetaddr_event(struct no
 				}
 			}
 		}
+#endif
 	}
 	return NOTIFY_DONE;
 }
@@ -4120,7 +4158,9 @@ static int bond_init(struct net_device *
 	bond->current_arp_slave = NULL;
 	bond->primary_slave = NULL;
 	bond->dev = bond_dev;
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 	INIT_LIST_HEAD(&bond->vlan_list);
+#endif
 
 	/* Initialize the device entry points */
 	bond_dev->open = bond_open;
@@ -4151,6 +4191,7 @@ static int bond_init(struct net_device *
 	 * transmitting */
 	bond_dev->features |= NETIF_F_LLTX;
 
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 	/* By default, we declare the bond to be fully
 	 * VLAN hardware accelerated capable. Special
 	 * care is taken in the various xmit functions
@@ -4163,6 +4204,7 @@ static int bond_init(struct net_device *
 	bond_dev->features |= (NETIF_F_HW_VLAN_TX |
 			       NETIF_F_HW_VLAN_RX |
 			       NETIF_F_HW_VLAN_FILTER);
+#endif
 
 #ifdef CONFIG_PROC_FS
 	bond_create_proc_entry(bond);
diff -urpN linux-2.6.16.org/drivers/net/bonding/bonding.h linux-2.6.16.vlan/drivers/net/bonding/bonding.h
--- linux-2.6.16.org/drivers/net/bonding/bonding.h	Mon Mar 20 07:53:29 2006
+++ linux-2.6.16.vlan/drivers/net/bonding/bonding.h	Tue Apr 11 10:15:58 2006
@@ -196,8 +196,10 @@ struct bonding {
 	struct   ad_bond_info ad_info;
 	struct   alb_bond_info alb_info;
 	struct   bond_params params;
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 	struct   list_head vlan_list;
 	struct   vlan_group *vlgrp;
+#endif
 };
 
 /**

^ permalink raw reply

* [PATCH 1/3] deinline a few large functions in vlan code - v3
From: Denis Vlasenko @ 2006-04-11  7:43 UTC (permalink / raw)
  To: David S. Miller, jgarzik, linux-kernel, linux-net, netdev

[-- Attachment #1: Type: text/plain, Size: 496 bytes --]

Hi,

After davem and Dave Dillow comments I realized that
a lot of drivers try to do VLAN-related things even on
non-VLAN-enabled kernels.

These patches exclude VLAN code from netdevice drivers
and from bonding module, and even remove vlan-related
members of struct netdevice if VLAN is not configured.

Compile tested on allyesconfig kernel with CONFIG_8021Q=y,m,n.

Below is a patch which takes care of drivers/net/*.

Please comment.

Signed-off-by: Denis Vlasenko <vda@ilport.com.ua>
--
vda

[-- Attachment #2: 2.6.16.vlan_inline5_drivers.patch --]
[-- Type: text/x-diff, Size: 24202 bytes --]

diff -urpN linux-2.6.16.org/drivers/net/bnx2.c linux-2.6.16.vlan/drivers/net/bnx2.c
--- linux-2.6.16.org/drivers/net/bnx2.c	Mon Mar 20 07:53:29 2006
+++ linux-2.6.16.vlan/drivers/net/bnx2.c	Tue Apr 11 10:15:58 2006
@@ -4436,10 +4436,13 @@ bnx2_start_xmit(struct sk_buff *skb, str
 		vlan_tag_flags |= TX_BD_FLAGS_TCP_UDP_CKSUM;
 	}
 
+#ifdef BCM_VLAN
 	if (bp->vlgrp != 0 && vlan_tx_tag_present(skb)) {
 		vlan_tag_flags |=
 			(TX_BD_FLAGS_VLAN_TAG | (vlan_tx_tag_get(skb) << 16));
 	}
+#endif
+
 #ifdef BCM_TSO 
 	if ((mss = skb_shinfo(skb)->tso_size) &&
 		(skb->len > (bp->dev->mtu + ETH_HLEN))) {
diff -urpN linux-2.6.16.org/drivers/net/bnx2.h linux-2.6.16.vlan/drivers/net/bnx2.h
--- linux-2.6.16.org/drivers/net/bnx2.h	Mon Mar 20 07:53:29 2006
+++ linux-2.6.16.vlan/drivers/net/bnx2.h	Tue Apr 11 10:15:58 2006
@@ -40,7 +40,9 @@
 #include <linux/mii.h>
 #ifdef NETIF_F_HW_VLAN_TX
 #include <linux/if_vlan.h>
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 #define BCM_VLAN 1
+#endif
 #endif
 #ifdef NETIF_F_TSO
 #include <net/ip.h>
diff -urpN linux-2.6.16.org/drivers/net/chelsio/sge.c linux-2.6.16.vlan/drivers/net/chelsio/sge.c
--- linux-2.6.16.org/drivers/net/chelsio/sge.c	Mon Mar 20 07:53:29 2006
+++ linux-2.6.16.vlan/drivers/net/chelsio/sge.c	Tue Apr 11 10:15:58 2006
@@ -978,6 +978,7 @@ static int sge_rx(struct sge *sge, struc
 	} else
 		skb->ip_summed = CHECKSUM_NONE;
 
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 	if (unlikely(adapter->vlan_grp && p->vlan_valid)) {
 		sge->port_stats[p->iff].vlan_xtract++;
 		if (adapter->params.sge.polling)
@@ -986,7 +987,9 @@ static int sge_rx(struct sge *sge, struc
 		else
 			vlan_hwaccel_rx(skb, adapter->vlan_grp,
 					ntohs(p->vlan));
-	} else if (adapter->params.sge.polling)
+	} else
+#endif
+	if (adapter->params.sge.polling)
 		netif_receive_skb(skb);
 	else
 		netif_rx(skb);
diff -urpN linux-2.6.16.org/drivers/net/e1000/e1000.h linux-2.6.16.vlan/drivers/net/e1000/e1000.h
--- linux-2.6.16.org/drivers/net/e1000/e1000.h	Mon Mar 20 07:53:29 2006
+++ linux-2.6.16.vlan/drivers/net/e1000/e1000.h	Tue Apr 11 10:15:58 2006
@@ -254,8 +254,10 @@ struct e1000_adapter {
 	struct timer_list tx_fifo_stall_timer;
 	struct timer_list watchdog_timer;
 	struct timer_list phy_info_timer;
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 	struct vlan_group *vlgrp;
     	uint16_t mng_vlan_id;
+#endif
 	uint32_t bd_number;
 	uint32_t rx_buffer_len;
 	uint32_t part_num;
diff -urpN linux-2.6.16.org/drivers/net/e1000/e1000_main.c linux-2.6.16.vlan/drivers/net/e1000/e1000_main.c
--- linux-2.6.16.org/drivers/net/e1000/e1000_main.c	Mon Mar 20 07:53:29 2006
+++ linux-2.6.16.vlan/drivers/net/e1000/e1000_main.c	Tue Apr 11 10:15:59 2006
@@ -250,10 +250,12 @@ static void e1000_smartspeed(struct e100
 static inline int e1000_82547_fifo_workaround(struct e1000_adapter *adapter,
 					      struct sk_buff *skb);
 
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 static void e1000_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp);
 static void e1000_vlan_rx_add_vid(struct net_device *netdev, uint16_t vid);
 static void e1000_vlan_rx_kill_vid(struct net_device *netdev, uint16_t vid);
 static void e1000_restore_vlan(struct e1000_adapter *adapter);
+#endif
 
 #ifdef CONFIG_PM
 static int e1000_suspend(struct pci_dev *pdev, pm_message_t state);
@@ -361,6 +363,7 @@ e1000_irq_enable(struct e1000_adapter *a
 	}
 }
 
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 static void
 e1000_update_mng_vlan(struct e1000_adapter *adapter)
 {
@@ -383,6 +386,7 @@ e1000_update_mng_vlan(struct e1000_adapt
 		}
 	}
 }
+#endif
 
 /**
  * e1000_release_hw_control - release control of the h/w to f/w
@@ -470,7 +474,9 @@ e1000_up(struct e1000_adapter *adapter)
 
 	e1000_set_multi(netdev);
 
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 	e1000_restore_vlan(adapter);
+#endif
 
 	e1000_configure_tx(adapter);
 	e1000_setup_rctl(adapter);
@@ -629,9 +635,12 @@ e1000_reset(struct e1000_adapter *adapte
 		E1000_WRITE_REG(&adapter->hw, WUC, 0);
 	if (e1000_init_hw(&adapter->hw))
 		DPRINTK(PROBE, ERR, "Hardware Error\n");
+
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 	e1000_update_mng_vlan(adapter);
 	/* Enable h/w to recognize an 802.1Q VLAN Ethernet packet */
 	E1000_WRITE_REG(&adapter->hw, VET, ETHERNET_IEEE_VLAN_TYPE);
+#endif
 
 	e1000_reset_adaptive(&adapter->hw);
 	e1000_phy_get_info(&adapter->hw, &adapter->phy_info);
@@ -733,9 +742,11 @@ e1000_probe(struct pci_dev *pdev,
 	netdev->poll = &e1000_clean;
 	netdev->weight = 64;
 #endif
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 	netdev->vlan_rx_register = e1000_vlan_rx_register;
 	netdev->vlan_rx_add_vid = e1000_vlan_rx_add_vid;
 	netdev->vlan_rx_kill_vid = e1000_vlan_rx_kill_vid;
+#endif
 #ifdef CONFIG_NET_POLL_CONTROLLER
 	netdev->poll_controller = e1000_netpoll;
 #endif
@@ -1228,11 +1239,14 @@ e1000_open(struct net_device *netdev)
 
 	if ((err = e1000_up(adapter)))
 		goto err_up;
+
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 	adapter->mng_vlan_id = E1000_MNG_VLAN_NONE;
 	if ((adapter->hw.mng_cookie.status &
 			  E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT)) {
 		e1000_update_mng_vlan(adapter);
 	}
+#endif
 
 	/* If AMT is enabled, let the firmware know that the network
 	 * interface is now open */
@@ -1274,10 +1288,12 @@ e1000_close(struct net_device *netdev)
 	e1000_free_all_tx_resources(adapter);
 	e1000_free_all_rx_resources(adapter);
 
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 	if ((adapter->hw.mng_cookie.status &
 			  E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT)) {
 		e1000_vlan_rx_kill_vid(netdev, adapter->mng_vlan_id);
 	}
+#endif
 
 	/* If AMT is enabled, let the firmware know that the network
 	 * interface is now closed */
@@ -2397,8 +2413,10 @@ e1000_watchdog_task(struct e1000_adapter
 	e1000_check_for_link(&adapter->hw);
 	if (adapter->hw.mac_type == e1000_82573) {
 		e1000_enable_tx_pkt_filtering(&adapter->hw);
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 		if (adapter->mng_vlan_id != adapter->hw.mng_cookie.vlan_id)
 			e1000_update_mng_vlan(adapter);
+#endif
 	}
 
 	if ((adapter->hw.media_type == e1000_media_type_internal_serdes) &&
@@ -2985,10 +3003,12 @@ e1000_xmit_frame(struct sk_buff *skb, st
 		}
 	}
 
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 	if (unlikely(adapter->vlgrp && vlan_tx_tag_present(skb))) {
 		tx_flags |= E1000_TX_FLAGS_VLAN;
 		tx_flags |= (vlan_tx_tag_get(skb) << E1000_TX_FLAGS_VLAN_SHIFT);
 	}
+#endif
 
 	first = tx_ring->next_to_use;
 
@@ -3714,23 +3734,25 @@ e1000_clean_rx_irq(struct e1000_adapter 
 
 		skb->protocol = eth_type_trans(skb, netdev);
 #ifdef CONFIG_E1000_NAPI
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 		if (unlikely(adapter->vlgrp &&
 			    (status & E1000_RXD_STAT_VP))) {
 			vlan_hwaccel_receive_skb(skb, adapter->vlgrp,
 						 le16_to_cpu(rx_desc->special) &
 						 E1000_RXD_SPC_VLAN_MASK);
-		} else {
+		} else
+#endif
 			netif_receive_skb(skb);
-		}
 #else /* CONFIG_E1000_NAPI */
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 		if (unlikely(adapter->vlgrp &&
 			    (status & E1000_RXD_STAT_VP))) {
 			vlan_hwaccel_rx(skb, adapter->vlgrp,
 					le16_to_cpu(rx_desc->special) &
 					E1000_RXD_SPC_VLAN_MASK);
-		} else {
+		} else
+#endif
 			netif_rx(skb);
-		}
 #endif /* CONFIG_E1000_NAPI */
 		netdev->last_rx = jiffies;
 #ifdef CONFIG_E1000_MQ
@@ -3861,21 +3883,23 @@ e1000_clean_rx_irq_ps(struct e1000_adapt
 			   cpu_to_le16(E1000_RXDPS_HDRSTAT_HDRSP)))
 			adapter->rx_hdr_split++;
 #ifdef CONFIG_E1000_NAPI
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 		if (unlikely(adapter->vlgrp && (staterr & E1000_RXD_STAT_VP))) {
 			vlan_hwaccel_receive_skb(skb, adapter->vlgrp,
 				le16_to_cpu(rx_desc->wb.middle.vlan) &
 				E1000_RXD_SPC_VLAN_MASK);
-		} else {
+		} else
+#endif
 			netif_receive_skb(skb);
-		}
 #else /* CONFIG_E1000_NAPI */
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 		if (unlikely(adapter->vlgrp && (staterr & E1000_RXD_STAT_VP))) {
 			vlan_hwaccel_rx(skb, adapter->vlgrp,
 				le16_to_cpu(rx_desc->wb.middle.vlan) &
 				E1000_RXD_SPC_VLAN_MASK);
-		} else {
+		} else
+#endif
 			netif_rx(skb);
-		}
 #endif /* CONFIG_E1000_NAPI */
 		netdev->last_rx = jiffies;
 #ifdef CONFIG_E1000_MQ
@@ -4351,6 +4375,7 @@ e1000_io_write(struct e1000_hw *hw, unsi
 	outl(value, port);
 }
 
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 static void
 e1000_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp)
 {
@@ -4382,10 +4407,12 @@ e1000_vlan_rx_register(struct net_device
 		rctl = E1000_READ_REG(&adapter->hw, RCTL);
 		rctl &= ~E1000_RCTL_VFE;
 		E1000_WRITE_REG(&adapter->hw, RCTL, rctl);
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 		if (adapter->mng_vlan_id != (uint16_t)E1000_MNG_VLAN_NONE) {
 			e1000_vlan_rx_kill_vid(netdev, adapter->mng_vlan_id);
 			adapter->mng_vlan_id = E1000_MNG_VLAN_NONE;
 		}
+#endif
 	}
 
 	e1000_irq_enable(adapter);
@@ -4450,6 +4477,7 @@ e1000_restore_vlan(struct e1000_adapter 
 		}
 	}
 }
+#endif
 
 int
 e1000_set_spd_dplx(struct e1000_adapter *adapter, uint16_t spddplx)
diff -urpN linux-2.6.16.org/drivers/net/gianfar.c linux-2.6.16.vlan/drivers/net/gianfar.c
--- linux-2.6.16.org/drivers/net/gianfar.c	Mon Mar 20 07:53:29 2006
+++ linux-2.6.16.vlan/drivers/net/gianfar.c	Tue Apr 11 10:15:59 2006
@@ -270,6 +270,7 @@ static int gfar_probe(struct platform_de
 	} else
 		priv->rx_csum_enable = 0;
 
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 	priv->vlgrp = NULL;
 
 	if (priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_VLAN) {
@@ -280,6 +281,7 @@ static int gfar_probe(struct platform_de
 
 		priv->vlan_enable = 1;
 	}
+#endif
 
 	if (priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_EXTENDED_HASH) {
 		priv->extended_hash = 1;
@@ -792,8 +794,10 @@ int startup_gfar(struct net_device *dev)
 		rctrl |= RCTRL_EMEN;
 	}
 
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 	if (priv->vlan_enable)
 		rctrl |= RCTRL_VLAN;
+#endif
 
 	if (priv->padding) {
 		rctrl &= ~RCTRL_PAL_MASK;
@@ -945,6 +949,7 @@ static int gfar_start_xmit(struct sk_buf
 		gfar_tx_checksum(skb, fcb);
 	}
 
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 	if (priv->vlan_enable &&
 			unlikely(priv->vlgrp && vlan_tx_tag_present(skb))) {
 		if (unlikely(NULL == fcb)) {
@@ -954,6 +959,7 @@ static int gfar_start_xmit(struct sk_buf
 
 		gfar_tx_vlan(skb, fcb);
 	}
+#endif
 
 	/* Set buffer length and pointer */
 	txbdp->length = skb->len;
@@ -1037,6 +1043,7 @@ int gfar_set_mac_address(struct net_devi
 }
 
 
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 /* Enables and disables VLAN insertion/extraction */
 static void gfar_vlan_rx_register(struct net_device *dev,
 		struct vlan_group *grp)
@@ -1074,8 +1081,10 @@ static void gfar_vlan_rx_register(struct
 
 	spin_unlock_irqrestore(&priv->lock, flags);
 }
+#endif
 
 
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 static void gfar_vlan_rx_kill_vid(struct net_device *dev, uint16_t vid)
 {
 	struct gfar_private *priv = netdev_priv(dev);
@@ -1088,6 +1097,7 @@ static void gfar_vlan_rx_kill_vid(struct
 
 	spin_unlock_irqrestore(&priv->lock, flags);
 }
+#endif
 
 
 static int gfar_change_mtu(struct net_device *dev, int new_mtu)
@@ -1097,8 +1107,10 @@ static int gfar_change_mtu(struct net_de
 	int oldsize = priv->rx_buffer_size;
 	int frame_size = new_mtu + ETH_HLEN;
 
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 	if (priv->vlan_enable)
 		frame_size += VLAN_ETH_HLEN;
+#endif
 
 	if (gfar_uses_fcb(priv))
 		frame_size += GMAC_FCB_LEN;
@@ -1343,6 +1355,7 @@ irqreturn_t gfar_receive(int irq, void *
 	return IRQ_HANDLED;
 }
 
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 static inline int gfar_rx_vlan(struct sk_buff *skb,
 		struct vlan_group *vlgrp, unsigned short vlctl)
 {
@@ -1352,6 +1365,7 @@ static inline int gfar_rx_vlan(struct sk
 	return vlan_hwaccel_rx(skb, vlgrp, vlctl);
 #endif
 }
+#endif
 
 static inline void gfar_rx_checksum(struct sk_buff *skb, struct rxfcb *fcb)
 {
@@ -1409,9 +1423,11 @@ static int gfar_process_frame(struct net
 		skb->protocol = eth_type_trans(skb, dev);
 
 		/* Send the packet up the stack */
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 		if (unlikely(priv->vlgrp && (fcb->flags & RXFCB_VLN)))
 			ret = gfar_rx_vlan(skb, priv->vlgrp, fcb->vlctl);
 		else
+#endif
 			ret = RECEIVE(skb);
 
 		if (NET_RX_DROP == ret)
diff -urpN linux-2.6.16.org/drivers/net/gianfar.h linux-2.6.16.vlan/drivers/net/gianfar.h
--- linux-2.6.16.org/drivers/net/gianfar.h	Mon Mar 20 07:53:29 2006
+++ linux-2.6.16.vlan/drivers/net/gianfar.h	Tue Apr 11 10:15:59 2006
@@ -702,7 +702,9 @@ struct gfar_private {
 		extended_hash:1,
 		bd_stash_en:1;
 	unsigned short padding;
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 	struct vlan_group *vlgrp;
+#endif
 	/* Info structure initialized by board setup code */
 	unsigned int interruptTransmit;
 	unsigned int interruptReceive;
diff -urpN linux-2.6.16.org/drivers/net/ixgb/ixgb.h linux-2.6.16.vlan/drivers/net/ixgb/ixgb.h
--- linux-2.6.16.org/drivers/net/ixgb/ixgb.h	Mon Mar 20 07:53:29 2006
+++ linux-2.6.16.vlan/drivers/net/ixgb/ixgb.h	Tue Apr 11 10:15:59 2006
@@ -155,7 +155,9 @@ struct ixgb_desc_ring {
 
 struct ixgb_adapter {
 	struct timer_list watchdog_timer;
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 	struct vlan_group *vlgrp;
+#endif
 	uint32_t bd_number;
 	uint32_t rx_buffer_len;
 	uint32_t part_num;
diff -urpN linux-2.6.16.org/drivers/net/ixgb/ixgb_main.c linux-2.6.16.vlan/drivers/net/ixgb/ixgb_main.c
--- linux-2.6.16.org/drivers/net/ixgb/ixgb_main.c	Mon Mar 20 07:53:29 2006
+++ linux-2.6.16.vlan/drivers/net/ixgb/ixgb_main.c	Tue Apr 11 10:15:59 2006
@@ -121,11 +121,13 @@ static void ixgb_alloc_rx_buffers(struct
 void ixgb_set_ethtool_ops(struct net_device *netdev);
 static void ixgb_tx_timeout(struct net_device *dev);
 static void ixgb_tx_timeout_task(struct net_device *dev);
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 static void ixgb_vlan_rx_register(struct net_device *netdev,
 				  struct vlan_group *grp);
 static void ixgb_vlan_rx_add_vid(struct net_device *netdev, uint16_t vid);
 static void ixgb_vlan_rx_kill_vid(struct net_device *netdev, uint16_t vid);
 static void ixgb_restore_vlan(struct ixgb_adapter *adapter);
+#endif
 
 #ifdef CONFIG_NET_POLL_CONTROLLER
 /* for netdump / net console */
@@ -233,7 +235,9 @@ ixgb_up(struct ixgb_adapter *adapter)
 
 	ixgb_set_multi(netdev);
 
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 	ixgb_restore_vlan(adapter);
+#endif
 
 	ixgb_configure_tx(adapter);
 	ixgb_setup_rctl(adapter);
@@ -419,9 +423,11 @@ ixgb_probe(struct pci_dev *pdev,
 	netdev->poll = &ixgb_clean;
 	netdev->weight = 64;
 #endif
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 	netdev->vlan_rx_register = ixgb_vlan_rx_register;
 	netdev->vlan_rx_add_vid = ixgb_vlan_rx_add_vid;
 	netdev->vlan_rx_kill_vid = ixgb_vlan_rx_kill_vid;
+#endif
 #ifdef CONFIG_NET_POLL_CONTROLLER
 	netdev->poll_controller = ixgb_netpoll;
 #endif
@@ -1398,10 +1404,12 @@ ixgb_xmit_frame(struct sk_buff *skb, str
 	}
 	spin_unlock_irqrestore(&adapter->tx_lock, flags);
 
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 	if(adapter->vlgrp && vlan_tx_tag_present(skb)) {
 		tx_flags |= IXGB_TX_FLAGS_VLAN;
 		vlan_id = vlan_tx_tag_get(skb);
 	}
+#endif
 
 	first = adapter->tx_ring.next_to_use;
 	
@@ -1905,21 +1913,23 @@ ixgb_clean_rx_irq(struct ixgb_adapter *a
 
 		skb->protocol = eth_type_trans(skb, netdev);
 #ifdef CONFIG_IXGB_NAPI
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 		if(adapter->vlgrp && (status & IXGB_RX_DESC_STATUS_VP)) {
 			vlan_hwaccel_receive_skb(skb, adapter->vlgrp,
 				le16_to_cpu(rx_desc->special) &
 					IXGB_RX_DESC_SPECIAL_VLAN_MASK);
-		} else {
+		} else
+#endif
 			netif_receive_skb(skb);
-		}
 #else /* CONFIG_IXGB_NAPI */
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 		if(adapter->vlgrp && (status & IXGB_RX_DESC_STATUS_VP)) {
 			vlan_hwaccel_rx(skb, adapter->vlgrp,
 				le16_to_cpu(rx_desc->special) &
 					IXGB_RX_DESC_SPECIAL_VLAN_MASK);
-		} else {
+		} else
+#endif
 			netif_rx(skb);
-		}
 #endif /* CONFIG_IXGB_NAPI */
 		netdev->last_rx = jiffies;
 
@@ -2014,6 +2024,7 @@ ixgb_alloc_rx_buffers(struct ixgb_adapte
 	rx_ring->next_to_use = i;
 }
 
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 /**
  * ixgb_vlan_rx_register - enables or disables vlan tagging/stripping.
  * 
@@ -2107,6 +2118,7 @@ ixgb_restore_vlan(struct ixgb_adapter *a
 		}
 	}
 }
+#endif /* defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) */
 
 #ifdef CONFIG_NET_POLL_CONTROLLER
 /*
diff -urpN linux-2.6.16.org/drivers/net/s2io.c linux-2.6.16.vlan/drivers/net/s2io.c
--- linux-2.6.16.org/drivers/net/s2io.c	Mon Mar 20 07:53:29 2006
+++ linux-2.6.16.vlan/drivers/net/s2io.c	Tue Apr 11 10:15:59 2006
@@ -182,6 +182,7 @@ static char ethtool_stats_keys[][ETH_GST
 			timer.data = (unsigned long) arg;	\
 			mod_timer(&timer, (jiffies + exp))	\
 
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 /* Add the vlan */
 static void s2io_vlan_rx_register(struct net_device *dev,
 					struct vlan_group *grp)
@@ -205,6 +206,7 @@ static void s2io_vlan_rx_kill_vid(struct
 		nic->vlgrp->vlan_devices[vid] = NULL;
 	spin_unlock_irqrestore(&nic->tx_lock, flags);
 }
+#endif
 
 /*
  * Constants to be programmed into the Xena's registers, to configure
@@ -3469,8 +3471,10 @@ static int s2io_xmit(struct sk_buff *skb
 #ifdef NETIF_F_TSO
 	int mss;
 #endif
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 	u16 vlan_tag = 0;
 	int vlan_priority = 0;
+#endif
 	mac_info_t *mac_control;
 	struct config_param *config;
 
@@ -3489,12 +3493,14 @@ static int s2io_xmit(struct sk_buff *skb
 
 	queue = 0;
 
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 	/* Get Fifo number to Transmit based on vlan priority */
 	if (sp->vlgrp && vlan_tx_tag_present(skb)) {
 		vlan_tag = vlan_tx_tag_get(skb);
 		vlan_priority = vlan_tag >> 13;
 		queue = config->fifo_mapping[vlan_priority];
 	}
+#endif
 
 	put_off = (u16) mac_control->fifos[queue].tx_curr_put_info.offset;
 	get_off = (u16) mac_control->fifos[queue].tx_curr_get_info.offset;
@@ -3537,10 +3543,12 @@ static int s2io_xmit(struct sk_buff *skb
 	txdp->Control_1 |= TXD_LIST_OWN_XENA;
 	txdp->Control_2 |= config->tx_intr_type;
 
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 	if (sp->vlgrp && vlan_tx_tag_present(skb)) {
 		txdp->Control_2 |= TXD_VLAN_ENABLE;
 		txdp->Control_2 |= TXD_VLAN_TAG(vlan_tag);
 	}
+#endif
 
 	frg_len = skb->len - skb->data_len;
 	if (skb_shinfo(skb)->ufo_size) {
@@ -5680,21 +5688,23 @@ static int rx_osm_handler(ring_info_t *r
 
 	skb->protocol = eth_type_trans(skb, dev);
 #ifdef CONFIG_S2IO_NAPI
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 	if (sp->vlgrp && RXD_GET_VLAN_TAG(rxdp->Control_2)) {
 		/* Queueing the vlan frame to the upper layer */
 		vlan_hwaccel_receive_skb(skb, sp->vlgrp,
 			RXD_GET_VLAN_TAG(rxdp->Control_2));
-	} else {
+	} else
+#endif
 		netif_receive_skb(skb);
-	}
 #else
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 	if (sp->vlgrp && RXD_GET_VLAN_TAG(rxdp->Control_2)) {
 		/* Queueing the vlan frame to the upper layer */
 		vlan_hwaccel_rx(skb, sp->vlgrp,
 			RXD_GET_VLAN_TAG(rxdp->Control_2));
-	} else {
+	} else
+#endif
 		netif_rx(skb);
-	}
 #endif
 	dev->last_rx = jiffies;
 	atomic_dec(&sp->rx_bufs_left[ring_no]);
@@ -6051,9 +6061,11 @@ Defaulting to INTA\n");
 	dev->do_ioctl = &s2io_ioctl;
 	dev->change_mtu = &s2io_change_mtu;
 	SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 	dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
 	dev->vlan_rx_register = s2io_vlan_rx_register;
 	dev->vlan_rx_kill_vid = (void *)s2io_vlan_rx_kill_vid;
+#endif
 
 	/*
 	 * will use eth_mac_addr() for  dev->set_mac_address
diff -urpN linux-2.6.16.org/drivers/net/s2io.h linux-2.6.16.vlan/drivers/net/s2io.h
--- linux-2.6.16.org/drivers/net/s2io.h	Mon Mar 20 07:53:29 2006
+++ linux-2.6.16.vlan/drivers/net/s2io.h	Tue Apr 11 10:15:59 2006
@@ -771,7 +771,9 @@ struct s2io_nic {
 #define CARD_UP 2
 	atomic_t card_state;
 	volatile unsigned long link_state;
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 	struct vlan_group *vlgrp;
+#endif
 #define MSIX_FLG                0xA5
 	struct msix_entry *entries;
 	struct s2io_msix_entry *s2io_entries;
diff -urpN linux-2.6.16.org/drivers/net/typhoon.c linux-2.6.16.vlan/drivers/net/typhoon.c
--- linux-2.6.16.org/drivers/net/typhoon.c	Mon Mar 20 07:53:29 2006
+++ linux-2.6.16.vlan/drivers/net/typhoon.c	Tue Apr 11 10:21:19 2006
@@ -285,7 +285,9 @@ struct typhoon {
 	struct pci_dev *	pdev;
 	struct net_device *	dev;
 	spinlock_t		state_lock;
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 	struct vlan_group *	vlgrp;
+#endif
 	struct basic_ring	rxHiRing;
 	struct basic_ring	rxBuffRing;
 	struct rxbuff_ent	rxbuffers[RXENT_ENTRIES];
@@ -707,6 +709,7 @@ out:
 	return err;
 }
 
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 static void
 typhoon_vlan_rx_register(struct net_device *dev, struct vlan_group *grp)
 {
@@ -754,6 +757,7 @@ typhoon_vlan_rx_kill_vid(struct net_devi
 		tp->vlgrp->vlan_devices[vid] = NULL;
 	spin_unlock_bh(&tp->state_lock);
 }
+#endif
 
 static inline void
 typhoon_tso_fill(struct sk_buff *skb, struct transmit_ring *txRing,
@@ -837,6 +841,7 @@ typhoon_start_tx(struct sk_buff *skb, st
 		first_txd->processFlags |= TYPHOON_TX_PF_IP_CHKSUM;
 	}
 
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 	if(vlan_tx_tag_present(skb)) {
 		first_txd->processFlags |=
 		    TYPHOON_TX_PF_INSERT_VLAN | TYPHOON_TX_PF_VLAN_PRIORITY;
@@ -844,6 +849,7 @@ typhoon_start_tx(struct sk_buff *skb, st
 		    cpu_to_le32(htons(vlan_tx_tag_get(skb)) <<
 				TYPHOON_TX_PF_VLAN_TAG_SHIFT);
 	}
+#endif
 
 	if(skb_tso_size(skb)) {
 		first_txd->processFlags |= TYPHOON_TX_PF_TCP_SEGMENT;
@@ -1744,13 +1750,15 @@ typhoon_rx(struct typhoon *tp, struct ba
 		} else
 			new_skb->ip_summed = CHECKSUM_NONE;
 
-		spin_lock(&tp->state_lock);
-		if(tp->vlgrp != NULL && rx->rxStatus & TYPHOON_RX_VLAN)
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
+		if(tp->vlgrp != NULL && rx->rxStatus & TYPHOON_RX_VLAN) {
+			spin_lock(&tp->state_lock);
 			vlan_hwaccel_receive_skb(new_skb, tp->vlgrp,
 						 ntohl(rx->vlanTag) & 0xffff);
-		else
+			spin_unlock(&tp->state_lock);
+		} else
+#endif
 			netif_receive_skb(new_skb);
-		spin_unlock(&tp->state_lock);
 
 		tp->dev->last_rx = jiffies;
 		received++;
@@ -2232,6 +2240,7 @@ typhoon_suspend(struct pci_dev *pdev, pm
 	if(!netif_running(dev))
 		return 0;
 
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 	spin_lock_bh(&tp->state_lock);
 	if(tp->vlgrp && tp->wol_events & TYPHOON_WAKE_MAGIC_PKT) {
 		spin_unlock_bh(&tp->state_lock);
@@ -2240,6 +2249,7 @@ typhoon_suspend(struct pci_dev *pdev, pm
 		return -EBUSY;
 	}
 	spin_unlock_bh(&tp->state_lock);
+#endif
 
 	netif_device_detach(dev);
 
@@ -2549,8 +2559,10 @@ typhoon_init_one(struct pci_dev *pdev, c
 	dev->watchdog_timeo	= TX_TIMEOUT;
 	dev->get_stats		= typhoon_get_stats;
 	dev->set_mac_address	= typhoon_set_mac_address;
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 	dev->vlan_rx_register	= typhoon_vlan_rx_register;
 	dev->vlan_rx_kill_vid	= typhoon_vlan_rx_kill_vid;
+#endif
 	SET_ETHTOOL_OPS(dev, &typhoon_ethtool_ops);
 
 	/* We can handle scatter gather, up to 16 entries, and

^ permalink raw reply

* Re: [PATCH] deinline a few large functions in vlan code v2
From: Denis Vlasenko @ 2006-04-11  7:28 UTC (permalink / raw)
  To: Dave Dillow, netdev; +Cc: David S. Miller, linux-kernel, jgarzik
In-Reply-To: <1144682807.12177.22.camel@dillow.idleaire.com>

> > > > block? For example, typhoon.c:
> > > > 
> > > >                 spin_lock(&tp->state_lock);
> > > > +#if defined(CONFIG_VLAN_8021Q) || defined (CONFIG_VLAN_8021Q_MODULE)
> > > >                 if(tp->vlgrp != NULL && rx->rxStatus & TYPHOON_RX_VLAN)
> > > >                         vlan_hwaccel_receive_skb(new_skb, tp->vlgrp,
> > > >                                                  ntohl(rx->vlanTag) & 0xffff);
> > > >                 else
> > > > +#endif
> > > >                         netif_receive_skb(new_skb);
> > > >                 spin_unlock(&tp->state_lock);
> > > > 
> > > > Same for s2io.c, chelsio/sge.c, etc...
> > > 
> > > Very likely yes.  tp->vlgrp will never be non-NULL in such situations
> > > so it's not a correctness issue, but rather an optimization :-)
> 
> I see this as a minor optimization, at the cost uglifying the body of a
> function.

But it saves some text (~5k total in all network drivers)
and removes a branch on rx path on non-VLAN enabled kernels...

> Besides, if you're going to do this, you can get rid of the 
> spin_lock functions around it to, since they only protect tp->vlgrp in
> this instance.

Done.

> Please don't apply this to typhoon.c

Please comment on the below patch fragment, is it ok with you?

diff -urpN linux-2.6.16.org/drivers/net/typhoon.c linux-2.6.16.vlan/drivers/net/typhoon.c
--- linux-2.6.16.org/drivers/net/typhoon.c	Mon Mar 20 07:53:29 2006
+++ linux-2.6.16.vlan/drivers/net/typhoon.c	Tue Apr 11 10:21:19 2006
@@ -285,7 +285,9 @@ struct typhoon {
 	struct pci_dev *	pdev;
 	struct net_device *	dev;
 	spinlock_t		state_lock;
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 	struct vlan_group *	vlgrp;
+#endif
 	struct basic_ring	rxHiRing;
 	struct basic_ring	rxBuffRing;
 	struct rxbuff_ent	rxbuffers[RXENT_ENTRIES];
@@ -707,6 +709,7 @@ out:
 	return err;
 }
 
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 static void
 typhoon_vlan_rx_register(struct net_device *dev, struct vlan_group *grp)
 {
@@ -754,6 +757,7 @@ typhoon_vlan_rx_kill_vid(struct net_devi
 		tp->vlgrp->vlan_devices[vid] = NULL;
 	spin_unlock_bh(&tp->state_lock);
 }
+#endif
 
 static inline void
 typhoon_tso_fill(struct sk_buff *skb, struct transmit_ring *txRing,
@@ -837,6 +841,7 @@ typhoon_start_tx(struct sk_buff *skb, st
 		first_txd->processFlags |= TYPHOON_TX_PF_IP_CHKSUM;
 	}
 
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 	if(vlan_tx_tag_present(skb)) {
 		first_txd->processFlags |=
 		    TYPHOON_TX_PF_INSERT_VLAN | TYPHOON_TX_PF_VLAN_PRIORITY;
@@ -844,6 +849,7 @@ typhoon_start_tx(struct sk_buff *skb, st
 		    cpu_to_le32(htons(vlan_tx_tag_get(skb)) <<
 				TYPHOON_TX_PF_VLAN_TAG_SHIFT);
 	}
+#endif
 
 	if(skb_tso_size(skb)) {
 		first_txd->processFlags |= TYPHOON_TX_PF_TCP_SEGMENT;
@@ -1744,13 +1750,15 @@ typhoon_rx(struct typhoon *tp, struct ba
 		} else
 			new_skb->ip_summed = CHECKSUM_NONE;
 
-		spin_lock(&tp->state_lock);
-		if(tp->vlgrp != NULL && rx->rxStatus & TYPHOON_RX_VLAN)
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
+		if(tp->vlgrp != NULL && rx->rxStatus & TYPHOON_RX_VLAN) {
+			spin_lock(&tp->state_lock);
 			vlan_hwaccel_receive_skb(new_skb, tp->vlgrp,
 						 ntohl(rx->vlanTag) & 0xffff);
-		else
+			spin_unlock(&tp->state_lock);
+		} else
+#endif
 			netif_receive_skb(new_skb);
-		spin_unlock(&tp->state_lock);
 
 		tp->dev->last_rx = jiffies;
 		received++;
@@ -2232,6 +2240,7 @@ typhoon_suspend(struct pci_dev *pdev, pm
 	if(!netif_running(dev))
 		return 0;
 
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 	spin_lock_bh(&tp->state_lock);
 	if(tp->vlgrp && tp->wol_events & TYPHOON_WAKE_MAGIC_PKT) {
 		spin_unlock_bh(&tp->state_lock);
@@ -2240,6 +2249,7 @@ typhoon_suspend(struct pci_dev *pdev, pm
 		return -EBUSY;
 	}
 	spin_unlock_bh(&tp->state_lock);
+#endif
 
 	netif_device_detach(dev);
 
@@ -2549,8 +2559,10 @@ typhoon_init_one(struct pci_dev *pdev, c
 	dev->watchdog_timeo	= TX_TIMEOUT;
 	dev->get_stats		= typhoon_get_stats;
 	dev->set_mac_address	= typhoon_set_mac_address;
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 	dev->vlan_rx_register	= typhoon_vlan_rx_register;
 	dev->vlan_rx_kill_vid	= typhoon_vlan_rx_kill_vid;
+#endif
 	SET_ETHTOOL_OPS(dev, &typhoon_ethtool_ops);
 
 	/* We can handle scatter gather, up to 16 entries, and

--
vda

^ permalink raw reply

* Re: [PATCH] IrDA: smcinit merged into smsc-ircc driver
From: Meelis Roos @ 2006-04-11  6:53 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Samuel Ortiz, netdev-u79uwXL29TY76Z2rM5mHXA,
	irda-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
In-Reply-To: <Pine.GSO.4.60.0604110841130.6504-fcPyB2Jy8d0vOS8lKHy7yQ@public.gmane.org>

>> Detected unconfigured Toshiba Satellite 1800 SMSC IrDA chip, 
>> pre-configuring device.
>> SORRY: Toshiba Satellite 1800 has an unsupported bridge controller (ALi): 
>> not pre-configured.
>> smsc-ircc2, Preconfiguration failed !
>
> Yep we don't have support for ALi bridges yet, the Toshiba 1800 still needs 
> tosh1800 smcinit. But if you're willing to test, I can make a try to create a 
> 1800-compliant ALi initializer implementation out of the blue...

I am willing to test patches.

-- 
Meelis Roos (mroos-Y27EyoLml9s@public.gmane.org)


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642

^ permalink raw reply

* Re: [PATCH] IrDA: smcinit merged into smsc-ircc driver
From: Linus Walleij @ 2006-04-11  6:43 UTC (permalink / raw)
  To: Meelis Roos
  Cc: Samuel Ortiz, netdev-u79uwXL29TY76Z2rM5mHXA,
	irda-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
In-Reply-To: <20060411040958.5B27913D8B-dsJFIBXIhhr8IXOVGmnxQA@public.gmane.org>

On Tue, 11 Apr 2006, Meelis Roos wrote:

> Detected unconfigured Toshiba Satellite 1800 SMSC IrDA chip, pre-configuring device.
> SORRY: Toshiba Satellite 1800 has an unsupported bridge controller (ALi): not pre-configured.
> smsc-ircc2, Preconfiguration failed !

Yep we don't have support for ALi bridges yet, the Toshiba 1800 still 
needs tosh1800 smcinit. But if you're willing to test, I can make a try to 
create a 1800-compliant ALi initializer implementation out of the blue...

Linus


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642

^ permalink raw reply

* Re: bcm43xx symbol clash problems
From: Johannes Berg @ 2006-04-11  6:39 UTC (permalink / raw)
  To: Michael Buesch
  Cc: linville-2XuSBdqkA4R54TAoqtyWWQ, netdev-u79uwXL29TY76Z2rM5mHXA,
	bcm43xx-dev-0fE9KPoRgkgATYTw5x5z8w
In-Reply-To: <200604100216.21571.mb-fseUSCV1ubazQB+pC5nmwQ@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 637 bytes --]

On Mon, 2006-04-10 at 02:16 +0200, Michael Buesch wrote:
> Does kbuild perhaps have some magic to handle that?
> 
> This needs to be solved soon, but I have no idea how.

You want to have bcm43xx and bcm43xx-dscape conflict anyway, since
there's no point in building both into the kernel, only one can be bound
to a device. Yes, I know one could still bind them manually, but that's
about as icky as building them as modules imho. And whoever really needs
a static kernel will not need both of them.

I don't know how the Kconfig there is laid out, but wouldn't it be
possible to make them conflict on both yes?

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 793 bytes --]

^ permalink raw reply

* Re: [RFC/PATCH] remove unneeded check in bcm43xx
From: David S. Miller @ 2006-04-11  5:49 UTC (permalink / raw)
  To: benh; +Cc: benoit.boissinot, mb, netdev, bcm43xx-dev, linux-kernel, linville
In-Reply-To: <1144719972.19353.24.camel@localhost.localdomain>

From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Date: Tue, 11 Apr 2006 11:46:12 +1000

> But ppc64 hits the problem and at this point, there is nothing
> I can do other than either implementing a split zone allocation mecanism
> in the ppc64 architecture for the sole sake of bcm43xx (ick !) or doing
> some trick with the iommu...

I think allowing DMA mask range limiting in the IOMMU layer is going
to set a very bad precedence, just don't do it.

It's 2006, we should be way past the era of not putting the full 32
PCI DMA address bits in devices.  In this day and age it is simply
inexscusable.

Maybe we could understand chips coming out 8 years ago when a lot of
designs were transitioning from ISA to PCI, but that no longer applies
in any way today.

^ permalink raw reply

* Re: [RFC/PATCH] remove unneeded check in bcm43xx
From: Benoit Boissinot @ 2006-04-11  2:23 UTC (permalink / raw)
  To: Michael Buesch
  Cc: Benjamin Herrenschmidt, netdev, bcm43xx-dev, linux-kernel,
	linville
In-Reply-To: <200604110353.52067.mb@bu3sch.de>

On Tue, Apr 11, 2006 at 03:53:51AM +0200, Michael Buesch wrote:
> On Tuesday 11 April 2006 03:46, you wrote:
> > 
> > 
> > Now, for ppc32, it should still sort-of work because all of lowmem is
> > below 1Gb and people generally don't hack their lowmem size (well, I do
> > but heh, that doesn't count :) and I don't think you'll get skb's in
> > highmem. But ppc64 hits the problem and at this point, there is nothing
> > I can do other than either implementing a split zone allocation mecanism
> > in the ppc64 architecture
> 
> > for the sole sake of bcm43xx (ick !)
> 
> Nope. For every broadcom device, which has this stupid DMA engine.
> That is b44 and bcm43xx, as far as I can tell. But likely there are more.

On the other hand, bcm43xx looks very common with apple hardware, so there
are probably a lot of users who cannot use their wifi card in G5's.

regards,

Benoit
-- 
powered by bash/screen/(urxvt/fvwm|linux-console)/gentoo/gnu/linux OS

^ permalink raw reply

* Re: [RFC/PATCH] remove unneeded check in bcm43xx
From: Michael Buesch @ 2006-04-11  1:53 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA, bcm43xx-dev-0fE9KPoRgkgATYTw5x5z8w,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linville-2XuSBdqkA4R54TAoqtyWWQ, Benoit Boissinot
In-Reply-To: <1144719972.19353.24.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>

On Tuesday 11 April 2006 03:46, you wrote:
> 
> > Yes, I know they hit the message, that's from a message in some forum
> > that i got interested in the issue. It probably comes from an allocation
> > from:
> > http://www.linux-m32r.org/lxr/http/source/arch/powerpc/kernel/pci_direct_iommu.c#L32
> > 
> > Either the ppc code is wrong (it doesn't enforce dma_mask) either the
> > driver still works without the check.
> > 
> > Maybe ppc should do the same thing as i386:
> > 
> > 47         if (dev == NULL || (dev->coherent_dma_mask < 0xffffffff))
> > 48                 gfp |= GFP_DMA;
> 
> PPC doesn't have a ZONE_DMA... PPC assumes that the whole memory is
> DMA'able... What happens here is that it works by "chance" on x86 ;)
> ZONE_DMA is a thing of the past that represents ISA DMA (below 16M iirc
> or something like that). Thus x86 historically maintained a separate
> allocation zone down there for ISA devices. What happens here is that
> the x86 code sort-of detects that the DMA mask isn't the full 32 bits
> and kicks everything down into ZONE_DMA. Makes things work, though the
> pressure on ZONE_DMA can often be high enough that you'll have a lot of
> failed allocations ...
> 
> PPC doesn't have ZONE_DMA, thus can't provide memory guaranteed to be
> below that limit.
> 
> Now, for ppc32, it should still sort-of work because all of lowmem is
> below 1Gb and people generally don't hack their lowmem size (well, I do
> but heh, that doesn't count :) and I don't think you'll get skb's in
> highmem. But ppc64 hits the problem and at this point, there is nothing
> I can do other than either implementing a split zone allocation mecanism
> in the ppc64 architecture

> for the sole sake of bcm43xx (ick !)

Nope. For every broadcom device, which has this stupid DMA engine.
That is b44 and bcm43xx, as far as I can tell. But likely there are more.

> or doing some trick with the iommu...

-- 
Greetings Michael.

^ permalink raw reply

* Re: [RFC/PATCH] remove unneeded check in bcm43xx
From: Benjamin Herrenschmidt @ 2006-04-11  1:47 UTC (permalink / raw)
  To: Benoit Boissinot; +Cc: Michael Buesch, netdev, bcm43xx-dev, linux-kernel
In-Reply-To: <20060410221359.GC27596@ens-lyon.fr>


> The hacks i see there is reallocating a buffer with GFP_DMA, so that
> means that if the ppc dma_alloc_coherent did the same thing as the i386
> counterpart (adding GFP_DMA if dma_mask is less than 32bits) it should
> work, no ?

Except that GFP_DMA covers the whole address space on ppc64...

Ben.

^ permalink raw reply

* Re: [RFC/PATCH] remove unneeded check in bcm43xx
From: Benjamin Herrenschmidt @ 2006-04-11  1:46 UTC (permalink / raw)
  To: Benoit Boissinot
  Cc: Michael Buesch, netdev, bcm43xx-dev, linux-kernel, linville
In-Reply-To: <20060410042228.GN27596@ens-lyon.fr>


> Yes, I know they hit the message, that's from a message in some forum
> that i got interested in the issue. It probably comes from an allocation
> from:
> http://www.linux-m32r.org/lxr/http/source/arch/powerpc/kernel/pci_direct_iommu.c#L32
> 
> Either the ppc code is wrong (it doesn't enforce dma_mask) either the
> driver still works without the check.
> 
> Maybe ppc should do the same thing as i386:
> 
> 47         if (dev == NULL || (dev->coherent_dma_mask < 0xffffffff))
> 48                 gfp |= GFP_DMA;

PPC doesn't have a ZONE_DMA... PPC assumes that the whole memory is
DMA'able... What happens here is that it works by "chance" on x86 ;)
ZONE_DMA is a thing of the past that represents ISA DMA (below 16M iirc
or something like that). Thus x86 historically maintained a separate
allocation zone down there for ISA devices. What happens here is that
the x86 code sort-of detects that the DMA mask isn't the full 32 bits
and kicks everything down into ZONE_DMA. Makes things work, though the
pressure on ZONE_DMA can often be high enough that you'll have a lot of
failed allocations ...

PPC doesn't have ZONE_DMA, thus can't provide memory guaranteed to be
below that limit.

Now, for ppc32, it should still sort-of work because all of lowmem is
below 1Gb and people generally don't hack their lowmem size (well, I do
but heh, that doesn't count :) and I don't think you'll get skb's in
highmem. But ppc64 hits the problem and at this point, there is nothing
I can do other than either implementing a split zone allocation mecanism
in the ppc64 architecture for the sole sake of bcm43xx (ick !) or doing
some trick with the iommu...

Ben.

^ permalink raw reply

* Re: [RFC/PATCH] remove unneeded check in bcm43xx
From: David S. Miller @ 2006-04-10 22:28 UTC (permalink / raw)
  To: benoit.boissinot; +Cc: mb, netdev, bcm43xx-dev, linux-kernel, benh
In-Reply-To: <20060410221359.GC27596@ens-lyon.fr>

From: Benoit Boissinot <benoit.boissinot@ens-lyon.org>
Date: Tue, 11 Apr 2006 00:13:59 +0200

> On Mon, Apr 10, 2006 at 09:46:30AM -0400, John W. Linville wrote:
> > On Mon, Apr 10, 2006 at 06:28:00AM +0200, Michael Buesch wrote:
> > 
> > > To summerize: I actually added these messages, because people were
> > > hitting "this does not work with >1G" issues and did not get an error message.
> > > So I decided to insert warnings until the issue is fixed inside the arch code.
> > > I will remove them once the issue is fixed.
> > 
> > This sounds like the same sort of problems w/ the b44 driver.
> > I surmise that both use the same (broken) DMA engine from Broadcom.
> > 
> > Unfortunately, I don't know of any good solution to this.  There are
> > a few hacks in b44 that deal with the issue.  I don't like them,
> > although I am the perpetrator of at least one of them.  It might be
> > worth looking at what was done there?
> 
> The hacks i see there is reallocating a buffer with GFP_DMA, so that
> means that if the ppc dma_alloc_coherent did the same thing as the i386
> counterpart (adding GFP_DMA if dma_mask is less than 32bits) it should
> work, no ?

PowerPC doesn't have a seperate GFP_DMA page pool, so this won't work.

^ permalink raw reply

* Re: [RFC/PATCH] remove unneeded check in bcm43xx
From: Benoit Boissinot @ 2006-04-10 22:13 UTC (permalink / raw)
  To: Michael Buesch, netdev, bcm43xx-dev, linux-kernel, benh
In-Reply-To: <20060410134625.GA25360@tuxdriver.com>

On Mon, Apr 10, 2006 at 09:46:30AM -0400, John W. Linville wrote:
> On Mon, Apr 10, 2006 at 06:28:00AM +0200, Michael Buesch wrote:
> 
> > To summerize: I actually added these messages, because people were
> > hitting "this does not work with >1G" issues and did not get an error message.
> > So I decided to insert warnings until the issue is fixed inside the arch code.
> > I will remove them once the issue is fixed.
> 
> This sounds like the same sort of problems w/ the b44 driver.
> I surmise that both use the same (broken) DMA engine from Broadcom.
> 
> Unfortunately, I don't know of any good solution to this.  There are
> a few hacks in b44 that deal with the issue.  I don't like them,
> although I am the perpetrator of at least one of them.  It might be
> worth looking at what was done there?

The hacks i see there is reallocating a buffer with GFP_DMA, so that
means that if the ppc dma_alloc_coherent did the same thing as the i386
counterpart (adding GFP_DMA if dma_mask is less than 32bits) it should
work, no ?

regards,

Benoit

ps: i do not have the hardware so i sadly cannot test.

-- 
powered by bash/screen/(urxvt/fvwm|linux-console)/gentoo/gnu/linux OS

^ permalink raw reply

* Re: [RFC/PATCH] remove unneeded check in bcm43xx
From: Arjan van de Ven @ 2006-04-10 16:18 UTC (permalink / raw)
  To: John W. Linville
  Cc: Michael Buesch, Benoit Boissinot, netdev, bcm43xx-dev,
	linux-kernel, benh
In-Reply-To: <20060410134625.GA25360@tuxdriver.com>

On Mon, 2006-04-10 at 09:46 -0400, John W. Linville wrote:
> On Mon, Apr 10, 2006 at 06:28:00AM +0200, Michael Buesch wrote:
> 
> > To summerize: I actually added these messages, because people were
> > hitting "this does not work with >1G" issues and did not get an error message.
> > So I decided to insert warnings until the issue is fixed inside the arch code.
> > I will remove them once the issue is fixed.
> 
> This sounds like the same sort of problems w/ the b44 driver.
> I surmise that both use the same (broken) DMA engine from Broadcom.
> 
> Unfortunately, I don't know of any good solution to this.  There are
> a few hacks in b44 that deal with the issue.  I don't like them,
> although I am the perpetrator of at least one of them.  It might be
> worth looking at what was done there?

or as better solution we should give i386 the swiommu code from
x86-64 ;)

^ permalink raw reply

* Re: [RFC/PATCH] remove unneeded check in bcm43xx
From: John W. Linville @ 2006-04-10 13:46 UTC (permalink / raw)
  To: Michael Buesch; +Cc: Benoit Boissinot, netdev, bcm43xx-dev, linux-kernel, benh
In-Reply-To: <200604100628.01483.mb@bu3sch.de>

On Mon, Apr 10, 2006 at 06:28:00AM +0200, Michael Buesch wrote:

> To summerize: I actually added these messages, because people were
> hitting "this does not work with >1G" issues and did not get an error message.
> So I decided to insert warnings until the issue is fixed inside the arch code.
> I will remove them once the issue is fixed.

This sounds like the same sort of problems w/ the b44 driver.
I surmise that both use the same (broken) DMA engine from Broadcom.

Unfortunately, I don't know of any good solution to this.  There are
a few hacks in b44 that deal with the issue.  I don't like them,
although I am the perpetrator of at least one of them.  It might be
worth looking at what was done there?

YMMV...

John
-- 
John W. Linville
linville@tuxdriver.com

^ permalink raw reply

* Re: [Bugme-new] [Bug 6349] New: iptables DNAT returns unknown error 4294967295
From: David S. Miller @ 2006-04-10  5:39 UTC (permalink / raw)
  To: kaber; +Cc: dmb, akpm, netfilter-devel, netdev
In-Reply-To: <4437A552.902@trash.net>

From: Patrick McHardy <kaber@trash.net>
Date: Sat, 08 Apr 2006 13:58:10 +0200

> Patrick McHardy wrote:
> > Please try if this patch helps.
> > 
> > +	.hooks		= 1 << NF_IP_PRE_ROUTING || 1 << NF_IP_LOCAL_OUT,
> 
> I shouldn't send patches before getting out of bed .. :)
> 
> Please try this one instead.

I'm applying this to my tree.

If it's wrong for some reason, we still have time in the 2.6.17-X
devel cycle to correct it.

^ permalink raw reply

* Re: [2.6 patch] drivers/char/random.c: unexport secure_ipv6_port_ephemeral
From: David S. Miller @ 2006-04-10  5:29 UTC (permalink / raw)
  To: bunk; +Cc: akpm, mpm, linux-kernel, netdev
In-Reply-To: <20060409155822.GI8454@stusta.de>

From: Adrian Bunk <bunk@stusta.de>
Date: Sun, 9 Apr 2006 17:58:22 +0200

> This patch removes the unused EXPORT_SYMBOL(secure_ipv6_port_ephemeral).
> 
> Signed-off-by: Adrian Bunk <bunk@stusta.de>

Applied, thanks Adrian.

^ permalink raw reply

* Re: 2.4.32: unresolved symbol unregister_qdisc
From: George P Nychis @ 2006-04-10  5:03 UTC (permalink / raw)
  To: Randy.Dunlap; +Cc: linux-kernel, netdev
In-Reply-To: <20060409202912.22d496e7.rdunlap@xenotime.net>


> On Sun, 9 Apr 2006 23:20:01 -0400 (EDT) George P Nychis wrote:
> 
>> 
>>> On Sun, 9 Apr 2006 22:49:50 -0400 (EDT) George P Nychis wrote:
>>> 
>>>> 
>>>>> On Sun, 9 Apr 2006 22:05:33 -0400 (EDT) George P Nychis wrote:
>>>>> 
>>>>>> 
>>>>>>> On Sun, 9 Apr 2006 13:37:25 -0400 (EDT) George P Nychis
>>>>>>> wrote:
>>>>>>> 
>>>>>>>> Thanks for the help.
>>>>>>>> 
>>>>>>>> Here is the makefile: 
>>>>>>>> http://rafb.net/paste/results/auchPH75.html
>>>>>>>> 
>>>>>>>> And here is the full errors I receive: 
>>>>>>>> http://rafb.net/paste/results/Qplpqw74.html
>>>>>>>> 
>>>>>>>> Greatly appreciate it
>>>>>>>> 
>>>>>>>> - George
>>>>>>> 
>>>>>>> [repeat: please don't top-post]
>>>>>>> 
>>>>>>> I don't know how much I can help you.  It's been a long time 
>>>>>>> since I've built external modules on 2.4.x.
>>>>>>> 
>>>>>>> Problems that I see: - the Makefile does not use the expected
>>>>>>> 2.4 kernel build infrastructure; - kernel Makefile uses
>>>>>>> -nostdinc to prevent use of userspace headers; - Makefile is
>>>>>>> trying to include userspace headers instead of kernel headers,
>>>>>>> e.g.: In file included from /usr/include/linux/if_ether.h:107,
>>>>>>> from /usr/include/linux/netdevice.h:29, from sch_xcp.c:8: -
>>>>>>> this specified include directory is only in 2.6.x, not 2.4.x: 
>>>>>>> -I/lib/modules/`uname -r`/build/include/asm/mach-default
>>>>>>> 
>>>>>>> It's not clear to me how this makefile could work with 2.4.x
>>>>>>> at all. Is it supposed to, or that's just what you want to see
>>>>>>> it do?
>>>>>>> 
>>>>>>> 
>>>>>>> You could try to fix the Makefile based on makefile-changes 
>>>>>>> articles at lwn.net. E.g.: http://lwn.net/Articles/151784/ 
>>>>>>> http://lwn.net/Articles/79984/ http://lwn.net/Articles/74767/
>>>>>>>  http://lwn.net/Articles/69148/
>>>>>>> http://lwn.net/Articles/21823/
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>>>> On Sat, 8 Apr 2006 19:18:47 -0400 (EDT) George P Nychis 
>>>>>>>>> wrote:
>>>>>>>>> 
>>>>>>>>>> Yeah, this module is unfortunately not under the GPL,
>>>>>>>>>> it was made for research and i am not the author, I was
>>>>>>>>>> only given the code for my own research.
>>>>>>>>>> 
>>>>>>>>>> I enabled that support in the kernel, and then tried to
>>>>>>>>>>  recompile and get tons of errors/warnings... so maybe
>>>>>>>>>> I am missing something else to be enabled in the
>>>>>>>>>> kernel... here are a few examples of errors: 
>>>>>>>>>> /usr/include/linux/skbuff.h:30:26: net/checksum.h: No
>>>>>>>>>> such file or directory /usr/include/asm/irq.h:16:25: 
>>>>>>>>>> irq_vectors.h: No such file or directory 
>>>>>>>>>> /usr/include/linux/irq.h:72: error: `NR_IRQS'
>>>>>>>>>> undeclared here (not in a function)
>>>>>>>>>> /usr/include/asm/hw_irq.h:28: error: `NR_IRQ_VECTORS'
>>>>>>>>>> undeclared here (not in a function)
>>>>>>>>>> 
>>>>>>>>>> I think those are the top most errors, so if i can fix 
>>>>>>>>>> those hopefully the rest shall vanish!
>>>>>>>>> 
>>>>>>>>> Looks like a Makefile problem then.  Can you post the 
>>>>>>>>> Makefile? Hopefully it is using a Makefile and not just
>>>>>>>>> an elaborate gcc command line.
>>>>>>>>> 
>>>>>>>>> [and please don't top-post]
>>>>>>>>> 
>>>>>>>>>> - George
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>>> From: "George P Nychis" <gnychis@cmu.edu> Date: Sat,
>>>>>>>>>>> 8 Apr 2006 18:47:34 -0400 (EDT)
>>>>>>>>>>> 
>>>>>>>>>>>> Hey,
>>>>>>>>>>>> 
>>>>>>>>>>>> I have a kernel module that uses unregister_qdisc
>>>>>>>>>>>> and register_qdisc, whenever i try to insert the
>>>>>>>>>>>> module I get:
>>>>>>>>>>>> /lib/modules/2.4.32/kernel/net/sched/sch_xcp.o: 
>>>>>>>>>>>> /lib/modules/2.4.32/kernel/net/sched/sch_xcp.o: 
>>>>>>>>>>>> unresolved symbol unregister_qdisc 
>>>>>>>>>>>> /lib/modules/2.4.32/kernel/net/sched/sch_xcp.o: 
>>>>>>>>>>>> /lib/modules/2.4.32/kernel/net/sched/sch_xcp.o: 
>>>>>>>>>>>> unresolved symbol register_qdisc
>>>>>>>>>>>> 
>>>>>>>>>>>> Am i missing some sort of support in the kernel?
>>>>>>>>>>> 
>>>>>>>>>>> Make sure CONFIG_NET_SCHED is enabled and that you 
>>>>>>>>>>> compiled your module against that kernel.
>>>>>>>>>>> 
>>>>>>>>>>> Where does this sch_xcp come from?  It's not in the 
>>>>>>>>>>> vanilla sources.
>>>>>>>>>>> 
>>>>>>>>>>> Also, please direct networking questions to the 
>>>>>>>>>>> netdev@vger.kernel.org mailing list which I have
>>>>>>>>>>> added to the CC:.
>>>>>>> 
>>>>>>> --- ~Randy
>>>>>>> 
>>>>>>> 
>>>>>> 
>>>>>> By the way, if I add -I/usr/src/linux/include to the compile
>>>>>> line, it successfully compiles, however, i am back to the start:
>>>>>>  lanthanum-ini src-1.0.1 # insmod sch_xcp Using 
>>>>>> /lib/modules/2.4.32/kernel/net/sched/sch_xcp.o 
>>>>>> /lib/modules/2.4.32/kernel/net/sched/sch_xcp.o: 
>>>>>> /lib/modules/2.4.32/kernel/net/sched/sch_xcp.o: unresolved
>>>>>> symbol unregister_qdisc
>>>>>> /lib/modules/2.4.32/kernel/net/sched/sch_xcp.o: 
>>>>>> /lib/modules/2.4.32/kernel/net/sched/sch_xcp.o: unresolved
>>>>>> symbol register_qdisc
>>>>> 
>>>>> Yet your 2.4.32 kernel image file does have those symbols in it?
>>>>> Can you verify that by using 'nm' on the kernel image file?
>>>>> 
>>>>> If so, then I suppose that you'll need to make a small module
>>>>> test case that exhibits this behavior, or just tell us where to
>>>>> get the sch_xcp files...
>>>>> 
>>>>> (re-added cc: for netdev)
>>>>> 
>>>>> --- ~Randy
>>>>> 
>>>>> 
>>>> 
>>>> By kernel image, do you mean /usr/src/linux/vmlinux ? if so, 
>>>> lanthanum-ini linux # nm vmlinux | grep register_qdisc c0399200 R 
>>>> __kstrtab_register_qdisc c0399240 R __kstrtab_unregister_qdisc
>>>> c039ebc8 R __ksymtab_register_qdisc c039ebd0 R
>>>> __ksymtab_unregister_qdisc c02eda40 T register_qdisc c02edaf0 T
>>>> unregister_qdisc
>>> 
>>> Yes.  That's good, then.
>>> 
>>> --- ~Randy
>>> 
>>> 
>> 
>> *sigh* ... still getting the unresolved symbols, i totally don't get
>> it, my /usr/src/linux/vmlinux says that the symbols exist, i install
>> the kernel, reboot, and still get the same errors
> 
> Yes, I understood that.
> 
>> Any other way of doing this or reason i can find out whats causing
>> this?
> 
> Well, one of the makefile gods can step in and spot the problem, or you
> can create a test case so that others can try to help out with it.  Or
> tell us where to get the code that you are using.
> 
>> thanks for your help
> 
> --- ~Randy
> 
> 


Got it working!

Ian's suggestion worked.... i had to make clean, make mrproper, and completely build from scratch

Bahhh 2.4

Thanks for your help Randy also, and all others who responded

^ permalink raw reply

* Re: [RFC/PATCH] remove unneeded check in bcm43xx
From: Benoit Boissinot @ 2006-04-10  4:38 UTC (permalink / raw)
  To: Michael Buesch; +Cc: netdev, bcm43xx-dev, linux-kernel, linville, benh
In-Reply-To: <200604100628.01483.mb@bu3sch.de>

On Mon, Apr 10, 2006 at 06:28:00AM +0200, Michael Buesch wrote:
> On Monday 10 April 2006 06:22, you wrote:
> > Either the ppc code is wrong (it doesn't enforce dma_mask) either the
> > driver still works without the check.
> > 
> > Maybe ppc should do the same thing as i386:
> > 
> > 47         if (dev == NULL || (dev->coherent_dma_mask < 0xffffffff))
> > 48                 gfp |= GFP_DMA;
> 
> No, GFP_DMA is a NOP on PPC.
> Actually the problems seems much more complex and a correct fix
> seems to be hard to do.
> I think benh is actually fixing this.
> 
> To summerize: I actually added these messages, because people were
> hitting "this does not work with >1G" issues and did not get an error message.
> So I decided to insert warnings until the issue is fixed inside the arch code.
> I will remove them once the issue is fixed.
>

Thanks for the explainations.

Benoit


-- 
powered by bash/screen/(urxvt/fvwm|linux-console)/gentoo/gnu/linux OS

^ permalink raw reply

* Re: [RFC/PATCH] remove unneeded check in bcm43xx
From: Michael Buesch @ 2006-04-10  4:28 UTC (permalink / raw)
  To: Benoit Boissinot
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA, bcm43xx-dev-0fE9KPoRgkgATYTw5x5z8w,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linville-2XuSBdqkA4R54TAoqtyWWQ,
	benh-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r
In-Reply-To: <20060410042228.GN27596-vYW+cPY1g1pWj0EZb7rXcA@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 785 bytes --]

On Monday 10 April 2006 06:22, you wrote:
> Either the ppc code is wrong (it doesn't enforce dma_mask) either the
> driver still works without the check.
> 
> Maybe ppc should do the same thing as i386:
> 
> 47         if (dev == NULL || (dev->coherent_dma_mask < 0xffffffff))
> 48                 gfp |= GFP_DMA;

No, GFP_DMA is a NOP on PPC.
Actually the problems seems much more complex and a correct fix
seems to be hard to do.
I think benh is actually fixing this.

To summerize: I actually added these messages, because people were
hitting "this does not work with >1G" issues and did not get an error message.
So I decided to insert warnings until the issue is fixed inside the arch code.
I will remove them once the issue is fixed.

-- 
Greetings Michael.

[-- Attachment #2: Type: application/pgp-signature, Size: 191 bytes --]

^ permalink raw reply

* Re: 2.4.32: unresolved symbol unregister_qdisc
From: Willy Tarreau @ 2006-04-10  4:24 UTC (permalink / raw)
  To: Randy.Dunlap; +Cc: George P Nychis, linux-kernel, netdev
In-Reply-To: <20060409202912.22d496e7.rdunlap@xenotime.net>

On Sun, Apr 09, 2006 at 08:29:12PM -0700, Randy.Dunlap wrote:
> On Sun, 9 Apr 2006 23:20:01 -0400 (EDT) George P Nychis wrote:
> 
> > 
> > > On Sun, 9 Apr 2006 22:49:50 -0400 (EDT) George P Nychis wrote:
> > > 
> > >> 
> > >>> On Sun, 9 Apr 2006 22:05:33 -0400 (EDT) George P Nychis wrote:
> > >>> 
> > >>>> 
> > >>>>> On Sun, 9 Apr 2006 13:37:25 -0400 (EDT) George P Nychis wrote:
> > >>>>> 
> > >>>>>> Thanks for the help.
> > >>>>>> 
> > >>>>>> Here is the makefile:
> > >>>>>> http://rafb.net/paste/results/auchPH75.html
> > >>>>>> 
> > >>>>>> And here is the full errors I receive: 
> > >>>>>> http://rafb.net/paste/results/Qplpqw74.html
> > >>>>>> 
> > >>>>>> Greatly appreciate it
> > >>>>>> 
> > >>>>>> - George
> > >>>>> 
> > >>>>> [repeat: please don't top-post]
> > >>>>> 
> > >>>>> I don't know how much I can help you.  It's been a long time
> > >>>>> since I've built external modules on 2.4.x.
> > >>>>> 
> > >>>>> Problems that I see: - the Makefile does not use the expected 2.4
> > >>>>>  kernel build infrastructure; - kernel Makefile uses -nostdinc to
> > >>>>>  prevent use of userspace headers; - Makefile is trying to
> > >>>>> include userspace headers instead of kernel headers, e.g.: In file
> > >>>>> included from /usr/include/linux/if_ether.h:107, from 
> > >>>>> /usr/include/linux/netdevice.h:29, from sch_xcp.c:8: - this
> > >>>>> specified include directory is only in 2.6.x, not 2.4.x:
> > >>>>> -I/lib/modules/`uname -r`/build/include/asm/mach-default
> > >>>>> 
> > >>>>> It's not clear to me how this makefile could work with 2.4.x at
> > >>>>> all. Is it supposed to, or that's just what you want to see it do?
> > >>>>> 
> > >>>>> 
> > >>>>> You could try to fix the Makefile based on makefile-changes
> > >>>>> articles at lwn.net. E.g.: http://lwn.net/Articles/151784/ 
> > >>>>> http://lwn.net/Articles/79984/ http://lwn.net/Articles/74767/ 
> > >>>>> http://lwn.net/Articles/69148/ http://lwn.net/Articles/21823/
> > >>>>> 
> > >>>>> 
> > >>>>> 
> > >>>>>>> On Sat, 8 Apr 2006 19:18:47 -0400 (EDT) George P Nychis
> > >>>>>>> wrote:
> > >>>>>>> 
> > >>>>>>>> Yeah, this module is unfortunately not under the GPL, it
> > >>>>>>>> was made for research and i am not the author, I was only
> > >>>>>>>> given the code for my own research.
> > >>>>>>>> 
> > >>>>>>>> I enabled that support in the kernel, and then tried to 
> > >>>>>>>> recompile and get tons of errors/warnings... so maybe I am 
> > >>>>>>>> missing something else to be enabled in the kernel... here
> > >>>>>>>> are a few examples of errors:
> > >>>>>>>> /usr/include/linux/skbuff.h:30:26: net/checksum.h: No such
> > >>>>>>>> file or directory /usr/include/asm/irq.h:16:25:
> > >>>>>>>> irq_vectors.h: No such file or directory
> > >>>>>>>> /usr/include/linux/irq.h:72: error: `NR_IRQS' undeclared
> > >>>>>>>> here (not in a function) /usr/include/asm/hw_irq.h:28:
> > >>>>>>>> error: `NR_IRQ_VECTORS' undeclared here (not in a function)
> > >>>>>>>> 
> > >>>>>>>> I think those are the top most errors, so if i can fix
> > >>>>>>>> those hopefully the rest shall vanish!
> > >>>>>>> 
> > >>>>>>> Looks like a Makefile problem then.  Can you post the
> > >>>>>>> Makefile? Hopefully it is using a Makefile and not just an
> > >>>>>>> elaborate gcc command line.
> > >>>>>>> 
> > >>>>>>> [and please don't top-post]
> > >>>>>>> 
> > >>>>>>>> - George
> > >>>>>>>> 
> > >>>>>>>> 
> > >>>>>>>>> From: "George P Nychis" <gnychis@cmu.edu> Date: Sat, 8
> > >>>>>>>>> Apr 2006 18:47:34 -0400 (EDT)
> > >>>>>>>>> 
> > >>>>>>>>>> Hey,
> > >>>>>>>>>> 
> > >>>>>>>>>> I have a kernel module that uses unregister_qdisc and 
> > >>>>>>>>>> register_qdisc, whenever i try to insert the module I
> > >>>>>>>>>> get: /lib/modules/2.4.32/kernel/net/sched/sch_xcp.o: 
> > >>>>>>>>>> /lib/modules/2.4.32/kernel/net/sched/sch_xcp.o:
> > >>>>>>>>>> unresolved symbol unregister_qdisc 
> > >>>>>>>>>> /lib/modules/2.4.32/kernel/net/sched/sch_xcp.o: 
> > >>>>>>>>>> /lib/modules/2.4.32/kernel/net/sched/sch_xcp.o:
> > >>>>>>>>>> unresolved symbol register_qdisc
> > >>>>>>>>>> 
> > >>>>>>>>>> Am i missing some sort of support in the kernel?
> > >>>>>>>>> 
> > >>>>>>>>> Make sure CONFIG_NET_SCHED is enabled and that you
> > >>>>>>>>> compiled your module against that kernel.
> > >>>>>>>>> 
> > >>>>>>>>> Where does this sch_xcp come from?  It's not in the
> > >>>>>>>>> vanilla sources.
> > >>>>>>>>> 
> > >>>>>>>>> Also, please direct networking questions to the 
> > >>>>>>>>> netdev@vger.kernel.org mailing list which I have added to
> > >>>>>>>>> the CC:.
> > >>>>> 
> > >>>>> --- ~Randy
> > >>>>> 
> > >>>>> 
> > >>>> 
> > >>>> By the way, if I add -I/usr/src/linux/include to the compile line,
> > >>>> it successfully compiles, however, i am back to the start:
> > >>>> lanthanum-ini src-1.0.1 # insmod sch_xcp Using 
> > >>>> /lib/modules/2.4.32/kernel/net/sched/sch_xcp.o 
> > >>>> /lib/modules/2.4.32/kernel/net/sched/sch_xcp.o: 
> > >>>> /lib/modules/2.4.32/kernel/net/sched/sch_xcp.o: unresolved symbol 
> > >>>> unregister_qdisc /lib/modules/2.4.32/kernel/net/sched/sch_xcp.o: 
> > >>>> /lib/modules/2.4.32/kernel/net/sched/sch_xcp.o: unresolved symbol 
> > >>>> register_qdisc
> > >>> 
> > >>> Yet your 2.4.32 kernel image file does have those symbols in it? Can
> > >>> you verify that by using 'nm' on the kernel image file?
> > >>> 
> > >>> If so, then I suppose that you'll need to make a small module test
> > >>> case that exhibits this behavior, or just tell us where to get the
> > >>> sch_xcp files...
> > >>> 
> > >>> (re-added cc: for netdev)
> > >>> 
> > >>> --- ~Randy
> > >>> 
> > >>> 
> > >> 
> > >> By kernel image, do you mean /usr/src/linux/vmlinux ? if so, 
> > >> lanthanum-ini linux # nm vmlinux | grep register_qdisc c0399200 R
> > >> __kstrtab_register_qdisc c0399240 R __kstrtab_unregister_qdisc c039ebc8 R
> > >> __ksymtab_register_qdisc c039ebd0 R __ksymtab_unregister_qdisc c02eda40 T
> > >> register_qdisc c02edaf0 T unregister_qdisc
> > > 
> > > Yes.  That's good, then.
> > > 
> > > --- ~Randy
> > > 
> > > 
> > 
> > *sigh* ... still getting the unresolved symbols, i totally don't get it, my /usr/src/linux/vmlinux says that the symbols exist, i install the kernel, reboot, and still get the same errors
> 
> Yes, I understood that.

There is also the possibility that you're running another kernel. Please
check /proc/ksyms to be sure that register_qdisc is there.

> > Any other way of doing this or reason i can find out whats causing this?
> 
> Well, one of the makefile gods can step in and spot the problem, or you can
> create a test case so that others can try to help out with it.  Or tell us
> where to get the code that you are using.

That would clearly help. If you cannot post the whole driver, please at
least post the source without any function except init_module(). Check
net/sched/sch_ingress.c for very minimal code.
 
> > thanks for your help
>
> ---
> ~Randy

Willy

^ permalink raw reply

* Re: [RFC/PATCH] remove unneeded check in bcm43xx
From: Benoit Boissinot @ 2006-04-10  4:22 UTC (permalink / raw)
  To: Michael Buesch; +Cc: netdev, bcm43xx-dev, linux-kernel, linville, benh
In-Reply-To: <200604100607.33362.mb@bu3sch.de>

On Mon, Apr 10, 2006 at 06:07:32AM +0200, Michael Buesch wrote:
> On Monday 10 April 2006 06:01, you wrote:
> > Since the driver already sets the correct dma_mask, there is no reason
> > to bail there. In fact if you have an iommu, I think you can have a
> > address above 1G which will be ok for the device (if it isn't true then
> > the powerpc dma_alloc_coherent with iommu needs to be fixed because it
> > doesn't respect the the dma_mask).
> > 
> > Please comment or apply.
> 
> NACK. Don't apply that patch.
> I know it is odd, but people are actually hitting these messages.
> Maybe benh can explain the issues. I don't know...
> 
Yes, I know they hit the message, that's from a message in some forum
that i got interested in the issue. It probably comes from an allocation
from:
http://www.linux-m32r.org/lxr/http/source/arch/powerpc/kernel/pci_direct_iommu.c#L32

Either the ppc code is wrong (it doesn't enforce dma_mask) either the
driver still works without the check.

Maybe ppc should do the same thing as i386:

47         if (dev == NULL || (dev->coherent_dma_mask < 0xffffffff))
48                 gfp |= GFP_DMA;

thanks,

Benoit

-- 
powered by bash/screen/(urxvt/fvwm|linux-console)/gentoo/gnu/linux OS

^ permalink raw reply

* Re: [RFC/PATCH] remove unneeded check in bcm43xx
From: Michael Buesch @ 2006-04-10  4:07 UTC (permalink / raw)
  To: Benoit Boissinot
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA, bcm43xx-dev-0fE9KPoRgkgATYTw5x5z8w,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linville-2XuSBdqkA4R54TAoqtyWWQ,
	benh-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r
In-Reply-To: <20060410040120.GA4860-vYW+cPY1g1pWj0EZb7rXcA@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 586 bytes --]

On Monday 10 April 2006 06:01, you wrote:
> Since the driver already sets the correct dma_mask, there is no reason
> to bail there. In fact if you have an iommu, I think you can have a
> address above 1G which will be ok for the device (if it isn't true then
> the powerpc dma_alloc_coherent with iommu needs to be fixed because it
> doesn't respect the the dma_mask).
> 
> Please comment or apply.

NACK. Don't apply that patch.
I know it is odd, but people are actually hitting these messages.
Maybe benh can explain the issues. I don't know...

-- 
Greetings Michael.

[-- Attachment #2: Type: application/pgp-signature, Size: 191 bytes --]

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox