Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH] NETDEV: fix receiving multicast frames.
From: Herbert Xu @ 2005-05-25  8:19 UTC (permalink / raw)
  To: YOSHIFUJI Hideaki / ????; +Cc: jgarzik, netdev, yoshfuji, usagi-core
In-Reply-To: <20050525.160704.28910448.yoshfuji@linux-ipv6.org>

YOSHIFUJI Hideaki / ???? <yoshfuji@linux-ipv6.org> wrote:
> From: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
> 
> Some USB ethernet drivers did not accept multicast frames appropriately.
> IPv6 did not work with those drivers without this patch.
> 
> Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
> 
> Index: drivers/usb/net/pegasus.c
> ===================================================================
> --- 5b713315560487f8c288820b17061fe27016c2cc/drivers/usb/net/pegasus.c  (mode:100644)
> +++ uncommitted/drivers/usb/net/pegasus.c  (mode:100644)
> @@ -1166,7 +1166,7 @@
>                pegasus->eth_regs[EthCtrl2] |= RX_PROMISCUOUS;
>                if (netif_msg_link(pegasus))
>                        pr_info("%s: Promiscuous mode enabled.\n", net->name);
> -       } else if ((net->mc_count > multicast_filter_limit) ||
> +       } else if (net->mc_count ||
>                   (net->flags & IFF_ALLMULTI)) {
>                pegasus->eth_regs[EthCtrl0] |= RX_MULTICAST;
>                pegasus->eth_regs[EthCtrl2] &= ~RX_PROMISCUOUS;
> Index: drivers/usb/net/rtl8150.c
> ===================================================================
> --- 5b713315560487f8c288820b17061fe27016c2cc/drivers/usb/net/rtl8150.c  (mode:100644)
> +++ uncommitted/drivers/usb/net/rtl8150.c  (mode:100644)
> @@ -667,7 +667,7 @@
>        if (netdev->flags & IFF_PROMISC) {
>                dev->rx_creg |= cpu_to_le16(0x0001);
>                info("%s: promiscuous mode", netdev->name);
> -       } else if ((netdev->mc_count > multicast_filter_limit) ||
> +       } else if (netdev->mc_count ||
>                   (netdev->flags & IFF_ALLMULTI)) {
>                dev->rx_creg &= cpu_to_le16(0xfffe);
>                dev->rx_creg |= cpu_to_le16(0x0002);

This patch is correct.  However, I presume these chips do actually have
filter support so it'd be even better if we could utilise that.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply

* [PATCH] NETDEV: fix receiving multicast frames.
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2005-05-25  7:07 UTC (permalink / raw)
  To: jgarzik; +Cc: netdev, yoshfuji, usagi-core

From: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>

Some USB ethernet drivers did not accept multicast frames appropriately.
IPv6 did not work with those drivers without this patch.

Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>

Index: drivers/usb/net/pegasus.c
===================================================================
--- 5b713315560487f8c288820b17061fe27016c2cc/drivers/usb/net/pegasus.c  (mode:100644)
+++ uncommitted/drivers/usb/net/pegasus.c  (mode:100644)
@@ -1166,7 +1166,7 @@
 		pegasus->eth_regs[EthCtrl2] |= RX_PROMISCUOUS;
 		if (netif_msg_link(pegasus))
 			pr_info("%s: Promiscuous mode enabled.\n", net->name);
-	} else if ((net->mc_count > multicast_filter_limit) ||
+	} else if (net->mc_count ||
 		   (net->flags & IFF_ALLMULTI)) {
 		pegasus->eth_regs[EthCtrl0] |= RX_MULTICAST;
 		pegasus->eth_regs[EthCtrl2] &= ~RX_PROMISCUOUS;
Index: drivers/usb/net/rtl8150.c
===================================================================
--- 5b713315560487f8c288820b17061fe27016c2cc/drivers/usb/net/rtl8150.c  (mode:100644)
+++ uncommitted/drivers/usb/net/rtl8150.c  (mode:100644)
@@ -667,7 +667,7 @@
 	if (netdev->flags & IFF_PROMISC) {
 		dev->rx_creg |= cpu_to_le16(0x0001);
 		info("%s: promiscuous mode", netdev->name);
-	} else if ((netdev->mc_count > multicast_filter_limit) ||
+	} else if (netdev->mc_count ||
 		   (netdev->flags & IFF_ALLMULTI)) {
 		dev->rx_creg &= cpu_to_le16(0xfffe);
 		dev->rx_creg |= cpu_to_le16(0x0002);

-- 
YOSHIFUJI Hideaki @ USAGI Project  <yoshfuji@linux-ipv6.org>
GPG-FP  : 9022 65EB 1ECF 3AD1 0BDF  80D8 4807 F894 E062 0EEA

^ permalink raw reply

* [PATCH] NETDEV: Elecom (Laneed) LD-USBL/TX support.
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2005-05-25  7:06 UTC (permalink / raw)
  To: jgarzik; +Cc: netdev, yoshfuji, nakam, usagi-core

From: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>

Elecom (Laneed) LD-USBL/TX support.

Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>

Index: drivers/usb/net/pegasus.h
===================================================================
--- 5b713315560487f8c288820b17061fe27016c2cc/drivers/usb/net/pegasus.h  (mode:100644)
+++ uncommitted/drivers/usb/net/pegasus.h  (mode:100644)
@@ -249,6 +249,8 @@
 		DEFAULT_GPIO_RESET)
 PEGASUS_DEV( "LANEED USB Ethernet LD-USB/TX", VENDOR_LANEED, 0x4002,
 		DEFAULT_GPIO_RESET )
+PEGASUS_DEV( "LANEED USB Ethernet LD-USBL/TX", VENDOR_LANEED, 0x4005,
+		DEFAULT_GPIO_RESET | PEGASUS_II)
 PEGASUS_DEV( "LANEED USB Ethernet LD-USB/TX", VENDOR_LANEED, 0x400b,
 		DEFAULT_GPIO_RESET | PEGASUS_II )
 PEGASUS_DEV( "LANEED USB Ethernet LD-USB/T", VENDOR_LANEED, 0xabc1,

-- 
YOSHIFUJI Hideaki @ USAGI Project  <yoshfuji@linux-ipv6.org>
GPG-FP  : 9022 65EB 1ECF 3AD1 0BDF  80D8 4807 F894 E062 0EEA

^ permalink raw reply

* Re: [0/5] Improvements to the ieee80211 layer
From: Zhu Yi @ 2005-05-25  6:55 UTC (permalink / raw)
  To: Jiri Benc; +Cc: NetDev, LKML, jgarzik, pavel
In-Reply-To: <20050524150711.01632672@griffin.suse.cz>

On Tue, 2005-05-24 at 15:07 +0200, Jiri Benc wrote:
> The ieee80211 layer, now present in -mm, lacks many important features
> (actually it's just a part of the ipw2100/ipw2200 driver; these cards do
> a lot of the processing in the hardware/firmware and thus the layer
> currently can not be used for simpler devices).
> 
> This is the first series of patches that try to convert it to a generic
> IEEE 802.11 layer, usable for most of today's wireless cards.
> 
> The long term plan is:
> - to implement a complete 802.11 stack in the kernel, making it easy to
>   write drivers for simple (cheap) devices
> - to implement all of Ad-Hoc, AP and monitor modes in the layer, so it
>   will be easy to support them in the drivers
> - to integrate Wireless Extensions to unify the kernel-userspace
>   interface of all the drivers

Do you just clean up current ieee80211 code to still do 802.11 <-> 802.3
conversion inside the driver or you plan to handle real 802.11 frames in
the stack like this?
http://oss.sgi.com/archives/netdev/2005-03/msg01405.html

Thanks,
-yi

^ permalink raw reply

* [PATCH] add is_multicast_ether_addr() in include/linux/etherdevice.h
From: Michael Ellerman @ 2005-05-25  5:03 UTC (permalink / raw)
  To: netdev

Hi,

This patch adds is_multicast_ether_addr() to go along with is_valid_ether_addr()
and friends. It then changes is_valid_ether_addr() to use the new macro, and
fixes up the comment on that function to move implementation details out of
the API doco.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>

Index: veth-dev/include/linux/etherdevice.h
===================================================================
--- veth-dev.orig/include/linux/etherdevice.h
+++ veth-dev/include/linux/etherdevice.h
@@ -56,18 +56,32 @@ static inline int is_zero_ether_addr(con
 }
 
 /**
+ * is_multicast_ether_addr - Determine if the given Ethernet address is a
+ * multicast address.
+ *
+ * @addr: Pointer to a six-byte array containing the Ethernet address
+ *
+ * Return true if the address is a multicast address.
+ */
+static inline int is_multicast_ether_addr(const u8 *addr)
+{
+	return addr[0] & 0x01;
+}
+
+/**
  * is_valid_ether_addr - Determine if the given Ethernet address is valid
  * @addr: Pointer to a six-byte array containing the Ethernet address
  *
  * Check that the Ethernet address (MAC) is not 00:00:00:00:00:00, is not
- * a multicast address, and is not FF:FF:FF:FF:FF:FF.  The multicast
- * and FF:FF:... tests are combined into the single test "!(addr[0]&1)".
+ * a multicast address, and is not FF:FF:FF:FF:FF:FF.
  *
  * Return true if the address is valid.
  */
 static inline int is_valid_ether_addr(const u8 *addr)
 {
-	return !(addr[0]&1) && !is_zero_ether_addr(addr);
+	/* FF:FF:FF:FF:FF:FF is a multicast address so we don't need to
+	 * explicitly check for it here. */
+	return !is_multicast_ether_addr(addr) && !is_zero_ether_addr(addr);
 }
 
 /**
@@ -83,6 +97,6 @@ static inline void random_ether_addr(u8 
 	addr [0] &= 0xfe;	/* clear multicast bit */
 	addr [0] |= 0x02;	/* set local assignment bit (IEEE802) */
 }
-#endif
+#endif	/* __KERNEL__ */
 
 #endif	/* _LINUX_ETHERDEVICE_H */

^ permalink raw reply

* Re: Fw: [Bugme-new] [Bug 4628] New: Test server hang while running rhr (network) test on RHEL4 with kernel 2.6.12-rc1-mm4
From: Jian Jun He @ 2005-05-25  3:21 UTC (permalink / raw)
  To: Ganesh Venkatesan
  Cc: Andrew Morton, Anton Blanchard, linuxppc64-dev, netdev,
	Dang En Ren, Lei CDL Wang, Jia Sen Wang
In-Reply-To: <5fc59ff305052411366b9b058c@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 5343 bytes --]


"rhr" is a "Red Hat Certification Testing Suite". You can download it from
redhat.com.

Best Regards!

Jian Jun He

CSDL, Beijing
Email: hejianj@cn.ibm.com



                                                                       
             Ganesh Venkatesan                                         
             <ganesh.venkatesa                                         
             n@gmail.com>                                               To
                                       Andrew Morton <akpm@osdl.org>   
             2005-05-25 02:36                                           cc
                                       netdev@oss.sgi.com, Jian Jun    
                                       He/China/Contr/IBM@IBMCN,       
             Please respond to         linuxppc64-dev@lists.linuxppc.org.s
             Ganesh Venkatesan         gi.com, Anton Blanchard         
                                       <anton@samba.org>               
                                                                   Subject
                                       Re: Fw: [Bugme-new] [Bug 4628] New:
                                       Test server hang while running rhr
                                       (network) test on RHEL4 with kernel
                                       2.6.12-rc1-mm4                  
                                                                       
                                                                       
                                                                       
                                                                       
                                                                       
                                                                       




Could you tell me what the rhr test is? Is this an IBM internal test tool?


On 5/16/05, Andrew Morton <akpm@osdl.org> wrote:
>
> Might be a bug in the e100 driver, might not be.
>
> I assume this is the
>
>         BUG_ON(skb->list != NULL);
>
> in __kfree_skb(), although the line number is off-by-one, and the
> .__kfree_skb+0x188/0x240 would tend to contradict that.  Anton, can you
> help work out where we went splat please?
>
> tx timeouts are fairly rare events, so this might not be a recently-added
> bug.
>
> Do we know if it is repeatable?
>
>
>
> Begin forwarded message:
>
> Date: Mon, 16 May 2005 02:44:04 -0700
> From: bugme-daemon@osdl.org
> To: bugme-new@lists.osdl.org
> Subject: [Bugme-new] [Bug 4628] New: Test server hang while running rhr
(network) test on RHEL4 with kernel 2.6.12-rc1-mm4
>
>
> http://bugme.osdl.org/show_bug.cgi?id=4628
>
>            Summary: Test server hang while running rhr (network) test on
>                     RHEL4 with kernel 2.6.12-rc1-mm4
>     Kernel Version: 2.6.12-rc1 with mm4 patch
>             Status: NEW
>           Severity: normal
>              Owner: anton@samba.org
>          Submitter: hejianj@cn.ibm.com
>                 CC:
hanwenb@cn.ibm.com,mridge@us.ibm.com,rende@cn.ibm.com,wa
>                     ngjs@cn.ibm.com
>
>
> Distribution:
> RHEL4 with kernel 2.6.12-rc1-mm4
>
> Hardware Environment:
> IBM OpenPower( CHRP IBM,9124-720 )
>
> Software Environment:
> RHEL4
> RHR: rhr2-rhel4-1.0-14a.noarch.rpm
>
> Problem Description:
> The test server hang while running rhr (network) test on RHEL4 with
kernel
> 2.6.12-rc1-mm4.
>
> Steps to reproduce:
> 1. Download kernel 2.6.12-rc1 and 2.6.12-rc1-mm4 patch from kernel.org,
then
> build the kernel on OpenPower 720
> 2. Download rhr2-rhel4-1.0-14a.noarch.rpm from rhn.redhat.com and install
it on
> the test machine.
> 3. Configure and run the rhr test via invoking redhat-ready.
>
> Additional information:
> Here is the backtrace from xmon.
>
> 3:mon> e
> cpu 0x3: Vector: 700 (Program Check) at [c00000000ffe7920]
>     pc: c00000000029632c: .__kfree_skb+0x188/0x240
>     lr: c000000000296328: .__kfree_skb+0x184/0x240
>     sp: c00000000ffe7ba0
>    msr: 8000000000029032
>   current = 0xc000000107f94040
>   paca    = 0xc000000000431c00
>     pid   = 0, comm = swapper
> kernel BUG in __kfree_skb at net/core/skbuff.c:282!
>
> 3:mon> t
> [c00000000ffe7c40] d0000000000ebac4 .e100_rx_clean_list+0xa0/0x144 [e100]
> [c00000000ffe7ce0] d0000000000ed6dc .e100_tx_timeout+0x7c/0xb0 [e100]
> [c00000000ffe7d70] c0000000002b87bc .dev_watchdog+0xc8/0x154
> [c00000000ffe7e00] c00000000006d6b4 .run_timer_softirq+0x180/0x298
> [c00000000ffe7ed0] c0000000000667d8 .__do_softirq+0xdc/0x1b8
> [c00000000ffe7f90] c000000000014bf0 .call_do_softirq+0x14/0x24
> [c000000086b43860] c0000000000102c4 .do_softirq+0x98/0xac
> [c000000086b438f0] c0000000000669cc .irq_exit+0x70/0x8c
> [c000000086b43970] c000000000011fb8 .timer_interrupt+0x398/0x47c
> [c000000086b43a90] c00000000000a2b4 decrementer_common+0xb4/0x100
> --- Exception: 901 (Decrementer) at c000000000010554
.dedicated_idle+0x114/0x280
> [c000000086b43e80] c0000000000108c8 .cpu_idle+0x3c/0x54
> [c000000086b43f00] c00000000003cc8c .start_secondary+0x108/0x148
> [c000000086b43f90] c00000000000bd84 .enable_64b_mode+0x0/0x28
>
> ------- You are receiving this mail because: -------
> You are on the CC list for the bug, or are watching someone who is.
>
>

[-- Attachment #1.2: Type: text/html, Size: 7675 bytes --]

[-- Attachment #2: graycol.gif --]
[-- Type: image/gif, Size: 105 bytes --]

[-- Attachment #3: pic29731.gif --]
[-- Type: image/gif, Size: 1255 bytes --]

[-- Attachment #4: ecblank.gif --]
[-- Type: image/gif, Size: 45 bytes --]

^ permalink raw reply

* Re: [PATCH] Super TSO v3
From: David S. Miller @ 2005-05-25  0:51 UTC (permalink / raw)
  To: shemminger; +Cc: netdev, harry
In-Reply-To: <20050524164219.59cc6b01@dxpl.pdx.osdl.net>

From: Stephen Hemminger <shemminger@osdl.org>
Date: Tue, 24 May 2005 16:42:19 -0700

> On Mon, 23 May 2005 12:19:43 -0700 (PDT)
> "David S. Miller" <davem@davemloft.net> wrote:
> 
> > Ok, new version.  This weekend has been productive.
> 
> I wonder if the TSO stuff would fix the performance problems with MacOSX
> and their broken delayed ack?

This is very possible, and people are free to test it out
to verify :-)

^ permalink raw reply

* Re: [PATCH] bonding using arp_ip_target may stay down with active path
From: David S. Miller @ 2005-05-25  0:37 UTC (permalink / raw)
  To: eparis; +Cc: fubar, netdev, jgarzik, bonding-devel
In-Reply-To: <1116959462.8954.6.camel@localhost.localdomain>

From: Eric Paris <eparis@parisplace.org>
Date: Tue, 24 May 2005 14:31:02 -0400

> It ate my tabs again.  This mailer is going out the window.

This is why I personally stick to Emacs/MEW and Sylpheed.

I tried Evolution for a while long ago, but stopped the first
time it refused to read in my entire mbox because it failed to
parse a multi-byte character in _one_ of the emails contained
within.

I'm sure that's fixed, but it's very much a non-ascii-text
mailer by default, so you have to pluck with it's configuration
a little bit if you're sending patches and code around a lot.

^ permalink raw reply

* Re: [PATCH] Super TSO v3
From: Stephen Hemminger @ 2005-05-24 23:42 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Harry Edmon
In-Reply-To: <20050523.121943.78708600.davem@davemloft.net>

On Mon, 23 May 2005 12:19:43 -0700 (PDT)
"David S. Miller" <davem@davemloft.net> wrote:

> 
> Ok, new version.  This weekend has been productive.
>

I wonder if the TSO stuff would fix the performance problems with MacOSX
and their broken delayed ack?

^ permalink raw reply

* 2.6.12-rc4-tcp3
From: Stephen Hemminger @ 2005-05-24 23:39 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, linux-kernel

http://developer.osdl.org/shemminger/patches/2.6.12-rc4-tcp3

This is the third revision of the TCP pluggable congestion framework with
other network changes (targeted for 2.6.13)

Minor tweaks from last time:
	- startup changed because westwood and hybla 
	  need to do setup after initial connection establishment
	- initialization happens when socket is created (fixes bug with
	  auto module load and preempt).
	- module refcounting fix for passive opens
	- cleanup westwood and get rid of too much inlining
	- latest version of TSO patch included in set
	- fix min_cwnd undershoot bug for all but legacy reno

# Changes involving network core to remove throttling
fastroute-stats-remove
no-congestion
no-throttle
bigger-backlog
fix-weightp
# TSO fixes from dave
tcp_ack26
tcp_super_tso_v3
# TCP infrastructure
tcp_infra
tcp_bic
tcp_westwood
hstcp
hybla
vegas
h-tcp
# Makefile version
version

^ permalink raw reply

* [PATCH] (3/3) netem: allow random reordering (with fix)
From: Stephen Hemminger @ 2005-05-24 22:26 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: David S. Miller, netdev, netem
In-Reply-To: <20050519151254.79afe7e7@dxpl.pdx.osdl.net>

Here is a fixed up version of the reorder feature of netem.
It is the same as the earlier patch plus with the bugfix from Julio merged in.
Has expected backwards compatibility behaviour.

Go ahead and merge this one, the TCP strangeness I was seeing was due
to the reordering bug, and previous version of TSO patch.

Signed-off-by: Stephen Hemminger <shemminger@osdl.org>

Index: netem/include/linux/pkt_sched.h
===================================================================
--- netem.orig/include/linux/pkt_sched.h
+++ netem/include/linux/pkt_sched.h
@@ -427,6 +427,7 @@ enum
 	TCA_NETEM_UNSPEC,
 	TCA_NETEM_CORR,
 	TCA_NETEM_DELAY_DIST,
+	TCA_NETEM_REORDER,
 	__TCA_NETEM_MAX,
 };
 
@@ -437,7 +438,7 @@ struct tc_netem_qopt
 	__u32	latency;	/* added delay (us) */
 	__u32   limit;		/* fifo limit (packets) */
 	__u32	loss;		/* random packet loss (0=none ~0=100%) */
-	__u32	gap;		/* re-ordering gap (0 for delay all) */
+	__u32	gap;		/* re-ordering gap (0 for none) */
 	__u32   duplicate;	/* random packet dup  (0=none ~0=100%) */
 	__u32	jitter;		/* random jitter in latency (us) */
 };
@@ -449,6 +450,12 @@ struct tc_netem_corr
 	__u32	dup_corr;	/* duplicate correlation  */
 };
 
+struct tc_netem_reorder
+{
+	__u32	probability;
+	__u32	correlation;
+};
+
 #define NETEM_DIST_SCALE	8192
 
 #endif
Index: netem/net/sched/sch_netem.c
===================================================================
--- netem.orig/net/sched/sch_netem.c
+++ netem/net/sched/sch_netem.c
@@ -62,11 +62,12 @@ struct netem_sched_data {
 	u32 gap;
 	u32 jitter;
 	u32 duplicate;
+	u32 reorder;
 
 	struct crndstate {
 		unsigned long last;
 		unsigned long rho;
-	} delay_cor, loss_cor, dup_cor;
+	} delay_cor, loss_cor, dup_cor, reorder_cor;
 
 	struct disttable {
 		u32  size;
@@ -180,23 +181,23 @@ static int netem_enqueue(struct sk_buff 
 		q->duplicate = dupsave;
 	}
 
-	/* 
-	 * Do re-ordering by putting one out of N packets at the front
-	 * of the queue.
-	 * gap == 0 is special case for no-reordering.
-	 */
-	if (q->gap == 0 || q->counter != q->gap) {
+	if (q->gap == 0 		/* not doing reordering */
+	    || q->counter < q->gap 	/* inside last reordering gap */
+	    || q->reorder < get_crandom(&q->reorder_cor)) {
 		psched_time_t now;
 		PSCHED_GET_TIME(now);
-		PSCHED_TADD2(now, 
-			     tabledist(q->latency, q->jitter, &q->delay_cor, q->delay_dist),
+		PSCHED_TADD2(now, tabledist(q->latency, q->jitter, 
+					    &q->delay_cor, q->delay_dist),
 			     cb->time_to_send);
-		
 		++q->counter;
 		ret = q->qdisc->enqueue(skb, q->qdisc);
 	} else {
-		q->counter = 0;
+		/* 
+		 * Do re-ordering by putting one out of N packets at the front
+		 * of the queue.
+		 */
 		PSCHED_GET_TIME(cb->time_to_send);
+		q->counter = 0;
 		ret = q->qdisc->ops->requeue(skb, q->qdisc);
 	}
 
@@ -351,6 +352,19 @@ static int get_correlation(struct Qdisc 
 	return 0;
 }
 
+static int get_reorder(struct Qdisc *sch, const struct rtattr *attr)
+{
+	struct netem_sched_data *q = qdisc_priv(sch);
+	const struct tc_netem_reorder *r = RTA_DATA(attr);
+
+	if (RTA_PAYLOAD(attr) != sizeof(*r))
+		return -EINVAL;
+
+	q->reorder = r->probability;
+	init_crandom(&q->reorder_cor, r->correlation);
+	return 0;
+}
+
 static int netem_change(struct Qdisc *sch, struct rtattr *opt)
 {
 	struct netem_sched_data *q = qdisc_priv(sch);
@@ -371,9 +385,15 @@ static int netem_change(struct Qdisc *sc
 	q->jitter = qopt->jitter;
 	q->limit = qopt->limit;
 	q->gap = qopt->gap;
+	q->counter = 0;
 	q->loss = qopt->loss;
 	q->duplicate = qopt->duplicate;
 
+	/* for compatiablity with earlier versions.
+	 * if gap is set, need to assume 100% probablity
+	 */
+	q->reorder = ~0;
+
 	/* Handle nested options after initial queue options.
 	 * Should have put all options in nested format but too late now.
 	 */ 
@@ -395,6 +415,11 @@ static int netem_change(struct Qdisc *sc
 			if (ret)
 				return ret;
 		}
+		if (tb[TCA_NETEM_REORDER-1]) {
+			ret = get_reorder(sch, tb[TCA_NETEM_REORDER-1]);
+			if (ret)
+				return ret;
+		}
 	}
 
 
@@ -412,7 +437,6 @@ static int netem_init(struct Qdisc *sch,
 	init_timer(&q->timer);
 	q->timer.function = netem_watchdog;
 	q->timer.data = (unsigned long) sch;
-	q->counter = 0;
 
 	q->qdisc = qdisc_create_dflt(sch->dev, &pfifo_qdisc_ops);
 	if (!q->qdisc) {
@@ -444,6 +468,7 @@ static int netem_dump(struct Qdisc *sch,
 	struct rtattr *rta = (struct rtattr *) b;
 	struct tc_netem_qopt qopt;
 	struct tc_netem_corr cor;
+	struct tc_netem_reorder reorder;
 
 	qopt.latency = q->latency;
 	qopt.jitter = q->jitter;
@@ -457,6 +482,11 @@ static int netem_dump(struct Qdisc *sch,
 	cor.loss_corr = q->loss_cor.rho;
 	cor.dup_corr = q->dup_cor.rho;
 	RTA_PUT(skb, TCA_NETEM_CORR, sizeof(cor), &cor);
+
+	reorder.probability = q->reorder;
+	reorder.correlation = q->reorder_cor.rho;
+	RTA_PUT(skb, TCA_NETEM_REORDER, sizeof(reorder), &reorder);
+
 	rta->rta_len = skb->tail - b;
 
 	return skb->len;

^ permalink raw reply

* Re: [4/6] ipw2100: fix after "ieee80211_device alignment fix"
From: Jirka Bohac @ 2005-05-24 19:18 UTC (permalink / raw)
  To: Pavel Machek; +Cc: Jiri Benc, NetDev
In-Reply-To: <20050524185820.GC2268@elf.ucw.cz>

On Tue, May 24, 2005 at 08:58:20PM +0200, Pavel Machek wrote:
> On Út 24-05-05 15:18:02, Jiri Benc wrote:
> > Fixes ipw2100 after ieee80211_device alignment fix
> > (patch [2/5] ieee80211: ieee80211_device alignment fix and cleanup)
> > 
> > 
> > Signed-off-by: Jiri Benc <jbenc@suse.cz>
> > Signed-off-by: Jirka Bohac <jbohac@suse.cz>
> > 
> > --- linux-2.6.12-rc2-mm3.01/drivers/net/wireless/ipw2100.c	2005-05-19 16:23:00.000000000 +0200
> > +++ linux-2.6.12-rc2-mm3.04/drivers/net/wireless/ipw2100.c	2005-05-19 17:35:48.000000000 +0200
> > @@ -1717,7 +1717,7 @@
> >  /* Called by register_netdev() */
> >  static int ipw2100_net_init(struct net_device *dev)
> >  {
> > -	struct ipw2100_priv *priv = ieee80211_priv(dev);
> > +	struct ipw2100_priv *priv = ieee80211_priv(netdev_priv(dev));
> >  	return ipw2100_up(priv, 1);
> >  }
> 
> 
> Ugh, that is getting rather ugly. Perhaps inline function doing this
> should be introduced?

Ok, this is a little ugly, but this driver is slowly getting
re-written as work on the ieee80211 layer proceeds. 

Drivers will not be supposed to use references to struct net_device
internally. Instead, they should be using references to struct
ieee80211_device -- this will be their interface to the stack,
not net_device. So this patch is a quick fix for the driver to
work with the unfinished layer. This "call" will disappear when
the layer is finished.

Both ieee80211_priv() and netdev_priv() are inline.


Regards,


-- 
Jirka Bohac <jbohac@suse.cz>
SUSE Labs, SUSE CR

^ permalink raw reply

* Re: [4/6] ipw2100: fix after "ieee80211_device alignment fix"
From: Pavel Machek @ 2005-05-24 18:58 UTC (permalink / raw)
  To: Jiri Benc; +Cc: NetDev
In-Reply-To: <20050524151802.59124dde@griffin.suse.cz>

On Út 24-05-05 15:18:02, Jiri Benc wrote:
> Fixes ipw2100 after ieee80211_device alignment fix
> (patch [2/5] ieee80211: ieee80211_device alignment fix and cleanup)
> 
> 
> Signed-off-by: Jiri Benc <jbenc@suse.cz>
> Signed-off-by: Jirka Bohac <jbohac@suse.cz>
> 
> --- linux-2.6.12-rc2-mm3.01/drivers/net/wireless/ipw2100.c	2005-05-19 16:23:00.000000000 +0200
> +++ linux-2.6.12-rc2-mm3.04/drivers/net/wireless/ipw2100.c	2005-05-19 17:35:48.000000000 +0200
> @@ -1717,7 +1717,7 @@
>  /* Called by register_netdev() */
>  static int ipw2100_net_init(struct net_device *dev)
>  {
> -	struct ipw2100_priv *priv = ieee80211_priv(dev);
> +	struct ipw2100_priv *priv = ieee80211_priv(netdev_priv(dev));
>  	return ipw2100_up(priv, 1);
>  }


Ugh, that is getting rather ugly. Perhaps inline function doing this
should be introduced?

								Pavel

^ permalink raw reply

* Re: [0/5] Improvements to the ieee80211 layer
From: Pavel Machek @ 2005-05-24 18:52 UTC (permalink / raw)
  To: Jiri Benc; +Cc: NetDev, LKML, jgarzik
In-Reply-To: <20050524150711.01632672@griffin.suse.cz>

Hi!

> The ieee80211 layer, now present in -mm, lacks many important features
> (actually it's just a part of the ipw2100/ipw2200 driver; these cards do
> a lot of the processing in the hardware/firmware and thus the layer
> currently can not be used for simpler devices).
> 
> This is the first series of patches that try to convert it to a generic
> IEEE 802.11 layer, usable for most of today's wireless cards.

Are they against -rc4-mm2?

Would it be possible to put agregate patch on the web somewhere (or
git tree?). I would certainly be easier to test....
								Pavel

^ permalink raw reply

* Re: Fw: [Bugme-new] [Bug 4628] New: Test server hang while running rhr (network) test on RHEL4 with kernel 2.6.12-rc1-mm4
From: Ganesh Venkatesan @ 2005-05-24 18:36 UTC (permalink / raw)
  To: Andrew Morton; +Cc: netdev, hejianj, linuxppc64-dev, Anton Blanchard
In-Reply-To: <20050516025901.4b26ccf3.akpm@osdl.org>

Could you tell me what the rhr test is? Is this an IBM internal test tool?


On 5/16/05, Andrew Morton <akpm@osdl.org> wrote:
> 
> Might be a bug in the e100 driver, might not be.
> 
> I assume this is the
> 
>         BUG_ON(skb->list != NULL);
> 
> in __kfree_skb(), although the line number is off-by-one, and the
> .__kfree_skb+0x188/0x240 would tend to contradict that.  Anton, can you
> help work out where we went splat please?
> 
> tx timeouts are fairly rare events, so this might not be a recently-added
> bug.
> 
> Do we know if it is repeatable?
> 
> 
> 
> Begin forwarded message:
> 
> Date: Mon, 16 May 2005 02:44:04 -0700
> From: bugme-daemon@osdl.org
> To: bugme-new@lists.osdl.org
> Subject: [Bugme-new] [Bug 4628] New: Test server hang while running rhr (network) test on RHEL4 with kernel 2.6.12-rc1-mm4
> 
> 
> http://bugme.osdl.org/show_bug.cgi?id=4628
> 
>            Summary: Test server hang while running rhr (network) test on
>                     RHEL4 with kernel 2.6.12-rc1-mm4
>     Kernel Version: 2.6.12-rc1 with mm4 patch
>             Status: NEW
>           Severity: normal
>              Owner: anton@samba.org
>          Submitter: hejianj@cn.ibm.com
>                 CC: hanwenb@cn.ibm.com,mridge@us.ibm.com,rende@cn.ibm.com,wa
>                     ngjs@cn.ibm.com
> 
> 
> Distribution:
> RHEL4 with kernel 2.6.12-rc1-mm4
> 
> Hardware Environment:
> IBM OpenPower( CHRP IBM,9124-720 )
> 
> Software Environment:
> RHEL4
> RHR: rhr2-rhel4-1.0-14a.noarch.rpm
> 
> Problem Description:
> The test server hang while running rhr (network) test on RHEL4 with kernel
> 2.6.12-rc1-mm4.
> 
> Steps to reproduce:
> 1. Download kernel 2.6.12-rc1 and 2.6.12-rc1-mm4 patch from kernel.org, then
> build the kernel on OpenPower 720
> 2. Download rhr2-rhel4-1.0-14a.noarch.rpm from rhn.redhat.com and install it on
> the test machine.
> 3. Configure and run the rhr test via invoking redhat-ready.
> 
> Additional information:
> Here is the backtrace from xmon.
> 
> 3:mon> e
> cpu 0x3: Vector: 700 (Program Check) at [c00000000ffe7920]
>     pc: c00000000029632c: .__kfree_skb+0x188/0x240
>     lr: c000000000296328: .__kfree_skb+0x184/0x240
>     sp: c00000000ffe7ba0
>    msr: 8000000000029032
>   current = 0xc000000107f94040
>   paca    = 0xc000000000431c00
>     pid   = 0, comm = swapper
> kernel BUG in __kfree_skb at net/core/skbuff.c:282!
> 
> 3:mon> t
> [c00000000ffe7c40] d0000000000ebac4 .e100_rx_clean_list+0xa0/0x144 [e100]
> [c00000000ffe7ce0] d0000000000ed6dc .e100_tx_timeout+0x7c/0xb0 [e100]
> [c00000000ffe7d70] c0000000002b87bc .dev_watchdog+0xc8/0x154
> [c00000000ffe7e00] c00000000006d6b4 .run_timer_softirq+0x180/0x298
> [c00000000ffe7ed0] c0000000000667d8 .__do_softirq+0xdc/0x1b8
> [c00000000ffe7f90] c000000000014bf0 .call_do_softirq+0x14/0x24
> [c000000086b43860] c0000000000102c4 .do_softirq+0x98/0xac
> [c000000086b438f0] c0000000000669cc .irq_exit+0x70/0x8c
> [c000000086b43970] c000000000011fb8 .timer_interrupt+0x398/0x47c
> [c000000086b43a90] c00000000000a2b4 decrementer_common+0xb4/0x100
> --- Exception: 901 (Decrementer) at c000000000010554 .dedicated_idle+0x114/0x280
> [c000000086b43e80] c0000000000108c8 .cpu_idle+0x3c/0x54
> [c000000086b43f00] c00000000003cc8c .start_secondary+0x108/0x148
> [c000000086b43f90] c00000000000bd84 .enable_64b_mode+0x0/0x28
> 
> ------- You are receiving this mail because: -------
> You are on the CC list for the bug, or are watching someone who is.
> 
>

^ permalink raw reply

* Re: [PATCH] bonding using arp_ip_target may stay down with active path
From: Eric Paris @ 2005-05-24 18:31 UTC (permalink / raw)
  To: Jay Vosburgh; +Cc: David S. Miller, netdev, jgarzik, bonding-devel
In-Reply-To: <1116959200.8954.5.camel@localhost.localdomain>

It ate my tabs again.  This mailer is going out the window.

-Eric

On Tue, 2005-05-24 at 14:26 -0400, Eric Paris wrote:
> >On Mon, 2005-05-23 at 14:21 -0700, Jay Vosburgh wrote:
> David S. Miller <davem@davemloft.net> wrote:
> >Patch doesn't apply, tabs turned into spaces by your
> >email client.
> >
> >	As penance for test applying trivial patches by hand, here's a
> >proper version.
> >
> >	-J
> >
> >---
> >	-Jay Vosburgh, IBM Linux Technology Center, fubar@us.ibm.com
> 
> I guess I should be in the signed off list as the original author.
> sorry I'm an idiot and copied and pasted my original message (to the
> bonding-devel list) which screwed up the spacing.
> 
> Signed-off-by: Eric Paris <eparis@parisplace.org>
> Signed-off-by: Jay Vosburgh <fubar@us.ibm.com>
> 
> diff -urN linux-2.6.11/drivers/net/bonding/bond_main.c linux-2.6.11-fix/drivers/net/bonding/bond_main.c
> --- linux-2.6.11/drivers/net/bonding/bond_main.c	2005-05-23 14:07:37.000000000 -0700
> +++ linux-2.6.11-fix/drivers/net/bonding/bond_main.c	2005-05-23 14:08:13.000000000 -0700
> @@ -3046,7 +3046,7 @@
>  			bond_set_slave_inactive_flags(bond->current_arp_slave);
>  
>  			/* search for next candidate */
> -			bond_for_each_slave_from(bond, slave, i, bond->current_arp_slave) {
> +			bond_for_each_slave_from(bond, slave, i, bond->current_arp_slave->next) {
>  				if (IS_UP(slave->dev)) {
>  					slave->link = BOND_LINK_BACK;
>  					bond_set_slave_active_flags(slave);
> 

^ permalink raw reply

* Re: [PATCH] bonding using arp_ip_target may stay down with active path
From: Eric Paris @ 2005-05-24 18:26 UTC (permalink / raw)
  To: Jay Vosburgh; +Cc: David S. Miller, netdev, jgarzik, bonding-devel
In-Reply-To: <200505232121.j4NLLaYa000837@death.nxdomain.ibm.com>

>On Mon, 2005-05-23 at 14:21 -0700, Jay Vosburgh wrote:
David S. Miller <davem@davemloft.net> wrote:
>Patch doesn't apply, tabs turned into spaces by your
>email client.
>
>	As penance for test applying trivial patches by hand, here's a
>proper version.
>
>	-J
>
>---
>	-Jay Vosburgh, IBM Linux Technology Center, fubar@us.ibm.com

I guess I should be in the signed off list as the original author.
sorry I'm an idiot and copied and pasted my original message (to the
bonding-devel list) which screwed up the spacing.

Signed-off-by: Eric Paris <eparis@parisplace.org>
Signed-off-by: Jay Vosburgh <fubar@us.ibm.com>

diff -urN linux-2.6.11/drivers/net/bonding/bond_main.c linux-2.6.11-fix/drivers/net/bonding/bond_main.c
--- linux-2.6.11/drivers/net/bonding/bond_main.c	2005-05-23 14:07:37.000000000 -0700
+++ linux-2.6.11-fix/drivers/net/bonding/bond_main.c	2005-05-23 14:08:13.000000000 -0700
@@ -3046,7 +3046,7 @@
 			bond_set_slave_inactive_flags(bond->current_arp_slave);
 
 			/* search for next candidate */
-			bond_for_each_slave_from(bond, slave, i, bond->current_arp_slave) {
+			bond_for_each_slave_from(bond, slave, i, bond->current_arp_slave->next) {
 				if (IS_UP(slave->dev)) {
 					slave->link = BOND_LINK_BACK;
 					bond_set_slave_active_flags(slave);

^ permalink raw reply

* Re: [1-2/6] ipw2100, ipw2200: patches to merge to kernel
From: Thomas Graf @ 2005-05-24 17:56 UTC (permalink / raw)
  To: Dave Jones; +Cc: Jiri Benc, NetDev, pavel
In-Reply-To: <20050524172416.GB10479@redhat.com>

* Dave Jones <20050524172416.GB10479@redhat.com> 2005-05-24 13:24
> On Tue, May 24, 2005 at 03:15:06PM +0200, Jiri Benc wrote:
>  > Patches to merge the ipw2100 and ipw2200 drivers to the kernel can be
>  > downloaded from:
>  > http://jikos.cz/~jbohac/wifi/import-ipw2100.patch
>  > http://jikos.cz/~jbohac/wifi/import-ipw2200.patch
>  > (they are too large to post them here)
>  > 
>  > The ipw2100 patch is just a merge of ipw2100 driver with Pavel Machek's
>  > cleanup patch.
> 
> It contains a number of bogus uses of HZ.
> 
> +		IPW_DEBUG_INFO("Command completion failed out after %dms.\n",
> +			       HOST_COMPLETE_TIMEOUT / (HZ / 100));
> 
> ..
> 
> +	schedule_timeout(HZ / 100);
> 
> ..
> 
> What I don't understand, is that HZ in kernel-code should be 1000
> according to <asm/param.h>,  though for some reason, I've seen
> divide by zeros, and really strange oopses with this code.
> It's as if its for some reason, choosing to use the userspace HZ
> definition. Hmm, does it need an explicit include of <asm/param.h>
> perhaps ?

It should really use jiffies_to_msecs/usecs. HZ is < 100 on some
architectures and thus results in a division by 0, even it was safe,
the above code is inaccurate for some values of HZ.

^ permalink raw reply

* [PATCH] net/802/tr.c: s/struct rif_cache_s/struct rif_cache/
From: Alexey Dobriyan @ 2005-05-24 17:48 UTC (permalink / raw)
  To: netdev

"_s" suffix is certainly of hungarian origin.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>

--- linux-sparse-001/net/802/tr.c	2005-05-24 19:08:47.000000000 +0400
+++ linux-s/net/802/tr.c	2005-05-24 21:42:33.000000000 +0400
@@ -47,12 +47,12 @@ static void rif_check_expire(unsigned lo
  *	Each RIF entry we learn is kept this way
  */
  
-struct rif_cache_s {	
+struct rif_cache {
 	unsigned char addr[TR_ALEN];
 	int iface;
 	__be16 rcf;
 	__be16 rseg[8];
-	struct rif_cache_s *next;
+	struct rif_cache *next;
 	unsigned long last_used;
 	unsigned char local_ring;
 };
@@ -64,7 +64,7 @@ struct rif_cache_s {	
  *	up a lot.
  */
  
-static struct rif_cache_s *rif_table[RIF_TABLE_SIZE];
+static struct rif_cache *rif_table[RIF_TABLE_SIZE];
 
 static DEFINE_SPINLOCK(rif_lock);
 
@@ -249,7 +249,7 @@ void tr_source_route(struct sk_buff *skb
 {
 	int slack;
 	unsigned int hash;
-	struct rif_cache_s *entry;
+	struct rif_cache *entry;
 	unsigned char *olddata;
 	static const unsigned char mcast_func_addr[] 
 		= {0xC0,0x00,0x00,0x04,0x00,0x00};
@@ -337,7 +337,7 @@ printk("source routing for %02X:%02X:%02
 static void tr_add_rif_info(struct trh_hdr *trh, struct net_device *dev)
 {
 	unsigned int hash, rii_p = 0;
-	struct rif_cache_s *entry;
+	struct rif_cache *entry;
 
 
 	spin_lock_bh(&rif_lock);
@@ -373,7 +373,7 @@ printk("adding rif_entry: addr:%02X:%02X
 		 *	FIXME: We ought to keep some kind of cache size
 		 *	limiting and adjust the timers to suit.
 		 */
-		entry=kmalloc(sizeof(struct rif_cache_s),GFP_ATOMIC);
+		entry=kmalloc(sizeof(struct rif_cache),GFP_ATOMIC);
 
 		if(!entry) 
 		{
@@ -435,7 +435,7 @@ static void rif_check_expire(unsigned lo
 	spin_lock_bh(&rif_lock);
 	
 	for(i =0; i < RIF_TABLE_SIZE; i++) {
-		struct rif_cache_s *entry, **pentry;
+		struct rif_cache *entry, **pentry;
 		
 		pentry = rif_table+i;
 		while((entry=*pentry) != NULL) {
@@ -467,10 +467,10 @@ static void rif_check_expire(unsigned lo
  
 #ifdef CONFIG_PROC_FS
 
-static struct rif_cache_s *rif_get_idx(loff_t pos)
+static struct rif_cache *rif_get_idx(loff_t pos)
 {
 	int i;
-	struct rif_cache_s *entry;
+	struct rif_cache *entry;
 	loff_t off = 0;
 
 	for(i = 0; i < RIF_TABLE_SIZE; i++) 
@@ -493,7 +493,7 @@ static void *rif_seq_start(struct seq_fi
 static void *rif_seq_next(struct seq_file *seq, void *v, loff_t *pos)
 {
 	int i;
-	struct rif_cache_s *ent = v;
+	struct rif_cache *ent = v;
 
 	++*pos;
 
@@ -522,7 +522,7 @@ static void rif_seq_stop(struct seq_file
 static int rif_seq_show(struct seq_file *seq, void *v)
 {
 	int j, rcf_len, segment, brdgnmb;
-	struct rif_cache_s *entry = v;
+	struct rif_cache *entry = v;
 
 	if (v == SEQ_START_TOKEN)
 		seq_puts(seq,

^ permalink raw reply

* [PATCH] tokenring: be'ify trh_hdr, trllc, rif_cache_s
From: Alexey Dobriyan @ 2005-05-24 17:46 UTC (permalink / raw)
  To: netdev

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>

--- linux-sparse-000/include/linux/if_tr.h	2005-05-24 08:49:03.000000000 +0400
+++ linux-sparse-001/include/linux/if_tr.h	2005-05-24 18:57:09.000000000 +0400
@@ -36,8 +36,8 @@ struct trh_hdr {
 	__u8  fc;			/* frame control field */
 	__u8  daddr[TR_ALEN];		/* destination address */
 	__u8  saddr[TR_ALEN];		/* source address */
-	__u16 rcf;			/* route control field */
-	__u16 rseg[8];			/* routing registers */
+	__be16 rcf;			/* route control field */
+	__be16 rseg[8];			/* routing registers */
 };
 
 #ifdef __KERNEL__
@@ -55,7 +55,7 @@ struct trllc {
 	__u8  ssap;			/* source SAP */
 	__u8  llc;			/* LLC control field */
 	__u8  protid[3];		/* protocol id */
-	__u16 ethertype;		/* ether type field */
+	__be16 ethertype;		/* ether type field */
 };
 
 /* Token-Ring statistics collection data. */
--- linux-sparse-000/net/802/tr.c	2005-05-24 08:49:20.000000000 +0400
+++ linux-sparse-001/net/802/tr.c	2005-05-24 19:06:12.000000000 +0400
@@ -50,8 +50,8 @@ static void rif_check_expire(unsigned lo
 struct rif_cache_s {	
 	unsigned char addr[TR_ALEN];
 	int iface;
-	__u16 rcf;
-	__u16 rseg[8];
+	__be16 rcf;
+	__be16 rseg[8];
 	struct rif_cache_s *next;
 	unsigned long last_used;
 	unsigned char local_ring;

^ permalink raw reply

* Tuning GigE NFS / Re: tcp_mem setting bytes or memory pages
From: Paul Griffith @ 2005-05-24 17:38 UTC (permalink / raw)
  To: John Heffner; +Cc: netdev
In-Reply-To: <200505241309.38771.jheffner@psc.edu>

On Tue, May 24, 2005 at 01:09:38PM -0400, John Heffner wrote:
> On Tuesday 24 May 2005 12:59 pm, Paul Griffith wrote:
> > Greetings,
> >
> > I have been searching the Internet for a final answer what the values
> > in net.ipv4.tcp_mem mean.
> >
> > I have seen some sites say it is in memory pages (4K blocks) and other
> > have said it is in KB. What the real answer?
> 
> It's in pages, as described in Documentation/networking/ip-sysctl.txt.  A lot 
> of people have this wrong.  If you find any incorrect sites, could you point 
> them out or send mail to their maintainers?  I've gotten a few corrected that 
> I've noticed so far.
> 
>   -John

Thanks for cleaning that up. I wanted to know, because I am tasked
with tunning a Linux NFS/SMB server on GigE. Details below:

Hardware:
P4/2.8Ghz/1GB/40GB HDD/G4 FX5200
Intel 865PERL

1) When I boot with v2.4.29 on my local computer tcp_mem set to the
   following:
cat /proc/sys/net/ipv4/tcp_mem
49152   65536   98304
(192MB)  (256MB)  (384MB)

2) When I boot the same computer with Knoppix v3.8.2 - v2.6.11.8 #3
cat /proc/sys/net/ipv4/tcp_mem
196608   262144  393216
(768MB)  (1024MB) (1536MB)

3) When I boot the same computer with Slax v5.0.5 - v2.6.11.8 #1
cat /proc/sys/net/ipv4/tcp_mem
98304   131073   196608
(384MB) (512MB)  (768MB)

I can understand the change in the tcp stack from 2.4.x to 2.6.x. What
I don't understand is why one level of the 2.6.11.8 #3 kernel will set
my max TCP_MEM to 1.5 * MEMORY and the other 2.6.11.8 #1 sets TCP_MEM
to .75 * MEMORY.

Anyone one has any idea what is going on here???

I am trying to understand the tcp stack in Linux because I have to
tune a GigE Linux based NFS/SMB server to as our departmental
fileserver. The server is currently using the default tcp settings on 2.4.26
[patched to support quotas on RiserFS].

Thanks
Paul

^ permalink raw reply

* Re: [PATCH] netem: fix logic bug in reorder conditional
From: Julio Kriger @ 2005-05-24 17:27 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: David S. Miller, netdev, netem
In-Reply-To: <20050524095707.678f77ba@dxpl.pdx.osdl.net>

On 5/24/05, Stephen Hemminger <shemminger@osdl.org> wrote:
> On Tue, 24 May 2005 12:41:11 -0300
> Julio Kriger <juliokriger@gmail.com> wrote:
> 
> > > > 2) If I set latency = 50ms and a jitter = 300ms, tabledist can give me
> > > > a negative number. This value is addes to cb->time_to_send, so it
> > > > could change it to a negative value. Should we only accept positives
> > > > number before add it to cb->time_to_send? or will
> > > > q->qdisc->enqueue(skb, q->qdisc) put the package on the queue in a
> > > > special way so it will be handled "before" other packages alrealy on
> > > > the queue but with gretaer time_to_send?
> > >
> > > probably should bound the value to 0 before the addition, to avoid large
> > > wraparound problems, but since enqueue checks for for time it will work
> > > as long as delta less than 2^32/2.
> > >
> >
> > I think the value should be restricted to be positive and greater than
> > zero. Becuase if a negative number is allowed we will be "losing"
> > packages to be reordered, hence we will not be reordering, say 25%, of
> > packages instead we will be reordering about 15%.
> > In other words, packages that should be reordered will not be
> > reordered because its new time to send will be the same as the old
> > time to send.
> > Regards,
> > Julio
> 
> The problem is that the user specification (latency 50ms +/- 300ms with reordering)
> is problematic. Just like specifying reordering without delay (and a fast connection).

I agree with you. Maybe changing the actual parameters to a "range"
could be a better solution. Say "I want delay a package between 50 and
300 ms with correlation of 50% and normal distribution". The code
should not change too much, I think.

Regards,
Julio


-- 
----------------------------
Julio Kriger
mailto:juliokriger@gmail.com

^ permalink raw reply

* Re: [1-2/6] ipw2100, ipw2200: patches to merge to kernel
From: Dave Jones @ 2005-05-24 17:24 UTC (permalink / raw)
  To: Jiri Benc; +Cc: NetDev, pavel
In-Reply-To: <20050524151506.48e5db65@griffin.suse.cz>

On Tue, May 24, 2005 at 03:15:06PM +0200, Jiri Benc wrote:
 > Patches to merge the ipw2100 and ipw2200 drivers to the kernel can be
 > downloaded from:
 > http://jikos.cz/~jbohac/wifi/import-ipw2100.patch
 > http://jikos.cz/~jbohac/wifi/import-ipw2200.patch
 > (they are too large to post them here)
 > 
 > The ipw2100 patch is just a merge of ipw2100 driver with Pavel Machek's
 > cleanup patch.

It contains a number of bogus uses of HZ.

+		IPW_DEBUG_INFO("Command completion failed out after %dms.\n",
+			       HOST_COMPLETE_TIMEOUT / (HZ / 100));

..

+	schedule_timeout(HZ / 100);

..

What I don't understand, is that HZ in kernel-code should be 1000
according to <asm/param.h>,  though for some reason, I've seen
divide by zeros, and really strange oopses with this code.
It's as if its for some reason, choosing to use the userspace HZ
definition. Hmm, does it need an explicit include of <asm/param.h>
perhaps ?

		Dave

^ permalink raw reply

* Re: tcp_mem setting bytes or memory pages
From: John Heffner @ 2005-05-24 17:09 UTC (permalink / raw)
  To: Paul Griffith; +Cc: netdev
In-Reply-To: <20050524125951.C11337@cs.yorku.ca>

On Tuesday 24 May 2005 12:59 pm, Paul Griffith wrote:
> Greetings,
>
> I have been searching the Internet for a final answer what the values
> in net.ipv4.tcp_mem mean.
>
> I have seen some sites say it is in memory pages (4K blocks) and other
> have said it is in KB. What the real answer?

It's in pages, as described in Documentation/networking/ip-sysctl.txt.  A lot 
of people have this wrong.  If you find any incorrect sites, could you point 
them out or send mail to their maintainers?  I've gotten a few corrected that 
I've noticed so far.

  -John

^ permalink raw reply

* [PATCH] neighbour tables via rtnetlink v2
From: Thomas Graf @ 2005-05-24 17:02 UTC (permalink / raw)
  To: netdev

Setting of values is still untested due to missing userspace part but
reading of the configuration and the statistics works. Example libnl
output including full statistics:

arp_cache entries 2 reachable 26s 156msec retrans 1s
    thresh1 128 thresh2 512 thresh3 1024
    key-len 4 entry-size 152 last-flush 24m 19s 474msec
    hash-rand 0xC7089C95/0x00000003 gc 1 last-rand 4s 472msec
    refcnt 1 qlen 3 proxy-qlen 64 locktime 1s base-reachable 30s
    app-probes 0 ucast-probes 3 mcast-probes 3 gc-stale-time 1m
    probe-delay 5s anycast-delay 1s proxy-delay 800msec
    lookups 65 hits 62 failed 0 allocations 3 destroys 1
    hash-grows 1 forced-gc-runs 0 periodic-gc-runs 387
    rcv-unicast-probes 0 rcv-multicast-probes 0

and for device specific parameter sets:

arp_cache<eth0> reachable 22s 443msec retrans 1s
    refcnt 3 qlen 3 proxy-qlen 64 locktime 1s base-reachable 30s
    app-probes 0 ucast-probes 3 mcast-probes 3 gc-stale-time 1m
    probe-delay 5s anycast-delay 1s proxy-delay 800msec

I use msecs for all time values instead of user HZ and seconds
to allow for greater precision and less headache for userspace.

Attached are 3 patches, new netlink and rtnetlink shortcuts
for prettier message building and the actual new code.

[NETLINK] New message building macros

 NLMSG_NEW(skb, pid, sequence, type, length)
   Start a new netlink message, returns message header.
  
 NLMSG_NEW_ANSWER(skb, nlcb, type, length)
   Start a new netlink message as answer to a request,
   returns message header.

 NLMSG_END(skb, nlh)
   End a netlink message, fixes total message length,
   returns skb->len.

 NLMSG_CANCEL(skb, nlh)
   Cancel the building process and trim whole message
   from skb again, returns -1.

Signed-off-by: Thomas Graf <tgraf@suug.ch>

---
commit 7250be2b3e192904e66ce314a3d2d2e46bc8bce2
tree 4f7a765c06386f20a3a9b68eea4efd57e2b354ad
parent d1faeaeb95a05275cf0c5b51b88f2fa833434625
author Thomas Graf <tgraf@suug.ch> Tue, 24 May 2005 14:26:10 +0200
committer Thomas Graf <tgraf@suug.ch> Tue, 24 May 2005 14:26:10 +0200

 include/linux/netlink.h |   22 ++++++++++++++++++++--
 1 files changed, 20 insertions(+), 2 deletions(-)

Index: include/linux/netlink.h
===================================================================
--- c6f827347b3c6c28bc55a8eb1e62ea2659202cab/include/linux/netlink.h  (mode:100644)
+++ 4f7a765c06386f20a3a9b68eea4efd57e2b354ad/include/linux/netlink.h  (mode:100644)
@@ -170,9 +170,27 @@
 	return nlh;
 }
 
+#define NLMSG_END(skb, nlh) \
+({	(nlh)->nlmsg_len = (skb)->tail - (unsigned char *) (nlh); \
+	skb->len; })
+
+#define NLMSG_CANCEL(skb, nlh) \
+({	skb_trim((skb), (unsigned char *) (nlh) - (skb)->data); \
+	-1; })
+
 #define NLMSG_PUT(skb, pid, seq, type, len) \
-({ if (skb_tailroom(skb) < (int)NLMSG_SPACE(len)) goto nlmsg_failure; \
-   __nlmsg_put(skb, pid, seq, type, len); })
+({	if (skb_tailroom(skb) < (int)NLMSG_SPACE(len)) \
+		goto nlmsg_failure; \
+	__nlmsg_put(skb, pid, seq, type, len); })
+
+#define NLMSG_NEW(skb, pid, seq, type, len) \
+({	struct nlmsghdr *_hdr = NLMSG_PUT(skb, pid, seq, type, len); \
+	_hdr->nlmsg_flags = pid ? NLM_F_MULTI : 0; \
+	_hdr; })
+
+#define NLMSG_NEW_ANSWER(skb, cb, type, len) \
+	NLMSG_NEW(skb, NETLINK_CB((cb)->skb).pid, \
+		  (cb)->nlh->nlmsg_seq, type, len)
 
 extern int netlink_dump_start(struct sock *ssk, struct sk_buff *skb,
 			      struct nlmsghdr *nlh,


[RTNETLINK] Routing attribute related shortcuts

 RTA_GET_U(32|64)(tlv)
   Assumes tlv is a u32/u64 field and returns its value.

 RTA_GET_[M]SECS(tlv)
   Assumes tlv is a u64 and transports jiffies converted
   to seconds or milliseconds and returns its value.

 RTA_PUT_U(32|64)(skb, type, value)
   Appends %value as fixed u32/u64 to %skb as TLV %type.

 RTA_PUT_[M]SECS(skb, type, jiffies)
   Converts %jiffies to secs/msecs and appends it as u64
   to %skb as TLV %type.

 RTA_PUT_STRING(skb, type, string)
   Appends %NUL terminated %string to %skb as TLV %type.

 RTA_NEST(skb, type)
   Starts a nested TLV %type and returns the nesting handle.

 RTA_END_NEST(skb, nesting_handle)
   Finishes the nested TLV %nesting_handle, must be called
   symmetric to RTA_NEST().

Signed-off-by: Thomas Graf <tgraf@suug.ch>

---
commit edab564809178ad08753d8d620fc9b518898fd79
tree d3a4a96913f779af77cd3486cdeb701dc92efed0
parent 7250be2b3e192904e66ce314a3d2d2e46bc8bce2
author Thomas Graf <tgraf@suug.ch> Tue, 24 May 2005 18:47:38 +0200
committer Thomas Graf <tgraf@suug.ch> Tue, 24 May 2005 18:47:38 +0200

 include/linux/rtnetlink.h |   37 +++++++++++++++++++++++++++++++++++++
 1 files changed, 37 insertions(+)

Index: include/linux/rtnetlink.h
===================================================================
--- 4f7a765c06386f20a3a9b68eea4efd57e2b354ad/include/linux/rtnetlink.h  (mode:100644)
+++ d3a4a96913f779af77cd3486cdeb701dc92efed0/include/linux/rtnetlink.h  (mode:100644)
@@ -123,8 +123,20 @@
 #define RTA_DATA(rta)   ((void*)(((char*)(rta)) + RTA_LENGTH(0)))
 #define RTA_PAYLOAD(rta) ((int)((rta)->rta_len) - RTA_LENGTH(0))
 
+#define RTA_GET_U32(rta) \
+({	if (!rta || RTA_PAYLOAD(rta) < sizeof(u32)) \
+		goto rtattr_failure; \
+	*(u32 *) RTA_DATA(rta); })
 
+#define RTA_GET_U64(rta) \
+({	u64 _tmp; \
+	if (!rta || RTA_PAYLOAD(rta) < sizeof(u64)) \
+		goto rtattr_failure; \
+	memcpy(&_tmp, RTA_DATA(rta), sizeof(_tmp)); \
+	_tmp; })
 
+#define RTA_GET_SECS(rta) ((unsigned long) RTA_GET_U64(rta) * HZ)
+#define RTA_GET_MSECS(rta) (msecs_to_jiffies((unsigned long) RTA_GET_U64(rta)))
 
 /******************************************************************************
  *		Definitions used in routing table administration.
@@ -789,6 +801,31 @@
 ({	if (unlikely(skb_tailroom(skb) < (int)(attrlen))) \
 		goto rtattr_failure; \
 	memcpy(skb_put(skb, RTA_ALIGN(attrlen)), data, attrlen); })
+
+#define RTA_PUT_U32(skb, attrtype, value) \
+({	u32 _tmp = (value); \
+	RTA_PUT(skb, attrtype, sizeof(u32), &_tmp); })
+
+#define RTA_PUT_U64(skb, attrtype, value) \
+({	u64 _tmp = (value); \
+	RTA_PUT(skb, attrtype, sizeof(u64), &_tmp); })
+
+#define RTA_PUT_SECS(skb, attrtype, value) \
+	RTA_PUT_U64(skb, attrtype, (value) / HZ)
+
+#define RTA_PUT_MSECS(skb, attrtype, value) \
+	RTA_PUT_U64(skb, attrtype, jiffies_to_msecs(value))
+
+#define RTA_PUT_STRING(skb, attrtype, value) \
+	RTA_PUT(skb, attrtype, strlen(value) + 1, value)
+
+#define RTA_NEST(skb, type) \
+({	struct rtattr *__start = (struct rtattr *) (skb)->tail; \
+	RTA_PUT(skb, type, 0, NULL); \
+	__start;  })
+
+#define RTA_END_NEST(skb, start) \
+({	(start)->rta_len = ((skb)->tail - (unsigned char *) (start)); })
 		
 static inline struct rtattr *
 __rta_reserve(struct sk_buff *skb, int attrtype, int attrlen)


[NEIGH] neighbour table configuration and statistics via rtnetlink

Signed-off-by: Thomas Graf <tgraf@suug.ch>

---
commit 51565b40aef15f4e4b5748f9d71121e029bc4fe7
tree 7fdf80f0bf19d8ed075ee7f423173f0838c87683
parent edab564809178ad08753d8d620fc9b518898fd79
author Thomas Graf <tgraf@suug.ch> Tue, 24 May 2005 18:48:08 +0200
committer Thomas Graf <tgraf@suug.ch> Tue, 24 May 2005 18:48:08 +0200

 include/linux/rtnetlink.h   |   94 +++++++++++++
 include/net/neighbour.h     |    4 
 net/core/neighbour.c        |  310 +++++++++++++++++++++++++++++++++++++++++++-
 net/core/rtnetlink.c        |   20 +-
 security/selinux/nlmsgtab.c |    2 
 5 files changed, 419 insertions(+), 11 deletions(-)

Index: include/linux/rtnetlink.h
===================================================================
--- d3a4a96913f779af77cd3486cdeb701dc92efed0/include/linux/rtnetlink.h  (mode:100644)
+++ 7fdf80f0bf19d8ed075ee7f423173f0838c87683/include/linux/rtnetlink.h  (mode:100644)
@@ -89,6 +89,13 @@
 	RTM_GETANYCAST	= 62,
 #define RTM_GETANYCAST	RTM_GETANYCAST
 
+	RTM_NEWNEIGHTBL	= 64,
+#define RTM_NEWNEIGHTBL	RTM_NEWNEIGHTBL
+	RTM_GETNEIGHTBL	= 66,
+#define RTM_GETNEIGHTBL	RTM_GETNEIGHTBL
+	RTM_SETNEIGHTBL,
+#define RTM_SETNEIGHTBL	RTM_SETNEIGHTBL
+
 	__RTM_MAX,
 #define RTM_MAX		(((__RTM_MAX + 3) & ~3) - 1)
 };
@@ -505,6 +512,93 @@
 	__u32		ndm_refcnt;
 };
 
+
+/*****************************************************************
+ *		Neighbour tables specific messages.
+ *
+ * Message Ordering:
+ * Phase 1: foreach neighbour table
+ *          neighbour table base configuration and statistics
+ *          NDTA_NAME, NDTA_CONFIG, NDTA_THRESH[1-3], NDTA_STATS
+ *          NDTA_PARMS
+ *
+ * Phase 2: foreach neighbour table device parameter set
+ *          NDTA_NAME, NDTA_PARMS
+ ****/
+
+struct ndt_stats
+{
+	__u64		ndts_allocs;
+	__u64		ndts_destroys;
+	__u64		ndts_hash_grows;
+	__u64		ndts_res_failed;
+	__u64		ndts_lookups;
+	__u64		ndts_hits;
+	__u64		ndts_rcv_probes_mcast;
+	__u64		ndts_rcv_probes_ucast;
+	__u64		ndts_periodic_gc_runs;
+	__u64		ndts_forced_gc_runs;
+};
+
+enum {
+	NDTPA_UNSPEC,
+	NDTPA_IFINDEX,			/* u32, read-only */
+	NDTPA_REFCNT,			/* u32, read-only */
+	NDTPA_REACHABLE_TIME,		/* u64, msecs, read-only */
+	NDTPA_BASE_REACHABLE_TIME,	/* u64, msecs */
+	NDTPA_RETRANS_TIME,		/* u64, msecs */
+	NDTPA_GC_STALETIME,		/* u64, msecs */
+	NDTPA_DELAY_PROBE_TIME,		/* u64, msecs */
+	NDTPA_QUEUE_LEN,		/* u32 */
+	NDTPA_APP_PROBES,		/* u32 */
+	NDTPA_UCAST_PROBES,		/* u32 */
+	NDTPA_MCAST_PROBES,		/* u32 */
+	NDTPA_ANYCAST_DELAY,		/* u64, msecs */
+	NDTPA_PROXY_DELAY,		/* u64, msecs */
+	NDTPA_PROXY_QLEN,		/* u32 */
+	NDTPA_LOCKTIME,			/* u64, msecs */
+	__NDTPA_MAX
+};
+#define NDTPA_MAX (__NDTPA_MAX - 1)
+
+struct ndtmsg
+{
+	__u8		ndtm_family;
+	__u8		ndtm_pad1;
+	__u16		ndtm_pad2;
+};
+
+struct ndt_config
+{
+	__u16		ndtc_key_len;
+	__u16		ndtc_entry_size;
+	__u32		ndtc_entries;
+	__u32		ndtc_last_flush;	/* delta to now in msecs */
+	__u32		ndtc_last_rand;		/* delta to now in msecs */
+	__u32		ndtc_hash_rnd;
+	__u32		ndtc_hash_mask;
+	__u32		ndtc_hash_chain_gc;
+	__u32		ndtc_proxy_qlen;
+};
+
+enum {
+	NDTA_UNSPEC,
+	NDTA_NAME,			/* char * */
+	NDTA_THRESH1,			/* u32 */
+	NDTA_THRESH2,			/* u32 */
+	NDTA_THRESH3,			/* u32 */
+	NDTA_CONFIG,			/* struct ndt_config */
+	NDTA_PARMS,			/* NDTPA_* */
+	NDTA_STATS,			/* struct ndt_stats */
+	__NDTA_MAX
+};
+#define NDTA_MAX (__NDTA_MAX - 1)
+
+#define NDTA_RTA(r) ((struct rtattr*)(((char*)(r)) + \
+		     NLMSG_ALIGN(sizeof(struct ndtmsg))))
+#define NDTA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct ndtmsg))
+
+
 /****
  *		General form of address family dependent message.
  ****/
Index: include/net/neighbour.h
===================================================================
--- d3a4a96913f779af77cd3486cdeb701dc92efed0/include/net/neighbour.h  (mode:100644)
+++ 7fdf80f0bf19d8ed075ee7f423173f0838c87683/include/net/neighbour.h  (mode:100644)
@@ -65,6 +65,7 @@
 
 struct neigh_parms
 {
+	struct net_device *dev;
 	struct neigh_parms *next;
 	int	(*neigh_setup)(struct neighbour *);
 	struct neigh_table *tbl;
@@ -252,6 +253,9 @@
 extern int neigh_delete(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg);
 extern void neigh_app_ns(struct neighbour *n);
 
+extern int neightbl_dump_info(struct sk_buff *skb, struct netlink_callback *cb);
+extern int neightbl_set(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg);
+
 extern void neigh_for_each(struct neigh_table *tbl, void (*cb)(struct neighbour *, void *), void *cookie);
 extern void __neigh_for_each_release(struct neigh_table *tbl, int (*cb)(struct neighbour *));
 extern void pneigh_for_each(struct neigh_table *tbl, void (*cb)(struct pneigh_entry *));
Index: net/core/neighbour.c
===================================================================
--- d3a4a96913f779af77cd3486cdeb701dc92efed0/net/core/neighbour.c  (mode:100644)
+++ 7fdf80f0bf19d8ed075ee7f423173f0838c87683/net/core/neighbour.c  (mode:100644)
@@ -1276,9 +1276,14 @@
 		INIT_RCU_HEAD(&p->rcu_head);
 		p->reachable_time =
 				neigh_rand_reach_time(p->base_reachable_time);
-		if (dev && dev->neigh_setup && dev->neigh_setup(dev, p)) {
-			kfree(p);
-			return NULL;
+		if (dev) {
+			if (dev->neigh_setup && dev->neigh_setup(dev, p)) {
+				kfree(p);
+				return NULL;
+			}
+
+			dev_hold(dev);
+			p->dev = dev;
 		}
 		p->sysctl_table = NULL;
 		write_lock_bh(&tbl->lock);
@@ -1309,6 +1314,8 @@
 			*p = parms->next;
 			parms->dead = 1;
 			write_unlock_bh(&tbl->lock);
+			if (parms->dev)
+				dev_put(parms->dev);
 			call_rcu(&parms->rcu_head, neigh_rcu_free_parms);
 			return;
 		}
@@ -1546,6 +1553,301 @@
 	return err;
 }
 
+static int neightbl_fill_parms(struct sk_buff *skb, struct neigh_parms *parms)
+{
+	struct rtattr *nest_parms = RTA_NEST(skb, NDTA_PARMS);
+
+	if (parms->dev)
+		RTA_PUT_U32(skb, NDTPA_IFINDEX, parms->dev->ifindex);
+
+	RTA_PUT_U32(skb, NDTPA_REFCNT, atomic_read(&parms->refcnt));
+	RTA_PUT_U32(skb, NDTPA_QUEUE_LEN, parms->queue_len);
+	RTA_PUT_U32(skb, NDTPA_PROXY_QLEN, parms->proxy_qlen);
+	RTA_PUT_U32(skb, NDTPA_APP_PROBES, parms->app_probes);
+	RTA_PUT_U32(skb, NDTPA_UCAST_PROBES, parms->ucast_probes);
+	RTA_PUT_U32(skb, NDTPA_MCAST_PROBES, parms->mcast_probes);
+	RTA_PUT_MSECS(skb, NDTPA_REACHABLE_TIME, parms->reachable_time);
+	RTA_PUT_MSECS(skb, NDTPA_BASE_REACHABLE_TIME,
+		      parms->base_reachable_time);
+	RTA_PUT_MSECS(skb, NDTPA_GC_STALETIME, parms->gc_staletime);
+	RTA_PUT_MSECS(skb, NDTPA_DELAY_PROBE_TIME, parms->delay_probe_time);
+	RTA_PUT_MSECS(skb, NDTPA_RETRANS_TIME, parms->retrans_time);
+	RTA_PUT_MSECS(skb, NDTPA_ANYCAST_DELAY, parms->anycast_delay);
+	RTA_PUT_MSECS(skb, NDTPA_PROXY_DELAY, parms->proxy_delay);
+	RTA_PUT_MSECS(skb, NDTPA_LOCKTIME, parms->locktime);
+
+	RTA_END_NEST(skb, nest_parms);
+	return 0;
+
+rtattr_failure:
+	return -1;
+}
+
+static int neightbl_fill_info(struct neigh_table *tbl, struct sk_buff *skb,
+			      struct netlink_callback *cb)
+{
+	struct nlmsghdr *nlh;
+	struct ndtmsg *ndtmsg;
+
+	nlh = NLMSG_NEW_ANSWER(skb, cb, RTM_NEWNEIGHTBL, sizeof(struct ndtmsg));
+	ndtmsg = NLMSG_DATA(nlh);
+
+	read_lock_bh(&tbl->lock);
+	ndtmsg->ndtm_family = tbl->family;
+
+	RTA_PUT_STRING(skb, NDTA_NAME, tbl->id);
+	RTA_PUT_U32(skb, NDTA_THRESH1, tbl->gc_thresh1);
+	RTA_PUT_U32(skb, NDTA_THRESH2, tbl->gc_thresh2);
+	RTA_PUT_U32(skb, NDTA_THRESH3, tbl->gc_thresh3);
+
+	{
+		unsigned long now = jiffies;
+		unsigned int flush_delta = now - tbl->last_flush;
+		unsigned int rand_delta = now - tbl->last_rand;
+
+		struct ndt_config ndc = {
+			.ndtc_key_len		= tbl->key_len,
+			.ndtc_entry_size	= tbl->entry_size,
+			.ndtc_entries		= atomic_read(&tbl->entries),
+			.ndtc_last_flush	= jiffies_to_msecs(flush_delta),
+			.ndtc_last_rand		= jiffies_to_msecs(rand_delta),
+			.ndtc_hash_rnd		= tbl->hash_rnd,
+			.ndtc_hash_mask		= tbl->hash_mask,
+			.ndtc_hash_chain_gc	= tbl->hash_chain_gc,
+			.ndtc_proxy_qlen	= tbl->proxy_queue.qlen,
+		};
+
+		RTA_PUT(skb, NDTA_CONFIG, sizeof(ndc), &ndc);
+	}
+
+	{
+		int cpu;
+		struct ndt_stats ndst;
+
+		memset(&ndst, 0, sizeof(ndst));
+
+		for (cpu = 0; cpu < NR_CPUS; cpu++) {
+			struct neigh_statistics	*st;
+
+			if (!cpu_possible(cpu))
+				continue;
+
+			st = per_cpu_ptr(tbl->stats, cpu);
+			ndst.ndts_allocs		+= st->allocs;
+			ndst.ndts_destroys		+= st->destroys;
+			ndst.ndts_hash_grows		+= st->hash_grows;
+			ndst.ndts_res_failed		+= st->res_failed;
+			ndst.ndts_lookups		+= st->lookups;
+			ndst.ndts_hits			+= st->hits;
+			ndst.ndts_rcv_probes_mcast	+= st->rcv_probes_mcast;
+			ndst.ndts_rcv_probes_ucast	+= st->rcv_probes_ucast;
+			ndst.ndts_periodic_gc_runs	+= st->periodic_gc_runs;
+			ndst.ndts_forced_gc_runs	+= st->forced_gc_runs;
+		}
+
+		RTA_PUT(skb, NDTA_STATS, sizeof(ndst), &ndst);
+	}
+
+	BUG_ON(tbl->parms.dev);
+	if (neightbl_fill_parms(skb, &tbl->parms) < 0)
+		goto rtattr_failure;
+
+	read_unlock_bh(&tbl->lock);
+	return NLMSG_END(skb, nlh);
+
+rtattr_failure:
+	read_unlock_bh(&tbl->lock);
+	return NLMSG_CANCEL(skb, nlh);
+ 
+nlmsg_failure:
+	return -1;
+}
+
+static int neightbl_fill_param_info(struct neigh_table *tbl,
+				    struct neigh_parms *parms,
+				    struct sk_buff *skb,
+				    struct netlink_callback *cb)
+{
+	struct ndtmsg *ndtmsg;
+	struct nlmsghdr *nlh;
+
+	nlh = NLMSG_NEW_ANSWER(skb, cb, RTM_NEWNEIGHTBL, sizeof(struct ndtmsg));
+	ndtmsg = NLMSG_DATA(nlh);
+
+	read_lock_bh(&tbl->lock);
+	ndtmsg->ndtm_family = tbl->family;
+	RTA_PUT_STRING(skb, NDTA_NAME, tbl->id);
+
+	if (neightbl_fill_parms(skb, parms) < 0)
+		goto rtattr_failure;
+
+	read_unlock_bh(&tbl->lock);
+	return NLMSG_END(skb, nlh);
+
+rtattr_failure:
+	read_unlock_bh(&tbl->lock);
+	return NLMSG_CANCEL(skb, nlh);
+
+nlmsg_failure:
+	return -1;
+}
+ 
+static inline struct neigh_parms *lookup_neigh_params(struct neigh_table *tbl,
+						      int ifindex)
+{
+	struct neigh_parms *p;
+	
+	for (p = &tbl->parms; p; p = p->next)
+		if ((p->dev && p->dev->ifindex == ifindex) ||
+		    (!p->dev && !ifindex))
+			return p;
+
+	return NULL;
+}
+
+int neightbl_set(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
+{
+	struct neigh_table *tbl;
+	struct ndtmsg *ndtmsg = NLMSG_DATA(nlh);
+	struct rtattr **tb = arg;
+	int err = -EINVAL;
+
+	if (!tb[NDTA_NAME - 1] || !RTA_PAYLOAD(tb[NDTA_NAME - 1]))
+		return -EINVAL;
+
+	read_lock(&neigh_tbl_lock);
+	for (tbl = neigh_tables; tbl; tbl = tbl->next) {
+		if (ndtmsg->ndtm_family && tbl->family != ndtmsg->ndtm_family)
+			continue;
+
+		if (!rtattr_strcmp(tb[NDTA_NAME - 1], tbl->id))
+			break;
+	}
+
+	if (tbl == NULL) {
+		err = -ENOENT;
+		goto errout;
+	}
+
+	/* 
+	 * We acquire tbl->lock to be nice to the periodic timers and
+	 * make sure they always see a consistent set of values.
+	 */
+	write_lock_bh(&tbl->lock);
+
+	if (tb[NDTA_THRESH1 - 1])
+		tbl->gc_thresh1 = RTA_GET_U32(tb[NDTA_THRESH1 - 1]);
+
+	if (tb[NDTA_THRESH2 - 1])
+		tbl->gc_thresh2 = RTA_GET_U32(tb[NDTA_THRESH2 - 1]);
+
+	if (tb[NDTA_THRESH3 - 1])
+		tbl->gc_thresh3 = RTA_GET_U32(tb[NDTA_THRESH3 - 1]);
+
+	if (tb[NDTA_PARMS - 1]) {
+		struct rtattr *tbp[NDTPA_MAX];
+		struct neigh_parms *p;
+		u32 ifindex = 0;
+
+		if (rtattr_parse_nested(tbp, NDTPA_MAX, tb[NDTA_PARMS - 1]) < 0)
+			goto rtattr_failure;
+
+		if (tbp[NDTPA_IFINDEX - 1])
+			ifindex = RTA_GET_U32(tbp[NDTPA_IFINDEX - 1]);
+
+		p = lookup_neigh_params(tbl, ifindex);
+		if (p == NULL) {
+			err = -ENOENT;
+			goto rtattr_failure;
+		}
+	
+		if (tbp[NDTPA_QUEUE_LEN - 1])
+			p->queue_len = RTA_GET_U32(tbp[NDTPA_QUEUE_LEN - 1]);
+
+		if (tbp[NDTPA_PROXY_QLEN - 1])
+			p->proxy_qlen = RTA_GET_U32(tbp[NDTPA_PROXY_QLEN - 1]);
+
+		if (tbp[NDTPA_APP_PROBES - 1])
+			p->app_probes = RTA_GET_U32(tbp[NDTPA_APP_PROBES - 1]);
+
+		if (tbp[NDTPA_UCAST_PROBES - 1])
+			p->ucast_probes =
+			   RTA_GET_U32(tbp[NDTPA_UCAST_PROBES - 1]);
+
+		if (tbp[NDTPA_MCAST_PROBES - 1])
+			p->mcast_probes =
+			   RTA_GET_U32(tbp[NDTPA_MCAST_PROBES - 1]);
+
+		if (tbp[NDTPA_BASE_REACHABLE_TIME - 1])
+			p->base_reachable_time =
+			   RTA_GET_MSECS(tbp[NDTPA_BASE_REACHABLE_TIME - 1]);
+
+		if (tbp[NDTPA_GC_STALETIME - 1])
+			p->gc_staletime =
+			   RTA_GET_MSECS(tbp[NDTPA_GC_STALETIME - 1]);
+
+		if (tbp[NDTPA_DELAY_PROBE_TIME - 1])
+			p->delay_probe_time =
+			   RTA_GET_MSECS(tbp[NDTPA_DELAY_PROBE_TIME - 1]);
+
+		if (tbp[NDTPA_RETRANS_TIME - 1])
+			p->retrans_time =
+			   RTA_GET_MSECS(tbp[NDTPA_RETRANS_TIME - 1]);
+
+		if (tbp[NDTPA_ANYCAST_DELAY - 1])
+			p->anycast_delay =
+			   RTA_GET_MSECS(tbp[NDTPA_ANYCAST_DELAY - 1]);
+
+		if (tbp[NDTPA_PROXY_DELAY - 1])
+			p->proxy_delay =
+			   RTA_GET_MSECS(tbp[NDTPA_PROXY_DELAY - 1]);
+
+		if (tbp[NDTPA_LOCKTIME - 1])
+			p->locktime = RTA_GET_MSECS(tbp[NDTPA_LOCKTIME - 1]);
+	}
+
+	err = 0;
+
+rtattr_failure:
+	write_unlock_bh(&tbl->lock);
+errout:
+	read_unlock(&neigh_tbl_lock);
+	return err;
+}
+
+int neightbl_dump_info(struct sk_buff *skb, struct netlink_callback *cb)
+{
+	int idx, family;
+	int s_idx = cb->args[0];
+	struct neigh_table *tbl;
+
+	family = ((struct rtgenmsg *)NLMSG_DATA(cb->nlh))->rtgen_family;
+
+	read_lock(&neigh_tbl_lock);
+	for (tbl = neigh_tables, idx = 0; tbl; tbl = tbl->next) {
+		struct neigh_parms *p;
+
+		if (idx < s_idx || (family && tbl->family != family))
+			continue;
+
+		if (neightbl_fill_info(tbl, skb, cb) <= 0)
+			break;
+
+		for (++idx, p = tbl->parms.next; p; p = p->next, idx++) {
+			if (idx < s_idx)
+				continue;
+
+			if (neightbl_fill_param_info(tbl, p, skb, cb) <= 0)
+				goto out;
+		}
+
+	}
+out:
+	read_unlock(&neigh_tbl_lock);
+	cb->args[0] = idx;
+
+	return skb->len;
+}
 
 static int neigh_fill_info(struct sk_buff *skb, struct neighbour *n,
 			   u32 pid, u32 seq, int event)
@@ -2352,6 +2654,8 @@
 EXPORT_SYMBOL(neigh_update_hhs);
 EXPORT_SYMBOL(pneigh_enqueue);
 EXPORT_SYMBOL(pneigh_lookup);
+EXPORT_SYMBOL(neightbl_dump_info);
+EXPORT_SYMBOL(neightbl_set);
 
 #ifdef CONFIG_ARPD
 EXPORT_SYMBOL(neigh_app_ns);
Index: net/core/rtnetlink.c
===================================================================
--- d3a4a96913f779af77cd3486cdeb701dc92efed0/net/core/rtnetlink.c  (mode:100644)
+++ 7fdf80f0bf19d8ed075ee7f423173f0838c87683/net/core/rtnetlink.c  (mode:100644)
@@ -100,6 +100,7 @@
 	[RTM_FAM(RTM_NEWPREFIX)]    = NLMSG_LENGTH(sizeof(struct rtgenmsg)),
 	[RTM_FAM(RTM_GETMULTICAST)] = NLMSG_LENGTH(sizeof(struct rtgenmsg)),
 	[RTM_FAM(RTM_GETANYCAST)]   = NLMSG_LENGTH(sizeof(struct rtgenmsg)),
+	[RTM_FAM(RTM_NEWNEIGHTBL)]  = NLMSG_LENGTH(sizeof(struct ndtmsg)),
 };
 
 static const int rta_max[RTM_NR_FAMILIES] =
@@ -113,6 +114,7 @@
 	[RTM_FAM(RTM_NEWTCLASS)]    = TCA_MAX,
 	[RTM_FAM(RTM_NEWTFILTER)]   = TCA_MAX,
 	[RTM_FAM(RTM_NEWACTION)]    = TCAA_MAX,
+	[RTM_FAM(RTM_NEWNEIGHTBL)]  = NDTA_MAX,
 };
 
 void __rta_fill(struct sk_buff *skb, int attrtype, int attrlen, const void *data)
@@ -649,14 +651,16 @@
 
 static struct rtnetlink_link link_rtnetlink_table[RTM_NR_MSGTYPES] =
 {
-	[RTM_GETLINK  - RTM_BASE] = { .dumpit = rtnetlink_dump_ifinfo },
-	[RTM_SETLINK  - RTM_BASE] = { .doit   = do_setlink	      },
-	[RTM_GETADDR  - RTM_BASE] = { .dumpit = rtnetlink_dump_all    },
-	[RTM_GETROUTE - RTM_BASE] = { .dumpit = rtnetlink_dump_all    },
-	[RTM_NEWNEIGH - RTM_BASE] = { .doit   = neigh_add	      },
-	[RTM_DELNEIGH - RTM_BASE] = { .doit   = neigh_delete	      },
-	[RTM_GETNEIGH - RTM_BASE] = { .dumpit = neigh_dump_info	      },
-	[RTM_GETRULE  - RTM_BASE] = { .dumpit = rtnetlink_dump_all    },
+	[RTM_GETLINK     - RTM_BASE] = { .dumpit = rtnetlink_dump_ifinfo },
+	[RTM_SETLINK     - RTM_BASE] = { .doit   = do_setlink		 },
+	[RTM_GETADDR     - RTM_BASE] = { .dumpit = rtnetlink_dump_all	 },
+	[RTM_GETROUTE    - RTM_BASE] = { .dumpit = rtnetlink_dump_all	 },
+	[RTM_NEWNEIGH    - RTM_BASE] = { .doit   = neigh_add		 },
+	[RTM_DELNEIGH    - RTM_BASE] = { .doit   = neigh_delete		 },
+	[RTM_GETNEIGH    - RTM_BASE] = { .dumpit = neigh_dump_info	 },
+	[RTM_GETRULE     - RTM_BASE] = { .dumpit = rtnetlink_dump_all	 },
+	[RTM_GETNEIGHTBL - RTM_BASE] = { .dumpit = neightbl_dump_info	 },
+	[RTM_SETNEIGHTBL - RTM_BASE] = { .doit   = neightbl_set		 },
 };
 
 static int rtnetlink_event(struct notifier_block *this, unsigned long event, void *ptr)
Index: security/selinux/nlmsgtab.c
===================================================================
--- d3a4a96913f779af77cd3486cdeb701dc92efed0/security/selinux/nlmsgtab.c  (mode:100644)
+++ 7fdf80f0bf19d8ed075ee7f423173f0838c87683/security/selinux/nlmsgtab.c  (mode:100644)
@@ -63,6 +63,8 @@
 	{ RTM_GETPREFIX,	NETLINK_ROUTE_SOCKET__NLMSG_READ  },
 	{ RTM_GETMULTICAST,	NETLINK_ROUTE_SOCKET__NLMSG_READ  },
 	{ RTM_GETANYCAST,	NETLINK_ROUTE_SOCKET__NLMSG_READ  },
+	{ RTM_GETNEIGHTBL,	NETLINK_ROUTE_SOCKET__NLMSG_READ  },
+	{ RTM_SETNEIGHTBL,	NETLINK_ROUTE_SOCKET__NLMSG_WRITE },
 };
 
 static struct nlmsg_perm nlmsg_firewall_perms[] =

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox