zd1211 ported to Devicescape stack

2006-12-02 Thread Michael Wu
Hi,
I have finished a port of the zd1211 driver to the Devicescape 802.11 
stack. 
Due to the size of the patch, the patch that copies the zd1211 directory to 
the d80211 directory has been omitted, but can be found at my git repo. 
(git://git.kernel.org/pub/scm/linux/kernel/git/mwu/d80211-drivers.git up) The 
two other patches relevant to porting the driver are bzip2ed and attached due 
to size concerns.

This port works fairly well in STA mode, with adhoc and monitor modes to come 
in the future. I tried to minimize changes to the structure of the driver and 
code whenever possible to make it easier to port patches from the softmac 
based zd1211 driver to this driver. However:

- The original driver does not seem to check if a frame has been 
successfully 
TXed (as in RXed an ACK), so the port does not properly report to the stack 
whether or not a TX succeeded.
-Because d80211 does not have complete regulatory domains support yet, 
the 
associated code was trimmed to the bare minimum of reading the region code. 
It should be a trivial patch to add regulatory domains support once the 
infrastructure is in place in d80211.
- d80211 doesn't tell us the size of the next fragment, so that part of 
the 
hardware TX header isn't set anymore. This might be fixed in the future.
- The LED link status isn't too reliable - I haven't found a way to 
reliably 
tell if the upper layer thinks it is associated, and I don't know how to use 
the LED api. Not too worried about this issue though.

I will push this to wireless-dev soon if there are no major problems.

Thanks,
-Michael Wu


zd1211-kconfig.bz2
Description: BZip2 compressed data


zd1211-port-to-d80211.bz2
Description: BZip2 compressed data


pgpsQqp0cDSeo.pgp
Description: PGP signature


Re: 2.6.19: Kernel panic with ifconfig eth0 up

2006-12-02 Thread David Miller
From: Marko Hänninen [EMAIL PROTECTED]
Date: Sat, 2 Dec 2006 10:30:17 +0200

 Hi,
 
 I'm having a kernel panic issue when bringing eth0 up. It happens every time 
 with command ifconfig eth0 up. This is vanilla 2.6.19 kernel from 
 kernel.org. 
 Works ok with 2.6.18.3. The system is a Acer Aspire 5021 WLMI laptop.
 Is there anything I can try? I'm not subscribed to the list, so please CC me.

Known problem mentioned on the lists a few times already,
here is the fix:

commit c28728decc37fe52c8cdf48b3e0c0cf9b0c2fefb
Author: David S. Miller [EMAIL PROTECTED]
Date:   Wed Nov 29 18:14:47 2006 -0800

[IPV6] NDISC: Calculate packet length correctly for allocation.

MAX_HEADER does not include the ipv6 header length in it,
so we need to add it in explicitly.

Signed-off-by: David S. Miller [EMAIL PROTECTED]

diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index 73eb8c3..c42d4c2 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -441,7 +441,8 @@ static void ndisc_send_na(struct net_dev
 struct sk_buff *skb;
int err;
 
-   len = sizeof(struct icmp6hdr) + sizeof(struct in6_addr);
+   len = sizeof(struct ipv6hdr) + sizeof(struct icmp6hdr) +
+   sizeof(struct in6_addr);
 
/* for anycast or proxy, solicited_addr != src_addr */
ifp = ipv6_get_ifaddr(solicited_addr, dev, 1);
@@ -556,7 +557,8 @@ void ndisc_send_ns(struct net_device *de
if (err  0)
return;
 
-   len = sizeof(struct icmp6hdr) + sizeof(struct in6_addr);
+   len = sizeof(struct ipv6hdr) + sizeof(struct icmp6hdr) +
+   sizeof(struct in6_addr);
send_llinfo = dev-addr_len  !ipv6_addr_any(saddr);
if (send_llinfo)
len += ndisc_opt_addr_space(dev);
@@ -632,7 +634,7 @@ void ndisc_send_rs(struct net_device *de
if (err  0)
return;
 
-   len = sizeof(struct icmp6hdr);
+   len = sizeof(struct ipv6hdr) + sizeof(struct icmp6hdr);
if (dev-addr_len)
len += ndisc_opt_addr_space(dev);
 
@@ -1381,7 +1383,8 @@ void ndisc_send_redirect(struct sk_buff 
 struct in6_addr *target)
 {
struct sock *sk = ndisc_socket-sk;
-   int len = sizeof(struct icmp6hdr) + 2 * sizeof(struct in6_addr);
+   int len = sizeof(struct ipv6hdr) + sizeof(struct icmp6hdr) +
+   2 * sizeof(struct in6_addr);
struct sk_buff *buff;
struct icmp6hdr *icmph;
struct in6_addr saddr_buf;
-
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.19: very low transmit speed after suspend/resume with Sky2

2006-12-02 Thread Tino Keitel
Hi folks,
 
since 2.6.19 I have the problem that I get lousy transmit speeds of  1 
mbit/s.

Here is a quick test, the 5th column is the transfer speed in mbit/s:

From the affected machine to my laptop over WLAN (the affected machine
is connected to a Fast Ethernet switch):

$ nttcp -r -l 1400 -n 500 dose
l   708.16   0.040.6867155.5469   824  101.04   22887.6 
1   708.15   0.000.6873 56.   500  61.375000.0

Only 0,68 mbit/s during transmit. :-(

From my laptop to the affected machine:

$ nttcp -l 1400 -n 5000 dose
l  7002.21   0.03   25.3427   1999.8572  5000  2262.74  178558.7 
1  7002.25   0.07   24.8363823.4810  9268  4110.41  136286.1 

This is ok, 25 mbit/s during receive, limited by the WLAN in the
laptop.

After reboot:

$ nttcp -l 1400 -n 5000 dose
l  7002.04   0.03   27.5005   1749.8906  5000  2455.40  156240.2
1  7002.08   0.06   26.9843999.9464  9455  4556.00  168830.2

Now I got 27 mbit/s during receive, that's ok for WLAN.

Re-tested with 2.6.18.2 after a suspend/resume cycle:

$ nttcp -l 1500 -n 5000 dose
l  750  2.15  0.05   27.9219   1249.92195000   2326.83  104160.2
1  750  2.20  0.04   27.2441   1499.92505178   2351.16  129443.5

$ nttcp -r -l 1500 -n 5000 dose
l  750  2.07  0.09   28.9676681.77945182   2501.83  58883.0
1  750  1.98  0.03   30.2748   2142.78065000   2522.90  178565.1

lspci output:

01:00.0 Ethernet controller: Marvell Technology Group Ltd. 88E8053
PCI-E Gigabit Ethernet Controller (rev 22)

Any hints what I could try to get the full performance in 2.6.19?

Regards,
Tino
-
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] net/tipc: kmalloc/kzalloc conversion

2006-12-02 Thread Florian Westphal
From: Florian Westphal [EMAIL PROTECTED]

convert kmalloc/memset to kzalloc.

Signed-off-by: Florian Westphal [EMAIL PROTECTED]

---

compile tested only.

index 1bb7570..730c5c4 100644
--- a/net/tipc/bcast.c
+++ b/net/tipc/bcast.c
@@ -774,8 +774,8 @@ int tipc_bclink_set_queue_limits(u32 lim
 
 int tipc_bclink_init(void)
 {
-   bcbearer = kmalloc(sizeof(*bcbearer), GFP_ATOMIC);
-   bclink = kmalloc(sizeof(*bclink), GFP_ATOMIC);
+   bcbearer = kzalloc(sizeof(*bcbearer), GFP_ATOMIC);
+   bclink = kzalloc(sizeof(*bclink), GFP_ATOMIC);
if (!bcbearer || !bclink) {
  nomem:
warn(Multicast link creation failed, no memory\n);
@@ -786,14 +786,12 @@ int tipc_bclink_init(void)
return -ENOMEM;
}
 
-   memset(bcbearer, 0, sizeof(struct bcbearer));
INIT_LIST_HEAD(bcbearer-bearer.cong_links);
bcbearer-bearer.media = bcbearer-media;
bcbearer-media.send_msg = tipc_bcbearer_send;
sprintf(bcbearer-media.name, tipc-multicast);
 
bcl = bclink-link;
-   memset(bclink, 0, sizeof(struct bclink));
INIT_LIST_HEAD(bcl-waiting_ports);
bcl-next_out_no = 1;
spin_lock_init(bclink-node.lock);
index 049242e..2d3f486 100644
--- a/net/tipc/name_table.c
+++ b/net/tipc/name_table.c
@@ -1052,12 +1052,11 @@ int tipc_nametbl_init(void)
 {
int array_size = sizeof(struct hlist_head) * tipc_nametbl_size;
 
-   table.types = kmalloc(array_size, GFP_ATOMIC);
+   table.types = kzalloc(array_size, GFP_ATOMIC);
if (!table.types)
return -ENOMEM;
 
write_lock_bh(tipc_nametbl_lock);
-   memset(table.types, 0, array_size);
table.local_publ_count = 0;
write_unlock_bh(tipc_nametbl_lock);
return 0;
index 886bda5..76c2abb 100644
--- a/net/tipc/node.c
+++ b/net/tipc/node.c
@@ -60,7 +60,7 @@ struct node *tipc_node_create(u32 addr)
struct node *n_ptr;
 struct node **curr_node;
 
-   n_ptr = kmalloc(sizeof(*n_ptr),GFP_ATOMIC);
+   n_ptr = kzalloc(sizeof(*n_ptr),GFP_ATOMIC);
if (!n_ptr) {
warn(Node creation failed, no memory\n);
return NULL;
@@ -75,7 +75,6 @@ struct node *tipc_node_create(u32 addr)
return NULL;
}

-   memset(n_ptr, 0, sizeof(*n_ptr));
n_ptr-addr = addr;
 spin_lock_init(n_ptr-lock);
INIT_LIST_HEAD(n_ptr-nsub);
index 7a918f1..ddade73 100644
--- a/net/tipc/subscr.c
+++ b/net/tipc/subscr.c
@@ -350,7 +350,7 @@ static void subscr_subscribe(struct tipc
 
/* Allocate subscription object */
 
-   sub = kmalloc(sizeof(*sub), GFP_ATOMIC);
+   sub = kzalloc(sizeof(*sub), GFP_ATOMIC);
if (!sub) {
warn(Subscription rejected, no memory\n);
subscr_terminate(subscriber);
@@ -359,7 +359,6 @@ static void subscr_subscribe(struct tipc
 
/* Initialize subscription object */
 
-   memset(sub, 0, sizeof(*sub));
sub-seq.type = htohl(s-seq.type, subscriber-swap);
sub-seq.lower = htohl(s-seq.lower, subscriber-swap);
sub-seq.upper = htohl(s-seq.upper, subscriber-swap);
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: RFC: XFRM changing the view of xfrm_aevent_id

2006-12-02 Thread jamal
On Fri, 2006-01-12 at 20:08 -0800, David Miller wrote:

 
 Let's change it now while we still can.
 
 A few months from now, I will probably not give the same
 answer :)

:- Ok, here it is ...

cheers,
jamal

[XFRM] fix aevent structuring to be more complete

aevents can not uniquely identify an SA. We break the ABI with
this patch, but consensus is that since it is not yet utilized
by any (known) application then it is fine (better do it now than
later).

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

---
commit 4bacaeb2cea3c6684f9b3acc54f71958bb2c25c5
tree c5f416a504abdb7583b799fec5245495c462bc92
parent 5465ae68b5ec11b2820db3f9b4c6fd94f113da44
author Jamal Hadi Salim [EMAIL PROTECTED] Sat, 02 Dec 2006 06:05:42 -0500
committer Jamal Hadi Salim [EMAIL PROTECTED] Sat, 02 Dec 2006 06:05:42 -0500

 Documentation/networking/xfrm_sync.txt |5 -
 include/linux/xfrm.h   |2 ++
 net/xfrm/xfrm_user.c   |4 +++-
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/Documentation/networking/xfrm_sync.txt 
b/Documentation/networking/xfrm_sync.txt
index 8be626f..fb88f1d 100644
--- a/Documentation/networking/xfrm_sync.txt
+++ b/Documentation/networking/xfrm_sync.txt
@@ -47,10 +47,13 @@ aevent_id structure looks like:
 
struct xfrm_aevent_id {
  struct xfrm_usersa_id   sa_id;
+ xfrm_address_t  saddr;
  __u32   flags;
+ __u32   reqid;
};
 
-xfrm_usersa_id in this message layout identifies the SA.
+The unique SA is identified by the combination of xfrm_usersa_id, 
+reqid and saddr.
 
 flags are used to indicate different things. The possible
 flags are:
diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h
index 7907c42..088ba81 100644
--- a/include/linux/xfrm.h
+++ b/include/linux/xfrm.h
@@ -289,7 +289,9 @@ struct xfrm_usersa_id {
 
 struct xfrm_aevent_id {
struct xfrm_usersa_id   sa_id;
+   xfrm_address_t  saddr;
__u32   flags;
+   __u32   reqid;
 };
 
 struct xfrm_userspi_info {
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index 055b72f..6f97665 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -1281,10 +1281,12 @@ static int build_aevent(struct sk_buff *skb, struct 
xfrm_state *x, struct km_eve
id = NLMSG_DATA(nlh);
nlh-nlmsg_flags = 0;
 
-   id-sa_id.daddr = x-id.daddr;
+   memcpy(id-sa_id.daddr, x-id.daddr,sizeof(x-id.daddr));
id-sa_id.spi = x-id.spi;
id-sa_id.family = x-props.family;
id-sa_id.proto = x-id.proto;
+   memcpy(id-saddr, x-props.saddr,sizeof(x-props.saddr));
+   id-reqid = x-props.reqid;
id-flags = c-data.aevent;
 
RTA_PUT(skb, XFRMA_REPLAY_VAL, sizeof(x-replay), x-replay);


Re: Network virtualization/isolation

2006-12-02 Thread Kari Hurtta
[EMAIL PROTECTED] (Eric W. Biederman) writes in gmane.linux.network:

 Ok.  So on this point we agree.  Full isolation at the network device/L2 level
 is desirable and no one is opposed to that.
 
 There is however a strong feeling especially for the case of application
 containers that something more focused on what a non-privileged process can
 use and deal with would be nice.  The ``L3'' case.
 
 I agree that has potential but I worry about 2 things.
 - Premature optimization.
 - A poor choice of semantics.
 - Feature creep leading to insane semantics.
 
 I feel there is something in the L3 arguments as well and it sounds
 like it would be a good idea to flush out the semantics.
 
 For full network isolation we have the case that every process,
 every socket, and every network device belongs to a network namespace.
 This is enough to derive the network namespace for all other user
 visible data structures, and to a large extent to define their semantics.
 
 We still need a definition of the non-privileged case, that is compatible
 with the former definition.
 
 .
 
 What unprivileged user space gets to manipulate are sockets.  So perhaps
 we can break our model into a network socket namespace and network device
 namespace.  
 
 I would define it so that for each socket there is exactly one network
 socket namespace.  And for each network socket namespace there is exactly
 one network device namespace.
 
 The network socket namespace would be concerned with the rules for deciding
 which local addresses a socket can connect/accept/bind to.
 
 The network device namespace would be concerned with everything else.

There need decide one thing:  What is connection between  namespaces?

- Connection between the network device namespaces is bridge.

- What (socket) is connection between the network socket namespaces?

Connection inside on name namespace is clear I think.

 - Connection inside of network device namespaces is loopback device.

 - Connection inside of network socket namespaces is socket
   using loopback address(es)?

/ Kari Hurtta



-
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: Network virtualization/isolation

2006-12-02 Thread Kari Hurtta
Kari Hurtta [EMAIL PROTECTED] writes in gmane.linux.network:

 [EMAIL PROTECTED] (Eric W. Biederman) writes in gmane.linux.network:
 
  Ok.  So on this point we agree.  Full isolation at the network device/L2 
  level
  is desirable and no one is opposed to that.
  
  There is however a strong feeling especially for the case of application
  containers that something more focused on what a non-privileged process can
  use and deal with would be nice.  The ``L3'' case.
  
  I agree that has potential but I worry about 2 things.
  - Premature optimization.
  - A poor choice of semantics.
  - Feature creep leading to insane semantics.
  
  I feel there is something in the L3 arguments as well and it sounds
  like it would be a good idea to flush out the semantics.
  
  For full network isolation we have the case that every process,
  every socket, and every network device belongs to a network namespace.
  This is enough to derive the network namespace for all other user
  visible data structures, and to a large extent to define their semantics.
  
  We still need a definition of the non-privileged case, that is compatible
  with the former definition.
  
  .
  
  What unprivileged user space gets to manipulate are sockets.  So perhaps
  we can break our model into a network socket namespace and network device
  namespace.  
  
  I would define it so that for each socket there is exactly one network
  socket namespace.  And for each network socket namespace there is exactly
  one network device namespace.
  
  The network socket namespace would be concerned with the rules for deciding
  which local addresses a socket can connect/accept/bind to.
  
  The network device namespace would be concerned with everything else.
 
 There need decide one thing:  What is connection between  namespaces?
 
 - Connection between the network device namespaces is bridge.
 
 - What (socket) is connection between the network socket namespaces?
 
 Connection inside on name namespace is clear I think.
 
  - Connection inside of network device namespaces is loopback device.
 
  - Connection inside of network socket namespaces is socket
using loopback address(es)?


On other hand bridge between the network device namespaces need to set
on parent namespace.

So it is logical that connecting socket between network socket namespaces
is set on parent namespace.So connecting socket is any socket created 
on parent namespace?   (socketpair() for example? )


( Currently socketpair()  allows only create AF_UNIX  sockects, which
  are not part of network socket namespace, I think) 

/ Kari Hurtta

-
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][GENETLINK] move command capabilities to flags

2006-12-02 Thread jamal

Dave,
If there is no objections on this approach, please apply this patch.
Against net-2.6.20

cheers,
jamal
This patch moves command capabilities to command flags. Other than
being cleaner, saves several bytes.

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

---
commit b6ac8f41bdd2edd9d215e376efa47261e9b118a1
tree fec2a968aad15264b30e2d550cb0c6f7939d4c93
parent 4bacaeb2cea3c6684f9b3acc54f71958bb2c25c5
author Jamal Hadi Salim [EMAIL PROTECTED] Sat, 02 Dec 2006 06:54:55 -0500
committer Jamal Hadi Salim [EMAIL PROTECTED] Sat, 02 Dec 2006 06:54:55 -0500

 include/linux/genetlink.h |3 +++
 net/netlink/genetlink.c   |   16 +++-
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/include/linux/genetlink.h b/include/linux/genetlink.h
index 9049dc6..3bd75c2 100644
--- a/include/linux/genetlink.h
+++ b/include/linux/genetlink.h
@@ -17,6 +17,9 @@ struct genlmsghdr {
 #define GENL_HDRLENNLMSG_ALIGN(sizeof(struct genlmsghdr))
 
 #define GENL_ADMIN_PERM0x01
+#define GENL_CMD_CAP_DO0x02
+#define GENL_CMD_CAP_DUMP  0x04
+#define GENL_CMD_CAP_HASPOL0x08
 
 /*
  * List of reserved static generic netlink identifiers:
diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c
index cc874f0..adfc203 100644
--- a/net/netlink/genetlink.c
+++ b/net/netlink/genetlink.c
@@ -143,6 +143,13 @@ int genl_register_ops(struct genl_family *family, struct 
genl_ops *ops)
goto errout;
}
 
+   if (ops-dumpit)
+   ops-flags |= GENL_CMD_CAP_DO;
+   if (ops-doit)
+   ops-flags |= GENL_CMD_CAP_DUMP;
+   if (ops-policy)
+   ops-flags |= GENL_CMD_CAP_HASPOL;
+
genl_lock();
list_add_tail(ops-ops_list, family-ops_list);
genl_unlock();
@@ -425,15 +432,6 @@ static int ctrl_fill_info(struct genl_family *family, u32 
pid, u32 seq,
NLA_PUT_U32(skb, CTRL_ATTR_OP_ID, ops-cmd);
NLA_PUT_U32(skb, CTRL_ATTR_OP_FLAGS, ops-flags);
 
-   if (ops-policy)
-   NLA_PUT_FLAG(skb, CTRL_ATTR_OP_POLICY);
-
-   if (ops-doit)
-   NLA_PUT_FLAG(skb, CTRL_ATTR_OP_DOIT);
-
-   if (ops-dumpit)
-   NLA_PUT_FLAG(skb, CTRL_ATTR_OP_DUMPIT);
-
nla_nest_end(skb, nest);
}
 


[RFC][GENETLINK] introduce command names

2006-12-02 Thread jamal
Dave,
Same as before:
If there is no objections on this approach, please apply this patch.
Against net-2.6.20

cheers,
jamal

[GENETLINK] introduce command names

Introduce optional command names.
While command names can be put in user space by the author of the
command, this alleviates things for the discovery process without
requiring any user space code written.
In a recent tutorial that i gave, the desire for this feature was
the highest.

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

---
commit c3b92488bea3f11a6cc7c1c59101444c26ad12ce
tree 52166fb1ea684e989fef16de89c85fb9bf551bb8
parent b6ac8f41bdd2edd9d215e376efa47261e9b118a1
author Jamal Hadi Salim [EMAIL PROTECTED] Sat, 02 Dec 2006 07:08:15 -0500
committer Jamal Hadi Salim [EMAIL PROTECTED] Sat, 02 Dec 2006 07:08:15 -0500

 include/net/genetlink.h |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/include/net/genetlink.h b/include/net/genetlink.h
index 7fd131c..52bc278 100644
--- a/include/net/genetlink.h
+++ b/include/net/genetlink.h
@@ -49,6 +49,7 @@ struct genl_info
 /**
  * struct genl_ops - generic netlink operations
  * @cmd: command identifier
+ * @name: command name
  * @flags: flags
  * @policy: attribute validation policy
  * @doit: standard command callback
@@ -58,6 +59,7 @@ struct genl_info
 struct genl_ops
 {
u8  cmd;
+   charname[GENL_NAMSIZ];
unsigned intflags;
struct nla_policy   *policy;
int(*doit)(struct sk_buff *skb,


Re: 2.6.19: very low transmit speed after suspend/resume with Sky2

2006-12-02 Thread Tino Keitel
On Sat, Dec 02, 2006 at 10:16:28 +0100, Tino Keitel wrote:
 Hi folks,
  
 since 2.6.19 I have the problem that I get lousy transmit speeds of  1 
 mbit/s.
 
 Here is a quick test, the 5th column is the transfer speed in mbit/s:
 
 From the affected machine to my laptop over WLAN (the affected machine
 is connected to a Fast Ethernet switch):
 
 $ nttcp -r -l 1400 -n 500 dose
 l   708.16   0.040.6867155.5469   824  101.04   22887.6 
 1   708.15   0.000.6873 56.   500  61.375000.0
 
 Only 0,68 mbit/s during transmit. :-(
 
 From my laptop to the affected machine:
 
 $ nttcp -l 1400 -n 5000 dose
 l  7002.21   0.03   25.3427   1999.8572  5000  2262.74  178558.7 
 1  7002.25   0.07   24.8363823.4810  9268  4110.41  136286.1 
 
 This is ok, 25 mbit/s during receive, limited by the WLAN in the
 laptop.
 
 After reboot:
 
 $ nttcp -l 1400 -n 5000 dose
 l  7002.04   0.03   27.5005   1749.8906  5000  2455.40  156240.2
 1  7002.08   0.06   26.9843999.9464  9455  4556.00  168830.2
 
 Now I got 27 mbit/s during receive, that's ok for WLAN.

Sorry, I should give the number for _transmit_ here. This was ok, too.

Regards,
Tino
-
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: zd1211 ported to Devicescape stack

2006-12-02 Thread Ulrich Kunitz
Hi Michael,

   I have finished a port of the zd1211 driver to the Devicescape 802.11 
 stack. 

This is absolutely great news. I will look into it and check it
today.

   - The original driver does not seem to check if a frame has been 
 successfully 
 TXed (as in RXed an ACK), so the port does not properly report to the stack 
 whether or not a TX succeeded.

TX is atomic. Do you really want to spin for the received ACK? Layer 2 doesn't
need to make any guarantees for packet transmission, so I have
trouble to see the point here. The Linux Device Driver book says
explicitly that packet transmission must not have been completed
at the point in time the function returns.

   -Because d80211 does not have complete regulatory domains support yet, 
 the 
 associated code was trimmed to the bare minimum of reading the region code. 

I have to look into it, but the code we had, didn't rely on upper
layer support. I would suggest to maintain it until d80211 has
complete regulatory domains support.

   - The LED link status isn't too reliable - I haven't found a way to 
 reliably 
 tell if the upper layer thinks it is associated, and I don't know how to use 
 the LED api. Not too worried about this issue though.

It took us also some time to do it for softmac. But it appears
that the d80211 stack needs still a fair amount of work.

-- 
Uli Kunitz
-
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: zd1211 ported to Devicescape stack

2006-12-02 Thread Michael Wu
On Saturday 02 December 2006 08:25, Ulrich Kunitz wrote:
  - The original driver does not seem to check if a frame has been
  successfully TXed (as in RXed an ACK), so the port does not properly
  report to the stack whether or not a TX succeeded.

 TX is atomic. Do you really want to spin for the received ACK? Layer 2
 doesn't need to make any guarantees for packet transmission, so I have
 trouble to see the point here. The Linux Device Driver book says
 explicitly that packet transmission must not have been completed
 at the point in time the function returns.

And it doesn't. Sleeping at that point would be bad. However, the p54 driver 
looks for special frames from the card that report the success/failure of 
sent frames, and adm8211 can tell if a frame was TXed successfully on TX ring 
cleanup. The notification is then done by calling ieee80211_tx_status, not by 
returning an error code. No sleeping necessary. This is needed for the upper 
layer to resend frames and to also do rate control.

 I would suggest to maintain it until d80211 has
 complete regulatory domains support.

Why? It's not like any other d80211 drivers have regulatory domains support, 
and they need the exactly the same features that zd1211 needs. Also, the 
limited support for regulatory domains that d80211 does have restricts it to 
channels 1-11 (FCC) regardless, so the code would not be effective.

Thanks,
-Michael Wu


pgpMQ7cClQqGX.pgp
Description: PGP signature


Re: zd1211 ported to Devicescape stack

2006-12-02 Thread Daniel Drake

Michael Wu wrote:

Hi,
	I have finished a port of the zd1211 driver to the Devicescape 802.11 stack. 


Yeah!! thanks so much for doing this.

Are you willing to maintain this in terms of porting upcoming patches to 
it? I think I also speak for Ulrich when I say that at the moment we are 
more concerned about getting our work into mainline and don't have time 
to maintain a ported driver, but we will be happy to switch immediately 
as soon as devicescape is declared ready for mainline inclusion.


	- The original driver does not seem to check if a frame has been successfully 
TXed (as in RXed an ACK), so the port does not properly report to the stack 
whether or not a TX succeeded.


Indeed, the situation is that silence means transmission succeeded, and 
we get a retry_failed interrupt if it didn't.


	- d80211 doesn't tell us the size of the next fragment, so that part of the 
hardware TX header isn't set anymore. This might be fixed in the future.


Even though ieee80211 appeared to have the infrastructure to do so, I 
don't think it was ever passing us multiple fragments. So this is no big 
deal.


	- The LED link status isn't too reliable - I haven't found a way to reliably 
tell if the upper layer thinks it is associated, and I don't know how to use 
the LED api. Not too worried about this issue though.


Watch out, the single most common bug report for zd1211rw (vs vendor 
driver) was that the LED didn't blink until recently :)


Thanks!
Daniel

-
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: zd1211 ported to Devicescape stack

2006-12-02 Thread Ulrich Kunitz
On 06-12-02 10:58 Daniel Drake wrote:

 Michael Wu wrote:
 Hi,
  I have finished a port of the zd1211 driver to the Devicescape 
  802.11 stack. 
 
 Yeah!! thanks so much for doing this.
 
 Are you willing to maintain this in terms of porting upcoming patches to 
 it? I think I also speak for Ulrich when I say that at the moment we are 
 more concerned about getting our work into mainline and don't have time 
 to maintain a ported driver, but we will be happy to switch immediately 
 as soon as devicescape is declared ready for mainline inclusion.

I intend to track the d80211 stack, care for the forward porting
and see also a number of things, which should be done for d80211.

- 802.11a support
- better d80211 integration (d80211_tx_status, led stuff)
- cleanups

Daniel your hardware crypto patches should certainly be included
here.

This will make the d80211 driver the development branch and the
mainline driver the maintenance branch. As already stated I intend
care for forwardportsi of the mainline fixes, but IMHO we should
not care to much for backports and backport compatibility. 

-- 
Uli Kunitz
-
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: zd1211 ported to Devicescape stack

2006-12-02 Thread Michael Wu
On Saturday 02 December 2006 12:57, Ulrich Kunitz wrote:
 I intend to track the d80211 stack, care for the forward porting
 and see also a number of things, which should be done for d80211.

 - 802.11a support
 - better d80211 integration (d80211_tx_status, led stuff)
 - cleanups

Great! I expected to handle the patch porting alone, but it's better to have 
someone used to this hardware doing this.

 This will make the d80211 driver the development branch and the
 mainline driver the maintenance branch. As already stated I intend
 care for forwardportsi of the mainline fixes, but IMHO we should
 not care to much for backports and backport compatibility.
I avoided cleanups in the patch to make any patch porting from the mainline 
driver easier, but if it's okay with you, I might make a few zd1211-d80211 
specific clean up patches.

Thanks,
-Michael Wu


pgpTXgNY8kbdB.pgp
Description: PGP signature


Re: zd1211 ported to Devicescape stack

2006-12-02 Thread Daniel Drake

Ulrich Kunitz wrote:

I intend to track the d80211 stack, care for the forward porting
and see also a number of things, which should be done for d80211.


OK, sorry for the false assumptions in my last mail.

In that case, I guess we should both switch to developing zd1211rw on 
d80211 primarily. I am still interested in seeing stuff in mainline so I 
will spend time backporting some of the new developments (but nothing 
major).


We should also use this opportunity to switch to developing in kernel 
git trees (as opposed to external kernel module git trees) for the 
d80211 port.


To start with, I would ask you to pull my git tree then John (or 
Michael?) would pull from you. We should start this at the point when 
Michael's port enters wireless-dev.git


What do you think?


Daniel your hardware crypto patches should certainly be included
here.


The patch only enables hardware decryption and doesn't work completely. 
Needs more work.


Daniel
-
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: Multiple end-points behind same NAT

2006-12-02 Thread Michal Ruzicka

Hi,

although I'm not a kernel guru I think I've got something to say to this.



I am wondering if 26sec supports NAT-Traversal for multiple
endpoints behind the same NAT. In looking at xfrm_tmpl it's
not obvious to me that it's supported, ...


You are looking at the rignt place indeed. Just to make you sure, there is 
really no space to store the port infomation of the tunnel endpoints in the 
xfrm_tmpl structure.
The structure xfrm_state (a kernel structuture for holding SA's) is a bit 
different story though. Although the port information is not stored directly 
in the structure either, there is the encap member pointing to a 
xfrm_encap_tmpl structure which is used to hold the required information.


The consequences of this are:
1) The IKE dameon (or the key manager as it is called in the kernel context) 
can't get the full infomation from the kernel required to be a successful 
initiator in the case of  multiple peers behind the same NAT. (Though you 
might be able to get it working with a single peer behind the NAT if you 
configure the port forwarding at the NAT box carefuly.)


2) If there was an IKE daemon which could be told the required port 
information by some other means then directly by the kernel it should be 
possible to make it work despite the deficiencies of the kernel. I don't 
know if there is any IKE daemon capable of this, but I'm sure racoon can't 
do that.


3) It is possible to get this working the other way around: If the boxes 
behind the NAT were the initiators then it should work just fine at least if 
tunnel mode was used. There are some problems with the transport mode but 
even that can be made to work for certain scenarios.


Regards,
Michal 


-
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-drivers pull request

2006-12-02 Thread Michael Wu
Hi John,

Please pull
git://git.kernel.org/pub/scm/linux/kernel/git/mwu/d80211-drivers.git up
for these patches:

Michael Wu (4):
  zd1211-d80211: Copy zd1211 driver to d80211 directory
  zd1211-d80211: Hook up Kconfig and Makefiles
  zd1211-d80211: Port zd1211 to Devicescape stack
  p54: Don't send startup packet again on next ifup (USB)

 Kconfig  |1
 Makefile |1
 p54/prism54usb.c |   26
 zd1211rw/Kconfig |   19
 zd1211rw/Makefile|   11
 zd1211rw/zd_chip.c   | 1655 
+++
 zd1211rw/zd_chip.h   |  845 +++
 zd1211rw/zd_def.h|   54 +
 zd1211rw/zd_ieee80211.h  |   68 +
 zd1211rw/zd_mac.c|  638 ++
 zd1211rw/zd_mac.h|  247 +++
 zd1211rw/zd_rf.c |  156 
 zd1211rw/zd_rf.h |   83 ++
 zd1211rw/zd_rf_al2230.c  |  373 ++
 zd1211rw/zd_rf_al7230b.c |  274 +++
 zd1211rw/zd_rf_rf2959.c  |  279 +++
 zd1211rw/zd_types.h  |   71 ++
 zd1211rw/zd_usb.c| 1423 
 zd1211rw/zd_usb.h|  243 ++
 zd1211rw/zd_util.c   |   82 ++
 zd1211rw/zd_util.h   |   29
 21 files changed, 6574 insertions(+), 4 deletions(-)

Thanks,
-Michael Wu


pgpVXt3OWfgzF.pgp
Description: PGP signature


Re: 2.6.19: very low transmit speed after suspend/resume with Sky2

2006-12-02 Thread Stephen Hemminger

Tino Keitel wrote:

On Sat, Dec 02, 2006 at 10:16:28 +0100, Tino Keitel wrote:
  
Hi folks,
 
since 2.6.19 I have the problem that I get lousy transmit speeds of  1 
mbit/s.


Here is a quick test, the 5th column is the transfer speed in mbit/s:

From the affected machine to my laptop over WLAN (the affected machine
is connected to a Fast Ethernet switch):

$ nttcp -r -l 1400 -n 500 dose
l   708.16   0.040.6867155.5469   824  101.04   22887.6 
1   708.15   0.000.6873 56.   500  61.375000.0


Only 0,68 mbit/s during transmit. :-(

From my laptop to the affected machine:

$ nttcp -l 1400 -n 5000 dose
l  7002.21   0.03   25.3427   1999.8572  5000  2262.74  178558.7 
1  7002.25   0.07   24.8363823.4810  9268  4110.41  136286.1 


This is ok, 25 mbit/s during receive, limited by the WLAN in the
laptop.

After reboot:

$ nttcp -l 1400 -n 5000 dose
l  7002.04   0.03   27.5005   1749.8906  5000  2455.40  156240.2
1  7002.08   0.06   26.9843999.9464  9455  4556.00  168830.2

Now I got 27 mbit/s during receive, that's ok for WLAN.



Sorry, I should give the number for _transmit_ here. This was ok, too.

Regards,
Tino


Most likely, the problem is similar to one I am working. The 
device_resume code gets run before
BIOS. And the BIOS wakeup screws up the device. The proper fix will 
happen in 2.6.20.

If you are using MSI, turn that off.
-
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] rose_add_loopback_node: propagate -E

2006-12-02 Thread Alexey Dobriyan
David Binderman's icc logs:
net/rose/rose_route.c(399): remark #593: variable err was set but never used

Signed-off-by: Alexey Dobriyan [EMAIL PROTECTED]
---

 net/rose/rose_route.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/net/rose/rose_route.c
+++ b/net/rose/rose_route.c
@@ -396,7 +396,7 @@ int rose_add_loopback_neigh(void)
 int rose_add_loopback_node(rose_address *address)
 {
struct rose_node *rose_node;
-   unsigned int err = 0;
+   int err = 0;
 
spin_lock_bh(rose_node_list_lock);
 
@@ -432,7 +432,7 @@ int rose_add_loopback_node(rose_address 
 out:
spin_unlock_bh(rose_node_list_lock);
 
-   return 0;
+   return 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


Re: [PATCH] 2.6 driver for Silan SC92031

2006-12-02 Thread Jeff Garzik

Cesar Eduardo Barros wrote:

From: Cesar Eduardo Barros [EMAIL PROTECTED]

This is a driver for the Silan SC92031/Rsltek 8139D NIC chip. It's a
rewrite of the vendor 2.4 driver for 2.6, and has been lightly tested
on a 2.6.17 x86-64 kernel with the Ubuntu patches (as a out-of-tree
module only).

This chip is found on at least one counterfeit Encore ENL832-TX-RENT
NIC [1], which came with a mini-CD with the 2.4 driver. A slightly
older version of the driver was found at [2]. The main difference
between them is that the newer one has a small bugfix in the RX path,
a lot of gratuitous renaming of functions, all the printable strings
changed to show as a Rsltek 8139D [sic], and a PCI ID of 8139 instead
of 2031.

This patch has been modified to apply cleanly on 2.6.19; to run on
2.6.17, just add back the struct pt_regs* argument to the interrupt
handler and to its call at poll_controller(). It compiles on 2.6.19 for
x86-64 as a module.

[1] See http://www.encore-usa.com/faq.php under ENL832-TX-RENT for more
information
[2] Look for SL_LINUX.ZIP (which is really a .tar.gz) at
http://broadbandforum.in/dataone_Intex_LAN_cardlinux-t4207-s15.html

Signed-off-by: Cesar Eduardo Barros [EMAIL PROTECTED]


Seems like it would be best to modify the existing 8139 driver...

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: 2.6.19: very low transmit speed after suspend/resume with Sky2

2006-12-02 Thread Tino Keitel
On Sat, Dec 02, 2006 at 13:16:28 -0800, Stephen Hemminger wrote:

[...]

 Most likely, the problem is similar to one I am working. The 

Great to hear that someone is working on this. If you need a tester,
just ask. :-)

 device_resume code gets run before
 BIOS. And the BIOS wakeup screws up the device. The proper fix will 
 happen in 2.6.20.
 If you are using MSI, turn that off.

I don't use it:

# CONFIG_PCI_MSI is not set

Regards,
Tino
-
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: removing the dgrs net driver

2006-12-02 Thread Adrian Bunk
Based on the information in the email forwarded below I'd remove the 
dgrs net driver (this wasn't the first driver shipped with the kernel 
without any hardware ever produced...).

Is this OK or is there any doubt whether this information is true?

cu
Adrian


- Forwarded message from Nathanael Nerode [EMAIL PROTECTED] -

Date:   Sun, 24 Sep 2006 13:00:12 -0400
From: Nathanael Nerode [EMAIL PROTECTED]
To: netdev@vger.kernel.org
Subject: Please remove useless dgrs driver

An official email from digi.com to Andres Salomon [EMAIL PROTECTED]
explained:

 Dear Andres:

 After further research, we found that this product was killed in place
 and never reached the market.  We would like to request that this not be
 included.

Copy at http://wiki.debian.org/KernelFirmwareLicensing (this was discovered
during research into firmware licensing).

The drgs driver is useless (no hardware to drive) and should be removed.
The files which should be deleted from the tree are:
drivers/net/dgrs.c
drivers/net/dgrs.h
drivers/net/dgrs_es4h.h
drivers/net/dgrs_plx9060.h
drivers/net/dgrs_i82596.h
drivers/net/dgrs_ether.h
drivers/net/dgrs_asstruct.h
drivers/net/dgrs_bcomm.h
drivers/net/dgrs_firmware.c

It will probably also be necessary to delete some stuff from drivers/net/Kconfig
and drivers/net/Makefile, but I assume that this will be trivial for any
net maintainer.

Thanks in advance for doing this.

-- 
Nathanael Nerode  [EMAIL PROTECTED]

(Instead, we front-load the flamewars and grudges in
the interest of efficiency.) --Steve Lanagasek,
http://lists.debian.org/debian-devel/2005/09/msg01056.html
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

- End forwarded message -

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


Re: RFC: removing the dgrs net driver

2006-12-02 Thread Alan
On Sat, 2 Dec 2006 18:19:32 +0100
Adrian Bunk [EMAIL PROTECTED] wrote:

 Based on the information in the email forwarded below I'd remove the 
 dgrs net driver (this wasn't the first driver shipped with the kernel 
 without any hardware ever produced...).
 
 Is this OK or is there any doubt whether this information is true?

As I understand it a small number of such devices were produced, but I
have no objection to it going away. Even if someone had such a card it
would not actually be useful any more.

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


Re: RFC: removing the dgrs net driver

2006-12-02 Thread maximilian attems
On Sat, Dec 02, 2006 at 06:19:32PM +0100, Adrian Bunk wrote:
 Based on the information in the email forwarded below I'd remove the 
 dgrs net driver (this wasn't the first driver shipped with the kernel 
 without any hardware ever produced...).
 
 Is this OK or is there any doubt whether this information is true?
 
 cu
 Adrian

ok thanks for doing this,
as the reporter was to lazy to cook up a proper patch for that.

there is zero bug report for dgrs on the debian bts nor did i find
one in bugzilla.kernel.org. redhat guys might want to verify on their
side.

 
 - Forwarded message from Nathanael Nerode [EMAIL PROTECTED] -
 
 Date: Sun, 24 Sep 2006 13:00:12 -0400
 From: Nathanael Nerode [EMAIL PROTECTED]
 To: netdev@vger.kernel.org
 Subject: Please remove useless dgrs driver
 
 An official email from digi.com to Andres Salomon [EMAIL PROTECTED]
 explained:
 
  Dear Andres:
 
  After further research, we found that this product was killed in place
  and never reached the market.  We would like to request that this not be
  included.
 
 Copy at http://wiki.debian.org/KernelFirmwareLicensing (this was discovered
 during research into firmware licensing).
 
 The drgs driver is useless (no hardware to drive) and should be removed.
 The files which should be deleted from the tree are:
 drivers/net/dgrs.c
 drivers/net/dgrs.h
 drivers/net/dgrs_es4h.h
 drivers/net/dgrs_plx9060.h
 drivers/net/dgrs_i82596.h
 drivers/net/dgrs_ether.h
 drivers/net/dgrs_asstruct.h
 drivers/net/dgrs_bcomm.h
 drivers/net/dgrs_firmware.c
 
 It will probably also be necessary to delete some stuff from 
 drivers/net/Kconfig
 and drivers/net/Makefile, but I assume that this will be trivial for any
 net maintainer.
 
 Thanks in advance for doing this.
 
 -- 
 Nathanael Nerode  [EMAIL PROTECTED]
 
 (Instead, we front-load the flamewars and grudges in
 the interest of efficiency.) --Steve Lanagasek,
 http://lists.debian.org/debian-devel/2005/09/msg01056.html
 -
 To unsubscribe from this list: send the line unsubscribe netdev in
 the body of a message to [EMAIL PROTECTED]
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
 
 - End forwarded message -
--
maks
-
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 v2 00/13] 2.6.20 Chelsio T3 RDMA Driver

2006-12-02 Thread Steve Wise

Version 2 changes:

- Make code sparse endian clean
- Use IDRs for mapping QP and CQ IDs to structure pointers instead of arrays
- Clean up confusing bitfields
- Use random32() instead of local random function
- Use krefs to track endpoint reference counts
- Misc nits

-

The following series implements the Chelsio T3 iWARP/RDMA Driver to
be considered for inclusion in 2.6.20.  It depends on the Chelsio T3
Ethernet Driver which is also under review now for 2.6.20. See:

http://www.mail-archive.com/netdev@vger.kernel.org/msg26619.html

The patches are against 2.6.19.

This patch series can also be pulled from:

http://www.opengridcomputing.com/downloads/iw_cxgb3_patches_v2.tar.bz2

The Chelsio T3 Ethernet Driver patch can be pulled from:

http://service.chelsio.com/kernel.org/cxgb3.patch.bz2

A complete GIT kernel tree with all the T3 drivers can be pulled from:

git://staging.openfabrics.org/~swise/cxgb3.git

Thanks,

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


[PATCH v2 03/13] Provider Methods and Data Structures

2006-12-02 Thread Steve Wise

Provider methods to support the Linux RDMA verbs.

Signed-off-by: Steve Wise [EMAIL PROTECTED]
---

 drivers/infiniband/hw/cxgb3/iwch_provider.c | 1170 +++
 drivers/infiniband/hw/cxgb3/iwch_provider.h |  362 
 drivers/infiniband/hw/cxgb3/iwch_user.h |   68 ++
 3 files changed, 1600 insertions(+), 0 deletions(-)

diff --git a/drivers/infiniband/hw/cxgb3/iwch_provider.c 
b/drivers/infiniband/hw/cxgb3/iwch_provider.c
new file mode 100644
index 000..4bef081
--- /dev/null
+++ b/drivers/infiniband/hw/cxgb3/iwch_provider.c
@@ -0,0 +1,1170 @@
+/*
+ * 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/module.h
+#include linux/moduleparam.h
+#include linux/device.h
+#include linux/netdevice.h
+#include linux/etherdevice.h
+#include linux/delay.h
+#include linux/errno.h
+#include linux/list.h
+#include linux/spinlock.h
+#include linux/ethtool.h
+
+#include asm/io.h
+#include asm/irq.h
+#include asm/byteorder.h
+
+#include rdma/iw_cm.h
+#include rdma/ib_verbs.h
+#include rdma/ib_smi.h
+#include rdma/ib_user_verbs.h
+
+#include cxio_hal.h
+#include iwch.h
+#include iwch_provider.h
+#include iwch_cm.h
+#include iwch_user.h
+
+static int iwch_modify_port(struct ib_device *ibdev,
+   u8 port, int port_modify_mask,
+   struct ib_port_modify *props)
+{
+   return -ENOSYS;
+}
+
+static struct ib_ah *iwch_ah_create(struct ib_pd *pd,
+   struct ib_ah_attr *ah_attr)
+{
+   return ERR_PTR(-ENOSYS);
+}
+
+static int iwch_ah_destroy(struct ib_ah *ah)
+{
+   return -ENOSYS;
+}
+
+static int iwch_multicast_attach(struct ib_qp *ibqp, union ib_gid *gid, u16 
lid)
+{
+   return -ENOSYS;
+}
+
+static int iwch_multicast_detach(struct ib_qp *ibqp, union ib_gid *gid, u16 
lid)
+{
+   return -ENOSYS;
+}
+
+static int iwch_process_mad(struct ib_device *ibdev,
+   int mad_flags,
+   u8 port_num,
+   struct ib_wc *in_wc,
+   struct ib_grh *in_grh,
+   struct ib_mad *in_mad, struct ib_mad *out_mad)
+{
+   return -ENOSYS;
+}
+
+static int iwch_dealloc_ucontext(struct ib_ucontext *context)
+{
+   struct iwch_dev *rhp = to_iwch_dev(context-device);
+   struct iwch_ucontext *ucontext = to_iwch_ucontext(context);
+   PDBG(%s context %p\n, __FUNCTION__, context);
+   cxio_release_ucontext(rhp-rdev, ucontext-uctx);
+   kfree(ucontext);
+   return 0;
+}
+
+static struct ib_ucontext *iwch_alloc_ucontext(struct ib_device *ibdev,
+   struct ib_udata *udata)
+{
+   struct iwch_ucontext *context;
+   struct iwch_dev *rhp = to_iwch_dev(ibdev);
+
+   PDBG(%s ibdev %p\n, __FUNCTION__, ibdev);
+   context = kmalloc(sizeof(*context), GFP_KERNEL);
+   if (!context)
+   return ERR_PTR(-ENOMEM);
+   cxio_init_ucontext(rhp-rdev, context-uctx);
+   INIT_LIST_HEAD(context-mmaps);
+   return context-ibucontext;
+}
+
+static int iwch_destroy_cq(struct ib_cq *ib_cq)
+{
+   struct iwch_cq *chp;
+
+   PDBG(%s ib_cq %p\n, __FUNCTION__, ib_cq);
+   chp = to_iwch_cq(ib_cq);
+
+   remove_handle(chp-rhp, chp-rhp-cqidr, chp-cq.cqid);
+   atomic_dec(chp-refcnt);
+   wait_event(chp-wait, !atomic_read(chp-refcnt));
+
+   cxio_destroy_cq(chp-rhp-rdev, chp-cq);
+   kfree(chp);
+   return 0;
+}
+
+static struct ib_cq 

[PATCH v2 07/13] Async Event Handler

2006-12-02 Thread Steve Wise

Code to handle async events coming from the T3 RDMA Core.

Signed-off-by: Steve Wise [EMAIL PROTECTED]
---

 drivers/infiniband/hw/cxgb3/iwch_ev.c |  228 +
 1 files changed, 228 insertions(+), 0 deletions(-)

diff --git a/drivers/infiniband/hw/cxgb3/iwch_ev.c 
b/drivers/infiniband/hw/cxgb3/iwch_ev.c
new file mode 100644
index 000..bf767b2
--- /dev/null
+++ b/drivers/infiniband/hw/cxgb3/iwch_ev.c
@@ -0,0 +1,228 @@
+/*
+ * 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/slab.h
+#include linux/mman.h
+#include net/sock.h
+#include iwch_provider.h
+#include iwch.h
+#include iwch_cm.h
+#include cxio_hal.h
+#include cxio_wr.h
+
+static void post_qp_event(struct iwch_dev *rnicp, struct iwch_cq *chp,
+ struct respQ_msg_t *rsp_msg,
+ enum ib_event_type ib_event, 
+ int send_term)
+{
+   struct ib_event event;
+   struct iwch_qp_attributes attrs;
+   struct iwch_qp *qhp;
+
+   printk(KERN_ERR %s - AE qpid 0x%x opcode %d status 0x%x 
+  type %d wrid.hi 0x%x wrid.lo 0x%x \n, __FUNCTION__, 
+  CQE_QPID(rsp_msg-cqe), CQE_OPCODE(rsp_msg-cqe), 
+  CQE_STATUS(rsp_msg-cqe), CQE_TYPE(rsp_msg-cqe),
+  CQE_WRID_HI(rsp_msg-cqe), CQE_WRID_LOW(rsp_msg-cqe));
+
+   spin_lock(rnicp-lock);
+   qhp = get_qhp(rnicp, CQE_QPID(rsp_msg-cqe));
+
+   if (!qhp) {
+   printk(KERN_ERR %s unaffiliated error 0x%x qpid 0x%x\n, 
+  __FUNCTION__, CQE_STATUS(rsp_msg-cqe), 
+  CQE_QPID(rsp_msg-cqe));
+   spin_unlock(rnicp-lock);
+   return;
+   }
+
+   if ((qhp-attr.state == IWCH_QP_STATE_ERROR) ||
+   (qhp-attr.state == IWCH_QP_STATE_TERMINATE)) {
+   PDBG(%s AE received after RTS - 
+qp state %d qpid 0x%x status 0x%x\n, __FUNCTION__, 
+qhp-attr.state, qhp-wq.qpid, CQE_STATUS(rsp_msg-cqe));
+   spin_unlock(rnicp-lock);
+   return;
+   }
+
+   atomic_inc(qhp-refcnt);
+   spin_unlock(rnicp-lock);
+
+   event.event = ib_event;
+   event.device = chp-ibcq.device;
+   if (ib_event == IB_EVENT_CQ_ERR)
+   event.element.cq = chp-ibcq;
+   else 
+   event.element.qp = qhp-ibqp;
+
+   if (qhp-ibqp.event_handler)
+   (*qhp-ibqp.event_handler)(event, qhp-ibqp.qp_context);
+
+   attrs.next_state = IWCH_QP_STATE_TERMINATE;
+   if (send_term  (qhp-attr.state == IWCH_QP_STATE_RTS)  
+   !iwch_modify_qp(qhp-rhp, qhp, IWCH_QP_ATTR_NEXT_STATE, attrs, 1))
+   iwch_post_terminate(qhp, rsp_msg);
+
+   if (atomic_dec_and_test(qhp-refcnt))
+   wake_up(qhp-wait);
+}
+
+void iwch_ev_dispatch(struct cxio_rdev *rdev_p, struct sk_buff *skb)
+{
+   struct iwch_dev *rnicp;
+   struct respQ_msg_t *rsp_msg = (struct respQ_msg_t *) skb-data;
+   struct iwch_cq *chp;
+   struct iwch_qp *qhp;
+   u32 cqid = RSPQ_CQID(rsp_msg);
+
+   rnicp = (struct iwch_dev *) rdev_p-ulp;
+   spin_lock(rnicp-lock);
+   chp = get_chp(rnicp, cqid);
+   qhp = get_qhp(rnicp, CQE_QPID(rsp_msg-cqe));
+   if (!chp || !qhp) {
+   printk(KERN_ERR MOD BAD AE cqid 0x%x qpid 0x%x opcode %d 
+  status 0x%x type %d wrid.hi 0x%x wrid.lo 0x%x \n, 
+  cqid, CQE_QPID(rsp_msg-cqe), 
+  

[PATCH v2 01/13] Linux RDMA Core Changes

2006-12-02 Thread Steve Wise

Support provider-specific data in ib_uverbs_cmd_req_notify_cq().
The Chelsio iwarp provider library needs to pass information to the
kernel verb for re-arming the CQ.

Signed-off-by: Steve Wise [EMAIL PROTECTED]
---

 drivers/infiniband/core/uverbs_cmd.c  |9 +++--
 drivers/infiniband/hw/amso1100/c2.h   |2 +-
 drivers/infiniband/hw/amso1100/c2_cq.c|3 ++-
 drivers/infiniband/hw/ehca/ehca_iverbs.h  |3 ++-
 drivers/infiniband/hw/ehca/ehca_reqs.c|3 ++-
 drivers/infiniband/hw/ipath/ipath_cq.c|4 +++-
 drivers/infiniband/hw/ipath/ipath_verbs.h |3 ++-
 drivers/infiniband/hw/mthca/mthca_cq.c|6 --
 drivers/infiniband/hw/mthca/mthca_dev.h   |4 ++--
 include/rdma/ib_verbs.h   |5 +++--
 10 files changed, 28 insertions(+), 14 deletions(-)

diff --git a/drivers/infiniband/core/uverbs_cmd.c 
b/drivers/infiniband/core/uverbs_cmd.c
index 743247e..5dd1de9 100644
--- a/drivers/infiniband/core/uverbs_cmd.c
+++ b/drivers/infiniband/core/uverbs_cmd.c
@@ -959,6 +959,7 @@ ssize_t ib_uverbs_req_notify_cq(struct i
int out_len)
 {
struct ib_uverbs_req_notify_cq cmd;
+   struct ib_udata   udata;
struct ib_cq  *cq;
 
if (copy_from_user(cmd, buf, sizeof cmd))
@@ -968,8 +969,12 @@ ssize_t ib_uverbs_req_notify_cq(struct i
if (!cq)
return -EINVAL;
 
-   ib_req_notify_cq(cq, cmd.solicited_only ?
-IB_CQ_SOLICITED : IB_CQ_NEXT_COMP);
+   INIT_UDATA(udata, buf + sizeof cmd, 0,
+  in_len - sizeof cmd, 0); 
+
+   cq-device-req_notify_cq(cq, cmd.solicited_only ?
+ IB_CQ_SOLICITED : IB_CQ_NEXT_COMP,
+ udata);
 
put_cq_read(cq);
 
diff --git a/drivers/infiniband/hw/amso1100/c2.h 
b/drivers/infiniband/hw/amso1100/c2.h
index 1b17dcd..716f9dc 100644
--- a/drivers/infiniband/hw/amso1100/c2.h
+++ b/drivers/infiniband/hw/amso1100/c2.h
@@ -519,7 +519,7 @@ extern void c2_free_cq(struct c2_dev *c2
 extern void c2_cq_event(struct c2_dev *c2dev, u32 mq_index);
 extern void c2_cq_clean(struct c2_dev *c2dev, struct c2_qp *qp, u32 mq_index);
 extern int c2_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc 
*entry);
-extern int c2_arm_cq(struct ib_cq *ibcq, enum ib_cq_notify notify);
+extern int c2_arm_cq(struct ib_cq *ibcq, enum ib_cq_notify notify, struct 
ib_udata *udata);
 
 /* CM */
 extern int c2_llp_connect(struct iw_cm_id *cm_id,
diff --git a/drivers/infiniband/hw/amso1100/c2_cq.c 
b/drivers/infiniband/hw/amso1100/c2_cq.c
index 05c9154..7ce8bca 100644
--- a/drivers/infiniband/hw/amso1100/c2_cq.c
+++ b/drivers/infiniband/hw/amso1100/c2_cq.c
@@ -217,7 +217,8 @@ int c2_poll_cq(struct ib_cq *ibcq, int n
return npolled;
 }
 
-int c2_arm_cq(struct ib_cq *ibcq, enum ib_cq_notify notify)
+int c2_arm_cq(struct ib_cq *ibcq, enum ib_cq_notify notify,
+ struct ib_udata *udata)
 {
struct c2_mq_shared __iomem *shared;
struct c2_cq *cq;
diff --git a/drivers/infiniband/hw/ehca/ehca_iverbs.h 
b/drivers/infiniband/hw/ehca/ehca_iverbs.h
index 3720e30..566b30c 100644
--- a/drivers/infiniband/hw/ehca/ehca_iverbs.h
+++ b/drivers/infiniband/hw/ehca/ehca_iverbs.h
@@ -135,7 +135,8 @@ int ehca_poll_cq(struct ib_cq *cq, int n
 
 int ehca_peek_cq(struct ib_cq *cq, int wc_cnt);
 
-int ehca_req_notify_cq(struct ib_cq *cq, enum ib_cq_notify cq_notify);
+int ehca_req_notify_cq(struct ib_cq *cq, enum ib_cq_notify cq_notify,
+  struct ib_udata *udata);
 
 struct ib_qp *ehca_create_qp(struct ib_pd *pd,
 struct ib_qp_init_attr *init_attr,
diff --git a/drivers/infiniband/hw/ehca/ehca_reqs.c 
b/drivers/infiniband/hw/ehca/ehca_reqs.c
index b46bda1..3ed6992 100644
--- a/drivers/infiniband/hw/ehca/ehca_reqs.c
+++ b/drivers/infiniband/hw/ehca/ehca_reqs.c
@@ -634,7 +634,8 @@ poll_cq_exit0:
return ret;
 }
 
-int ehca_req_notify_cq(struct ib_cq *cq, enum ib_cq_notify cq_notify)
+int ehca_req_notify_cq(struct ib_cq *cq, enum ib_cq_notify cq_notify,
+  struct ib_udata *udata)
 {
struct ehca_cq *my_cq = container_of(cq, struct ehca_cq, ib_cq);
 
diff --git a/drivers/infiniband/hw/ipath/ipath_cq.c 
b/drivers/infiniband/hw/ipath/ipath_cq.c
index 87462e0..27ba4db 100644
--- a/drivers/infiniband/hw/ipath/ipath_cq.c
+++ b/drivers/infiniband/hw/ipath/ipath_cq.c
@@ -307,13 +307,15 @@ int ipath_destroy_cq(struct ib_cq *ibcq)
  * ipath_req_notify_cq - change the notification type for a completion queue
  * @ibcq: the completion queue
  * @notify: the type of notification to request
+ * @udata: user data 
  *
  * Returns 0 for success.
  *
  * This may be called from interrupt context.  Also called by
  * ib_req_notify_cq() in the generic verbs code.
  */
-int ipath_req_notify_cq(struct ib_cq *ibcq, enum ib_cq_notify notify)
+int ipath_req_notify_cq(struct ib_cq 

[PATCH v2 02/13] Device Discovery and ULLD Linkage

2006-12-02 Thread Steve Wise

Code to discover all the T3 devices and register them 
with the T3 RDMA Core and the Linux RDMA Core.

Signed-off-by: Steve Wise [EMAIL PROTECTED]
---

 drivers/infiniband/hw/cxgb3/iwch.c |  189 
 drivers/infiniband/hw/cxgb3/iwch.h |  175 +
 2 files changed, 364 insertions(+), 0 deletions(-)

diff --git a/drivers/infiniband/hw/cxgb3/iwch.c 
b/drivers/infiniband/hw/cxgb3/iwch.c
new file mode 100644
index 000..acbe449
--- /dev/null
+++ b/drivers/infiniband/hw/cxgb3/iwch.c
@@ -0,0 +1,189 @@
+/*
+ * 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/module.h
+#include linux/moduleparam.h
+
+#include rdma/ib_verbs.h
+
+#include cxgb3_offload.h
+#include iwch_provider.h
+#include iwch_user.h
+#include iwch.h
+#include iwch_cm.h
+
+#define DRV_VERSION 1.1
+
+MODULE_AUTHOR(Boyd Faulkner, Steve Wise);
+MODULE_DESCRIPTION(Chelsio T3 RDMA Driver);
+MODULE_LICENSE(Dual BSD/GPL);
+MODULE_VERSION(DRV_VERSION);
+
+cxgb3_cpl_handler_func t3c_handlers[NUM_CPL_CMDS];
+
+static void open_rnic_dev(struct t3cdev *);
+static void close_rnic_dev(struct t3cdev *);
+
+struct cxgb3_client t3c_client = {
+   .name = iw_cxgb3,
+   .add = open_rnic_dev,
+   .remove = close_rnic_dev,
+   .handlers = t3c_handlers,
+   .redirect = iwch_ep_redirect
+};
+
+static LIST_HEAD(dev_list);
+static DEFINE_MUTEX(dev_mutex);
+
+static void rnic_init(struct iwch_dev *rnicp)
+{
+   PDBG(%s iwch_dev %p\n, __FUNCTION__,  rnicp);
+   idr_init(rnicp-cqidr);
+   idr_init(rnicp-qpidr);
+   idr_init(rnicp-mmidr);
+   spin_lock_init(rnicp-lock);
+
+   rnicp-attr.vendor_id = 0x168;
+   rnicp-attr.vendor_part_id = 7;
+   rnicp-attr.max_qps = T3_MAX_NUM_QP - 32;
+   rnicp-attr.max_wrs = (1UL  24) - 1;
+   rnicp-attr.max_sge_per_wr = T3_MAX_SGE;
+   rnicp-attr.max_sge_per_rdma_write_wr = T3_MAX_SGE;
+   rnicp-attr.max_cqs = T3_MAX_NUM_CQ - 1;
+   rnicp-attr.max_cqes_per_cq = (1UL  24) - 1;
+   rnicp-attr.max_mem_regs = cxio_num_stags(rnicp-rdev);
+   rnicp-attr.max_phys_buf_entries = T3_MAX_PBL_SIZE;
+   rnicp-attr.max_pds = T3_MAX_NUM_PD - 1;
+   rnicp-attr.mem_pgsizes_bitmask = 0x7FFF;   /* 4KB-128MB */
+   rnicp-attr.can_resize_wq = 0;
+   rnicp-attr.max_rdma_reads_per_qp = 8;
+   rnicp-attr.max_rdma_read_resources =
+   rnicp-attr.max_rdma_reads_per_qp * rnicp-attr.max_qps;
+   rnicp-attr.max_rdma_read_qp_depth = 8; /* IRD */
+   rnicp-attr.max_rdma_read_depth =
+   rnicp-attr.max_rdma_read_qp_depth * rnicp-attr.max_qps;
+   rnicp-attr.rq_overflow_handled = 0;
+   rnicp-attr.can_modify_ird = 0;
+   rnicp-attr.can_modify_ord = 0;
+   rnicp-attr.max_mem_windows = rnicp-attr.max_mem_regs - 1;
+   rnicp-attr.stag0_value = 1;
+   rnicp-attr.zbva_support = 1;
+   rnicp-attr.local_invalidate_fence = 1;
+   rnicp-attr.cq_overflow_detection = 1;
+   return;
+}
+
+static void open_rnic_dev(struct t3cdev *tdev)
+{
+   struct iwch_dev *rnicp;
+   static int vers_printed;
+
+   PDBG(%s t3cdev %p\n, __FUNCTION__,  tdev);
+   if (!vers_printed++) 
+   printk(KERN_INFO MOD Chelsio T3 RDMA Driver - version %s\n,
+  DRV_VERSION);
+   rnicp = (struct iwch_dev *)ib_alloc_device(sizeof(*rnicp));
+   if (!rnicp) {
+   printk(KERN_ERR MOD Cannot allocate ib device\n);
+   return;
+   }
+   rnicp-rdev.ulp = 

[PATCH v2 09/13] Core WQE/CQE Types

2006-12-02 Thread Steve Wise

T3 WQE and CQE structures, defines, etc...

Signed-off-by: Steve Wise [EMAIL PROTECTED]
---

 drivers/infiniband/hw/cxgb3/core/cxio_wr.h |  685 
 1 files changed, 685 insertions(+), 0 deletions(-)

diff --git a/drivers/infiniband/hw/cxgb3/core/cxio_wr.h 
b/drivers/infiniband/hw/cxgb3/core/cxio_wr.h
new file mode 100644
index 000..45870be
--- /dev/null
+++ b/drivers/infiniband/hw/cxgb3/core/cxio_wr.h
@@ -0,0 +1,685 @@
+/*
+ * 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.
+ */
+#ifndef __CXIO_WR_H__
+#define __CXIO_WR_H__
+
+#include asm/io.h
+#include linux/pci.h
+#include linux/timer.h
+#include firmware_exports.h
+
+#define T3_MAX_SGE  4
+
+#define Q_EMPTY(rptr,wptr) ((rptr)==(wptr))
+#define Q_FULL(rptr,wptr,size_log2)  ( (((wptr)-(rptr))(size_log2))  \
+  ((rptr)!=(wptr)) )
+#define Q_GENBIT(ptr,size_log2) (!(((ptr)size_log2)0x1))
+#define Q_FREECNT(rptr,wptr,size_log2) ((1ULsize_log2)-((wptr)-(rptr)))
+#define Q_COUNT(rptr,wptr) ((wptr)-(rptr))
+#define Q_PTR2IDX(ptr,size_log2) (ptr  ((1ULsize_log2)-1))
+
+static inline void ring_doorbell(void __iomem *doorbell, u32 qpid) 
+{
+   writel(((131) | qpid), doorbell);
+}
+
+#define SEQ32_GE(x,y) (!( (((u32) (x)) - ((u32) (y)))  0x8000 ))
+
+enum t3_wr_flags {
+   T3_COMPLETION_FLAG = 0x01,
+   T3_NOTIFY_FLAG = 0x02,
+   T3_SOLICITED_EVENT_FLAG = 0x04,
+   T3_READ_FENCE_FLAG = 0x08,
+   T3_LOCAL_FENCE_FLAG = 0x10
+} __attribute__ ((packed));
+
+enum t3_wr_opcode {
+   T3_WR_BP = FW_WROPCODE_RI_BYPASS,
+   T3_WR_SEND = FW_WROPCODE_RI_SEND,
+   T3_WR_WRITE = FW_WROPCODE_RI_RDMA_WRITE,
+   T3_WR_READ = FW_WROPCODE_RI_RDMA_READ,
+   T3_WR_INV_STAG = FW_WROPCODE_RI_LOCAL_INV,
+   T3_WR_BIND = FW_WROPCODE_RI_BIND_MW,
+   T3_WR_RCV = FW_WROPCODE_RI_RECEIVE,
+   T3_WR_INIT = FW_WROPCODE_RI_RDMA_INIT,
+   T3_WR_QP_MOD = FW_WROPCODE_RI_MODIFY_QP
+} __attribute__ ((packed));
+
+enum t3_rdma_opcode {
+   T3_RDMA_WRITE,  /* IETF RDMAP v1.0 ... */
+   T3_READ_REQ,
+   T3_READ_RESP,
+   T3_SEND,
+   T3_SEND_WITH_INV,
+   T3_SEND_WITH_SE,
+   T3_SEND_WITH_SE_INV,
+   T3_TERMINATE,
+   T3_RDMA_INIT,   /* CHELSIO RI specific ... */
+   T3_BIND_MW,
+   T3_FAST_REGISTER,
+   T3_LOCAL_INV,
+   T3_QP_MOD,
+   T3_BYPASS
+} __attribute__ ((packed));
+
+static inline enum t3_rdma_opcode wr2opcode(enum t3_wr_opcode wrop)
+{
+   switch (wrop) {
+   case T3_WR_BP: return T3_BYPASS;
+   case T3_WR_SEND: return T3_SEND;
+   case T3_WR_WRITE: return T3_RDMA_WRITE;
+   case T3_WR_READ: return T3_READ_REQ;
+   case T3_WR_INV_STAG: return T3_LOCAL_INV;
+   case T3_WR_BIND: return T3_BIND_MW;
+   case T3_WR_INIT: return T3_RDMA_INIT;
+   case T3_WR_QP_MOD: return T3_QP_MOD;
+   default: break;
+   }
+   return -1;
+}
+
+
+/* Work request id */
+union t3_wrid {
+   struct {
+   u32 hi;
+   u32 low;
+   } id0;
+   u64 id1;
+};
+
+#define WRID(wrid) (wrid.id1)
+#define WRID_GEN(wrid) (wrid.id0.wr_gen)
+#define WRID_IDX(wrid) (wrid.id0.wr_idx)
+#define WRID_LO(wrid)  (wrid.id0.wr_lo)
+
+struct fw_riwrh {
+   __be32 op_seop_flags;
+   __be32 gen_tid_len;
+};
+
+#define S_FW_RIWR_OP   24
+#define M_FW_RIWR_OP   0xff
+#define V_FW_RIWR_OP(x)  

[PATCH v2 10/13] Core HAL

2006-12-02 Thread Steve Wise

The RDMA Core interfaces with the T3 HW and ULLD providing a low level
RDMA interface.

Signed-off-by: Steve Wise [EMAIL PROTECTED]
---

 drivers/infiniband/hw/cxgb3/core/cxio_hal.c | 1302 +++
 drivers/infiniband/hw/cxgb3/core/cxio_hal.h |  201 
 2 files changed, 1503 insertions(+), 0 deletions(-)

diff --git a/drivers/infiniband/hw/cxgb3/core/cxio_hal.c 
b/drivers/infiniband/hw/cxgb3/core/cxio_hal.c
new file mode 100644
index 000..367c834
--- /dev/null
+++ b/drivers/infiniband/hw/cxgb3/core/cxio_hal.c
@@ -0,0 +1,1302 @@
+/*
+ * 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 asm/semaphore.h
+#include asm/delay.h
+
+#include linux/netdevice.h
+#include linux/sched.h
+#include linux/spinlock.h
+#include linux/pci.h
+
+#include cxio_resource.h
+#include cxio_hal.h
+#include cxgb3_offload.h
+#include sge_defs.h
+
+static struct cxio_rdev *rdev_tbl[T3_MAX_NUM_RNIC];
+static cxio_hal_ev_callback_func_t cxio_ev_cb = NULL;
+
+static inline struct cxio_rdev *cxio_hal_find_rdev_by_name(char *dev_name)
+{
+   int i;
+   for (i = 0; i  T3_MAX_NUM_RNIC; i++)
+   if (rdev_tbl[i])
+   if (!strcmp(rdev_tbl[i]-dev_name, dev_name))
+   return rdev_tbl[i];
+   return NULL;
+}
+
+static inline struct cxio_rdev *cxio_hal_find_rdev_by_t3cdev(struct t3cdev
+*tdev)
+{
+   int i;
+   for (i = 0; i  T3_MAX_NUM_RNIC; i++)
+   if (rdev_tbl[i])
+   if (rdev_tbl[i]-t3cdev_p == tdev)
+   return rdev_tbl[i];
+   return NULL;
+}
+
+static inline int cxio_hal_add_rdev(struct cxio_rdev *rdev_p)
+{
+   int i;
+   for (i = 0; i  T3_MAX_NUM_RNIC; i++)
+   if (!rdev_tbl[i]) {
+   rdev_tbl[i] = rdev_p;
+   break;
+   }
+   return (i == T3_MAX_NUM_RNIC);
+}
+
+static inline void cxio_hal_delete_rdev(struct cxio_rdev *rdev_p)
+{
+   int i;
+   for (i = 0; i  T3_MAX_NUM_RNIC; i++)
+   if (rdev_tbl[i] == rdev_p) {
+   rdev_tbl[i] = NULL;
+   break;
+   }
+}
+
+int cxio_hal_cq_op(struct cxio_rdev *rdev_p, struct t3_cq *cq, 
+  enum t3_cq_opcode op, u32 credit)
+{
+   int ret;
+   struct t3_cqe *cqe;
+   u32 rptr;
+
+   struct rdma_cq_op setup;
+   setup.id = cq-cqid;
+   setup.credits = (op == CQ_CREDIT_UPDATE) ? credit : 0;
+   setup.op = op;
+   ret = rdev_p-t3cdev_p-ctl(rdev_p-t3cdev_p, RDMA_CQ_OP, setup);
+
+   if ((ret  0) || (op == CQ_CREDIT_UPDATE)) 
+   return ret;
+
+   /*
+* If the rearm returned an index other than our current index,
+* then there might be CQE's in flight (being DMA'd).  We must wait
+* here for them to complete or the consumer can miss a notification.
+*/
+   if (Q_PTR2IDX((cq-rptr), cq-size_log2) != ret) {
+   int i=0;
+
+   rptr = cq-rptr;
+
+   /* 
+* Keep the generation correct by bumping rptr until it
+* matches the index returned by the rearm - 1.
+*/
+   while (Q_PTR2IDX((rptr+1), cq-size_log2) != ret)
+   rptr++;
+
+   /* 
+* Now rptr is the index for the (last) cqe that was 
+* in-flight at the time the HW rearmed the CQ.  We 

[PATCH v2 13/13] Kconfig/Makefile

2006-12-02 Thread Steve Wise

Signed-off-by: Steve Wise [EMAIL PROTECTED]
---

 drivers/infiniband/Kconfig  |1 +
 drivers/infiniband/Makefile |1 +
 drivers/infiniband/hw/cxgb3/Kconfig |   27 +++
 drivers/infiniband/hw/cxgb3/Makefile|   12 
 drivers/infiniband/hw/cxgb3/locking.txt |   25 +
 5 files changed, 66 insertions(+), 0 deletions(-)

diff --git a/drivers/infiniband/Kconfig b/drivers/infiniband/Kconfig
index 59b3932..06453ab 100644
--- a/drivers/infiniband/Kconfig
+++ b/drivers/infiniband/Kconfig
@@ -38,6 +38,7 @@ source drivers/infiniband/hw/mthca/Kcon
 source drivers/infiniband/hw/ipath/Kconfig
 source drivers/infiniband/hw/ehca/Kconfig
 source drivers/infiniband/hw/amso1100/Kconfig
+source drivers/infiniband/hw/cxgb3/Kconfig
 
 source drivers/infiniband/ulp/ipoib/Kconfig
 
diff --git a/drivers/infiniband/Makefile b/drivers/infiniband/Makefile
index 570b30a..69bdd55 100644
--- a/drivers/infiniband/Makefile
+++ b/drivers/infiniband/Makefile
@@ -3,6 +3,7 @@ obj-$(CONFIG_INFINIBAND_MTHCA)  += hw/mt
 obj-$(CONFIG_INFINIBAND_IPATH) += hw/ipath/
 obj-$(CONFIG_INFINIBAND_EHCA)  += hw/ehca/
 obj-$(CONFIG_INFINIBAND_AMSO1100)  += hw/amso1100/
+obj-$(CONFIG_INFINIBAND_CXGB3) += hw/cxgb3/
 obj-$(CONFIG_INFINIBAND_IPOIB) += ulp/ipoib/
 obj-$(CONFIG_INFINIBAND_SRP)   += ulp/srp/
 obj-$(CONFIG_INFINIBAND_ISER)  += ulp/iser/
diff --git a/drivers/infiniband/hw/cxgb3/Kconfig 
b/drivers/infiniband/hw/cxgb3/Kconfig
new file mode 100644
index 000..84f0f6e
--- /dev/null
+++ b/drivers/infiniband/hw/cxgb3/Kconfig
@@ -0,0 +1,27 @@
+config INFINIBAND_CXGB3
+   tristate Chelsio RDMA Driver
+   depends on CHELSIO_T3  INFINIBAND
+   select GENERIC_ALLOCATOR
+   ---help---
+ This is an iWARP/RDMA driver for the Chelsio T3 1GbE and
+ 10GbE 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 iw_cxgb3.
+
+config INFINIBAND_CXGB3_DEBUG
+   bool Verbose debugging output
+   depends on INFINIBAND_CXGB3
+   default n
+   ---help---
+ This option causes the Chelsio RDMA driver to produce copious
+ amounts of debug messages.  Select this if you are developing
+ the driver or trying to diagnose a problem.
diff --git a/drivers/infiniband/hw/cxgb3/Makefile 
b/drivers/infiniband/hw/cxgb3/Makefile
new file mode 100644
index 000..0df2b3d
--- /dev/null
+++ b/drivers/infiniband/hw/cxgb3/Makefile
@@ -0,0 +1,12 @@
+EXTRA_CFLAGS += -I$(TOPDIR)/drivers/net/cxgb3 \
+   -I$(TOPDIR)/drivers/infiniband/hw/cxgb3/core 
+
+obj-$(CONFIG_INFINIBAND_CXGB3) += iw_cxgb3.o
+
+iw_cxgb3-y :=  iwch_cm.o iwch_ev.o iwch_cq.o iwch_qp.o iwch_mem.o \
+  iwch_provider.o iwch.o core/cxio_hal.o core/cxio_resource.o
+
+ifdef CONFIG_INFINIBAND_CXGB3_DEBUG
+EXTRA_CFLAGS += -DDEBUG -O1 -g 
+iw_cxgb3-y += core/cxio_dbg.o
+endif
diff --git a/drivers/infiniband/hw/cxgb3/locking.txt 
b/drivers/infiniband/hw/cxgb3/locking.txt
new file mode 100644
index 000..e5e9991
--- /dev/null
+++ b/drivers/infiniband/hw/cxgb3/locking.txt
@@ -0,0 +1,25 @@
+cq lock:
+   - spin lock
+   - used to synchronize the t3_cq
+
+qp lock:
+   - spin lock
+   - used to synchronize updates to the qp state, attrs, and the t3_wq.
+   - touched on interrupt and process context
+   
+rnicp lock:
+   - spin lock
+   - touched on interrupt and process context
+   - used around lookup tables mapping CQID and QPID to a structure.
+   - used also to bump the refcnt atomically with the lookup.
+
+poll:
+   lock+disable on cq lock
+   lock qp lock for each cqe that is polled around the call
+   to cxio_poll_cq().
+   
+post: 
+   lock+disable qp lock
+
+global mutex iwch_mutex:
+   used to maintain global device list.
-
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 v2 08/13] Memory Registration

2006-12-02 Thread Steve Wise

Functions to register memory regions.

Signed-off-by: Steve Wise [EMAIL PROTECTED]
---

 drivers/infiniband/hw/cxgb3/iwch_mem.c |  170 
 1 files changed, 170 insertions(+), 0 deletions(-)

diff --git a/drivers/infiniband/hw/cxgb3/iwch_mem.c 
b/drivers/infiniband/hw/cxgb3/iwch_mem.c
new file mode 100644
index 000..774d11e
--- /dev/null
+++ b/drivers/infiniband/hw/cxgb3/iwch_mem.c
@@ -0,0 +1,170 @@
+/*
+ * 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 asm/byteorder.h
+
+#include rdma/iw_cm.h
+#include rdma/ib_verbs.h
+
+#include cxio_hal.h
+#include iwch.h
+#include iwch_provider.h
+
+int iwch_register_mem(struct iwch_dev *rhp, struct iwch_pd *php,
+   struct iwch_mr *mhp,
+   int shift,
+   __be64 *page_list)
+{
+   u32 stag;
+   u32 mmid;
+
+
+   if (cxio_register_phys_mem(rhp-rdev,
+  stag, mhp-attr.pdid,
+  mhp-attr.perms,
+  mhp-attr.zbva,
+  mhp-attr.va_fbo,
+  mhp-attr.len,
+  shift-12,
+  page_list,
+  mhp-attr.pbl_size, mhp-attr.pbl_addr))
+   return -ENOMEM;
+   mhp-attr.state = 1;
+   mhp-attr.stag = stag;
+   mmid = stag  8;
+   mhp-ibmr.rkey = mhp-ibmr.lkey = stag;
+   insert_handle(rhp, rhp-mmidr, mhp, mmid); 
+   PDBG(%s mmid 0x%x mhp %p\n, __FUNCTION__, mmid, mhp);
+   return 0;
+}
+
+int iwch_reregister_mem(struct iwch_dev *rhp, struct iwch_pd *php,
+   struct iwch_mr *mhp,
+   int shift,
+   __be64 *page_list,
+   int npages)
+{
+   u32 stag;
+   u32 mmid;
+
+
+   /* We could support this... */
+   if (npages  mhp-attr.pbl_size)
+   return -ENOMEM;
+
+   stag = mhp-attr.stag;
+   if (cxio_reregister_phys_mem(rhp-rdev,
+  stag, mhp-attr.pdid,
+  mhp-attr.perms,
+  mhp-attr.zbva,
+  mhp-attr.va_fbo,
+  mhp-attr.len,
+  shift-12,
+  page_list,
+  mhp-attr.pbl_size, mhp-attr.pbl_addr))
+   return -ENOMEM;
+   mhp-attr.state = 1;
+   mhp-attr.stag = stag;
+   mmid = stag  8;
+   mhp-ibmr.rkey = mhp-ibmr.lkey = stag;
+   insert_handle(rhp, rhp-mmidr, mhp, mmid); 
+   PDBG(%s mmid 0x%x mhp %p\n, __FUNCTION__, mmid, mhp);
+   return 0;
+}
+
+int build_phys_page_list(struct ib_phys_buf *buffer_list,
+   int num_phys_buf,
+   u64 *iova_start,
+   u64 *total_size,
+   int *npages,
+   int *shift,
+   __be64 **page_list)
+{
+   u64 mask;
+   int i, j, n;
+
+   mask = 0;
+   *total_size = 0;
+   for (i = 0; i  num_phys_buf; ++i) {
+   if (i != 0  buffer_list[i].addr  ~PAGE_MASK)
+   

[PATCH v2 05/13] Queue Pairs

2006-12-02 Thread Steve Wise

Code to manipulate the QP.

Signed-off-by: Steve Wise [EMAIL PROTECTED]
---

 drivers/infiniband/hw/cxgb3/iwch_qp.c | 1007 +
 1 files changed, 1007 insertions(+), 0 deletions(-)

diff --git a/drivers/infiniband/hw/cxgb3/iwch_qp.c 
b/drivers/infiniband/hw/cxgb3/iwch_qp.c
new file mode 100644
index 000..9f6b251
--- /dev/null
+++ b/drivers/infiniband/hw/cxgb3/iwch_qp.c
@@ -0,0 +1,1007 @@
+/*
+ * 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 iwch_provider.h
+#include iwch.h
+#include iwch_cm.h
+#include cxio_hal.h
+
+#define NO_SUPPORT -1
+
+static inline int iwch_build_rdma_send(union t3_wr *wqe, struct ib_send_wr *wr,
+  u8 * flit_cnt)
+{
+   int i;
+   u32 plen;
+
+   switch (wr-opcode) {
+   case IB_WR_SEND:
+   case IB_WR_SEND_WITH_IMM:
+   if (wr-send_flags  IB_SEND_SOLICITED)
+   wqe-send.rdmaop = T3_SEND_WITH_SE;
+   else
+   wqe-send.rdmaop = T3_SEND;
+   wqe-send.rem_stag = 0;
+   break;
+#if 0  /* Not currently supported */
+   case TYPE_SEND_INVALIDATE:
+   case TYPE_SEND_INVALIDATE_IMMEDIATE:
+   wqe-send.rdmaop = T3_SEND_WITH_INV;
+   wqe-send.rem_stag = cpu_to_be32(wr-wr.rdma.rkey);
+   break;
+   case TYPE_SEND_SE_INVALIDATE:
+   wqe-send.rdmaop = T3_SEND_WITH_SE_INV;
+   wqe-send.rem_stag = cpu_to_be32(wr-wr.rdma.rkey);
+   break;
+#endif
+   default:
+   break;
+   }
+   if (wr-num_sge  T3_MAX_SGE)
+   return -EINVAL;
+   wqe-send.reserved[0] = 0;
+   wqe-send.reserved[1] = 0;
+   wqe-send.reserved[2] = 0;
+   if (wr-opcode == IB_WR_SEND_WITH_IMM) {
+   plen = 4;
+   wqe-send.sgl[0].stag = wr-imm_data;
+   wqe-send.sgl[0].len = __constant_cpu_to_be32(0);
+   wqe-send.num_sgle = __constant_cpu_to_be32(0);
+   *flit_cnt = 5;
+   } else {
+   plen = 0;
+   for (i = 0; i  wr-num_sge; i++) {
+   if ((plen + wr-sg_list[i].length)  plen) {
+   return -EMSGSIZE;
+   }
+   plen += wr-sg_list[i].length;
+   wqe-send.sgl[i].stag =
+   cpu_to_be32(wr-sg_list[i].lkey);
+   wqe-send.sgl[i].len =
+   cpu_to_be32(wr-sg_list[i].length);
+   wqe-send.sgl[i].to = cpu_to_be64(wr-sg_list[i].addr);
+   }
+   wqe-send.num_sgle = cpu_to_be32(wr-num_sge);
+   *flit_cnt = 4 + ((wr-num_sge)  1);
+   }
+   wqe-send.plen = cpu_to_be32(plen);
+   return 0;
+}
+
+static inline int iwch_build_rdma_write(union t3_wr *wqe, struct ib_send_wr 
*wr,
+   u8 *flit_cnt)
+{
+   int i;
+   u32 plen;
+   if (wr-num_sge  T3_MAX_SGE)
+   return -EINVAL;
+   wqe-write.rdmaop = T3_RDMA_WRITE;
+   wqe-write.reserved[0] = 0;
+   wqe-write.reserved[1] = 0;
+   wqe-write.reserved[2] = 0;
+   wqe-write.stag_sink = cpu_to_be32(wr-wr.rdma.rkey);
+   wqe-write.to_sink = cpu_to_be64(wr-wr.rdma.remote_addr);
+
+   if (wr-opcode == IB_WR_RDMA_WRITE_WITH_IMM) {
+   plen = 4;
+   wqe-write.sgl[0].stag = wr-imm_data;
+  

[PATCH v2 11/13] Core Resource Allocation

2006-12-02 Thread Steve Wise

Core functions to carve up adapter memory, stag, qp, and cq IDs.

Signed-off-by: Steve Wise [EMAIL PROTECTED]
---

 drivers/infiniband/hw/cxgb3/core/cxio_resource.c |  331 ++
 drivers/infiniband/hw/cxgb3/core/cxio_resource.h |   70 +
 2 files changed, 401 insertions(+), 0 deletions(-)

diff --git a/drivers/infiniband/hw/cxgb3/core/cxio_resource.c 
b/drivers/infiniband/hw/cxgb3/core/cxio_resource.c
new file mode 100644
index 000..444df15
--- /dev/null
+++ b/drivers/infiniband/hw/cxgb3/core/cxio_resource.c
@@ -0,0 +1,331 @@
+/*
+ * 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.
+ */
+/* Crude resource management */
+#include linux/kernel.h
+#include linux/random.h
+#include linux/slab.h
+#include linux/kfifo.h
+#include linux/spinlock.h
+#include linux/errno.h
+#include cxio_resource.h
+#include cxio_hal.h
+
+static struct kfifo *rhdl_fifo;
+static spinlock_t rhdl_fifo_lock;
+
+#define RANDOM_SIZE 16
+
+static int __cxio_init_resource_fifo(struct kfifo **fifo,
+  spinlock_t *fifo_lock,
+  u32 nr, u32 skip_low,
+  u32 skip_high,
+  int random)
+{
+   u32 i, j, entry = 0, idx;
+   u32 random_bytes;
+   u32 rarray[16];
+   spin_lock_init(fifo_lock);
+
+   *fifo = kfifo_alloc(nr * sizeof(u32), GFP_KERNEL, fifo_lock);
+   if (IS_ERR(*fifo))
+   return -ENOMEM;
+
+   for (i = 0; i  skip_low + skip_high; i++)
+   __kfifo_put(*fifo, (unsigned char *) entry, sizeof(u32));
+   if (random) {
+   j = 0;
+   random_bytes = random32();
+   for (i = 0; i  RANDOM_SIZE; i++)
+   rarray[i] = i + skip_low;
+   for (i = skip_low + RANDOM_SIZE; i  nr - skip_high; i++) {
+   if (j = RANDOM_SIZE) {
+   j = 0;
+   random_bytes = random32();
+   }
+   idx = (random_bytes  (j * 2))  0xF;
+   __kfifo_put(*fifo, 
+   (unsigned char *) rarray[idx],
+   sizeof(u32));
+   rarray[idx] = i;
+   j++;
+   }
+   for (i = 0; i  RANDOM_SIZE; i++)
+   __kfifo_put(*fifo, 
+   (unsigned char *) rarray[i],
+   sizeof(u32));
+   } else
+   for (i = skip_low; i  nr - skip_high; i++)
+   __kfifo_put(*fifo, (unsigned char *) i, sizeof(u32));
+
+   for (i = 0; i  skip_low + skip_high; i++)
+   kfifo_get(*fifo, (unsigned char *) entry, sizeof(u32));
+   return 0;
+}
+
+static int cxio_init_resource_fifo(struct kfifo **fifo, spinlock_t * fifo_lock,
+  u32 nr, u32 skip_low, u32 skip_high)
+{
+   return (__cxio_init_resource_fifo(fifo, fifo_lock, nr, skip_low, 
+ skip_high, 0));
+}
+
+static int cxio_init_resource_fifo_random(struct kfifo **fifo,
+  spinlock_t * fifo_lock,
+  u32 nr, u32 skip_low, u32 skip_high)
+{
+
+   return (__cxio_init_resource_fifo(fifo, fifo_lock, nr, skip_low, 
+ skip_high, 1));
+}
+
+static int cxio_init_qpid_fifo(struct cxio_rdev *rdev_p)
+{
+   u32 i;

[PATCH v2 06/13] Completion Queues

2006-12-02 Thread Steve Wise

Functions to manipulate CQs.

Signed-off-by: Steve Wise [EMAIL PROTECTED]
---

 drivers/infiniband/hw/cxgb3/iwch_cq.c |  231 +
 1 files changed, 231 insertions(+), 0 deletions(-)

diff --git a/drivers/infiniband/hw/cxgb3/iwch_cq.c 
b/drivers/infiniband/hw/cxgb3/iwch_cq.c
new file mode 100644
index 000..9d82df4
--- /dev/null
+++ b/drivers/infiniband/hw/cxgb3/iwch_cq.c
@@ -0,0 +1,231 @@
+/*
+ * 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 iwch_provider.h
+#include iwch.h
+
+/*
+ * Get one cq entry from cxio and map it to openib.
+ *
+ * Returns:
+ * 0   EMPTY;
+ * 1   cqe returned
+ * -EAGAIN caller must try again
+ * any other -errnofatal error
+ */
+int iwch_poll_cq_one(struct iwch_dev *rhp, struct iwch_cq *chp,
+struct ib_wc *wc)
+{
+   struct iwch_qp *qhp = NULL;
+   struct t3_cqe cqe, *rd_cqe;
+   struct t3_wq *wq;
+   u32 credit = 0;
+   u8 cqe_flushed;
+   u64 cookie;
+   int ret = 1;
+
+   rd_cqe = cxio_next_cqe(chp-cq);
+
+   if (!rd_cqe)
+   return 0;
+
+   qhp = get_qhp(rhp, CQE_QPID(*rd_cqe));
+   if (!qhp)
+   wq = NULL;
+   else {
+   spin_lock(qhp-lock);
+   wq = (qhp-wq);
+   }
+   ret = cxio_poll_cq(wq, (chp-cq), cqe, cqe_flushed, cookie,
+  credit);
+   if (t3a_device(chp-rhp)  credit) {
+   PDBG(%s updating %d cq credits on id %d\n, __FUNCTION__, 
+credit, chp-cq.cqid);
+   cxio_hal_cq_op(rhp-rdev, chp-cq, CQ_CREDIT_UPDATE, credit);
+   }
+
+   if (ret) {
+   ret = -EAGAIN;
+   goto out;
+   }
+   ret = 1;
+
+   wc-wr_id = cookie;
+   wc-qp_num = qhp-wq.qpid;
+   wc-vendor_err = CQE_STATUS(cqe);
+
+   PDBG(%s qpid 0x%x type %d opcode %d status 0x%x wrid hi 0x%x 
+lo 0x%x cookie 0x%llx\n, __FUNCTION__, 
+CQE_QPID(cqe), CQE_TYPE(cqe),
+CQE_OPCODE(cqe), CQE_STATUS(cqe), CQE_WRID_HI(cqe),
+CQE_WRID_LOW(cqe), cookie);
+
+   if (CQE_TYPE(cqe) == 0) {
+   if (!CQE_STATUS(cqe))
+   wc-byte_len = CQE_LEN(cqe);
+   else
+   wc-byte_len = 0;
+   wc-opcode = IB_WC_RECV;
+   } else {
+   switch (CQE_OPCODE(cqe)) {
+   case T3_RDMA_WRITE:
+   wc-opcode = IB_WC_RDMA_WRITE;
+   break;
+   case T3_READ_REQ:
+   wc-opcode = IB_WC_RDMA_READ;
+   wc-byte_len = CQE_LEN(cqe);
+   break;
+   case T3_SEND:
+   case T3_SEND_WITH_SE:
+   wc-opcode = IB_WC_SEND;
+   break;
+   case T3_BIND_MW:
+   wc-opcode = IB_WC_BIND_MW;
+   break;
+
+   /* these aren't supported yet */
+   case T3_SEND_WITH_INV:
+   case T3_SEND_WITH_SE_INV:
+   case T3_LOCAL_INV:
+   case T3_FAST_REGISTER:
+   default:
+   printk(KERN_ERR MOD Unexpected opcode %d 
+  in the CQE received for QPID=0x%0x\n, 
+  CQE_OPCODE(cqe), CQE_QPID(cqe));
+   ret = -EINVAL;
+  

Re: [PATCH v2 00/13] 2.6.20 Chelsio T3 RDMA Driver

2006-12-02 Thread Francois Romieu
Steve Wise [EMAIL PROTECTED] :
[...]
 Version 2 changes:
 
 - Make code sparse endian clean
 - Use IDRs for mapping QP and CQ IDs to structure pointers instead of arrays
 - Clean up confusing bitfields
 - Use random32() instead of local random function
 - Use krefs to track endpoint reference counts
 - Misc nits
 
 -
 
 The following series implements the Chelsio T3 iWARP/RDMA Driver to
 be considered for inclusion in 2.6.20.  It depends on the Chelsio T3
 Ethernet Driver which is also under review now for 2.6.20. See:

I understood that Stephen expressed some doubts regarding the inclusion
of TOE enabled features.

Was his point addressed ?

-- 
Ueimor
-
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/RFC] make MII and PHYLIB independent of NET_ETHERNET

2006-12-02 Thread Randy Dunlap
On Thu, 30 Nov 2006 06:10:14 -0500 Jeff Garzik wrote:

 ACK, but patch doesn't apply to #upstream

Does it work to patch -mm instead?  (below)

---
From: Randy Dunlap [EMAIL PROTECTED]

PHYLIB can be used by non-NET_ETHERNET (10/100 ethernet) devices;
e.g., GIANFAR (gigabit) uses it.

We also have USB ethernet devices trying to use MII
without NET_ETHERNET being enabled, so move MII outside of
NET_ETHERNET, along with PHYLIB.

They both still depend on NET  NETDEVICES.

Signed-off-by: Randy Dunlap [EMAIL PROTECTED]
---
 drivers/net/Kconfig |   16 
 drivers/net/phy/Kconfig |   21 +
 2 files changed, 13 insertions(+), 24 deletions(-)

--- linux-2.6.19-rc6-mm2.orig/drivers/net/Kconfig
+++ linux-2.6.19-rc6-mm2/drivers/net/Kconfig
@@ -145,6 +145,14 @@ config NET_SB1000
 
 source drivers/net/arcnet/Kconfig
 
+config MII
+   tristate Generic Media Independent Interface device support
+   depends on NET_ETHERNET
+   help
+ Most ethernet controllers have MII transceiver either as an external
+ or internal device.  It is safe to say Y or M here even if your
+ ethernet card lack MII.
+
 source drivers/net/phy/Kconfig
 
 #
@@ -180,14 +188,6 @@ config NET_ETHERNET
  kernel: saying N will just cause the configurator to skip all
  the questions about Ethernet network cards. If unsure, say N.
 
-config MII
-   tristate Generic Media Independent Interface device support
-   depends on NET_ETHERNET
-   help
- Most ethernet controllers have MII transceiver either as an external
- or internal device.  It is safe to say Y or M here even if your
- ethernet card lack MII.
-
 config MACB
tristate Atmel MACB support
depends on NET_ETHERNET  AVR32
--- linux-2.6.19-rc6-mm2.orig/drivers/net/phy/Kconfig
+++ linux-2.6.19-rc6-mm2/drivers/net/phy/Kconfig
@@ -2,69 +2,59 @@
 # PHY Layer Configuration
 #
 
-menu PHY device support
-
-config PHYLIB
+menuconfig PHYLIB
tristate PHY Device support and infrastructure
-   depends on NET_ETHERNET  (BROKEN || !S390)
+   depends on (BROKEN || !S390)
help
  Ethernet controllers are usually attached to PHY
  devices.  This option provides infrastructure for
  managing PHY devices.
 
+if PHYLIB
+
 comment MII PHY device drivers
-   depends on PHYLIB
 
 config MARVELL_PHY
tristate Drivers for Marvell PHYs
-   depends on PHYLIB
---help---
  Currently has a driver for the 88E1011S

 config DAVICOM_PHY
tristate Drivers for Davicom PHYs
-   depends on PHYLIB
---help---
  Currently supports dm9161e and dm9131
 
 config QSEMI_PHY
tristate Drivers for Quality Semiconductor PHYs
-   depends on PHYLIB
---help---
  Currently supports the qs6612
 
 config LXT_PHY
tristate Drivers for the Intel LXT PHYs
-   depends on PHYLIB
---help---
  Currently supports the lxt970, lxt971
 
 config CICADA_PHY
tristate Drivers for the Cicada PHYs
-   depends on PHYLIB
---help---
  Currently supports the cis8204
 config VITESSE_PHY
 tristate Drivers for the Vitesse PHYs
-depends on PHYLIB
 ---help---
   Currently supports the vsc8244
 
 config SMSC_PHY
tristate Drivers for SMSC PHYs
-   depends on PHYLIB
---help---
  Currently supports the LAN83C185 PHY
 
 config BROADCOM_PHY
tristate Drivers for Broadcom PHYs
-   depends on PHYLIB
---help---
  Currently supports the BCM5411, BCM5421 and BCM5461 PHYs.
 
 config FIXED_PHY
tristate Drivers for PHY emulation on fixed speed/link
-   depends on PHYLIB
---help---
  Adds the driver to PHY layer to cover the boards that do not have any 
PHY bound,
  but with the ability to manipulate with speed/link in software. The 
relavant MII
@@ -79,5 +69,4 @@ config FIXED_MII_100_FDX
bool Emulation for 100M Fdx fixed PHY behavior
depends on FIXED_PHY
 
-endmenu
-
+endif #PHYLIB
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] 2.6 driver for Silan SC92031

2006-12-02 Thread Cesar Eduardo Barros

Jeff Garzik escreveu:

Cesar Eduardo Barros wrote:

From: Cesar Eduardo Barros [EMAIL PROTECTED]

This is a driver for the Silan SC92031/Rsltek 8139D NIC chip. It's a
rewrite of the vendor 2.4 driver for 2.6, and has been lightly tested
on a 2.6.17 x86-64 kernel with the Ubuntu patches (as a out-of-tree
module only).



Seems like it would be best to modify the existing 8139 driver...


I'm not sure it would help. Either the hardware differences are too 
large (for instance, the MII/link part, where the way the vendor driver 
did things implies the MII has only the two basic registers plus two 
vendor registers, meaning I simply cannot use the generic mii code) or 
the code is already modified from the 8139 driver (the vendor driver 
seems to be based on an old version of either pci-skeleton.c or 
8139too.c, and I based my rewrite on the vendor driver).


Of course, one thing I probably will copy from 8139too.c later is the 
NAPI code; I wanted to avoid the extra locking complexity in this first 
version (the fact that the interrupt status register is cleared on 
reading only makes things more complex). If you can suggest other things 
to copy, it would be good, since the copied code is less likely to be wrong.


--
Cesar Eduardo Barros
[EMAIL PROTECTED]
[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 v2 00/13] 2.6.20 Chelsio T3 RDMA Driver

2006-12-02 Thread Stephen Hemminger

Francois Romieu wrote:

Steve Wise [EMAIL PROTECTED] :
[...]
  

Version 2 changes:

- Make code sparse endian clean
- Use IDRs for mapping QP and CQ IDs to structure pointers instead of arrays
- Clean up confusing bitfields
- Use random32() instead of local random function
- Use krefs to track endpoint reference counts
- Misc nits

-

The following series implements the Chelsio T3 iWARP/RDMA Driver to
be considered for inclusion in 2.6.20.  It depends on the Chelsio T3
Ethernet Driver which is also under review now for 2.6.20. See:



I understood that Stephen expressed some doubts regarding the inclusion
of TOE enabled features.

Was his point addressed ?

  


My comments were about different hardware.
-
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: [Bugme-new] [Bug 7621] New: 2.6.19 breaks IPv6

2006-12-02 Thread Andrew Morton
 On Sat, 2 Dec 2006 11:23:54 -0800 [EMAIL PROTECTED] wrote:
 http://bugzilla.kernel.org/show_bug.cgi?id=7621
 
Summary: 2.6.19 breaks IPv6
 Kernel Version: 2.6.19
 Status: NEW
   Severity: high
  Owner: [EMAIL PROTECTED]
  Submitter: [EMAIL PROTECTED]
 
 
 Vanille 2.6.19 oops'es at boot. With the patch from 
 http://marc.theaimsgroup.com/?l=linux-kernelm=116485303623545w=2 it boots 
 but IPv6 stopps working. I can't ping/traceroute any host. Network setup has 
 not changed.
 
 --- You are receiving this mail because: ---
 You are on the CC list for the bug, or are watching someone who is.
-
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: [Bugme-new] [Bug 7621] New: 2.6.19 breaks IPv6

2006-12-02 Thread David Miller
From: Andrew Morton [EMAIL PROTECTED]
Date: Sat, 2 Dec 2006 19:20:09 -0800

  On Sat, 2 Dec 2006 11:23:54 -0800 [EMAIL PROTECTED] wrote:
  http://bugzilla.kernel.org/show_bug.cgi?id=7621
  
 Summary: 2.6.19 breaks IPv6
  Kernel Version: 2.6.19
  Status: NEW
Severity: high
   Owner: [EMAIL PROTECTED]
   Submitter: [EMAIL PROTECTED]
  
  
  Vanille 2.6.19 oops'es at boot. With the patch from 
  http://marc.theaimsgroup.com/?l=linux-kernelm=116485303623545w=2 it boots 
  but IPv6 stopps working. I can't ping/traceroute any host. Network setup 
  has 
  not changed.
  
  --- You are receiving this mail because: ---
  You are on the CC list for the bug, or are watching someone who is.

As YOSHIFUJI Hideaki noticed, changing 'len' influences the
argument to ip6_nd_hdr(), which is not a side effect we wanted.

We only wanted the allocation length to be increased by
sizeof(struct ipv6hdr).

This is the correct version of the fix.

commit 6e38433357e2381bb278a418fb7e2fd201475101
Author: David S. Miller [EMAIL PROTECTED]
Date:   Sat Dec 2 21:00:06 2006 -0800

[IPV6] NDISC: Calculate packet length correctly for allocation.

MAX_HEADER does not include the ipv6 header length in it,
so we need to add it in explicitly.

With help from YOSHIFUJI Hideaki.

Signed-off-by: David S. Miller [EMAIL PROTECTED]

diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index 73eb8c3..89d527e 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -472,7 +472,9 @@ static void ndisc_send_na(struct net_dev
inc_opt = 0;
}
 
-   skb = sock_alloc_send_skb(sk, MAX_HEADER + len + LL_RESERVED_SPACE(dev),
+   skb = sock_alloc_send_skb(sk,
+ (MAX_HEADER + sizeof(struct ipv6hdr) +
+  len + LL_RESERVED_SPACE(dev)),
  1, err);
 
if (skb == NULL) {
@@ -561,7 +563,9 @@ void ndisc_send_ns(struct net_device *de
if (send_llinfo)
len += ndisc_opt_addr_space(dev);
 
-   skb = sock_alloc_send_skb(sk, MAX_HEADER + len + LL_RESERVED_SPACE(dev),
+   skb = sock_alloc_send_skb(sk,
+ (MAX_HEADER + sizeof(struct ipv6hdr) +
+  len + LL_RESERVED_SPACE(dev)),
  1, err);
if (skb == NULL) {
ND_PRINTK0(KERN_ERR
@@ -636,7 +640,9 @@ void ndisc_send_rs(struct net_device *de
if (dev-addr_len)
len += ndisc_opt_addr_space(dev);
 
-skb = sock_alloc_send_skb(sk, MAX_HEADER + len + 
LL_RESERVED_SPACE(dev),
+skb = sock_alloc_send_skb(sk,
+ (MAX_HEADER + sizeof(struct ipv6hdr) +
+  len + LL_RESERVED_SPACE(dev)),
  1, err);
if (skb == NULL) {
ND_PRINTK0(KERN_ERR
@@ -1446,7 +1452,9 @@ void ndisc_send_redirect(struct sk_buff 
rd_len = ~0x7;
len += rd_len;
 
-   buff = sock_alloc_send_skb(sk, MAX_HEADER + len + 
LL_RESERVED_SPACE(dev),
+   buff = sock_alloc_send_skb(sk,
+  (MAX_HEADER + sizeof(struct ipv6hdr) +
+   len + LL_RESERVED_SPACE(dev)),
   1, err);
if (buff == NULL) {
ND_PRINTK0(KERN_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


Re: [PATCH] rose_add_loopback_node: propagate -E

2006-12-02 Thread David Miller
From: Alexey Dobriyan [EMAIL PROTECTED]
Date: Sun, 3 Dec 2006 00:33:39 +0300

 David Binderman's icc logs:
 net/rose/rose_route.c(399): remark #593: variable err was set but never used
 
 Signed-off-by: Alexey Dobriyan [EMAIL PROTECTED]

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


Re: RFC: XFRM changing the view of xfrm_aevent_id

2006-12-02 Thread David Miller
From: jamal [EMAIL PROTECTED]
Date: Sat, 02 Dec 2006 06:09:08 -0500

 On Fri, 2006-01-12 at 20:08 -0800, David Miller wrote:
 
  
  Let's change it now while we still can.
  
  A few months from now, I will probably not give the same
  answer :)
 
 :- Ok, here it is ...

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


[PATCH] softmac: fix unbalanced mutex_lock/unlock in ieee80211softmac_wx_set_mlme

2006-12-02 Thread Maxime Austruy

Found a hang while playing with wpa_supplicant and a zd1211 usb adapter
using linux 2.6.19.  The problem is that ieee80211softmac_wx_set_mlme
forgets to release a mutex when mlme-cmd is IW_MLME_DEAUTH.  The fix
below allows me to kill wpa_supplicant and to restart it without having
to reboot the machine. FWIW, it seems that the problem was introduced
between 2.6.19-rc2 and 2.6.19-rc3 when this function was changed to use
a mutex.

Signed-off-by: Maxime Austruy [EMAIL PROTECTED]

--
 net/ieee80211/softmac/ieee80211softmac_wx.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- linux.orig/net/ieee80211/softmac/ieee80211softmac_wx.c  2006-11-29 
13:57:37.0 -0800
+++ linux/net/ieee80211/softmac/ieee80211softmac_wx.c   2006-12-02 
22:58:20.0 -0800
@@ -495,7 +495,8 @@ ieee80211softmac_wx_set_mlme(struct net_
printk(KERN_DEBUG PFX wx_set_mlme: we should know the 
net here...\n);
goto out;
}
-   return ieee80211softmac_deauth_req(mac, net, reason);
+   err =  ieee80211softmac_deauth_req(mac, net, reason);
+   goto out;
case IW_MLME_DISASSOC:
ieee80211softmac_send_disassoc_req(mac, reason);
mac-associnfo.associated = 0;
-
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] drivers/net/netxen/: possible cleanups

2006-12-02 Thread Adrian Bunk
On Tue, Nov 28, 2006 at 02:02:46AM -0800, Andrew Morton wrote:
...
 Changes since 2.6.19-rc6-mm1:
...
  git-netdev-all.patch
...
  git trees
...

This patch contains the following possible cleanups:
- make needlessly global code static
- #if 0 the following unused global functions:
  - netxen_nic_hw.c: netxen_crb_read_val()
  - netxen_nic_niu.c: netxen_niu_xgbe_clear_phy_interrupts()
  - netxen_nic_niu.c: netxen_niu_gbe_handle_phy_interrupt()
  - netxen_nic_niu.c: netxen_niu_macaddr_get()
  - netxen_nic_niu.c: netxen_niu_enable_gbe_port()
  - netxen_nic_niu.c: netxen_niu_xg_macaddr_get()

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

---

 drivers/net/netxen/netxen_nic.h  |   13 -
 drivers/net/netxen/netxen_nic_hw.c   |   13 +++--
 drivers/net/netxen/netxen_nic_hw.h   |8 ++--
 drivers/net/netxen/netxen_nic_init.c |   21 +
 drivers/net/netxen/netxen_nic_isr.c  |   10 +-
 drivers/net/netxen/netxen_nic_niu.c  |   22 --
 6 files changed, 39 insertions(+), 48 deletions(-)

--- linux-2.6.19-rc6-mm2/drivers/net/netxen/netxen_nic_hw.c.old 2006-12-02 
20:43:26.0 +0100
+++ linux-2.6.19-rc6-mm2/drivers/net/netxen/netxen_nic_hw.c 2006-12-02 
20:45:07.0 +0100
@@ -51,9 +51,8 @@
 #define NETXEN_NIU_HDRSIZE (0x1  6)
 #define NETXEN_NIU_TLRSIZE (0x1  5)
 
-unsigned long netxen_nic_pci_set_window(void __iomem * pci_base,
-   unsigned long long addr);
-void netxen_free_hw_resources(struct netxen_adapter *adapter);
+static unsigned long netxen_nic_pci_set_window(void __iomem * pci_base,
+  unsigned long long addr);
 
 int netxen_nic_set_mac(struct net_device *netdev, void *p)
 {
@@ -646,10 +645,10 @@
netxen_nic_pci_change_crbwindow(adapter, 1);
 }
 
-int netxen_pci_set_window_warning_count = 0;
+static int netxen_pci_set_window_warning_count = 0;
 
-unsigned long
-netxen_nic_pci_set_window(void __iomem * pci_base, unsigned long long addr)
+static unsigned long netxen_nic_pci_set_window(void __iomem * pci_base,
+  unsigned long long addr)
 {
static int ddr_mn_window = -1;
static int qdr_sn_window = -1;
@@ -928,9 +927,11 @@
   fw_major, fw_minor);
 }
 
+#if 0
 int netxen_crb_read_val(struct netxen_adapter *adapter, unsigned long off)
 {
int data;
netxen_nic_hw_read_wx(adapter, off, data, 4);
return data;
 }
+#endif  /*  0  */
--- linux-2.6.19-rc6-mm2/drivers/net/netxen/netxen_nic_init.c.old   
2006-12-02 20:45:27.0 +0100
+++ linux-2.6.19-rc6-mm2/drivers/net/netxen/netxen_nic_init.c   2006-12-02 
20:47:44.0 +0100
@@ -239,7 +239,7 @@
  * netxen_decode_crb_addr(0 - utility to translate from internal Phantom CRB
  * address to external PCI CRB address.
  */
-unsigned long netxen_decode_crb_addr(unsigned long addr)
+static unsigned long netxen_decode_crb_addr(unsigned long addr)
 {
int i;
unsigned long base_addr, offset, pci_base;
@@ -304,7 +304,7 @@
 
 }
 
-int netxen_wait_rom_done(struct netxen_adapter *adapter)
+static int netxen_wait_rom_done(struct netxen_adapter *adapter)
 {
long timeout = 0;
long done = 0;
@@ -582,9 +582,8 @@
  * and if the number of receives exceeds RX_BUFFERS_REFILL, then we
  * invoke the routine to send more rx buffers to the Phantom...
  */
-void
-netxen_process_rcv(struct netxen_adapter *adapter, int ctxid,
-  struct status_desc *desc)
+static void netxen_process_rcv(struct netxen_adapter *adapter, int ctxid,
+  struct status_desc *desc)
 {
struct netxen_port *port = adapter-port[STATUS_DESC_PORT(desc)];
struct pci_dev *pdev = port-pdev;
@@ -919,10 +918,9 @@
return 0;
 }
 
-int
-netxen_nic_fill_statistics(struct netxen_adapter *adapter,
-  struct netxen_port *port,
-  struct netxen_statistics *netxen_stats)
+static int netxen_nic_fill_statistics(struct netxen_adapter *adapter,
+ struct netxen_port *port,
+ struct netxen_statistics *netxen_stats)
 {
void __iomem *addr;
 
@@ -978,9 +976,8 @@
}
 }
 
-int
-netxen_nic_clear_statistics(struct netxen_adapter *adapter,
-   struct netxen_port *port)
+static int netxen_nic_clear_statistics(struct netxen_adapter *adapter,
+  struct netxen_port *port)
 {
int data = 0;
 
--- linux-2.6.19-rc6-mm2/drivers/net/netxen/netxen_nic.h.old2006-12-02 
20:48:02.0 +0100
+++ linux-2.6.19-rc6-mm2/drivers/net/netxen/netxen_nic.h2006-12-02 
20:54:30.0 +0100
@@ -793,16 +793,8 @@
   int port);
 int netxen_niu_gbe_disable_phy_interrupts(struct netxen_adapter *adapter,