[patch 5/5] fib_trie: use RCU (EXPERIMENTAL)

2005-08-04 Thread Robert Olsson

Stephen Hemminger writes:
  Convert FIB Trie to use RCU for the normal lookup fast
  path. Use simple spin_lock for updates and dump access.
 
 Hello!

 Yes spent some days to get a complete RCU for the trie. Discussed  with 
 Patrick at OLS. This includes your start and also RCU versions of fib_alias 
 handling and removes the fib_lock totally etc.

 Replace of fib_alias needs to be proctected via RCU and should be added.

 This needs more testing on systems with lareg numbers of routes
 
 Testing and verification is absolutely crucial... and is often much more 
 work then doing a patch. And really testing  verification is a iterative
 part of the design.

 The patch below is current work it is tested/iterated with rDoS injection
 during both insert, delete and dump of full bgp on SMP machine.

 Also now insert and delete performance seems now acceptable. (destruction 
 of nested RCU  lists) leaf - list of leaf_info - list of fib_alias
 And lookup performance is interesting w. SMP :)

 I've asked Patrick to put on his argus eyes to spot any potential problems 
 that might be missed.

 I'm on vacation so email will be sporadic...
 

 Cheers.
--ro


diff --git a/include/linux/list.h b/include/linux/list.h
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -620,6 +620,28 @@ static inline void hlist_add_after(struc
next-next-pprev  = next-next;
 }
 
+static inline void hlist_add_before_rcu(struct hlist_node *n,
+   struct hlist_node *next)
+{
+   n-pprev = next-pprev;
+   n-next = next;
+   smp_wmb();
+   next-pprev = n-next;
+   *(n-pprev) = n;
+}
+
+static inline void hlist_add_after_rcu(struct hlist_node *n,
+  struct hlist_node *next)
+{
+   next-next = n-next;
+   n-next = next;
+   smp_wmb();
+   next-pprev = n-next;
+
+   if (next-next)
+   next-next-pprev  = next-next;
+}
+
 #define hlist_entry(ptr, type, member) container_of(ptr,type,member)
 
 #define hlist_for_each(pos, head) \
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -847,6 +847,102 @@ failure:
return NULL;
 }
 
+/* Deal with better RCU integration later  */
+
+/* Return the first fib alias matching TOS with
+ * priority less than or equal to PRIO.
+ */
+struct fib_alias *fib_find_alias_rcu(struct list_head *fah, u8 tos, u32 prio)
+{
+   if (fah) {
+   struct fib_alias *fa;
+   list_for_each_entry_rcu(fa, fah, fa_list) {
+   if (fa-fa_tos  tos)
+   continue;
+   if (fa-fa_info-fib_priority = prio ||
+   fa-fa_tos  tos)
+   return fa;
+   }
+   }
+   return NULL;
+}
+
+int fib_semantic_match_rcu(struct list_head *head, const struct flowi *flp,
+  struct fib_result *res, __u32 zone, __u32 mask, 
+   int prefixlen)
+{
+   struct fib_alias *fa;
+   int nh_sel = 0;
+
+   list_for_each_entry_rcu(fa, head, fa_list) {
+   int err;
+
+   if (fa-fa_tos 
+   fa-fa_tos != flp-fl4_tos)
+   continue;
+
+   if (fa-fa_scope  flp-fl4_scope)
+   continue;
+
+   fa-fa_state |= FA_S_ACCESSED;
+
+   err = fib_props[fa-fa_type].error;
+   if (err == 0) {
+   struct fib_info *fi = fa-fa_info;
+
+   if (fi-fib_flags  RTNH_F_DEAD)
+   continue;
+
+   switch (fa-fa_type) {
+   case RTN_UNICAST:
+   case RTN_LOCAL:
+   case RTN_BROADCAST:
+   case RTN_ANYCAST:
+   case RTN_MULTICAST:
+   for_nexthops(fi) {
+   if (nh-nh_flagsRTNH_F_DEAD)
+   continue;
+   if (!flp-oif || flp-oif == nh-nh_oif)
+   break;
+   }
+#ifdef CONFIG_IP_ROUTE_MULTIPATH
+   if (nhsel  fi-fib_nhs) {
+   nh_sel = nhsel;
+   goto out_fill_res;
+   }
+#else
+   if (nhsel  1) {
+   goto out_fill_res;
+   }
+#endif
+   endfor_nexthops(fi);
+   continue;
+
+   default:
+   printk(KERN_DEBUG impossible 102\n);
+   return -EINVAL;
+ 

Re: 2.6.13-rc4 - kernel panic - BUG at net/ipv4/tcp_output.c:918

2005-08-04 Thread Herbert Xu
On Thu, Aug 04, 2005 at 01:33:29PM +1000, herbert wrote:
 
 So I suppose we should reset cwnd_quota after tcp_transmit_skb?

Please try this patch to see if this is really the problem or not.

Thanks,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmVHI~} [EMAIL PROTECTED]
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -1027,19 +1027,14 @@ static int tcp_write_xmit(struct sock *s
tcp_minshall_update(tp, mss_now, skb);
sent_pkts++;
 
-   /* Do not optimize this to use tso_segs. If we chopped up
-* the packet above, tso_segs will no longer be valid.
-*/
-   cwnd_quota -= tcp_skb_pcount(skb);
-
-   BUG_ON(cwnd_quota  0);
-   if (!cwnd_quota)
-   break;
-
skb = sk-sk_send_head;
if (!skb)
break;
+
tso_segs = tcp_init_tso_segs(sk, skb, mss_now);
+   cwnd_quota = tcp_cwnd_test(tp, skb);
+   if (!cwnd_quota)
+   break;
}
 
if (likely(sent_pkts)) {


Re: [PATCH] IPSec anti-replay sequence numbers

2005-08-04 Thread Ulrich Weber
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi All,

thanks for revising Patrick! Attached is the updated patch.
Sorry had no time yet to remove the sysctl variables.
It will follow in a few weeks if I have more time :)

Best regards
 Ulrich

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFC8fRi22t2oTuElzoRAkPIAJ40Ej2cs+1DX2IYiVcpr/OF8dUKJgCeJj6T
o639zBMfTeeEwY1OgxRcsw0=
=ggAG
-END PGP SIGNATURE-

diff -Nru linux-2.6.13-rc3.org/include/linux/sysctl.h 
linux-2.6.13-rc3/include/linux/sysctl.h
--- linux-2.6.13-rc3.org/include/linux/sysctl.h 2005-07-18 10:24:11.0 
+0200
+++ linux-2.6.13-rc3/include/linux/sysctl.h 2005-07-19 10:10:22.0 
+0200
@@ -253,6 +253,8 @@
NET_CORE_DEV_WEIGHT=17,
NET_CORE_SOMAXCONN=18,
NET_CORE_BUDGET=19,
+   NET_CORE_XFRM_SEQDIFF_IN=20,
+   NET_CORE_XFRM_SEQDIFF_OUT=21,
 };
 
 /* /proc/sys/net/ethernet */
diff -Nru linux-2.6.13-rc3.org/include/linux/xfrm.h 
linux-2.6.13-rc3/include/linux/xfrm.h
--- linux-2.6.13-rc3.org/include/linux/xfrm.h   2005-07-18 10:49:43.0 
+0200
+++ linux-2.6.13-rc3/include/linux/xfrm.h   2005-07-19 10:10:22.0 
+0200
@@ -140,6 +140,9 @@
XFRM_MSG_FLUSHPOLICY,
 #define XFRM_MSG_FLUSHPOLICY XFRM_MSG_FLUSHPOLICY
 
+   XFRM_MSG_UPDSEQ,
+#define XFRM_MSG_UPDSEQ XFRM_MSG_UPDSEQ
+ 
__XFRM_MSG_MAX
 };
 #define XFRM_MSG_MAX (__XFRM_MSG_MAX - 1)
@@ -263,5 +266,6 @@
 #define XFRMGRP_EXPIRE 2
 #define XFRMGRP_SA 4
 #define XFRMGRP_POLICY 8
+#define XFRMGRP_REPLAY 16
 
 #endif /* _LINUX_XFRM_H */
diff -Nru linux-2.6.13-rc3.org/include/net/xfrm.h 
linux-2.6.13-rc3/include/net/xfrm.h
--- linux-2.6.13-rc3.org/include/net/xfrm.h 2005-07-18 10:24:11.0 
+0200
+++ linux-2.6.13-rc3/include/net/xfrm.h 2005-08-04 12:28:36.0 +0200
@@ -134,6 +134,9 @@
/* State for replay detection */
struct xfrm_replay_state replay;
 
+   /* Replay detection state at the time we sent the last notification */
+   struct xfrm_replay_state preplay;
+
/* Statistics */
struct xfrm_stats   stats;
 
@@ -301,6 +304,10 @@
struct xfrm_tmplxfrm_vec[XFRM_MAX_DEPTH];
 };
 
+/* which seqno */
+#define XFRM_REPLAY_INBOUND1
+#define XFRM_REPLAY_OUTBOUND   2
+
 #define XFRM_KM_TIMEOUT30
 
 struct xfrm_mgr
@@ -312,6 +319,7 @@
struct xfrm_policy  *(*compile_policy)(u16 family, int opt, u8 
*data, int len, int *dir);
int (*new_mapping)(struct xfrm_state *x, 
xfrm_address_t *ipaddr, u16 sport);
int (*notify_policy)(struct xfrm_policy *x, int 
dir, struct km_event *c);
+   int (*notify_seq)(struct xfrm_state *x, u32 pid, 
u32 seq);
 };
 
 extern int xfrm_register_km(struct xfrm_mgr *km);
@@ -838,6 +846,8 @@
 extern void xfrm_state_flush(u8 proto);
 extern int xfrm_replay_check(struct xfrm_state *x, u32 seq);
 extern void xfrm_replay_advance(struct xfrm_state *x, u32 seq);
+extern void xfrm_replay_notify(struct xfrm_state *x, int event);
+extern void xfrm_state_replay_update(struct xfrm_state *x, struct 
xfrm_replay_state *replay);
 extern int xfrm_state_check(struct xfrm_state *x, struct sk_buff *skb);
 extern int xfrm_state_mtu(struct xfrm_state *x, int mtu);
 extern int xfrm_init_state(struct xfrm_state *x);
@@ -888,6 +898,7 @@
 struct xfrm_state * xfrm_find_acq(u8 mode, u32 reqid, u8 proto, 
  xfrm_address_t *daddr, xfrm_address_t *saddr, 
  int create, unsigned short family);
+extern void km_replay_notify(struct xfrm_state *);
 extern void xfrm_policy_flush(void);
 extern int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy 
*pol);
 extern int xfrm_flush_bundles(void);
diff -Nru linux-2.6.13-rc3.org/net/core/sysctl_net_core.c 
linux-2.6.13-rc3/net/core/sysctl_net_core.c
--- linux-2.6.13-rc3.org/net/core/sysctl_net_core.c 2005-07-18 
10:24:11.0 +0200
+++ linux-2.6.13-rc3/net/core/sysctl_net_core.c 2005-07-19 10:10:22.0 
+0200
@@ -31,6 +31,11 @@
 extern char sysctl_divert_version[];
 #endif /* CONFIG_NET_DIVERT */
 
+#ifdef CONFIG_XFRM
+extern u32 sysctl_xfrm_seqdiff_in;
+extern u32 sysctl_xfrm_seqdiff_out;
+#endif /* CONFIG_XFRM */
+
 ctl_table core_table[] = {
 #ifdef CONFIG_NET
{
@@ -116,6 +121,24 @@
.proc_handler   = proc_dostring
},
 #endif /* CONFIG_NET_DIVERT */
+#ifdef CONFIG_XFRM
+   {
+   .ctl_name   = NET_CORE_XFRM_SEQDIFF_IN,
+   .procname   = xfrm_seqdiff_in,
+   .data   = sysctl_xfrm_seqdiff_in,
+   .maxlen = sizeof(int),
+   .mode   = 0644,
+   .proc_handler   = proc_dointvec,
+   },
+   {
+   .ctl_name   = NET_CORE_XFRM_SEQDIFF_OUT,

Re: [Bugme-new] [Bug 4952] New: IPSec incompabilty. Linux kernel waits to long to start using new SA for outbound traffic.

2005-08-04 Thread David S. Miller
From: Herbert Xu [EMAIL PROTECTED]
Date: Thu, 4 Aug 2005 07:32:15 +1000

 On Wed, Aug 03, 2005 at 06:34:38AM -0700, David S. Miller wrote:
  Therefore, when any SA is added, the assosciated policy is the
  one for which we flush all matching DST entries.
 
 How do you find the associated policy aside from walking
 through the entire policy list and checking each template?

When you add an SA, you have to place it somewhere, don't you?
And that where (be it one policy template, or many) are
what you use to decide which policy for which to do the DST
flush.

Maybe I don't understand the hierarchy in which the SA's are
stored.

Anyways, I'm not going to listen to the userland can fix this
arguments any longer.  The kernel needs to implement consistency
here, even if arguably stupid things occur.
-
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] add new nfnetlink_log subsystem

2005-08-04 Thread David S. Miller
From: Andi Kleen [EMAIL PROTECTED]
Subject: Re: [PATCH] add new nfnetlink_log subsystem
Date: Thu, 4 Aug 2005 00:19:41 +0200

  no, it hasn't.  I am travelling and don't have the space for a
  debian/i386 installation in addition to the debian/x86_64 on this box,
  sorry :(
 
 That sounds risky. I would ask for this stuff not being merged before
 it isn't tested.

Andi, stop this, you yourself, can test and verify this and suggest
changes to the protocol structure layout if you want to.

You will have more than ample time to do this, as this feature is
scheduled to go into 2.6.14 and we haven't even gotten 2.6.13 out
the door yet :-)
-
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: Super TSO performance drop

2005-08-04 Thread David S. Miller
From: Leonid Grossman [EMAIL PROTECTED]
Date: Wed, 3 Aug 2005 21:07:56 -0400

 We can either provide a remote to the setup, or test incremental patches
 if #16 can be broken in smaller pieces.

I think it would be more productive for you to work on trying
to figure out what about the packet patterns of the new code
leads to the lower performance.

It's too much back and forth, and wasted time, to have other people
do this part of the work.
-
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] add new nfnetlink_log subsystem

2005-08-04 Thread Andi Kleen
On Thu, Aug 04, 2005 at 06:49:46AM -0700, David S. Miller wrote:
 From: Harald Welte [EMAIL PROTECTED]
 Date: Thu, 4 Aug 2005 00:03:53 +0200
 
  However, all nfnetlink-based protocols are supposed to be both endian
  and 32/64 as well as alignment (*) safe.   the protocol definitions
  always use u_intXX_t types, all network byte order, and no kernel pointers
  passed to userspace or similar crap ;)
 
 You cannot use u64 objects, even though that is supposed to
 be a portable type.  i386 does not align u64's on an 8-byte
 boundary, whereas every sane platform in the world (including
 x86_64) does.

Well you can, just you need to make sure they are properly aligned
by hand. And a more subtle issue is that structures are padded
to a multiple of the largest alignment of any member. So when a structure 
has an u64 member it must be padded at the end to 8 bytes too.

But this is all relatively subtle, so some review and some testing
before fixing the interface would be good.

-Andi

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


Re: [PATCH] 8139cp - redetect link after suspend

2005-08-04 Thread Pierre Ossman
John W. Linville wrote:

On Mon, Jul 04, 2005 at 12:22:53AM +0200, Pierre Ossman wrote:
  

After suspend the driver needs to retest link status in case the cable
has been inserted or removed during the suspend.

Signed-off-by: Pierre Ossman [EMAIL PROTECTED]



Please copy netdev@vger.kernel.org for network driver patches.

Other than that, the patch looks acceptable to me, fwiw...
  


Has anyone had else had the time to review this? Jeff especially.

Rgds
Pierre

-
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: 8139cp misses interrupts during resume

2005-08-04 Thread Pierre Ossman
Pierre Ossman wrote:
 I'm having problem with the interrupt getting killed after suspend with
 my 8139cp controller. The problem only appears if the cable is connected
 during resume (before suspend is irrelevant) and the interface is down.
 
 Both suspend-to-disk and suspend-to-ram exhibit the error. dmesg from
 suspend-to-ram included.
 
 I find it a bit strange that 8139cp's interrupt handler isn't included
 when it dumps the handlers. Could this be related to the problem?
 

Anyone familiar with this driver that can give me some pointers on what
to look for? I'd prefer not to have to learn how the entire thing works
just to fix one bug. :)

Rgds
Pierre
-
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] IPSec anti-replay sequence numbers

2005-08-04 Thread KOVACS Krisztian

  Hi,

2005-08-04, cs keltezéssel 12.56-kor Ulrich Weber ezt írta:
 thanks for revising Patrick! Attached is the updated patch.
 Sorry had no time yet to remove the sysctl variables.
 It will follow in a few weeks if I have more time :)

  Ulrich, I already have some code which supports per-state difference
settings, along with optional time limits. I don't know whether or not
the latter would be necessary or not, but putting the per-state diff
values would be trivial. I'll send a patch in a couple of days if I find
the time to hack it together.

  Some questions below:

 diff -Nru linux-2.6.13-rc3.org/include/net/xfrm.h 
 linux-2.6.13-rc3/include/net/xfrm.h
 --- linux-2.6.13-rc3.org/include/net/xfrm.h   2005-07-18 10:24:11.0 
 +0200
 +++ linux-2.6.13-rc3/include/net/xfrm.h   2005-08-04 12:28:36.0 
 +0200
 @@ -134,6 +134,9 @@
   /* State for replay detection */
   struct xfrm_replay_state replay;
  
 + /* Replay detection state at the time we sent the last notification */
 + struct xfrm_replay_state preplay;
 +
   /* Statistics */
   struct xfrm_stats   stats;
  
 @@ -301,6 +304,10 @@
   struct xfrm_tmplxfrm_vec[XFRM_MAX_DEPTH];
  };
  
 +/* which seqno */
 +#define XFRM_REPLAY_INBOUND  1
 +#define XFRM_REPLAY_OUTBOUND 2
 +
  #define XFRM_KM_TIMEOUT  30
  
  struct xfrm_mgr
 @@ -312,6 +319,7 @@
   struct xfrm_policy  *(*compile_policy)(u16 family, int opt, u8 
 *data, int len, int *dir);
   int (*new_mapping)(struct xfrm_state *x, 
 xfrm_address_t *ipaddr, u16 sport);
   int (*notify_policy)(struct xfrm_policy *x, int 
 dir, struct km_event *c);
 + int (*notify_seq)(struct xfrm_state *x, u32 pid, 
 u32 seq);

  Why do you need the pid and seq argument here? The sequence number is
redundant information anyway. In turn, you don't seem to pass the event
in to the notify_seq() callback, which could be handy in some cases. So
IMHO something like

  notify_seq(struct xfrm_state *x, int event)

would be more general.

 --- linux-2.6.13-rc3.org/net/key/af_key.c 2005-07-18 10:49:41.0 
 +0200
 +++ linux-2.6.13-rc3/net/key/af_key.c 2005-07-19 10:10:22.0 +0200
 @@ -2860,6 +2860,12 @@
   return pfkey_broadcast(skb, GFP_ATOMIC, BROADCAST_REGISTERED, NULL);
  }
  
 +static int pfkey_send_replay_notify(struct xfrm_state *x, u32 pid, u32 seq)
 +{
 + /* FIXME: To be done*/
 + return 0;
 +}

  I also have a PF_KEY implementation of these features, but since we
have to define new message types to support all the features this is a
hard thing... (And consequently the code is more of a hack than correct
implementation.)

-- 
 Regards,
  Krisztian Kovacs

-
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] IPSec anti-replay sequence numbers

2005-08-04 Thread Ulrich Weber
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

KOVACS Krisztian wrote:

 Ulrich, I already have some code which supports per-state
 difference settings, along with optional time limits. I don't know
 whether or not the latter would be necessary or not, but putting
 the per-state diff values would be trivial. I'll send a patch in a
 couple of days if I find the time to hack it together.

Ok great :)

 Why do you need the pid and seq argument here? The sequence number
 is redundant information anyway. In turn, you don't seem to pass
 the event in to the notify_seq() callback, which could be handy in
 some cases. So IMHO something like

 notify_seq(struct xfrm_state *x, int event)

 would be more general.

I need it to distinguish between unicast (userspace wants a seq nr) or
multicast (inform userspace about new seq nr) netlink messages. Seq
stands here for Netlink seq nr.
I'll have a look if I can wrap it another way.

Best regards
 Ulrich
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFC8j+g22t2oTuElzoRAlpTAJ9CuaW1MoHZ0P1IjsIb8UdGavOb3ACfY5CK
epoVhuRj/aYA5Jcpjhm1frc=
=tmgD
-END PGP SIGNATURE-

-
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 ieee80211] ieee80211.h: minor changes to header

2005-08-04 Thread Michael Wu
(resend to netdev@vger.kernel.org, previous email went to [EMAIL PROTECTED])

Hi,

This patch:
- fixes misc. whitespace/comments
- replaces u16 with __le16/__be16 where appropriate

Signed-off-by: Michael Wu [EMAIL PROTECTED]

diff --git a/include/net/ieee80211.h b/include/net/ieee80211.h
--- a/include/net/ieee80211.h
+++ b/include/net/ieee80211.h
@@ -47,22 +47,22 @@
 #define IEEE80211_FRAME_LEN(IEEE80211_DATA_LEN + IEEE80211_HLEN)
 
 struct ieee80211_hdr {
-   u16 frame_ctl;
-   u16 duration_id;
+   __le16 frame_ctl;
+   __le16 duration_id;
u8 addr1[ETH_ALEN];
u8 addr2[ETH_ALEN];
u8 addr3[ETH_ALEN];
-   u16 seq_ctl;
+   __le16 seq_ctl;
u8 addr4[ETH_ALEN];
 } __attribute__ ((packed));
 
 struct ieee80211_hdr_3addr {
-   u16 frame_ctl;
-   u16 duration_id;
+   __le16 frame_ctl;
+   __le16 duration_id;
u8 addr1[ETH_ALEN];
u8 addr2[ETH_ALEN];
u8 addr3[ETH_ALEN];
-   u16 seq_ctl;
+   __le16 seq_ctl;
 } __attribute__ ((packed));
 
 enum eap_type {
@@ -88,10 +88,10 @@ static inline const char *eap_get_type(i
 
 struct eapol {
u8 snap[6];
-   u16 ethertype;
+   __be16 ethertype;
u8 version;
u8 type;
-   u16 length;
+   __be16 length;
 } __attribute__ ((packed));
 
 #define IEEE80211_1ADDR_LEN 10
@@ -223,9 +223,9 @@ do { if (ieee80211_debug_level  (level)
 #include linux/if_arp.h /* ARPHRD_ETHER */
 
 #ifndef WIRELESS_SPY
-#define WIRELESS_SPY   // enable iwspy support
+#define WIRELESS_SPY   /* enable iwspy support */
 #endif
-#include net/iw_handler.h// new driver API
+#include net/iw_handler.h/* new driver API */
 
 #ifndef ETH_P_PAE
 #define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */
@@ -520,9 +520,9 @@ struct ieee80211_info_element {
 
 struct ieee80211_authentication {
struct ieee80211_hdr_3addr header;
-   u16 algorithm;
-   u16 transaction;
-   u16 status;
+   __le16 algorithm;
+   __le16 transaction;
+   __le16 status;
struct ieee80211_info_element info_element;
 } __attribute__ ((packed));
 
@@ -530,23 +530,23 @@ struct ieee80211_authentication {
 struct ieee80211_probe_response {
struct ieee80211_hdr_3addr header;
u32 time_stamp[2];
-   u16 beacon_interval;
-   u16 capability;
+   __le16 beacon_interval;
+   __le16 capability;
struct ieee80211_info_element info_element;
 } __attribute__ ((packed));
 
 struct ieee80211_assoc_request_frame {
-   u16 capability;
-   u16 listen_interval;
+   __le16 capability;
+   __le16 listen_interval;
u8 current_ap[ETH_ALEN];
struct ieee80211_info_element info_element;
 } __attribute__ ((packed));
 
 struct ieee80211_assoc_response_frame {
struct ieee80211_hdr_3addr header;
-   u16 capability;
-   u16 status;
-   u16 aid;
+   __le16 capability;
+   __le16 status;
+   __le16 aid;
struct ieee80211_info_element info_element; /* supported rates */
 } __attribute__ ((packed));
 
@@ -561,7 +561,7 @@ struct ieee80211_txb {
 };
 
 
-/* SWEEP TABLE ENTRIES NUMBER*/
+/* SWEEP TABLE ENTRIES NUMBER */
 #define MAX_SWEEP_TAB_ENTRIES42
 #define MAX_SWEEP_TAB_ENTRIES_PER_PACKET  7
 /* MAX_RATES_LENGTH needs to be 12.  The spec says 8, and many APs
@@ -791,8 +791,6 @@ extern struct net_device *alloc_ieee8021
 extern int ieee80211_set_encryption(struct ieee80211_device *ieee);
 
 /* ieee80211_tx.c */
-
-
 extern int ieee80211_xmit(struct sk_buff *skb,
  struct net_device *dev);
 extern void ieee80211_txb_free(struct ieee80211_txb *);
@@ -805,7 +803,7 @@ extern void ieee80211_rx_mgt(struct ieee
 struct ieee80211_hdr *header,
 struct ieee80211_rx_stats *stats);
 
-/* iee80211_wx.c */
+/* ieee80211_wx.c */
 extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
 struct iw_request_info *info,
 union iwreq_data *wrqu, char *key);
-
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


tg3: jumbo frames broken on BCM5721 in 2.6.12.2?

2005-08-04 Thread Zoran Dzelajlija
Hi, 

I can't get jumbo frames to work for tg3 under 2.6.12.2
or 2.6.11.7 (no patches added):

filestore# ip link set eth1 mtu 9000
SIOCSIFMTU: Invalid argument
filestore# ifconfig eth1 mtu 9000
SIOCSIFMTU: Invalid argument

I've also tried disabling the vlan devices, or setting them first, but no
cigar.

filestore# ifconfig -a
eth0  Link encap:Ethernet  HWaddr 00:30:48:82:9C:CE  
  inet addr:10.0.30.89  Bcast:10.0.30.255  Mask:255.255.255.0
  UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
  RX packets:120787 errors:0 dropped:0 overruns:0 frame:0
  TX packets:98242 errors:0 dropped:0 overruns:0 carrier:0
  collisions:0 txqueuelen:1000 
  RX bytes:8894695 (8.4 MiB)  TX bytes:11028364 (10.5 MiB)
  Interrupt:16 

eth1  Link encap:Ethernet  HWaddr 00:30:48:82:9C:CF  
  UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
  RX packets:581729751 errors:0 dropped:0 overruns:0 frame:0
  TX packets:491457289 errors:0 dropped:0 overruns:0 carrier:0
  collisions:0 txqueuelen:1000 
  RX bytes:2348687127 (2.1 GiB)  TX bytes:469377212 (447.6 MiB)
  Interrupt:17 

eth1.17   Link encap:Ethernet  HWaddr 00:30:48:82:9C:CF  
  inet addr:10.9.0.139  Bcast:10.9.0.143  Mask:255.255.255.248
  UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
  RX packets:338634049 errors:0 dropped:0 overruns:0 frame:0
  TX packets:94889196 errors:0 dropped:0 overruns:0 carrier:0
  collisions:0 txqueuelen:0 
  RX bytes:2109932095 (1.9 GiB)  TX bytes:2048359064 (1.9 GiB)

eth1.66   Link encap:Ethernet  HWaddr 00:30:48:82:9C:CF  
  inet addr:10.9.1.19  Bcast:10.9.1.23  Mask:255.255.255.248
  UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
  RX packets:238619718 errors:0 dropped:0 overruns:0 frame:0
  TX packets:396568422 errors:0 dropped:0 overruns:0 carrier:0
  collisions:0 txqueuelen:0 
  RX bytes:61603862 (58.7 MiB)  TX bytes:2979577911 (2.7 GiB)
[cut lo]
---
lspci -v
---
:00:00.0 Host bridge: Intel Corp. Server Memory Controller Hub (rev 05)
Subsystem: Super Micro Computer Inc: Unknown device 7480
Flags: bus master, fast devsel, latency 0
Capabilities: [e0] #09 [2109]

:00:01.0 PCI bridge: Intel Corp. Server Memory Controller Hub PCI Express 
Port (rev 05) (prog-if 00 [Normal decode])
Flags: bus master, fast devsel, latency 0
Bus: primary=00, secondary=01, subordinate=02, sec-latency=0
Memory behind bridge: d010-d02f
Prefetchable memory behind bridge: d000-d00f
Capabilities: [88] #0d []
Capabilities: [80] Power Management version 2
Capabilities: [90] Message Signalled Interrupts: 64bit- Queue=0/0 
Enable-
Capabilities: [a0] #10 [0141]

:00:02.0 VGA compatible controller: Intel Corp. Graphics Controller (rev 
05) (prog-if 00 [VGA])
Subsystem: Super Micro Computer Inc: Unknown device 7480
Flags: bus master, fast devsel, latency 0, IRQ 10
Memory at d050 (32-bit, non-prefetchable) [size=512K]
I/O ports at e000 [size=8]
Memory at c000 (32-bit, prefetchable) [size=256M]
Memory at d058 (32-bit, non-prefetchable) [size=256K]
Capabilities: [d0] Power Management version 2

:00:1c.0 PCI bridge: Intel Corp. 82801FB/FBM/FR/FW/FRW (ICH6 Family) PCI 
Express Port 1 (rev 03) (prog-if 00 [Normal decode])
Flags: bus master, fast devsel, latency 0
Bus: primary=00, secondary=03, subordinate=03, sec-latency=0
Memory behind bridge: d030-d03f
Capabilities: [40] #10 [0141]
Capabilities: [80] Message Signalled Interrupts: 64bit- Queue=0/0 
Enable-
Capabilities: [90] #0d []
Capabilities: [a0] Power Management version 2

:00:1c.1 PCI bridge: Intel Corp. 82801FB/FBM/FR/FW/FRW (ICH6 Family) PCI 
Express Port 2 (rev 03) (prog-if 00 [Normal decode])
Flags: bus master, fast devsel, latency 0
Bus: primary=00, secondary=04, subordinate=04, sec-latency=0
Memory behind bridge: d040-d04f
Capabilities: [40] #10 [0141]
Capabilities: [80] Message Signalled Interrupts: 64bit- Queue=0/0 
Enable-
Capabilities: [90] #0d []
Capabilities: [a0] Power Management version 2

:00:1d.0 USB Controller: Intel Corp. 82801FB/FBM/FR/FW/FRW (ICH6 Family) 
USB UHCI #1 (rev 03) (prog-if 00 [UHCI])
Subsystem: Super Micro Computer Inc: Unknown device 7480
Flags: bus master, medium devsel, latency 0, IRQ 23
I/O ports at e100 [size=32]

:00:1d.1 USB Controller: Intel Corp. 82801FB/FBM/FR/FW/FRW (ICH6 Family) 
USB UHCI #2 (rev 03) (prog-if 00 [UHCI])
Subsystem: Super Micro Computer Inc: Unknown device 7480
Flags: bus master, medium devsel, latency 0, IRQ 19
I/O ports at e200 [size=32]


networking problems when using gcc 4.0.1

2005-08-04 Thread Adrian Bunk
On Wed, Aug 03, 2005 at 08:53:52PM -0400, Mathieu Chouquet-Stringer wrote:
 
 Moreover I get some weird networking problems which prevent setting up the
 routes (RNETLINK invalid argument messages) when I compile my kernel with
 4.0.1 while the same kernel, same config works fine compiled with 3.2.3...
 
 So eventhough 4.0 is supposed to be supported, it doesn't work too well in
 my case.

I haven't heard of such a problem.

Please give a complete bug report:
- exact error messages
- kernel version
- self-compiled gcc or distrbution compiler?

 Mathieu Chouquet-Stringer

cu
Adrian

-- 

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

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


Re: [Bugme-new] [Bug 4952] New: IPSec incompabilty. Linux kernel waits to long to start using new SA for outbound traffic.

2005-08-04 Thread Herbert Xu
On Thu, Aug 04, 2005 at 06:48:18AM -0700, David S. Miller wrote:
 
 When you add an SA, you have to place it somewhere, don't you?
 And that where (be it one policy template, or many) are
 what you use to decide which policy for which to do the DST
 flush.

Unfortunately, it goes straight into the SADB as (daddr, spi, proto).
When policies are resolved during the xfrm_lookup for outbound
flows, the best SA is then found from the SADB by iterating
through all SAs with the same daddr as the template.

So given a policy you can easily find the SAs for it.  However,
going in the opposite direction requirs you to walk through all
policies.

I suppose we could add another cache that hashes all the policies
by their template destination addresses.
 
 Anyways, I'm not going to listen to the userland can fix this
 arguments any longer.  The kernel needs to implement consistency
 here, even if arguably stupid things occur.

Alright, let stupid things occur then :) But at least guard it
with a sysctl or something.

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


Re: [RFC] Net vm deadlock fix (preliminary)

2005-08-04 Thread Daniel Phillips
Hi,

I spent the last day mulling things over and doing research.  It seems to me 
that the patch as first posted is correct and solves the deadlock, except 
that some uses of __GFP_MEMALLOC in __dev_alloc_skb may escape into contexts 
where the reserve is not guaranteed to be reclaimed.  It may be that this 
does not actually happen, but there is enough different usage that I would 
rather err on the side of caution just now, and offer a variant called, e.g., 
dev_memalloc_skb so that drivers will explicitly have to choose to use it (or 
supply the flag to __dev_alloc_skb).  This is just a stack of inline 
functions so there should be no extra object code.  The dev_memalloc_skb 
variant can go away in time, but for now it does no harm.

A minor cleanup: somebody (Rik) complained about his bleeding eyes after 
reading my side-effecty alloc_skb expression, so that was rearranged in a way 
that should optimize to the same thing.

On the first write the patch, then do the research principle, the entire 
thread on this topic from the ksummit-2005-discuss mailing list is a good 
read:

http://thunker.thunk.org/pipermail/ksummit-2005-discuss/2005-March/thread.html#186

Matt, you are close to the truth here:

http://thunker.thunk.org/pipermail/ksummit-2005-discuss/2005-March/000242.html

but this part isn't right: it's important to note here that making progress 
may require M acknowledgements to N packets representing a single IO. So we 
need separate send and acknowledge pools for each SO_MEMALLOC socket so that 
we don't find ourselves wedged with M-1 available mempool slots when we're 
waiting on ACKs.  This erroneously assumes that mempools throttle the block 
IO traffic.  In fact, the throttling _must_ take place higher up, in the 
block IO stack.  The block driver that submits the network IO must 
pre-account any per-request resources and block until sufficient resources 
become available.  So the accounting would include both space for transmit 
and acknowledge, and the network block IO protocol must be designed to obey 
that accounting.  (I will wave my hands at the question of how we arrange for 
low-level components to communicate their resource needs to high-level 
throttlers, just for now.)

Andrea, also getting close:

http://thunker.thunk.org/pipermail/ksummit-2005-discuss/2005-March/000200.html

But there is no need to be random.  Short of actually overlowing the input 
ring buffer, we can be precise about accepting all block IO packets and 
dropping non-blockio traffic as necessary.

Rik, not bad:

http://thunker.thunk.org/pipermail/ksummit-2005-discuss/2005-March/000218.html

particularly for deducing it from first principles without actually looking at 
the network code ;-)  It is even the same socket flag name as I settled on 
(SO_MEMALLOC).  But step 4 veers off course: out of order does not matter.  
And the conclusion that we can throttle here by dropping non-blockio packets 
is not right: the packets that we got from reserve still can live an 
arbitrary time in the protocol stack, so we could still exhaust the reserve 
and be back to the same bad old deadlock conditions.

Everybody noticed that dropping non-blockio packets is key, and everybody 
missed the fact that softnet introduces additional queues that need 
throttling (which can't be done sanely) or bypassing.  Almost everybody 
noticed that throttling in the block IO submission path is non-optional.

Everybody thought that mempool is the one true way of reserving memory.  I am 
not so sure, though I still intend to produce a mempool variant of the patch.  
One problem I see with mempool is that it not only reserves resources, but 
pins them.  If the kernel is full of mempools pinning memory pages here and 
there, physical defragmentation gets that much harder and the buddy tree will 
fragment that much sooner.  The __GPF_MEMALLOC interface does not have this 
problem because pages stay in the global pool.  So the jury is still out on 
which method is better.

Obviously, to do the job properly, __GPF_MEMALLOC would need a way of resizing 
the memalloc reserve as users are loaded and unloaded.  Such an interface can 
be very lightweight.  I will cook one up just to demonstrate this.

Now, the scheme in my patch does the job and I think it does it in a way that 
works for all drivers, even e1000 (by method 1. in the thread above).  But we 
could tighten this up a little by noticing that it doesn't actually matter 
which socket buffer we return to the pool as long as we are sure to return 
the same amount of memory as we withdrew.  Therefore, we could just account 
the number of pages alloc_skb withdraws, and the number that freeing a packet 
returns.  The e1000 driver would look at this number to determine whether to 
mark a packet as from_reserve or not.  That way, the e1000 driver could set 
things in motion to release reserve resources sooner, rather than waiting for 
certain specially flagged skbs to work their way around the 

Re: [PATCH] add new nfnetlink_log subsystem

2005-08-04 Thread Harald Welte
On Thu, Aug 04, 2005 at 06:50:42AM -0700, David S. Miller wrote:
 From: Andi Kleen [EMAIL PROTECTED]
 Subject: Re: [PATCH] add new nfnetlink_log subsystem
 Date: Thu, 4 Aug 2005 00:19:41 +0200
 
   no, it hasn't.  I am travelling and don't have the space for a
   debian/i386 installation in addition to the debian/x86_64 on this box,
   sorry :(
  
  That sounds risky. I would ask for this stuff not being merged before
  it isn't tested.
 
 Andi, stop this, you yourself, can test and verify this and suggest
 changes to the protocol structure layout if you want to.

I understand Andi's reasons and they're perfectly valid.  

When I started to get involved with netfilter/iptables, I didn't know
about the 32/64bit and alignment issues that exist in kernel/userspace
interfaces at all.  During the years however, I've suffered enough of
this for the rest of my life.

At this time I can assure him that greatest care was taken to not run
into any endian, 32/64, alignment or other issues - at least to the
degree of my (maybe limited) knowledge of this matter.

I have scheduled testing over the next week, although it's a bit
exhausting (and I'm too lazy) to test all the possible
arch/endian/... combinations.

 [...] more than ample time to do this, as this feature is
 scheduled to go into 2.6.14 and we haven't even gotten 2.6.13 out
 the door yet :-)

ACK.  

-- 
- Harald Welte [EMAIL PROTECTED]  http://gnumonks.org/

Privacy in residential applications is a desirable marketing option.
  (ETSI EN 300 175-7 Ch. A6)


pgpwjezAPI6l1.pgp
Description: PGP signature


Re: [PATCH] add new nfnetlink_log subsystem

2005-08-04 Thread Andi Kleen
 Unless I'm overlooking something, to the best of my knowledge I don't
 think we could still run into any trouble here.

Still risky.

Here's a different idea. Define a new aligned u64 type and use that
on i386 too.

Like

/* Must be #define because __attribute__ doesn't work on typedefs */
#define __aligned_u64 unsigned long long __attribute__((aligned(8)))


Then use __aligned_u64 instead of plain __u64 in all user visible parts. 
Should DTRT in all cases.

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


Re: [PATCH] add new nfnetlink_log subsystem

2005-08-04 Thread Harald Welte
On Thu, Aug 04, 2005 at 06:49:46AM -0700, David S. Miller wrote:
 From: Harald Welte [EMAIL PROTECTED]
 Date: Thu, 4 Aug 2005 00:03:53 +0200
 
  However, all nfnetlink-based protocols are supposed to be both endian
  and 32/64 as well as alignment (*) safe.   the protocol definitions
  always use u_intXX_t types, all network byte order, and no kernel pointers
  passed to userspace or similar crap ;)
 
 You cannot use u64 objects, even though that is supposed to
 be a portable type.  i386 does not align u64's on an 8-byte
 boundary, whereas every sane platform in the world (including
 x86_64) does.
 
 This is where the compatability problems come from.

We only have one case where 64byte types are used: timestamps.  the
structure consists of two u_int64_t members - nothing before that and
nothing behind (so no padding required).  This structure
(nfqnl_msg_packet_timestamp and nfulnl_msg_packet_timestamp) is put into
one nfattr (like rtattr).

Also, this data structure is only passed from kernel-userspace, and
kernel will always be 64bit (who has more stringend alignment rules). 

Even if we chose to send it from userspace to kernel at some point in
the future, it would be something that i386 userspace would have to take
care of, not the kernel.

Unless I'm overlooking something, to the best of my knowledge I don't
think we could still run into any trouble here.

-- 
- Harald Welte [EMAIL PROTECTED]  http://gnumonks.org/

Privacy in residential applications is a desirable marketing option.
  (ETSI EN 300 175-7 Ch. A6)


pgpFkxSoOM0qe.pgp
Description: PGP signature


Re: 2.6.13-rc4 - kernel panic - BUG at net/ipv4/tcp_output.c:918

2005-08-04 Thread Andrew Morton
Guillaume Pelat [EMAIL PROTECTED] wrote:

 Hi,
 
 Herbert Xu wrote:
  On Thu, Aug 04, 2005 at 01:33:29PM +1000, herbert wrote:
  
 So I suppose we should reset cwnd_quota after tcp_transmit_skb?
  
  Please try this patch to see if this is really the problem or not.
  
  Thanks,
 
 I just applied your patch, and it seems to work :)
 2 hours uptime, and no crash yet (without the patch, it was crashing a 
 few mins only after booting).
 So i think the bug is crushed :)
 

Thanks, Guillaume.  Herbert, David is travelling and not able to do a lot
of patchmonkeying.  Could you please prepare and submit a final patch?

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


Re: Resend: [RFC/PATCH] safer ipv4 reassembly

2005-08-04 Thread Arthur Kepner


On Sun, 31 Jul 2005, Herbert Xu wrote:


 Anyway, here is a patch to use inetpeer instead of that icky ipc
 structure.? It sure cuts down the size of the patch :)
 

Herbert;

I've been using the updated patch, and I like it. struct inet_peer
is the right place to do this accounting.

I made a few bug fixes and have tested it, tried to break it, etc.
Seems to do the trick. The latest iteration is attached. Please have
a look.

Regards.

--
Arthur
diff -pur linux.orig/include/linux/sysctl.h linux.new/include/linux/sysctl.h
--- linux.orig/include/linux/sysctl.h   2005-08-03 11:43:40.923892254 -0700
+++ linux.new/include/linux/sysctl.h2005-08-04 16:58:17.901171101 -0700
@@ -352,6 +352,7 @@ enum
NET_TCP_BIC_BETA=108,
NET_IPV4_ICMP_ERRORS_USE_INBOUND_IFADDR=109,
NET_TCP_CONG_CONTROL=110,
+   NET_IPV4_IPFRAG_MAX_DIST=111,
 };
 
 enum {
diff -pur linux.orig/include/net/inetpeer.h linux.new/include/net/inetpeer.h
--- linux.orig/include/net/inetpeer.h   2005-08-03 11:44:01.778605212 -0700
+++ linux.new/include/net/inetpeer.h2005-08-04 16:58:38.694360121 -0700
@@ -25,6 +25,7 @@ struct inet_peer
__u32   v4daddr;/* peer's address */
__u16   avl_height;
__u16   ip_id_count;/* IP ID for the next packet */
+   atomic_trid;/* Frag reception counter */
__u32   tcp_ts;
unsigned long   tcp_ts_stamp;
 };
diff -pur linux.orig/include/net/ip.h linux.new/include/net/ip.h
--- linux.orig/include/net/ip.h 2005-08-03 11:44:08.654654565 -0700
+++ linux.new/include/net/ip.h  2005-08-04 16:58:50.460109760 -0700
@@ -45,6 +45,7 @@ struct inet_skb_parm
 #define IPSKB_TRANSLATED   2
 #define IPSKB_FORWARDED4
 #define IPSKB_XFRM_TUNNEL_SIZE 8
+#define IPSKB_FRAG_COMPLETE16
 };
 
 struct ipcm_cookie
diff -pur linux.orig/net/ipv4/inetpeer.c linux.new/net/ipv4/inetpeer.c
--- linux.orig/net/ipv4/inetpeer.c  2005-08-03 11:44:40.086627938 -0700
+++ linux.new/net/ipv4/inetpeer.c   2005-08-04 16:59:20.251440976 -0700
@@ -401,6 +401,7 @@ struct inet_peer *inet_getpeer(__u32 dad
return NULL;
n-v4daddr = daddr;
atomic_set(n-refcnt, 1);
+   atomic_set(n-rid, 0);
n-ip_id_count = secure_ip_id(daddr);
n-tcp_ts_stamp = 0;
 
diff -pur linux.orig/net/ipv4/ip_fragment.c linux.new/net/ipv4/ip_fragment.c
--- linux.orig/net/ipv4/ip_fragment.c   2005-08-03 11:44:48.086712630 -0700
+++ linux.new/net/ipv4/ip_fragment.c2005-08-04 17:03:02.162971536 -0700
@@ -22,6 +22,7 @@
  * Patrick McHardy :   LRU queue of frag heads for evictor.
  */
 
+#include linux/compiler.h
 #include linux/config.h
 #include linux/module.h
 #include linux/types.h
@@ -38,6 +39,7 @@
 #include net/ip.h
 #include net/icmp.h
 #include net/checksum.h
+#include net/inetpeer.h
 #include linux/tcp.h
 #include linux/udp.h
 #include linux/inet.h
@@ -56,6 +58,8 @@
 int sysctl_ipfrag_high_thresh = 256*1024;
 int sysctl_ipfrag_low_thresh = 192*1024;
 
+int sysctl_ipfrag_max_dist = 64;
+
 /* Important NOTE! Fragment queue must be destroyed before MSL expires.
  * RFC791 is wrong proposing to prolongate timer each fragment arrival by TTL.
  */
@@ -90,8 +94,11 @@ struct ipq {
atomic_trefcnt;
struct timer_list timer;/* when will this queue expire? 
*/
struct ipq  **pprev;
-   int iif;
struct timeval  stamp;
+   int iif;
+
+   unsigned intrid;
+   struct inet_peer *peer;
 };
 
 /* Hash table. */
@@ -207,6 +214,9 @@ static void ip_frag_destroy(struct ipq *
BUG_TRAP(qp-last_inCOMPLETE);
BUG_TRAP(del_timer(qp-timer) == 0);
 
+   if (qp-peer)
+   inet_putpeer(qp-peer);
+
/* Release all fragment data. */
fp = qp-fragments;
while (fp) {
@@ -366,6 +376,9 @@ static struct ipq *ip_frag_create(unsign
qp-meat = 0;
qp-fragments = NULL;
qp-iif = 0;
+   qp-peer = sysctl_ipfrag_max_dist ? inet_getpeer(iph-saddr, 1) : NULL;
+   if (qp-peer) 
+   qp-rid = atomic_read(qp-peer-rid);
 
/* Initialize a timer for this entry. */
init_timer(qp-timer);
@@ -410,6 +423,63 @@ static inline struct ipq *ip_find(struct
return ip_frag_create(hash, iph, user);
 }
 
+/* Is the fragment too far ahead to be part of ipq? */
+static inline int ip_frag_too_far(struct ipq *qp)
+{
+   struct inet_peer *peer = qp-peer;
+   unsigned int max = sysctl_ipfrag_max_dist;
+   unsigned int start, end;
+
+   int rc;
+
+   if (!peer || !max)
+   return 0;
+
+   start = ++qp-rid;
+   end   = atomic_inc_return(peer-rid);
+
+   rc = qp-fragments  (end - start) = max;
+
+   if (rc) {
+   IP_INC_STATS_BH(IPSTATS_MIB_REASMFAILS);
+   }
+
+   return rc;
+}
+
+static int 

Re: [TCP]: Fix TSO cwnd caching bug

2005-08-04 Thread Andrew Morton
Herbert Xu [EMAIL PROTECTED] wrote:

 On Thu, Aug 04, 2005 at 04:58:42PM -0700, Andrew Morton wrote:
   
   Thanks, Guillaume.  Herbert, David is travelling and not able to do a lot
   of patchmonkeying.  Could you please prepare and submit a final patch?
 
  OK, here is the final version.

Thanks.

  It depends on the patch that David
  posted earlier on in this thread.  Please let me know if you need a
  copy of that.

Yes please.
-
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


[Question]No memory release after enlarge fib_info hash table

2005-08-04 Thread Yan Zheng

linux 2.6.12.3

net/ipv4/fib_semantics.c:line 679


   if (fib_info_cnt = fib_hash_size) {
   unsigned int new_size = fib_hash_size  1;
   struct hlist_head *new_info_hash;
   struct hlist_head *new_laddrhash;
   unsigned int bytes;

   if (!new_size)
   new_size = 1;
   bytes = new_size * sizeof(struct hlist_head *);
   new_info_hash = fib_hash_alloc(bytes);
   new_laddrhash = fib_hash_alloc(bytes);
   if (!new_info_hash || !new_laddrhash) {
   fib_hash_free(new_info_hash, bytes);
   fib_hash_free(new_laddrhash, bytes);
   } else {
   memset(new_info_hash, 0, bytes);
   memset(new_laddrhash, 0, bytes);

   fib_hash_move(new_info_hash, new_laddrhash,
new_size);
   }

   if (!fib_hash_size)
   goto failure;
   }

In fib_hash_move, there is no code call fib_hash_free to release memory
used by old hash table.  after call fib_hash_move,  fib_info_hash and
fib_info_laddrhash  are  the new memory addresses , old addresses  are
lost. Is this a bug?

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


atheros driver - desc

2005-08-04 Thread Mateusz Berezecki

Hi list members,

I just post the code for review for anyone interested.
I would be more than pleased to hear some feedback from you on the code.

Im sending a series of 8 patches splitted and diffed as in 
SubmittingPatches documentation.


The driver is not yet fully working because I didn't finish kernel 
integration yet. Almost all
driver I/O ops are reverse engineered independently of openbsd openhal 
which is missing just too much.



Ok, enough talking. Most of the atheros 5212 hal is now open :)

sending patches...

Mateusz

-
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


atheros driver (1/8)

2005-08-04 Thread Mateusz Berezecki


--- netdev-2.6.git#ieee80211/drivers/net/wireless/Kconfig	2005-08-02 13:18:21.0 +0200
+++ netdev-atheros/drivers/net/wireless/Kconfig	2005-08-05 03:43:32.0 +0200
@@ -459,6 +459,14 @@ config PRISM54
 	  say M here and read file:Documentation/modules.txt.  The module
 	  will be called prism54.ko.
 
+comment Atheros combo cardbus cards support
+config PCMCIA_ATHEROS_5212
+	tristate Atheros 5212 (a/b/g) combo cards
+	depends on NET_RADIO  EXPERIMENTAL  PCMCIA
+	---help---
+	  Experimental support for Atheros radio chips.
+
+	
 # yes, this works even when no drivers are selected
 config NET_WIRELESS
 	bool
diff -uprN -X 'netdev-2.6.git#ieee80211/Documentation/dontdiff' netdev-2.6.git#ieee80211/drivers/net/wireless/Makefile netdev-atheros/drivers/net/wireless/Makefile
--- netdev-2.6.git#ieee80211/drivers/net/wireless/Makefile	2005-08-02 13:18:22.0 +0200
+++ netdev-atheros/drivers/net/wireless/Makefile	2005-08-05 03:48:17.0 +0200
@@ -35,3 +35,5 @@ obj-$(CONFIG_PRISM54)		+= prism54/
 # 16-bit wireless PCMCIA client drivers
 obj-$(CONFIG_PCMCIA_RAYCS)	+= ray_cs.o
 obj-$(CONFIG_PCMCIA_WL3501)	+= wl3501_cs.o
+
+obj-$(CONFIG_PCMCIA_ATHEROS_5212) += atheros/atheros5212/
diff -uprN -X 'netdev-2.6.git#ieee80211/Documentation/dontdiff' netdev-2.6.git#ieee80211/drivers/net/wireless/atheros/atheros5212/Makefile netdev-atheros/drivers/net/wireless/atheros/atheros5212/Makefile
--- netdev-2.6.git#ieee80211/drivers/net/wireless/atheros/atheros5212/Makefile	1970-01-01 01:00:00.0 +0100
+++ netdev-atheros/drivers/net/wireless/atheros/atheros5212/Makefile	2005-08-05 03:51:53.0 +0200
@@ -0,0 +1,3 @@
+atheros5212-objs := init.o eeprom.o beacons.o powermodes.o keys.o mode_tables.o regops.o interrupts.o caps.o chans.o transmit_receive.o mode_tables.o other.o ioctl.o
+
+obj-$(CONFIG_PCMCIA_ATHEROS_5212) += atheros5212.o



atheros driver (3/8)

2005-08-04 Thread Mateusz Berezecki


diff -uprN -X 'netdev-2.6.git#ieee80211/Documentation/dontdiff' netdev-2.6.git#ieee80211/drivers/net/wireless/atheros/atheros5212/beacons.c netdev-atheros/drivers/net/wireless/atheros/atheros5212/beacons.c
--- netdev-2.6.git#ieee80211/drivers/net/wireless/atheros/atheros5212/beacons.c	1970-01-01 01:00:00.0 +0100
+++ netdev-atheros/drivers/net/wireless/atheros/atheros5212/beacons.c	2005-08-05 03:48:36.0 +0200
@@ -0,0 +1,235 @@
+/*
+ * All the work was created by reverse engineering and porting
+ * for interoperability. The creator is Mateusz Berezecki,
+ * unless explicitly marked ( some parts are derived
+ * from GPL'ed parts of madwifi project located at http://madwifi.sf.net)
+ *
+ * derived or copied parts of code licensed under
+ * dual GPL/BSD license
+ * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
+ * All rights reserved.
+ * 
+ * rest of the code has been reversed by me and is under copyright too
+ * Copyright (C) 2005  Mateusz Berezecki
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ */
+
+#include linux/config.h
+#include linux/kernel.h
+#include linux/module.h
+#include linux/version.h
+#include linux/init.h
+#include linux/delay.h
+#include linux/pci.h
+#include linux/netdevice.h
+
+#include net/ieee80211.h
+
+#include linux/wireless.h
+#include net/iw_handler.h
+
+#include atheros_id.h
+#include atheros_dev.h
+#include atheros_defs.h
+//#include atheros_devops.h
+//#include atheros_regops.h
+#include atheros_registers.h
+#include atheros.h
+
+
+
+
+void ath_beacon_init(struct net_device *netdev, unsigned int nextbtt,
+		unsigned int intval)
+{
+	struct atheros_priv *pdata = ieee80211_priv(netdev);
+	struct ieee80211_device *dev = netdev_priv(netdev);
+	unsigned int val;
+	
+	ath_reg_write(netdev, AR5212_TIMER0, nextbtt);
+
+	switch (dev-iw_mode) {
+		case IW_MODE_MONITOR:
+		case IW_MODE_INFRA:
+			ath_reg_write(netdev,
+AR5212_TIMER1,
+0x);
+			ath_reg_write(netdev,
+AR5212_TIMER2, 
+0x7); 
+			break;
+			
+		case IW_MODE_ADHOC:
+			ath_reg_write(netdev,
+AR5212_TIMER1, 
+(nextbtt - 2)  3);
+			ath_reg_write(netdev,
+AR5212_TIMER2,
+(nextbtt - 10)  3);
+			break;
+			
+		default:
+			break;
+	}
+
+	ath_reg_write(netdev, AR5212_TIMER3, nextbtt + 
+		  (pdata-atim_win ? pdata-atim_win : 1));
+	
+	val = intval  
+		(AR5212_BEACON_PERIOD | 
+		 AR5212_BEACON_RESET_TSF |
+		 AR5212_BEACON_ENABLE);
+	
+	if (val  AR5212_BEACON_RESET_TSF)
+		ath_reg_write(netdev, AR5212_BEACON, 
+AR5212_BEACON_RESET_TSF); 
+	
+	ath_reg_write(netdev, AR5212_BEACON, val);
+}
+
+void ath_reset_station_btimers(struct net_device *netdev)
+{
+	int tmp;
+
+	ath_reg_write(netdev, AR5212_TIMER0, 0);
+	tmp = (ath_reg_read(netdev, AR5212_STA_ID1) 
+			| AR5212_STA_ID1_PWR_SV)  
+			~(AR5212_STA_ID1_DEFAULT_ANTENNA |
+			AR5212_STA_ID1_PCF); 
+	
+	
+	ath_reg_write(netdev, AR5212_BEACON, 0x);
+	return;
+}
+
+void ath_set_station_btimers(struct net_device *netdev, 
+		struct beacon_state *state, unsigned int tsf,
+		unsigned int dtcx, unsigned int cfpcx)
+{
+	unsigned int tmp, dtimp, nextt;
+	unsigned int bintval;
+	
+	if (state-bs_cfpperiod) {
+		tmp = ath_reg_read(netdev, AR5212_STA_ID1);
+		tmp |= AR5212_STA_ID1_PCF;
+		
+		ath_reg_write(netdev, AR5212_STA_ID1, tmp);
+		
+		ath_reg_write(netdev, AR5212_CFP_PERIOD, 
+state-bs_cfpperiod *
+state-bs_dtimperiod * 
+state-bs_intval);
+		
+		ath_reg_write(netdev, AR5212_CFP_DUR, 
+state-bs_cfpmaxduration);
+		
+		ath_reg_write(netdev, AR5212_TIMER2, 
+			((tsf + 
+			((cfpcx * state-bs_dtimperiod + dtcx) *
+			 state-bs_intval)))  3);
+	} else 
+		ath_reg_disable(netdev, 
+			AR5212_STA_ID1,
+			AR5212_STA_ID1_PCF);
+
+	
+	bintval = state-bs_intval;
+	
+	ath_reg_write(netdev, AR5212_TIMER0, state-bs_nexttbtt);
+
+	tmp = ath_reg_read(netdev, AR5212_BEACON)  0xff80;
+	tmp |= state-bs_intval  0x;
+
+	if (state-bs_timoffset) {
+		tmp |= ((state-bs_timoffset + 4)  16)  0x7f;
+	} else {
+		tmp |= (4  16)  0x7f;
+	}
+
+	ath_reg_write(netdev, AR5212_BEACON, tmp);
+
+	
+	if (state-bs_bmissthreshold = (0xff00  8)) {
+		BUG();
+		return;
+	}
+
+	tmp = ath_reg_read(netdev, AR5212_RSSI_THR)  (~0xff00);
+	tmp |= (state-bs_bmissthreshold  8)  0xff00;
+	ath_reg_write(netdev, AR5212_RSSI_THR, tmp);
+
+	
+	

atheros driver (5/8)

2005-08-04 Thread Mateusz Berezecki


diff -uprN -X 'netdev-2.6.git#ieee80211/Documentation/dontdiff' netdev-2.6.git#ieee80211/drivers/net/wireless/atheros/atheros5212/init.c netdev-atheros/drivers/net/wireless/atheros/atheros5212/init.c
--- netdev-2.6.git#ieee80211/drivers/net/wireless/atheros/atheros5212/init.c	1970-01-01 01:00:00.0 +0100
+++ netdev-atheros/drivers/net/wireless/atheros/atheros5212/init.c	2005-08-05 03:48:36.0 +0200
@@ -0,0 +1,788 @@
+/*
+ * All the work was created by reverse engineering and porting
+ * for interoperability. The creator is Mateusz Berezecki,
+ * unless explicitly marked ( some parts are derived
+ * from GPL'ed parts of madwifi project located at http://madwifi.sf.net)
+ *
+ * derived or copied parts of code licensed under
+ * dual GPL/BSD license
+ * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
+ * All rights reserved.
+ * 
+ * rest of the code has been reversed by me are under copyright too... should they?:P
+ * Copyright (C) 2005  Mateusz Berezecki
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ */
+
+#include linux/config.h
+#include linux/kernel.h
+#include linux/module.h
+#include linux/version.h
+#include linux/init.h
+#include linux/delay.h
+#include linux/pci.h
+#include linux/netdevice.h
+
+#include net/ieee80211.h
+
+#include linux/wireless.h
+#include net/iw_handler.h
+
+#include atheros_id.h
+#include atheros_dev.h
+#include atheros_defs.h
+#include atheros_registers.h
+#include atheros.h
+#include eeprom.h
+#include interrupts.h
+#include regops.h
+#include powermodes.h
+#include transmit_receive.h
+#include chans.h
+
+struct net_device *atheros_card = NULL;
+
+unsigned int ath_radio(struct net_device *netdev)
+{
+	unsigned int ret = 0,val = 0;
+	unsigned int i;
+	
+	ath_reg_write(netdev, 0x9800 + (0x34  2), 0x1c16);
+	
+	for (i = 0; i  8; i++)
+		ath_reg_write(netdev, 0x9800 + (0x20  2), 0x1);
+
+	val = ath_reg_read(netdev, 0x9800 + (256  2));
+	val = (val  24)  0xff;
+	val = (val  0xf0)  4;
+	val |= ((val  0x0f)  4);
+	
+	for (i = 0; i  8; i++) {
+		ret = (ret  1) | (val  1);
+		val = val  1;
+	}
+	
+	return ret;
+}
+
+unsigned int ath_selftest(struct net_device *netdev)
+{
+	unsigned int i, j;
+	unsigned int regs[2] = { 0x8000, 0x9800 + (8  2) };
+	unsigned int vals[2];
+	unsigned int values[4] = { 
+		0x, 0x,
+		0x, 0x 
+	};
+	
+	for (i = 0; i  2; i++) {
+		unsigned int addr = regs[i];
+		unsigned int wdata, rdata;
+		
+		vals[i] = ath_reg_read(netdev, addr);
+		
+		for (j = 0; j  256; j++) {
+			wdata = (j  16) | j;
+			ath_reg_write(netdev, addr, wdata);
+			rdata = ath_reg_read(netdev, addr);
+			if (wdata != rdata) {
+printk(KERN_DEBUGatheros:(%d) read %x exp. %x\n,
+	j, rdata, wdata);
+return 0;
+			}
+		}
+
+		for (j = 0; j  4; j++) {
+			unsigned int tmp;
+			ath_reg_write(netdev, regs[i], values[j]);
+			tmp = ath_reg_read(netdev, regs[i]);
+			if (values[j] != tmp) {
+printk(KERN_DEBUGatheros: 2nd loop\n);
+return 0;
+			}
+		}
+		ath_reg_write(netdev, regs[i], vals[i]);
+	}
+	udelay(100);
+	return 1;
+}
+
+unsigned int ath_set_reset_register(struct net_device *netdev, 
+unsigned int rmask)
+{
+	unsigned int mask = rmask ? rmask : ~0;
+	unsigned int t;
+	
+	
+	ath_reg_read(netdev, 0x000c);
+	ath_reg_write(netdev, 0x4000, rmask);
+	udelay(15);
+
+	mask = (0x0001 | 0x0002);
+	rmask = (0x0001 | 0x0002);
+	t = ath_timed_read(netdev, 0x4000, mask, rmask);
+	
+	if ((rmask  1) == 0) {
+		ath_reg_write(netdev, 0x14, 0);
+		if (!ath_set_power_mode(netdev, 2, 1, 0))
+			return t;
+		ath_reg_read(netdev, 0xc0);
+	}
+	return t;
+}
+
+unsigned int ath_prep_reset(struct net_device *netdev)
+{
+	return 1;
+}
+
+unsigned int ath_chip_reset(struct net_device *netdev, void *unused)
+{
+	
+	if (!ath_set_reset_register(netdev, 0x13)) {
+		printk(KERN_DEBUGatheros: if 1 (warm reset)\n);
+		return 0;
+	}
+
+	if (!ath_set_power_mode(netdev, 2, 1, 0)) {
+		printk(KERN_DEBUGatheros: if #2 (power mode)\n);
+		return 0;
+	}
+
+	if (!ath_set_reset_register(netdev, 0)) {
+		printk(KERN_DEBUGatheros: if 3 (cold reset)\n);
+		return 0;
+	}
+
+	if (unused == NULL)
+		return 1;
+
+	return 0;
+}
+
+unsigned int ath_reset(struct net_device *netdev)
+{
+	return 0;
+}
+
+struct chip_gain_desc athgaindesc = {
+	.entrycnt = 9,
+	.defentry = 4,
+	

atheros driver (6/8)

2005-08-04 Thread Mateusz Berezecki


diff -uprN -X 'netdev-2.6.git#ieee80211/Documentation/dontdiff' netdev-2.6.git#ieee80211/drivers/net/wireless/atheros/atheros5212/ioctl.c netdev-atheros/drivers/net/wireless/atheros/atheros5212/ioctl.c
--- netdev-2.6.git#ieee80211/drivers/net/wireless/atheros/atheros5212/ioctl.c	1970-01-01 01:00:00.0 +0100
+++ netdev-atheros/drivers/net/wireless/atheros/atheros5212/ioctl.c	2005-08-05 03:48:36.0 +0200
@@ -0,0 +1,590 @@
+/*
+ * All the work was created by reverse engineering and porting
+ * for interoperability. The creator is Mateusz Berezecki,
+ * unless explicitly marked ( some parts are derived
+ * from GPL'ed parts of madwifi project located at http://madwifi.sf.net)
+ *
+ * derived or copied parts of code licensed under
+ * dual GPL/BSD license
+ * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
+ * All rights reserved.
+ * 
+ * rest of the code has been reverse engineered by Mateusz Berezecki
+ * Copyright (C) 2005  Mateusz Berezecki
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ */
+
+#include linux/config.h
+#include linux/kernel.h
+#include linux/module.h
+#include linux/version.h
+#include linux/init.h
+#include linux/delay.h
+#include linux/pci.h
+#include linux/netdevice.h
+
+#include net/iw_handler.h
+#include linux/wireless.h
+#include net/ieee80211.h
+
+#include atheros_id.h
+#include atheros_dev.h
+#include atheros_defs.h
+#include atheros_registers.h
+#include atheros.h
+#include eeprom.h
+#include interrupts.h
+#include regops.h
+#include powermodes.h
+#include transmit_receive.h
+#include chans.h
+
+
+/*
+ * These are just templates for future expansion. I would have done
+ * that already but unfortunately I have to get familiar with
+ * new ieee80211 API first... Help!!! ;-p
+ */
+
+int ath_ioctl_giwname(struct net_device *netdev, struct iw_request_info *info, 
+		char *name, char *extra)
+{
+	struct ieee80211_device *dev = netdev_priv(netdev);
+	
+	switch (dev-mode) {
+		case IEEE_A:
+			strncpy(name, IEEE 802.11a, IFNAMSIZ);
+			break;
+		case IEEE_B:
+			strncpy(name, IEEE 802.11b, IFNAMSIZ);
+			break;
+		case IEEE_G:
+			strncpy(name, IEEE 802.11b, IFNAMSIZ);
+			break;
+		default:
+			strncpy(name, IEEE 802.11, IFNAMSIZ);
+			break;
+	}
+
+	return 0;
+}
+EXPORT_SYMBOL(ath_ioctl_giwname);
+
+int ath_ioctl_siwencode(struct net_device *netdev, 
+		struct iw_request_info *info,
+		struct iw_point *erq, char *extra)
+{
+	/* not yet supported */
+	return -1;
+}
+EXPORT_SYMBOL(ath_ioctl_siwencode);
+
+int ath_ioctl_giwencode(struct net_device *netdev, 
+		struct iw_request_info *info, 
+		struct iw_point *erq, char *extra)
+{
+	/* not yet supported */
+	return -1;
+}
+EXPORT_SYMBOL(ath_ioctl_giwencode);
+
+int ath_ioctl_siwrate(struct net_device *netdev, 
+		struct iw_request_info *info, 
+		struct iw_param *erq, char *extra)
+{
+	return -1;
+}
+EXPORT_SYMBOL(ath_ioctl_siwrate);
+
+int ath_ioctl_giwrate(struct net_device *netdev, struct iw_request_info *info, struct iw_param *erq, char *extra)
+{
+	return -1;
+}
+EXPORT_SYMBOL(ath_ioctl_giwrate);
+
+int ath_ioctl_siwsens(struct net_device *netdev, struct iw_request_info *info, struct iw_param *erq, char *extra)
+{
+	return -1;
+}
+EXPORT_SYMBOL(ath_ioctl_siwsens);
+
+int ath_ioctl_giwsens(struct net_device *netdev, struct iw_request_info *info, struct iw_param *erq, char *extra)
+{
+	return -1;
+}
+EXPORT_SYMBOL(ath_ioctl_giwsens);
+
+int ath_ioctl_siwrts(struct net_device *netdev, struct iw_request_info *info, struct iw_param *erq, char *extra)
+{
+	return -1;
+}
+EXPORT_SYMBOL(ath_ioctl_siwrts);
+
+int ath_ioctl_giwrts(struct net_device *netdev, struct iw_request_info *info, struct iw_param *erq, char *extra)
+{
+	return -1;
+}
+EXPORT_SYMBOL(ath_ioctl_giwrts);
+
+int ath_ioctl_siwfrag(struct net_device *netdev, struct iw_request_info *info, struct iw_param *erq, char *extra)
+{
+	return -1;
+}
+EXPORT_SYMBOL(ath_ioctl_siwfrag);
+
+int ath_ioctl_giwfrag(struct net_device *netdev, struct iw_request_info *info, struct iw_param *erq, char *extra)
+{
+	return -1;
+}
+EXPORT_SYMBOL(ath_ioctl_giwfrag);
+
+int ath_ioctl_siwap(struct net_device *netdev, struct iw_request_info *info, struct sockaddr *erq, char *extra)
+{
+	return -1;
+}
+EXPORT_SYMBOL(ath_ioctl_siwap);
+
+int ath_ioctl_giwap(struct net_device *netdev, struct iw_request_info 

atheros driver (7/8)

2005-08-04 Thread Mateusz Berezecki


diff -uprN -X 'netdev-2.6.git#ieee80211/Documentation/dontdiff' netdev-2.6.git#ieee80211/drivers/net/wireless/atheros/atheros5212/keys.c netdev-atheros/drivers/net/wireless/atheros/atheros5212/keys.c
--- netdev-2.6.git#ieee80211/drivers/net/wireless/atheros/atheros5212/keys.c	1970-01-01 01:00:00.0 +0100
+++ netdev-atheros/drivers/net/wireless/atheros/atheros5212/keys.c	2005-08-05 03:48:36.0 +0200
@@ -0,0 +1,268 @@
+/*
+ * All the work was created by reverse engineering and porting
+ * for interoperability. The creator is Mateusz Berezecki,
+ * unless explicitly marked ( some parts are derived
+ * from GPL'ed parts of madwifi project located at http://madwifi.sf.net)
+ *
+ * derived or copied parts of code licensed under
+ * dual GPL/BSD license
+ * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
+ * All rights reserved.
+ * 
+ * rest of the code has been reversed by me and is under copyright too
+ * Copyright (C) 2005  Mateusz Berezecki
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ */
+#include linux/config.h
+#include linux/kernel.h
+#include linux/module.h
+#include linux/version.h
+#include linux/init.h
+#include linux/delay.h
+#include linux/pci.h
+#include linux/netdevice.h
+
+#include net/ieee80211.h
+
+#include linux/wireless.h
+#include net/iw_handler.h
+
+#include atheros_id.h
+#include atheros_dev.h
+#include atheros_defs.h
+//#include atheros_devops.h
+//#include atheros_regops.h
+#include atheros_registers.h
+#include atheros.h
+
+
+unsigned int ath_keycache_valid(struct net_device *netdev,
+		unsigned short entry)
+{
+	struct atheros_priv *pdata;
+	unsigned int val;
+	
+	pdata = ieee80211_priv(netdev);
+	
+	if (entry  pdata-max_keycache)
+		return 0;
+	
+	val = ath_reg_read(netdev, 0x8800 + entry * 32 + 28);
+
+	if (val  0x8000)
+		return 1;
+	
+	return 0;
+}
+
+unsigned int ath_reset_keycache(struct net_device *netdev,
+		unsigned short entry)
+{
+	struct atheros_priv *pdata;
+	unsigned int keytype;
+	
+	pdata = ieee80211_priv(netdev);
+	
+	if (entry  pdata-keycache_size)
+		return 0;
+
+	keytype = ath_reg_read(netdev, (entry * 32) + 0x8814);
+
+	ath_reg_write(netdev, (entry * 32) + 0x8800, 0);
+	ath_reg_write(netdev, (entry * 32) + 0x8804, 0);
+	ath_reg_write(netdev, (entry * 32) + 0x8808, 0);
+	ath_reg_write(netdev, (entry * 32) + 0x880c, 0);
+	ath_reg_write(netdev, (entry * 32) + 0x8810, 0);
+	ath_reg_write(netdev, (entry * 32) + 0x8814, 7);
+	ath_reg_write(netdev, (entry * 32) + 0x8818, 0);
+	ath_reg_write(netdev, (entry * 32) + 0x881c, 0);
+	
+	if (keytype != 4)
+		return 1;
+
+	if (!pdata-ext_keycache)
+		return 1;
+
+	ath_reg_write(netdev, ((entry + 64) * 32) + 0x8800, 0);
+	ath_reg_write(netdev, ((entry + 64) * 32) + 0x8804, 0);
+	ath_reg_write(netdev, ((entry + 64) * 32) + 0x8808, 0);
+	ath_reg_write(netdev, ((entry + 64) * 32) + 0x880c, 0);
+
+	return 1;
+}
+
+unsigned int ath_set_keycache_entry_mac(struct net_device *netdev,
+		unsigned short entry, unsigned char *mac)
+{
+	struct atheros_priv *pdata;
+	unsigned int mac1, mac2;
+	
+	pdata = ieee80211_priv(netdev);
+
+	if (entry  pdata-max_keycache)
+		return 0;
+
+	if (mac == NULL) {
+		mac1 = 0;
+		mac2 = 0;
+	} else {
+		mac1  = mac[5]  8;
+		mac1 |= mac[4];
+		
+		mac2  = mac[3]  24;
+		mac2 |= mac[2]  16;
+		mac2 |= mac[1]  8;
+		mac2 |= mac[0];
+		
+		mac2 = mac2  1;
+		mac2 |= ((mac1  1) 31);
+		
+		mac1 = mac1  1;
+	}
+
+	ath_reg_write(netdev, (entry * 32) + 0x8800 + 24, mac2);
+	ath_reg_write(netdev, (entry * 32) + 0x8800 + 28, mac1 | 0x80);
+
+	return 1;
+}
+
+unsigned int ath_set_keycache_entry(struct net_device *netdev,
+		unsigned short entry, struct keyval *kv,
+		unsigned char *mac, int num)
+{
+	int flg = (num == 1) ? 0x : 0;
+	int cipher_opt;
+	int newentry;
+	struct atheros_priv *pdata = ieee80211_priv(netdev);
+	unsigned int part1, part2, part3, part4, part5;
+
+
+	flg = 0x;
+
+	if (entry  pdata-max_keycache)
+		return 0;
+
+	switch (kv-kv_type) {
+		case CIPHER_AES_OCB:
+			cipher_opt = 5;
+			break;
+
+		case CIPHER_AES_CCM:
+			/* fixme TODO FIXME */
+			return 0;
+//			break;
+
+		case CIPHER_TKIP:
+			cipher_opt = 4;
+
+			if ((entry + 0x40)  pdata-max_keycache)
+return 0;
+
+			break;
+
+		case CIPHER_WEP:
+			if (kv-kv_len = 4)
+return 0;
+			
+			cipher_opt = 0;
+
+			if 

atheros driver (8/8)

2005-08-04 Thread Mateusz Berezecki


diff -uprN -X 'netdev-2.6.git#ieee80211/Documentation/dontdiff' netdev-2.6.git#ieee80211/drivers/net/wireless/atheros/atheros5212/other.c netdev-atheros/drivers/net/wireless/atheros/atheros5212/other.c
--- netdev-2.6.git#ieee80211/drivers/net/wireless/atheros/atheros5212/other.c	1970-01-01 01:00:00.0 +0100
+++ netdev-atheros/drivers/net/wireless/atheros/atheros5212/other.c	2005-08-05 03:48:36.0 +0200
@@ -0,0 +1,57 @@
+/*
+ * All the work was created by reverse engineering and porting
+ * for interoperability. The creator is Mateusz Berezecki,
+ * unless explicitly marked ( some parts are derived
+ * from GPL'ed parts of madwifi project located at http://madwifi.sf.net)
+ *
+ * derived or copied parts of code licensed under
+ * dual GPL/BSD license
+ * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
+ * All rights reserved.
+ * 
+ * rest of the code has been reversed by me and is under copyright too
+ * Copyright (C) 2005  Mateusz Berezecki
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ */
+
+
+#include linux/config.h
+#include linux/kernel.h
+#include linux/module.h
+#include linux/version.h
+#include linux/init.h
+#include linux/delay.h
+#include linux/pci.h
+#include linux/netdevice.h
+
+#include net/ieee80211.h
+
+#include linux/wireless.h
+#include net/iw_handler.h
+
+#include atheros_id.h
+#include atheros_dev.h
+#include atheros_defs.h
+#include atheros_registers.h
+#include atheros.h
+
+
+int ath_phy_disable(struct net_device *netdev)
+{
+	return ath_set_reset_register(netdev, AR5212_RC_BB);
+}
+
+
diff -uprN -X 'netdev-2.6.git#ieee80211/Documentation/dontdiff' netdev-2.6.git#ieee80211/drivers/net/wireless/atheros/atheros5212/powermodes.c netdev-atheros/drivers/net/wireless/atheros/atheros5212/powermodes.c
--- netdev-2.6.git#ieee80211/drivers/net/wireless/atheros/atheros5212/powermodes.c	1970-01-01 01:00:00.0 +0100
+++ netdev-atheros/drivers/net/wireless/atheros/atheros5212/powermodes.c	2005-08-05 03:48:36.0 +0200
@@ -0,0 +1,155 @@
+/*
+ * All the work was created by reverse engineering and porting
+ * for interoperability. The creator is Mateusz Berezecki,
+ * unless explicitly marked ( some parts are derived
+ * from GPL'ed parts of madwifi project located at http://madwifi.sf.net)
+ *
+ * derived or copied parts of code licensed under
+ * dual GPL/BSD license
+ * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
+ * All rights reserved.
+ * 
+ * rest of the code has been reversed by me and is under copyright too
+ * Copyright (C) 2005  Mateusz Berezecki
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ */
+
+
+#include linux/config.h
+#include linux/kernel.h
+#include linux/module.h
+#include linux/version.h
+#include linux/init.h
+#include linux/delay.h
+#include linux/pci.h
+#include linux/netdevice.h
+
+#include net/ieee80211.h
+
+#include linux/wireless.h
+#include net/iw_handler.h
+
+#include atheros_id.h
+#include atheros_dev.h
+#include atheros_defs.h
+//#include atheros_devops.h
+//#include atheros_regops.h
+#include atheros_registers.h
+#include atheros.h
+
+
+/* don return power mode from private device data.
+ * use hardware instead. thats better */
+POWER_MODE ath_get_power_mode(struct net_device *netdev)
+{
+	unsigned int mode = ath_reg_read(netdev, AR5212_SCR);
+	mode = (AR5212_SCR_SLE  16);
+	return mode;
+}
+
+/* zZzZ... */
+void ath_pmode_fullsleep(struct net_device *netdev, int set)
+{
+	ath_reg_enable(netdev, AR5212_STA_ID1, AR5212_STA_ID1_PWR_SV);
+	
+	if (set)
+		ath_reg_write(netdev, AR5212_SCR, 
+AR5212_SCR_SLE_SLP);
+	return;
+}
+
+/* oh, my god, its 6 am already... */

argh... ;/

2005-08-04 Thread Mateusz Berezecki
I accidentaly posted the patches as MIME attachments... its 5:03 am here 
already. Sorry guys.
I can resubmit if you want. I just dont want do that now and not trash 
your mailboxes


Mateusz
-
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: atheros driver (1/8)

2005-08-04 Thread Matt Mackall
Some initial comments:

- you should include a description of each patch in the message
- you should use more descriptive subjects, eg

[PATCH 1/8] atheros: Kconfig bits

-- 
Mathematics is the supreme nostalgia of our time.
-
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