Re: [1/1] netlink: fix broadcasting to the wrong group.

2006-04-18 Thread Evgeniy Polyakov
On Tue, Apr 18, 2006 at 08:00:25AM +0200, Patrick McHardy ([EMAIL PROTECTED]) 
wrote:
 Again, bind() takes a bitmask of the groups to subscribe to, not the
 numerical value 5. To subscribe to group 5 using bind, you use 1(5-1)
 as nladdr, which is 0x1. Check out the difference between
 RTMGRP_NOTIFY (backwards compatibility for bind()) and RTNLGRP_NOTIFY
 (used internally and for NETLINK_ADD_MEMBERSHIP).
  
  
  I.e. bind nladdr is an optimisation for several calls of
  NETLINK_ADD_MEMBERSHIP, as long as socket setup in netlink table?
 
 No, its not an optimization, its there for backwards compatibility.
 Otherwise the cleanest solution would have been to remove group
 subscription from bind().
 
  And thus bind(5) is equal to subscribe(1); subscribe(3).
 
 Yes, except that it will also unsubscribe from all other groups = 32.
 
 Easiest way to avoid problems is to first call bind() with a group mask
 of 0, then use setsockopt() to subscribe to groups.


Ok, this clarifies things a lot.
Thank you.

-- 
Evgeniy Polyakov
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


e1000 breakage in git-netdev-all

2006-04-18 Thread Andrew Morton

A bunch of e1000 changes just hit Jeff's tree.

I hit this.

skb_over_panic: text:803b7dc5 len:3028 put:1514 head:81017f83e870 
data:81017f83e882 tail:81017f83f456 end:81017f83ee70 dev:eth0
--- [cut here ] - [please bite here ] -
Kernel BUG at net/core/skbuff.c:94
invalid opcode:  [1] PREEMPT SMP 
last sysfs file: /class/vc/vcsa5/dev
CPU 3 
Modules linked in: pcmcia yenta_socket rsrc_nonstatic pcmcia_core video 
sony_acpi
Pid: 11697, comm: cc1 Not tainted 2.6.17-rc1-mm3 #66
RIP: 0010:[8043f2d6] 8043f2d6{skb_over_panic+78}
RSP: :81017fd1be28  EFLAGS: 00010292
RAX: 009b RBX:  RCX: 0213
RDX: 805ddad8 RSI: 0213 RDI: 0001
RBP: 81017fd1be48 R08: 805ddad8 R09: 0061
R10: 0061 R11:  R12: 81017fb31500
R13: 81017f8e4548 R14: 05ea R15: 003b
FS:  2b7e4f259b00() GS:81017fc74b20() knlGS:
CS:  0010 DS:  ES:  CR0: 80050033
CR2: 2b7e547db000 CR3: 00016098a000 CR4: 06e0
Process cc1 (pid: 11697, threadinfo 81015c6aa000, task 8101791120d0)
Stack: 81017f83f456 81017f83ee70 81017fb31000 81017f83f456 
   81017fd1bed8 803b7dd0 23ff81017fd1be68 00010001 
   c2010760 c2010740 
Call Trace: IRQ 803b7dd0{e1000_clean_rx_irq+836}
   803b79be{e1000_intr+173} 
8024f26b{handle_IRQ_event+48}
   8024f344{__do_IRQ+163} 8020bcd5{do_IRQ+50}
   80209d84{ret_from_intr+0} EOI

Code: 0f 0b 68 2b 74 52 80 c2 5e 00 c9 c3 55 49 89 d2 48 89 e5 52 
RIP 8043f2d6{skb_over_panic+78} RSP 81017fd1be28

The machine was being used as a distcc server at the time - just basic TCP
stuff.

I'll drop Jeff's tree for now.  Please let me know when we have a fix.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] ip_route_input panic fix

2006-04-18 Thread Herbert Xu
Stephen Hemminger [EMAIL PROTECTED] wrote:
 
 --- linux-2.6.16.6.orig/net/ipv4/route.c
 +++ linux-2.6.16.6/net/ipv4/route.c
 @@ -2750,7 +2750,10 @@ int inet_rtm_getroute(struct sk_buff *in
/* Reserve room for dummy headers, this skb can pass
   through good chunk of routing engine.
 */
 -   skb-mac.raw = skb-data;
 +   skb-mac.raw = skb-nh.raw = skb-data;
 +
 +   /* Bugfix: need to give ip_route_input enough of an IP header to not 
 gag. */
 +   skb-nh.iph-protocol = IPPROTO_ICMP;

Looking at this again, the root of this problem is the IGMPv3
patch which started using the skb-nh.iph-protocol as a key.

So what we really should do is make the protocol an explicit parameter
to the ip_route_input function.  This will make it clear to all the
users which include some pretty weird cases that the protocol is needed.

In fact I'm unsure as to whether all the other users of ip_route_input
is safe as it is regarding the protocol.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmVHI~} [EMAIL PROTECTED]
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[TCP]: Fix truesize underflow

2006-04-18 Thread Herbert Xu
Hi Dave:

You're absolutely right about there being a problem with the TSO packet
trimming code.  The cause of this lies in the tcp_fragment() function.

When we allocate a fragment for a completely non-linear packet the
truesize is calculated for a payload length of zero.  This means that
truesize could in fact be less than the real payload length.

When that happens the TSO packet trimming can cause truesize to become
negative.  This in turn can cause sk_forward_alloc to be -n * PAGE_SIZE
which would trigger the warning.

I've copied the code you used in tso_fragment which should work here.

Signed-off-by: Herbert Xu [EMAIL PROTECTED]

Everyone who's having the sk_forward_alloc warning problem should give
this patch a go to see if it cures things.

Just in case this still doesn't fix it, could everyone please also verify
whether disabling SMP has any effect on reproducing this?

Thanks,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmVHI~} [EMAIL PROTECTED]
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index b871db6..44df1db 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -551,7 +551,9 @@
buff = sk_stream_alloc_skb(sk, nsize, GFP_ATOMIC);
if (buff == NULL)
return -ENOMEM; /* We'll just try again later. */
-   sk_charge_skb(sk, buff);
+
+   buff-truesize = skb-len - len;
+   skb-truesize -= buff-truesize;
 
/* Correct the sequence numbers. */
TCP_SKB_CB(buff)-seq = TCP_SKB_CB(skb)-seq + len;


Re: [RFC: 2.6 patch] net/netlink/: possible cleanups

2006-04-18 Thread Adrian Bunk
On Fri, Apr 14, 2006 at 02:56:12PM +0400, Evgeniy Polyakov wrote:
...
 Although it is always statically built systems, it is still very
 convenient way of netlink usage for others (future modular systems).

I do understand Dave's new API, users are expected soon point.

OTOH, we also have to always check whether users are expected soon (and 
recheck whether there are really users after some time) since every 
single export makes the kernel larger for nearly everyone.

   Evgeniy Polyakov

cu
Adrian

-- 

   Is there not promise of rain? Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
   Only a promise, Lao Er said.
   Pearl S. Buck - Dragon Seed

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] sync bcm43xx-d80211 to bcm43xx

2006-04-18 Thread Michael Buesch
Hi John,

I already sent these three patches for inclusion into
the softmac version of the driver. Here are the devicescape
port versions for inclusion in your wireless-dev tree.

-- 
Greetings Michael.
Index: wireless-dev-ds/drivers/net/wireless/bcm43xx-d80211/bcm43xx.h
===
--- wireless-dev-ds.orig/drivers/net/wireless/bcm43xx-d80211/bcm43xx.h	2006-04-18 16:33:23.0 +0200
+++ wireless-dev-ds/drivers/net/wireless/bcm43xx-d80211/bcm43xx.h	2006-04-18 16:38:10.0 +0200
@@ -18,7 +18,6 @@
 
 #include bcm43xx_debugfs.h
 #include bcm43xx_leds.h
-#include bcm43xx_sysfs.h
 
 
 #define PFXKBUILD_MODNAME : 
@@ -628,8 +627,6 @@
 };
 
 struct bcm43xx_private {
-	struct bcm43xx_sysfs sysfs;
-
 	struct ieee80211_hw *ieee;
 	struct ieee80211_low_level_stats ieee_stats;
 	int iw_mode;
@@ -843,6 +840,20 @@
 	return phy-_lo_pairs + (radio_attenuation + 14 * (baseband_attenuation / 2));
 }
 
+struct device;
+
+static inline
+struct bcm43xx_private * dev_to_bcm(struct device *dev)
+{
+	struct net_device *net_dev;
+	struct bcm43xx_private *bcm;
+
+	net_dev = dev_get_drvdata(dev);
+	bcm = bcm43xx_priv(net_dev);
+
+	return bcm;
+}
+
 
 static inline
 u16 bcm43xx_read16(struct bcm43xx_private *bcm, u16 offset)
Index: wireless-dev-ds/drivers/net/wireless/bcm43xx-d80211/bcm43xx_main.c
===
--- wireless-dev-ds.orig/drivers/net/wireless/bcm43xx-d80211/bcm43xx_main.c	2006-04-18 16:33:23.0 +0200
+++ wireless-dev-ds/drivers/net/wireless/bcm43xx-d80211/bcm43xx_main.c	2006-04-18 16:37:48.0 +0200
@@ -52,6 +52,7 @@
 #include bcm43xx_sysfs.h
 #include bcm43xx_ethtool.h
 #include bcm43xx_xmit.h
+#include bcm43xx_sysfs.h
 
 
 MODULE_DESCRIPTION(Broadcom BCM43xx wireless driver);
Index: wireless-dev-ds/drivers/net/wireless/bcm43xx-d80211/bcm43xx_sysfs.c
===
--- wireless-dev-ds.orig/drivers/net/wireless/bcm43xx-d80211/bcm43xx_sysfs.c	2006-04-18 16:33:23.0 +0200
+++ wireless-dev-ds/drivers/net/wireless/bcm43xx-d80211/bcm43xx_sysfs.c	2006-04-18 16:37:48.0 +0200
@@ -71,14 +71,46 @@
 	return -EINVAL;
 }
 
+static int sprom2hex(const u16 *sprom, char *buf, size_t buf_len)
+{
+	int i, pos = 0;
+
+	for (i = 0; i  BCM43xx_SPROM_SIZE; i++) {
+		pos += snprintf(buf + pos, buf_len - pos - 1,
+%04X, swab16(sprom[i])  0x);
+	}
+	pos += snprintf(buf + pos, buf_len - pos - 1, \n);
+
+	return pos + 1;
+}
+
+static int hex2sprom(u16 *sprom, const char *dump, size_t len)
+{
+	char tmp[5] = { 0 };
+	int cnt = 0;
+	unsigned long parsed;
+
+	if (len  BCM43xx_SPROM_SIZE * sizeof(u16) * 2)
+		return -EINVAL;
+
+	while (cnt  BCM43xx_SPROM_SIZE) {
+		memcpy(tmp, dump, 4);
+		dump += 4;
+		parsed = simple_strtoul(tmp, NULL, 16);
+		sprom[cnt++] = swab16((u16)parsed);
+	}
+
+	return 0;
+}
+
 static ssize_t bcm43xx_attr_sprom_show(struct device *dev,
    struct device_attribute *attr,
    char *buf)
 {
-	struct bcm43xx_private *bcm = devattr_to_bcm(attr, attr_sprom);
+	struct bcm43xx_private *bcm = dev_to_bcm(dev);
 	u16 *sprom;
 	unsigned long flags;
-	int i, err;
+	int err;
 
 	if (!capable(CAP_NET_ADMIN))
 		return -EPERM;
@@ -91,55 +123,53 @@
 	bcm43xx_lock_mmio(bcm, flags);
 	assert(bcm-initialized);
 	err = bcm43xx_sprom_read(bcm, sprom);
-	if (!err) {
-		for (i = 0; i  BCM43xx_SPROM_SIZE; i++) {
-			buf[i * 2] = sprom[i]  0x00FF;
-			buf[i * 2 + 1] = (sprom[i]  0xFF00)  8;
-		}
-	}
+	if (!err)
+		err = sprom2hex(sprom, buf, PAGE_SIZE);
 	bcm43xx_unlock_mmio(bcm, flags);
 	kfree(sprom);
 
-	return err ? err : BCM43xx_SPROM_SIZE * sizeof(u16);
+	return err;
 }
 
 static ssize_t bcm43xx_attr_sprom_store(struct device *dev,
 	struct device_attribute *attr,
 	const char *buf, size_t count)
 {
-	struct bcm43xx_private *bcm = devattr_to_bcm(attr, attr_sprom);
+	struct bcm43xx_private *bcm = dev_to_bcm(dev);
 	u16 *sprom;
 	unsigned long flags;
-	int i, err;
+	int err;
 
 	if (!capable(CAP_NET_ADMIN))
 		return -EPERM;
 
-	if (count != BCM43xx_SPROM_SIZE * sizeof(u16))
-		return -EINVAL;
 	sprom = kmalloc(BCM43xx_SPROM_SIZE * sizeof(*sprom),
 			GFP_KERNEL);
 	if (!sprom)
 		return -ENOMEM;
-	for (i = 0; i  BCM43xx_SPROM_SIZE; i++) {
-		sprom[i] = buf[i * 2]  0xFF;
-		sprom[i] |= ((u16)(buf[i * 2 + 1]  0xFF))  8;
-	}
+	err = hex2sprom(sprom, buf, count);
+	if (err)
+		goto out_kfree;
 	bcm43xx_lock_mmio(bcm, flags);
 	assert(bcm-initialized);
 	err = bcm43xx_sprom_write(bcm, sprom);
 	bcm43xx_unlock_mmio(bcm, flags);
+out_kfree:
 	kfree(sprom);
 
 	return err ? err : count;
 
 }
 
+static DEVICE_ATTR(sprom, 0600,
+		   bcm43xx_attr_sprom_show,
+		   bcm43xx_attr_sprom_store);
+
 static ssize_t bcm43xx_attr_interfmode_show(struct device *dev,
 	struct device_attribute *attr,
 	char *buf)
 {
-	struct bcm43xx_private *bcm = devattr_to_bcm(attr, attr_interfmode);
+	struct bcm43xx_private *bcm = 

[PATCH 4/4] [IPV6]: Clean up hop-by-hop options handler.

2006-04-18 Thread YOSHIFUJI Hideaki / 吉藤英明
[IPV6]: Clean up hop-by-hop options handler.

- Removed unused argument (nhoff) for ipv6_parse_hopopts().
- Make ipv6_parse_hopopts() to align with other extension header
  handlers.
- Removed pointless assignment (hdr), which is not used afterwards.

Signed-off-by: YOSHIFUJI Hideaki [EMAIL PROTECTED]

---

 include/net/ipv6.h   |2 +-
 net/ipv6/exthdrs.c   |4 ++--
 net/ipv6/ip6_input.c |3 +--
 3 files changed, 4 insertions(+), 5 deletions(-)

e261b91167cad07c4639dffb72ecabedb4ed9e49
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 6d6f063..4abedb8 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -230,7 +230,7 @@ extern int  ip6_ra_control(struct sock
   void (*destructor)(struct sock 
*));
 
 
-extern int ipv6_parse_hopopts(struct sk_buff *skb, int);
+extern int ipv6_parse_hopopts(struct sk_buff *skb);
 
 extern struct ipv6_txoptions *  ipv6_dup_options(struct sock *sk, struct 
ipv6_txoptions *opt);
 extern struct ipv6_txoptions * ipv6_renew_options(struct sock *sk, struct 
ipv6_txoptions *opt,
diff --git a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c
index d88cab7..a18d425 100644
--- a/net/ipv6/exthdrs.c
+++ b/net/ipv6/exthdrs.c
@@ -485,7 +485,7 @@ static struct tlvtype_proc tlvprochopopt
{ -1, }
 };
 
-int ipv6_parse_hopopts(struct sk_buff *skb, int nhoff)
+int ipv6_parse_hopopts(struct sk_buff *skb)
 {
struct inet6_skb_parm *opt = IP6CB(skb);
 
@@ -505,7 +505,7 @@ int ipv6_parse_hopopts(struct sk_buff *s
if (ip6_parse_tlv(tlvprochopopt_lst, skb)) {
skb-h.raw += (skb-h.raw[1]+1)3;
opt-nhoff = sizeof(struct ipv6hdr);
-   return sizeof(struct ipv6hdr);
+   return 1;
}
return -1;
 }
diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c
index 29f7359..aceee25 100644
--- a/net/ipv6/ip6_input.c
+++ b/net/ipv6/ip6_input.c
@@ -114,11 +114,10 @@ int ipv6_rcv(struct sk_buff *skb, struct
}
 
if (hdr-nexthdr == NEXTHDR_HOP) {
-   if (ipv6_parse_hopopts(skb, IP6CB(skb)-nhoff)  0) {
+   if (ipv6_parse_hopopts(skb)  0) {
IP6_INC_STATS_BH(IPSTATS_MIB_INHDRERRORS);
return 0;
}
-   hdr = skb-nh.ipv6h;
}
 
return NF_HOOK(PF_INET6,NF_IP6_PRE_ROUTING, skb, dev, NULL, 
ip6_rcv_finish);
-- 
1.0.8

-- 
YOSHIFUJI Hideaki @ USAGI Project  [EMAIL PROTECTED]
GPG-FP  : 9022 65EB 1ECF 3AD1 0BDF  80D8 4807 F894 E062 0EEA
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/4]: Fix several errors in extension header handling.

2006-04-18 Thread YOSHIFUJI Hideaki / 吉藤英明
Hello.

Following changesets fix several errors in extension header handling.
I'd propose to push them (except 4/4, maybe) to -stable.

[PATCH 1/4] [IPV6]: Ensure to have hop-by-hop options in our header of sk_buff.
[PATCH 2/4] [IPV6] XFRM: Don't use old copy of pointer after pskb_may_pull().
[PATCH 3/4] [IPV6] XFRM: Fix decoding session with preceding extension 
header(s).
[PATCH 4/4] [IPV6]: Clean up hop-by-hop options handler.

Regards,

-- 
YOSHIFUJI Hideaki @ USAGI Project  [EMAIL PROTECTED]
GPG-FP  : 9022 65EB 1ECF 3AD1 0BDF  80D8 4807 F894 E062 0EEA
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/4] [IPV6]: Ensure to have hop-by-hop options in our header of sk_buff.

2006-04-18 Thread YOSHIFUJI Hideaki / 吉藤英明
[IPV6]: Ensure to have hop-by-hop options in our header of sk_buff.

Signed-off-by: YOSHIFUJI Hideaki [EMAIL PROTECTED]

---

 net/ipv6/exthdrs.c |   12 
 1 files changed, 12 insertions(+), 0 deletions(-)

7bcedcc73a45a5577103422c33e01f1633173984
diff --git a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c
index 2a1e7e4..d88cab7 100644
--- a/net/ipv6/exthdrs.c
+++ b/net/ipv6/exthdrs.c
@@ -489,6 +489,18 @@ int ipv6_parse_hopopts(struct sk_buff *s
 {
struct inet6_skb_parm *opt = IP6CB(skb);
 
+   /*
+* skb-nh.raw is equal to skb-data, and
+* skb-h.raw - skb-nh.raw is always equal to
+* sizeof(struct ipv6hdr) by definition of
+* hop-by-hop options.
+*/
+   if (!pskb_may_pull(skb, sizeof(struct ipv6hdr) + 8) ||
+   !pskb_may_pull(skb, sizeof(struct ipv6hdr) + ((skb-h.raw[1] + 1) 
 3))) {
+   kfree_skb(skb);
+   return -1;
+   }
+
opt-hop = sizeof(struct ipv6hdr);
if (ip6_parse_tlv(tlvprochopopt_lst, skb)) {
skb-h.raw += (skb-h.raw[1]+1)3;
-- 
1.0.8

-- 
YOSHIFUJI Hideaki @ USAGI Project  [EMAIL PROTECTED]
GPG-FP  : 9022 65EB 1ECF 3AD1 0BDF  80D8 4807 F894 E062 0EEA
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/4] [IPV6] XFRM: Don't use old copy of pointer after pskb_may_pull().

2006-04-18 Thread YOSHIFUJI Hideaki / 吉藤英明
[IPV6] XFRM: Don't use old copy of pointer after pskb_may_pull().

Signed-off-by: YOSHIFUJI Hideaki [EMAIL PROTECTED]

---

 net/ipv6/xfrm6_policy.c |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

83e25b9fb69b2c04ebfec2ee2b9fe95e5a7c0584
diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c
index 91cce8b..588922b 100644
--- a/net/ipv6/xfrm6_policy.c
+++ b/net/ipv6/xfrm6_policy.c
@@ -193,7 +193,7 @@ _decode_session6(struct sk_buff *skb, st
 {
u16 offset = sizeof(struct ipv6hdr);
struct ipv6hdr *hdr = skb-nh.ipv6h;
-   struct ipv6_opt_hdr *exthdr = (struct ipv6_opt_hdr*)(skb-nh.raw + 
offset);
+   struct ipv6_opt_hdr *exthdr;
u8 nexthdr = skb-nh.ipv6h-nexthdr;
 
memset(fl, 0, sizeof(struct flowi));
@@ -201,6 +201,8 @@ _decode_session6(struct sk_buff *skb, st
ipv6_addr_copy(fl-fl6_src, hdr-saddr);
 
while (pskb_may_pull(skb, skb-nh.raw + offset + 1 - skb-data)) {
+   exthdr = (struct ipv6_opt_hdr*)(skb-nh.raw + offset);
+
switch (nexthdr) {
case NEXTHDR_ROUTING:
case NEXTHDR_HOP:
-- 
1.0.8
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/4] [IPV6] XFRM: Fix decoding session with preceding extension header(s).

2006-04-18 Thread YOSHIFUJI Hideaki / 吉藤英明
[IPV6] XFRM: Fix decoding session with preceding extension header(s).

We did not correctly decode session with preceding extension
header(s).  This was because we had already pulled preceding
headers, skb-nh.raw + 40 + 1 - skb-data was minus, and
pskb_may_pull() failed.

We now have IP6CB(skb)-nhoff and skb-h.raw, and we can
start parsing / decoding upper layer protocol from current
position.

Tracked down by Noriaki TAKAMIYA [EMAIL PROTECTED]
and tested by Kazunori Miyazawa [EMAIL PROTECTED].

Signed-off-by: YOSHIFUJI Hideaki [EMAIL PROTECTED]

---

 net/ipv6/xfrm6_policy.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

2556f141ba4ee513141aaf2a984e98e1e06a8c44
diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c
index 588922b..88c840f 100644
--- a/net/ipv6/xfrm6_policy.c
+++ b/net/ipv6/xfrm6_policy.c
@@ -191,10 +191,10 @@ error:
 static inline void
 _decode_session6(struct sk_buff *skb, struct flowi *fl)
 {
-   u16 offset = sizeof(struct ipv6hdr);
+   u16 offset = skb-h.raw - skb-nh.raw;
struct ipv6hdr *hdr = skb-nh.ipv6h;
struct ipv6_opt_hdr *exthdr;
-   u8 nexthdr = skb-nh.ipv6h-nexthdr;
+   u8 nexthdr = skb-nh.raw[IP6CB(skb)-nhoff];
 
memset(fl, 0, sizeof(struct flowi));
ipv6_addr_copy(fl-fl6_dst, hdr-daddr);
-- 
1.0.8
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [TCP]: Fix truesize underflow

2006-04-18 Thread Ingo Oeser
Hi Herbert,

Herbert Xu wrote:
 I've copied the code you used in tso_fragment which should work here.

I'm happy to see, that this got resolved and this is a nice minimalistic fix 
for -stable. 

But shouldn't we put this kind of hairy manipulation into some nice functions?
Driver writers were already confused by all that size, len and truesize stuff, 
as this bug showed.


Regards

Ingo Oeser
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Patch] Dead code in net/sunrpc/auth_gss/auth_gss.c

2006-04-18 Thread Trond Myklebust
On Tue, 2006-04-18 at 18:07 +0200, Eric Sesterhenn wrote:
 Hi,
 
 the coverity checker spotted that cred is always NULL
 when we jump to out_err ( there is just one case, when
 we fail to allocate the memory for cred )
 This is Coverity ID #79
 
 Signed-off-by: Eric Sesterhenn [EMAIL PROTECTED]
 

I'll take it, but please send sunrpc patches to the NFS lists, not
netdev.

Cheers,
  Trond

 --- linux-2.6.17-rc1/net/sunrpc/auth_gss/auth_gss.c.orig  2006-04-18 
 13:23:22.0 +0200
 +++ linux-2.6.17-rc1/net/sunrpc/auth_gss/auth_gss.c   2006-04-18 
 13:24:10.0 +0200
 @@ -794,7 +794,6 @@ gss_create_cred(struct rpc_auth *auth, s
  
  out_err:
   dprintk(RPC:  gss_create_cred failed with error %d\n, err);
 - if (cred) gss_destroy_cred(cred-gc_base);
   return ERR_PTR(err);
  }
  
 
 
 -
 To unsubscribe from this list: send the line unsubscribe netdev in
 the body of a message to [EMAIL PROTECTED]
 More majordomo info at  http://vger.kernel.org/majordomo-info.html

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC: 2.6 patch] net/netlink/: possible cleanups

2006-04-18 Thread Alan Cox
On Maw, 2006-04-18 at 16:19 +0200, Adrian Bunk wrote:
 OTOH, we also have to always check whether users are expected soon (and 
 recheck whether there are really users after some time) since every 
 single export makes the kernel larger for nearly everyone.

Of course fixing the amount of memory used by an EXPORT_SYMBOL would be
far more productive.

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC: 2.6 patch] net/netlink/: possible cleanups

2006-04-18 Thread Adrian Bunk
On Tue, Apr 18, 2006 at 07:48:41PM +0100, Alan Cox wrote:
 On Maw, 2006-04-18 at 16:19 +0200, Adrian Bunk wrote:
  OTOH, we also have to always check whether users are expected soon (and 
  recheck whether there are really users after some time) since every 
  single export makes the kernel larger for nearly everyone.
 
 Of course fixing the amount of memory used by an EXPORT_SYMBOL would be
 far more productive.

Both is productive.
You can decrease the amount of memory used by an EXPORT_SYMBOL, but you 
can't get it down to 0.

And in some cases the memory used by an EXPORT_SYMBOL mostly consists of 
an otherwise unused function...

cu
Adrian

-- 

   Is there not promise of rain? Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
   Only a promise, Lao Er said.
   Pearl S. Buck - Dragon Seed

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/2] e1000: fix two mispatches

2006-04-18 Thread Kok, Auke

Hi,

This patch series implements two e100 fixes for an old and new patch mishap.

[1] fix mispatch for media type detect.
[2] fix mismerge skb_put.


These changes are available through git.

git://63.64.152.142/~ahkok/git/netdev-2.6 e1000-7.0.38-k2-fixes

these patches are against
 netdev-2.6#upstream 8fc65162a8f25929be80c8d6321a3479e92b5aae


Cheers,

Auke


---
 drivers/net/e1000/e1000_main.c |5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)


--
Auke Kok [EMAIL PROTECTED]
Intel Pro Ethernet Driver Group
LAN Access Division / Digital Enterprise Group 
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/2] e1000: fix mispatch for media type detect.

2006-04-18 Thread Kok, Auke

Recent patch was mismerged in the miitool path. e1000_media_type_copper
was being compared with the phy type instead of the media type.


Signed-off-by: Jesse Brandeburg [EMAIL PROTECTED]
Signed-off-by: Auke Kok [EMAIL PROTECTED]
---

 drivers/net/e1000/e1000_main.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 82d443b..2b8bced 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -4174,7 +4174,7 @@ e1000_mii_ioctl(struct net_device *netde
spin_unlock_irqrestore(adapter-stats_lock, flags);
return -EIO;
}
-   if (adapter-hw.phy_type == e1000_media_type_copper) {
+   if (adapter-hw.media_type == e1000_media_type_copper) {
switch (data-reg_num) {
case PHY_CTRL:
if (mii_reg  MII_CR_POWER_DOWN)



--
Auke Kok [EMAIL PROTECTED]
Intel Pro Ethernet Driver Group
LAN Access Division / Digital Enterprise Group 
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/2] e1000: fix mismerge skb_put.

2006-04-18 Thread Kok, Auke

Seems there was a bit of a fix needed to due a bad merge in the legacy
receive path.  Fixes a panic due to skb_over_panic.

Signed-off-by: Jesse Brandeburg [EMAIL PROTECTED]
Signed-off-by: Auke Kok [EMAIL PROTECTED]
---

 drivers/net/e1000/e1000_main.c |3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 2b8bced..fb8cef6 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -3585,8 +3585,7 @@ e1000_clean_rx_irq(struct e1000_adapter 
buffer_info-skb = skb;
goto next_desc;
}
-   } else
-   skb_put(skb, length);
+   }
 
/* code added for copybreak, this should improve
 * performance for small packets with large amounts



--
Auke Kok [EMAIL PROTECTED]
Intel Pro Ethernet Driver Group
LAN Access Division / Digital Enterprise Group 
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC PATCH 1/8] pcmcia: add new ID to pcnet_cs

2006-04-18 Thread Dominik Brodowski
Please review these patches which I inted to push upstream for 2.6.17 soon.
Thanks,
Dominik

Subject: [PATCH] pcmcia: add new ID to pcnet_cs

This adds a new ID to pcnet_cs, as noted by Kuro Moji.

Signed-off-by: Dominik Brodowski [EMAIL PROTECTED]

---

 drivers/net/pcmcia/pcnet_cs.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

af6f85925c2984c3596ba480c19573e55724bbdf
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c
index 506e777..d090df4 100644
--- a/drivers/net/pcmcia/pcnet_cs.c
+++ b/drivers/net/pcmcia/pcnet_cs.c
@@ -1639,6 +1639,7 @@ static struct pcmcia_device_id pcnet_ids
PCMCIA_DEVICE_PROD_ID12(CONTEC, C-NET(PC)C-10L, 0x21cab552, 
0xf6f90722),
PCMCIA_DEVICE_PROD_ID12(corega, FEther PCC-TXF, 0x0a21501a, 
0xa51564a2),
PCMCIA_DEVICE_PROD_ID12(corega K.K., corega EtherII PCC-T, 
0x5261440f, 0xfa9d85bd),
+   PCMCIA_DEVICE_PROD_ID12(corega K.K., corega EtherII PCC-TD, 
0x5261440f, 0xc49bd73d),
PCMCIA_DEVICE_PROD_ID12(Corega K.K., corega EtherII PCC-TD, 
0xd4fdcbd8, 0xc49bd73d),
PCMCIA_DEVICE_PROD_ID12(corega K.K., corega Ether PCC-T, 
0x5261440f, 0x6705fcaa),
PCMCIA_DEVICE_PROD_ID12(corega K.K., corega FastEther PCC-TX, 
0x5261440f, 0x485e85d9),
-- 
1.2.6

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [TCP]: Fix truesize underflow

2006-04-18 Thread David S. Miller
From: Ingo Oeser [EMAIL PROTECTED]
Date: Tue, 18 Apr 2006 18:29:59 +0200

 But shouldn't we put this kind of hairy manipulation into some nice
 functions?  Driver writers were already confused by all that size,
 len and truesize stuff, as this bug showed.

It's 2 lines and frankly it's a bit context dependant.  I think
Herbert's fix is fine for now.

In the long term, yes, a lot of these weird manipulations need to
be consolidated in well defined functions to make maintainence
and auditing easier.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [TCP]: Fix truesize underflow

2006-04-18 Thread David S. Miller
From: Herbert Xu [EMAIL PROTECTED]
Date: Tue, 18 Apr 2006 22:32:04 +1000

 You're absolutely right about there being a problem with the TSO packet
 trimming code.  The cause of this lies in the tcp_fragment() function.
 
 When we allocate a fragment for a completely non-linear packet the
 truesize is calculated for a payload length of zero.  This means that
 truesize could in fact be less than the real payload length.
 
 When that happens the TSO packet trimming can cause truesize to become
 negative.  This in turn can cause sk_forward_alloc to be -n * PAGE_SIZE
 which would trigger the warning.
 
 I've copied the code you used in tso_fragment which should work here.
 
 Signed-off-by: Herbert Xu [EMAIL PROTECTED]

Thanks for discovering this, very nice work Herbert.

So what we find out time and time again, is that the TSO splitting and
trimming code enforces that the skb-truesize of every TCP packet must
be accurate at all times.

I think it is deserving of some run time assertions, else these bugs
will elude us continually.  Luckily there are only a few places that
would need the run time assertion checks on skb-truesize, and I'll
try to spend a few cycles on implementing this soon.

Patch applied, thanks a lot!

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] ip_route_input panic fix

2006-04-18 Thread David S. Miller
From: Herbert Xu [EMAIL PROTECTED]
Date: Tue, 18 Apr 2006 16:54:48 +1000

 Looking at this again, the root of this problem is the IGMPv3
 patch which started using the skb-nh.iph-protocol as a key.
 
 So what we really should do is make the protocol an explicit parameter
 to the ip_route_input function.  This will make it clear to all the
 users which include some pretty weird cases that the protocol is needed.
 
 In fact I'm unsure as to whether all the other users of ip_route_input
 is safe as it is regarding the protocol.

There are other areas of the packet which are interpreted in various
ways.  For example, the martian source handling will dump the MAC
directly from skb-mac.raw into the kernel logs.

The output path is so much cleaner, because things like the protocol
are filled out in the struct flowi so there is no need to be parsing
the SKB in any way.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [TCP]: Fix truesize underflow

2006-04-18 Thread Herbert Xu
On Tue, Apr 18, 2006 at 01:22:56PM -0700, David S. Miller wrote:
 
 I think it is deserving of some run time assertions, else these bugs
 will elude us continually.  Luckily there are only a few places that
 would need the run time assertion checks on skb-truesize, and I'll
 try to spend a few cycles on implementing this soon.

Yes indeed.  One place that comes to mind would be tcp_trim_head just
before we munge truesize.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmVHI~} [EMAIL PROTECTED]
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] ip_route_input panic fix

2006-04-18 Thread Alexey Kuznetsov
Hello!

 Looking at this again, the root of this problem is the IGMPv3
 patch which started using the skb-nh.iph-protocol as a key.

No, root is that this fake skb was not properly initialized.
It should, it should be a good real IP skb.


 In fact I'm unsure as to whether all the other users of ip_route_input
 is safe as it is regarding the protocol.

ip_route_input takes skb as an argument exactly because it needs nothing
but skb and there is always an skb, when we input.
ip_route_output would be happy to take an skb as well,
but unfortuntely it happens before we have an skb.

I do not see anything scary here: agree, when skb-nh happens to be undefined,
such skb would crash almost any place in IP stack. :-)


Actually, this weird case in inet_get_route() is the only place, where
a dummy skb is used and it is needed mostly to resolve multicast routes.
In this case this fake skb really passes through all the engine, even
delivered to user space in some sense, and when the route is resolved,
the same skb is submitted to netlink socket. I remember, Dave found
something very bad about this and this even deserved a place in TODO list,
but franky speaking I did not understand what is so wrong with this trick.

Alexey
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] softmac: report SIOCGIWAP event upon association

2006-04-18 Thread Daniel Drake
wpa_supplicant requires some notification when association has completed, and
this is the way to do it.

Before this patch, wpa_supplicant just times out when trying to associate,
even though the association completed successfully in the background. This was
reported at 
http://www.mail-archive.com/bcm43xx-dev@lists.berlios.de/msg00959.html

After this patch, wpa_supplicant works for me. I have tested connecting to a
WEP network.

Signed-off-by: Daniel Drake [EMAIL PROTECTED]

--- linux/net/ieee80211/softmac/ieee80211softmac_assoc.c.orig   2006-04-16 
23:55:23.0 +0100
+++ linux/net/ieee80211/softmac/ieee80211softmac_assoc.c2006-04-19 
01:08:40.0 +0100
@@ -282,6 +282,8 @@ ieee80211softmac_associated(struct ieee8
struct ieee80211_assoc_response * resp,
struct ieee80211softmac_network *net)
 {
+   union iwreq_data wrqu;
+
mac-associnfo.associating = 0;
mac-associated = 1;
if (mac-set_bssid_filter)
@@ -290,6 +292,10 @@ ieee80211softmac_associated(struct ieee8
netif_carrier_on(mac-dev);

mac-association_id = le16_to_cpup(resp-aid);
+
+   wrqu.ap_addr.sa_family = ARPHRD_ETHER;
+   memcpy(wrqu.ap_addr.sa_data, net-bssid, ETH_ALEN);
+   wireless_send_event(mac-dev, SIOCGIWAP, wrqu, NULL);
 }
 
 /* received frame handling functions */
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC: 2.6 patch] net/netlink/: possible cleanups

2006-04-18 Thread Philip Craig
On 04/14/2006 06:26 AM, David S. Miller wrote:
 These interfaces were added so that new users of netlink could
 write their code more easily.

 Unused does not equate to comment out or delete.

Does a GENETLINK Kconfig option make sense (possibly dependant on
EMBEDDED)?  I'm unsure whether these interfaces are going to be used
in core networking code that can't be disabled anyway.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] ip_route_input panic fix

2006-04-18 Thread Alexey Kuznetsov
Hello!

 There is also the ARP code which passes an ARP packet through that
 would get dereferenced as an IP packet.  Granted this shouldn't crash
 because nh is set properly.

And points to something which is not an IP header. So, iph-protocol
is something funny. :-)

It is plain luck that this never happens, ARP packets
with multicast addresses are filtered out.

Mess, I agree.


 But we really should make up our mind as to whether the routing key
 comes from the arguments to ip_route_input (src/dst/...) or the skb.

 Using both is just asking for trouble.

Well, both sets are present only for use the same function in ARP.

So, arguments. Actually, skb can be preserved, but it should not be used
for anything but debugging or for hints, when we should not create
cache entry.


BTW, I cannot figure out what ip_check_mc() tries to do with protocol
(which is __u16 by some reason). If it creates cache entry, protocol
is not checked. Funny.

Alexey
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2.6.16-rc5] S2io: Receive packet classification and steering mechanisms

2006-04-18 Thread Andi Kleen
On Wednesday 19 April 2006 02:38, Ravinandan Arakali wrote:

 configuration: A mask(specified using loadable parameter rth_fn_and_mask)
 can be used to select a subset of TCP/UDP tuple for hash calculation.
 eg. To mask source port for TCP/IPv4 configuration,
 # insmod s2io.ko rx_steering_type=2 rth_fn_and_mask=0x0101
 LSB specifies RTH function type and MSB the mask. A full description
 is provided at the beginning of s2io.c 

I don't think it's a good idea to introduce such weird and hard to understand
module parameters for this.  I would be better to define a generic
internal kernel interface between stack and driver. Perhaps starting
with a standard netlink interface for this might be a good start
until the stack learns how to use this on its own.

 3. MAC address-based:
 Done based on destination MAC address of packet. Xframe can be
 configured with multiple unicast MAC addresses.
 
 configuration: Load-time parameters multi_mac_cnt and multi_macs
 can be used to specify no. of MAC addresses and list of unicast
 addresses.
 eg. insmod s2io.ko rx_steering_type=8 multi_mac_cnt=3 
   multi_macs=00:0c:fc:00:00:22, 00:0c:fc:00:01:22, 00:0c:fc:00:02:22 
 Packets received with default destination MAC address will be steered to 
 ring0. Packets with destination MAC addresses specified by multi_macs are 
 steered to ring1, ring2... respectively.

The obvious way to do this nicely would be to allow to define multiple
virtual interfaces where the mac addresses can be set using the usual ioctls.


-Andi
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] ip_route_input panic fix

2006-04-18 Thread Alexey Kuznetsov
Hello!

 There is also the ARP code which passes an ARP packet through that
 would get dereferenced as an IP packet.  Granted this shouldn't crash
 because nh is set properly.

And point to something which is not an IP header. So, iph-protocol
is something funny. :-)

It is plain luck that this never happens, ARP packets
with multicast addresses are filtered out.

Mess, I agree.


 But we really should make up our mind as to whether the routing key
 comes from the arguments to ip_route_input (src/dst/...) or the skb.

 Using both is just asking for trouble.

Well, both sets are present only for use the same function in ARP.

So, arguments. skb can be even preserved, but it should not be used
for anything but debugging or for hints, when we should not create
cache entry.


BTW, I cannot figure out what ip_check_mc tries to do with protocol
(which is __u16 by some reason). If it creates cache entry, protocol
is not checked. Funny.

Alexey
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/4]: Fix several errors in extension header handling.

2006-04-18 Thread YOSHIFUJI Hideaki / 吉藤英明
In article [EMAIL PROTECTED] (at Tue, 18 Apr 2006 14:49:14 -0700 (PDT)), 
David S. Miller [EMAIL PROTECTED] says:

 All applied, and I agree with pushing 1-3 into -stable,
 please send it.

Done. Thanks.

--yoshfuji
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] ip_route_input panic fix

2006-04-18 Thread David S. Miller
From: Alexey Kuznetsov [EMAIL PROTECTED]
Date: Wed, 19 Apr 2006 03:52:22 +0400

 Actually, this weird case in inet_get_route() is the only place, where
 a dummy skb is used and it is needed mostly to resolve multicast routes.
 In this case this fake skb really passes through all the engine, even
 delivered to user space in some sense, and when the route is resolved,
 the same skb is submitted to netlink socket. I remember, Dave found
 something very bad about this and this even deserved a place in TODO list,
 but franky speaking I did not understand what is so wrong with this trick.

Problem there is via rt_fill_info().  When multicast route cannot be
found by ipmr, it tries to use this netlink SKB to send out a probe.

ipmr_get_route() is the trouble maker.  If ipmr_cache_find() cannot
find an entry, it tries to use the netlink SKB to send out an ipv4
packet, completely mangling it, via ipmr_cache_unresolved().

Even worse it may even free the skb on us, or queue it to
mroute_socket.

It is pure disaster, this entire code path.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 04/10] PCI Error Recovery: e100 network device driver

2006-04-18 Thread akpm

From: [EMAIL PROTECTED] (Linas Vepstas)

Various PCI bus errors can be signaled by newer PCI controllers.  This
patch adds the PCI error recovery callbacks to the intel ethernet e100
device driver.  The patch has been tested, and appears to work well.

Signed-off-by: Linas Vepstas [EMAIL PROTECTED]
Acked-by: Jesse Brandeburg [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/net/e100.c |   75 +++
 1 files changed, 75 insertions(+)

diff -puN drivers/net/e100.c~pci-error-recovery-e100-network-device-driver 
drivers/net/e100.c
--- devel/drivers/net/e100.c~pci-error-recovery-e100-network-device-driver  
2006-04-10 23:21:20.0 -0700
+++ devel-akpm/drivers/net/e100.c   2006-04-10 23:21:20.0 -0700
@@ -2726,6 +2726,80 @@ static void e100_shutdown(struct pci_dev
DPRINTK(PROBE,ERR, Error enabling wake\n);
 }
 
+/* -- PCI Error Recovery infrastructure  -- */
+/**
+ * e100_io_error_detected - called when PCI error is detected.
+ * @pdev: Pointer to PCI device
+ * @state: The current pci conneection state
+ */
+static pci_ers_result_t e100_io_error_detected(struct pci_dev *pdev, 
pci_channel_state_t state)
+{
+   struct net_device *netdev = pci_get_drvdata(pdev);
+
+   /* Similar to calling e100_down(), but avoids adpater I/O. */
+   netdev-stop(netdev);
+
+   /* Detach; put netif into state similar to hotplug unplug. */
+   netif_poll_enable(netdev);
+   netif_device_detach(netdev);
+
+   /* Request a slot reset. */
+   return PCI_ERS_RESULT_NEED_RESET;
+}
+
+/**
+ * e100_io_slot_reset - called after the pci bus has been reset.
+ * @pdev: Pointer to PCI device
+ *
+ * Restart the card from scratch.
+ */
+static pci_ers_result_t e100_io_slot_reset(struct pci_dev *pdev)
+{
+   struct net_device *netdev = pci_get_drvdata(pdev);
+   struct nic *nic = netdev_priv(netdev);
+
+   if (pci_enable_device(pdev)) {
+   printk(KERN_ERR e100: Cannot re-enable PCI device after 
reset.\n);
+   return PCI_ERS_RESULT_DISCONNECT;
+   }
+   pci_set_master(pdev);
+
+   /* Only one device per card can do a reset */
+   if (0 != PCI_FUNC(pdev-devfn))
+   return PCI_ERS_RESULT_RECOVERED;
+   e100_hw_reset(nic);
+   e100_phy_init(nic);
+
+   return PCI_ERS_RESULT_RECOVERED;
+}
+
+/**
+ * e100_io_resume - resume normal operations
+ * @pdev: Pointer to PCI device
+ *
+ * Resume normal operations after an error recovery
+ * sequence has been completed.
+ */
+static void e100_io_resume(struct pci_dev *pdev)
+{
+   struct net_device *netdev = pci_get_drvdata(pdev);
+   struct nic *nic = netdev_priv(netdev);
+
+   /* ack any pending wake events, disable PME */
+   pci_enable_wake(pdev, 0, 0);
+
+   netif_device_attach(netdev);
+   if (netif_running(netdev)) {
+   e100_open(netdev);
+   mod_timer(nic-watchdog, jiffies);
+   }
+}
+
+static struct pci_error_handlers e100_err_handler = {
+   .error_detected = e100_io_error_detected,
+   .slot_reset = e100_io_slot_reset,
+   .resume = e100_io_resume,
+};
 
 static struct pci_driver e100_driver = {
.name = DRV_NAME,
@@ -2737,6 +2811,7 @@ static struct pci_driver e100_driver = {
.resume =   e100_resume,
 #endif
.shutdown = e100_shutdown,
+   .err_handler = e100_err_handler,
 };
 
 static int __init e100_init_module(void)
_
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 01/10] tulip: NatSemi DP83840A PHY fix

2006-04-18 Thread akpm

From: Thibaut VARENE [EMAIL PROTECTED]

Fix a problem with Tulip 21142 HP branded PCI cards (PN#: B5509-66001),
which feature a NatSemi DP83840A PHY.

Without that patch, it is impossible to properly initialize the card's PHY,
and it's thus impossible to monitor/configure it.

It's a timing/posting problem, and it is solved exactly the same way Grant
fixed it elsewhere already.

Signed-off-by: Thibaut VARENE [EMAIL PROTECTED]
Cc: Jeff Garzik [EMAIL PROTECTED]
Acked-by: Grant Grundler [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/net/tulip/media.c |   18 +-
 1 files changed, 17 insertions(+), 1 deletion(-)

diff -puN drivers/net/tulip/media.c~tulip-natsemi-dp83840a-phy-fix 
drivers/net/tulip/media.c
--- devel/drivers/net/tulip/media.c~tulip-natsemi-dp83840a-phy-fix  
2006-04-10 23:21:18.0 -0700
+++ devel-akpm/drivers/net/tulip/media.c2006-04-10 23:21:18.0 
-0700
@@ -261,11 +261,27 @@ void tulip_select_media(struct net_devic
u16 *reset_sequence = 
((u16*)(p+3))[init_length];
int reset_length = p[2 + init_length*2];
misc_info = reset_sequence + reset_length;
-   if (startup)
+   if (startup) {
+   int timeout = 10;   /* max 1 ms */
for (i = 0; i  reset_length; i++)

iowrite32(get_u16(reset_sequence[i])  16, ioaddr + CSR15);
+
+   /* flush posted writes */
+   ioread32(ioaddr + CSR15);
+
+   /* Sect 3.10.3 in DP83840A.pdf (p39) */
+   udelay(500);
+
+   /* Section 4.2 in DP83840A.pdf (p43) */
+   /* and IEEE 802.3 22.2.4.1.1 Reset */
+   while (timeout-- 
+   (tulip_mdio_read (dev, phy_num, 
MII_BMCR)  BMCR_RESET))
+   udelay(100);
+   }
for (i = 0; i  init_length; i++)
iowrite32(get_u16(init_sequence[i])  
16, ioaddr + CSR15);
+
+   ioread32(ioaddr + CSR15);   /* flush posted 
writes */
} else {
u8 *init_sequence = p + 2;
u8 *reset_sequence = p + 3 + init_length;
_
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 08/10] bcm43xx: sysfs code cleanup

2006-04-18 Thread akpm

From: Michael Buesch [EMAIL PROTECTED]

This cleans up the bcm43xx sysfs code and makes it compliant with the
unwritten sysfs rules (at least I hope so).

Signed-off-by: Michael Buesch [EMAIL PROTECTED]
Cc: Jeff Garzik [EMAIL PROTECTED]
Cc: Greg KH [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/net/wireless/bcm43xx/bcm43xx.h   |   17 ++
 drivers/net/wireless/bcm43xx/bcm43xx_main.c  |1 
 drivers/net/wireless/bcm43xx/bcm43xx_sysfs.c |  115 +
 drivers/net/wireless/bcm43xx/bcm43xx_sysfs.h |   16 --
 4 files changed, 82 insertions(+), 67 deletions(-)

diff -puN drivers/net/wireless/bcm43xx/bcm43xx.h~bcm43xx-sysfs-code-cleanup 
drivers/net/wireless/bcm43xx/bcm43xx.h
--- devel/drivers/net/wireless/bcm43xx/bcm43xx.h~bcm43xx-sysfs-code-cleanup 
2006-04-12 18:11:12.0 -0700
+++ devel-akpm/drivers/net/wireless/bcm43xx/bcm43xx.h   2006-04-12 
18:11:12.0 -0700
@@ -15,7 +15,6 @@
 
 #include bcm43xx_debugfs.h
 #include bcm43xx_leds.h
-#include bcm43xx_sysfs.h
 
 
 #define PFXKBUILD_MODNAME : 
@@ -638,8 +637,6 @@ struct bcm43xx_key {
 };
 
 struct bcm43xx_private {
-   struct bcm43xx_sysfs sysfs;
-
struct ieee80211_device *ieee;
struct ieee80211softmac_device *softmac;
 
@@ -772,6 +769,20 @@ struct bcm43xx_private * bcm43xx_priv(st
return ieee80211softmac_priv(dev);
 }
 
+struct device;
+
+static inline
+struct bcm43xx_private * dev_to_bcm(struct device *dev)
+{
+   struct net_device *net_dev;
+   struct bcm43xx_private *bcm;
+
+   net_dev = dev_get_drvdata(dev);
+   bcm = bcm43xx_priv(net_dev);
+
+   return bcm;
+}
+
 
 /* Helper function, which returns a boolean.
  * TRUE, if PIO is used; FALSE, if DMA is used.
diff -puN 
drivers/net/wireless/bcm43xx/bcm43xx_main.c~bcm43xx-sysfs-code-cleanup 
drivers/net/wireless/bcm43xx/bcm43xx_main.c
--- 
devel/drivers/net/wireless/bcm43xx/bcm43xx_main.c~bcm43xx-sysfs-code-cleanup
2006-04-12 18:11:12.0 -0700
+++ devel-akpm/drivers/net/wireless/bcm43xx/bcm43xx_main.c  2006-04-12 
18:11:12.0 -0700
@@ -52,6 +52,7 @@
 #include bcm43xx_wx.h
 #include bcm43xx_ethtool.h
 #include bcm43xx_xmit.h
+#include bcm43xx_sysfs.h
 
 
 MODULE_DESCRIPTION(Broadcom BCM43xx wireless driver);
diff -puN 
drivers/net/wireless/bcm43xx/bcm43xx_sysfs.c~bcm43xx-sysfs-code-cleanup 
drivers/net/wireless/bcm43xx/bcm43xx_sysfs.c
--- 
devel/drivers/net/wireless/bcm43xx/bcm43xx_sysfs.c~bcm43xx-sysfs-code-cleanup   
2006-04-12 18:11:12.0 -0700
+++ devel-akpm/drivers/net/wireless/bcm43xx/bcm43xx_sysfs.c 2006-04-12 
18:11:12.0 -0700
@@ -71,14 +71,46 @@ static int get_boolean(const char *buf, 
return -EINVAL;
 }
 
+static int sprom2hex(const u16 *sprom, char *buf, size_t buf_len)
+{
+   int i, pos = 0;
+
+   for (i = 0; i  BCM43xx_SPROM_SIZE; i++) {
+   pos += snprintf(buf + pos, buf_len - pos - 1,
+   %04X, swab16(sprom[i])  0x);
+   }
+   pos += snprintf(buf + pos, buf_len - pos - 1, \n);
+
+   return pos + 1;
+}
+
+static int hex2sprom(u16 *sprom, const char *dump, size_t len)
+{
+   char tmp[5] = { 0 };
+   int cnt = 0;
+   unsigned long parsed;
+
+   if (len  BCM43xx_SPROM_SIZE * sizeof(u16) * 2)
+   return -EINVAL;
+
+   while (cnt  BCM43xx_SPROM_SIZE) {
+   memcpy(tmp, dump, 4);
+   dump += 4;
+   parsed = simple_strtoul(tmp, NULL, 16);
+   sprom[cnt++] = swab16((u16)parsed);
+   }
+
+   return 0;
+}
+
 static ssize_t bcm43xx_attr_sprom_show(struct device *dev,
   struct device_attribute *attr,
   char *buf)
 {
-   struct bcm43xx_private *bcm = devattr_to_bcm(attr, attr_sprom);
+   struct bcm43xx_private *bcm = dev_to_bcm(dev);
u16 *sprom;
unsigned long flags;
-   int i, err;
+   int err;
 
if (!capable(CAP_NET_ADMIN))
return -EPERM;
@@ -91,55 +123,53 @@ static ssize_t bcm43xx_attr_sprom_show(s
bcm43xx_lock_mmio(bcm, flags);
assert(bcm-initialized);
err = bcm43xx_sprom_read(bcm, sprom);
-   if (!err) {
-   for (i = 0; i  BCM43xx_SPROM_SIZE; i++) {
-   buf[i * 2] = sprom[i]  0x00FF;
-   buf[i * 2 + 1] = (sprom[i]  0xFF00)  8;
-   }
-   }
+   if (!err)
+   err = sprom2hex(sprom, buf, PAGE_SIZE);
bcm43xx_unlock_mmio(bcm, flags);
kfree(sprom);
 
-   return err ? err : BCM43xx_SPROM_SIZE * sizeof(u16);
+   return err;
 }
 
 static ssize_t bcm43xx_attr_sprom_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
 {
-   struct bcm43xx_private *bcm = devattr_to_bcm(attr, attr_sprom);
+   

[patch 07/10] forcedeth: suggested cleanups

2006-04-18 Thread akpm

From: Ingo Oeser [EMAIL PROTECTED]

general:
- endian annotation of the ring descriptors

nv_getlen():
- use htons() instead of __constant_htons()
  to improvde readability and let the compiler constant fold it.

nv_rx_process():
- use a real for() loop in processing instead of goto and break
- consolidate rx_errors increment
- count detected rx_length_errors

Signed-off-by: Ingo Oeser [EMAIL PROTECTED]
Cc: Manfred Spraul [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/net/forcedeth.c |   59 --
 1 files changed, 26 insertions(+), 33 deletions(-)

diff -puN drivers/net/forcedeth.c~forcedeth-suggested-cleanups 
drivers/net/forcedeth.c
--- devel/drivers/net/forcedeth.c~forcedeth-suggested-cleanups  2006-04-10 
23:21:26.0 -0700
+++ devel-akpm/drivers/net/forcedeth.c  2006-04-10 23:21:26.0 -0700
@@ -328,17 +328,18 @@ enum {
NvRegMSIXIrqStatus = 0x3f0,
 };
 
-/* Big endian: should work, but is untested */
+/* Big endian: should work, but is untested.
+ * So give arch maintainers a hint here. -ioe */
 struct ring_desc {
-   u32 PacketBuffer;
-   u32 FlagLen;
+   __le32 PacketBuffer;
+   __le32 FlagLen;
 };
 
 struct ring_desc_ex {
-   u32 PacketBufferHigh;
-   u32 PacketBufferLow;
-   u32 TxVlan;
-   u32 FlagLen;
+   __le32 PacketBufferHigh;
+   __le32 PacketBufferLow;
+   __le32 TxVlan;
+   __le32 FlagLen;
 };
 
 typedef union _ring_type {
@@ -1403,7 +1404,7 @@ static int nv_getlen(struct net_device *
int protolen;   /* length as stored in the proto field */
 
/* 1) calculate len according to header */
-   if ( ((struct vlan_ethhdr *)packet)-h_vlan_proto == 
__constant_htons(ETH_P_8021Q)) {
+   if (((struct vlan_ethhdr *)packet)-h_vlan_proto == htons(ETH_P_8021Q)) 
{
protolen = ntohs( ((struct vlan_ethhdr 
*)packet)-h_vlan_encapsulated_proto );
hdrlen = VLAN_HLEN;
} else {
@@ -1453,12 +1454,10 @@ static void nv_rx_process(struct net_dev
u32 vlanflags = 0;
 
 
-   for (;;) {
+   for (; np-cur_rx - np-refill_rx  RX_RING; np-cur_rx++) {
struct sk_buff *skb;
int len;
int i;
-   if (np-cur_rx - np-refill_rx = RX_RING)
-   break;  /* we scanned the whole ring - do not continue 
*/
 
i = np-cur_rx % RX_RING;
if (np-desc_ver == DESC_VER_1 || np-desc_ver == DESC_VER_2) {
@@ -1498,33 +1497,29 @@ static void nv_rx_process(struct net_dev
/* look at what we actually got: */
if (np-desc_ver == DESC_VER_1) {
if (!(Flags  NV_RX_DESCRIPTORVALID))
-   goto next_pkt;
+   continue;
 
if (Flags  NV_RX_ERROR) {
if (Flags  NV_RX_MISSEDFRAME) {
np-stats.rx_missed_errors++;
-   np-stats.rx_errors++;
-   goto next_pkt;
+   goto error_pkt;
}
if (Flags  
(NV_RX_ERROR1|NV_RX_ERROR2|NV_RX_ERROR3)) {
-   np-stats.rx_errors++;
-   goto next_pkt;
+   goto error_pkt;
}
if (Flags  NV_RX_CRCERR) {
np-stats.rx_crc_errors++;
-   np-stats.rx_errors++;
-   goto next_pkt;
+   goto error_pkt;
}
if (Flags  NV_RX_OVERFLOW) {
np-stats.rx_over_errors++;
-   np-stats.rx_errors++;
-   goto next_pkt;
+   goto error_pkt;
}
if (Flags  NV_RX_ERROR4) {
len = nv_getlen(dev, 
np-rx_skbuff[i]-data, len);
if (len  0) {
-   np-stats.rx_errors++;
-   goto next_pkt;
+   np-stats.rx_length_errors++;
+   goto error_pkt;
}
}
/* framing errors are soft errors. */
@@ -1536,28 +1531,25 @@ static void nv_rx_process(struct net_dev
}
} else {
   

[patch 06/10] e100: disable interrupts at boot

2006-04-18 Thread akpm

From: Bjorn Helgaas [EMAIL PROTECTED]

Apparently the Intel PRO/100 device enables interrupts on reset.  Unless
firmware explicitly disables PRO/100 interrupts, we can get a flood of
interrupts when a driver attaches to an unrelated device that happens to
share the PRO/100 IRQ.

This should resolve this irq 11: nobody cared bug report:
http://bugzilla.kernel.org/show_bug.cgi?id=5918

Signed-off-by: Bjorn Helgaas [EMAIL PROTECTED]
Cc: Jesse Brandeburg [EMAIL PROTECTED]
Cc: Jeff Kirsher [EMAIL PROTECTED]
Cc: John Ronciak [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/pci/quirks.c |   57 +
 1 files changed, 57 insertions(+)

diff -puN drivers/pci/quirks.c~e100-disable-interrupts-at-boot 
drivers/pci/quirks.c
--- devel/drivers/pci/quirks.c~e100-disable-interrupts-at-boot  2006-04-14 
23:41:34.0 -0700
+++ devel-akpm/drivers/pci/quirks.c 2006-04-14 23:41:34.0 -0700
@@ -1374,6 +1374,63 @@ static void __devinit quirk_netmos(struc
 }
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NETMOS, PCI_ANY_ID, quirk_netmos);
 
+static void __devinit quirk_e100_interrupt(struct pci_dev *dev)
+{
+   u16 command;
+   u32 bar;
+   u8 __iomem *csr;
+   u8 cmd_hi;
+
+   switch (dev-device) {
+   /* PCI IDs taken from drivers/net/e100.c */
+   case 0x1029:
+   case 0x1030 ... 0x1034:
+   case 0x1038 ... 0x103E:
+   case 0x1050 ... 0x1057:
+   case 0x1059:
+   case 0x1064 ... 0x106B:
+   case 0x1091 ... 0x1095:
+   case 0x1209:
+   case 0x1229:
+   case 0x2449:
+   case 0x2459:
+   case 0x245D:
+   case 0x27DC:
+   break;
+   default:
+   return;
+   }
+
+   /*
+* Some firmware hands off the e100 with interrupts enabled,
+* which can cause a flood of interrupts if packets are
+* received before the driver attaches to the device.  So
+* disable all e100 interrupts here.  The driver will
+* re-enable them when it's ready.
+*/
+   pci_read_config_word(dev, PCI_COMMAND, command);
+   pci_read_config_dword(dev, PCI_BASE_ADDRESS_0, bar);
+
+   if (!(command  PCI_COMMAND_MEMORY) || !bar)
+   return;
+
+   csr = ioremap(bar, 8);
+   if (!csr) {
+   printk(KERN_WARNING PCI: Can't map %s e100 registers\n,
+   pci_name(dev));
+   return;
+   }
+
+   cmd_hi = readb(csr + 3);
+   if (cmd_hi == 0) {
+   printk(KERN_WARNING PCI: Firmware left %s e100 interrupts 
+   enabled, disabling\n, pci_name(dev));
+   writeb(1, csr + 3);
+   }
+
+   iounmap(csr);
+}
+DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, PCI_ANY_ID, quirk_e100_interrupt);
 
 static void __devinit fixup_rev1_53c810(struct pci_dev* dev)
 {
_
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 05/10] e1000: prevent statistics from getting garbled during reset

2006-04-18 Thread akpm

From: Linas Vepstas [EMAIL PROTECTED]

If a PCI bus error/fault triggers a PCI bus reset, attempts to get the
ethernet packet count statistics from the hardware will fail, returning
garbage data upstream.  This patch skips statistics data collection if the
PCI device is not on the bus.

This patch presumes that an earlier patch,
[PATCH] PCI Error Recovery: e1000 network device driver
has already been applied.

Signed-off-by: Linas Vepstas [EMAIL PROTECTED]
Cc: John Ronciak [EMAIL PROTECTED]
Cc: Jesse Brandeburg [EMAIL PROTECTED]
Cc: Jeff Kirsher [EMAIL PROTECTED]
Cc: Jeff Garzik [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/net/e1000/e1000_main.c |8 +++-
 1 files changed, 7 insertions(+), 1 deletion(-)

diff -puN 
drivers/net/e1000/e1000_main.c~e1000-prevent-statistics-from-getting-garbled-during-reset
 drivers/net/e1000/e1000_main.c
--- 
devel/drivers/net/e1000/e1000_main.c~e1000-prevent-statistics-from-getting-garbled-during-reset
 2006-04-14 23:41:34.0 -0700
+++ devel-akpm/drivers/net/e1000/e1000_main.c   2006-04-14 23:41:34.0 
-0700
@@ -3082,14 +3082,20 @@ void
 e1000_update_stats(struct e1000_adapter *adapter)
 {
struct e1000_hw *hw = adapter-hw;
+   struct pci_dev *pdev = adapter-pdev;
unsigned long flags;
uint16_t phy_tmp;
 
 #define PHY_IDLE_ERROR_COUNT_MASK 0x00FF
 
-   /* Prevent stats update while adapter is being reset */
+   /*
+* Prevent stats update while adapter is being reset, or if the pci
+* connection is down.
+*/
if (adapter-link_speed == 0)
return;
+   if (pdev-error_state  pdev-error_state != pci_channel_io_normal)
+   return;
 
spin_lock_irqsave(adapter-stats_lock, flags);
 
_
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 10/10] e1000: fix media_type - phy_type thinko

2006-04-18 Thread akpm

From: Willy TARREAU [EMAIL PROTECTED]

Recent patch cb764326dff0ee51aca0d450e1a292de65661055 introduced a thinko
in e1000_main.c : e1000_media_type_copper is compared to hw.phy_type
instead of hw.media_type.  Original patch proposed by Jesse Brandeburg was
correct, but what has been merged is not.

Acked-by: Jesse Brandeburg [EMAIL PROTECTED]
Cc: Ronciak, John [EMAIL PROTECTED]
Cc: Jeff Garzik [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/net/e1000/e1000_main.c |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

diff -puN drivers/net/e1000/e1000_main.c~e1000-fix-media_type-phy_type-thinko 
drivers/net/e1000/e1000_main.c
--- devel/drivers/net/e1000/e1000_main.c~e1000-fix-media_type-phy_type-thinko   
2006-04-17 21:42:32.0 -0700
+++ devel-akpm/drivers/net/e1000/e1000_main.c   2006-04-17 21:43:30.0 
-0700
@@ -4195,7 +4195,7 @@ e1000_mii_ioctl(struct net_device *netde
spin_unlock_irqrestore(adapter-stats_lock, flags);
return -EIO;
}
-   if (adapter-hw.phy_type == e1000_media_type_copper) {
+   if (adapter-hw.media_type == e1000_media_type_copper) {
switch (data-reg_num) {
case PHY_CTRL:
if (mii_reg  MII_CR_POWER_DOWN)
_
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 02/10] natsemi: Add support for using MII port with no PHY

2006-04-18 Thread akpm

From: Mark Brown [EMAIL PROTECTED]

Provide a module option which configures the natsemi driver to use the
external MII port on the chip but ignore any PHYs that may be attached to it. 
The link state will be left as it was when the driver started and can be
configured via ethtool.  Any PHYs that are present can be accessed via the MII
ioctl()s.

This is useful for systems where the device is connected without a PHY or
where either information or actions outside the scope of the driver are
required in order to use the PHYs.

Signed-off-by: Mark Brown [EMAIL PROTECTED]
Cc: Tim Hockin [EMAIL PROTECTED]
Cc: Jeff Garzik [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/net/natsemi.c |  105 +---
 1 files changed, 67 insertions(+), 38 deletions(-)

diff -puN 
drivers/net/natsemi.c~natsemi-add-support-for-using-mii-port-with-no-phy 
drivers/net/natsemi.c
--- 
devel/drivers/net/natsemi.c~natsemi-add-support-for-using-mii-port-with-no-phy  
2006-04-10 23:21:19.0 -0700
+++ devel-akpm/drivers/net/natsemi.c2006-04-10 23:21:19.0 -0700
@@ -259,7 +259,7 @@ MODULE_PARM_DESC(debug, DP8381x default
 MODULE_PARM_DESC(rx_copybreak, 
DP8381x copy breakpoint for copy-only-tiny-frames);
 MODULE_PARM_DESC(options, 
-   DP8381x: Bits 0-3: media type, bit 17: full duplex);
+   DP8381x: Bits 0-3: media type, bit 17: full duplex, bit 18: ignore 
PHY);
 MODULE_PARM_DESC(full_duplex, DP8381x full duplex setting(s) (1));
 
 /*
@@ -690,6 +690,8 @@ struct netdev_private {
u32 intr_status;
/* Do not touch the nic registers */
int hands_off;
+   /* Don't pay attention to the reported link state. */
+   int ignore_phy;
/* external phy that is used: only valid if dev-if_port != PORT_TP */
int mii;
int phy_addr_external;
@@ -894,7 +896,19 @@ static int __devinit natsemi_probe1 (str
np-intr_status = 0;
np-eeprom_size = NATSEMI_DEF_EEPROM_SIZE;
 
+   option = find_cnt  MAX_UNITS ? options[find_cnt] : 0;
+   if (dev-mem_start)
+   option = dev-mem_start;
+
+   /* Ignore the PHY status? */
+   if (option  0x400) {
+   np-ignore_phy = 1;
+   } else {
+   np-ignore_phy = 0;
+   }
+
/* Initial port:
+* - If configured to ignore the PHY set up for external.
 * - If the nic was configured to use an external phy and if find_mii
 *   finds a phy: use external port, first phy that replies.
 * - Otherwise: internal port.
@@ -902,7 +916,7 @@ static int __devinit natsemi_probe1 (str
 * The address would be used to access a phy over the mii bus, but
 * the internal phy is accessed through mapped registers.
 */
-   if (readl(ioaddr + ChipConfig)  CfgExtPhy)
+   if (np-ignore_phy || readl(ioaddr + ChipConfig)  CfgExtPhy)
dev-if_port = PORT_MII;
else
dev-if_port = PORT_TP;
@@ -912,7 +926,9 @@ static int __devinit natsemi_probe1 (str
 
if (dev-if_port != PORT_TP) {
np-phy_addr_external = find_mii(dev);
-   if (np-phy_addr_external == PHY_ADDR_NONE) {
+   /* If we're ignoring the PHY it doesn't matter if we can't
+* find one. */
+   if (!np-ignore_phy  np-phy_addr_external == PHY_ADDR_NONE) {
dev-if_port = PORT_TP;
np-phy_addr_external = PHY_ADDR_INTERNAL;
}
@@ -920,10 +936,6 @@ static int __devinit natsemi_probe1 (str
np-phy_addr_external = PHY_ADDR_INTERNAL;
}
 
-   option = find_cnt  MAX_UNITS ? options[find_cnt] : 0;
-   if (dev-mem_start)
-   option = dev-mem_start;
-
/* The lower four bits are the media type. */
if (option) {
if (option  0x200)
@@ -957,7 +969,10 @@ static int __devinit natsemi_probe1 (str
if (mtu)
dev-mtu = mtu;
 
-   netif_carrier_off(dev);
+   if (np-ignore_phy)
+   netif_carrier_on(dev);
+   else
+   netif_carrier_off(dev);
 
/* get the initial settings from hardware */
tmp= mdio_read(dev, MII_BMCR);
@@ -1005,6 +1020,8 @@ static int __devinit natsemi_probe1 (str
printk(%02x, IRQ %d, dev-dev_addr[i], irq);
if (dev-if_port == PORT_TP)
printk(, port TP.\n);
+   else if (np-ignore_phy)
+   printk(, port MII, ignoring PHY\n);
else
printk(, port MII, phy ad %d.\n, 
np-phy_addr_external);
}
@@ -1685,42 +1702,44 @@ static void check_link(struct net_device
 {
struct netdev_private *np = netdev_priv(dev);
void __iomem * ioaddr = ns_ioaddr(dev);
-   int duplex;
+   int duplex = np-full_duplex;
u16 bmsr;
-   
-   /* The link status 

[patch 09/10] bcm43xx: fix pctl slowclock limit calculation

2006-04-18 Thread akpm

From: Michael Buesch [EMAIL PROTECTED]

This fixes coverity bug:
http://marc.theaimsgroup.com/?l=linux-netdevm=114417628413880w=2

Signed-off-by: Michael Buesch [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/net/wireless/bcm43xx/bcm43xx_power.c |  115 ++---
 drivers/net/wireless/bcm43xx/bcm43xx_power.h |9 +
 2 files changed, 77 insertions(+), 47 deletions(-)

diff -puN 
drivers/net/wireless/bcm43xx/bcm43xx_power.c~bcm43xx-fix-pctl-slowclock-limit-calculation
 drivers/net/wireless/bcm43xx/bcm43xx_power.c
--- 
devel/drivers/net/wireless/bcm43xx/bcm43xx_power.c~bcm43xx-fix-pctl-slowclock-limit-calculation
 2006-04-12 18:12:22.0 -0700
+++ devel-akpm/drivers/net/wireless/bcm43xx/bcm43xx_power.c 2006-04-12 
18:12:22.0 -0700
@@ -35,77 +35,101 @@
 #include bcm43xx_main.h
 
 
+/* Get the Slow Clock Source */
+static int bcm43xx_pctl_get_slowclksrc(struct bcm43xx_private *bcm)
+{
+   u32 tmp;
+   int err;
+
+   assert(bcm-current_core == bcm-core_chipcommon);
+   if (bcm-current_core-rev  6) {
+   if (bcm-bustype == BCM43xx_BUSTYPE_PCMCIA ||
+   bcm-bustype == BCM43xx_BUSTYPE_SB)
+   return BCM43xx_PCTL_CLKSRC_XTALOS;
+   if (bcm-bustype == BCM43xx_BUSTYPE_PCI) {
+   err = bcm43xx_pci_read_config32(bcm, BCM43xx_PCTL_OUT, 
tmp);
+   assert(!err);
+   if (tmp  0x10)
+   return BCM43xx_PCTL_CLKSRC_PCI;
+   return BCM43xx_PCTL_CLKSRC_XTALOS;
+   }
+   }
+   if (bcm-current_core-rev  10) {
+   tmp = bcm43xx_read32(bcm, BCM43xx_CHIPCOMMON_SLOWCLKCTL);
+   tmp = 0x7;
+   if (tmp == 0)
+   return BCM43xx_PCTL_CLKSRC_LOPWROS;
+   if (tmp == 1)
+   return BCM43xx_PCTL_CLKSRC_XTALOS;
+   if (tmp == 2)
+   return BCM43xx_PCTL_CLKSRC_PCI;
+   }
+
+   return BCM43xx_PCTL_CLKSRC_XTALOS;
+}
+
 /* Get max/min slowclock frequency
  * as described in http://bcm-specs.sipsolutions.net/PowerControl
  */
 static int bcm43xx_pctl_clockfreqlimit(struct bcm43xx_private *bcm,
   int get_max)
 {
-   int limit = 0;
+   int limit;
+   int clocksrc;
int divisor;
-   int selection;
-   int err;
u32 tmp;
-   struct bcm43xx_coreinfo *old_core;
 
-   if (!(bcm-chipcommon_capabilities  BCM43xx_CAPABILITIES_PCTL))
-   goto out;
-   old_core = bcm-current_core;
-   err = bcm43xx_switch_core(bcm, bcm-core_chipcommon);
-   if (err)
-   goto out;
+   assert(bcm-chipcommon_capabilities  BCM43xx_CAPABILITIES_PCTL);
+   assert(bcm-current_core == bcm-core_chipcommon);
 
+   clocksrc = bcm43xx_pctl_get_slowclksrc(bcm);
if (bcm-current_core-rev  6) {
-   if ((bcm-bustype == BCM43xx_BUSTYPE_PCMCIA) ||
-   (bcm-bustype == BCM43xx_BUSTYPE_SB)) {
-   selection = 1;
+   switch (clocksrc) {
+   case BCM43xx_PCTL_CLKSRC_PCI:
+   divisor = 64;
+   break;
+   case BCM43xx_PCTL_CLKSRC_XTALOS:
divisor = 32;
-   } else {
-   err = bcm43xx_pci_read_config32(bcm, BCM43xx_PCTL_OUT, 
tmp);
-   if (err) {
-   printk(KERN_ERR PFX clockfreqlimit pcicfg read 
failure\n);
-   goto out_switchback;
-   }
-   if (tmp  0x10) {
-   /* PCI */
-   selection = 2;
-   divisor = 64;
-   } else {
-   /* XTAL */
-   selection = 1;
-   divisor = 32;
-   }
+   break;
+   default:
+   assert(0);
+   divisor = 1;
}
} else if (bcm-current_core-rev  10) {
-   selection = (tmp  0x07);
-   if (selection) {
+   switch (clocksrc) {
+   case BCM43xx_PCTL_CLKSRC_LOPWROS:
+   divisor = 1;
+   break;
+   case BCM43xx_PCTL_CLKSRC_XTALOS:
+   case BCM43xx_PCTL_CLKSRC_PCI:
tmp = bcm43xx_read32(bcm, 
BCM43xx_CHIPCOMMON_SLOWCLKCTL);
-   divisor = 4 * (1 + ((tmp  0x)  16));
-   } else
+   divisor = ((tmp  0x)  16) + 1;
+   divisor *= 4;
+   break;
+   default:
+   assert(0);
divisor = 1;
+