* [PATCH] atm: clip causes unregister hang
From: Stephen Hemminger @ 2006-04-12 19:45 UTC (permalink / raw)
To: Herbert Xu; +Cc: davem, chas, linux-atm-general, netdev, stable
In-Reply-To: <E1FTjlM-00050V-00@gondolin.me.apana.org.au>
If Classical IP over ATM module is loaded, its neighbor table gets
populated when permanent neighbor entries are created; but these entries
are not flushed when the device is removed. Since the entry never gets
flushed the unregister of the network device never completes.
Bug-reference: http://bugzilla.kernel.org/show_bug.cgi?id=6295
Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
--- linux-2.6.16.2.orig/net/atm/clip.c 2006-04-12 10:10:43.000000000 -0700
+++ linux-2.6.16.2/net/atm/clip.c 2006-04-12 11:22:47.000000000 -0700
@@ -613,12 +613,19 @@
static int clip_device_event(struct notifier_block *this,unsigned long event,
- void *dev)
+ void *arg)
{
+ struct net_device *dev = arg;
+
+ if (event == NETDEV_UNREGISTER) {
+ neigh_ifdown(&clip_tbl, dev);
+ return NOTIFY_DONE;
+ }
+
/* ignore non-CLIP devices */
- if (((struct net_device *) dev)->type != ARPHRD_ATM ||
- ((struct net_device *) dev)->hard_start_xmit != clip_start_xmit)
+ if (dev->type != ARPHRD_ATM || dev->hard_start_xmit != clip_start_xmit)
return NOTIFY_DONE;
+
switch (event) {
case NETDEV_UP:
DPRINTK("clip_device_event NETDEV_UP\n");
@@ -688,8 +695,7 @@
DPRINTK("atmarpd_close\n");
atmarpd = NULL; /* assumed to be atomic */
barrier();
- unregister_inetaddr_notifier(&clip_inet_notifier);
- unregister_netdevice_notifier(&clip_dev_notifier);
+
if (skb_peek(&sk_atm(vcc)->sk_receive_queue))
printk(KERN_ERR "atmarpd_close: closing with requests "
"pending\n");
@@ -731,10 +737,6 @@
vcc->push = NULL;
vcc->pop = NULL; /* crash */
vcc->push_oam = NULL; /* crash */
- if (register_netdevice_notifier(&clip_dev_notifier))
- printk(KERN_ERR "register_netdevice_notifier failed\n");
- if (register_inetaddr_notifier(&clip_inet_notifier))
- printk(KERN_ERR "register_inetaddr_notifier failed\n");
return 0;
}
@@ -992,6 +994,8 @@
clip_tbl_hook = &clip_tbl;
register_atm_ioctl(&clip_ioctl_ops);
+ register_netdevice_notifier(&clip_dev_notifier);
+ register_inetaddr_notifier(&clip_inet_notifier);
#ifdef CONFIG_PROC_FS
{
@@ -1012,6 +1016,9 @@
remove_proc_entry("arp", atm_proc_root);
+ unregister_inetaddr_notifier(&clip_inet_notifier);
+ unregister_netdevice_notifier(&clip_dev_notifier);
+
deregister_atm_ioctl(&clip_ioctl_ops);
/* First, stop the idle timer, so it stops banging
^ permalink raw reply
* Fw: [Bugme-new] [Bug 6378] New: bonding mode=1 does not always pick right primary interface
From: Andrew Morton @ 2006-04-12 19:45 UTC (permalink / raw)
To: netdev; +Cc: linux
Begin forwarded message:
Date: Wed, 12 Apr 2006 05:57:27 -0700
From: bugme-daemon@bugzilla.kernel.org
To: bugme-new@lists.osdl.org
Subject: [Bugme-new] [Bug 6378] New: bonding mode=1 does not always pick right primary interface
http://bugzilla.kernel.org/show_bug.cgi?id=6378
Summary: bonding mode=1 does not always pick right primary
interface
Kernel Version: 2.6.16
Status: NEW
Severity: normal
Owner: acme@conectiva.com.br
Submitter: linux@hrunting.org
Most recent kernel where this bug did not occur: 2.6.10
Distribution: Fedora Core 4
Hardware Environment: Dual P4 2.4GHz, dual onboard e1000 NICs, one unused e100
management NIC
Software Environment: FC4, 2.6.16-1.2069_FC4
Problem Description: Picking a primary interface does not always work
Steps to reproduce:
Configure /etc/modprobe.conf with lines like such:
alias eth0 e1000
alias eth1 e1000
alias bond0 bonding
options bond0 miimon=100 mode=1 primary=eth1
Reboot the box.
When the box comes up, it's using eth0 as the primary NIC and eth1 as a backup.
If you drop the connection on eth0 (I do this by shutting down a port on the
router), it fails over properly to eth1. If I then bring back up eth0, it stays
on eth0 correctly. Shutting down the port to eth1 fails over to eth0 properly.
Bringing back up the port for eth1 causes it to fail back over to eth1 properly.
So it looks like the primary mode is being set right, but isn't being
acknowledged or handled properly when the bond is first brought up.
I also have Opteron servers running this config and they do not seem to be
affected by this bug. It might be a timing issue on boot that affects Intel
systems more than Opterons, though. I've seen it once or twice on Opteron with
kernel 2.6.15. It's regularly reproducible with the Intel systems, though, with
both 2.6.15 and 2.6.16 FC4 kernels.
The relevant portions of lspci -v:
03:01.0 Ethernet controller: Intel Corporation 82541EI Gigabit Ethernet
Controller (Copper)
Subsystem: Intel Corporation: Unknown device 1213
Flags: bus master, 66Mhz, medium devsel, latency 64, IRQ 28
Memory at fd8c0000 (32-bit, non-prefetchable) [size=128K]
I/O ports at c400 [size=64]
Capabilities: [dc] Power Management version 2
Capabilities: [e4] PCI-X non-bridge device.
03:02.0 Ethernet controller: Intel Corporation 82541EI Gigabit Ethernet
Controller (Copper)
Subsystem: Intel Corporation: Unknown device 1213
Flags: bus master, 66Mhz, medium devsel, latency 64, IRQ 29
Memory at fd8e0000 (32-bit, non-prefetchable) [size=128K]
I/O ports at c800 [size=64]
Capabilities: [dc] Power Management version 2
Capabilities: [e4] PCI-X non-bridge device.
Relevant lines from dmesg (boot):
Ethernet Channel Bonding Driver: v3.0.1 (January 9, 2006)
bonding: MII link monitoring set to 100 ms
e1000: eth0: e1000_watchdog_task: NIC Link is Up 1000 Mbps Full Duplex
bonding: bond0: making interface eth0 the new active one.
bonding: bond0: enslaving eth0 as an active interface with an up link.
e1000: eth1: e1000_watchdog_task: NIC Link is Up 1000 Mbps Full Duplex
bonding: bond0: enslaving eth1 as a backup interface with an up link.
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply
* [RFD][PATCH] typhoon and core sample for folding away VLAN stuff (was: Re: [PATCH] deinline a few large functions in vlan code v2)
From: Ingo Oeser @ 2006-04-12 19:32 UTC (permalink / raw)
To: Ingo Oeser
Cc: Denis Vlasenko, Dave Dillow, netdev, David S. Miller,
linux-kernel, jgarzik
In-Reply-To: <200604111517.37215.netdev@axxeo.de>
Hi Denis,
here is a sample patch for the vlan core and API plus
typhoon driver converted as example.
Just so you can see, what I meant with "No #if in control flow code."
I couldn't resist cleaning up the vlan core, while I'm at it.
Of course I can seperate this, if you want the pure unilining stuff only.
So I hope this style is clear enough that you can do the rest of
the conversion without any problems.
Dave Dillow: Is this style clean enough to have it in your driver?
This kind of changes are important, because bloat creeps in byte by byte
of unused features. So I really appreciate your work here Denis.
Regards
Ingo Oeser
diff --git a/drivers/net/typhoon.c b/drivers/net/typhoon.c
index c1ce87a..aab24b8 100644
--- a/drivers/net/typhoon.c
+++ b/drivers/net/typhoon.c
@@ -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];
@@ -350,6 +352,19 @@ enum state_values {
#define TSO_OFFLOAD_ON 0
#endif
+
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
+static inline struct vlan_group *typhoon_get_vlgrp(struct typhoon *tp)
+{
+ return tp->vlgrp;
+}
+#else
+static inline struct vlan_group *typhoon_get_vlgrp(struct typhoon *tp)
+{
+ return NULL;
+}
+#endif
+
static inline void
typhoon_inc_index(u32 *index, const int count, const int num_entries)
{
@@ -707,6 +722,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 +770,12 @@ typhoon_vlan_rx_kill_vid(struct net_devi
tp->vlgrp->vlan_devices[vid] = NULL;
spin_unlock_bh(&tp->state_lock);
}
+#else
+
+#define typhoon_vlan_rx_register NULL
+#define typhoon_vlan_rx_kill_vid NULL
+
+#endif
static inline void
typhoon_tso_fill(struct sk_buff *skb, struct transmit_ring *txRing,
@@ -1686,6 +1708,7 @@ typhoon_rx(struct typhoon *tp, struct ba
struct rx_desc *rx;
struct sk_buff *skb, *new_skb;
struct rxbuff_ent *rxb;
+ struct vlan_group *vlgrp;
dma_addr_t dma_addr;
u32 local_ready;
u32 rxaddr;
@@ -1745,8 +1768,9 @@ typhoon_rx(struct typhoon *tp, struct ba
new_skb->ip_summed = CHECKSUM_NONE;
spin_lock(&tp->state_lock);
- if(tp->vlgrp != NULL && rx->rxStatus & TYPHOON_RX_VLAN)
- vlan_hwaccel_receive_skb(new_skb, tp->vlgrp,
+ vlgrp = typhoon_get_vlgrp(tp);
+ if(vlgrp != NULL && rx->rxStatus & TYPHOON_RX_VLAN)
+ vlan_hwaccel_receive_skb(new_skb, vlgrp,
ntohl(rx->vlanTag) & 0xffff);
else
netif_receive_skb(new_skb);
@@ -2233,7 +2257,7 @@ typhoon_suspend(struct pci_dev *pdev, pm
return 0;
spin_lock_bh(&tp->state_lock);
- if(tp->vlgrp && tp->wol_events & TYPHOON_WAKE_MAGIC_PKT) {
+ if(typhoon_get_vlgrp(tp) && tp->wol_events & TYPHOON_WAKE_MAGIC_PKT) {
spin_unlock_bh(&tp->state_lock);
printk(KERN_ERR "%s: cannot do WAKE_MAGIC with VLANS\n",
dev->name);
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index eef0876..4ed541f 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -14,6 +14,8 @@
#define _LINUX_IF_VLAN_H_
#ifdef __KERNEL__
+#define HAVE_VLAN_PUT_TAG
+#define HAVE_VLAN_GET_TAG
/* externally defined structs */
struct vlan_group;
@@ -119,79 +121,29 @@ struct vlan_dev_info {
struct net_device_stats dev_stats; /* Device stats (rx-bytes, tx-pkts, etc...) */
};
-#define VLAN_DEV_INFO(x) ((struct vlan_dev_info *)(x->priv))
-
-/* inline functions */
-
-static inline struct net_device_stats *vlan_dev_get_stats(struct net_device *dev)
-{
- return &(VLAN_DEV_INFO(dev)->dev_stats);
-}
-
-static inline __u32 vlan_get_ingress_priority(struct net_device *dev,
- unsigned short vlan_tag)
-{
- struct vlan_dev_info *vip = VLAN_DEV_INFO(dev);
-
- return vip->ingress_priority_map[(vlan_tag >> 13) & 0x7];
-}
-
/* VLAN tx hw acceleration helpers. */
struct vlan_skb_tx_cookie {
u32 magic;
u32 vlan_tag;
};
-#define VLAN_TX_COOKIE_MAGIC 0x564c414e /* "VLAN" in ascii. */
#define VLAN_TX_SKB_CB(__skb) ((struct vlan_skb_tx_cookie *)&((__skb)->cb[0]))
-#define vlan_tx_tag_present(__skb) \
- (VLAN_TX_SKB_CB(__skb)->magic == VLAN_TX_COOKIE_MAGIC)
+
#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,
- 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;
- }
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
+#define VLAN_DEV_INFO(x) ((struct vlan_dev_info *)(x->priv))
+#define VLAN_REAL_DEV(x) (VLAN_DEV_INFO(x)->real_dev)
- skb->dev->last_rx = jiffies;
+#define VLAN_TX_COOKIE_MAGIC 0x564c414e /* "VLAN" in ascii. */
- 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));
-}
+#define vlan_tx_tag_present(__skb) \
+ (VLAN_TX_SKB_CB(__skb)->magic == VLAN_TX_COOKIE_MAGIC)
+
+
+int __vlan_hwaccel_rx(struct sk_buff *skb, struct vlan_group *grp,
+ unsigned short vlan_tag, int polling);
static inline int vlan_hwaccel_rx(struct sk_buff *skb,
struct vlan_group *grp,
@@ -207,55 +159,7 @@ static inline int vlan_hwaccel_receive_s
return __vlan_hwaccel_rx(skb, grp, vlan_tag, 1);
}
-/**
- * __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.
- */
-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
* @skb: skbuff to tag
@@ -274,8 +178,6 @@ static inline struct sk_buff *__vlan_hwa
return skb;
}
-#define HAVE_VLAN_PUT_TAG
-
/**
* vlan_put_tag - inserts VLAN tag according to device features
* @skb: skbuff to tag
@@ -304,7 +206,7 @@ static inline int __vlan_get_tag(struct
{
struct vlan_ethhdr *veth = (struct vlan_ethhdr *)skb->data;
- if (veth->h_vlan_proto != __constant_htons(ETH_P_8021Q)) {
+ if (veth->h_vlan_proto != htons(ETH_P_8021Q)) {
return -EINVAL;
}
@@ -334,8 +236,6 @@ static inline int __vlan_hwaccel_get_tag
}
}
-#define HAVE_VLAN_GET_TAG
-
/**
* vlan_get_tag - get the VLAN ID from the skb
* @skb: skbuff to query
@@ -352,6 +252,41 @@ static inline int vlan_get_tag(struct sk
}
}
+#else
+
+#define VLAN_REAL_DEV(x) x
+#define vlan_tx_tag_present(__skb) 0
+
+static inline int vlan_hwaccel_rx(struct sk_buff *skb,
+ struct vlan_group *grp,
+ unsigned short vlan_tag)
+{
+ return netif_rx(skb);
+}
+
+static inline int vlan_hwaccel_receive_skb(struct sk_buff *skb,
+ struct vlan_group *grp,
+ unsigned short vlan_tag)
+{
+ return netif_receive_skb(skb);
+}
+
+static inline struct sk_buff *vlan_put_tag(struct sk_buff *skb, unsigned short tag)
+{
+ return skb;
+}
+
+static inline int vlan_get_tag(struct sk_buff *skb, unsigned short *tag)
+{
+ *tag = 0;
+ return -EINVAL;
+}
+
+#endif /* defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) */
+
+
+
+
#endif /* __KERNEL__ */
/* VLAN IOCTLs are found in sockios.h */
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index da9cfe9..d7c4eb1 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -37,6 +37,21 @@
#include <linux/if_vlan.h>
#include <net/ip.h>
+/* inline functions */
+
+static inline struct net_device_stats *vlan_dev_get_stats(struct net_device *dev)
+{
+ return &(VLAN_DEV_INFO(dev)->dev_stats);
+}
+
+static inline __u32 vlan_get_ingress_priority(struct net_device *dev,
+ unsigned short vlan_tag)
+{
+ struct vlan_dev_info *vip = VLAN_DEV_INFO(dev);
+
+ return vip->ingress_priority_map[(vlan_tag >> 13) & 0x7];
+}
+
/*
* Rebuild the Ethernet MAC header. This is called after an ARP
* (or in future other address resolution) has completed on this
@@ -71,7 +86,7 @@ int vlan_dev_rebuild_header(struct sk_bu
return 0;
}
-static inline struct sk_buff *vlan_check_reorder_header(struct sk_buff *skb)
+static struct sk_buff *vlan_check_reorder_header(struct sk_buff *skb)
{
if (VLAN_DEV_INFO(skb->dev)->flags & 1) {
if (skb_shared(skb) || skb_cloned(skb)) {
@@ -90,6 +105,104 @@ static inline struct sk_buff *vlan_check
return skb;
}
+/**
+ * __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;
+}
+
+static void vlan_rx_common(struct sk_buff *skb, unsigned short vlan_tag)
+{
+ struct net_device_stats *stats;
+
+ 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 (!compare_ether_addr(eth_hdr(skb)->h_dest, skb->dev->dev_addr)) {
+ skb->pkt_type = PACKET_HOST;
+ break;
+ };
+}
+
+/* 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)
+{
+ 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;
+ vlan_rx_common(skb, vlan_tag);
+ return (polling ? netif_receive_skb(skb) : netif_rx(skb));
+}
+
/*
* Determine the packet's protocol ID. The rule here is that we
* assume 802.3 if the type field is short enough to be a length.
@@ -158,11 +271,6 @@ int vlan_skb_recv(struct sk_buff *skb, s
skb->dev->last_rx = jiffies;
- /* Bump the rx counters for the VLAN device. */
- stats = vlan_dev_get_stats(skb->dev);
- stats->rx_packets++;
- stats->rx_bytes += skb->len;
-
/* Take off the VLAN header (4 bytes currently) */
skb_pull_rcsum(skb, VLAN_HLEN);
@@ -184,42 +292,7 @@ int vlan_skb_recv(struct sk_buff *skb, s
return -1;
}
- /*
- * Deal with ingress priority mapping.
- */
- skb->priority = vlan_get_ingress_priority(skb->dev, ntohs(vhdr->h_vlan_TCI));
-
-#ifdef VLAN_DEBUG
- printk(VLAN_DBG "%s: priority: %lu for TCI: %hu (hbo)\n",
- __FUNCTION__, (unsigned long)(skb->priority),
- ntohs(vhdr->h_vlan_TCI));
-#endif
-
- /* The ethernet driver already did the pkt_type calculations
- * for us...
- */
- switch (skb->pkt_type) {
- case PACKET_BROADCAST: /* Yeah, stats collect these together.. */
- // stats->broadcast ++; // no such counter :-(
- 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 (!compare_ether_addr(eth_hdr(skb)->h_dest, skb->dev->dev_addr)) {
- /* It is for our (changed) MAC-address! */
- skb->pkt_type = PACKET_HOST;
- }
- break;
- default:
- break;
- };
+ vlan_rx_common(skb, vlan_tag);
/* Was a VLAN packet, grab the encapsulated protocol, which the layer
* three protocols care about.
@@ -258,7 +331,7 @@ int vlan_skb_recv(struct sk_buff *skb, s
* won't work for fault tolerant netware but does for the rest.
*/
if (*(unsigned short *)rawp == 0xFFFF) {
- skb->protocol = __constant_htons(ETH_P_802_3);
+ skb->protocol = htons(ETH_P_802_3);
/* place it back on the queue to be handled by true layer 3 protocols.
*/
@@ -281,7 +354,7 @@ int vlan_skb_recv(struct sk_buff *skb, s
/*
* Real 802.2 LLC
*/
- skb->protocol = __constant_htons(ETH_P_802_2);
+ skb->protocol = htons(ETH_P_802_2);
/* place it back on the queue to be handled by upper layer protocols.
*/
diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c
index 3da9264..dec3495 100644
--- a/net/bridge/br_netfilter.c
+++ b/net/bridge/br_netfilter.c
@@ -879,10 +879,8 @@ static unsigned int ip_sabotage_out(unsi
if ((out->hard_start_xmit == br_dev_xmit &&
okfn != br_nf_forward_finish &&
okfn != br_nf_local_out_finish && okfn != br_nf_dev_queue_xmit)
-#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
|| ((out->priv_flags & IFF_802_1Q_VLAN) &&
- VLAN_DEV_INFO(out)->real_dev->hard_start_xmit == br_dev_xmit)
-#endif
+ VLAN_REAL_DEV(out)->hard_start_xmit == br_dev_xmit)
) {
struct nf_bridge_info *nf_bridge;
^ permalink raw reply related
* Re: [RFC][PATCH] Avoid multi-page allocs for large mtu datagram sends
From: Herbert Xu @ 2006-04-12 18:31 UTC (permalink / raw)
To: Zach Brown; +Cc: netdev
In-Reply-To: <443D4582.5000301@oracle.com>
On Wed, Apr 12, 2006 at 11:22:58AM -0700, Zach Brown wrote:
>
> Did you have an opinion of the rest of the original patch?
Sorry, I've been busy lately so I've only just started reading it.
I should have something to say by tomorrow :)
--
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
* Re: [RFC][PATCH] Avoid multi-page allocs for large mtu datagram sends
From: Zach Brown @ 2006-04-12 18:22 UTC (permalink / raw)
To: Herbert Xu; +Cc: netdev
In-Reply-To: <20060412162035.GA18572@gondor.apana.org.au>
[-- Attachment #1: Type: text/plain, Size: 519 bytes --]
Herbert Xu wrote:
> On Wed, Apr 05, 2006 at 05:51:02PM +0000, Zach Brown wrote:
>> 2) I changed the final-frag test to be length + fraggap as the math later on
>> seemed to match that.. is that OK?
>
> Yes that's a real bug introduced by a previous rework. Could you
> please split that off into a separate patch?
Sure, here it is by itself. I lightly tested this but didn't actually
use anything that has a non-zero trailer len, I don't think.
Did you have an opinion of the rest of the original patch?
- z
[-- Attachment #2: ip-append-data-fraggap-math-0.patch --]
[-- Type: text/x-patch, Size: 837 bytes --]
[PATCH] ip_output: account for fraggap when checking to add trailer_len
During other work I noticed that ip_append_data() seemed to be forgetting to
include the frag gap in its calculation of a fragment that consumes the rest of
the payload. Herbert confirmed that this was a bug that snuck in during a
previous rework.
Signed-off-by: Zach Brown <zach.brown@oracle.com>
Index: 2.6.17-rc1-mm2-fraggap/net/ipv4/ip_output.c
===================================================================
--- 2.6.17-rc1-mm2-fraggap.orig/net/ipv4/ip_output.c
+++ 2.6.17-rc1-mm2-fraggap/net/ipv4/ip_output.c
@@ -904,7 +904,7 @@ alloc_new_skb:
* because we have no idea what fragment will be
* the last.
*/
- if (datalen == length)
+ if (datalen == length + fraggap)
alloclen += rt->u.dst.trailer_len;
if (transhdrlen) {
^ permalink raw reply
* Re: [RFC: 2.6 patch] the overdue removal of ip{,6}_queue
From: Patrick McHardy @ 2006-04-12 18:14 UTC (permalink / raw)
To: Harald Welte
Cc: Adrian Bunk, coreteam, netdev, sds, jmorris,
Netfilter Development Mailinglist
In-Reply-To: <20060411182624.GD31616@sunbeam.de.gnumonks.org>
Harald Welte wrote:
> On Tue, Apr 11, 2006 at 04:42:50PM +0200, Patrick McHardy wrote:
>
>>I think we need to do two things:
>>
>>- make libipq_compat a drop-in replacement that doesn't require
>> recompilation
>
>
> libipq is not distributed as a shared library (at least not by us), so I
> don't see any purpose for doing so. Do you think anyone is going to
> re-link statically linked code against the new lib
I wasn't aware of that. That makes it even worse, old applications
will break and we can't do anything about it. I think this is
normally considered not acceptable.
^ permalink raw reply
* Re: [PATCH] atm: clip causes unregister hang
From: Herbert Xu @ 2006-04-12 18:08 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: davem, chas, linux-atm-general, netdev, stable
In-Reply-To: <20060412105545.3b089dd8@localhost.localdomain>
Hi Stephen:
Stephen Hemminger <shemminger@osdl.org> wrote:
>
> --- linux-2.6.16.2.orig/net/atm/clip.c 2006-04-12 10:10:43.000000000 -0700
> +++ linux-2.6.16.2/net/atm/clip.c 2006-04-12 10:15:46.000000000 -0700
> @@ -613,12 +613,19 @@
>
>
> static int clip_device_event(struct notifier_block *this,unsigned long event,
> - void *dev)
> + void *arg)
> {
> + struct net_device *dev = arg;
> +
> + if (event == NETDEV_DOWN) {
> + neigh_ifdown(&clip_tbl, dev);
> + return NOTIFY_DONE;
> + }
You want NETDEV_UNREGISTER because neigh entries may get added
even if the device is down.
Thanks,
--
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
* [PATCH] atm: clip causes unregister hang
From: Stephen Hemminger @ 2006-04-12 17:55 UTC (permalink / raw)
To: David S. Miller, chas; +Cc: linux-atm-general, netdev, stable
If Classical IP over ATM module is loaded or compile in to the kernel.
Its neighbor table gets populated when permanent neighbor entries are created;
but these entries are not flushed when the device is removed.
Since the entry never gets flushed the unregister of the network device never
completes.
The problem is that the driver doesn't register a notify handler unless
ATM is started, and it doesn't do the proper cleanup in the event handler.
Please apply for 2.6.17 and 2.6.16 stable.
Bug-reference: http://bugzilla.kernel.org/show_bug.cgi?id=6295
Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
--- linux-2.6.16.2.orig/net/atm/clip.c 2006-04-12 10:10:43.000000000 -0700
+++ linux-2.6.16.2/net/atm/clip.c 2006-04-12 10:15:46.000000000 -0700
@@ -613,12 +613,19 @@
static int clip_device_event(struct notifier_block *this,unsigned long event,
- void *dev)
+ void *arg)
{
+ struct net_device *dev = arg;
+
+ if (event == NETDEV_DOWN) {
+ neigh_ifdown(&clip_tbl, dev);
+ return NOTIFY_DONE;
+ }
+
/* ignore non-CLIP devices */
- if (((struct net_device *) dev)->type != ARPHRD_ATM ||
- ((struct net_device *) dev)->hard_start_xmit != clip_start_xmit)
+ if (dev->type != ARPHRD_ATM || dev->hard_start_xmit != clip_start_xmit)
return NOTIFY_DONE;
+
switch (event) {
case NETDEV_UP:
DPRINTK("clip_device_event NETDEV_UP\n");
@@ -688,8 +695,7 @@
DPRINTK("atmarpd_close\n");
atmarpd = NULL; /* assumed to be atomic */
barrier();
- unregister_inetaddr_notifier(&clip_inet_notifier);
- unregister_netdevice_notifier(&clip_dev_notifier);
+
if (skb_peek(&sk_atm(vcc)->sk_receive_queue))
printk(KERN_ERR "atmarpd_close: closing with requests "
"pending\n");
@@ -731,10 +737,6 @@
vcc->push = NULL;
vcc->pop = NULL; /* crash */
vcc->push_oam = NULL; /* crash */
- if (register_netdevice_notifier(&clip_dev_notifier))
- printk(KERN_ERR "register_netdevice_notifier failed\n");
- if (register_inetaddr_notifier(&clip_inet_notifier))
- printk(KERN_ERR "register_inetaddr_notifier failed\n");
return 0;
}
@@ -992,6 +994,8 @@
clip_tbl_hook = &clip_tbl;
register_atm_ioctl(&clip_ioctl_ops);
+ register_netdevice_notifier(&clip_dev_notifier);
+ register_inetaddr_notifier(&clip_inet_notifier);
#ifdef CONFIG_PROC_FS
{
@@ -1012,6 +1016,9 @@
remove_proc_entry("arp", atm_proc_root);
+ unregister_inetaddr_notifier(&clip_inet_notifier);
+ unregister_netdevice_notifier(&clip_dev_notifier);
+
deregister_atm_ioctl(&clip_ioctl_ops);
/* First, stop the idle timer, so it stops banging
^ permalink raw reply
* Re: [PATCH] deinline a few large functions in vlan code v2
From: Dave Dillow @ 2006-04-12 17:18 UTC (permalink / raw)
To: Denis Vlasenko; +Cc: netdev, David S. Miller, linux-kernel, jgarzik
In-Reply-To: <200604121155.55561.vda@ilport.com.ua>
On Wed, 2006-04-12 at 11:55 +0300, Denis Vlasenko wrote:
> On Tuesday 11 April 2006 16:59, Dave Dillow wrote:
> > DaveM beat me to it, but as he said, it saves 5K only if you have all
> > the drivers built in
>
> I have most of network drivers built in.
> I want network card to work right away in early boot,
> and I prefer to not regenerate initrd with new nic modules for
> each new kernel which I build for diskless stations.
Do you really intend to say that you are the common case, and that this
5K really matters? I'm all for removing bloat, but not without looking
at the real savings vs the cost.
> > or loaded. And even if it saves 200 bytes in one
> > module, unless that module text was already less than 200 bytes into a
> > page, you've saved no memory -- a 4300 byte module takes 2 pages on x86,
> > as does a 4100 byte module.
>
> Sometimes, those 200 bytes can bring module size just under 4096.
> Thus on the average, on many modules you get the same size savings
> as on built-in code. (Not that we have THAT many network modules...)
You're making a bogus leap from "sometimes" to "average".
Assuming an even distribution of lengths mod 4096, less than 5% of the
time will 200 bytes save any memory on a module.
Since we're both making big assumptions, only real numbers from built
modules would be convincing.
> > NAK. The #ifdefs are ugly, for no significant gain.
> >
> > And you introduced a race condition when you moved the spin_locks. The
> > test for tp->vlgrp is no longer protected.
>
> See attached. Much less #ifdefs (most of the time I test for compile time
> constant VLAN_ENABLED in the if()s instead), the race is fixed.
Testing for VLAN_ENABLED in an if statement is better than the ifdefs, I
agree, but I still find it ugly. Probably not ugly enough to argue about
it any more.
I don't like "VLAN_ENABLED" as a global define -- it looks too much like
something local. The CONFIG_VLAN... defines were more descriptive.
I didn't think about this before, but I'm pretty sure you're taking away
functionality. When I wrote the typhoon driver, ISTR that I looked
through the vlan implantation, and determined that all the #ifdefs on
CONFIG_VLAN_8021Q were not really needed, since all the hooks were
there. You could just load the 8021q module (even perhaps building it at
a later date), and it would work if you had filled in the hooks in
struct net_device. So I didn't #ifdef out code in my driver to let the
user have the option.
You're taking that away in the name of a total of 5K, which most users
won't actually get back?
--
Dave Dillow <dave@thedillows.org>
^ permalink raw reply
* VLAN & ARP requests
From: Florian Reitmeir @ 2006-04-12 16:32 UTC (permalink / raw)
To: netdev
Hi,
I don't if this a bug, and i tried to get some documentation about the
behavier but failed, so here is my question..
(i tested this with 2.6.14 & 2.6.16.1)
I have two network interfaces,
lan = a1000 ethernet
wlan = ipw2200 wireless
then I give them the same network address/subnet
ifconfig lan 10.200.20.20 netmask 255.255.255.0
ifconfig wlan 10.200.20.20 netmask 255.255.255.0
(there is no promisc mode or any other non default config)
now I try to ping an address which is not on my network for e.g.
ping 10.200.20.30
and use tcpdump -pni lan|wlan to look at the arp requests. The kernel asking
arp on the two interfaces. Everything is OK.
(also there are two routes for the networks, one for each interface)
now I add VLANs,
vconfig add lan 12
vconfig add lan 20
and give them also the same ip address:
ifconfig lan.12 10.200.20.20 netmask 255.255.255.0
ifconfig lan.20 10.200.20.20 netmask 255.255.255.0
and try to ping..
and now .. there are no arp requests for those two interfaces. sometime when
i disable for example the wlan interface, there is an arp request on _one_
of the vlan interfaces (that one which has the first route), but never on
all.
On the lan interface are always arp requests, even if i try to change the
macaddress of the vlan interfaces, or change the ip to an other subnet.
In my opinion the kernel should also send arp request on the vlan interfaces,
so they behave identical like the physical ones.
Any clues to that problem? (btw. I now that this is'nt a common configuration)
--
Florian Reitmeir
^ permalink raw reply
* Re: [RFC][PATCH] Avoid multi-page allocs for large mtu datagram sends
From: Herbert Xu @ 2006-04-12 16:20 UTC (permalink / raw)
To: Zach Brown; +Cc: netdev
In-Reply-To: <20060405175102.GA28166@tetsuo.zabbo.net>
On Wed, Apr 05, 2006 at 05:51:02PM +0000, Zach Brown wrote:
>
> 2) I changed the final-frag test to be length + fraggap as the math later on
> seemed to match that.. is that OK?
Yes that's a real bug introduced by a previous rework. Could you
please split that off into a separate patch?
Thanks,
--
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
* Re: [PATCH] deinline a few large functions in vlan code v2
From: Denis Vlasenko @ 2006-04-12 8:55 UTC (permalink / raw)
To: Dave Dillow; +Cc: netdev, David S. Miller, linux-kernel, jgarzik
In-Reply-To: <1144763984.16193.9.camel@dillow.idleaire.com>
[-- Attachment #1: Type: text/plain, Size: 1944 bytes --]
On Tuesday 11 April 2006 16:59, Dave Dillow wrote:
> DaveM beat me to it, but as he said, it saves 5K only if you have all
> the drivers built in
I have most of network drivers built in.
I want network card to work right away in early boot,
and I prefer to not regenerate initrd with new nic modules for
each new kernel which I build for diskless stations.
> or loaded. And even if it saves 200 bytes in one
> module, unless that module text was already less than 200 bytes into a
> page, you've saved no memory -- a 4300 byte module takes 2 pages on x86,
> as does a 4100 byte module.
Sometimes, those 200 bytes can bring module size just under 4096.
Thus on the average, on many modules you get the same size savings
as on built-in code. (Not that we have THAT many network modules...)
> The only savings is in instruction cache, and it would be better to
> perhaps uninline vlan_hwaccel_receive_skb() or __vlan_hwaccel_rx() and
> make vlan_tx_tag_present be
>
> #if defined(CONFIG_VLAN_8021Q) || defined (CONFIG_VLAN_8021Q_MODULE)
> #define vlan_tx_tag_present(__skb) \
> (VLAN_TX_SKB_CB(__skb)->magic == VLAN_TX_COOKIE_MAGIC)
> #else
> #define vlan_tx_tag_present(x) 0
> #endif
>
> to get the cache savings on the hot paths without the ugliness.
Good idea.
> > > 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?
>
> NAK. The #ifdefs are ugly, for no significant gain.
>
> And you introduced a race condition when you moved the spin_locks. The
> test for tp->vlgrp is no longer protected.
See attached. Much less #ifdefs (most of the time I test for compile time
constant VLAN_ENABLED in the if()s instead), the race is fixed.
Please apply your ugli-o-meter to it...
--
vda
[-- Attachment #2: 2.6.16.vlan_inline8.patch --]
[-- Type: text/x-diff, Size: 36840 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 Wed Apr 12 11:29:34 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 Wed Apr 12 11:29:34 2006
@@ -40,7 +40,9 @@
#include <linux/mii.h>
#ifdef NETIF_F_HW_VLAN_TX
#include <linux/if_vlan.h>
+#if VLAN_ENABLED
#define BCM_VLAN 1
+#endif
#endif
#ifdef NETIF_F_TSO
#include <net/ip.h>
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 Wed Apr 12 11:29:34 2006
@@ -502,7 +502,7 @@ static void rlb_update_client(struct rlb
skb->dev = client_info->slave->dev;
- if (client_info->tag) {
+ if (VLAN_ENABLED && client_info->tag) {
skb = vlan_put_tag(skb, client_info->vlan_id);
if (!skb) {
printk(KERN_ERR DRV_NAME
@@ -511,7 +511,6 @@ static void rlb_update_client(struct rlb
continue;
}
}
-
arp_xmit(skb);
}
}
@@ -671,7 +670,7 @@ static struct slave *rlb_choose_channel(
client_info->ntt = 0;
}
- if (!list_empty(&bond->vlan_list)) {
+ if (VLAN_ENABLED && !list_empty(&bond->vlan_list)) {
unsigned short vlan_id;
int res = vlan_get_tag(skb, &vlan_id);
if (!res) {
@@ -833,6 +832,7 @@ static void rlb_deinitialize(struct bond
_unlock_rx_hashtbl(bond);
}
+#if VLAN_ENABLED
static void rlb_clear_vlan(struct bonding *bond, unsigned short vlan_id)
{
struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond));
@@ -865,16 +865,20 @@ 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[])
{
- struct bonding *bond = bond_get_bond_by_slave(slave);
+ struct bonding *bond;
struct learning_pkt pkt;
int size = sizeof(struct learning_pkt);
int i;
+ if (VLAN_ENABLED)
+ bond = bond_get_bond_by_slave(slave);
+
memset(&pkt, 0, size);
memcpy(pkt.mac_dst, mac_addr, ETH_ALEN);
memcpy(pkt.mac_src, mac_addr, ETH_ALEN);
@@ -898,7 +902,7 @@ static void alb_send_learning_packets(st
skb->priority = TC_PRIO_CONTROL;
skb->dev = slave->dev;
- if (!list_empty(&bond->vlan_list)) {
+ if (VLAN_ENABLED && !list_empty(&bond->vlan_list)) {
struct vlan_entry *vlan;
vlan = bond_next_vlan(bond,
@@ -918,7 +922,6 @@ static void alb_send_learning_packets(st
continue;
}
}
-
dev_queue_xmit(skb);
}
}
@@ -1665,6 +1668,7 @@ int bond_alb_set_mac_address(struct net_
return 0;
}
+#if VLAN_ENABLED
void bond_alb_clear_vlan(struct bonding *bond, unsigned short vlan_id)
{
if (bond->alb_info.current_alb_vlan &&
@@ -1676,4 +1680,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 Wed Apr 12 11:45:33 2006
@@ -199,6 +199,7 @@ const char *bond_mode_name(int mode)
}
}
+#if VLAN_ENABLED
/*---------------------------------- VLAN -----------------------------------*/
/**
@@ -349,6 +350,10 @@ struct vlan_entry *bond_next_vlan(struct
return next;
}
+#else
+/* never called */
+int bond_has_challenged_slaves(struct bonding *bond);
+#endif /* VLAN_ENABLED */
/**
* bond_dev_queue_xmit - Prepare skb for xmit.
@@ -368,7 +373,7 @@ int bond_dev_queue_xmit(struct bonding *
{
unsigned short vlan_id;
- if (!list_empty(&bond->vlan_list) &&
+ if (VLAN_ENABLED && !list_empty(&bond->vlan_list) &&
!(slave_dev->features & NETIF_F_HW_VLAN_TX) &&
vlan_get_tag(skb, &vlan_id) == 0) {
skb->dev = slave_dev;
@@ -390,6 +395,7 @@ int bond_dev_queue_xmit(struct bonding *
return 0;
}
+#if VLAN_ENABLED
/*
* 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 +561,11 @@ unreg:
out:
write_unlock_bh(&bond->lock);
}
+#else
+/* never called */
+void bond_add_vlans_on_slave(struct bonding *bond, struct net_device *slave_dev);
+void bond_del_vlans_from_slave(struct bonding *bond, struct net_device *slave_dev);
+#endif /* VLAN_ENABLED */
/*------------------------------- Link status -------------------------------*/
@@ -1217,7 +1228,7 @@ int bond_enslave(struct net_device *bond
/* vlan challenged mutual exclusion */
/* no need to lock since we're protected by rtnl_lock */
- if (slave_dev->features & NETIF_F_VLAN_CHALLENGED) {
+ if (VLAN_ENABLED && (slave_dev->features & NETIF_F_VLAN_CHALLENGED)) {
dprintk("%s: NETIF_F_VLAN_CHALLENGED\n", slave_dev->name);
if (!list_empty(&bond->vlan_list)) {
printk(KERN_ERR DRV_NAME
@@ -1235,7 +1246,7 @@ int bond_enslave(struct net_device *bond
bond_dev->name);
bond_dev->features |= NETIF_F_VLAN_CHALLENGED;
}
- } else {
+ } else if (VLAN_ENABLED) {
dprintk("%s: ! NETIF_F_VLAN_CHALLENGED\n", slave_dev->name);
if (bond->slave_cnt == 0) {
/* First slave, and it is not VLAN challenged,
@@ -1356,7 +1367,8 @@ int bond_enslave(struct net_device *bond
dev_mc_add(slave_dev, lacpdu_multicast, ETH_ALEN, 0);
}
- bond_add_vlans_on_slave(bond, slave_dev);
+ if (VLAN_ENABLED)
+ bond_add_vlans_on_slave(bond, slave_dev);
write_lock_bh(&bond->lock);
@@ -1667,7 +1679,7 @@ int bond_release(struct net_device *bond
*/
memset(bond_dev->dev_addr, 0, bond_dev->addr_len);
- if (list_empty(&bond->vlan_list)) {
+ if (!VLAN_ENABLED || list_empty(&bond->vlan_list)) {
bond_dev->features |= NETIF_F_VLAN_CHALLENGED;
} else {
printk(KERN_WARNING DRV_NAME
@@ -1679,7 +1691,7 @@ int bond_release(struct net_device *bond
"HW address matches its VLANs'.\n",
bond_dev->name);
}
- } else if ((bond_dev->features & NETIF_F_VLAN_CHALLENGED) &&
+ } else if (VLAN_ENABLED && (bond_dev->features & NETIF_F_VLAN_CHALLENGED) &&
!bond_has_challenged_slaves(bond)) {
printk(KERN_INFO DRV_NAME
": %s: last VLAN challenged slave %s "
@@ -1693,7 +1705,8 @@ int bond_release(struct net_device *bond
/* must do this from outside any spinlocks */
bond_destroy_slave_symlinks(bond_dev, slave_dev);
- bond_del_vlans_from_slave(bond, slave_dev);
+ if (VLAN_ENABLED)
+ bond_del_vlans_from_slave(bond, slave_dev);
/* 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,7 +1798,8 @@ static int bond_release_all(struct net_d
write_unlock_bh(&bond->lock);
bond_destroy_slave_symlinks(bond_dev, slave_dev);
- bond_del_vlans_from_slave(bond, slave_dev);
+ if (VLAN_ENABLED)
+ bond_del_vlans_from_slave(bond, slave_dev);
/* 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
@@ -1835,7 +1849,7 @@ static int bond_release_all(struct net_d
*/
memset(bond_dev->dev_addr, 0, bond_dev->addr_len);
- if (list_empty(&bond->vlan_list)) {
+ if (!VLAN_ENABLED || list_empty(&bond->vlan_list)) {
bond_dev->features |= NETIF_F_VLAN_CHALLENGED;
} else {
printk(KERN_WARNING DRV_NAME
@@ -2239,7 +2253,7 @@ static int bond_has_ip(struct bonding *b
if (bond->master_ip)
return 1;
- if (list_empty(&bond->vlan_list))
+ if (!VLAN_ENABLED || list_empty(&bond->vlan_list))
return 0;
list_for_each_entry_safe(vlan, vlan_next, &bond->vlan_list,
@@ -2270,7 +2284,7 @@ static void bond_arp_send(struct net_dev
printk(KERN_ERR DRV_NAME ": ARP packet allocation failed\n");
return;
}
- if (vlan_id) {
+ if (VLAN_ENABLED && vlan_id) {
skb = vlan_put_tag(skb, vlan_id);
if (!skb) {
printk(KERN_ERR DRV_NAME ": failed to insert VLAN tag\n");
@@ -2283,7 +2297,7 @@ static void bond_arp_send(struct net_dev
static void bond_arp_send_all(struct bonding *bond, struct slave *slave)
{
- int i, vlan_id, rv;
+ int i,vlan_id, rv;
u32 *targets = bond->params.arp_targets;
struct vlan_entry *vlan, *vlan_next;
struct net_device *vlan_dev;
@@ -2294,7 +2308,7 @@ static void bond_arp_send_all(struct bon
if (!targets[i])
continue;
dprintk("basa: target %x\n", targets[i]);
- if (list_empty(&bond->vlan_list)) {
+ if (!VLAN_ENABLED || list_empty(&bond->vlan_list)) {
dprintk("basa: empty vlan: arp_send\n");
bond_arp_send(slave->dev, ARPOP_REQUEST, targets[i],
bond->master_ip, 0);
@@ -2369,7 +2383,6 @@ static void bond_send_gratuitous_arp(str
struct slave *slave = bond->curr_active_slave;
struct vlan_entry *vlan;
struct net_device *vlan_dev;
-
dprintk("bond_send_grat_arp: bond %s slave %s\n", bond->dev->name,
slave ? slave->dev->name : "NULL");
if (!slave)
@@ -2380,11 +2393,13 @@ static void bond_send_gratuitous_arp(str
bond->master_ip, 0);
}
- list_for_each_entry(vlan, &bond->vlan_list, vlan_list) {
- vlan_dev = bond->vlgrp->vlan_devices[vlan->vlan_id];
- if (vlan->vlan_ip) {
- bond_arp_send(slave->dev, ARPOP_REPLY, vlan->vlan_ip,
- vlan->vlan_ip, vlan->vlan_id);
+ if (VLAN_ENABLED) {
+ list_for_each_entry(vlan, &bond->vlan_list, vlan_list) {
+ vlan_dev = bond->vlgrp->vlan_devices[vlan->vlan_id];
+ if (vlan->vlan_ip) {
+ bond_arp_send(slave->dev, ARPOP_REPLY, vlan->vlan_ip,
+ vlan->vlan_ip, vlan->vlan_id);
+ }
}
}
}
@@ -3215,7 +3230,7 @@ static int bond_inetaddr_event(struct no
}
}
- if (list_empty(&bond->vlan_list))
+ if (!VLAN_ENABLED || list_empty(&bond->vlan_list))
continue;
list_for_each_entry_safe(vlan, vlan_next, &bond->vlan_list,
@@ -4120,7 +4135,8 @@ static int bond_init(struct net_device *
bond->current_arp_slave = NULL;
bond->primary_slave = NULL;
bond->dev = bond_dev;
- INIT_LIST_HEAD(&bond->vlan_list);
+ if (VLAN_ENABLED)
+ INIT_LIST_HEAD(&bond->vlan_list);
/* Initialize the device entry points */
bond_dev->open = bond_open;
@@ -4151,6 +4167,7 @@ static int bond_init(struct net_device *
* transmitting */
bond_dev->features |= NETIF_F_LLTX;
+#if VLAN_ENABLED
/* By default, we declare the bond to be fully
* VLAN hardware accelerated capable. Special
* care is taken in the various xmit functions
@@ -4163,6 +4180,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/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 Wed Apr 12 11:29:34 2006
@@ -978,7 +978,7 @@ static int sge_rx(struct sge *sge, struc
} else
skb->ip_summed = CHECKSUM_NONE;
- if (unlikely(adapter->vlan_grp && p->vlan_valid)) {
+ if (VLAN_ENABLED && unlikely(adapter->vlan_grp && p->vlan_valid)) {
sge->port_stats[p->iff].vlan_xtract++;
if (adapter->params.sge.polling)
vlan_hwaccel_receive_skb(skb, adapter->vlan_grp,
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 Wed Apr 12 11:39:31 2006
@@ -250,10 +250,16 @@ static void e1000_smartspeed(struct e100
static inline int e1000_82547_fifo_workaround(struct e1000_adapter *adapter,
struct sk_buff *skb);
+#if VLAN_ENABLED
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);
+#else
+/* never called */
+void e1000_vlan_rx_kill_vid(struct net_device *netdev, uint16_t vid);
+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 +367,7 @@ e1000_irq_enable(struct e1000_adapter *a
}
}
+#if VLAN_ENABLED
static void
e1000_update_mng_vlan(struct e1000_adapter *adapter)
{
@@ -383,6 +390,10 @@ e1000_update_mng_vlan(struct e1000_adapt
}
}
}
+#else
+/* never called */
+void e1000_update_mng_vlan(struct e1000_adapter *adapter);
+#endif
/**
* e1000_release_hw_control - release control of the h/w to f/w
@@ -470,7 +481,8 @@ e1000_up(struct e1000_adapter *adapter)
e1000_set_multi(netdev);
- e1000_restore_vlan(adapter);
+ if (VLAN_ENABLED)
+ e1000_restore_vlan(adapter);
e1000_configure_tx(adapter);
e1000_setup_rctl(adapter);
@@ -629,9 +641,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");
- 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);
+
+ if (VLAN_ENABLED) {
+ 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);
+ }
e1000_reset_adaptive(&adapter->hw);
e1000_phy_get_info(&adapter->hw, &adapter->phy_info);
@@ -733,9 +748,11 @@ e1000_probe(struct pci_dev *pdev,
netdev->poll = &e1000_clean;
netdev->weight = 64;
#endif
+#if VLAN_ENABLED
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,10 +1245,13 @@ e1000_open(struct net_device *netdev)
if ((err = e1000_up(adapter)))
goto err_up;
- 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);
+
+ if (VLAN_ENABLED) {
+ 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);
+ }
}
/* If AMT is enabled, let the firmware know that the network
@@ -1274,7 +1294,7 @@ e1000_close(struct net_device *netdev)
e1000_free_all_tx_resources(adapter);
e1000_free_all_rx_resources(adapter);
- if ((adapter->hw.mng_cookie.status &
+ if (VLAN_ENABLED && (adapter->hw.mng_cookie.status &
E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT)) {
e1000_vlan_rx_kill_vid(netdev, adapter->mng_vlan_id);
}
@@ -2397,7 +2417,7 @@ 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 (adapter->mng_vlan_id != adapter->hw.mng_cookie.vlan_id)
+ if (VLAN_ENABLED && adapter->mng_vlan_id != adapter->hw.mng_cookie.vlan_id)
e1000_update_mng_vlan(adapter);
}
@@ -3714,7 +3734,7 @@ e1000_clean_rx_irq(struct e1000_adapter
skb->protocol = eth_type_trans(skb, netdev);
#ifdef CONFIG_E1000_NAPI
- if (unlikely(adapter->vlgrp &&
+ if (VLAN_ENABLED && unlikely(adapter->vlgrp &&
(status & E1000_RXD_STAT_VP))) {
vlan_hwaccel_receive_skb(skb, adapter->vlgrp,
le16_to_cpu(rx_desc->special) &
@@ -3723,7 +3743,7 @@ e1000_clean_rx_irq(struct e1000_adapter
netif_receive_skb(skb);
}
#else /* CONFIG_E1000_NAPI */
- if (unlikely(adapter->vlgrp &&
+ if (VLAN_ENABLED && unlikely(adapter->vlgrp &&
(status & E1000_RXD_STAT_VP))) {
vlan_hwaccel_rx(skb, adapter->vlgrp,
le16_to_cpu(rx_desc->special) &
@@ -3861,7 +3881,7 @@ e1000_clean_rx_irq_ps(struct e1000_adapt
cpu_to_le16(E1000_RXDPS_HDRSTAT_HDRSP)))
adapter->rx_hdr_split++;
#ifdef CONFIG_E1000_NAPI
- if (unlikely(adapter->vlgrp && (staterr & E1000_RXD_STAT_VP))) {
+ if (VLAN_ENABLED && 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);
@@ -3869,7 +3889,7 @@ e1000_clean_rx_irq_ps(struct e1000_adapt
netif_receive_skb(skb);
}
#else /* CONFIG_E1000_NAPI */
- if (unlikely(adapter->vlgrp && (staterr & E1000_RXD_STAT_VP))) {
+ if (VLAN_ENABLED && 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);
@@ -4351,6 +4371,7 @@ e1000_io_write(struct e1000_hw *hw, unsi
outl(value, port);
}
+#if VLAN_ENABLED
static void
e1000_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp)
{
@@ -4382,7 +4403,7 @@ 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 (adapter->mng_vlan_id != (uint16_t)E1000_MNG_VLAN_NONE) {
+ if (VLAN_ENABLED && 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;
}
@@ -4450,6 +4471,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 Wed Apr 12 11:41:09 2006
@@ -270,15 +270,17 @@ static int gfar_probe(struct platform_de
} else
priv->rx_csum_enable = 0;
- priv->vlgrp = NULL;
+ if (VLAN_ENABLED) {
+ priv->vlgrp = NULL;
- if (priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_VLAN) {
- dev->vlan_rx_register = gfar_vlan_rx_register;
- dev->vlan_rx_kill_vid = gfar_vlan_rx_kill_vid;
+ if (priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_VLAN) {
+ dev->vlan_rx_register = gfar_vlan_rx_register;
+ dev->vlan_rx_kill_vid = gfar_vlan_rx_kill_vid;
- dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
+ dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
- priv->vlan_enable = 1;
+ priv->vlan_enable = 1;
+ }
}
if (priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_EXTENDED_HASH) {
@@ -792,7 +794,7 @@ int startup_gfar(struct net_device *dev)
rctrl |= RCTRL_EMEN;
}
- if (priv->vlan_enable)
+ if (VLAN_ENABLED && priv->vlan_enable)
rctrl |= RCTRL_VLAN;
if (priv->padding) {
@@ -1037,6 +1039,7 @@ int gfar_set_mac_address(struct net_devi
}
+#if VLAN_ENABLED
/* Enables and disables VLAN insertion/extraction */
static void gfar_vlan_rx_register(struct net_device *dev,
struct vlan_group *grp)
@@ -1088,6 +1091,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,7 +1101,7 @@ static int gfar_change_mtu(struct net_de
int oldsize = priv->rx_buffer_size;
int frame_size = new_mtu + ETH_HLEN;
- if (priv->vlan_enable)
+ if (VLAN_ENABLED && priv->vlan_enable)
frame_size += VLAN_ETH_HLEN;
if (gfar_uses_fcb(priv))
@@ -1409,7 +1413,7 @@ static int gfar_process_frame(struct net
skb->protocol = eth_type_trans(skb, dev);
/* Send the packet up the stack */
- if (unlikely(priv->vlgrp && (fcb->flags & RXFCB_VLN)))
+ if (VLAN_ENABLED && unlikely(priv->vlgrp && (fcb->flags & RXFCB_VLN)))
ret = gfar_rx_vlan(skb, priv->vlgrp, fcb->vlctl);
else
ret = RECEIVE(skb);
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 Wed Apr 12 11:29:34 2006
@@ -702,7 +702,9 @@ struct gfar_private {
extended_hash:1,
bd_stash_en:1;
unsigned short padding;
+#if VLAN_ENABLED
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_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 Wed Apr 12 11:39:25 2006
@@ -121,11 +121,16 @@ 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 VLAN_ENABLED
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);
+#else
+/* never called */
+void ixgb_restore_vlan(struct ixgb_adapter *adapter);
+#endif
#ifdef CONFIG_NET_POLL_CONTROLLER
/* for netdump / net console */
@@ -233,7 +238,8 @@ ixgb_up(struct ixgb_adapter *adapter)
ixgb_set_multi(netdev);
- ixgb_restore_vlan(adapter);
+ if (VLAN_ENABLED)
+ ixgb_restore_vlan(adapter);
ixgb_configure_tx(adapter);
ixgb_setup_rctl(adapter);
@@ -419,9 +425,11 @@ ixgb_probe(struct pci_dev *pdev,
netdev->poll = &ixgb_clean;
netdev->weight = 64;
#endif
+#if VLAN_ENABLED
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
@@ -1905,7 +1913,7 @@ ixgb_clean_rx_irq(struct ixgb_adapter *a
skb->protocol = eth_type_trans(skb, netdev);
#ifdef CONFIG_IXGB_NAPI
- if(adapter->vlgrp && (status & IXGB_RX_DESC_STATUS_VP)) {
+ if(VLAN_ENABLED && 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);
@@ -1913,7 +1921,7 @@ ixgb_clean_rx_irq(struct ixgb_adapter *a
netif_receive_skb(skb);
}
#else /* CONFIG_IXGB_NAPI */
- if(adapter->vlgrp && (status & IXGB_RX_DESC_STATUS_VP)) {
+ if(VLAN_ENABLED && 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);
@@ -2014,6 +2022,7 @@ ixgb_alloc_rx_buffers(struct ixgb_adapte
rx_ring->next_to_use = i;
}
+#if VLAN_ENABLED
/**
* ixgb_vlan_rx_register - enables or disables vlan tagging/stripping.
*
@@ -2107,6 +2116,7 @@ ixgb_restore_vlan(struct ixgb_adapter *a
}
}
}
+#endif /* VLAN_ENABLED */
#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 Wed Apr 12 11:40:33 2006
@@ -182,6 +182,7 @@ static char ethtool_stats_keys[][ETH_GST
timer.data = (unsigned long) arg; \
mod_timer(&timer, (jiffies + exp)) \
+#if VLAN_ENABLED
/* 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
@@ -3470,7 +3472,6 @@ static int s2io_xmit(struct sk_buff *skb
int mss;
#endif
u16 vlan_tag = 0;
- int vlan_priority = 0;
mac_info_t *mac_control;
struct config_param *config;
@@ -3491,6 +3492,7 @@ static int s2io_xmit(struct sk_buff *skb
/* Get Fifo number to Transmit based on vlan priority */
if (sp->vlgrp && vlan_tx_tag_present(skb)) {
+ int vlan_priority;
vlan_tag = vlan_tx_tag_get(skb);
vlan_priority = vlan_tag >> 13;
queue = config->fifo_mapping[vlan_priority];
@@ -5680,7 +5682,7 @@ static int rx_osm_handler(ring_info_t *r
skb->protocol = eth_type_trans(skb, dev);
#ifdef CONFIG_S2IO_NAPI
- if (sp->vlgrp && RXD_GET_VLAN_TAG(rxdp->Control_2)) {
+ if (VLAN_ENABLED && 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));
@@ -5688,7 +5690,7 @@ static int rx_osm_handler(ring_info_t *r
netif_receive_skb(skb);
}
#else
- if (sp->vlgrp && RXD_GET_VLAN_TAG(rxdp->Control_2)) {
+ if (VLAN_ENABLED && 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));
@@ -6051,9 +6053,11 @@ Defaulting to INTA\n");
dev->do_ioctl = &s2io_ioctl;
dev->change_mtu = &s2io_change_mtu;
SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops);
+#if VLAN_ENABLED
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/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 Wed Apr 12 11:40:48 2006
@@ -707,6 +707,7 @@ out:
return err;
}
+#if VLAN_ENABLED
static void
typhoon_vlan_rx_register(struct net_device *dev, struct vlan_group *grp)
{
@@ -754,6 +755,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,
@@ -1744,13 +1746,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)
- vlan_hwaccel_receive_skb(new_skb, tp->vlgrp,
+ if(VLAN_ENABLED) {
+ spin_lock(&tp->state_lock);
+ if(tp->vlgrp != NULL && rx->rxStatus & TYPHOON_RX_VLAN) {
+ vlan_hwaccel_receive_skb(new_skb, tp->vlgrp,
ntohl(rx->vlanTag) & 0xffff);
- else
+ }
+ spin_unlock(&tp->state_lock);
+ } else
netif_receive_skb(new_skb);
- spin_unlock(&tp->state_lock);
tp->dev->last_rx = jiffies;
received++;
@@ -2232,14 +2236,16 @@ typhoon_suspend(struct pci_dev *pdev, pm
if(!netif_running(dev))
return 0;
- spin_lock_bh(&tp->state_lock);
- if(tp->vlgrp && tp->wol_events & TYPHOON_WAKE_MAGIC_PKT) {
+ if(VLAN_ENABLED) {
+ spin_lock_bh(&tp->state_lock);
+ if(tp->vlgrp && tp->wol_events & TYPHOON_WAKE_MAGIC_PKT) {
+ spin_unlock_bh(&tp->state_lock);
+ printk(KERN_ERR "%s: cannot do WAKE_MAGIC with VLANS\n",
+ dev->name);
+ return -EBUSY;
+ }
spin_unlock_bh(&tp->state_lock);
- printk(KERN_ERR "%s: cannot do WAKE_MAGIC with VLANS\n",
- dev->name);
- return -EBUSY;
}
- spin_unlock_bh(&tp->state_lock);
netif_device_detach(dev);
@@ -2549,8 +2555,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 VLAN_ENABLED
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
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 Wed Apr 12 11:38:14 2006
@@ -23,6 +23,12 @@ struct vlan_collection;
struct vlan_dev_info;
struct hlist_node;
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
+#define VLAN_ENABLED 1
+#else
+#define VLAN_ENABLED 0
+#endif
+
#include <linux/proc_fs.h> /* for proc_dir_entry */
#include <linux/netdevice.h>
@@ -144,54 +150,18 @@ struct vlan_skb_tx_cookie {
#define VLAN_TX_COOKIE_MAGIC 0x564c414e /* "VLAN" in ascii. */
#define VLAN_TX_SKB_CB(__skb) ((struct vlan_skb_tx_cookie *)&((__skb)->cb[0]))
+#if VLAN_ENABLED 1
#define vlan_tx_tag_present(__skb) \
(VLAN_TX_SKB_CB(__skb)->magic == VLAN_TX_COOKIE_MAGIC)
+#else
+#define vlan_tx_tag_present(__skb) 0
+#endif
#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 +188,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 Wed Apr 12 11:29:34 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/8021q/Makefile linux-2.6.16.vlan/net/8021q/Makefile
--- linux-2.6.16.org/net/8021q/Makefile Mon Mar 20 07:53:29 2006
+++ linux-2.6.16.vlan/net/8021q/Makefile Wed Apr 12 11:29:34 2006
@@ -2,6 +2,8 @@
# Makefile for the Linux VLAN layer.
#
+obj-y += if_vlan.o
+
obj-$(CONFIG_VLAN_8021Q) += 8021q.o
8021q-objs := vlan.o vlan_dev.o
diff -urpN linux-2.6.16.org/net/8021q/if_vlan.c linux-2.6.16.vlan/net/8021q/if_vlan.c
--- linux-2.6.16.org/net/8021q/if_vlan.c Thu Jan 1 03:00:00 1970
+++ linux-2.6.16.vlan/net/8021q/if_vlan.c Wed Apr 12 11:29:34 2006
@@ -0,0 +1,111 @@
+/* 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.
+ */
+
+
+#include <linux/skbuff.h>
+#include <linux/if_vlan.h>
+
+#if VLAN_ENABLED
+
+/* 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
diff -urpN linux-2.6.16.org/net/Makefile linux-2.6.16.vlan/net/Makefile
--- linux-2.6.16.org/net/Makefile Mon Mar 20 07:53:29 2006
+++ linux-2.6.16.vlan/net/Makefile Wed Apr 12 11:29:34 2006
@@ -41,7 +41,7 @@ obj-$(CONFIG_RXRPC) += rxrpc/
obj-$(CONFIG_ATM) += atm/
obj-$(CONFIG_DECNET) += decnet/
obj-$(CONFIG_ECONET) += econet/
-obj-$(CONFIG_VLAN_8021Q) += 8021q/
+obj-y += 8021q/
obj-$(CONFIG_IP_DCCP) += dccp/
obj-$(CONFIG_IP_SCTP) += sctp/
obj-$(CONFIG_IEEE80211) += ieee80211/
^ permalink raw reply
* Re: 2.6.17 regression: Very slow net transfer from some hosts
From: John Heffner @ 2006-04-12 0:42 UTC (permalink / raw)
To: Daniel Drake; +Cc: Stephen Hemminger, netdev, linux-kernel
In-Reply-To: <443C4471.7040407@gentoo.org>
Daniel Drake wrote:
> Stephen Hemminger wrote:
>>> This is very familiar, and I just found the article I was thinking
>>> of: http://lwn.net/Articles/92727/
>>>
>>> I was also hit by that bug, on the same collection of websites, but
>>> that particular problem was fixed for 2.6.8 or so. So I guess it is
>>> extremely likely that my ISP has broken routers. nmap isn't able to
>>> identify the OS of any ISP routers in my path.
>>
>> We never fixed it, its kind of hard to fix other peoples equipment ;-)
>
> Weird, things started working for me around 2.6.9 without having to
> modify any sysctl stuff.
Ah, I remember now. 2.6.7 introduced the tcp_default_win_scale
variable, and 2.6.9 got rid of it, doing the calculation based on the
max possible tcp rcvbuf. This is conceptually the right thing to do,
regardless of broken middleboxes, but had the side effect of hiding this
latent problem a bit longer.
Thanks,
-John
^ permalink raw reply
* Re: 2.6.17 regression: Very slow net transfer from some hosts
From: John Heffner @ 2006-04-12 0:32 UTC (permalink / raw)
To: Daniel Drake; +Cc: Stephen Hemminger, netdev, linux-kernel
In-Reply-To: <443C4471.7040407@gentoo.org>
Daniel Drake wrote:
> Stephen Hemminger wrote:
>> Turn off TCP window scaling, your performance will be limited but about
>> as good as you can get with a corrupting firewall in between.
[snip]
> For anyone else interested, the ISP is NTL (UK). The fix:
>
> echo "4096 16384 131072 " > /proc/sys/net/ipv4/tcp_wmem
> echo "4096 87380 174760 " > /proc/sys/net/ipv4/tcp_rmem
For the record, I think Stephen's suggested workaround is better:
echo 0 > /proc/sys/net/ipv4/tcp_window_scaling
It will prevent the other end of the connection from using a window
scale, so it "fixes" both directions of the connection, not just receiving.
Thanks,
-John
^ permalink raw reply
* Re: 2.6.17 regression: Very slow net transfer from some hosts
From: Daniel Drake @ 2006-04-12 0:06 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: John Heffner, netdev, linux-kernel
In-Reply-To: <20060411153315.4132b477@localhost.localdomain>
Stephen Hemminger wrote:
>> This is very familiar, and I just found the article I was thinking of:
>> http://lwn.net/Articles/92727/
>>
>> I was also hit by that bug, on the same collection of websites, but that
>> particular problem was fixed for 2.6.8 or so. So I guess it is extremely
>> likely that my ISP has broken routers. nmap isn't able to identify the
>> OS of any ISP routers in my path.
>
> We never fixed it, its kind of hard to fix other peoples equipment ;-)
Weird, things started working for me around 2.6.9 without having to
modify any sysctl stuff.
> Turn off TCP window scaling, your performance will be limited but about
> as good as you can get with a corrupting firewall in between.
I was wrong in my previous mail where I said that the rmem/wmem output
hasn't changed over the two kernels - it has, the 3rd column differs. I
simply set those values back to what they were on 2.6.16 and now things
work again - I presumably have window scale 2 (scale factor 4) again,
which appears to be a decent compromise between having a window and
things actually working.
For anyone else interested, the ISP is NTL (UK). The fix:
echo "4096 16384 131072 " > /proc/sys/net/ipv4/tcp_wmem
echo "4096 87380 174760 " > /proc/sys/net/ipv4/tcp_rmem
This issue is visible on my 1GB system but not on my laptop (256mb RAM).
The key thing is that more memory means a higher window scale factor is
used, which appears to trigger ntl's brokenness.
Daniel
^ permalink raw reply
* Re: 2.6.17 regression: Very slow net transfer from some hosts
From: Stephen Hemminger @ 2006-04-11 23:59 UTC (permalink / raw)
To: Daniel Drake; +Cc: John Heffner, netdev, linux-kernel
In-Reply-To: <443C4471.7040407@gentoo.org>
On Wed, 12 Apr 2006 01:06:09 +0100
Daniel Drake <dsd@gentoo.org> wrote:
> Stephen Hemminger wrote:
> >> This is very familiar, and I just found the article I was thinking of:
> >> http://lwn.net/Articles/92727/
> >>
> >> I was also hit by that bug, on the same collection of websites, but that
> >> particular problem was fixed for 2.6.8 or so. So I guess it is extremely
> >> likely that my ISP has broken routers. nmap isn't able to identify the
> >> OS of any ISP routers in my path.
> >
> > We never fixed it, its kind of hard to fix other peoples equipment ;-)
>
> Weird, things started working for me around 2.6.9 without having to
> modify any sysctl stuff.
What we did was default the window scaling needed to match the max
possible memory usage. The normal value for tcp_wmem correlated to
a window scale of 2. If a corrupting middlebox lost the window
scale option, then connection would proceed but all windows would
be 1/4 of possible; and connection would still limp along at
somewhat reduced bandwidth.
John's changes cause tcp_wmem to be bigger, so we ask for a bigger
window scale. If the "window scale lost in translation" problem gets
too bad, the sender will never send anything because it thinks
the receiver is doing silly-window-syndrome.
>
> > Turn off TCP window scaling, your performance will be limited but about
> > as good as you can get with a corrupting firewall in between.
>
> I was wrong in my previous mail where I said that the rmem/wmem output
> hasn't changed over the two kernels - it has, the 3rd column differs. I
> simply set those values back to what they were on 2.6.16 and now things
> work again - I presumably have window scale 2 (scale factor 4) again,
> which appears to be a decent compromise between having a window and
> things actually working.
>
> For anyone else interested, the ISP is NTL (UK). The fix:
>
> echo "4096 16384 131072 " > /proc/sys/net/ipv4/tcp_wmem
> echo "4096 87380 174760 " > /proc/sys/net/ipv4/tcp_rmem
>
>
> This issue is visible on my 1GB system but not on my laptop (256mb RAM).
> The key thing is that more memory means a higher window scale factor is
> used, which appears to trigger ntl's brokenness.
>
> Daniel
^ permalink raw reply
* Re: [RFC/PATCH] remove unneeded check in bcm43xx
From: Michael Buesch @ 2006-04-11 23:04 UTC (permalink / raw)
To: Benjamin Herrenschmidt
Cc: benoit.boissinot-vYW+cPY1g1pg9hUCZPvPmw,
mb-fseUSCV1ubazQB+pC5nmwQ, netdev-u79uwXL29TY76Z2rM5mHXA,
bcm43xx-dev-0fE9KPoRgkgATYTw5x5z8w,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linville-2XuSBdqkA4R54TAoqtyWWQ, David S. Miller
In-Reply-To: <1144794077.19353.53.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
On Wednesday 12 April 2006 00:21, you wrote:
>
> > I still think we shouldn't reward shit hardware by complicating
> > up our DMA mappings internals. :-)
>
> BTW. In the meantime, can't that driver work in PIO only mode ?
No, because I did not finish debugging that, yet. ;)
And a second half-no, because some newer chips don't support
PIO anymore (4318 for example).
--
Greetings Michael.
^ permalink raw reply
* Re: [RFC/PATCH] remove unneeded check in bcm43xx
From: Benjamin Herrenschmidt @ 2006-04-11 22:35 UTC (permalink / raw)
To: Benoit Boissinot
Cc: David S. Miller, mb-fseUSCV1ubazQB+pC5nmwQ,
netdev-u79uwXL29TY76Z2rM5mHXA, bcm43xx-dev-0fE9KPoRgkgATYTw5x5z8w,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linville-2XuSBdqkA4R54TAoqtyWWQ
In-Reply-To: <20060411223024.GA6543-vYW+cPY1g1pWj0EZb7rXcA@public.gmane.org>
On Wed, 2006-04-12 at 00:30 +0200, Benoit Boissinot wrote:
> On Wed, Apr 12, 2006 at 08:21:17AM +1000, Benjamin Herrenschmidt wrote:
> >
> > > I still think we shouldn't reward shit hardware by complicating
> > > up our DMA mappings internals. :-)
> >
> > BTW. In the meantime, can't that driver work in PIO only mode ?
>
> yes, I think you just have to have the pci_set_dma_mask fail with
> DMA30BIT_MASK.
Ok, _that_ makes sense in fact to have ppc do that when the mask is too
big... now the problem is should I compare the mask to the available
RAM ? That is, there is little point in failing for a 30 bits mask if
hte machine only has 512M of RAM.
By extension of the above, what to do on 32 bits kernels, should I test
the mask against total memory or specifically against lowmem ? There is
no clear answer here as some drivers will get highmem pages for DMA,
just not network drivers afaik (block drivers will), though I can't be
sure what will happen with thing like nbd... I'm not familiar enough
with the network stack. It would be sad to have 32 bits laptop switch to
PIO when they have too much RAM if, in practice, skbs are always only in
lowmem..
I think for now, what I may do is just add such a test for ppc64 and not
ppc32 and will talk to paulus see if he happens to have a better idea.
It's all very sad that bcm gets away with such crap though and that so
many vendors just bought it without complaining...
Ben.
^ permalink raw reply
* Re: 2.6.17 regression: Very slow net transfer from some hosts
From: Stephen Hemminger @ 2006-04-11 22:33 UTC (permalink / raw)
To: Daniel Drake; +Cc: John Heffner, netdev, linux-kernel
In-Reply-To: <443C2BBA.5010804@gentoo.org>
On Tue, 11 Apr 2006 23:20:42 +0100
Daniel Drake <dsd@gentoo.org> wrote:
> John Heffner wrote:
> > This is almost certainly due to a buggy firewall that doesn't understand
> > TCP window scaling. I've usually seen this in the past with OpenBSD
> > firewalls. Do you have one of these in your path?
>
> At home I'm behind a Linux gateway box currently running 2.6.15-rc6 - I
> am connected through ethernet to that.
>
> At my student house I am connected wirelessly to a Linksys WRT54Gv5
> router (the model that doesnt run Linux).
>
> I have reproduced it at both those locations (same ISP).
>
> This is very familiar, and I just found the article I was thinking of:
> http://lwn.net/Articles/92727/
>
> I was also hit by that bug, on the same collection of websites, but that
> particular problem was fixed for 2.6.8 or so. So I guess it is extremely
> likely that my ISP has broken routers. nmap isn't able to identify the
> OS of any ISP routers in my path.
We never fixed it, its kind of hard to fix other peoples equipment ;-)
>
> It's a huge ISP over here, so contacting them over technical matters is
> not easy...
>
> Thanks,
> Daniel
>
Turn off TCP window scaling, your performance will be limited but about
as good as you can get with a corrupting firewall in between.
^ permalink raw reply
* Re: [RFC/PATCH] remove unneeded check in bcm43xx
From: Benoit Boissinot @ 2006-04-11 22:30 UTC (permalink / raw)
To: Benjamin Herrenschmidt
Cc: David S. Miller, mb, netdev, bcm43xx-dev, linux-kernel, linville
In-Reply-To: <1144794077.19353.53.camel@localhost.localdomain>
On Wed, Apr 12, 2006 at 08:21:17AM +1000, Benjamin Herrenschmidt wrote:
>
> > I still think we shouldn't reward shit hardware by complicating
> > up our DMA mappings internals. :-)
>
> BTW. In the meantime, can't that driver work in PIO only mode ?
yes, I think you just have to have the pci_set_dma_mask fail with
DMA30BIT_MASK.
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: Benjamin Herrenschmidt @ 2006-04-11 22:21 UTC (permalink / raw)
To: David S. Miller
Cc: benoit.boissinot, mb, netdev, bcm43xx-dev, linux-kernel, linville
In-Reply-To: <20060411.143407.74615246.davem@davemloft.net>
> I still think we shouldn't reward shit hardware by complicating
> up our DMA mappings internals. :-)
BTW. In the meantime, can't that driver work in PIO only mode ?
Ben.
^ permalink raw reply
* Re: 2.6.17 regression: Very slow net transfer from some hosts
From: Daniel Drake @ 2006-04-11 22:20 UTC (permalink / raw)
To: John Heffner; +Cc: netdev, linux-kernel
In-Reply-To: <443C178B.3030805@psc.edu>
John Heffner wrote:
> This is almost certainly due to a buggy firewall that doesn't understand
> TCP window scaling. I've usually seen this in the past with OpenBSD
> firewalls. Do you have one of these in your path?
At home I'm behind a Linux gateway box currently running 2.6.15-rc6 - I
am connected through ethernet to that.
At my student house I am connected wirelessly to a Linksys WRT54Gv5
router (the model that doesnt run Linux).
I have reproduced it at both those locations (same ISP).
This is very familiar, and I just found the article I was thinking of:
http://lwn.net/Articles/92727/
I was also hit by that bug, on the same collection of websites, but that
particular problem was fixed for 2.6.8 or so. So I guess it is extremely
likely that my ISP has broken routers. nmap isn't able to identify the
OS of any ISP routers in my path.
It's a huge ISP over here, so contacting them over technical matters is
not easy...
Thanks,
Daniel
^ permalink raw reply
* Re: [RFC/PATCH] remove unneeded check in bcm43xx
From: Benjamin Herrenschmidt @ 2006-04-11 22:20 UTC (permalink / raw)
To: David S. Miller
Cc: benoit.boissinot, mb, netdev, bcm43xx-dev, linux-kernel, linville
In-Reply-To: <20060411.143407.74615246.davem@davemloft.net>
On Tue, 2006-04-11 at 14:34 -0700, David S. Miller wrote:
> I still think we shouldn't reward shit hardware by complicating
> up our DMA mappings internals. :-)
Heh, it's a good point but in that specific case, it's a bit difficult
to tell that to users who don't have a choice of what card to put in
apple proprietary slot ... =P
> If you're going to do it anyways, we use a nearly identical
> allocation bitmap algorithm under sparc64 so maybe you can
> take a stab at trying to put your code there too. I'm more
> than happy to test and integrate.
I may give it a go later this week. I don't have a wireless card in my
g5 so I'll need to ping-pong the patch with testers first tho.
Ben.
^ permalink raw reply
* Re: [RFC/PATCH] remove unneeded check in bcm43xx
From: David S. Miller @ 2006-04-11 21:34 UTC (permalink / raw)
To: benh; +Cc: benoit.boissinot, mb, netdev, bcm43xx-dev, linux-kernel, linville
In-Reply-To: <1144788541.19353.41.camel@localhost.localdomain>
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Date: Wed, 12 Apr 2006 06:49:00 +1000
> I would tend to agree... except that the broadcom is _the_ wireless
> card shipped by Apple with all of their machines for the last few
> years, and thus, the problem will be hit by pretty much any G5 user
> trying to use theirs...
>
> I don't have another idea on how to fix that at hand... a dma mask
> limit in the iommu layer is fairly easy to implement with our iommu
> implementation (though it wouldn't work on pseries where ranges are
> allocated per slot, but it would work fine on a g5). Still sounds
> better than introducing a ZONE_DMA separate from ZONE_NORMAL ...
I still think we shouldn't reward shit hardware by complicating
up our DMA mappings internals. :-)
If you're going to do it anyways, we use a nearly identical
allocation bitmap algorithm under sparc64 so maybe you can
take a stab at trying to put your code there too. I'm more
than happy to test and integrate.
Thanks.
^ permalink raw reply
* Re: 2.6.17 regression: Very slow net transfer from some hosts
From: John Heffner @ 2006-04-11 20:54 UTC (permalink / raw)
To: Daniel Drake; +Cc: netdev, linux-kernel
In-Reply-To: <443C1738.20605@gentoo.org>
This is almost certainly due to a buggy firewall that doesn't understand
TCP window scaling. I've usually seen this in the past with OpenBSD
firewalls. Do you have one of these in your path?
Thanks,
-John
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox