Re: [Bugme-new] [Bug 7541] New: dhcp + suspend-to-RAM sometimes trashes the NIC

2006-11-17 Thread Andrew Morton
On Thu, 16 Nov 2006 23:37:18 -0800
[EMAIL PROTECTED] wrote:

 http://bugzilla.kernel.org/show_bug.cgi?id=7541
 
Summary: dhcp + suspend-to-RAM sometimes trashes the NIC
 Kernel Version: 2.6.17.7
 Status: NEW
   Severity: normal
  Owner: [EMAIL PROTECTED]
  Submitter: [EMAIL PROTECTED]
 
 
 Most recent kernel where this bug did *NOT* occur: Sorry, dunno
 Distribution: Debian
 Hardware Environment: Fujitsu P-2040 laptop
 Software Environment: dhcp-client 2.0pl5-19.4 (debian)
 Problem Description:
 
 I have hit this bug ever since I started using DHCP. Prior to DHCP, I never 
 had
 a problem with suspend to RAM.
 
 Steps to reproduce:
 
 My laptop travels from home to work and back. Every time I switch on, I run
 ifdown eth0 and ifup eth0 to switch to the appropriate network configured
 using DHCP. Usually, this works fine. Here's my ethernet chipset:
 
 00:12.0 Ethernet controller: Realtek Semiconductor Co., Ltd.
 RTL-8139/8139C/8139C+ (rev 10)
 
 Anyway, sometimes, maybe once a week, something goes wrong and I get this 
 error:
 
 SIOCSIFFLAGS: No such device
 
 The NIC still exists, see:
 
 emit:/home/joshua# ifconfig eth0
 eth0  Link encap:Ethernet  HWaddr 00:E0:00:8C:8B:8E
   inet addr:192.168.0.4  Bcast:192.168.0.255  Mask:255.255.255.0
   BROADCAST MULTICAST  MTU:1500  Metric:1
   RX packets:739959 errors:4 dropped:5 overruns:3 frame:0
   TX packets:441931 errors:0 dropped:0 overruns:2 carrier:0
   collisions:0 txqueuelen:1000
   RX bytes:1059867013 (1010.7 MiB)  TX bytes:37902281 (36.1 MiB)
   Interrupt:9 Base address:0x4800
 
 However, it's impossible to configure:
 
 emit:/home/joshua# ifconfig eth0 132.147.1.109 up
 SIOCSIFFLAGS: No such device
 SIOCSIFFLAGS: No such device
 
 Weird, huh?
-
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]: bcm43xx-d80211: fix hwcrypto issues (mcast)

2006-11-17 Thread Paul Hampson

Benjamin Herrenschmidt wrote:

On Fri, 2006-11-17 at 08:53 +0100, Johannes Berg wrote:

On Fri, 2006-11-17 at 18:46 +1100, Benjamin Herrenschmidt wrote:



So what is the solution for Apple machines owner who only get a v3
firmware from Apple ? I remember you telling me the answer on irc but I
wanted to make it public :-) Some web site we can d/l the windows
updates and extract the FW ?



Yes, fwcutter comes with a huge list of URLs for both firmware versions
(I suppose they'll remove the v3 ones now...)


v3 ones are still needed for the softmac version, unless I'm badly drunk...


Well, the latest released version (fwcutter-005) contains a huge list
of ... v3 URLs :-) Only 2 v4 in there. I'll check SVN.


There's actually a v4 big-endian firmware in the fwcutter list in SVN, but
no URL to fetch it from...

It comes from the AppleAirPortBrcm4311 driver. I've no idea where that update
comes from, I found a copy on the Internet somewhere. (I think someone posted
the file to a message board looking for help with it...)

I'm not sure, would it be be bad for me to just stick a copy of it up on a
website? If so, I can prolly dig up the place I got it from (I'm sure I
bookmarked it at the time) and people can choose their own level of comfort.

I have to say it's not clear from the documentation that BE machines like
PPC need to use a BE firmware... (If that's not the case, it's not clear
that it's not the case either, it just doesn't say either way. ^_^)

In fact, given that it's a BE firmware update for Intel-based Macs' bcm
cards, I presume the endianess of the firmware doesn't matter?

--
Paul Hampson
[EMAIL PROTECTED]

-
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]: bcm43xx-d80211: fix hwcrypto issues (mcast)

2006-11-17 Thread Benjamin Herrenschmidt
On Fri, 2006-11-17 at 08:53 +0100, Johannes Berg wrote:
 On Fri, 2006-11-17 at 18:46 +1100, Benjamin Herrenschmidt wrote:
 
  So what is the solution for Apple machines owner who only get a v3
  firmware from Apple ? I remember you telling me the answer on irc but I
  wanted to make it public :-) Some web site we can d/l the windows
  updates and extract the FW ?
 
 Yes, fwcutter comes with a huge list of URLs for both firmware versions
 (I suppose they'll remove the v3 ones now...)

Well, the latest released version (fwcutter-005) contains a huge list
of ... v3 URLs :-) Only 2 v4 in there. I'll check SVN.

Cheers,
Ben.


-
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]: bcm43xx-d80211: fix hwcrypto issues (mcast)

2006-11-17 Thread Andreas Schwab
Benjamin Herrenschmidt [EMAIL PROTECTED] writes:

 Well, the latest released version (fwcutter-005) contains a huge list
 of ... v3 URLs :-) Only 2 v4 in there. I'll check SVN.

Still the same.  One of them does not exist, the other one requires
Javascript!

Andreas.

-- 
Andreas Schwab, SuSE Labs, [EMAIL PROTECTED]
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
And now for something completely different.
-
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]: bcm43xx-d80211: fix hwcrypto issues (mcast)

2006-11-17 Thread Johannes Berg
On Fri, 2006-11-17 at 11:35 +0100, Andreas Schwab wrote:

 Still the same.  One of them does not exist, the other one requires
 Javascript!

Yeah, looks like Martin forgot to put the URLs in the the readme while
he put them into commit messages...

Try these:

Support for bcmwl5.sys v4.80.53.0 added.
ftp://downloads.netgear.com/files/wn511b_sw_3_28_3_8_setup.zip
(bcmwl5.sys is renamed to wn511b.sys)

Support for bcmwl5(64).sys v4.100.15.5 added.
from the latest Linksys WPC300N driver at
http://www.linksys.com/download/
It's ucode revision 0x0173, patchlevel 0x0425, 2006-10-04.

Martin, can you add these to the readme?

johannes
-
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]: bcm43xx-d80211: fix hwcrypto issues (mcast)

2006-11-17 Thread Andreas Schwab
Johannes Berg [EMAIL PROTECTED] writes:

 Try these:

 Support for bcmwl5.sys v4.80.53.0 added.
 ftp://downloads.netgear.com/files/wn511b_sw_3_28_3_8_setup.zip
 (bcmwl5.sys is renamed to wn511b.sys)

No supported files in there.

 Support for bcmwl5(64).sys v4.100.15.5 added.
 from the latest Linksys WPC300N driver at
 http://www.linksys.com/download/
 It's ucode revision 0x0173, patchlevel 0x0425, 2006-10-04.

Requires Javascript.

Andreas.

-- 
Andreas Schwab, SuSE Labs, [EMAIL PROTECTED]
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
And now for something completely different.
-
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: Generic Netlink HOW-TO based on Jamal's original doc

2006-11-17 Thread jamal
On Mon, 2006-13-11 at 15:06 -0500, Paul Moore wrote:
 jamal wrote:
  On Mon, 2006-13-11 at 09:08 -0500, Paul Moore wrote:
  
 I want to give Jamal a little bit longer to reply.
  
  Sorry, family emergency - still ongoing today, so havent looked at
  anything (including presentation that was supposed to be done) ;-
  
  Give me a day or two (I know i at least have to do the presentation or
  iam fscked ;-).
 
 No problem, life has a tendency to surprise us once in a while, hopefully it 
 is
 nothing to terrible.
 

Sorry, this was certainly more than 2 days; however, I am back (kinda).
[Chasing something that is driving me nuts for the last hour or so for
an iproute2 with ipsec with hope to introduce aevents.]
i will review the doc as soon as i am done with that.

cheers,
jamal


-
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][XFRM]: nlmsg length not computed correctly in the presence of subpolicies

2006-11-17 Thread jamal
Another one in the same spirit as before. Compiles. I dont have
a good test case, but looks right.
Nakamura-san please ACK and Dave (as before this goes in as a bug-fix).

cheers,
jamal
[XFRM]: nlmsg length not computed correctly in the presence of subpolicies

I actually dont have a test case for these; i just found them by
inspection. Refer to patch [XFRM]: Sub-policies broke policy events
for more info

Signed-off-by: Jamal Hadi Salim [EMAIL PROTECTED]

---
commit c3d793454ab2a36c2d618d226d7de975ab9b7570
tree 26198ba84d85317b4f1b54c0e10c220dbe0d97da
parent b53ec68c276ac1d879759de130620a72254cb969
author Jamal Hadi Salim [EMAIL PROTECTED] Fri, 17 Nov 2006 08:39:52 -0500
committer Jamal Hadi Salim [EMAIL PROTECTED](none) Fri, 17 Nov 2006 08:39:52 
-0500

 net/xfrm/xfrm_user.c |   10 +-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index 2dae1c1..c4cde57 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -1927,6 +1927,9 @@ static int xfrm_send_acquire(struct xfrm
len = RTA_SPACE(sizeof(struct xfrm_user_tmpl) * xp-xfrm_nr);
len += NLMSG_SPACE(sizeof(struct xfrm_user_acquire));
len += RTA_SPACE(xfrm_user_sec_ctx_size(xp));
+#ifdef CONFIG_XFRM_SUB_POLICY
+   len += RTA_SPACE(sizeof(struct xfrm_userpolicy_type));
+#endif
skb = alloc_skb(len, GFP_ATOMIC);
if (skb == NULL)
return -ENOMEM;
@@ -2034,6 +2037,9 @@ static int xfrm_exp_policy_notify(struct
len = RTA_SPACE(sizeof(struct xfrm_user_tmpl) * xp-xfrm_nr);
len += NLMSG_SPACE(sizeof(struct xfrm_user_polexpire));
len += RTA_SPACE(xfrm_user_sec_ctx_size(xp));
+#ifdef CONFIG_XFRM_SUB_POLICY
+   len += RTA_SPACE(sizeof(struct xfrm_userpolicy_type));
+#endif
skb = alloc_skb(len, GFP_ATOMIC);
if (skb == NULL)
return -ENOMEM;
@@ -2109,10 +2115,12 @@ static int xfrm_notify_policy_flush(stru
struct nlmsghdr *nlh;
struct sk_buff *skb;
unsigned char *b;
+   int len = 0;
 #ifdef CONFIG_XFRM_SUB_POLICY
struct xfrm_userpolicy_type upt;
+   len += RTA_SPACE(sizeof(struct xfrm_userpolicy_type));
 #endif
-   int len = NLMSG_LENGTH(0);
+   len += NLMSG_LENGTH(0);
 
skb = alloc_skb(len, GFP_ATOMIC);
if (skb == NULL)


[PATCH 1/2][XFRM]: Sub-policies beautification

2006-11-17 Thread jamal
First one

cheers,
jamal
[XFRM]: Make copy_to_user_policy_type take a type
Make copy_to_user_policy_type take a type instead a policy and
fix its users to pass the type

Signed-off-by: Jamal Hadi Salim [EMAIL PROTECTED]

---
commit 5e6a47d1e7baabd38cca9d01f3d78ae1319db535
tree cb4b19b38076cdf545a591ae9d5d6ecd8849c0bc
parent c3d793454ab2a36c2d618d226d7de975ab9b7570
author Jamal Hadi Salim [EMAIL PROTECTED] Fri, 17 Nov 2006 08:52:26 -0500
committer Jamal Hadi Salim [EMAIL PROTECTED](none) Fri, 17 Nov 2006 08:52:26 
-0500

 net/xfrm/xfrm_user.c |   14 +++---
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index c4cde57..3c34385 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -1082,12 +1082,12 @@ static inline int copy_to_user_sec_ctx(s
 }
 
 #ifdef CONFIG_XFRM_SUB_POLICY
-static int copy_to_user_policy_type(struct xfrm_policy *xp, struct sk_buff 
*skb)
+static int copy_to_user_policy_type(__u8 type, struct sk_buff *skb)
 {
struct xfrm_userpolicy_type upt;
 
memset(upt, 0, sizeof(upt));
-   upt.type = xp-type;
+   upt.type = type;
 
RTA_PUT(skb, XFRMA_POLICY_TYPE, sizeof(upt), upt);
 
@@ -1098,7 +1098,7 @@ rtattr_failure:
 }
 
 #else
-static inline int copy_to_user_policy_type(struct xfrm_policy *xp, struct 
sk_buff *skb)
+static inline int copy_to_user_policy_type(__u8 type, struct sk_buff *skb)
 {
return 0;
 }
@@ -1127,7 +1127,7 @@ static int dump_one_policy(struct xfrm_p
goto nlmsg_failure;
if (copy_to_user_sec_ctx(xp, skb))
goto nlmsg_failure;
-   if (copy_to_user_policy_type(xp, skb)  0)
+   if (copy_to_user_policy_type(xp-type, skb)  0)
goto nlmsg_failure;
 
nlh-nlmsg_len = skb-tail - b;
@@ -1907,7 +1907,7 @@ static int build_acquire(struct sk_buff 
goto nlmsg_failure;
if (copy_to_user_state_sec_ctx(x, skb))
goto nlmsg_failure;
-   if (copy_to_user_policy_type(xp, skb)  0)
+   if (copy_to_user_policy_type(xp-type, skb)  0)
goto nlmsg_failure;
 
nlh-nlmsg_len = skb-tail - b;
@@ -2017,7 +2017,7 @@ static int build_polexpire(struct sk_buf
goto nlmsg_failure;
if (copy_to_user_sec_ctx(xp, skb))
goto nlmsg_failure;
-   if (copy_to_user_policy_type(xp, skb)  0)
+   if (copy_to_user_policy_type(xp-type, skb)  0)
goto nlmsg_failure;
upe-hard = !!hard;
 
@@ -2096,7 +2096,7 @@ #endif
copy_to_user_policy(xp, p, dir);
if (copy_to_user_tmpl(xp, skb)  0)
goto nlmsg_failure;
-   if (copy_to_user_policy_type(xp, skb)  0)
+   if (copy_to_user_policy_type(xp-type, skb)  0)
goto nlmsg_failure;
 
nlh-nlmsg_len = skb-tail - b;


[PATCH 0/2] [XFRM]Sub-policies beautification

2006-11-17 Thread jamal
Ga-Dang. Ok, since i am on a row ... 
Might as well kill a few ifdefs.

This is more than likely 2.6.20 material but depends on the previous two
patches i sent earlier.

cheers,
jamal

-
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][XFRM]: Sub-policies beautification

2006-11-17 Thread jamal
Second one ..

cheers,
jamal
[XFRM]: Make flush notifier prettier when subpolicy used

Might as well make flush notifier prettier when subpolicy used

Signed-off-by: Jamal Hadi Salim [EMAIL PROTECTED]

---
commit eb52e3df145c2f8676da51a21cbe664d7794949c
tree d51daecf0feb1119f7c00bf9949b255a9494
parent 5e6a47d1e7baabd38cca9d01f3d78ae1319db535
author Jamal Hadi Salim [EMAIL PROTECTED] Fri, 17 Nov 2006 08:56:34 -0500
committer Jamal Hadi Salim [EMAIL PROTECTED](none) Fri, 17 Nov 2006 08:56:34 
-0500

 net/xfrm/xfrm_user.c |   12 ++--
 1 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index 3c34385..793b241 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -2117,7 +2117,6 @@ static int xfrm_notify_policy_flush(stru
unsigned char *b;
int len = 0;
 #ifdef CONFIG_XFRM_SUB_POLICY
-   struct xfrm_userpolicy_type upt;
len += RTA_SPACE(sizeof(struct xfrm_userpolicy_type));
 #endif
len += NLMSG_LENGTH(0);
@@ -2130,12 +2129,8 @@ #endif
 
nlh = NLMSG_PUT(skb, c-pid, c-seq, XFRM_MSG_FLUSHPOLICY, 0);
nlh-nlmsg_flags = 0;
-
-#ifdef CONFIG_XFRM_SUB_POLICY
-   memset(upt, 0, sizeof(upt));
-   upt.type = c-data.type;
-   RTA_PUT(skb, XFRMA_POLICY_TYPE, sizeof(upt), upt);
-#endif
+   if (copy_to_user_policy_type(c-data.type, skb)  0)
+   goto nlmsg_failure;
 
nlh-nlmsg_len = skb-tail - b;
 
@@ -2143,9 +2138,6 @@ #endif
return netlink_broadcast(xfrm_nl, skb, 0, XFRMNLGRP_POLICY, GFP_ATOMIC);
 
 nlmsg_failure:
-#ifdef CONFIG_XFRM_SUB_POLICY
-rtattr_failure:
-#endif
kfree_skb(skb);
return -1;
 }


Re: [PATCH] IPv6: Fix NULL dereference in ipv6_del_addr()

2006-11-17 Thread YOSHIFUJI Hideaki / 吉藤英明
In article [EMAIL PROTECTED] (at Fri, 17 Nov 2006 15:26:28 +0200), Ville 
Nuorvala [EMAIL PROTECTED] says:


 - dst_release(rt-u.dst);
 + if (rt)
 + dst_release(rt-u.dst);
   }

I disagree.  This does NOT fix any bugs.

(void *)rt-u.dst is ever equal to (void*)rt, and
dst_release() checks if the argument is NULL.

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


[PATCHES 0/10][NET] use kmemdup + some cleanups

2006-11-17 Thread Arnaldo Carvalho de Melo
Hi David,

Please consider pulling from:

master.kernel.org:/pub/scm/linux/kernel/git/acme/net-2.6.20.git

- Arnaldo
-
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/10][TCP_IPV4]: CodingStyle cleanups, no code change

2006-11-17 Thread Arnaldo Carvalho de Melo
Mostly related to CONFIG_TCP_MD5SIG recent merge.

Signed-off-by: Arnaldo Carvalho de Melo [EMAIL PROTECTED]
---
 net/ipv4/tcp_ipv4.c |  143 +++
 1 files changed, 75 insertions(+), 68 deletions(-)

diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index dadf802..010dff4 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -93,16 +93,18 @@ static struct socket *tcp_socket;
 void tcp_v4_send_check(struct sock *sk, int len, struct sk_buff *skb);
 
 #ifdef CONFIG_TCP_MD5SIG
-static struct tcp_md5sig_key *tcp_v4_md5_do_lookup(struct sock *sk, __be32 
addr);
+static struct tcp_md5sig_key *tcp_v4_md5_do_lookup(struct sock *sk,
+  __be32 addr);
 static int tcp_v4_do_calc_md5_hash(char *md5_hash, struct tcp_md5sig_key *key,
-  __be32 saddr, __be32 daddr, struct tcphdr 
*th,
-  int protocol, int tcplen);
+  __be32 saddr, __be32 daddr,
+  struct tcphdr *th, int protocol,
+  int tcplen);
 #endif
 
 struct inet_hashinfo __cacheline_aligned tcp_hashinfo = {
-   .lhash_lock = __RW_LOCK_UNLOCKED(tcp_hashinfo.lhash_lock),
-   .lhash_users= ATOMIC_INIT(0),
-   .lhash_wait = 
__WAIT_QUEUE_HEAD_INITIALIZER(tcp_hashinfo.lhash_wait),
+   .lhash_lock  = __RW_LOCK_UNLOCKED(tcp_hashinfo.lhash_lock),
+   .lhash_users = ATOMIC_INIT(0),
+   .lhash_wait  = __WAIT_QUEUE_HEAD_INITIALIZER(tcp_hashinfo.lhash_wait),
 };
 
 static int tcp_v4_get_port(struct sock *sk, unsigned short snum)
@@ -215,13 +217,14 @@ int tcp_v4_connect(struct sock *sk, stru
if (tcp_death_row.sysctl_tw_recycle 
!tp-rx_opt.ts_recent_stamp  rt-rt_dst == daddr) {
struct inet_peer *peer = rt_get_peer(rt);
-
-   /* VJ's idea. We save last timestamp seen from
-* the destination in peer table, when entering state TIME-WAIT
-* and initialize rx_opt.ts_recent from it, when trying new 
connection.
+   /*
+* VJ's idea. We save last timestamp seen from
+* the destination in peer table, when entering state
+* TIME-WAIT * and initialize rx_opt.ts_recent from it,
+* when trying new connection.
 */
-
-   if (peer  peer-tcp_ts_stamp + TCP_PAWS_MSL = xtime.tv_sec) {
+   if (peer != NULL 
+   peer-tcp_ts_stamp + TCP_PAWS_MSL = xtime.tv_sec) {
tp-rx_opt.ts_recent_stamp = peer-tcp_ts_stamp;
tp-rx_opt.ts_recent = peer-tcp_ts;
}
@@ -246,7 +249,8 @@ int tcp_v4_connect(struct sock *sk, stru
if (err)
goto failure;
 
-   err = ip_route_newports(rt, IPPROTO_TCP, inet-sport, inet-dport, sk);
+   err = ip_route_newports(rt, IPPROTO_TCP,
+   inet-sport, inet-dport, sk);
if (err)
goto failure;
 
@@ -270,7 +274,10 @@ int tcp_v4_connect(struct sock *sk, stru
return 0;
 
 failure:
-   /* This unhashes the socket and releases the local port, if necessary. 
*/
+   /*
+* This unhashes the socket and releases the local port,
+* if necessary.
+*/
tcp_set_state(sk, TCP_CLOSE);
ip_rt_put(rt);
sk-sk_route_caps = 0;
@@ -495,7 +502,8 @@ void tcp_v4_send_check(struct sock *sk, 
struct tcphdr *th = skb-h.th;
 
if (skb-ip_summed == CHECKSUM_PARTIAL) {
-   th-check = ~tcp_v4_check(th, len, inet-saddr, inet-daddr, 0);
+   th-check = ~tcp_v4_check(th, len,
+ inet-saddr, inet-daddr, 0);
skb-csum = offsetof(struct tcphdr, check);
} else {
th-check = tcp_v4_check(th, len, inet-saddr, inet-daddr,
@@ -572,7 +580,7 @@ #endif
   skb-len - (th-doff  2));
}
 
-   memset(arg, 0, sizeof arg);
+   memset(arg, 0, sizeof(arg));
arg.iov[0].iov_base = (unsigned char *)rep;
arg.iov[0].iov_len  = sizeof(rep.th);
 
@@ -595,9 +603,8 @@ #ifdef CONFIG_TCP_MD5SIG
arg.iov[0].iov_len);
}
 #endif
-
arg.csum = csum_tcpudp_nofold(skb-nh.iph-daddr,
- skb-nh.iph-saddr, /*XXX*/
+ skb-nh.iph-saddr, /* XXX */
  sizeof(struct tcphdr), IPPROTO_TCP, 0);
arg.csumoffset = offsetof(struct tcphdr, check) / 2;
 
@@ -631,7 +638,7 @@ #ifdef CONFIG_TCP_MD5SIG
 #endif
 
memset(rep.th, 0, sizeof(struct tcphdr));
-   memset(arg, 0, sizeof arg);
+   memset(arg, 0, sizeof(arg));
 
arg.iov[0].iov_base = (unsigned char *)rep;
arg.iov[0].iov_len  = sizeof(rep.th);

[PATCH 2/10][TCP_IPV4]: Use kmemdup where appropriate

2006-11-17 Thread Arnaldo Carvalho de Melo
Also use a variable to avoid the longish tp-md5sig_info- use
in tcp_v4_md5_do_add.

Code diff stats:

[EMAIL PROTECTED] net-2.6.20]$ codiff /tmp/tcp_ipv4.o.before 
/tmp/tcp_ipv4.o.after
/pub/scm/linux/kernel/git/acme/net-2.6.20/net/ipv4/tcp_ipv4.c:
  tcp_v4_md5_do_add |  -62
  tcp_v4_syn_recv_sock  |  -32
  tcp_v4_parse_md5_keys |  -86
 3 functions changed, 180 bytes removed
[EMAIL PROTECTED] net-2.6.20]$

Signed-off-by: Arnaldo Carvalho de Melo [EMAIL PROTECTED]
---
 net/ipv4/tcp_ipv4.c |   49 +
 1 files changed, 25 insertions(+), 24 deletions(-)

diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 010dff4..b7d5522 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -855,15 +855,18 @@ int tcp_v4_md5_do_add(struct sock *sk, _
struct tcp_sock *tp = tcp_sk(sk);
struct tcp4_md5sig_key *keys;
 
-   key = (struct tcp4_md5sig_key *) tcp_v4_md5_do_lookup(sk, addr);
+   key = (struct tcp4_md5sig_key *)tcp_v4_md5_do_lookup(sk, addr);
if (key) {
/* Pre-existing entry - just update that one. */
-   kfree (key-key);
+   kfree(key-key);
key-key = newkey;
key-keylen = newkeylen;
} else {
+   struct tcp_md5sig_info *md5sig;
+
if (!tp-md5sig_info) {
-   tp-md5sig_info = kzalloc(sizeof(*tp-md5sig_info), 
GFP_ATOMIC);
+   tp-md5sig_info = kzalloc(sizeof(*tp-md5sig_info),
+ GFP_ATOMIC);
if (!tp-md5sig_info) {
kfree(newkey);
return -ENOMEM;
@@ -873,30 +876,31 @@ int tcp_v4_md5_do_add(struct sock *sk, _
kfree(newkey);
return -ENOMEM;
}
-   if (tp-md5sig_info-alloced4 == tp-md5sig_info-entries4) {
-   keys = kmalloc((sizeof(struct tcp4_md5sig_key) *
-  (tp-md5sig_info-entries4 + 1)), 
GFP_ATOMIC);
+   md5sig = tp-md5sig_info;
+
+   if (md5sig-alloced4 == md5sig-entries4) {
+   keys = kmalloc((sizeof(*keys) *
+   (md5sig-entries4 + 1)), GFP_ATOMIC);
if (!keys) {
kfree(newkey);
tcp_free_md5sig_pool();
return -ENOMEM;
}
 
-   if (tp-md5sig_info-entries4)
-   memcpy(keys, tp-md5sig_info-keys4,
-  (sizeof (struct tcp4_md5sig_key) *
-   tp-md5sig_info-entries4));
+   if (md5sig-entries4)
+   memcpy(keys, md5sig-keys4,
+  sizeof(*keys) * md5sig-entries4);
 
/* Free old key list, and reference new one */
-   if (tp-md5sig_info-keys4)
-   kfree(tp-md5sig_info-keys4);
-   tp-md5sig_info-keys4 = keys;
-   tp-md5sig_info-alloced4++;
+   if (md5sig-keys4)
+   kfree(md5sig-keys4);
+   md5sig-keys4 = keys;
+   md5sig-alloced4++;
}
-   tp-md5sig_info-entries4++;
-   tp-md5sig_info-keys4[tp-md5sig_info-entries4 - 1].addr = 
addr;
-   tp-md5sig_info-keys4[tp-md5sig_info-entries4 - 1].key = 
newkey;
-   tp-md5sig_info-keys4[tp-md5sig_info-entries4 - 1].keylen = 
newkeylen;
+   md5sig-entries4++;
+   md5sig-keys4[md5sig-entries4 - 1].addr   = addr;
+   md5sig-keys4[md5sig-entries4 - 1].key= newkey;
+   md5sig-keys4[md5sig-entries4 - 1].keylen = newkeylen;
}
return 0;
 }
@@ -998,10 +1002,9 @@ static int tcp_v4_parse_md5_keys(struct 
 
}
 
-   newkey = kmalloc(cmd.tcpm_keylen, GFP_KERNEL);
+   newkey = kmemdup(cmd.tcpm_key, cmd.tcpm_keylen, GFP_KERNEL);
if (!newkey)
return -ENOMEM;
-   memcpy(newkey, cmd.tcpm_key, cmd.tcpm_keylen);
return tcp_v4_md5_do_add(sk, sin-sin_addr.s_addr,
 newkey, cmd.tcpm_keylen);
 }
@@ -1494,12 +1497,10 @@ #ifdef CONFIG_TCP_MD5SIG
 * memory, then we end up not copying the key
 * across. Shucks.
 */
-   char *newkey = kmalloc(key-keylen, GFP_ATOMIC);
-   if (newkey) {
-   memcpy(newkey, key-key, key-keylen);
+   char *newkey = kmemdup(key-key, key-keylen, GFP_ATOMIC);
+   if (newkey != NULL)
tcp_v4_md5_do_add(newsk, inet_sk(sk)-daddr,
  

[PATCH 10/10][NETROM]: Use kmemdup

2006-11-17 Thread Arnaldo Carvalho de Melo
Signed-off-by: Arnaldo Carvalho de Melo [EMAIL PROTECTED]
---
 net/netrom/nr_route.c |   12 +++-
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/net/netrom/nr_route.c b/net/netrom/nr_route.c
index c11737f..0096105 100644
--- a/net/netrom/nr_route.c
+++ b/net/netrom/nr_route.c
@@ -155,14 +155,15 @@ static int nr_add_node(ax25_address *nr,
atomic_set(nr_neigh-refcount, 1);
 
if (ax25_digi != NULL  ax25_digi-ndigi  0) {
-   if ((nr_neigh-digipeat = kmalloc(sizeof(*ax25_digi), 
GFP_KERNEL)) == NULL) {
+   nr_neigh-digipeat = kmemdup(ax25_digi,
+sizeof(*ax25_digi),
+GFP_KERNEL);
+   if (nr_neigh-digipeat == NULL) {
kfree(nr_neigh);
if (nr_node)
nr_node_put(nr_node);
return -ENOMEM;
}
-   memcpy(nr_neigh-digipeat, ax25_digi,
-   sizeof(*ax25_digi));
}
 
spin_lock_bh(nr_neigh_list_lock);
@@ -432,11 +433,12 @@ static int nr_add_neigh(ax25_address *ca
atomic_set(nr_neigh-refcount, 1);
 
if (ax25_digi != NULL  ax25_digi-ndigi  0) {
-   if ((nr_neigh-digipeat = kmalloc(sizeof(*ax25_digi), 
GFP_KERNEL)) == NULL) {
+   nr_neigh-digipeat = kmemdup(ax25_digi, sizeof(*ax25_digi),
+GFP_KERNEL);
+   if (nr_neigh-digipeat == NULL) {
kfree(nr_neigh);
return -ENOMEM;
}
-   memcpy(nr_neigh-digipeat, ax25_digi, sizeof(*ax25_digi));
}
 
spin_lock_bh(nr_neigh_list_lock);
-- 
1.4.2.1.g3d5c

-
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 4/10][IPV4]: Use kmemdup in net/ipv4/devinet.c

2006-11-17 Thread Arnaldo Carvalho de Melo
Code diff stats:

[EMAIL PROTECTED] net-2.6.20]$ codiff /tmp/devinet.o.before /tmp/devinet.o.after
/pub/scm/linux/kernel/git/acme/net-2.6.20/net/ipv4/devinet.c:
  devinet_sysctl_register |  -38
 1 function changed, 38 bytes removed
[EMAIL PROTECTED] net-2.6.20]$

Signed-off-by: Arnaldo Carvalho de Melo [EMAIL PROTECTED]
---
 net/ipv4/devinet.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index a1b356c..2fd8991 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -1564,12 +1564,12 @@ static void devinet_sysctl_register(stru
 {
int i;
struct net_device *dev = in_dev ? in_dev-dev : NULL;
-   struct devinet_sysctl_table *t = kmalloc(sizeof(*t), GFP_KERNEL);
+   struct devinet_sysctl_table *t = kmemdup(devinet_sysctl, sizeof(*t),
+GFP_KERNEL);
char *dev_name = NULL;
 
if (!t)
return;
-   memcpy(t, devinet_sysctl, sizeof(*t));
for (i = 0; i  ARRAY_SIZE(t-devinet_vars) - 1; i++) {
t-devinet_vars[i].data += (char *)p - (char *)ipv4_devconf;
t-devinet_vars[i].de = NULL;
-- 
1.4.2.1.g3d5c

-
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 9/10][AX25]: Use kmemdup

2006-11-17 Thread Arnaldo Carvalho de Melo
Code diff stats:

[EMAIL PROTECTED] net-2.6.20]$ codiff /tmp/ax25.ko.before /tmp/ax25.ko.after
/pub/scm/linux/kernel/git/acme/net-2.6.20/net/ax25/ax25_out.c:
  ax25_send_frame |   -8
 1 function changed, 8 bytes removed

/pub/scm/linux/kernel/git/acme/net-2.6.20/net/ax25/ax25_route.c:
  ax25_rt_autobind |  -15
 1 function changed, 15 bytes removed

/pub/scm/linux/kernel/git/acme/net-2.6.20/net/ax25/af_ax25.c:
  ax25_make_new |  -33
 1 function changed, 33 bytes removed

/pub/scm/linux/kernel/git/acme/net-2.6.20/net/ax25/sysctl_net_ax25.c:
  ax25_register_sysctl |  -21
 1 function changed, 21 bytes removed

/tmp/ax25.ko.after:
 4 functions changed, 77 bytes removed
[EMAIL PROTECTED] net-2.6.20]$

Signed-off-by: Arnaldo Carvalho de Melo [EMAIL PROTECTED]
---
 net/ax25/af_ax25.c |6 +++---
 net/ax25/ax25_out.c|4 ++--
 net/ax25/ax25_route.c  |5 +++--
 net/ax25/sysctl_net_ax25.c |5 +++--
 4 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
index 000695c..6cabf6d 100644
--- a/net/ax25/af_ax25.c
+++ b/net/ax25/af_ax25.c
@@ -906,13 +906,13 @@ struct sock *ax25_make_new(struct sock *
ax25-source_addr = oax25-source_addr;
 
if (oax25-digipeat != NULL) {
-   if ((ax25-digipeat = kmalloc(sizeof(ax25_digi), GFP_ATOMIC)) 
== NULL) {
+   ax25-digipeat = kmemdup(oax25-digipeat, sizeof(ax25_digi),
+GFP_ATOMIC);
+   if (ax25-digipeat == NULL) {
sk_free(sk);
ax25_cb_put(ax25);
return NULL;
}
-
-   memcpy(ax25-digipeat, oax25-digipeat, sizeof(ax25_digi));
}
 
sk-sk_protinfo = ax25;
diff --git a/net/ax25/ax25_out.c b/net/ax25/ax25_out.c
index d7736e5..f84047d 100644
--- a/net/ax25/ax25_out.c
+++ b/net/ax25/ax25_out.c
@@ -70,11 +70,11 @@ ax25_cb *ax25_send_frame(struct sk_buff 
ax25-dest_addr   = *dest;
 
if (digi != NULL) {
-   if ((ax25-digipeat = kmalloc(sizeof(ax25_digi), GFP_ATOMIC)) 
== NULL) {
+   ax25-digipeat = kmemdup(digi, sizeof(*digi), GFP_ATOMIC);
+   if (ax25-digipeat == NULL) {
ax25_cb_put(ax25);
return NULL;
}
-   memcpy(ax25-digipeat, digi, sizeof(ax25_digi));
}
 
switch (ax25-ax25_dev-values[AX25_VALUES_PROTOCOL]) {
diff --git a/net/ax25/ax25_route.c b/net/ax25/ax25_route.c
index 51b7bda..8580356 100644
--- a/net/ax25/ax25_route.c
+++ b/net/ax25/ax25_route.c
@@ -432,11 +432,12 @@ int ax25_rt_autobind(ax25_cb *ax25, ax25
}
 
if (ax25_rt-digipeat != NULL) {
-   if ((ax25-digipeat = kmalloc(sizeof(ax25_digi), GFP_ATOMIC)) 
== NULL) {
+   ax25-digipeat = kmemdup(ax25_rt-digipeat, sizeof(ax25_digi),
+GFP_ATOMIC);
+   if (ax25-digipeat == NULL) {
err = -ENOMEM;
goto put;
}
-   memcpy(ax25-digipeat, ax25_rt-digipeat, sizeof(ax25_digi));
ax25_adjust_path(addr, ax25-digipeat);
}
 
diff --git a/net/ax25/sysctl_net_ax25.c b/net/ax25/sysctl_net_ax25.c
index 867d425..d23a27f 100644
--- a/net/ax25/sysctl_net_ax25.c
+++ b/net/ax25/sysctl_net_ax25.c
@@ -209,7 +209,9 @@ void ax25_register_sysctl(void)
}
 
for (n = 0, ax25_dev = ax25_dev_list; ax25_dev != NULL; ax25_dev = 
ax25_dev-next) {
-   ctl_table *child = kmalloc(sizeof(ax25_param_table), 
GFP_ATOMIC);
+   struct ctl_table *child = kmemdup(ax25_param_table,
+ sizeof(ax25_param_table),
+ GFP_ATOMIC);
if (!child) {
while (n--)
kfree(ax25_table[n].child);
@@ -217,7 +219,6 @@ void ax25_register_sysctl(void)
spin_unlock_bh(ax25_dev_lock);
return;
}
-   memcpy(child, ax25_param_table, sizeof(ax25_param_table));
ax25_table[n].child = ax25_dev-systable = child;
ax25_table[n].ctl_name = n + 1;
ax25_table[n].procname = ax25_dev-dev-name;
-- 
1.4.2.1.g3d5c

-
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/10][NETLABEL]: Use kmemdup in cipso_ipv4.c

2006-11-17 Thread Arnaldo Carvalho de Melo
Code diff stats:

[EMAIL PROTECTED] net-2.6.20]$ codiff /tmp/cipso_ipv4.o.before 
/tmp/cipso_ipv4.o.after
/pub/scm/linux/kernel/git/acme/net-2.6.20/net/ipv4/cipso_ipv4.c:
  cipso_v4_cache_add |  -46
 1 function changed, 46 bytes removed
[EMAIL PROTECTED] net-2.6.20]$

Signed-off-by: Arnaldo Carvalho de Melo [EMAIL PROTECTED]
---
 net/ipv4/cipso_ipv4.c |3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/cipso_ipv4.c b/net/ipv4/cipso_ipv4.c
index c3a61eb..095038a 100644
--- a/net/ipv4/cipso_ipv4.c
+++ b/net/ipv4/cipso_ipv4.c
@@ -377,12 +377,11 @@ int cipso_v4_cache_add(const struct sk_b
entry = kzalloc(sizeof(*entry), GFP_ATOMIC);
if (entry == NULL)
return -ENOMEM;
-   entry-key = kmalloc(cipso_ptr_len, GFP_ATOMIC);
+   entry-key = kmemdup(cipso_ptr, cipso_ptr_len, GFP_ATOMIC);
if (entry-key == NULL) {
ret_val = -ENOMEM;
goto cache_add_failure;
}
-   memcpy(entry-key, cipso_ptr, cipso_ptr_len);
entry-key_len = cipso_ptr_len;
entry-hash = cipso_v4_map_cache_hash(cipso_ptr, cipso_ptr_len);
atomic_inc(secattr-cache-refcount);
-- 
1.4.2.1.g3d5c

-
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/3] NetXen: Fixed /sys mapping between device and driver

2006-11-17 Thread Linsys Contractor Amit S. Kale
Signed-off-by: Amit S. Kale [EMAIL PROTECTED]

 netxen_nic_main.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/netxen/netxen_nic_main.c 
b/drivers/net/netxen/netxen_nic_main.c
index 145bf47..a055208 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -273,6 +273,7 @@ netxen_nic_probe(struct pci_dev *pdev, c
}
 
SET_MODULE_OWNER(netdev);
+   SET_NETDEV_DEV(netdev, pdev-dev);
 
port = netdev_priv(netdev);
port-netdev = netdev;
@@ -1043,7 +1044,7 @@ static int netxen_nic_poll(struct net_de
netxen_nic_enable_int(adapter);
}
 
-   return (done ? 0 : 1);
+   return (!done);
 }
 
 #ifdef CONFIG_NET_POLL_CONTROLLER
-
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 5/10][TCP] minisocks: Use kmemdup and LIMIT_NETDEBUG

2006-11-17 Thread Arnaldo Carvalho de Melo
Code diff stats:

[EMAIL PROTECTED] net-2.6.20]$ codiff /tmp/tcp_minisocks.o.before 
/tmp/tcp_minisocks.o.after
/pub/scm/linux/kernel/git/acme/net-2.6.20/net/ipv4/tcp_minisocks.c:
  tcp_check_req |  -44
 1 function changed, 44 bytes removed
[EMAIL PROTECTED] net-2.6.20]$

Signed-off-by: Arnaldo Carvalho de Melo [EMAIL PROTECTED]
---
 net/ipv4/tcp_minisocks.c |7 +++
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c
index 383cb38..6dddf59 100644
--- a/net/ipv4/tcp_minisocks.c
+++ b/net/ipv4/tcp_minisocks.c
@@ -351,8 +351,7 @@ #endif
 * socket up.  We've got bigger problems than
 * non-graceful socket closings.
 */
-   if (net_ratelimit())
-   printk(KERN_INFO TCP: time wait bucket table 
overflow\n);
+   LIMIT_NETDEBUG(KERN_INFO TCP: time wait bucket table 
overflow\n);
}
 
tcp_update_metrics(sk);
@@ -667,11 +666,11 @@ #ifdef CONFIG_TCP_MD5SIG
 * newsk structure. If we fail to get memory 
then we
 * end up not copying the key across. Shucks.
 */
-   char *newkey = kmalloc(key-keylen, GFP_ATOMIC);
+   char *newkey = kmemdup(key-key, key-keylen,
+  GFP_ATOMIC);
if (newkey) {
if (!tcp_alloc_md5sig_pool())
BUG();
-   memcpy(newkey, key-key, key-keylen);
tp-af_specific-md5_add(child, child,
 newkey,
 key-keylen);
-- 
1.4.2.1.g3d5c

-
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/3] NetXen: 64-bit memory fixes, driver cleanup

2006-11-17 Thread Linsys Contractor Amit S. Kale
NetXen: 1G/10G Ethernet Driver updates
- These fixes take care of driver on machines with 4G memory
- Driver cleanup

Signed-off-by: Amit S. Kale [EMAIL PROTECTED]

 netxen_nic.h  |   41 ++
 netxen_nic_ethtool.c  |   19 ++--
 netxen_nic_hw.c   |   10 +-
 netxen_nic_hw.h   |4 
 netxen_nic_init.c |   51 +++-
 netxen_nic_isr.c  |3 
 netxen_nic_main.c |  204 +++---
 netxen_nic_phan_reg.h |   10 +-
 8 files changed, 293 insertions(+), 49 deletions(-)


diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h
index 1bee560..84259f9 100644
--- a/drivers/net/netxen/netxen_nic.h
+++ b/drivers/net/netxen/netxen_nic.h
@@ -6,12 +6,12 @@
  * 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.
- *
+ *
  * This program is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *   
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
@@ -89,8 +89,8 @@
  * normalize a 64MB crb address to 32MB PCI window 
  * To use NETXEN_CRB_NORMALIZE, window _must_ be set to 1
  */
-#define NETXEN_CRB_NORMAL(reg)\
-   (reg) - NETXEN_CRB_PCIX_HOST2 + NETXEN_CRB_PCIX_HOST
+#define NETXEN_CRB_NORMAL(reg) \
+   ((reg) - NETXEN_CRB_PCIX_HOST2 + NETXEN_CRB_PCIX_HOST)
 
 #define NETXEN_CRB_NORMALIZE(adapter, reg) \
pci_base_offset(adapter, NETXEN_CRB_NORMAL(reg))
@@ -164,7 +164,7 @@ enum {
 
 #define MAX_CMD_DESCRIPTORS1024
 #define MAX_RCV_DESCRIPTORS32768
-#define MAX_JUMBO_RCV_DESCRIPTORS  1024
+#define MAX_JUMBO_RCV_DESCRIPTORS  4096
 #define MAX_RCVSTATUS_DESCRIPTORS  MAX_RCV_DESCRIPTORS
 #define MAX_JUMBO_RCV_DESC MAX_JUMBO_RCV_DESCRIPTORS
 #define MAX_RCV_DESC   MAX_RCV_DESCRIPTORS
@@ -592,6 +592,16 @@ struct netxen_skb_frag {
u32 length;
 };
 
+/* Bounce buffer index */
+struct bounce_index {
+   /* Index of a buffer */
+   unsigned buffer_index;
+   /* Offset inside the buffer */
+   unsigned buffer_offset;
+};
+
+#define IS_BOUNCE 0xcafebb
+
 /*Following defines are for the state of the buffers*/
 #defineNETXEN_BUFFER_FREE  0
 #defineNETXEN_BUFFER_BUSY  1
@@ -611,6 +621,8 @@ struct netxen_cmd_buffer {
unsigned long time_stamp;
u32 state;
u32 no_of_descriptors;
+   u32 tx_bounce_buff;
+   struct bounce_index bnext;
 };
 
 /* In rx_buffer, we do not need multiple fragments as is a single buffer */
@@ -619,6 +631,9 @@ struct netxen_rx_buffer {
u64 dma;
u16 ref_handle;
u16 state;
+   u32 rx_bounce_buff;
+   struct bounce_index bnext;
+   char *bounce_ptr;
 };
 
 /* Board types */
@@ -703,6 +718,7 @@ struct netxen_recv_context {
 };
 
 #define NETXEN_NIC_MSI_ENABLED 0x02
+#define NETXEN_DMA_MASK0xfffe
 
 struct netxen_drvops;
 
@@ -937,9 +953,7 @@ static inline void netxen_nic_disable_in
/*
 * ISR_INT_MASK: Can be read from window 0 or 1.
 */
-   writel(0x7ff,
-  (void __iomem
-   *)(PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_MASK)));
+   writel(0x7ff, PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_MASK));
 
 }
 
@@ -959,14 +973,12 @@ static inline void netxen_nic_enable_int
break;
}
 
-   writel(mask,
-  (void __iomem
-   *)(PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_MASK)));
+   writel(mask, PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_MASK));
 
if (!(adapter-flags  NETXEN_NIC_MSI_ENABLED)) {
mask = 0xbff;
-   writel(mask, (void __iomem *)
-  (PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_TARGET_MASK)));
+   writel(mask, PCI_OFFSET_SECOND_RANGE(adapter,
+ISR_INT_TARGET_MASK));
}
 }
 
@@ -1040,6 +1052,9 @@ static inline void get_brd_name_by_type(
 
 int netxen_is_flash_supported(struct netxen_adapter *adapter);
 int netxen_get_flash_mac_addr(struct netxen_adapter *adapter, u64 mac[]);
+int netxen_get_next_bounce_buffer(struct bounce_index *head,
+ struct bounce_index *tail,
+ struct bounce_index *biret, unsigned len);
 
 extern void netxen_change_ringparam(struct netxen_adapter *adapter);
 extern int netxen_rom_fast_read(struct netxen_adapter *adapter, int addr,
diff --git a/drivers/net/netxen/netxen_nic_ethtool.c 

Re: [PATCH 1/2][XFRM]: Sub-policies beautification

2006-11-17 Thread Thomas Graf
* jamal [EMAIL PROTECTED] 2006-11-17 09:10
 First one
 
 cheers,
 jamal

 [XFRM]: Make copy_to_user_policy_type take a type
 Make copy_to_user_policy_type take a type instead a policy and
 fix its users to pass the type
 
 Signed-off-by: Jamal Hadi Salim [EMAIL PROTECTED]
 
 ---
 commit 5e6a47d1e7baabd38cca9d01f3d78ae1319db535
 tree cb4b19b38076cdf545a591ae9d5d6ecd8849c0bc
 parent c3d793454ab2a36c2d618d226d7de975ab9b7570
 author Jamal Hadi Salim [EMAIL PROTECTED] Fri, 17 Nov 2006 08:52:26 -0500
 committer Jamal Hadi Salim [EMAIL PROTECTED](none) Fri, 17 Nov 2006 
 08:52:26 -0500
 
  net/xfrm/xfrm_user.c |   14 +++---
  1 files changed, 7 insertions(+), 7 deletions(-)
 
 diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
 index c4cde57..3c34385 100644
 --- a/net/xfrm/xfrm_user.c
 +++ b/net/xfrm/xfrm_user.c
 @@ -1082,12 +1082,12 @@ static inline int copy_to_user_sec_ctx(s
  }
  
  #ifdef CONFIG_XFRM_SUB_POLICY
 -static int copy_to_user_policy_type(struct xfrm_policy *xp, struct sk_buff 
 *skb)
 +static int copy_to_user_policy_type(__u8 type, struct sk_buff *skb)

Could you maybe use u8 instead of the  userspace alternative __u8?

The other patches look good.

-
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 1/2][XFRM]: Sub-policies beautification

2006-11-17 Thread Thomas Graf
* jamal [EMAIL PROTECTED] 2006-11-17 11:49
 Good catch. I think i know how i missed that one - TheLinuxWay;-
 theres a few __u8s in there unrelated. So i will send an additional
 patch that fixes that and the rest of em. Sounds good?

Sure
-
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 3/10][NETLABEL]: Use kmemdup in cipso_ipv4.c

2006-11-17 Thread Paul Moore
Arnaldo Carvalho de Melo wrote:
 Code diff stats:
 
 [EMAIL PROTECTED] net-2.6.20]$ codiff /tmp/cipso_ipv4.o.before 
 /tmp/cipso_ipv4.o.after
 /pub/scm/linux/kernel/git/acme/net-2.6.20/net/ipv4/cipso_ipv4.c:
   cipso_v4_cache_add |  -46
  1 function changed, 46 bytes removed
 [EMAIL PROTECTED] net-2.6.20]$
 
 Signed-off-by: Arnaldo Carvalho de Melo [EMAIL PROTECTED]

Acked-by: Paul Moore [EMAIL PROTECTED]

Looks fine to me.

-- 
paul moore
linux security @ hp
-
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


[2.6 patch] net/ipv6/sit.c: make 2 functions static

2006-11-17 Thread Adrian Bunk
This patch makes two needlessly global functions static.

Signed-off-by: Adrian Bunk [EMAIL PROTECTED]

---

 include/net/ipip.h |4 
 net/ipv6/sit.c |4 ++--
 2 files changed, 2 insertions(+), 6 deletions(-)

--- linux-2.6.19-rc5-mm2/include/net/ipip.h.old 2006-11-17 16:58:59.0 
+0100
+++ linux-2.6.19-rc5-mm2/include/net/ipip.h 2006-11-17 16:59:06.0 
+0100
@@ -44,8 +44,4 @@
}   \
 } while (0)
 
-
-extern int sit_init(void);
-extern voidsit_cleanup(void);
-
 #endif
--- linux-2.6.19-rc5-mm2/net/ipv6/sit.c.old 2006-11-17 16:37:49.0 
+0100
+++ linux-2.6.19-rc5-mm2/net/ipv6/sit.c 2006-11-17 16:38:53.0 +0100
@@ -809,7 +809,7 @@
}
 }
 
-void __exit sit_cleanup(void)
+static void __exit sit_cleanup(void)
 {
inet_del_protocol(sit_protocol, IPPROTO_IPV6);
 
@@ -819,7 +819,7 @@
rtnl_unlock();
 }
 
-int __init sit_init(void)
+static int __init sit_init(void)
 {
int 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


[-mm patch] make net/core/skbuff.c:skb_over_panic() static

2006-11-17 Thread Adrian Bunk
skb_over_panic() can now become static.

Signed-off-by: Adrian Bunk [EMAIL PROTECTED]

---

Note:
This patch depends on net-uninline-skb_put.patch.

 include/linux/skbuff.h |2 --
 net/core/skbuff.c  |3 +--
 2 files changed, 1 insertion(+), 4 deletions(-)

--- linux-2.6.19-rc5-mm2/include/linux/skbuff.h.old 2006-11-17 
15:24:22.0 +0100
+++ linux-2.6.19-rc5-mm2/include/linux/skbuff.h 2006-11-17 15:24:31.0 
+0100
@@ -364,8 +364,6 @@ extern struct sk_buff *skb_copy_expand(c
   gfp_t priority);
 extern intskb_pad(struct sk_buff *skb, int pad);
 #define dev_kfree_skb(a)   kfree_skb(a)
-extern void  skb_over_panic(struct sk_buff *skb, int len,
-void *here);
 extern void  skb_under_panic(struct sk_buff *skb, int len,
  void *here);
 extern void  skb_truesize_bug(struct sk_buff *skb);
--- linux-2.6.19-rc5-mm2/net/core/skbuff.c.old  2006-11-17 15:24:38.0 
+0100
+++ linux-2.6.19-rc5-mm2/net/core/skbuff.c  2006-11-17 15:25:09.0 
+0100
@@ -84,7 +84,7 @@ static kmem_cache_t *skbuff_fclone_cache
  *
  * Out of line support code for skb_put(). Not user callable.
  */
-void skb_over_panic(struct sk_buff *skb, int sz, void *here)
+static void skb_over_panic(struct sk_buff *skb, int sz, void *here)
 {
printk(KERN_EMERG skb_over_panic: text:%p len:%d put:%d head:%p 
  data:%p tail:%p end:%p dev:%s\n,
@@ -2094,7 +2094,6 @@ EXPORT_SYMBOL(skb_copy_and_csum_bits);
 EXPORT_SYMBOL(skb_copy_and_csum_dev);
 EXPORT_SYMBOL(skb_copy_bits);
 EXPORT_SYMBOL(skb_copy_expand);
-EXPORT_SYMBOL(skb_over_panic);
 EXPORT_SYMBOL(skb_pad);
 EXPORT_SYMBOL(skb_realloc_headroom);
 EXPORT_SYMBOL(skb_under_panic);

-
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 11/13] Core Resource Allocation

2006-11-17 Thread Roland Dreier
  +static u32 next_random(u32 rand)
  +{
  +u32 y, ylast;
  +
  +y = rand;   
  +ylast = y;
  +y = (y * 69069)  0x;
  +y = (y  0x8000) + (ylast  0x7fff);
  +if ((y  1))
  +y = ylast ^ (y  1) ^ (2567483615UL);
  +else
  +y = ylast ^ (y  1);
  +y = y ^ (y  11);
  +y = y ^ ((y  7)  2636928640UL);
  +y = y ^ ((y  15)  4022730752UL);
  +y = y ^ (y  18);
  +return y;
  +}

How about just using the kernel's random32()?

I haven't read the code really so I don't understand what's being
randomized here, but random32() should be more than good enough for a
typical randomized algorithm().

 - R.
-
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 09/13] Core WQE/CQE Types

2006-11-17 Thread Steve Wise
On Thu, 2006-11-16 at 20:45 -0800, Roland Dreier wrote:
   +struct t3_send_wr {
   +  struct fw_riwrh wrh;/* 0 */
   +  union t3_wrid wrid; /* 1 */
   +
   +  enum t3_rdma_opcode rdmaop:8;
   +  u32 reserved:24;/* 2 */
 
 Does this do the right thing wrt endianness?  I'd be more comfortable
 with something like
 
   u8 rdmaop;
 u8 reserved[3];
 
 (although the __attribute__((packed)) on enum t3_rdma_opcode does make
 it OK to use here, I guess)
 
   +  u32 rem_stag;   /* 2 */
   +  u32 plen;   /* 3 */
   +  u32 num_sgle;
   +  struct t3_sge sgl[T3_MAX_SGE];  /* 4+ */
   +};


I don't really like the bit fields either. I inherited these structs and
I'm not adverse to changing them as you suggest to get rid of bit
fields.  But I think they are correct wrt endianness.  I wrote a test
program and on a LE machine it put the u8 first in memory followed by
the 24 bit reserved.  However, I think if you use bit fields less than 8
bits its not endian safe.

BTW:  I don't have a PPC system (yet) to test this code on BE...

Here's a dumb program that plays around with bit fields...

#include sys/types.h
#include inttypes.h
#include stdint.h
#include stdio.h

struct foo {
uint32_ta:8;
uint32_tb:24;
uint32_tc:16;
uint32_td:8;
uint32_te:8;
};

struct bar {
uint8_t a;
uint8_t b[3];
uint16_tc;
uint8_t d;
uint8_t e;
};

struct bits {
#if 0 /* BE */
uint32_ta:4;
uint32_tb:4;
#else /* LE */
uint32_tb:4;
uint32_ta:4;
#endif
uint32_tc:8;
uint32_td:8;
uint32_te:8;
};

main()
{
struct foo foo;
struct bar bar;
struct bits bits;
uint8_t *cp;
int i;

foo.a = 0x01;
foo.b = 0x020304;
foo.c = 0x0506;
foo.d = 0x07;
foo.e = 0x08;

printf(foo cpu: 0x% PRIx64 \n, *(uint64_t *)foo);
printf(foo mem: );
cp = (uint8_t *)foo;
for (i=0; i8; i++)
printf(%02x, *cp++);
printf(\n);

bar.a = 0x01;
bar.b[0] = 0x02;
bar.b[1] = 0x03;
bar.b[2] = 0x04;
bar.c = 0x0506;
bar.d = 0x07;
bar.e = 0x08;

printf(bar cpu: 0x% PRIx64 \n, *(uint64_t *)bar);
printf(bar mem: );
cp = (uint8_t *)bar;
for (i=0; i8; i++)
printf(%02x, *cp++);
printf(\n);


bits.a = 0x1;
bits.b = 0x2;
bits.c = 0x3;
bits.d = 0x4;
bits.e = 0x5;

printf(bits cpu: 0x%08x\n, *(uint32_t *)bits);
printf(bar mem: );
cp = (uint8_t *)bits;
for (i=0; i4; i++)
printf(%02x, *cp++);
printf(\n);
}




-
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 11/13] Core Resource Allocation

2006-11-17 Thread Steve Wise
On Fri, 2006-11-17 at 08:54 -0800, Roland Dreier wrote:
   +static u32 next_random(u32 rand)
   +{
   +  u32 y, ylast;
   +
   +  y = rand;   
   +  ylast = y;
   +  y = (y * 69069)  0x;
   +  y = (y  0x8000) + (ylast  0x7fff);
   +  if ((y  1))
   +  y = ylast ^ (y  1) ^ (2567483615UL);
   +  else
   +  y = ylast ^ (y  1);
   +  y = y ^ (y  11);
   +  y = y ^ ((y  7)  2636928640UL);
   +  y = y ^ ((y  15)  4022730752UL);
   +  y = y ^ (y  18);
   +  return y;
   +}
 
 How about just using the kernel's random32()?
 
 I haven't read the code really so I don't understand what's being
 randomized here, but random32() should be more than good enough for a
 typical randomized algorithm().
 
  - R.

I think we can use random32() or get_random_bytes().  I need to
re-review how this algorithm works.  Its randomizing the stag IDs so
they are not predictable.

Steve.



-
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: [openib-general] [PATCH 02/13] Device Discovery and ULLD Linkage

2006-11-17 Thread Bryan O'Sullivan

Steve Wise wrote:


+static inline void *vzmalloc(int size)
+{
+   void *p = vmalloc(size);
+   memset(p, 0, size);
+   return p;
+}


This isn't checking the return value from vmalloc.

Also, we could do with a generic vzalloc and vcalloc, just as we now 
have kzalloc and kcalloc.  There are lots of routines like this sitting 
around.


b
-
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: [openib-general] [PATCH 02/13] Device Discovery and ULLD Linkage

2006-11-17 Thread Steve Wise
On Fri, 2006-11-17 at 09:53 -0800, Bryan O'Sullivan wrote:
 Steve Wise wrote:
 
  +static inline void *vzmalloc(int size)
  +{
  +   void *p = vmalloc(size);
  +   memset(p, 0, size);
  +   return p;
  +}
 
 This isn't checking the return value from vmalloc.
 

Oops...


 Also, we could do with a generic vzalloc and vcalloc, just as we now 
 have kzalloc and kcalloc.  There are lots of routines like this sitting 
 around.
 
   b

I guess I'll post a kernel patch to add these...



-
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: [openib-general] [PATCH 04/13] Connection Manager

2006-11-17 Thread Bryan O'Sullivan

Steve Wise wrote:


+static void release_tid(struct t3cdev *tdev, u32 hwtid, struct sk_buff *skb)
+{
+   struct cpl_tid_release *req;
+
+   skb = get_skb(skb, sizeof *req, GFP_KERNEL);
+   if (!skb) {
+   return;
+   }


Style micronit: no curlies for single-statement blocks.


+void __free_ep(struct iwch_ep_common *epc)
+{
+   PDBG(%s ep %p, refcnt %p state %s, refcnt %d\n,
+__FUNCTION__, epc, epc-refcnt,
+states[state_read(epc)], atomic_read(epc-refcnt));
+
+   if (atomic_read(epc-refcnt) == 1) {
+   goto out;
+   }
+   if (!atomic_dec_and_test(epc-refcnt)) {
+   return;
+   }
+out:
+   PDBG(free ep %p\n, epc);
+   kfree(epc);
+}


Whatever you're trying to do with refcounting and atomics here looks 
extremely dodgy and race-prone to me.  Why are you using atomic ops in 
such a scary manner, instead of just slapping a spinlock around this?


Anyway, please drop this atomic refcounting stuff and use embedded krefs 
instead.  You're tunnelling into a bug mine.


By the way, it would be more consistent with normal kernel naming 
conventions to name these refcount-diddling routines ep_get and ep_put, 
since __ep_free doesn't actually free an object unless it feels like it.



+int __init iwch_cm_init(void)
+{
+   skb_queue_head_init(rxq);
+
+   workq = create_singlethread_workqueue(iw_cxgb3);
+   if (!workq)
+   return -ENOMEM;
+
+   /*
+	 * All upcalls from the T3 Core go to sched() to 
+	 * schedule the processing on a work queue.

+*/
+   t3c_handlers[CPL_ACT_ESTABLISH] = sched;
+   t3c_handlers[CPL_ACT_OPEN_RPL] = sched;
+   t3c_handlers[CPL_RX_DATA] = sched;
+   t3c_handlers[CPL_TX_DMA_ACK] = sched;
+   t3c_handlers[CPL_ABORT_RPL_RSS] = sched;
+   t3c_handlers[CPL_ABORT_RPL] = sched;
+   t3c_handlers[CPL_PASS_OPEN_RPL] = sched;
+   t3c_handlers[CPL_CLOSE_LISTSRV_RPL] = sched;
+   t3c_handlers[CPL_PASS_ACCEPT_REQ] = sched;
+   t3c_handlers[CPL_PASS_ESTABLISH] = sched;
+   t3c_handlers[CPL_PEER_CLOSE] = sched;
+   t3c_handlers[CPL_CLOSE_CON_RPL] = sched;
+   t3c_handlers[CPL_ABORT_REQ_RSS] = sched;
+   t3c_handlers[CPL_RDMA_TERMINATE] = sched;
+   t3c_handlers[CPL_RDMA_EC_STATUS] = sched;
+
+   /*
+	 * These are the real handlers that are called from a 
+	 * work queue.

+*/
+   work_handlers[CPL_ACT_ESTABLISH] = act_establish;
+   work_handlers[CPL_ACT_OPEN_RPL] = act_open_rpl;
+   work_handlers[CPL_RX_DATA] = rx_data;
+   work_handlers[CPL_TX_DMA_ACK] = tx_ack;
+   work_handlers[CPL_ABORT_RPL_RSS] = abort_rpl;
+   work_handlers[CPL_ABORT_RPL] = abort_rpl;
+   work_handlers[CPL_PASS_OPEN_RPL] = pass_open_rpl;
+   work_handlers[CPL_CLOSE_LISTSRV_RPL] = close_listsrv_rpl;
+   work_handlers[CPL_PASS_ACCEPT_REQ] = pass_accept_req;
+   work_handlers[CPL_PASS_ESTABLISH] = pass_establish;
+   work_handlers[CPL_PEER_CLOSE] = peer_close;
+   work_handlers[CPL_ABORT_REQ_RSS] = peer_abort;
+   work_handlers[CPL_CLOSE_CON_RPL] = close_con_rpl;
+   work_handlers[CPL_RDMA_TERMINATE] = terminate;
+   work_handlers[CPL_RDMA_EC_STATUS] = ec_status;
+   return 0;
+}


This seems mighty peculiar.  Why aren't you keeping this stuff in 
structs, instead of faking up structs via arrays?


b
-
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] IPv6: Fix NULL dereference in ipv6_del_addr()

2006-11-17 Thread Ville Nuorvala

YOSHIFUJI Hideaki wrote:

In article [EMAIL PROTECTED] (at Fri, 17 Nov 2006 15:26:28 +0200), Ville Nuorvala 
[EMAIL PROTECTED] says:



-   dst_release(rt-u.dst);
+   if (rt)
+   dst_release(rt-u.dst);
}


I disagree.  This does NOT fix any bugs.

(void *)rt-u.dst is ever equal to (void*)rt, and
dst_release() checks if the argument is NULL.


As the check is unnecessary you probably want to clean up the other 
places where rt is checked before rt-u.dst is passed, as well ;-)

This is done at least in addrconf.c, ndisc.c and route.c...

Seriously though, you are probably right about the pointer being equal 
to NULL in this case,  but does the C language actually guarantee that 
the pointer to the structure and its first element are equal, or is it 
implementation dependent? I don't have my KR here, so I can't check.


Regards,
Ville


-
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 wireless-2.6-git] prism54: WPA/RSN support for fullmac cards

2006-11-17 Thread chunkeey
Am Freitag, 17. November 2006 06:42 schrieben Sie:
 
  No, more that my card doesn't successfully associate at all even
  _without_ the patch on unencrypted or WEP APs; I just can't test it,
  since my card seems to be broken...

 FWIW I applied the patch to tonight pull form Linus's tree and my card
 stopped associating with my AP (WEP128, Shared key). It only associated
 with my neighbour router which is running without encryption.
can you please describe your setup? I tested WEP (restricted) with a Netgear 
WGT624 and a normal linux AP and haven't seen any problems so far.

for debugging: 
dmesg  iwevent output would be nice...
but I'll accept a short sniffer extract too. ;)

(it would be really good, if you can provide a package dump form a working 
setup with the old driver too!)

Christian
-
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: Generic Netlink HOW-TO based on Jamal's original doc

2006-11-17 Thread jamal
On Fri, 2006-17-11 at 08:05 -0500, jamal wrote:

 i will review the doc as soon as i am done with that.

I glanced at the doc over lunch. I will give you high level views first
and later on today or tomorrow i will give you a lot more pointed
opinions.

#1. I think the content layout has improved over the previous doc. So
good stuff.
Something still bothers me though; whether there is too much theory or
verbosity (not that this long email has any of those
characteristics;-). I am wondering if that affects usability. As a
litmus test, what would be the answer to the question:
If i didnt know anything about generic netlink, how long do i need to
spend and immediately start programming?
I dont think it is 5 minutes. Can we make it a 5 minute effort?

I think this is partially my fault because thats how i laid out the
original doc (and always is my style) - but you added more;-

Heres a thought:

** lay it out is to have two sections:

I. A LinuxWay section (others call it genetic programming!)

a) heres an example for the kernel and heres the controller from user
space
b) heres what all different fields mean

II. Here are all the nitty gritty details your mother never told you.

What this means is someone can immediately jump to Ia) do it the
LinuxWay(tm). When in doubt will read Ib) and when in further doubt will
read II.
[Actually Andrew Morton contented that nobody needs more than section I
when i first posted the doc].

I know this is a big change, so it will depend on how much time you
have. I also think people may be happy with it in its current form. It
would be nice to get feedback from someone who has used it.

2) Hey - you got rid of foobar[1] and googah ;- I love those terms.
No big deal - you own the doc now, so you can get away with things like
that ;-

3) Why not create a references section at the end and move all the
references you have scattered every there instead? 

4) Terminology is still confusing even to me. We most definetely need
such a section. For example, I dont like the term family to descrive
those boxes that sit in the kernel. But i dont know what else to call
them. Also looking closely at Thomas' introduction of the thing called
nla_policy - it really oughta have been called attribute property.
To add to this chaos - you introduced something you call a channel. A
little confusing although sounds right ;- I think the previous doc had
attempted something like a section on terms introduced by Balbir. But
you may have gotten rid of it.

5) For registration of commands and families, you dont show the user
handling return codes which could be errors. If this doc becomes
scripture it could mean trouble. Just a cutnpaste from the original doc
should suffice. 

6) There is still a lot of content for theory mostly that is missing.
I noticed you dont have async events, discovery etc. And there are still
a few ideas i would like to discuss with Thomas and send patches for
later.
So keep me as a coauthor - it will keep me on the hook for now; i will
bail out the moment i think it is complete.

hope this helps. 

cheers,
jamal

[1] http://en.wikipedia.org/wiki/Foobar

-
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] chelsio: procectomy

2006-11-17 Thread Stephen Hemminger
Complete removal of proc stuff from chelsio. The orignal driver had a debug
proc interface, but not all the code got removed.

Signed-off-by: Stephen Hemminger [EMAIL PROTECTED]

---
 drivers/net/chelsio/cxgb2.c |   14 --
 1 file changed, 14 deletions(-)

--- chelsio-t2.orig/drivers/net/chelsio/cxgb2.c
+++ chelsio-t2/drivers/net/chelsio/cxgb2.c
@@ -45,7 +45,6 @@
 #include linux/if_vlan.h
 #include linux/mii.h
 #include linux/sockios.h
-#include linux/proc_fs.h
 #include linux/dma-mapping.h
 #include asm/uaccess.h
 
@@ -780,17 +779,6 @@ static const struct ethtool_ops t1_ethto
.set_tso   = set_tso,
 };
 
-static void cxgb_proc_cleanup(struct adapter *adapter,
-   struct proc_dir_entry *dir)
-{
-   const char *name;
-   name = adapter-name;
-   remove_proc_entry(name, dir);
-}
-//#define chtoe_setup_toedev(adapter) NULL
-#define update_mtu_tab(adapter)
-#define write_smt_entry(adapter, idx)
-
 static int t1_ioctl(struct net_device *dev, struct ifreq *req, int cmd)
 {
struct adapter *adapter = dev-priv;
@@ -1156,7 +1144,6 @@ static int __devinit init_one(struct pci
if (adapter-regs) iounmap(adapter-regs);
for (i = bi-port_number - 1; i = 0; --i)
if (adapter-port[i].dev) {
-   cxgb_proc_cleanup(adapter, proc_root_driver);
kfree(adapter-port[i].dev);
}
}
@@ -1189,7 +1176,6 @@ static void __devexit remove_one(struct 
iounmap(adapter-regs);
while (--i = 0)
if (adapter-port[i].dev) {
-   cxgb_proc_cleanup(adapter, proc_root_driver);
kfree(adapter-port[i].dev);
}
pci_release_regions(pdev);
-
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] chelsio: remove leftover code

2006-11-17 Thread Stephen Hemminger
The chelsio network driver has some extra ifdef's that got in because the
driver was originally based on code that worked on 2.4 as well as 2.6.
This patch removes the dead code.

Signed-off-by: Stephen Hemminger [EMAIL PROTECTED]

--- chelsio-t2.orig/drivers/net/chelsio/cxgb2.c
+++ chelsio-t2/drivers/net/chelsio/cxgb2.c
@@ -56,34 +56,6 @@
 #include sge.h
 #include espi.h
 
-#ifdef work_struct
-#include linux/tqueue.h
-#define INIT_WORK INIT_TQUEUE
-#define schedule_work schedule_task
-#define flush_scheduled_work flush_scheduled_tasks
-
-static inline void schedule_mac_stats_update(struct adapter *ap, int secs)
-{
-   mod_timer(ap-stats_update_timer, jiffies + secs * HZ);
-}
-
-static inline void cancel_mac_stats_update(struct adapter *ap)
-{
-   del_timer_sync(ap-stats_update_timer);
-   flush_scheduled_tasks();
-}
-
-/*
- * Stats update timer for 2.4.  It schedules a task to do the actual update as
- * we need to access MAC statistics in process context.
- */
-static void mac_stats_timer(unsigned long data)
-{
-   struct adapter *ap = (struct adapter *)data;
-
-   schedule_task(ap-stats_update_task);
-}
-#else
 #include linux/workqueue.h
 
 static inline void schedule_mac_stats_update(struct adapter *ap, int secs)
@@ -95,7 +67,6 @@ static inline void cancel_mac_stats_upda
 {
cancel_delayed_work(ap-stats_update_task);
 }
-#endif
 
 #define MAX_CMDQ_ENTRIES 16384
 #define MAX_CMDQ1_ENTRIES 1024
@@ -1090,12 +1061,6 @@ static int __devinit init_one(struct pci
  ext_intr_task, adapter);
INIT_WORK(adapter-stats_update_task, mac_stats_task,
  adapter);
-#ifdef work_struct
-   init_timer(adapter-stats_update_timer);
-   adapter-stats_update_timer.function = mac_stats_timer;
-   adapter-stats_update_timer.data =
-   (unsigned long)adapter;
-#endif
 
pci_set_drvdata(pdev, netdev);
}
-
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 4/4] chelsio: free_netdev

2006-11-17 Thread Stephen Hemminger
Network devices need to be free'd with free_netdev() not kfree()
otherwise the kernel will panic if an application has /sys/class/net/ethX/value
open and reads it.

Signed-off-by: Stephen Hemminger [EMAIL PROTECTED]

---
 drivers/net/chelsio/cxgb2.c |   14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

--- chelsio-t2.orig/drivers/net/chelsio/cxgb2.c
+++ chelsio-t2/drivers/net/chelsio/cxgb2.c
@@ -1141,11 +1141,11 @@ static int __devinit init_one(struct pci
t1_free_sw_modules(adapter);
  out_free_dev:
if (adapter) {
-   if (adapter-regs) iounmap(adapter-regs);
+   if (adapter-regs)
+   iounmap(adapter-regs);
for (i = bi-port_number - 1; i = 0; --i)
-   if (adapter-port[i].dev) {
-   kfree(adapter-port[i].dev);
-   }
+   if (adapter-port[i].dev)
+   free_netdev(adapter-port[i].dev);
}
pci_release_regions(pdev);
  out_disable_pdev:
@@ -1175,9 +1175,9 @@ static void __devexit remove_one(struct 
t1_free_sw_modules(adapter);
iounmap(adapter-regs);
while (--i = 0)
-   if (adapter-port[i].dev) {
-   kfree(adapter-port[i].dev);
-   }
+   if (adapter-port[i].dev)
+   free_netdev(adapter-port[i].dev);
+
pci_release_regions(pdev);
pci_disable_device(pdev);
pci_set_drvdata(pdev, NULL);
-
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] chelsio: whitespace cleanup

2006-11-17 Thread Stephen Hemminger
Whitespace cleanups.  Replace leading spaces with tabs and fix indentation

Signed-off-by: Stephen Hemminger [EMAIL PROTECTED]

---
 drivers/net/chelsio/cxgb2.c |  202 ++--
 1 file changed, 101 insertions(+), 101 deletions(-)

--- chelsio-t2.orig/drivers/net/chelsio/cxgb2.c
+++ chelsio-t2/drivers/net/chelsio/cxgb2.c
@@ -120,7 +120,7 @@ static void t1_set_rxmode(struct net_dev
 static void link_report(struct port_info *p)
 {
if (!netif_carrier_ok(p-dev))
-   printk(KERN_INFO %s: link down\n, p-dev-name);
+   printk(KERN_INFO %s: link down\n, p-dev-name);
else {
const char *s = 10Mbps;
 
@@ -130,7 +130,7 @@ static void link_report(struct port_info
case SPEED_100:   s = 100Mbps; break;
}
 
-printk(KERN_INFO %s: link up, %s, %s-duplex\n,
+   printk(KERN_INFO %s: link up, %s, %s-duplex\n,
   p-dev-name, s,
   p-link_config.duplex == DUPLEX_FULL ? full : half);
}
@@ -261,7 +261,7 @@ static struct net_device_stats *t1_get_s
 
/* Do a full update of the MAC stats */
pstats = p-mac-ops-statistics_update(p-mac,
- MAC_STATS_UPDATE_FULL);
+   MAC_STATS_UPDATE_FULL);
 
ns-tx_packets = pstats-TxUnicastFramesOK +
pstats-TxMulticastFramesOK + pstats-TxBroadcastFramesOK;
@@ -315,39 +315,39 @@ static void set_msglevel(struct net_devi
 }
 
 static char stats_strings[][ETH_GSTRING_LEN] = {
-TxOctetsOK,
-TxOctetsBad,
-TxUnicastFramesOK,
-TxMulticastFramesOK,
-TxBroadcastFramesOK,
-TxPauseFrames,
-TxFramesWithDeferredXmissions,
-TxLateCollisions,
-TxTotalCollisions,
-TxFramesAbortedDueToXSCollisions,
-TxUnderrun,
-TxLengthErrors,
-TxInternalMACXmitError,
-TxFramesWithExcessiveDeferral,
-TxFCSErrors,
-
-RxOctetsOK,
-RxOctetsBad,
-RxUnicastFramesOK,
-RxMulticastFramesOK,
-RxBroadcastFramesOK,
-RxPauseFrames,
-RxFCSErrors,
-RxAlignErrors,
-RxSymbolErrors,
-RxDataErrors,
-RxSequenceErrors,
-RxRuntErrors,
-RxJabberErrors,
-RxInternalMACRcvError,
-RxInRangeLengthErrors,
-RxOutOfRangeLengthField,
-RxFrameTooLongErrors,
+   TxOctetsOK,
+   TxOctetsBad,
+   TxUnicastFramesOK,
+   TxMulticastFramesOK,
+   TxBroadcastFramesOK,
+   TxPauseFrames,
+   TxFramesWithDeferredXmissions,
+   TxLateCollisions,
+   TxTotalCollisions,
+   TxFramesAbortedDueToXSCollisions,
+   TxUnderrun,
+   TxLengthErrors,
+   TxInternalMACXmitError,
+   TxFramesWithExcessiveDeferral,
+   TxFCSErrors,
+
+   RxOctetsOK,
+   RxOctetsBad,
+   RxUnicastFramesOK,
+   RxMulticastFramesOK,
+   RxBroadcastFramesOK,
+   RxPauseFrames,
+   RxFCSErrors,
+   RxAlignErrors,
+   RxSymbolErrors,
+   RxDataErrors,
+   RxSequenceErrors,
+   RxRuntErrors,
+   RxJabberErrors,
+   RxInternalMACRcvError,
+   RxInRangeLengthErrors,
+   RxOutOfRangeLengthField,
+   RxFrameTooLongErrors,
 
TSO,
VLANextractions,
@@ -367,7 +367,7 @@ static char stats_strings[][ETH_GSTRING_
tx_reg_pkts,
tx_lso_pkts,
tx_do_cksum,
-   
+
espi_DIP2ParityErr,
espi_DIP4Err,
espi_RxDrops,
@@ -375,7 +375,7 @@ static char stats_strings[][ETH_GSTRING_
espi_RxOvfl,
espi_ParityErr
 };
- 
+
 #define T2_REGMAP_SIZE (3 * 1024)
 
 static int get_regs_len(struct net_device *dev)
@@ -417,39 +417,39 @@ static void get_stats(struct net_device 
ss = t1_sge_get_port_stats(adapter-sge, dev-if_port);
t = t1_sge_get_intr_counts(adapter-sge);
 
-*data++ = s-TxOctetsOK;
-*data++ = s-TxOctetsBad;
-*data++ = s-TxUnicastFramesOK;
-*data++ = s-TxMulticastFramesOK;
-*data++ = s-TxBroadcastFramesOK;
-*data++ = s-TxPauseFrames;
-*data++ = s-TxFramesWithDeferredXmissions;
-*data++ = s-TxLateCollisions;
-*data++ = s-TxTotalCollisions;
-*data++ = s-TxFramesAbortedDueToXSCollisions;
-*data++ = s-TxUnderrun;
-*data++ = s-TxLengthErrors;
-*data++ = s-TxInternalMACXmitError;
-*data++ = s-TxFramesWithExcessiveDeferral;
-*data++ = s-TxFCSErrors;
-
-*data++ = s-RxOctetsOK;
-*data++ = s-RxOctetsBad;
-*data++ = s-RxUnicastFramesOK;
-*data++ = s-RxMulticastFramesOK;
-*data++ = s-RxBroadcastFramesOK;
-*data++ = s-RxPauseFrames;
-*data++ = s-RxFCSErrors;
-*data++ = s-RxAlignErrors;
-*data++ = s-RxSymbolErrors;
-*data++ = s-RxDataErrors;
-*data++ = 

Re: [PATCH wireless-2.6-git] prism54: WPA/RSN support for fullmac cards

2006-11-17 Thread Dmitry Torokhov

On 11/17/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

Am Freitag, 17. November 2006 06:42 schrieben Sie:
 
  No, more that my card doesn't successfully associate at all even
  _without_ the patch on unencrypted or WEP APs; I just can't test it,
  since my card seems to be broken...

 FWIW I applied the patch to tonight pull form Linus's tree and my card
 stopped associating with my AP (WEP128, Shared key). It only associated
 with my neighbour router which is running without encryption.
can you please describe your setup? I tested WEP (restricted) with a Netgear
WGT624 and a normal linux AP and haven't seen any problems so far.



The card is WG511 talking to netgear WGR614 router. I am using WEP128
with shared keys. Router is set to be g only. The OS is Fedora Core
3 (I swear I will upgrade :) ), just recompiled wireless tools from
sources in FC6.


for debugging:
dmesg  iwevent output would be nice...


Will do when I get home.


but I'll accept a short sniffer extract too. ;)

(it would be really good, if you can provide a package dump form a working
setup with the old driver too!)



You'd have to tell me exactly what you want me to do.

The reason for me trying the patch is that the card locks up
frequently (the amber transmission light turns on stays this way).

--
Dmitry
-
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 wireless-2.6-git] prism54: WPA/RSN support for fullmac cards

2006-11-17 Thread chunkeey

 The card is WG511 talking to netgear WGR614 router. I am using WEP128
 with shared keys. Router is set to be g only. The OS is Fedora Core
 3 (I swear I will upgrade :) ), just recompiled wireless tools from
 sources in FC6.

  for debugging:
  dmesg  iwevent output would be nice...

 Will do when I get home.

  but I'll accept a short sniffer extract too. ;)
 
  (it would be really good, if you can provide a package dump form a
  working setup with the old driver too!)

 You'd have to tell me exactly what you want me to do.
just the Management Frames (MLME):
Beacon, Authentication and Association Responses/Requests Frames
you can capture these frames with an extra sniffer card (in monitor mode)
just run tcpdump, wireshark(ethereal), kismet, ...



 The reason for me trying the patch is that the card locks up
 frequently (the amber transmission light turns on stays this way).
 
Do you get any fancy mgt timeout ... or something in dmesg, when
the cards locks up? (include one, if you can, maybe syslog saved one)
-
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 wireless-2.6-git] prism54: WPA/RSN support for fullmac cards

2006-11-17 Thread Dmitry Torokhov

On 11/17/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:


 The reason for me trying the patch is that the card locks up
 frequently (the amber transmission light turns on stays this way).

Do you get any fancy mgt timeout ... or something in dmesg, when
the cards locks up? (include one, if you can, maybe syslog saved one)



I think I saw these before (with earlier kernels, can't tell you
exactly when it stopped as I don't pay much attention to versions - I
work off tip of Linus's tree and pull often) but now it looks like it
simply locks up. Maybe I don't wait long enough - I just simply eject
and inster the card back when I see it locked up.

--
Dmitry
-
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 wireless-2.6-git] prism54: WPA/RSN support for fullmac cards

2006-11-17 Thread Dmitry Torokhov

On 11/17/06, Dmitry Torokhov [EMAIL PROTECTED] wrote:

On 11/17/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 
  The reason for me trying the patch is that the card locks up
  frequently (the amber transmission light turns on stays this way).

 Do you get any fancy mgt timeout ... or something in dmesg, when
 the cards locks up? (include one, if you can, maybe syslog saved one)


I think I saw these before (with earlier kernels, can't tell you
exactly when it stopped as I don't pay much attention to versions - I
work off tip of Linus's tree and pull often) but now it looks like it
simply locks up. Maybe I don't wait long enough - I just simply eject
and inster the card back when I see it locked up.



Btw, it usually locks up under heavyish load. I.e. if I just ssh into
my devel box and code in vi it will stay jsut fine for hours. But
FTPing stuff over quite often locks it up.

--
Dmitry
-
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 wireless-2.6-git] prism54: WPA/RSN support for fullmac cards

2006-11-17 Thread chunkeey

 Btw, it usually locks up under heavyish load. I.e. if I just ssh into
 my devel box and code in vi it will stay jsut fine for hours. But
 FTPing stuff over quite often locks it up.

k, I've seen this phenomenon too, but on my a PCI card.

Alright, when you come home, you should check the syslogs for these 
kind of timeout messages. 
-
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] netdev: don't allow register_netdev with blank name

2006-11-17 Thread Stephen Hemminger
This bit of old backwards compatibility cruft can be removed in 2.6.20.
If there is still an device that calls register_netdev()
with a zero or blank name, it will get -EINVAL from register_netdevice().

Signed-off-by: Stephen Hemminger [EMAIL PROTECTED]


--- linux-2.6.19-rc6.orig/net/core/dev.c2006-11-17 13:35:04.0 
-0800
+++ linux-2.6.19-rc6/net/core/dev.c 2006-11-17 13:37:46.0 -0800
@@ -3035,15 +3035,6 @@
goto out;
}

-   /*
-* Back compatibility hook. Kill this one in 2.5
-*/
-   if (dev-name[0] == 0 || dev-name[0] == ' ') {
-   err = dev_alloc_name(dev, eth%d);
-   if (err  0)
-   goto out;
-   }
-
err = register_netdevice(dev);
 out:
rtnl_unlock();
-
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/10] d80211: move away from wmaster towards wiphy

2006-11-17 Thread Johannes Berg
Hi,

Since it looks like we'll be able to move the qdisc stuff over to a new
wiphy concept the master device is getting completely useless. Joy :)

Here's a series of patches to migrate d80211 away from the wmaster and
more towards a wiphy concept. This series targets the driver API.

Since I have no hope that netdev will like my patches, the whole series
is available at http://johannes.sipsolutions.net/patches/d80211-wiphy/
(and this time I made sure it's accessible :), also as
http://johannes.sipsolutions.net/patches/d80211-wiphy.tar.bz2)

d80211: clean up some stupid list and loop code
d80211: reduce mdev usage
d80211: reduce mdev usage
d80211: reduce mdev usage, fix ieee80211_rx_mgmt
d80211: reduce master ieee80211_ptr deref in scan routines
d80211: change the cookie to be opaque

These have been submitted previously and I've used them as stepping
stones. I removed the while (1) from the first one again in favour of
for (;;).

d80211: move hw descriptor into wiphy structure

Another stepping stone in a way, moves the ieee80211_hw *hw into wiphy
to drop some exported symbols.

d80211: add a perm_addr hardware property

another patch from my original series... puts the perm_addr property in
that will be moved around in the next patch

d80211: split ieee80211_hw

Most interesting one :) This one splits up ieee80211_hw into
ieee80211_ops and moves everything that could possibly be card-dependent
(as opposed to driver dependent) into ieee80211_wiphy.

d80211: introduce IEEE80211_HW_FRAG flag

just a fix for the previous one.

No driver updates for now, sorry.

johannes


signature.asc
Description: This is a digitally signed message part


[PATCH 08/13] NetLabel: return the correct error for translated CIPSOv4 tags

2006-11-17 Thread paul . moore
From: Paul Moore [EMAIL PROTECTED]

The CIPSOv4 translated tag #1 mapping does not always return the correct error
code if the desired mapping does not exist; instead of returning -EPERM it
returns -ENOSPC indicating that the buffer is not large enough to hold the
translated value.  This was caused by failing to check a specific error
condition.  This patch fixes this so that unknown mappings return
-EPERM which is consistent with the rest of the related CIPSOv4 code.

Signed-off-by: Paul Moore [EMAIL PROTECTED]
---
 net/ipv4/cipso_ipv4.c |4 
 1 files changed, 4 insertions(+)

Index: net-2.6.20_netlabel-base-work/net/ipv4/cipso_ipv4.c
===
--- net-2.6.20_netlabel-base-work.orig/net/ipv4/cipso_ipv4.c
+++ net-2.6.20_netlabel-base-work/net/ipv4/cipso_ipv4.c
@@ -868,6 +868,8 @@ static int cipso_v4_map_cat_rbm_hton(con
return -EPERM;
 
net_spot = host_cat_array[host_spot];
+   if (net_spot = CIPSO_V4_INV_CAT)
+   return -EPERM;
if (net_spot = net_clen_bits)
return -ENOSPC;
cipso_v4_bitmap_setbit(net_cat, net_spot, 1);
@@ -936,6 +938,8 @@ static int cipso_v4_map_cat_rbm_ntoh(con
return -EPERM;
 
host_spot = net_cat_array[net_spot];
+   if (host_spot = CIPSO_V4_INV_CAT)
+   return -EPERM;
if (host_spot = host_clen_bits)
return -ENOSPC;
cipso_v4_bitmap_setbit(host_cat, host_spot, 1);

--
paul moore
linux security @ hp
-
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 11/13] NetLabel: SELinux cleanups

2006-11-17 Thread paul . moore
From: Paul Moore [EMAIL PROTECTED]

This patch does a lot of cleanup in the SELinux NetLabel support code.  A
summary of the changes include:

* Use RCU locking for the NetLabel state variable in the skk_security_struct
  instead of using the inode_security_struct mutex.
* Remove unnecessary parameters in selinux_netlbl_socket_post_create().
* Rename selinux_netlbl_sk_clone_security() to
  selinux_netlbl_sk_security_clone() to better fit the other NetLabel
  sk_security functions.
* Improvements to selinux_netlbl_inode_permission() to help reduce the cost of
  the common case.

Signed-off-by: Paul Moore [EMAIL PROTECTED]
---
 security/selinux/hooks.c|   10 +-
 security/selinux/include/objsec.h   |2 
 security/selinux/include/selinux_netlabel.h |   21 +++--
 security/selinux/ss/services.c  |  107 +---
 4 files changed, 86 insertions(+), 54 deletions(-)

Index: net-2.6.20_netlabel-base-work/security/selinux/hooks.c
===
--- net-2.6.20_netlabel-base-work.orig/security/selinux/hooks.c
+++ net-2.6.20_netlabel-base-work/security/selinux/hooks.c
@@ -3139,9 +3139,7 @@ static int selinux_socket_post_create(st
if (sock-sk) {
sksec = sock-sk-sk_security;
sksec-sid = isec-sid;
-   err = selinux_netlbl_socket_post_create(sock,
-   family,
-   isec-sid);
+   err = selinux_netlbl_socket_post_create(sock);
}
 
return err;
@@ -3660,7 +3658,7 @@ static void selinux_sk_clone_security(co
newssec-sid = ssec-sid;
newssec-peer_sid = ssec-peer_sid;
 
-   selinux_netlbl_sk_clone_security(ssec, newssec);
+   selinux_netlbl_sk_security_clone(ssec, newssec);
 }
 
 static void selinux_sk_getsecid(struct sock *sk, u32 *secid)
@@ -3729,7 +3727,9 @@ static void selinux_inet_csk_clone(struc
   So we will wait until sock_graft to do it, by which
   time it will have been created and available. */
 
-   selinux_netlbl_sk_security_init(newsksec, req-rsk_ops-family);
+   /* We don't need to take any sort of lock here as we are the only
+* thread with access to newsksec */
+   selinux_netlbl_sk_security_reset(newsksec, req-rsk_ops-family);
 }
 
 static void selinux_inet_conn_established(struct sock *sk,
Index: net-2.6.20_netlabel-base-work/security/selinux/include/objsec.h
===
--- net-2.6.20_netlabel-base-work.orig/security/selinux/include/objsec.h
+++ net-2.6.20_netlabel-base-work/security/selinux/include/objsec.h
@@ -23,6 +23,7 @@
 #include linux/fs.h
 #include linux/binfmts.h
 #include linux/in.h
+#include linux/spinlock.h
 #include flask.h
 #include avc.h
 
@@ -108,6 +109,7 @@ struct sk_security_struct {
NLBL_REQUIRE,
NLBL_LABELED,
} nlbl_state;
+   spinlock_t nlbl_lock;   /* protects nlbl_state */
 #endif
 };
 
Index: net-2.6.20_netlabel-base-work/security/selinux/include/selinux_netlabel.h
===
--- 
net-2.6.20_netlabel-base-work.orig/security/selinux/include/selinux_netlabel.h
+++ net-2.6.20_netlabel-base-work/security/selinux/include/selinux_netlabel.h
@@ -38,9 +38,7 @@
 
 #ifdef CONFIG_NETLABEL
 void selinux_netlbl_cache_invalidate(void);
-int selinux_netlbl_socket_post_create(struct socket *sock,
- int sock_family,
- u32 sid);
+int selinux_netlbl_socket_post_create(struct socket *sock);
 void selinux_netlbl_sock_graft(struct sock *sk, struct socket *sock);
 u32 selinux_netlbl_inet_conn_request(struct sk_buff *skb, u32 sock_sid);
 int selinux_netlbl_sock_rcv_skb(struct sk_security_struct *sksec,
@@ -48,9 +46,11 @@ int selinux_netlbl_sock_rcv_skb(struct s
struct avc_audit_data *ad);
 u32 selinux_netlbl_socket_getpeersec_stream(struct socket *sock);
 u32 selinux_netlbl_socket_getpeersec_dgram(struct sk_buff *skb);
+void selinux_netlbl_sk_security_reset(struct sk_security_struct *ssec,
+ int family);
 void selinux_netlbl_sk_security_init(struct sk_security_struct *ssec,
 int family);
-void selinux_netlbl_sk_clone_security(struct sk_security_struct *ssec,
+void selinux_netlbl_sk_security_clone(struct sk_security_struct *ssec,
  struct sk_security_struct *newssec);
 int selinux_netlbl_inode_permission(struct inode *inode, int mask);
 int selinux_netlbl_socket_setsockopt(struct socket *sock,
@@ -62,9 +62,7 @@ static inline void selinux_netlbl_cache_
return;
 }
 
-static inline int selinux_netlbl_socket_post_create(struct socket *sock,
-   

[PATCH 00/13] NetLabel cleanups for 2.6.20

2006-11-17 Thread paul . moore
This patchset consists of a lot of small-ish cleanups for NetLabel and in some
cases labeled networking in general.  I've tested these patches for the past
few days and I haven't seen any regressions so please consider them for the
net-2.6.20 git tree.

The patches are fairly varied so it doesn't make sense to go into too much
details here, please see each patch for an explanation of what it does.

--
paul moore
linux security @ hp
-
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/13] NetLabel: convert the unlabeled accept flag to use RCU

2006-11-17 Thread paul . moore
From: Paul Moore [EMAIL PROTECTED]

Currently the NetLabel unlabeled packet accept flag is an atomic type and it
is checked for every non-NetLabel packet which comes into the system but rarely
ever changed.  This patch changes this flag to a normal integer and protects it
with RCU locking.

Signed-off-by: Paul Moore [EMAIL PROTECTED]
---
 net/netlabel/netlabel_unlabeled.c |   28 +---
 1 files changed, 21 insertions(+), 7 deletions(-)

Index: net-2.6.20_netlabel-base-work/net/netlabel/netlabel_unlabeled.c
===
--- net-2.6.20_netlabel-base-work.orig/net/netlabel/netlabel_unlabeled.c
+++ net-2.6.20_netlabel-base-work/net/netlabel/netlabel_unlabeled.c
@@ -47,7 +47,8 @@
 #include netlabel_unlabeled.h
 
 /* Accept unlabeled packets flag */
-static atomic_t netlabel_unlabel_accept_flg = ATOMIC_INIT(0);
+static DEFINE_SPINLOCK(netlabel_unlabel_acceptflg_lock);
+static u8 netlabel_unlabel_acceptflg = 0;
 
 /* NetLabel Generic NETLINK CIPSOv4 family */
 static struct genl_family netlbl_unlabel_gnl_family = {
@@ -82,8 +83,12 @@ static void netlbl_unlabel_acceptflg_set
struct audit_buffer *audit_buf;
u8 old_val;
 
-   old_val = atomic_read(netlabel_unlabel_accept_flg);
-   atomic_set(netlabel_unlabel_accept_flg, value);
+   rcu_read_lock();
+   old_val = netlabel_unlabel_acceptflg;
+   spin_lock(netlabel_unlabel_acceptflg_lock);
+   netlabel_unlabel_acceptflg = value;
+   spin_unlock(netlabel_unlabel_acceptflg_lock);
+   rcu_read_unlock();
 
audit_buf = netlbl_audit_start_common(AUDIT_MAC_UNLBL_ALLOW,
  audit_info);
@@ -148,9 +153,11 @@ static int netlbl_unlabel_list(struct sk
goto list_failure;
}
 
+   rcu_read_lock();
ret_val = nla_put_u8(ans_skb,
 NLBL_UNLABEL_A_ACPTFLG,
-atomic_read(netlabel_unlabel_accept_flg));
+netlabel_unlabel_acceptflg);
+   rcu_read_unlock();
if (ret_val != 0)
goto list_failure;
 
@@ -236,10 +243,17 @@ int netlbl_unlabel_genl_init(void)
  */
 int netlbl_unlabel_getattr(struct netlbl_lsm_secattr *secattr)
 {
-   if (atomic_read(netlabel_unlabel_accept_flg) == 1)
-   return netlbl_secattr_init(secattr);
+   int ret_val;
+
+   rcu_read_lock();
+   if (netlabel_unlabel_acceptflg == 1) {
+   netlbl_secattr_init(secattr);
+   ret_val = 0;
+   } else
+   ret_val = -ENOMSG;
+   rcu_read_unlock();
 
-   return -ENOMSG;
+   return ret_val;
 }
 
 /**

--
paul moore
linux security @ hp
-
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 09/13] NetLabel: use the correct CIPSOv4 MLS label limits

2006-11-17 Thread paul . moore
From: Paul Moore [EMAIL PROTECTED]

The CIPSOv4 engine currently has MLS label limits which are slightly larger
than what the draft allows.  This is not a major problem due to the current
implementation but we should fix this so it doesn't bite us later.

Signed-off-by: Paul Moore [EMAIL PROTECTED]
---
 include/net/cipso_ipv4.h |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

Index: net-2.6.20_netlabel-base-work/include/net/cipso_ipv4.h
===
--- net-2.6.20_netlabel-base-work.orig/include/net/cipso_ipv4.h
+++ net-2.6.20_netlabel-base-work/include/net/cipso_ipv4.h
@@ -58,10 +58,10 @@
 #define CIPSO_V4_MAP_PASS 2
 
 /* limits */
-#define CIPSO_V4_MAX_REM_LVLS 256
+#define CIPSO_V4_MAX_REM_LVLS 255
 #define CIPSO_V4_INV_LVL  0x8000
 #define CIPSO_V4_MAX_LOC_LVLS (CIPSO_V4_INV_LVL - 1)
-#define CIPSO_V4_MAX_REM_CATS 65536
+#define CIPSO_V4_MAX_REM_CATS 65534
 #define CIPSO_V4_INV_CAT  0x8000
 #define CIPSO_V4_MAX_LOC_CATS (CIPSO_V4_INV_CAT - 1)
 

--
paul moore
linux security @ hp
-
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 03/13] NetLabel: change netlbl_secattr_init() to return void

2006-11-17 Thread paul . moore
From: Paul Moore [EMAIL PROTECTED]

The netlbl_secattr_init() function would always return 0 making it pointless
to have a return value.  This patch changes the function to return void.

Signed-off-by: Paul Moore [EMAIL PROTECTED]
---
 include/net/netlabel.h |6 ++
 1 files changed, 2 insertions(+), 4 deletions(-)

Index: net-2.6.20_netlabel-base-work/include/net/netlabel.h
===
--- net-2.6.20_netlabel-base-work.orig/include/net/netlabel.h
+++ net-2.6.20_netlabel-base-work/include/net/netlabel.h
@@ -169,14 +169,12 @@ static inline void netlbl_secattr_cache_
  * @secattr: the struct to initialize
  *
  * Description:
- * Initialize an already allocated netlbl_lsm_secattr struct.  Returns zero on
- * success, negative values on error.
+ * Initialize an already allocated netlbl_lsm_secattr struct.
  *
  */
-static inline int netlbl_secattr_init(struct netlbl_lsm_secattr *secattr)
+static inline void netlbl_secattr_init(struct netlbl_lsm_secattr *secattr)
 {
memset(secattr, 0, sizeof(*secattr));
-   return 0;
 }
 
 /**

--
paul moore
linux security @ hp
-
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 06/13] NetLabel: add tag verification when adding new CIPSOv4 DOI definitions

2006-11-17 Thread paul . moore
From: Paul Moore [EMAIL PROTECTED]

Currently the CIPSOv4 engine does not do any sort of checking when a new DOI
definition is added.  The tags are still verified but only as a side effect of
normal NetLabel operation (packet processing, socket labeling, etc.) which
would cause application errors due to the faulty configuration.  This patch
adds tag checking when new DOI definition are added allowing us to catch these
configuration problems when they happen.

Signed-off-by: Paul Moore [EMAIL PROTECTED]
---
 net/ipv4/cipso_ipv4.c |   14 ++
 1 files changed, 14 insertions(+)

Index: net-2.6.20_netlabel-base-work/net/ipv4/cipso_ipv4.c
===
--- net-2.6.20_netlabel-base-work.orig/net/ipv4/cipso_ipv4.c
+++ net-2.6.20_netlabel-base-work/net/ipv4/cipso_ipv4.c
@@ -448,8 +448,22 @@ static struct cipso_v4_doi *cipso_v4_doi
  */
 int cipso_v4_doi_add(struct cipso_v4_doi *doi_def)
 {
+   u32 iter;
+
if (doi_def == NULL || doi_def-doi == CIPSO_V4_DOI_UNKNOWN)
return -EINVAL;
+   for (iter = 0; iter  CIPSO_V4_TAG_MAXCNT; iter++) {
+   switch (doi_def-tags[iter]) {
+   case CIPSO_V4_TAG_RBITMAP:
+   break;
+   case CIPSO_V4_TAG_INVALID:
+   if (iter == 0)
+   return -EINVAL;
+   break;
+   default:
+   return -EINVAL;
+   }
+   }
 
doi_def-valid = 1;
INIT_RCU_HEAD(doi_def-rcu);

--
paul moore
linux security @ hp
-
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/13] NetLabel: use gfp_t instead of int where it makes sense

2006-11-17 Thread paul . moore
From: Paul Moore [EMAIL PROTECTED]

There were a few places in the NetLabel code where the int type was being used
instead of the gfp_t type, this patch corrects this mistake.

Signed-off-by: Paul Moore [EMAIL PROTECTED]
---
 include/net/netlabel.h |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

Index: net-2.6.20_netlabel-base-work/include/net/netlabel.h
===
--- net-2.6.20_netlabel-base-work.orig/include/net/netlabel.h
+++ net-2.6.20_netlabel-base-work/include/net/netlabel.h
@@ -205,7 +205,7 @@ static inline void netlbl_secattr_destro
  * pointer on success, or NULL on failure.
  *
  */
-static inline struct netlbl_lsm_secattr *netlbl_secattr_alloc(int flags)
+static inline struct netlbl_lsm_secattr *netlbl_secattr_alloc(gfp_t flags)
 {
return kzalloc(sizeof(struct netlbl_lsm_secattr), flags);
 }

--
paul moore
linux security @ hp
-
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/13] NetLabel: make netlbl_lsm_secattr struct easier/quicker to understand

2006-11-17 Thread paul . moore
From: Paul Moore [EMAIL PROTECTED]

The existing netlbl_lsm_secattr struct required the LSM to check all of the
fields to determine if any security attributes were present resulting in a lot
of work in the common case of no attributes.  This patch adds a 'flags' field
which is used to indicate which attributes are present in the structure; this
should allow the LSM to do a quick comparison to determine if the structure
holds any security attributes.

Example:

 if (netlbl_lsm_secattr-flags)
/* security attributes present */
 else
/* NO security attributes present */

Signed-off-by: Paul Moore [EMAIL PROTECTED]
---
 include/net/netlabel.h |   13 +++--
 net/ipv4/cipso_ipv4.c  |   22 ++
 net/netlabel/netlabel_kapi.c   |5 -
 security/selinux/ss/services.c |   24 
 4 files changed, 45 insertions(+), 19 deletions(-)

Index: net-2.6.20_netlabel-base-work/include/net/netlabel.h
===
--- net-2.6.20_netlabel-base-work.orig/include/net/netlabel.h
+++ net-2.6.20_netlabel-base-work/include/net/netlabel.h
@@ -111,11 +111,17 @@ struct netlbl_lsm_cache {
void (*free) (const void *data);
void *data;
 };
+#define NETLBL_SECATTR_NONE 0x
+#define NETLBL_SECATTR_DOMAIN   0x0001
+#define NETLBL_SECATTR_CACHE0x0002
+#define NETLBL_SECATTR_MLS_LVL  0x0004
+#define NETLBL_SECATTR_MLS_CAT  0x0008
 struct netlbl_lsm_secattr {
+   u32 flags;
+
char *domain;
 
u32 mls_lvl;
-   u32 mls_lvl_vld;
unsigned char *mls_cat;
size_t mls_cat_len;
 
@@ -174,7 +180,10 @@ static inline void netlbl_secattr_cache_
  */
 static inline void netlbl_secattr_init(struct netlbl_lsm_secattr *secattr)
 {
-   memset(secattr, 0, sizeof(*secattr));
+   secattr-flags = 0;
+   secattr-domain = NULL;
+   secattr-mls_cat = NULL;
+   secattr-cache = NULL;
 }
 
 /**
Index: net-2.6.20_netlabel-base-work/net/ipv4/cipso_ipv4.c
===
--- net-2.6.20_netlabel-base-work.orig/net/ipv4/cipso_ipv4.c
+++ net-2.6.20_netlabel-base-work/net/ipv4/cipso_ipv4.c
@@ -319,6 +319,7 @@ static int cipso_v4_cache_check(const un
entry-activity += 1;
atomic_inc(entry-lsm_data-refcount);
secattr-cache = entry-lsm_data;
+   secattr-flags |= NETLBL_SECATTR_CACHE;
if (prev_entry == NULL) {
spin_unlock_bh(cipso_v4_cache[bkt].lock);
return 0;
@@ -992,12 +993,15 @@ static int cipso_v4_gentag_rbm(const str
   unsigned char **buffer,
   u32 *buffer_len)
 {
-   int ret_val = -EPERM;
+   int ret_val;
unsigned char *buf = NULL;
u32 buf_len;
u32 level;
 
-   if (secattr-mls_cat) {
+   if ((secattr-flags  NETLBL_SECATTR_MLS_LVL) == 0)
+   return -EPERM;
+
+   if (secattr-flags  NETLBL_SECATTR_MLS_CAT) {
buf = kzalloc(CIPSO_V4_HDR_LEN + 4 + CIPSO_V4_TAG1_CAT_LEN,
  GFP_ATOMIC);
if (buf == NULL)
@@ -1014,10 +1018,10 @@ static int cipso_v4_gentag_rbm(const str
/* This will send packets using the optimized format when
 * possibile as specified in  section 3.4.2.6 of the
 * CIPSO draft. */
-   if (cipso_v4_rbm_optfmt  (ret_val  0  ret_val  10))
-   ret_val = 10;
-
-   buf_len = 4 + ret_val;
+   if (cipso_v4_rbm_optfmt  ret_val  0  ret_val = 10)
+   buf_len = 14;
+   else
+   buf_len = 4 + ret_val;
} else {
buf = kzalloc(CIPSO_V4_HDR_LEN + 4, GFP_ATOMIC);
if (buf == NULL)
@@ -1071,7 +1075,7 @@ static int cipso_v4_parsetag_rbm(const s
if (ret_val != 0)
return ret_val;
secattr-mls_lvl = level;
-   secattr-mls_lvl_vld = 1;
+   secattr-flags |= NETLBL_SECATTR_MLS_LVL;
 
if (tag_len  4) {
switch (doi_def-type) {
@@ -1095,8 +1099,10 @@ static int cipso_v4_parsetag_rbm(const s
if (ret_val  0) {
kfree(secattr-mls_cat);
return ret_val;
+   } else if (ret_val  0) {
+   secattr-mls_cat_len = ret_val;
+   secattr-flags |= NETLBL_SECATTR_MLS_CAT;
}
-   secattr-mls_cat_len = ret_val;
}
 
return 0;
Index: net-2.6.20_netlabel-base-work/net/netlabel/netlabel_kapi.c
===
--- net-2.6.20_netlabel-base-work.orig/net/netlabel/netlabel_kapi.c
+++ 

[PATCH 13/13] NetLabel: honor the audit_enabled flag

2006-11-17 Thread paul . moore
From: Paul Moore [EMAIL PROTECTED]

The audit_enabled flag is used to signal when syscall auditing is to be
performed.  While NetLabel uses a Netlink interface instead of syscalls, it is
reasonable to consider the NetLabel Netlink interface as a form of syscall so
pay attention to the audit_enabled flag when generating audit messages in
NetLabel.

Signed-off-by: Paul Moore [EMAIL PROTECTED]
---
 net/netlabel/netlabel_cipso_v4.c   |   26 +++-
 net/netlabel/netlabel_domainhash.c |   48 -
 net/netlabel/netlabel_unlabeled.c  |8 --
 net/netlabel/netlabel_user.c   |7 +
 4 files changed, 50 insertions(+), 39 deletions(-)

Index: net-2.6.20_netlabel-base-work/net/netlabel/netlabel_cipso_v4.c
===
--- net-2.6.20_netlabel-base-work.orig/net/netlabel/netlabel_cipso_v4.c
+++ net-2.6.20_netlabel-base-work/net/netlabel/netlabel_cipso_v4.c
@@ -407,12 +407,14 @@ static int netlbl_cipsov4_add(struct sk_
 
audit_buf = netlbl_audit_start_common(AUDIT_MAC_CIPSOV4_ADD,
  audit_info);
-   audit_log_format(audit_buf,
- cipso_doi=%u cipso_type=%s res=%u,
-doi,
-type_str,
-ret_val == 0 ? 1 : 0);
-   audit_log_end(audit_buf);
+   if (audit_buf != NULL) {
+   audit_log_format(audit_buf,
+ cipso_doi=%u cipso_type=%s res=%u,
+doi,
+type_str,
+ret_val == 0 ? 1 : 0);
+   audit_log_end(audit_buf);
+   }
 
return ret_val;
 }
@@ -680,11 +682,13 @@ static int netlbl_cipsov4_remove(struct 
 
audit_buf = netlbl_audit_start_common(AUDIT_MAC_CIPSOV4_DEL,
  audit_info);
-   audit_log_format(audit_buf,
- cipso_doi=%u res=%u,
-doi,
-ret_val == 0 ? 1 : 0);
-   audit_log_end(audit_buf);
+   if (audit_buf != NULL) {
+   audit_log_format(audit_buf,
+ cipso_doi=%u res=%u,
+doi,
+ret_val == 0 ? 1 : 0);
+   audit_log_end(audit_buf);
+   }
 
return ret_val;
 }
Index: net-2.6.20_netlabel-base-work/net/netlabel/netlabel_domainhash.c
===
--- net-2.6.20_netlabel-base-work.orig/net/netlabel/netlabel_domainhash.c
+++ net-2.6.20_netlabel-base-work/net/netlabel/netlabel_domainhash.c
@@ -202,7 +202,6 @@ int netlbl_domhsh_add(struct netlbl_dom_
int ret_val;
u32 bkt;
struct audit_buffer *audit_buf;
-   char *audit_domain;
 
switch (entry-type) {
case NETLBL_NLTYPE_UNLABELED:
@@ -243,24 +242,24 @@ int netlbl_domhsh_add(struct netlbl_dom_
} else
ret_val = -EINVAL;
 
-   if (entry-domain != NULL)
-   audit_domain = entry-domain;
-   else
-   audit_domain = (default);
audit_buf = netlbl_audit_start_common(AUDIT_MAC_MAP_ADD, audit_info);
-   audit_log_format(audit_buf,  nlbl_domain=%s, audit_domain);
-   switch (entry-type) {
-   case NETLBL_NLTYPE_UNLABELED:
-   audit_log_format(audit_buf,  nlbl_protocol=unlbl);
-   break;
-   case NETLBL_NLTYPE_CIPSOV4:
+   if (audit_buf != NULL) {
audit_log_format(audit_buf,
- nlbl_protocol=cipsov4 cipso_doi=%u,
-entry-type_def.cipsov4-doi);
-   break;
+ nlbl_domain=%s,
+entry-domain ? entry-domain : (default));
+   switch (entry-type) {
+   case NETLBL_NLTYPE_UNLABELED:
+   audit_log_format(audit_buf,  nlbl_protocol=unlbl);
+   break;
+   case NETLBL_NLTYPE_CIPSOV4:
+   audit_log_format(audit_buf,
+ nlbl_protocol=cipsov4 cipso_doi=%u,
+entry-type_def.cipsov4-doi);
+   break;
+   }
+   audit_log_format(audit_buf,  res=%u, ret_val == 0 ? 1 : 0);
+   audit_log_end(audit_buf);
}
-   audit_log_format(audit_buf,  res=%u, ret_val == 0 ? 1 : 0);
-   audit_log_end(audit_buf);
 
rcu_read_unlock();
 
@@ -310,7 +309,6 @@ int netlbl_domhsh_remove(const char *dom
int ret_val = -ENOENT;
struct netlbl_dom_map *entry;
struct audit_buffer *audit_buf;
-   char *audit_domain;
 
rcu_read_lock();
if (domain != NULL)
@@ -348,16 +346,14 @@ int netlbl_domhsh_remove(const char *dom
 

[PATCH 05/13] NetLabel: check for a CIPSOv4 option before we do call into the CIPSOv4 layer

2006-11-17 Thread paul . moore
From: Paul Moore [EMAIL PROTECTED]

Right now the NetLabel code always jumps into the CIPSOv4 layer to determine if
a CIPSO IP option is present.  However, we can do this check directly in the
NetLabel code by making use of the CIPSO_V4_OPTEXIST() macro which should save
us a function call in the common case of not having a CIPSOv4 option present.

Signed-off-by: Paul Moore [EMAIL PROTECTED]
---
 net/ipv4/cipso_ipv4.c|2 --
 net/netlabel/netlabel_kapi.c |6 ++
 2 files changed, 2 insertions(+), 6 deletions(-)

Index: net-2.6.20_netlabel-base-work/net/ipv4/cipso_ipv4.c
===
--- net-2.6.20_netlabel-base-work.orig/net/ipv4/cipso_ipv4.c
+++ net-2.6.20_netlabel-base-work/net/ipv4/cipso_ipv4.c
@@ -1436,8 +1436,6 @@ int cipso_v4_skbuff_getattr(const struct
u32 doi;
struct cipso_v4_doi *doi_def;
 
-   if (!CIPSO_V4_OPTEXIST(skb))
-   return -ENOMSG;
cipso_ptr = CIPSO_V4_OPTPTR(skb);
if (cipso_v4_cache_check(cipso_ptr, cipso_ptr[1], secattr) == 0)
return 0;
Index: net-2.6.20_netlabel-base-work/net/netlabel/netlabel_kapi.c
===
--- net-2.6.20_netlabel-base-work.orig/net/netlabel/netlabel_kapi.c
+++ net-2.6.20_netlabel-base-work/net/netlabel/netlabel_kapi.c
@@ -149,10 +149,8 @@ int netlbl_socket_getattr(const struct s
 int netlbl_skbuff_getattr(const struct sk_buff *skb,
  struct netlbl_lsm_secattr *secattr)
 {
-   int ret_val;
-
-   ret_val = cipso_v4_skbuff_getattr(skb, secattr);
-   if (ret_val == 0)
+   if (CIPSO_V4_OPTEXIST(skb) 
+   cipso_v4_skbuff_getattr(skb, secattr) == 0)
return 0;
 
return netlbl_unlabel_getattr(secattr);

--
paul moore
linux security @ hp
-
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 12/13] SELinux: peer secid consolidation for external network labeling

2006-11-17 Thread paul . moore
From: Paul Moore [EMAIL PROTECTED]

Now that labeled IPsec makes use of the peer_sid field in the
sk_security_struct we can remove a lot of the special cases between labeled
IPsec and NetLabel.  In addition, create a new function,
security_skb_extlbl_sid(), which we can use in several places to get the
security context of the packet's external label which allows us to further
simplify the code in a few places.

Signed-off-by: Paul Moore [EMAIL PROTECTED]
---
 security/selinux/hooks.c|   43 +++--
 security/selinux/include/security.h |3 
 security/selinux/include/selinux_netlabel.h |   28 ++--
 security/selinux/include/xfrm.h |5 -
 security/selinux/ss/services.c  |   90 
 security/selinux/xfrm.c |   33 --
 6 files changed, 52 insertions(+), 150 deletions(-)

Index: net-2.6.20_netlabel-base-work/security/selinux/hooks.c
===
--- net-2.6.20_netlabel-base-work.orig/security/selinux/hooks.c
+++ net-2.6.20_netlabel-base-work/security/selinux/hooks.c
@@ -3573,27 +3573,16 @@ static int selinux_socket_getpeersec_str
u32 scontext_len;
struct sk_security_struct *ssec;
struct inode_security_struct *isec;
-   u32 peer_sid = 0;
+   u32 peer_sid = SECSID_NULL;
 
isec = SOCK_INODE(sock)-i_security;
 
-   /* if UNIX_STREAM check peer_sid, if TCP check dst for labelled sa */
-   if (isec-sclass == SECCLASS_UNIX_STREAM_SOCKET) {
+   if (isec-sclass == SECCLASS_UNIX_STREAM_SOCKET ||
+   isec-sclass == SECCLASS_TCP_SOCKET) {
ssec = sock-sk-sk_security;
peer_sid = ssec-peer_sid;
}
-   else if (isec-sclass == SECCLASS_TCP_SOCKET) {
-   peer_sid = selinux_netlbl_socket_getpeersec_stream(sock);
-   if (peer_sid == SECSID_NULL) {
-   ssec = sock-sk-sk_security;
-   peer_sid = ssec-peer_sid;
-   }
-   if (peer_sid == SECSID_NULL) {
-   err = -ENOPROTOOPT;
-   goto out;
-   }
-   }
-   else {
+   if (peer_sid == SECSID_NULL) {
err = -ENOPROTOOPT;
goto out;
}
@@ -3625,13 +3614,12 @@ static int selinux_socket_getpeersec_dgr
u32 peer_secid = SECSID_NULL;
int err = 0;
 
-   if (sock  (sock-sk-sk_family == PF_UNIX))
+   if (sock  sock-sk-sk_family == PF_UNIX)
selinux_get_inode_sid(SOCK_INODE(sock), peer_secid);
-   else if (skb) {
-   peer_secid = selinux_netlbl_socket_getpeersec_dgram(skb);
-   if (peer_secid == SECSID_NULL)
-   peer_secid = selinux_socket_getpeer_dgram(skb);
-   }
+   else if (skb)
+   security_skb_extlbl_sid(skb,
+   SECINITSID_UNLABELED,
+   peer_secid);
 
if (peer_secid == SECSID_NULL)
err = -EINVAL;
@@ -3692,17 +3680,10 @@ static int selinux_inet_conn_request(str
u32 newsid;
u32 peersid;
 
-   newsid = selinux_netlbl_inet_conn_request(skb, sksec-sid);
-   if (newsid != SECSID_NULL) {
-   req-secid = newsid;
-   return 0;
-   }
-
-   selinux_skb_xfrm_sid(skb, peersid);
-
+   security_skb_extlbl_sid(skb, SECINITSID_UNLABELED, peersid);
if (peersid == SECSID_NULL) {
req-secid = sksec-sid;
-   req-peer_secid = 0;
+   req-peer_secid = SECSID_NULL;
return 0;
}
 
@@ -3737,7 +3718,7 @@ static void selinux_inet_conn_establishe
 {
struct sk_security_struct *sksec = sk-sk_security;
 
-   selinux_skb_xfrm_sid(skb, sksec-peer_sid);
+   security_skb_extlbl_sid(skb, SECINITSID_UNLABELED, sksec-peer_sid);
 }
 
 static void selinux_req_classify_flow(const struct request_sock *req,
Index: net-2.6.20_netlabel-base-work/security/selinux/include/security.h
===
--- net-2.6.20_netlabel-base-work.orig/security/selinux/include/security.h
+++ net-2.6.20_netlabel-base-work/security/selinux/include/security.h
@@ -8,6 +8,7 @@
 #ifndef _SELINUX_SECURITY_H_
 #define _SELINUX_SECURITY_H_
 
+#include linux/skbuff.h
 #include flask.h
 
 #define SECSID_NULL0x /* unspecified SID */
@@ -80,6 +81,8 @@ int security_netif_sid(char *name, u32 *
 int security_node_sid(u16 domain, void *addr, u32 addrlen,
u32 *out_sid);
 
+void security_skb_extlbl_sid(struct sk_buff *skb, u32 base_sid, u32 *sid);
+
 int security_validate_transition(u32 oldsid, u32 newsid, u32 tasksid,
  u16 tclass);
 
Index: net-2.6.20_netlabel-base-work/security/selinux/include/selinux_netlabel.h

[PATCH 07/13] NetLabel: fixup the handling of CIPSOv4 tags to allow for multiple tag types

2006-11-17 Thread paul . moore
From: Paul Moore [EMAIL PROTECTED]

While the original CIPSOv4 code had provisions for multiple tag types the
implementation was not as great as it could be, pushing a lot of non-tag
specific processing into the tag specific code blocks.  This patch fixes that
issue making it easier to support multiple tag types in the future.

Signed-off-by: Paul Moore [EMAIL PROTECTED]
---
 net/ipv4/cipso_ipv4.c |  115 +++---
 1 files changed, 54 insertions(+), 61 deletions(-)

Index: net-2.6.20_netlabel-base-work/net/ipv4/cipso_ipv4.c
===
--- net-2.6.20_netlabel-base-work.orig/net/ipv4/cipso_ipv4.c
+++ net-2.6.20_netlabel-base-work/net/ipv4/cipso_ipv4.c
@@ -959,35 +959,28 @@ static int cipso_v4_map_cat_rbm_ntoh(con
  * Protocol Handling Functions
  */
 
+#define CIPSO_V4_OPT_LEN_MAX  40
 #define CIPSO_V4_HDR_LEN  6
 
 /**
  * cipso_v4_gentag_hdr - Generate a CIPSO option header
  * @doi_def: the DOI definition
- * @len: the total tag length in bytes
+ * @len: the total tag length in bytes, not including this header
  * @buf: the CIPSO option buffer
  *
  * Description:
- * Write a CIPSO header into the beginning of @buffer.  Return zero on success,
- * negative values on failure.
+ * Write a CIPSO header into the beginning of @buffer.
  *
  */
-static int cipso_v4_gentag_hdr(const struct cipso_v4_doi *doi_def,
-  u32 len,
-  unsigned char *buf)
+static void cipso_v4_gentag_hdr(const struct cipso_v4_doi *doi_def,
+   unsigned char *buf,
+   u32 len)
 {
-   if (CIPSO_V4_HDR_LEN + len  40)
-   return -ENOSPC;
-
buf[0] = IPOPT_CIPSO;
buf[1] = CIPSO_V4_HDR_LEN + len;
*(__be32 *)buf[2] = htonl(doi_def-doi);
-
-   return 0;
 }
 
-#define CIPSO_V4_TAG1_CAT_LEN 30
-
 /**
  * cipso_v4_gentag_rbm - Generate a CIPSO restricted bitmap tag (type #1)
  * @doi_def: the DOI definition
@@ -998,71 +991,50 @@ static int cipso_v4_gentag_hdr(const str
  * Description:
  * Generate a CIPSO option using the restricted bitmap tag, tag type #1.  The
  * actual buffer length may be larger than the indicated size due to
- * translation between host and network category bitmaps.  Returns zero on
- * success, negative values on failure.
+ * translation between host and network category bitmaps.  Returns the size of
+ * the tag on success, negative values on failure.
  *
  */
 static int cipso_v4_gentag_rbm(const struct cipso_v4_doi *doi_def,
   const struct netlbl_lsm_secattr *secattr,
-  unsigned char **buffer,
-  u32 *buffer_len)
+  unsigned char *buffer,
+  u32 buffer_len)
 {
int ret_val;
-   unsigned char *buf = NULL;
-   u32 buf_len;
+   u32 tag_len;
u32 level;
 
if ((secattr-flags  NETLBL_SECATTR_MLS_LVL) == 0)
return -EPERM;
 
-   if (secattr-flags  NETLBL_SECATTR_MLS_CAT) {
-   buf = kzalloc(CIPSO_V4_HDR_LEN + 4 + CIPSO_V4_TAG1_CAT_LEN,
- GFP_ATOMIC);
-   if (buf == NULL)
-   return -ENOMEM;
+   ret_val = cipso_v4_map_lvl_hton(doi_def, secattr-mls_lvl, level);
+   if (ret_val != 0)
+   return ret_val;
 
+   if (secattr-flags  NETLBL_SECATTR_MLS_CAT) {
ret_val = cipso_v4_map_cat_rbm_hton(doi_def,
secattr-mls_cat,
secattr-mls_cat_len,
-   buf[CIPSO_V4_HDR_LEN + 4],
-   CIPSO_V4_TAG1_CAT_LEN);
+   buffer[4],
+   buffer_len - 4);
if (ret_val  0)
-   goto gentag_failure;
+   return ret_val;
 
/* This will send packets using the optimized format when
 * possibile as specified in  section 3.4.2.6 of the
 * CIPSO draft. */
if (cipso_v4_rbm_optfmt  ret_val  0  ret_val = 10)
-   buf_len = 14;
+   tag_len = 14;
else
-   buf_len = 4 + ret_val;
-   } else {
-   buf = kzalloc(CIPSO_V4_HDR_LEN + 4, GFP_ATOMIC);
-   if (buf == NULL)
-   return -ENOMEM;
-   buf_len = 4;
-   }
-
-   ret_val = cipso_v4_map_lvl_hton(doi_def, secattr-mls_lvl, level);
-   if (ret_val != 0)
-   goto gentag_failure;
-
-   ret_val = cipso_v4_gentag_hdr(doi_def, buf_len, buf);
-   if (ret_val != 0)
-   goto 

[PATCH] d80211: remove useless driver name field

2006-11-17 Thread Johannes Berg
struct ieee80211_ops has a driver name field that's never used.
Remove it.

Signed-off-by: Johannes Berg [EMAIL PROTECTED]

---
applies after the 10 patches

--- wireless-dev.orig/include/net/d80211.h  2006-11-17 23:37:10.249703408 
+0100
+++ wireless-dev/include/net/d80211.h   2006-11-17 23:37:21.709703408 +0100
@@ -531,9 +531,6 @@ struct ieee80211_wiphy {
  * about supported hardware features and to pass function pointers to callback
  * functions. */
 struct ieee80211_ops {
-   /* Driver name */
-   char *name;
-
/* Handler that 802.11 module calls for each transmitted frame.
 * skb contains the buffer starting from the IEEE 802.11 header.
 * The low-level driver should send the frame out based on


-
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/13] NetLabel: use cipso_v4_doi_search() for local CIPSOv4 functions

2006-11-17 Thread paul . moore
From: Paul Moore [EMAIL PROTECTED]

The cipso_v4_doi_search() function behaves the same as cipso_v4_doi_getdef()
but is a local, static function so use it whenever possibile in the CIPSOv4
code base.

Signed-of-by: Paul Moore [EMAIL PROTECTED]
---
 net/ipv4/cipso_ipv4.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

Index: net-2.6.20_netlabel-base-work/net/ipv4/cipso_ipv4.c
===
--- net-2.6.20_netlabel-base-work.orig/net/ipv4/cipso_ipv4.c
+++ net-2.6.20_netlabel-base-work/net/ipv4/cipso_ipv4.c
@@ -1136,7 +1136,7 @@ int cipso_v4_validate(unsigned char **op
}
 
rcu_read_lock();
-   doi_def = cipso_v4_doi_getdef(ntohl(*((__be32 *)opt[2])));
+   doi_def = cipso_v4_doi_search(ntohl(*((u32 *)opt[2])));
if (doi_def == NULL) {
err_offset = 2;
goto validate_return_locked;
@@ -1381,7 +1381,7 @@ int cipso_v4_sock_getattr(struct sock *s
 
doi = ntohl(*(__be32 *)cipso_ptr[2]);
rcu_read_lock();
-   doi_def = cipso_v4_doi_getdef(doi);
+   doi_def = cipso_v4_doi_search(doi);
if (doi_def == NULL) {
rcu_read_unlock();
return -ENOMSG;
@@ -1449,7 +1449,7 @@ int cipso_v4_skbuff_getattr(const struct
 
doi = ntohl(*(__be32 *)cipso_ptr[2]);
rcu_read_lock();
-   doi_def = cipso_v4_doi_getdef(doi);
+   doi_def = cipso_v4_doi_search(doi);
if (doi_def == NULL)
goto skbuff_getattr_return;
 

--
paul moore
linux security @ hp
-
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/10] d80211: move away from wmaster towards wiphy

2006-11-17 Thread Pavel Roskin
Hello Johannes,

On Fri, 2006-11-17 at 23:27 +0100, Johannes Berg wrote:

 Since it looks like we'll be able to move the qdisc stuff over to a new
 wiphy concept the master device is getting completely useless. Joy :)

Could you please provide details about the solution?  Maybe a link?

Here's what I would consider:

1) Accept wiphy as a network device.  This would be a rare case of
polymorphism in the kernel, which would make me feel uneasy.

2) Introduce a notion of the secondary queue of the device, which
would be the master queue for the virtual d80211 network devices.  This
could be extended to other virtual interfaces (e.g. VLAN).  Virtual
devices sharing the hardware would have the same secondary queue.  In
the case of VLAN, the secondary queue of one VLAN device would be the
primary queue of the physical device.

3) Have a way to create the master device on demand from wiphy or a
virtual device specifically for the purpose of manipulating its queue.

4) Introduce hidden network devices, seen by tc but not by ifconfig,
route et al.  Make the master hidden.

I wonder if you invented something better than that.

 d80211: clean up some stupid list and loop code
 d80211: reduce mdev usage
 d80211: reduce mdev usage
 d80211: reduce mdev usage, fix ieee80211_rx_mgmt
 d80211: reduce master ieee80211_ptr deref in scan routines

I think these are pretty uncontroversial, especially the loop code.  The
rest may need some wider and longer discussion (at least give driver
maintainers and the top kernel folks a chance to look at what you are
suggesting).

-- 
Regards,
Pavel Roskin


-
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


d80211: RFC: divide by zero when hw-maxssi not set

2006-11-17 Thread David Kimdon
Hi,

commit 448bf25bc9e3d70a211fdf235426472089371c43 added
ieee80211_get_wireless_stats in net/d80211/ieee80211_ioctl.c.  At
present we get a divide by zero (oops) if the low level driver does
not set the new hw-maxssi field.  Perhaps:

- reject registration of devices which do not set maxssi
- do not attempt to report link quality for drivers which do not 
  set maxssi
- other ideas? 

-David
-
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: Generic Netlink HOW-TO based on Jamal's original doc

2006-11-17 Thread Paul Moore
jamal wrote:
 #1. I think the content layout has improved over the previous doc. So
 good stuff.
 Something still bothers me though; whether there is too much theory or
 verbosity (not that this long email has any of those
 characteristics;-). I am wondering if that affects usability. As a
 litmus test, what would be the answer to the question:
 If i didnt know anything about generic netlink, how long do i need to
 spend and immediately start programming?
 I dont think it is 5 minutes. Can we make it a 5 minute effort?
 
 I think this is partially my fault because thats how i laid out the
 original doc (and always is my style) - but you added more;-
 
 Heres a thought:
 
 ** lay it out is to have two sections:
 
 I. A LinuxWay section (others call it genetic programming!)
 
 a) heres an example for the kernel and heres the controller from user
 space
 b) heres what all different fields mean

I think we are best off punting on the userspace as there a multiple ways to do
it: use good ole fashioned socket calls, the libnl library, or some other way
that hasn't been written yet.  Besides, Thomas already has some pretty good
userspace documentation written for libnl; no sense in duplicating that effort.

That said, there is a kernel space example and a field breakdown; did that look
okay?  If the content is good but the layout is off we can always move it up
closer to the top of the document.  If the content needs work lets deal with
that first ...

 II. Here are all the nitty gritty details your mother never told you.
 
 What this means is someone can immediately jump to Ia) do it the
 LinuxWay(tm). When in doubt will read Ib) and when in further doubt will
 read II.
 [Actually Andrew Morton contented that nobody needs more than section I
 when i first posted the doc].

Well, if we are talking about *needs* then nobody really needs more than the
source code.  IMHO the main reason for documentation is to help speed along the
understanding of the code so it becomes more accessibile.  I can see their being
value for including both section I and section II material in the document.

 I know this is a big change, so it will depend on how much time you
 have. I also think people may be happy with it in its current form. It
 would be nice to get feedback from someone who has used it.

Well, it's Friday night and I've got a big football game to watch tommorrow so
I'm probably not going to devote much time to this until Monday.  Let's see what
 other people have to say in the meantime.  We can always just submit/post it
and play with it as time permits.

One of the main reasons I wanted to post my changes is because I found your
original document helpful when writing NetLabel but I didn't know about when I
started because it wasn't located in the usual places (I had to pick it out of
the mailing list archives).  I think having a Generic Netlink document in
Documentation/ and/or on the OSDL network wiki is a good thing - even if it
isn't perfect.

 2) Hey - you got rid of foobar[1] and googah ;- I love those terms.
 No big deal - you own the doc now, so you can get away with things like
 that ;-

Don't take it personally, it's just step one in my master plan to remove all
references too googah from the english language.  Muwahahaha!

 3) Why not create a references section at the end and move all the
 references you have scattered every there instead? 

I tend to like the actual references closer to the referring text (I dislike
scrolling) but I'm not too hung up on this, I can move it.

 4) Terminology is still confusing even to me. We most definetely need
 such a section. For example, I dont like the term family to descrive
 those boxes that sit in the kernel. But i dont know what else to call
 them. Also looking closely at Thomas' introduction of the thing called
 nla_policy - it really oughta have been called attribute property.
 To add to this chaos - you introduced something you call a channel. A
 little confusing although sounds right ;- I think the previous doc had
 attempted something like a section on terms introduced by Balbir. But
 you may have gotten rid of it.

Yeah, I stuggled with that the entire time I was writing that draft.  I'm still
not entirely happy with it either but I decided that I was tired of worrying
about it so I just sent it out.

I don't remember a section on terminology in your original doc, but I'll go back
and check.

 5) For registration of commands and families, you dont show the user
 handling return codes which could be errors. If this doc becomes
 scripture it could mean trouble. Just a cutnpaste from the original doc
 should suffice. 

Good point, I included it in the other examples but not that one - I'll fix it.

 6) There is still a lot of content for theory mostly that is missing.
 I noticed you dont have async events, discovery etc. And there are still
 a few ideas i would like to discuss with Thomas and send patches for
 later.

Yep, I was trying to get it fairly small so 

Re: d80211: RFC: divide by zero when hw-maxssi not set

2006-11-17 Thread Michael Wu
On Friday 17 November 2006 18:51, David Kimdon wrote:
 - reject registration of devices which do not set maxssi
 - do not attempt to report link quality for drivers which do not
   set maxssi
 - other ideas?

I've noticed that too. p54 didn't get a driver update when maxssi was added. I 
don't mind adding a dummy maxssi just to make sure we don't divide by zero. 
In fact, I'm going to come up with a patch for p54 to do that soon.

-Michael Wu


pgp67DV8dGnpA.pgp
Description: PGP signature


Re: [PATCH 0/10] d80211: move away from wmaster towards wiphy

2006-11-17 Thread Johannes Berg

 No driver updates for now, sorry.

Ah well, here we go :)

bcm43xx patch to go with this. I noticed one bug in my other patches, if
you have already downloaded them please do so again.

This thing will conflict with lots of things Michael has in his tree,
but just as a starting point... Working fine here :)

Signed-off-by: Johannes Berg [EMAIL PROTECTED]

--- wireless-dev.orig/drivers/net/wireless/d80211/bcm43xx/Makefile  
2006-11-18 01:08:58.639703408 +0100
+++ wireless-dev/drivers/net/wireless/d80211/bcm43xx/Makefile   2006-11-18 
01:09:16.419703408 +0100
@@ -7,6 +7,6 @@ bcm43xx-d80211-obj-$(CONFIG_BCM43XX_D802
 bcm43xx-d80211-objs := bcm43xx_main.o bcm43xx_ilt.o \
   bcm43xx_radio.o bcm43xx_phy.o \
   bcm43xx_power.o bcm43xx_sysfs.o \
-  bcm43xx_leds.o bcm43xx_ethtool.o \
+  bcm43xx_leds.o \
   bcm43xx_xmit.o \
   $(bcm43xx-d80211-obj-y)
--- wireless-dev.orig/drivers/net/wireless/d80211/bcm43xx/bcm43xx.h 
2006-11-18 01:08:58.699703408 +0100
+++ wireless-dev/drivers/net/wireless/d80211/bcm43xx/bcm43xx.h  2006-11-18 
01:09:16.419703408 +0100
@@ -679,10 +679,9 @@ struct bcm43xx_private {
/* The Sonics Silicon Backplane. */
struct ssb ssb;
 
-   struct ieee80211_hw *ieee;
+   struct ieee80211_wiphy *wiphy;
struct ieee80211_low_level_stats ieee_stats;
 
-   struct net_device *net_dev;
unsigned int irq;
 
spinlock_t irq_lock;
@@ -770,9 +769,9 @@ struct bcm43xx_private {
 
 
 static inline
-struct bcm43xx_private * bcm43xx_priv(struct net_device *dev)
+struct bcm43xx_private * bcm43xx_priv(struct ieee80211_wiphy *wiphy)
 {
-   return ieee80211_dev_hw_data(dev);
+   return wiphy-priv;
 }
 
 static inline
@@ -854,13 +853,7 @@ 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;
+   return dev_get_drvdata(dev);
 }
 
 /* Is the device operating in a specified mode (IEEE80211_IF_TYPE_XXX). */
--- wireless-dev.orig/drivers/net/wireless/d80211/bcm43xx/bcm43xx_debugfs.c 
2006-11-18 01:08:58.789703408 +0100
+++ wireless-dev/drivers/net/wireless/d80211/bcm43xx/bcm43xx_debugfs.c  
2006-11-18 01:09:16.419703408 +0100
@@ -285,7 +285,7 @@ void bcm43xx_debugfs_add_device(struct b
 {
struct bcm43xx_dfsentry *e;
struct bcm43xx_txstatus_log *log;
-   char devdir[IFNAMSIZ];
+   char devdir[16];
 
assert(bcm);
e = kzalloc(sizeof(*e), GFP_KERNEL);
@@ -308,7 +308,7 @@ void bcm43xx_debugfs_add_device(struct b
 
bcm-dfsentry = e;
 
-   strncpy(devdir, bcm-net_dev-name, ARRAY_SIZE(devdir));
+   snprintf(devdir, sizeof(devdir), wiphy%d, bcm-wiphy-index);
e-subdir = debugfs_create_dir(devdir, fs.root);
e-dentry_tsf = debugfs_create_file(tsf, 0666, e-subdir,
bcm, tsf_fops);
--- wireless-dev.orig/drivers/net/wireless/d80211/bcm43xx/bcm43xx_dma.c 
2006-11-18 01:08:58.819703408 +0100
+++ wireless-dev/drivers/net/wireless/d80211/bcm43xx/bcm43xx_dma.c  
2006-11-18 01:09:16.429703408 +0100
@@ -525,7 +525,6 @@ static int setup_rx_descbuffer(struct bc
 ring-rx_buffersize, 0);
meta-skb = skb;
meta-dmaaddr = dmaaddr;
-   skb-dev = ring-bcm-net_dev;
 
ring-ops-fill_descriptor(ring, desc, dmaaddr,
   ring-rx_buffersize, 0, 0, 0);
@@ -1091,7 +1090,7 @@ int bcm43xx_dma_tx(struct bcm43xx_privat
ring-nr_tx_packets++;
if (free_slots(ring)  SLOTS_PER_PACKET) {
/* FIXME: we currently only have one queue */
-   ieee80211_stop_queue(bcm-net_dev, 0);
+   ieee80211_stop_queue(bcm-wiphy, 0);
ring-stopped = 1;
}
 
@@ -1130,7 +1129,7 @@ void bcm43xx_dma_handle_txstatus(struct 
if (status-acked)
meta-txstat.flags |= IEEE80211_TX_STATUS_ACK;
meta-txstat.retry_count = status-frame_count - 1;
-   ieee80211_tx_status_irqsafe(bcm-net_dev, meta-skb, 
(meta-txstat));
+   ieee80211_tx_status_irqsafe(bcm-wiphy, meta-skb, 
(meta-txstat));
/* skb is freed by ieee80211_tx_status_irqsafe() */
} else {
/* No need to call free_descriptor_buffer here, as
@@ -1151,7 +1150,7 @@ void bcm43xx_dma_handle_txstatus(struct 
if (ring-stopped) {
assert(free_slots(ring) = SLOTS_PER_PACKET);
/* FIXME: we currently only have one queue */
-   ieee80211_wake_queue(bcm-net_dev, 0);
+   ieee80211_wake_queue(bcm-wiphy, 0);
ring-stopped = 0;
}

[PATCH 1/2] chelsio: use __netif_rx_schedule_prep

2006-11-17 Thread Stephen Hemminger
The chelsio driver can use __netif_rx_schedule_prep instead of it's own
test_and_set inline.  Applies after the previous 4 patches.

Signed-off-by: Stephen Hemminger [EMAIL PROTECTED]


--- chelsio-t2.orig/drivers/net/chelsio/sge.c
+++ chelsio-t2/drivers/net/chelsio/sge.c
@@ -929,18 +929,6 @@ static inline void reclaim_completed_tx(
 # define __netif_rx_complete(dev) netif_rx_complete(dev)
 #endif
 
-/*
- * We cannot use the standard netif_rx_schedule_prep() because we have multiple
- * ports plus the TOE all multiplexing onto a single response queue, therefore
- * accepting new responses cannot depend on the state of any particular port.
- * So define our own equivalent that omits the netif_running() test.
- */
-static inline int napi_schedule_prep(struct net_device *dev)
-{
-   return !test_and_set_bit(__LINK_STATE_RX_SCHED, dev-state);
-}
-
-
 /**
  * sge_rx - process an ingress ethernet packet
  * @sge: the sge structure
@@ -1241,10 +1229,10 @@ static irqreturn_t t1_interrupt_napi(int
if (e-GenerationBit == q-genbit) {
if (e-DataValid ||
process_pure_responses(adapter, e)) {
-   if (likely(napi_schedule_prep(sge-netdev)))
+   if 
(likely(__netif_rx_schedule_prep(sge-netdev)))
__netif_rx_schedule(sge-netdev);
-   else
-   printk(KERN_CRIT
+   else if (net_ratelimit())
+   printk(KERN_INFO
   NAPI schedule failure!\n);
} else
writel(q-cidx, adapter-regs + A_SG_SLEEPING);

-
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] chelsio: use kzalloc

2006-11-17 Thread Stephen Hemminger
Use kzalloc() in chelsio driver.

Signed-off-by: Stephen Hemminger [EMAIL PROTECTED]


--- chelsio-t2.orig/drivers/net/chelsio/sge.c
+++ chelsio-t2/drivers/net/chelsio/sge.c
@@ -335,10 +335,9 @@ static int alloc_rx_resources(struct sge
goto err_no_mem;
memset(q-entries, 0, size);
size = sizeof(struct freelQ_ce) * q-size;
-   q-centries = kmalloc(size, GFP_KERNEL);
+   q-centries = kzalloc(size, GFP_KERNEL);
if (!q-centries)
goto err_no_mem;
-   memset(q-centries, 0, size);
}
 
/*
@@ -463,10 +462,9 @@ static int alloc_tx_resources(struct sge
goto err_no_mem;
memset(q-entries, 0, size);
size = sizeof(struct cmdQ_ce) * q-size;
-   q-centries = kmalloc(size, GFP_KERNEL);
+   q-centries = kzalloc(size, GFP_KERNEL);
if (!q-centries)
goto err_no_mem;
-   memset(q-centries, 0, size);
}
 
/*
@@ -1635,11 +1633,10 @@ static void espibug_workaround(void *dat
 struct sge * __devinit t1_sge_create(struct adapter *adapter,
 struct sge_params *p)
 {
-   struct sge *sge = kmalloc(sizeof(*sge), GFP_KERNEL);
+   struct sge *sge = kzalloc(sizeof(*sge), GFP_KERNEL);
 
if (!sge)
return NULL;
-   memset(sge, 0, sizeof(*sge));
 
sge-adapter = adapter;
sge-netdev = adapter-port[0].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 2/2] chelsio: 1G board support

2006-11-17 Thread Stephen Hemminger
This patch is the addon to the Chelsio 10G driver to support their 1G boards.
I extracted this from the vendor driver version 2.2 code, and cleaned it up
to match the mainline code.

I don't have the hardware, so it probably doesn't work as is.  But getting
it to development kernel will get others to fix it.

Signed-off-by: Stephen Hemminger [EMAIL PROTECTED]

Patch is large 80K so please download from:
http://developer.osdl.org/shemminger/prototypes/chelsio-1g.patch.gz
-
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 00/13] NetLabel cleanups for 2.6.20 [GIT]

2006-11-17 Thread James Morris
On Fri, 17 Nov 2006, [EMAIL PROTECTED] wrote:

 This patchset consists of a lot of small-ish cleanups for NetLabel and in some
 cases labeled networking in general.  I've tested these patches for the past
 few days and I haven't seen any regressions so please consider them for the
 net-2.6.20 git tree.

Thanks, excellent!

There was one minor compilation issue caused by including linux/skbuff.h 
in an SELinux header, which I fixed (see below).

Applied to
git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/selinux-net-2.6.20


---

diff --git a/security/selinux/include/security.h 
b/security/selinux/include/security.h
index 015f697..210eec7 100644
--- a/security/selinux/include/security.h
+++ b/security/selinux/include/security.h
@@ -8,7 +8,6 @@
 #ifndef _SELINUX_SECURITY_H_
 #define _SELINUX_SECURITY_H_
 
-#include linux/skbuff.h
 #include flask.h
 
 #define SECSID_NULL0x /* unspecified SID */
@@ -35,6 +34,8 @@ #else
 #define POLICYDB_VERSION_MAX   POLICYDB_VERSION_RANGETRANS
 #endif
 
+struct sk_buff;
+
 extern int selinux_enabled;
 extern int selinux_mls_enabled;
 
-
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 wireless-2.6-git] prism54: WPA/RSN support for fullmac cards

2006-11-17 Thread Dmitry Torokhov
On Friday 17 November 2006 15:53, [EMAIL PROTECTED] wrote:
 
  The card is WG511 talking to netgear WGR614 router. I am using WEP128
  with shared keys. Router is set to be g only. The OS is Fedora Core
  3 (I swear I will upgrade :) ), just recompiled wireless tools from
  sources in FC6.
 
   for debugging:
   dmesg  iwevent output would be nice...
 
  Will do when I get home.
 
   but I'll accept a short sniffer extract too. ;)
  
   (it would be really good, if you can provide a package dump form a
   working setup with the old driver too!)
 
  You'd have to tell me exactly what you want me to do.
 just the Management Frames (MLME):
 Beacon, Authentication and Association Responses/Requests Frames
 you can capture these frames with an extra sniffer card (in monitor mode)
 just run tcpdump, wireshark(ethereal), kismet, ...


OK, i'll try installing kismet on another laptop. For now that's what I have
from iwevent:

[EMAIL PROTECTED] ~]# cat iwevents.bad
21:30:52.185823   eth1 Set Mode:Managed
21:30:52.226100   eth1 Set ESSID:ALCT76_68b
21:30:54.505039   eth1 Custom driver event:Authenticate request to 
00:0f:b5:5b:fe:3a [00 0D 0002]
21:30:56.300128   eth1 Custom driver event:Authenticate request to 
00:0f:b5:5b:fe:3a [00 0D 0002]
21:30:58.095251   eth1 Custom driver event:Authenticate request to 
00:0f:b5:5b:fe:3a [00 0D 0002]
21:31:11.413225   eth1 Custom driver event:Authenticate request to 
00:0f:b5:5b:fe:3a [00 0D 0002]
21:31:13.207322   eth1 Custom driver event:Authenticate request to 
00:0f:b5:5b:fe:3a [00 0D 0002]
21:31:15.003497   eth1 Custom driver event:Authenticate request to 
00:0f:b5:5b:fe:3a [00 0D 0002]
21:31:16.798687   eth1 Custom driver event:Authenticate request to 
00:0f:b5:5b:fe:3a [00 0D 0002]
21:31:18.593844   eth1 Custom driver event:Authenticate request to 
00:0f:b5:5b:fe:3a [00 0D 0002]
21:31:31.911710   eth1 Custom driver event:Authenticate request to 
00:0f:b5:5b:fe:3a [00 0D 0002]
21:31:33.705200   eth1 Custom driver event:Authenticate request to 
00:0f:b5:5b:fe:3a [00 0D 0002]
21:31:35.501650   eth1 Custom driver event:Authenticate request to 
00:0f:b5:5b:fe:3a [00 0D 0002]
21:31:37.296756   eth1 Custom driver event:Authenticate request to 
00:0f:b5:5b:fe:3a [00 0D 0002]
21:31:39.091866   eth1 Custom driver event:Authenticate request to 
00:0f:b5:5b:fe:3a [00 0D 0002]
21:31:52.409596   eth1 Custom driver event:Authenticate request to 
00:0f:b5:5b:fe:3a [00 0D 0002]
21:31:54.203281   eth1 Custom driver event:Authenticate request to 
00:0f:b5:5b:fe:3a [00 0D 0002]

[EMAIL PROTECTED] ~]# cat iwevents.good
21:50:50.575630   eth1 Set Mode:Managed
21:50:50.604998   eth1 Set Encryption key:------**  
 Security mode:restricted
21:50:50.616502   eth1 Set ESSID:ALCT76_68b
21:50:52.880361   eth1 Custom driver event:Authenticate request to 
00:0F:B5:5B:FE:3A  : ACCEPTED  (00)
21:50:52.882638   eth1 Custom driver event:Associate request to 
00:0F:B5:5B:FE:3A  : ACCEPTED  (00)
21:50:52.883625   eth1 New Access Point/Cell address:00:0F:B5:5B:FE:3A

 
 
 
  The reason for me trying the patch is that the card locks up
  frequently (the amber transmission light turns on stays this way).
  
 Do you get any fancy mgt timeout ... or something in dmesg, when
 the cards locks up? (include one, if you can, maybe syslog saved one)
 

No, just netdev watchdog bitches:

Nov 16 23:15:30 core kernel: [164606.712000] NETDEV WATCHDOG: eth1: transmit 
timed out
Nov 16 23:15:30 core kernel: [164606.712000] eth1: tx_timeout, scheduling a 
reset
Nov 16 23:15:30 core kernel: [164606.712000] eth1: resetting device...
Nov 16 23:15:30 core kernel: [164606.712000] eth1: uploading firmware...
Nov 16 23:15:31 core kernel: [164606.996000] eth1: firmware version: 1.0.4.3
Nov 16 23:15:31 core kernel: [164606.996000] eth1: firmware upload complete
Nov 16 23:15:31 core kernel: [164607.232000] eth1: interface reset complete

-- 
Dmitry
-
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]: bcm43xx-d80211: fix hwcrypto issues (mcast)

2006-11-17 Thread Paul TBBle Hampson
On Fri, Nov 17, 2006 at 11:35:54AM +0100, Andreas Schwab wrote:
 Benjamin Herrenschmidt [EMAIL PROTECTED] writes:

 Well, the latest released version (fwcutter-005) contains a huge list
 of ... v3 URLs :-) Only 2 v4 in there. I'll check SVN.

 Still the same.  One of them does not exist, the other one requires
 Javascript!

MacOS X 10.4.8 Update for Intel [1] has
AppleAirportBrcm4311 E99AD02FDD7699FA52F0B9153C8411C8
 4.80.46.0 big-endian, supported in fwcutter-svn

It's a 200MB download for just the one file, but w3m seems to be able to
process it OK, so I assume it doesn't require Javascript.

[1] http://www.apple.com/support/downloads/macosx1048updateintel.html

-- 
---
Paul TBBle Hampson, B.Sc, LPI, MCSE
On-hiatus Asian Studies student, ANU
The Boss, Bubblesworth Pty Ltd (ABN: 51 095 284 361)
[EMAIL PROTECTED]

Of course Pacman didn't influence us as kids. If it did,
we'd be running around in darkened rooms, popping pills and
listening to repetitive music.
 -- Kristian Wilson, Nintendo, Inc, 1989

License: http://creativecommons.org/licenses/by/2.1/au/
---


pgpkwvBXHFP3Y.pgp
Description: PGP signature


Re: [PATCH]: bcm43xx-d80211: fix hwcrypto issues (mcast)

2006-11-17 Thread Martin Langer
On Fri, Nov 17, 2006 at 12:04:42PM +0100, Johannes Berg wrote:
 On Fri, 2006-11-17 at 11:35 +0100, Andreas Schwab wrote:
 
  Still the same.  One of them does not exist, the other one requires
  Javascript!
 
 Yeah, looks like Martin forgot to put the URLs in the the readme while
 he put them into commit messages...

The last update for README was quite some time ago. I think that file 
is a bad way to transport that kind of information. So I'm afraid a lot 
of links are really out of date now. A better way is probably an open 
wiki (berlios?). Volunteers and other ideas are always welcome.

The comments in the commit messages are more a kind of protocol and not 
the best link on earth. And if you wait some days the number of mirrors 
for the latest driver will explode. It would be bad to write the first 
available link into the README. A download link should be a direct 
link, a small package, easy to extract and so on. But I'm really not 
interested in doing that job of a hunter for the perfect download link 
and try to keep that link up to date. I think it's more important to 
write support for more driver files instead of doing that surrounding 
stuff for a few files in a perfect way. Google isn't that complicated 
these days and it's more up to date than our README.
 
 Support for bcmwl5.sys v4.80.53.0 added.
 ftp://downloads.netgear.com/files/wn511b_sw_3_28_3_8_setup.zip
 (bcmwl5.sys is renamed to wn511b.sys)
 
 Support for bcmwl5(64).sys v4.100.15.5 added.
 from the latest Linksys WPC300N driver at
 http://www.linksys.com/download/
 It's ucode revision 0x0173, patchlevel 0x0425, 2006-10-04.
 
 Martin, can you add these to the readme?

These are bad examples for adding to README. People aren't prepared 
well enough to look for renamed bcmwl5.sys files which are packaged 
twice and they expect direct links, too. ...

Martin
-
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]: bcm43xx-d80211: fix hwcrypto issues (mcast)

2006-11-17 Thread Paul TBBle Hampson
On Fri, Nov 17, 2006 at 06:46:29PM +1100, Benjamin Herrenschmidt wrote:
 On Thu, 2006-11-16 at 15:07 +0100, Michael Buesch wrote:
 This fixes various bcm43xx-d80211 hwcrypto issues,
 which mainly prevented mcast frames from being decrypted properly.
 
 This is mostly a rewrite of the key managing code.
 Note that after this patch v3 firmware is no longer supported.

 So what is the solution for Apple machines owner who only get a v3
 firmware from Apple ? I remember you telling me the answer on irc but I
 wanted to make it public :-) Some web site we can d/l the windows
 updates and extract the FW ?

http://bcm43xx.spugna.org/index.php?topic=141.msg517 provides the
following links to 4.80.46.0:

http://www.i-nz.net/files/perm/AppleAirPortBrcm4311.tar.gz
http://www.i-nz.net/files/perm/bcmwl5-win32.tar.gz

-- 
---
Paul TBBle Hampson, B.Sc, LPI, MCSE
On-hiatus Asian Studies student, ANU
The Boss, Bubblesworth Pty Ltd (ABN: 51 095 284 361)
[EMAIL PROTECTED]

Of course Pacman didn't influence us as kids. If it did,
we'd be running around in darkened rooms, popping pills and
listening to repetitive music.
 -- Kristian Wilson, Nintendo, Inc, 1989

License: http://creativecommons.org/licenses/by/2.1/au/
---


pgpdU5wbcGLV6.pgp
Description: PGP signature


[PATCH 1/10] cxgb3 - main header files

2006-11-17 Thread Divy Le Ray [EMAIL PROTECTED]
From: Divy Le Ray [EMAIL PROTECTED]

This patch implements the main header files of
the Chelsio T3 network driver.

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
---

 drivers/net/cxgb3/adapter.h  |  317 +++
 drivers/net/cxgb3/common.h   |  702 ++
 drivers/net/cxgb3/cxgb3_ioctl.h  |  165 
 drivers/net/cxgb3/firmware_exports.h |  145 +++
 4 files changed, 1329 insertions(+), 0 deletions(-)

diff --git a/drivers/net/cxgb3/adapter.h b/drivers/net/cxgb3/adapter.h
new file mode 100644
index 000..318fe6c
--- /dev/null
+++ b/drivers/net/cxgb3/adapter.h
@@ -0,0 +1,317 @@
+/*
+ * This file is part of the Chelsio T3 Ethernet driver for Linux.
+ *
+ * Copyright (C) 2003-2006 Chelsio Communications.  All rights reserved.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the LICENSE file included in this
+ * release for licensing terms and conditions.
+ */
+
+/* This file should not be included directly.  Include common.h instead. */
+
+#ifndef __T3_ADAPTER_H__
+#define __T3_ADAPTER_H__
+
+#include linux/pci.h
+#include linux/spinlock.h
+#include linux/interrupt.h
+#include linux/timer.h
+#include linux/cache.h
+#include t3cdev.h
+#include asm/semaphore.h
+#include asm/bitops.h
+#include asm/io.h
+
+typedef irqreturn_t (*intr_handler_t)(int, void *);
+
+struct vlan_group;
+
+struct port_info {
+   struct net_device *dev;
+   struct vlan_group *vlan_grp;
+   const struct port_type_info *port_type;
+   u8 rx_csum_offload;
+   u8 nqsets;
+   u8 first_qset;
+   struct cphy phy;
+   struct cmac mac;
+   struct link_config link_config;
+   struct net_device_stats netstats;
+   int activity;
+};
+
+struct work_struct;
+struct dentry;
+
+enum { /* adapter flags */
+   FULL_INIT_DONE = (1  0),
+   USING_MSI  = (1  1),
+   USING_MSIX = (1  2),
+};
+
+struct rx_desc;
+struct rx_sw_desc;
+
+struct sge_fl { /* SGE per free-buffer list state */
+   unsigned int buf_size;  /* size of each Rx buffer */
+   unsigned int credits;   /* # of available Rx buffers */
+   unsigned int size;  /* capacity of free list */
+   unsigned int cidx;  /* consumer index */
+   unsigned int pidx;  /* producer index */
+   unsigned int gen;   /* free list generation */
+   struct rx_desc *desc;   /* address of HW Rx descriptor ring */
+   struct rx_sw_desc *sdesc;   /* address of SW Rx descriptor ring */
+   dma_addr_t   phys_addr; /* physical address of HW ring start */
+   unsigned int cntxt_id;  /* SGE context id for the free list */
+   unsigned long empty;/* # of times queue ran out of buffers */
+};
+
+/*
+ * Bundle size for grouping offload RX packets for delivery to the stack.
+ * Don't make this too big as we do prefetch on each packet in a bundle.
+ */
+# define RX_BUNDLE_SIZE 8
+
+struct rsp_desc;
+
+struct sge_rspq {   /* state for an SGE response queue */
+   unsigned int credits;   /* # of pending response credits */
+   unsigned int size;  /* capacity of response queue */
+   unsigned int cidx;  /* consumer index */
+   unsigned int gen;   /* current generation bit */
+   unsigned int polling;   /* is the queue serviced through NAPI? */
+   unsigned int holdoff_tmr;   /* interrupt holdoff timer in 100ns */
+   unsigned int next_holdoff;  /* holdoff time for next interrupt */
+   struct rsp_desc *desc;  /* address of HW response ring */
+   dma_addr_t   phys_addr; /* physical address of the ring */
+   unsigned int cntxt_id;  /* SGE context id for the response q */
+   spinlock_t   lock;  /* guards response processing */
+   struct sk_buff *rx_head;/* offload packet receive queue head */
+   struct sk_buff *rx_tail;/* offload packet receive queue tail */
+
+   unsigned long offload_pkts;
+   unsigned long offload_bundles;
+   unsigned long eth_pkts; /* # of ethernet packets */
+   unsigned long pure_rsps;/* # of pure (non-data) responses */
+   unsigned long imm_data; /* responses with immediate data */
+   unsigned long rx_drops; /* # of packets dropped due to no mem */
+   unsigned long async_notif;  /* # of asynchronous notification events */
+   unsigned long empty;/* # of times queue ran out of credits */
+   unsigned long nomem;/* # of responses deferred due to no mem */
+   unsigned long unhandled_irqs; /* # of spurious intrs */
+};
+
+struct tx_desc;
+struct tx_sw_desc;
+
+struct sge_txq {/* state for an SGE Tx queue */
+   unsigned long flags;   

[PATCH 0/10] cxgb3: Chelsio T3 1G/10G ethernet device driver

2006-11-17 Thread Divy Le Ray

Hi,

Based on Arnd's feedback, I re-submit the patch supporting the latest
Chelsio T3 adapter in inlined mails.  Some header files were trimmed
down to reduce the code footprint.

This patch adds support for the latest Chelsio adapter, T3.  It is built
against 2.6.19-rc6.

A corresponding monolithic patch against 2.6.19-rc6 is posted at the
following URL: http://service.chelsio.com/kernel.org/cxgb3.patch.bz2

We wish this patch to be considered for inclusion in 2.6.20. This driver
is required by the Chelsio T3 RDMA driver which was posted on 11/15/2006.

Cheers,
Divy

-
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 9/10] cxgb3 - register definitions

2006-11-17 Thread Divy Le Ray [EMAIL PROTECTED]
From: Divy Le Ray [EMAIL PROTECTED]

This patch implements the registers definitions for the
Chelsio network adapter's driver.

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
---

 drivers/net/cxgb3/regs.h | 2754 ++
 1 files changed, 2754 insertions(+), 0 deletions(-)

diff --git a/drivers/net/cxgb3/regs.h b/drivers/net/cxgb3/regs.h
new file mode 100644
index 000..74c440b
--- /dev/null
+++ b/drivers/net/cxgb3/regs.h
@@ -0,0 +1,2754 @@
+#define A_SG_CONTROL 0x0
+
+
+#define S_DROPPKT20
+#define V_DROPPKT(x) ((x)  S_DROPPKT)
+#define F_DROPPKTV_DROPPKT(1U)
+
+
+#define S_EGRGENCTRL19
+#define V_EGRGENCTRL(x) ((x)  S_EGRGENCTRL)
+#define F_EGRGENCTRLV_EGRGENCTRL(1U)
+
+
+#define S_USERSPACESIZE14
+#define M_USERSPACESIZE0x1f
+#define V_USERSPACESIZE(x) ((x)  S_USERSPACESIZE)
+
+#define S_HOSTPAGESIZE11
+#define M_HOSTPAGESIZE0x7
+#define V_HOSTPAGESIZE(x) ((x)  S_HOSTPAGESIZE)
+
+#define S_FLMODE9
+#define V_FLMODE(x) ((x)  S_FLMODE)
+#define F_FLMODEV_FLMODE(1U)
+
+
+#define S_PKTSHIFT6
+#define M_PKTSHIFT0x7
+#define V_PKTSHIFT(x) ((x)  S_PKTSHIFT)
+
+#define S_ONEINTMULTQ5
+#define V_ONEINTMULTQ(x) ((x)  S_ONEINTMULTQ)
+#define F_ONEINTMULTQV_ONEINTMULTQ(1U)
+
+
+#define S_BIGENDIANINGRESS2
+#define V_BIGENDIANINGRESS(x) ((x)  S_BIGENDIANINGRESS)
+#define F_BIGENDIANINGRESSV_BIGENDIANINGRESS(1U)
+
+
+#define S_ISCSICOALESCING1
+#define V_ISCSICOALESCING(x) ((x)  S_ISCSICOALESCING)
+#define F_ISCSICOALESCINGV_ISCSICOALESCING(1U)
+
+
+#define S_GLOBALENABLE0
+#define V_GLOBALENABLE(x) ((x)  S_GLOBALENABLE)
+#define F_GLOBALENABLEV_GLOBALENABLE(1U)
+
+
+#define S_AVOIDCQOVFL24
+#define V_AVOIDCQOVFL(x) ((x)  S_AVOIDCQOVFL)
+#define F_AVOIDCQOVFLV_AVOIDCQOVFL(1U)
+
+
+#define S_OPTONEINTMULTQ23
+#define V_OPTONEINTMULTQ(x) ((x)  S_OPTONEINTMULTQ)
+#define F_OPTONEINTMULTQV_OPTONEINTMULTQ(1U)
+
+
+#define S_CQCRDTCTRL22
+#define V_CQCRDTCTRL(x) ((x)  S_CQCRDTCTRL)
+#define F_CQCRDTCTRLV_CQCRDTCTRL(1U)
+
+
+#define A_SG_KDOORBELL 0x4
+
+
+#define S_SELEGRCNTX31
+#define V_SELEGRCNTX(x) ((x)  S_SELEGRCNTX)
+#define F_SELEGRCNTXV_SELEGRCNTX(1U)
+
+
+#define S_EGRCNTX0
+#define M_EGRCNTX0x
+#define V_EGRCNTX(x) ((x)  S_EGRCNTX)
+
+#define A_SG_GTS 0x8
+
+
+#define S_RSPQ29
+
+#define V_RSPQ(x) ((x)  S_RSPQ)
+
+#define G_RSPQ(x) (((x)  S_RSPQ)  M_RSPQ)
+
+
+#define S_NEWTIMER16
+#define M_NEWTIMER0x1fff
+
+#define V_NEWTIMER(x) ((x)  S_NEWTIMER)
+
+#define S_NEWINDEX0
+#define M_NEWINDEX0x
+#define V_NEWINDEX(x) ((x)  S_NEWINDEX)
+
+#define A_SG_CONTEXT_CMD 0xc
+
+
+#define S_CONTEXT_CMD_OPCODE28
+#define M_CONTEXT_CMD_OPCODE0xf
+#define V_CONTEXT_CMD_OPCODE(x) ((x)  S_CONTEXT_CMD_OPCODE)
+
+#define S_CONTEXT_CMD_BUSY27
+#define V_CONTEXT_CMD_BUSY(x) ((x)  S_CONTEXT_CMD_BUSY)
+#define F_CONTEXT_CMD_BUSYV_CONTEXT_CMD_BUSY(1U)
+
+
+#define S_CQ_CREDIT20
+
+#define M_CQ_CREDIT0x7f
+
+#define V_CQ_CREDIT(x) ((x)  S_CQ_CREDIT)
+
+#define G_CQ_CREDIT(x) (((x)  S_CQ_CREDIT)  M_CQ_CREDIT)
+
+
+#define S_CQ19
+
+#define V_CQ(x) ((x)  S_CQ)
+#define F_CQV_CQ(1U)
+
+#define F_CQV_CQ(1U)
+
+
+#define S_RESPONSEQ18
+#define V_RESPONSEQ(x) ((x)  S_RESPONSEQ)
+#define F_RESPONSEQV_RESPONSEQ(1U)
+
+
+#define S_EGRESS17
+#define V_EGRESS(x) ((x)  S_EGRESS)
+#define F_EGRESSV_EGRESS(1U)
+
+
+#define S_FREELIST16
+#define V_FREELIST(x) ((x)  S_FREELIST)
+#define F_FREELISTV_FREELIST(1U)
+
+
+#define S_CONTEXT0
+#define M_CONTEXT0x
+#define V_CONTEXT(x) ((x)  S_CONTEXT)
+
+#define G_CONTEXT(x) (((x)  S_CONTEXT)  M_CONTEXT)
+
+
+#define A_SG_CONTEXT_DATA0 0x10
+
+
+#define A_SG_CONTEXT_DATA1 0x14
+
+
+#define A_SG_CONTEXT_DATA2 0x18
+
+
+#define A_SG_CONTEXT_DATA3 0x1c
+
+
+#define A_SG_CONTEXT_MASK0 0x20
+
+
+#define A_SG_CONTEXT_MASK1 0x24
+
+
+#define A_SG_CONTEXT_MASK2 0x28
+
+
+#define A_SG_CONTEXT_MASK3 0x2c
+
+
+#define A_SG_RSPQ_CREDIT_RETURN 0x30
+
+
+#define S_CREDITS0
+#define M_CREDITS0x
+#define V_CREDITS(x) ((x)  S_CREDITS)
+
+#define A_SG_DATA_INTR 0x34
+
+
+#define S_ERRINTR31
+#define V_ERRINTR(x) ((x)  S_ERRINTR)
+#define F_ERRINTRV_ERRINTR(1U)
+
+
+#define A_SG_HI_DRB_HI_THRSH 0x38
+
+
+#define A_SG_HI_DRB_LO_THRSH 0x3c
+
+
+#define A_SG_LO_DRB_HI_THRSH 0x40
+
+
+#define A_SG_LO_DRB_LO_THRSH 0x44
+
+
+#define A_SG_RSPQ_FL_STATUS 0x4c
+
+
+#define S_RSPQ0DISABLED8
+
+#define A_SG_EGR_RCQ_DRB_THRSH 0x54
+
+
+#define S_HIRCQDRBTHRSH16
+#define M_HIRCQDRBTHRSH0x7ff
+#define V_HIRCQDRBTHRSH(x) ((x)  S_HIRCQDRBTHRSH)
+
+#define S_LORCQDRBTHRSH0
+#define M_LORCQDRBTHRSH0x7ff
+#define V_LORCQDRBTHRSH(x) ((x)  S_LORCQDRBTHRSH)
+
+#define A_SG_EGR_CNTX_BADDR 0x58
+
+
+#define A_SG_INT_CAUSE 0x5c
+
+
+#define S_RSPQDISABLED3
+#define V_RSPQDISABLED(x) ((x)  S_RSPQDISABLED)
+#define F_RSPQDISABLEDV_RSPQDISABLED(1U)
+
+

[PATCH 7/10] cxgb3 - offload header files

2006-11-17 Thread Divy Le Ray [EMAIL PROTECTED]
From: Divy Le Ray [EMAIL PROTECTED]

This patch implements the offload operations header files
for the Chelsio T3 network adapter's driver.

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
---

 drivers/net/cxgb3/cxgb3_ctl_defs.h |  141 
 drivers/net/cxgb3/cxgb3_defs.h |  100 +++
 drivers/net/cxgb3/cxgb3_offload.h  |  199 +
 drivers/net/cxgb3/l2t.h|  144 
 drivers/net/cxgb3/t3_cpl.h | 1431 
 drivers/net/cxgb3/t3cdev.h |   72 ++
 6 files changed, 2087 insertions(+), 0 deletions(-)

diff --git a/drivers/net/cxgb3/cxgb3_ctl_defs.h 
b/drivers/net/cxgb3/cxgb3_ctl_defs.h
new file mode 100644
index 000..be7ac6d
--- /dev/null
+++ b/drivers/net/cxgb3/cxgb3_ctl_defs.h
@@ -0,0 +1,141 @@
+/*
+ * Copyright (C) 2003-2006 Chelsio Communications.  All rights reserved.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the LICENSE file included in this
+ * release for licensing terms and conditions.
+ */
+
+#ifndef _CXGB3_OFFLOAD_CTL_DEFS_H
+#define _CXGB3_OFFLOAD_CTL_DEFS_H
+
+enum {
+   GET_MAX_OUTSTANDING_WR,
+   GET_TX_MAX_CHUNK,
+   GET_TID_RANGE,
+   GET_STID_RANGE,
+   GET_RTBL_RANGE,
+   GET_L2T_CAPACITY,
+   GET_MTUS,
+   GET_WR_LEN,
+   GET_IFF_FROM_MAC,
+   GET_DDP_PARAMS,
+   GET_PORTS,
+
+   ULP_ISCSI_GET_PARAMS,
+   ULP_ISCSI_SET_PARAMS,
+
+   RDMA_GET_PARAMS,
+   RDMA_CQ_OP,
+   RDMA_CQ_SETUP,
+   RDMA_CQ_DISABLE,
+   RDMA_CTRL_QP_SETUP,
+   RDMA_GET_MEM,
+};
+
+/*
+ * Structure used to describe a TID range.  Valid TIDs are [base, base+num).
+ */
+struct tid_range {
+   unsigned int base;   /* first TID */
+   unsigned int num;/* number of TIDs in range */
+};
+
+/*
+ * Structure used to request the size and contents of the MTU table.
+ */
+struct mtutab {
+   unsigned int size;  /* # of entries in the MTU table */
+   const unsigned short *mtus; /* the MTU table values */
+};
+
+struct net_device;
+
+/*
+ * Structure used to request the adapter net_device owning a given MAC address.
+ */
+struct iff_mac {
+   struct net_device *dev;  /* the net_device */
+   const unsigned char *mac_addr;   /* MAC address to lookup */
+   u16 vlan_tag;
+};
+
+/*
+ * Structure used to request the TCP DDP parameters.
+ */
+struct ddp_params {
+   unsigned int llimit; /* TDDP region start address */
+   unsigned int ulimit; /* TDDP region end address */
+   unsigned int tag_mask;   /* TDDP tag mask */
+};
+
+struct adap_ports {
+   unsigned int nports; /* number of ports on this adapter */
+   struct net_device *lldevs[2];
+};
+
+struct pci_dev;
+
+/*
+ * Structure used to return information to the iscsi layer.
+ */
+struct ulp_iscsi_info {
+   unsigned intoffset;
+   unsigned intllimit;
+   unsigned intulimit;
+   unsigned inttagmask;
+   unsigned intpgsz3;
+   unsigned intpgsz2;
+   unsigned intpgsz1;
+   unsigned intpgsz0;
+   unsigned intmax_rxsz;
+   unsigned intmax_txsz;
+   struct pci_dev  *pdev;
+};
+
+/*
+ * Structure used to return information to the RDMA layer.
+ */
+struct rdma_info {
+   unsigned int tpt_base;   /* TPT base address */
+   unsigned int tpt_top;/* TPT last entry address */
+   unsigned int pbl_base;   /* PBL base address */
+   unsigned int pbl_top;/* PBL last entry address */
+   unsigned int rqt_base;   /* RQT base address */
+   unsigned int rqt_top;/* RQT last entry address */
+   unsigned int udbell_len; /* user doorbell region length */
+   unsigned long udbell_physbase;  /* user doorbell physical start addr */
+   void __iomem *kdb_addr;  /* kernel doorbell register address */
+   struct pci_dev *pdev;/* associated PCI device */
+};
+
+/*
+ * Structure used to request an operation on an RDMA completion queue.
+ */
+struct rdma_cq_op {
+   unsigned int id;
+   unsigned int op;
+   unsigned int credits;
+};
+
+/*
+ * Structure used to setup RDMA completion queues.
+ */
+struct rdma_cq_setup {
+   unsigned int id;
+   unsigned long long base_addr;
+   unsigned int size;
+   unsigned int credits;
+   unsigned int credit_thres;
+   unsigned int ovfl_mode;
+};
+
+/*
+ * Structure used to setup the RDMA control egress context.
+ */
+struct rdma_ctrlqp_setup {
+   unsigned long long base_addr;
+   unsigned int size;
+};
+#endif /* _CXGB3_OFFLOAD_CTL_DEFS_H */
diff --git a/drivers/net/cxgb3/cxgb3_defs.h b/drivers/net/cxgb3/cxgb3_defs.h
new file mode 100644
index 000..ddaba3f
--- /dev/null
+++ b/drivers/net/cxgb3/cxgb3_defs.h
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2006 Chelsio, Inc. All rights reserved.
+ * Copyright (c) 2006 Open Grid 

[PATCH 4/10] cxgb3 - HW access routines - part 2

2006-11-17 Thread divy
From: Divy Le Ray [EMAIL PROTECTED]

This patch implements the HW access routines for the
Chelsio T3 network adapter's driver.
This patch is split. This is the second part.

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
---

+   return t3_wait_op_done(adapter, A_SG_CONTEXT_CMD, F_CONTEXT_CMD_BUSY,
+  0, 5, 1);
+}
+
+/**
+ * t3_sge_disable_fl - disable an SGE free-buffer list
+ * @adapter: the adapter
+ * @id: the free list context id
+ *
+ * Disable an SGE free-buffer list.  The caller is responsible for
+ * ensuring only one context operation occurs at a time.
+ */
+int t3_sge_disable_fl(adapter_t *adapter, unsigned int id)
+{
+   if (t3_read_reg(adapter, A_SG_CONTEXT_CMD)  F_CONTEXT_CMD_BUSY)
+   return -EBUSY;
+
+   t3_write_reg(adapter, A_SG_CONTEXT_MASK0, 0);
+   t3_write_reg(adapter, A_SG_CONTEXT_MASK1, 0);
+   t3_write_reg(adapter, A_SG_CONTEXT_MASK2, V_FL_SIZE(M_FL_SIZE));
+   t3_write_reg(adapter, A_SG_CONTEXT_MASK3, 0);
+   t3_write_reg(adapter, A_SG_CONTEXT_DATA2, 0);
+   t3_write_reg(adapter, A_SG_CONTEXT_CMD,
+V_CONTEXT_CMD_OPCODE(1) | F_FREELIST | V_CONTEXT(id));
+   return t3_wait_op_done(adapter, A_SG_CONTEXT_CMD, F_CONTEXT_CMD_BUSY,
+  0, 5, 1);
+}
+
+/**
+ * t3_sge_disable_rspcntxt - disable an SGE response queue
+ * @adapter: the adapter
+ * @id: the response queue context id
+ *
+ * Disable an SGE response queue.  The caller is responsible for
+ * ensuring only one context operation occurs at a time.
+ */
+int t3_sge_disable_rspcntxt(adapter_t *adapter, unsigned int id)
+{
+   if (t3_read_reg(adapter, A_SG_CONTEXT_CMD)  F_CONTEXT_CMD_BUSY)
+   return -EBUSY;
+
+   t3_write_reg(adapter, A_SG_CONTEXT_MASK0, V_CQ_SIZE(M_CQ_SIZE));
+   t3_write_reg(adapter, A_SG_CONTEXT_MASK1, 0);
+   t3_write_reg(adapter, A_SG_CONTEXT_MASK2, 0);
+   t3_write_reg(adapter, A_SG_CONTEXT_MASK3, 0);
+   t3_write_reg(adapter, A_SG_CONTEXT_DATA0, 0);
+   t3_write_reg(adapter, A_SG_CONTEXT_CMD,
+V_CONTEXT_CMD_OPCODE(1) | F_RESPONSEQ | V_CONTEXT(id));
+   return t3_wait_op_done(adapter, A_SG_CONTEXT_CMD, F_CONTEXT_CMD_BUSY,
+  0, 5, 1);
+}
+
+/**
+ * t3_sge_disable_cqcntxt - disable an SGE completion queue
+ * @adapter: the adapter
+ * @id: the completion queue context id
+ *
+ * Disable an SGE completion queue.  The caller is responsible for
+ * ensuring only one context operation occurs at a time.
+ */
+int t3_sge_disable_cqcntxt(adapter_t *adapter, unsigned int id)
+{
+   if (t3_read_reg(adapter, A_SG_CONTEXT_CMD)  F_CONTEXT_CMD_BUSY)
+   return -EBUSY;
+
+   t3_write_reg(adapter, A_SG_CONTEXT_MASK0, V_CQ_SIZE(M_CQ_SIZE));
+   t3_write_reg(adapter, A_SG_CONTEXT_MASK1, 0);
+   t3_write_reg(adapter, A_SG_CONTEXT_MASK2, 0);
+   t3_write_reg(adapter, A_SG_CONTEXT_MASK3, 0);
+   t3_write_reg(adapter, A_SG_CONTEXT_DATA0, 0);
+   t3_write_reg(adapter, A_SG_CONTEXT_CMD,
+V_CONTEXT_CMD_OPCODE(1) | F_CQ | V_CONTEXT(id));
+   return t3_wait_op_done(adapter, A_SG_CONTEXT_CMD, F_CONTEXT_CMD_BUSY,
+  0, 5, 1);
+}
+
+/**
+ * t3_sge_cqcntxt_op - perform an operation on a completion queue context
+ * @adapter: the adapter
+ * @id: the context id
+ * @op: the operation to perform
+ *
+ * Perform the selected operation on an SGE completion queue context.
+ * The caller is responsible for ensuring only one context operation
+ * occurs at a time.
+ */
+int t3_sge_cqcntxt_op(adapter_t *adapter, unsigned int id, unsigned int op,
+ unsigned int credits)
+{
+   if (t3_read_reg(adapter, A_SG_CONTEXT_CMD)  F_CONTEXT_CMD_BUSY)
+   return -EBUSY;
+
+   t3_write_reg(adapter, A_SG_CONTEXT_DATA0, credits  16);
+   t3_write_reg(adapter, A_SG_CONTEXT_CMD, V_CONTEXT_CMD_OPCODE(op) |
+V_CONTEXT(id) | F_CQ);
+   if (t3_wait_op_done(adapter, A_SG_CONTEXT_CMD, F_CONTEXT_CMD_BUSY, 0,
+   5, 1))
+   return -EIO;
+
+   if (op = 2  op  7) {
+   t3_write_reg(adapter, A_SG_CONTEXT_CMD,
+V_CONTEXT_CMD_OPCODE(0) | F_CQ | V_CONTEXT(id));
+   if (t3_wait_op_done(adapter, A_SG_CONTEXT_CMD,
+   F_CONTEXT_CMD_BUSY, 0, 5, 1))
+   return -EIO;
+   return G_CQ_INDEX(t3_read_reg(adapter, A_SG_CONTEXT_DATA0));
+   }
+   return 0;
+}
+
+/**
+ * t3_sge_read_context - read an SGE context
+ * @type: the context type
+ * @adapter: the adapter
+ * @id: the context id
+ * @data: holds the retrieved context
+ *
+ * Read an SGE egress context.  The caller is responsible for ensuring
+ * only one context operation occurs at a time.
+ 

[PATCH 8/10] cxgb3 - offload capabilities

2006-11-17 Thread Divy Le Ray [EMAIL PROTECTED]
From: Divy Le Ray [EMAIL PROTECTED]

This patch implements the offload capabilities of the
Chelsio network adapter's driver.

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
---

 drivers/net/cxgb3/cxgb3_offload.c | 1204 +
 drivers/net/cxgb3/l2t.c   |  558 +
 2 files changed, 1762 insertions(+), 0 deletions(-)

diff --git a/drivers/net/cxgb3/cxgb3_offload.c 
b/drivers/net/cxgb3/cxgb3_offload.c
new file mode 100644
index 000..1b963d8
--- /dev/null
+++ b/drivers/net/cxgb3/cxgb3_offload.c
@@ -0,0 +1,1204 @@
+/*
+ * Copyright (c) 2006 Chelsio, Inc. All rights reserved.
+ * Copyright (c) 2006 Open Grid Computing, Inc. All rights reserved.
+ *
+ * This software is available to you under a choice of one of two
+ * licenses.  You may choose to be licensed under the terms of the GNU
+ * General Public License (GPL) Version 2, available from the file
+ * COPYING in the main directory of this source tree, or the
+ * OpenIB.org BSD license below:
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ *  - Redistributions of source code must retain the above
+ *copyright notice, this list of conditions and the following
+ *disclaimer.
+ *
+ *  - Redistributions in binary form must reproduce the above
+ *copyright notice, this list of conditions and the following
+ *disclaimer in the documentation and/or other materials
+ *provided with the distribution.
+ *
+ * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include linux/list.h
+#include net/neighbour.h
+#include linux/notifier.h
+#include asm/atomic.h
+#include linux/proc_fs.h
+#include linux/if_vlan.h
+#include net/netevent.h
+
+#include common.h
+#include regs.h
+#include cxgb3_ioctl.h
+#include cxgb3_ctl_defs.h
+#include cxgb3_defs.h
+#include l2t.h
+#include firmware_exports.h
+#include cxgb3_offload.h
+
+static LIST_HEAD(client_list);
+static LIST_HEAD(ofld_dev_list);
+static DEFINE_MUTEX(cxgb3_db_lock);
+
+static DEFINE_RWLOCK(adapter_list_lock);
+static LIST_HEAD(adapter_list);
+
+static const unsigned int MAX_ATIDS = 64 * 1024;
+static const unsigned int ATID_BASE = 0x10;
+
+static inline int offload_activated(struct t3cdev *tdev)
+{
+   struct adapter *adapter = tdev2adap(tdev);
+
+   return (test_bit(OFFLOAD_DEVMAP_BIT, adapter-open_device_map));
+}
+
+/**
+ * cxgb3_register_client - register an offload client
+ * @client: the client
+ *
+ * Add the client to the client list,
+ * and call backs the client for each activated offload device
+ */
+void cxgb3_register_client(struct cxgb3_client *client)
+{
+   struct t3cdev *tdev;
+
+   mutex_lock(cxgb3_db_lock);
+   list_add_tail(client-client_list, client_list);
+
+   if (client-add) {
+   list_for_each_entry(tdev, ofld_dev_list, ofld_dev_list) {
+   if (offload_activated(tdev))
+   client-add(tdev);
+   }
+   }
+   mutex_unlock(cxgb3_db_lock);
+}
+EXPORT_SYMBOL(cxgb3_register_client);
+
+/**
+ * cxgb3_unregister_client - unregister an offload client
+ * @client: the client
+ *
+ * Remove the client to the client list,
+ * and call backs the client for each activated offload device.
+ */
+void cxgb3_unregister_client(struct cxgb3_client *client)
+{
+   struct t3cdev *tdev;
+
+   mutex_lock(cxgb3_db_lock);
+   list_del(client-client_list);
+
+   if (client-remove) {
+   list_for_each_entry(tdev, ofld_dev_list, ofld_dev_list) {
+   if (offload_activated(tdev))
+   client-remove(tdev);
+   }
+   }
+   mutex_unlock(cxgb3_db_lock);
+}
+EXPORT_SYMBOL(cxgb3_unregister_client);
+
+/**
+ * cxgb3_add_clients - activate register clients for an offload device
+ * @tdev: the offload device
+ *
+ * Call backs all registered clients once a offload device is activated
+ */
+void cxgb3_add_clients(struct t3cdev *tdev)
+{
+   struct cxgb3_client *client;
+
+   mutex_lock(cxgb3_db_lock);
+   list_for_each_entry(client, client_list, client_list) {
+   if (client-add)
+   client-add(tdev);
+   }
+   mutex_unlock(cxgb3_db_lock);
+}
+
+/**
+ * cxgb3_remove_clients - activate register clients for an offload device
+ * @tdev: the offload device
+ *
+ * Call 

[PATCH 6/10] cxgb3 - on board memory, MAC and PHY

2006-11-17 Thread Divy Le Ray [EMAIL PROTECTED]
From: Divy Le Ray [EMAIL PROTECTED]

This patch implements on board memory, MAC and PHY management
for the Chelsio T3 network adapter's driver.

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
---

 drivers/net/cxgb3/ael1002.c |  223 +
 drivers/net/cxgb3/mc5.c |  453 +++
 drivers/net/cxgb3/vsc8211.c |  208 
 drivers/net/cxgb3/xgmac.c   |  383 
 4 files changed, 1267 insertions(+), 0 deletions(-)

diff --git a/drivers/net/cxgb3/ael1002.c b/drivers/net/cxgb3/ael1002.c
new file mode 100644
index 000..761c719
--- /dev/null
+++ b/drivers/net/cxgb3/ael1002.c
@@ -0,0 +1,223 @@
+/*
+ * This file is part of the Chelsio T3 Ethernet driver.
+ *
+ * Copyright (C) 2005-2006 Chelsio Communications.  All rights reserved.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the LICENSE file included in this
+ * release for licensing terms and conditions.
+ */
+
+#include common.h
+#include regs.h
+
+enum {
+   AEL100X_TX_DISABLE  = 9,
+   AEL100X_TX_CONFIG1  = 0xc002,
+   AEL1002_PWR_DOWN_HI = 0xc011,
+   AEL1002_PWR_DOWN_LO = 0xc012,
+   AEL1002_XFI_EQL = 0xc015,
+   AEL1002_LB_EN   = 0xc017,
+
+   LASI_CTRL   = 0x9002,
+   LASI_STAT   = 0x9005
+};
+
+static void ael100x_txon(struct cphy *phy)
+{
+   int tx_on_gpio = phy-addr == 0 ? F_GPIO7_OUT_VAL : F_GPIO2_OUT_VAL;
+
+   msleep(100);
+   t3_set_reg_field(phy-adapter, A_T3DBG_GPIO_EN, 0, tx_on_gpio);
+   msleep(30);
+}
+
+static int ael1002_power_down(struct cphy *phy, int enable)
+{
+   int err;
+
+   err = mdio_write(phy, MDIO_DEV_PMA_PMD, AEL100X_TX_DISABLE, !!enable);
+   if (!err)
+   err = t3_mdio_change_bits(phy, MDIO_DEV_PMA_PMD, MII_BMCR,
+ BMCR_PDOWN, enable ? BMCR_PDOWN : 0);
+   return err;
+}
+
+static int ael1002_reset(struct cphy *phy, int wait)
+{
+   int err;
+
+   if ((err = ael1002_power_down(phy, 0)) ||
+   (err = mdio_write(phy, MDIO_DEV_PMA_PMD, AEL100X_TX_CONFIG1, 1)) ||
+   (err = mdio_write(phy, MDIO_DEV_PMA_PMD, AEL1002_PWR_DOWN_HI, 0)) ||
+   (err = mdio_write(phy, MDIO_DEV_PMA_PMD, AEL1002_PWR_DOWN_LO, 0)) ||
+   (err = mdio_write(phy, MDIO_DEV_PMA_PMD, AEL1002_XFI_EQL, 0x18)) ||
+   (err = t3_mdio_change_bits(phy, MDIO_DEV_PMA_PMD, AEL1002_LB_EN,
+  0, 1  5)))
+   return err;
+   return 0;
+}
+
+static int ael1002_intr_noop(struct cphy *phy)
+{
+   return 0;
+}
+
+static int ael100x_get_link_status(struct cphy *phy, int *link_ok,
+  int *speed, int *duplex, int *fc)
+{
+   if (link_ok) {
+   unsigned int status;
+   int err = mdio_read(phy, MDIO_DEV_PMA_PMD, MII_BMSR, status);
+
+   /*
+* BMSR_LSTATUS is latch-low, so if it is 0 we need to read it
+* once more to get the current link state.
+*/
+   if (!err  !(status  BMSR_LSTATUS))
+   err = mdio_read(phy, MDIO_DEV_PMA_PMD, MII_BMSR,
+   status);
+   if (err)
+   return err;
+   *link_ok = !!(status  BMSR_LSTATUS);
+   }
+   if (speed)
+   *speed = SPEED_1;
+   if (duplex)
+   *duplex = DUPLEX_FULL;
+   return 0;
+}
+
+static struct cphy_ops ael1002_ops = {
+   .reset   = ael1002_reset,
+   .intr_enable = ael1002_intr_noop,
+   .intr_disable= ael1002_intr_noop,
+   .intr_clear  = ael1002_intr_noop,
+   .intr_handler= ael1002_intr_noop,
+   .get_link_status = ael100x_get_link_status,
+   .power_down  = ael1002_power_down,
+};
+
+void t3_ael1002_phy_prep(struct cphy *phy, adapter_t *adapter, int phy_addr,
+const struct mdio_ops *mdio_ops)
+{
+   cphy_init(phy, adapter, phy_addr, ael1002_ops, mdio_ops);
+   ael100x_txon(phy);
+}
+
+static int ael1006_reset(struct cphy *phy, int wait)
+{
+   return t3_phy_reset(phy, MDIO_DEV_PMA_PMD, wait);
+}
+
+static int ael1006_intr_enable(struct cphy *phy)
+{
+   return mdio_write(phy, MDIO_DEV_PMA_PMD, LASI_CTRL, 1);
+}
+
+static int ael1006_intr_disable(struct cphy *phy)
+{
+   return mdio_write(phy, MDIO_DEV_PMA_PMD, LASI_CTRL, 0);
+}
+
+static int ael1006_intr_clear(struct cphy *phy)
+{
+   u32 val;
+
+   return mdio_read(phy, MDIO_DEV_PMA_PMD, LASI_STAT, val);
+}
+
+static int ael1006_intr_handler(struct cphy *phy)
+{
+   unsigned int status;
+   int err = mdio_read(phy, MDIO_DEV_PMA_PMD, LASI_STAT, status);
+
+   if (err)
+   return err;
+   return (status  

Re: driver support for Chelsio T210 10Gb ethernet in 2.6.x

2006-11-17 Thread Jeff Garzik

Felix Marti wrote:

Jeff, as indicated by Chris, the driver that is in the kernel is for
N110 and N210. So far, we have not received any customer complaints
regarding bugs in the driver and thus it has not been updated in a long
time. If you feel like there are some missing features/bug fixes, I'd be
glad to spend some time on it.

However, Chris's initial request is regarding support for T210. As you
indicate, the T210 product is a superset of N110/N210 and i.e. supports
TOE. Since the T210 board features additional pieces of hardware, these
must be initialized (i.e. memory controllers and TCAM) even if the board
is to be used as a NIC only. If the kernel developers are okay with
these additional initialization procedures we could update the driver to
support N as well as T based products, in NIC mode only, of course ;)



I'd welcome support for NIC mode, so, sure...

Jeff


-
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: driver support for Chelsio T210 10Gb ethernet in 2.6.x

2006-11-17 Thread Jeff Garzik

Jeff Garzik wrote:

Felix Marti wrote:

Jeff, as indicated by Chris, the driver that is in the kernel is for
N110 and N210. So far, we have not received any customer complaints
regarding bugs in the driver and thus it has not been updated in a long
time. If you feel like there are some missing features/bug fixes, I'd be
glad to spend some time on it.

However, Chris's initial request is regarding support for T210. As you
indicate, the T210 product is a superset of N110/N210 and i.e. supports
TOE. Since the T210 board features additional pieces of hardware, these
must be initialized (i.e. memory controllers and TCAM) even if the board
is to be used as a NIC only. If the kernel developers are okay with
these additional initialization procedures we could update the driver to
support N as well as T based products, in NIC mode only, of course ;)



I'd welcome support for NIC mode, so, sure...


Well, presuming that active maintenance comes along with it...

Jeff


-
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] cxgb3 - build files and versioning

2006-11-17 Thread Divy Le Ray [EMAIL PROTECTED]
From: Divy Le Ray [EMAIL PROTECTED]

This patch implements build files and versioning for the 
Chelsio T3 network adapter's driver.

Signed-off-by: Divy Le Ray [EMAIL PROTECTED]
---

 drivers/net/Kconfig |   18 ++
 drivers/net/Makefile|1 +
 drivers/net/cxgb3/Makefile  |8 
 drivers/net/cxgb3/version.h |   24 
 4 files changed, 51 insertions(+), 0 deletions(-)

diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 6e863aa..543374d 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -2357,6 +2357,24 @@ config CHELSIO_T1
   To compile this driver as a module, choose M here: the module
   will be called cxgb.
 
+config CHELSIO_T3
+tristate Chelsio Communications T3 10Gb Ethernet support
+depends on PCI
+help
+  This driver supports Chelsio T3-based gigabit and 10Gb Ethernet
+  adapters.
+
+  For general information about Chelsio and our products, visit
+  our website at http://www.chelsio.com.
+
+  For customer support, please visit our customer support page at
+  http://www.chelsio.com/support.htm.
+
+  Please send feedback to [EMAIL PROTECTED].
+
+  To compile this driver as a module, choose M here: the module
+  will be called cxgb3.
+
 config EHEA
tristate eHEA Ethernet support
depends on IBMEBUS
diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index f270bc4..d316ee0 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -6,6 +6,7 @@ obj-$(CONFIG_E1000) += e1000/
 obj-$(CONFIG_IBM_EMAC) += ibm_emac/
 obj-$(CONFIG_IXGB) += ixgb/
 obj-$(CONFIG_CHELSIO_T1) += chelsio/
+obj-$(CONFIG_CHELSIO_T3) += cxgb3/
 obj-$(CONFIG_EHEA) += ehea/
 obj-$(CONFIG_BONDING) += bonding/
 obj-$(CONFIG_GIANFAR) += gianfar_driver.o
diff --git a/drivers/net/cxgb3/Makefile b/drivers/net/cxgb3/Makefile
new file mode 100644
index 000..3434679
--- /dev/null
+++ b/drivers/net/cxgb3/Makefile
@@ -0,0 +1,8 @@
+#
+# Chelsio T3 driver
+#
+
+obj-$(CONFIG_CHELSIO_T3) += cxgb3.o
+
+cxgb3-objs := cxgb3_main.o ael1002.o vsc8211.o t3_hw.o mc5.o \
+ xgmac.o sge.o l2t.o cxgb3_offload.o
diff --git a/drivers/net/cxgb3/version.h b/drivers/net/cxgb3/version.h
new file mode 100644
index 000..61de82e
--- /dev/null
+++ b/drivers/net/cxgb3/version.h
@@ -0,0 +1,24 @@
+/*
+ *   *
+ * File: *
+ *  version.h*
+ *   *
+ * Description:  *
+ *  Chelsio driver version defines.  *
+ *   *
+ * Copyright (c) 2003 - 2006 Chelsio Communications, Inc.*
+ * All rights reserved.  *
+ *   *
+ * Maintainers: [EMAIL PROTECTED]  *
+ *   *
+ * http://www.chelsio.com*
+ *   *
+ /
+/* $Date: 2006/10/31 18:57:51 $ $RCSfile: version.h,v $ $Revision: 1.3 $ */
+#ifndef __CHELSIO_VERSION_H
+#define __CHELSIO_VERSION_H
+#define DRV_DESC Chelsio T3 Network Driver
+#define DRV_NAME cxgb3
+// Driver version
+#define DRV_VERSION 1.0
+#endif //__CHELSIO_VERSION_H
-
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 1/10] cxgb3 - main header files

2006-11-17 Thread Stephen Hemminger

 +
 +struct work_struct;
 +struct dentry;


Why do you need these extra forward declarations?

...

 +
 +struct sge_rspq {   /* state for an SGE response queue */
 + unsigned int credits;   /* # of pending response credits */
 + unsigned int size;  /* capacity of response queue */
 + unsigned int cidx;  /* consumer index */
 + unsigned int gen;   /* current generation bit */
 + unsigned int polling;   /* is the queue serviced through NAPI? */
 + unsigned int holdoff_tmr;   /* interrupt holdoff timer in 100ns */
 + unsigned int next_holdoff;  /* holdoff time for next interrupt */
 + struct rsp_desc *desc;  /* address of HW response ring */
 + dma_addr_t   phys_addr; /* physical address of the ring */
 + unsigned int cntxt_id;  /* SGE context id for the response q */
 + spinlock_t   lock;  /* guards response processing */
 + struct sk_buff *rx_head;/* offload packet receive queue head */
 + struct sk_buff *rx_tail;/* offload packet receive queue tail */

Why not use sk_buff_head?

...

 + /*
 +  * Dummy netdevices are needed when using multiple receive queues with
 +  * NAPI as each netdevice can service only one queue.
 +  */
 + struct net_device *dummy_netdev[SGE_QSETS - 1];


Rather than abusing, NAPI with multiple receive queue's why not do it
by either:
1) changing NAPI to have multiple receive contexts
2) or use your own tasklet and processing.

 + struct dentry *debugfs_root;
 +
 + struct semaphore mdio_lock;
 + spinlock_t stats_lock;
 + spinlock_t work_lock;
 +};
 +
 +#define MDIO_LOCK(adapter) down((adapter)-mdio_lock)
 +#define MDIO_UNLOCK(adapter) up((adapter)-mdio_lock)

Please don't wrap locks


 +static inline u32 t3_read_reg(adapter_t *adapter, u32 reg_addr)
 +{
 + u32 val = readl(adapter-regs + reg_addr);
 +
 + CH_DBG(adapter, MMIO, read register 0x%x value 0x%x\n, reg_addr,
 +val);
 + return val;
 +}
 +
 +static inline void t3_write_reg(adapter_t *adapter, u32 reg_addr, u32 val)
 +{
 + CH_DBG(adapter, MMIO, setting register 0x%x to 0x%x\n, reg_addr,
 +val);
 + writel(val, adapter-regs + reg_addr);
 +}

This kind of wrapper makes sense.

 +static inline int t3_os_pci_save_state(adapter_t *adapter)
 +{
 + return pci_save_state(adapter-pdev);
 +}

Please don't add bogus OS independent wrappers. It makes it harder for later
maintenance.

 +static inline int t3_os_pci_restore_state(adapter_t *adapter)
 +{
 + return pci_restore_state(adapter-pdev);
 +}
 +
 +static inline void t3_os_pci_write_config_4(adapter_t *adapter, int reg,
 + u32 val)
 +{
 + pci_write_config_dword(adapter-pdev, reg, val);
 +}
 +
 +static inline void t3_os_pci_read_config_4(adapter_t *adapter, int reg,
 +u32 *val)
 +{
 + pci_read_config_dword(adapter-pdev, reg, val);
 +}
 +
 +static inline void t3_os_pci_write_config_2(adapter_t *adapter, int reg,
 + u16 val)
 +{
 + pci_write_config_word(adapter-pdev, reg, val);
 +}
 +
 +static inline void t3_os_pci_read_config_2(adapter_t *adapter, int reg,
 +u16 *val)
 +{
 + pci_read_config_word(adapter-pdev, reg, val);
 +}
 +
 +static inline int t3_os_find_pci_capability(adapter_t *adapter, int cap)
 +{
 + return pci_find_capability(adapter-pdev, cap);
 +}
 +
 +static inline const char *adapter_name(adapter_t *adapter)
 +{
 + return adapter-name;
 +}
 +
 +static inline const char *port_name(adapter_t *adapter, unsigned int 
 port_idx)
 +{
 + return adapter-port[port_idx].dev-name;
 +}

Why not do this inline.

 +static inline void t3_os_set_hw_addr(adapter_t *adapter, int port_idx,
 +  u8 hw_addr[])
 +{
 + memcpy(adapter-port[port_idx].dev-dev_addr, hw_addr, ETH_ALEN);
 +#ifdef ETHTOOL_GPERMADDR
 + memcpy(adapter-port[port_idx].dev-perm_addr, hw_addr, ETH_ALEN);
 +#endif
 +}

Another bogus wrapper.

 +/*
 + * We use the spare atalk_ptr to map a net device to its SGE queue set.
 + * This is a macro so it can be used as l-value.
 + */
 +#define dev2qset(netdev) ((netdev)-atalk_ptr)

That looks a bad idea.

 +
 +#define OFFLOAD_DEVMAP_BIT 15
 +
 +#define tdev2adap(d) container_of(d, struct adapter, tdev)
 +
 +static inline int offload_running(adapter_t *adapter)
 +{
 + return test_bit(OFFLOAD_DEVMAP_BIT, adapter-open_device_map);
 +}
 +
 +int t3_offload_tx(struct t3cdev *tdev, struct sk_buff *skb);

What kind of offload?  You remember TOE was rejected.


 +#define promisc_rx_mode(rm)  ((rm)-dev-flags  IFF_PROMISC)
 +#define allmulti_rx_mode(rm) ((rm)-dev-flags  IFF_ALLMULTI)


Yet another high maintenance wrapper


 +struct sg_ent {   /* SGE scatter/gather entry */
 + u32 len[2];
 + u64 addr[2];
 +};

Shouldn't 

Re: [PATCH 8/10] cxgb3 - offload capabilities

2006-11-17 Thread Stephen Hemminger
On Fri, 17 Nov 2006 12:25:39 -0800
Divy Le Ray [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

 From: Divy Le Ray [EMAIL PROTECTED]
 
 This patch implements the offload capabilities of the
 Chelsio network adapter's driver.

Could you implement these as sysfs attributes on the device instead of
through /proc?
-
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 1/10] cxgb3 - main header files

2006-11-17 Thread Roland Dreier
   +#define MDIO_LOCK(adapter) down((adapter)-mdio_lock)
   +#define MDIO_UNLOCK(adapter) up((adapter)-mdio_lock)
  
  Please don't wrap locks

Plus these should probably be mutexes, not semaphores.

   +int t3_offload_tx(struct t3cdev *tdev, struct sk_buff *skb);
  
  What kind of offload?  You remember TOE was rejected.

But we're OK with RDMA over TCP (iWARP) I think...

 - R.
-
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]: spidernet poor network performance

2006-11-17 Thread Linas Vepstas

Andrew, 

Please apply.

--linas


This patch corrects a problem seen on later kernels running 
the NetPIPE application.  Specifically, NetPIPE would begin 
running very slowly at the 1533 packet size. It was
determined that Spidernet slowed with an idle DMA 
engine.

Signed-off-by: James K Lewis [EMAIL PROTECTED]
Signed-off-by: Linas Vepstas [EMAIL PROTECTED]


 drivers/net/spider_net.c |2 +-
 drivers/net/spider_net.h |8 
 2 files changed, 5 insertions(+), 5 deletions(-)

Index: linux-2.6.19-rc4-git3/drivers/net/spider_net.c
===
--- linux-2.6.19-rc4-git3.orig/drivers/net/spider_net.c 2006-11-01 
19:14:34.0 -0600
+++ linux-2.6.19-rc4-git3/drivers/net/spider_net.c  2006-11-17 
13:33:44.0 -0600
@@ -1606,7 +1606,7 @@ spider_net_enable_card(struct spider_net
 SPIDER_NET_INT2_MASK_VALUE);
 
spider_net_write_reg(card, SPIDER_NET_GDTDMACCNTR,
-SPIDER_NET_GDTBSTA | SPIDER_NET_GDTDCEIDIS);
+SPIDER_NET_GDTBSTA);
 }
 
 /**
Index: linux-2.6.19-rc4-git3/drivers/net/spider_net.h
===
--- linux-2.6.19-rc4-git3.orig/drivers/net/spider_net.h 2006-11-01 
19:14:34.0 -0600
+++ linux-2.6.19-rc4-git3/drivers/net/spider_net.h  2006-11-17 
16:19:30.0 -0600
@@ -24,7 +24,7 @@
 #ifndef _SPIDER_NET_H
 #define _SPIDER_NET_H
 
-#define VERSION 1.1 A
+#define VERSION 1.6 A
 
 #include sungem_phy.h
 
@@ -217,8 +217,7 @@ extern char spider_net_driver_name[];
 #define SPIDER_NET_GDTBSTA 0x0300
 #define SPIDER_NET_GDTDCEIDIS  0x0002
 #define SPIDER_NET_DMA_TX_VALUESPIDER_NET_TX_DMA_EN | \
-   SPIDER_NET_GDTBSTA | \
-   SPIDER_NET_GDTDCEIDIS
+   SPIDER_NET_GDTBSTA
 
 #define SPIDER_NET_DMA_TX_FEND_VALUE   0x00030003
 
@@ -328,7 +327,8 @@ enum spider_net_int2_status {
SPIDER_NET_GRISPDNGINT
 };
 
-#define SPIDER_NET_TXINT   ( (1  SPIDER_NET_GDTFDCINT) )
+#define SPIDER_NET_TXINT   ( (1  SPIDER_NET_GDTFDCINT) | \
+ (1  SPIDER_NET_GDTDCEINT) )
 
 /* We rely on flagged descriptor interrupts */
 #define SPIDER_NET_RXINT   ( (1  SPIDER_NET_GDAFDCINT) )
-
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: 2.6 patch] remove broken net drivers

2006-11-17 Thread Adrian Bunk
This patch removes net drivers that:
- had already been marked as BROKEN in 2.6.0 three years ago and
- are still marked as BROKEN.

These are the following drivers:
- MAC89x0
- ATARI_BIONET
- ATARI_PAMSNET
- SKMC

Drivers that had been marked as BROKEN for such a long time seem to be 
unlikely to be revived in the forseeable future.

But if anyone wants to ever revive any of these drivers, the code is 
still present in the older kernel releases.

Signed-off-by: Adrian Bunk [EMAIL PROTECTED]

---

Due to it's size, the patch is attached compressed.

 Documentation/networking/net-modules.txt |6 
 drivers/net/Kconfig  |   44 
 drivers/net/Makefile |4 
 drivers/net/Space.c  |   16 
 drivers/net/atari_bionet.c   |  674 
 drivers/net/atari_pamsnet.c  |  894 
 drivers/net/mac89x0.c|  666 
 drivers/net/sk_mca.c | 1216 ---
 drivers/net/sk_mca.h |  170 ---
 9 files changed, 3690 deletions(-)



patch-remove-broken-net.gz
Description: Binary data