Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH 1/3] PPC 44x EMAC driver: add 440SPe support
From: Jeff Garzik @ 2005-10-29 22:07 UTC (permalink / raw)
  To: Eugene Surovegin; +Cc: netdev, linuxppc-embedded
In-Reply-To: <20051029194314.GB1865@gate.ebshome.net>

applied 1-3

^ permalink raw reply

* [2.6 patch] kernel/: small cleanups
From: Adrian Bunk @ 2005-10-30  1:02 UTC (permalink / raw)
  To: linux-kernel; +Cc: Paul E. McKenney, dwmw2, linux-audit, faith, george, netdev

This patch contains the following cleanups:
- make needlessly global functions static
- every file should include the headers containing the prototypes for
  it's global functions


Signed-off-by: Adrian Bunk <bunk@stusta.de>

---

 kernel/audit.c      |    2 +-
 kernel/irq/proc.c   |    2 ++
 kernel/rcutorture.c |    2 +-
 kernel/timer.c      |    1 +
 4 files changed, 5 insertions(+), 2 deletions(-)

--- linux-2.6.14-rc5-mm1-full/kernel/timer.c.old	2005-10-30 02:27:36.000000000 +0200
+++ linux-2.6.14-rc5-mm1-full/kernel/timer.c	2005-10-30 02:27:56.000000000 +0200
@@ -33,6 +33,7 @@
 #include <linux/posix-timers.h>
 #include <linux/cpu.h>
 #include <linux/syscalls.h>
+#include <linux/delay.h>
 
 #include <asm/uaccess.h>
 #include <asm/unistd.h>
--- linux-2.6.14-rc5-mm1-full/kernel/irq/proc.c.old	2005-10-30 02:31:31.000000000 +0200
+++ linux-2.6.14-rc5-mm1-full/kernel/irq/proc.c	2005-10-30 02:31:48.000000000 +0200
@@ -10,6 +10,8 @@
 #include <linux/proc_fs.h>
 #include <linux/interrupt.h>
 
+#include "internals.h"
+
 static struct proc_dir_entry *root_irq_dir, *irq_dir[NR_IRQS];
 
 #ifdef CONFIG_SMP
--- linux-2.6.14-rc5-mm1-full/kernel/audit.c.old	2005-10-30 02:33:08.000000000 +0200
+++ linux-2.6.14-rc5-mm1-full/kernel/audit.c	2005-10-30 02:33:15.000000000 +0200
@@ -272,7 +272,7 @@
 	return old;
 }
 
-int kauditd_thread(void *dummy)
+static int kauditd_thread(void *dummy)
 {
 	struct sk_buff *skb;
 
--- linux-2.6.14-rc5-mm1-full/kernel/rcutorture.c.old	2005-10-30 02:33:35.000000000 +0200
+++ linux-2.6.14-rc5-mm1-full/kernel/rcutorture.c	2005-10-30 02:33:53.000000000 +0200
@@ -99,7 +99,7 @@
 /*
  * Allocate an element from the rcu_tortures pool.
  */
-struct rcu_torture *
+static struct rcu_torture *
 rcu_torture_alloc(void)
 {
 	struct list_head *p;

^ permalink raw reply

* Eradicate everything you owe with out sending another dime
From: conchita mccoy @ 2005-10-30  4:58 UTC (permalink / raw)
  To: Divina Nguyen


Abolish all you are indebted for without mailing another cent.  
Stop the embarrassing telephone calls. Eliminate the sending of checks!
Believe it or not a good number lending institutions not following the
banking laws here. Mind-boggling but accurate! 
Visit our web site for comprehensive particulars in relation to our
procedure at NO cost or requirement. You have zilch to lose and heaps to
reap.

http://ar.geocities.com/bernard_wooid/?1=37.Do away with all that you owe
with out mailing an other dime
Complete info or to cease getting or to comprehend our mailng address

Develop profit & customer base immediately with skilled , large quantity
e-mail advertising campaign
Rely on most experienced quality_items_ideas@uk2.net

Just before he reached Tokio he came to a military fort, and for nearly an
hour watched the skilful maneuvers of a regiment of soldiers at their
morning drill. They were not very big people, compared with other nations,
but they seemed alert and well trained, and the boy decided it would require
a brave enemy to face them on a field of battle
Having at length satisfied his curiosity as to Japanese life and customs
Rob prepared for his long flight across the Pacific Ocean

^ permalink raw reply

* [2.6 patch] drivers/net/arcnet/: possible cleanups
From: Adrian Bunk @ 2005-10-30 10:50 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: akpm, linux-kernel, netdev
In-Reply-To: <43281950.7000004@pobox.com>

On Wed, Sep 14, 2005 at 08:36:32AM -0400, Jeff Garzik wrote:
> akpm@osdl.org wrote:
> >From: Adrian Bunk <bunk@stusta.de>
> >
> >This patch contains the following possible cleanups:
> >- make needlessly global code static
> >- arcnet.c: remove the outdated VERSION
> 
> continually NAK'd, because it removes a version that may be relevant to 
> somebody as a reference.

OK, what about the patch below that leaves the VERSION #define but 
doesn't print this 5 year old version string?


<--  snip  -->


This patch contains the following possible cleanups:
- make needlessly global code static
- arcnet.c: don't print the outdated VERSION
- arcnet.c: remove the unneeded EXPORT_SYMBOL(arc_proto_null)
- arcnet.c: remove the unneeded EXPORT_SYMBOL(arcnet_dump_packet)

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>

---

 drivers/net/arcnet/arc-rawmode.c |    2 +-
 drivers/net/arcnet/arcnet.c      |   17 ++++++++++-------
 drivers/net/arcnet/rfc1051.c     |    2 +-
 drivers/net/arcnet/rfc1201.c     |    2 +-
 include/linux/arcdevice.h        |    9 ---------
 5 files changed, 13 insertions(+), 19 deletions(-)
      
diff -puN drivers/net/arcnet/arcnet.c~drivers-net-arcnet-possible-cleanups drivers/net/arcnet/arcnet.c
--- devel/drivers/net/arcnet/arcnet.c~drivers-net-arcnet-possible-cleanups	2005-07-09 01:24:43.000000000 -0700
+++ devel-akpm/drivers/net/arcnet/arcnet.c	2005-07-09 01:24:43.000000000 -0700
@@ -61,6 +59,7 @@ static int null_build_header(struct sk_b
 static int null_prepare_tx(struct net_device *dev, struct archdr *pkt,
 			   int length, int bufnum);
 
+static void arcnet_rx(struct net_device *dev, int bufnum);
 
 /*
  * one ArcProto per possible proto ID.  None of the elements of
@@ -71,7 +70,7 @@ static int null_prepare_tx(struct net_de
  struct ArcProto *arc_proto_map[256], *arc_proto_default,
    *arc_bcast_proto, *arc_raw_proto;
 
-struct ArcProto arc_proto_null =
+static struct ArcProto arc_proto_null =
 {
 	.suffix		= '?',
 	.mtu		= XMTU,
@@ -90,7 +89,6 @@ EXPORT_SYMBOL(arc_proto_map);
 EXPORT_SYMBOL(arc_proto_default);
 EXPORT_SYMBOL(arc_bcast_proto);
 EXPORT_SYMBOL(arc_raw_proto);
-EXPORT_SYMBOL(arc_proto_null);
 EXPORT_SYMBOL(arcnet_unregister_proto);
 EXPORT_SYMBOL(arcnet_debug);
 EXPORT_SYMBOL(alloc_arcdev);
@@ -118,7 +116,7 @@ static int __init arcnet_init(void)
 
 	arcnet_debug = debug;
 
-	printk(VERSION);
+	printk("arcnet loaded.\n");
 
 #ifdef ALPHA_WARNING
 	BUGLVL(D_EXTRA) {
@@ -178,8 +176,8 @@ EXPORT_SYMBOL(arcnet_dump_skb);
  * Dump the contents of an ARCnet buffer
  */
 #if (ARCNET_DEBUG_MAX & (D_RX | D_TX))
-void arcnet_dump_packet(struct net_device *dev, int bufnum, char *desc,
-			int take_arcnet_lock)
+static void arcnet_dump_packet(struct net_device *dev, int bufnum,
+			       char *desc, int take_arcnet_lock)
 {
 	struct arcnet_local *lp = dev->priv;
 	int i, length;
@@ -208,7 +206,10 @@ void arcnet_dump_packet(struct net_devic
 
 }
 
-EXPORT_SYMBOL(arcnet_dump_packet);
+#else
+
+#define arcnet_dump_packet(dev, bufnum, desc,take_arcnet_lock) do { } while (0)
+
 #endif
 
 
@@ -987,7 +988,7 @@ irqreturn_t arcnet_interrupt(int irq, vo
  * This is a generic packet receiver that calls arcnet??_rx depending on the
  * protocol ID found.
  */
-void arcnet_rx(struct net_device *dev, int bufnum)
+static void arcnet_rx(struct net_device *dev, int bufnum)
 {
 	struct arcnet_local *lp = dev->priv;
 	struct archdr pkt;
diff -puN drivers/net/arcnet/arc-rawmode.c~drivers-net-arcnet-possible-cleanups drivers/net/arcnet/arc-rawmode.c
--- devel/drivers/net/arcnet/arc-rawmode.c~drivers-net-arcnet-possible-cleanups	2005-07-09 01:24:43.000000000 -0700
+++ devel-akpm/drivers/net/arcnet/arc-rawmode.c	2005-07-09 01:24:43.000000000 -0700
@@ -42,7 +42,7 @@ static int build_header(struct sk_buff *
 static int prepare_tx(struct net_device *dev, struct archdr *pkt, int length,
 		      int bufnum);
 
-struct ArcProto rawmode_proto =
+static struct ArcProto rawmode_proto =
 {
 	.suffix		= 'r',
 	.mtu		= XMTU,
diff -puN drivers/net/arcnet/rfc1051.c~drivers-net-arcnet-possible-cleanups drivers/net/arcnet/rfc1051.c
--- devel/drivers/net/arcnet/rfc1051.c~drivers-net-arcnet-possible-cleanups	2005-07-09 01:24:43.000000000 -0700
+++ devel-akpm/drivers/net/arcnet/rfc1051.c	2005-07-09 01:24:43.000000000 -0700
@@ -43,7 +43,7 @@ static int prepare_tx(struct net_device 
 		      int bufnum);
 
 
-struct ArcProto rfc1051_proto =
+static struct ArcProto rfc1051_proto =
 {
 	.suffix		= 's',
 	.mtu		= XMTU - RFC1051_HDR_SIZE,
diff -puN drivers/net/arcnet/rfc1201.c~drivers-net-arcnet-possible-cleanups drivers/net/arcnet/rfc1201.c
--- devel/drivers/net/arcnet/rfc1201.c~drivers-net-arcnet-possible-cleanups	2005-07-09 01:24:43.000000000 -0700
+++ devel-akpm/drivers/net/arcnet/rfc1201.c	2005-07-09 01:24:43.000000000 -0700
@@ -43,7 +43,7 @@ static int prepare_tx(struct net_device 
 		      int bufnum);
 static int continue_tx(struct net_device *dev, int bufnum);
 
-struct ArcProto rfc1201_proto =
+static struct ArcProto rfc1201_proto =
 {
 	.suffix		= 'a',
 	.mtu		= 1500,	/* could be more, but some receivers can't handle it... */
diff -puN include/linux/arcdevice.h~drivers-net-arcnet-possible-cleanups include/linux/arcdevice.h
--- devel/include/linux/arcdevice.h~drivers-net-arcnet-possible-cleanups	2005-07-09 01:24:43.000000000 -0700
+++ devel-akpm/include/linux/arcdevice.h	2005-07-09 01:24:43.000000000 -0700
@@ -206,7 +206,6 @@ struct ArcProto {
 
 extern struct ArcProto *arc_proto_map[256], *arc_proto_default,
 	*arc_bcast_proto, *arc_raw_proto;
-extern struct ArcProto arc_proto_null;
 
 
 /*
@@ -334,17 +333,9 @@ void arcnet_dump_skb(struct net_device *
 #define arcnet_dump_skb(dev,skb,desc) ;
 #endif
 
-#if (ARCNET_DEBUG_MAX & D_RX) || (ARCNET_DEBUG_MAX & D_TX)
-void arcnet_dump_packet(struct net_device *dev, int bufnum, char *desc,
-			int take_arcnet_lock);
-#else
-#define arcnet_dump_packet(dev, bufnum, desc,take_arcnet_lock) ;
-#endif
-
 void arcnet_unregister_proto(struct ArcProto *proto);
 irqreturn_t arcnet_interrupt(int irq, void *dev_id, struct pt_regs *regs);
 struct net_device *alloc_arcdev(char *name);
-void arcnet_rx(struct net_device *dev, int bufnum);
 
 #endif				/* __KERNEL__ */
 #endif				/* _LINUX_ARCDEVICE_H */
_

^ permalink raw reply

* [PATCH][MCAST]IPv6: doubt about ipv6_sk_mc_lock usage.
From: Yan Zheng @ 2005-10-30 15:44 UTC (permalink / raw)
  To: netdev; +Cc: linux-kernel

Hello.

I think ipv6_sk_mc_lock should protest both ipv6_mc_list and it's sflist. because they can are used by 
inet6_mc_check(...) in softirq and be modified by ip6_mc_source(...) or ip6_mc_msfilter(...) simultaneity.
I also remove read_lock when traverse ipv6_mc_list, because it's protected by lock_sock(sk).

Regards

Signed-off-by: Yan Zheng <yanzheng@21cn.com>

Index: net/ipv6/mcast.c
====================================================================
--- linux-2.6.14/net/ipv6/mcast.c	2005-10-30 23:09:33.000000000 +0800
+++ linux/net/ipv6/mcast.c	2005-10-30 23:00:24.000000000 +0800
@@ -188,15 +188,12 @@ int ipv6_sock_mc_join(struct sock *sk, i
 	if (!ipv6_addr_is_multicast(addr))
 		return -EINVAL;
 
-	read_lock_bh(&ipv6_sk_mc_lock);
 	for (mc_lst=np->ipv6_mc_list; mc_lst; mc_lst=mc_lst->next) {
 		if ((ifindex == 0 || mc_lst->ifindex == ifindex) &&
 		    ipv6_addr_equal(&mc_lst->addr, addr)) {
-			read_unlock_bh(&ipv6_sk_mc_lock);
 			return -EADDRINUSE;
 		}
 	}
-	read_unlock_bh(&ipv6_sk_mc_lock);
 
 	mc_lst = sock_kmalloc(sk, sizeof(struct ipv6_mc_socklist), GFP_KERNEL);
 
@@ -379,7 +376,6 @@ int ip6_mc_source(int add, int omode, st
 
 	err = -EADDRNOTAVAIL;
 
-	read_lock_bh(&ipv6_sk_mc_lock);
 	for (pmc=inet6->ipv6_mc_list; pmc; pmc=pmc->next) {
 		if (pgsr->gsr_interface && pmc->ifindex != pgsr->gsr_interface)
 			continue;
@@ -400,7 +396,7 @@ int ip6_mc_source(int add, int omode, st
 		/* allow mode switches for empty-set filters */
 		ip6_mc_add_src(idev, group, omode, 0, NULL, 0);
 		ip6_mc_del_src(idev, group, pmc->sfmode, 0, NULL, 0);
-		pmc->sfmode = omode;
+		pmc->sfmode = omode; //need a write lock ?
 	}
 
 	psl = pmc->sflist;
@@ -425,10 +421,12 @@ int ip6_mc_source(int add, int omode, st
 
 		/* update the interface filter */
 		ip6_mc_del_src(idev, group, omode, 1, source, 1);
-
+		
+		write_lock_bh(&ipv6_sk_mc_lock);
 		for (j=i+1; j<psl->sl_count; j++)
 			psl->sl_addr[j-1] = psl->sl_addr[j];
 		psl->sl_count--;
+		write_unlock_bh(&ipv6_sk_mc_lock);
 		err = 0;
 		goto done;
 	}
@@ -455,9 +453,12 @@ int ip6_mc_source(int add, int omode, st
 		if (psl) {
 			for (i=0; i<psl->sl_count; i++)
 				newpsl->sl_addr[i] = psl->sl_addr[i];
-			sock_kfree_s(sk, psl, IP6_SFLSIZE(psl->sl_max));
 		}
+		write_lock_bh(&ipv6_sk_mc_lock);
+		if (psl) 
+			sock_kfree_s(sk, psl, IP6_SFLSIZE(psl->sl_max));
 		pmc->sflist = psl = newpsl;
+		write_unlock_bh(&ipv6_sk_mc_lock);
 	}
 	rv = 1;	/* > 0 for insert logic below if sl_count is 0 */
 	for (i=0; i<psl->sl_count; i++) {
@@ -467,15 +468,16 @@ int ip6_mc_source(int add, int omode, st
 	}
 	if (rv == 0)		/* address already there is an error */
 		goto done;
+	write_lock_bh(&ipv6_sk_mc_lock);
 	for (j=psl->sl_count-1; j>=i; j--)
 		psl->sl_addr[j+1] = psl->sl_addr[j];
 	psl->sl_addr[i] = *source;
 	psl->sl_count++;
+	write_unlock_bh(&ipv6_sk_mc_lock);
 	err = 0;
 	/* update the interface list */
 	ip6_mc_add_src(idev, group, omode, 1, source, 1);
 done:
-	read_unlock_bh(&ipv6_sk_mc_lock);
 	read_unlock_bh(&idev->lock);
 	in6_dev_put(idev);
 	dev_put(dev);
@@ -548,14 +550,17 @@ int ip6_mc_msfilter(struct sock *sk, str
 	} else
 		newpsl = NULL;
 	psl = pmc->sflist;
-	if (psl) {
+	if (psl) 
 		(void) ip6_mc_del_src(idev, group, pmc->sfmode,
 			psl->sl_count, psl->sl_addr, 0);
-		sock_kfree_s(sk, psl, IP6_SFLSIZE(psl->sl_max));
-	} else
+	else
 		(void) ip6_mc_del_src(idev, group, pmc->sfmode, 0, NULL, 0);
+	write_lock_bh(&ipv6_sk_mc_lock);
+	if (psl) 
+		sock_kfree_s(sk, psl, IP6_SFLSIZE(psl->sl_max));
 	pmc->sflist = newpsl;
 	pmc->sfmode = gsf->gf_fmode;
+	write_unlock_bh(&ipv6_sk_mc_lock);
 	err = 0;
 done:
 	read_unlock_bh(&idev->lock);

^ permalink raw reply

* [2.6 patch] drivers/net/ixgb/: make some code static
From: Adrian Bunk @ 2005-10-30 15:53 UTC (permalink / raw)
  To: ayyappan.veeraiyan, ganesh.venkatesan, john.ronciak
  Cc: jgarzik, netdev, linux-kernel

This patch makes some needlessly global code static.


Signed-off-by: Adrian Bunk <bunk@stusta.de>

---

 drivers/net/ixgb/ixgb_ethtool.c |    2 +-
 drivers/net/ixgb/ixgb_hw.c      |   31 ++++++++++++++++++++++---------
 drivers/net/ixgb/ixgb_hw.h      |   17 -----------------
 drivers/net/ixgb/ixgb_main.c    |    2 +-
 4 files changed, 24 insertions(+), 28 deletions(-)

--- linux-2.6.14-rc5-mm1-full/drivers/net/ixgb/ixgb_ethtool.c.old	2005-10-30 15:37:22.000000000 +0100
+++ linux-2.6.14-rc5-mm1-full/drivers/net/ixgb/ixgb_ethtool.c	2005-10-30 15:37:29.000000000 +0100
@@ -694,7 +694,7 @@
 	}
 }
 
-struct ethtool_ops ixgb_ethtool_ops = {
+static struct ethtool_ops ixgb_ethtool_ops = {
 	.get_settings = ixgb_get_settings,
 	.set_settings = ixgb_set_settings,
 	.get_drvinfo = ixgb_get_drvinfo,
--- linux-2.6.14-rc5-mm1-full/drivers/net/ixgb/ixgb_hw.h.old	2005-10-30 15:37:57.000000000 +0100
+++ linux-2.6.14-rc5-mm1-full/drivers/net/ixgb/ixgb_hw.h	2005-10-30 15:41:28.000000000 +0100
@@ -784,23 +784,8 @@
 extern boolean_t ixgb_adapter_stop(struct ixgb_hw *hw);
 extern boolean_t ixgb_init_hw(struct ixgb_hw *hw);
 extern boolean_t ixgb_adapter_start(struct ixgb_hw *hw);
-extern void ixgb_init_rx_addrs(struct ixgb_hw *hw);
 extern void ixgb_check_for_link(struct ixgb_hw *hw);
 extern boolean_t ixgb_check_for_bad_link(struct ixgb_hw *hw);
-extern boolean_t ixgb_setup_fc(struct ixgb_hw *hw);
-extern void ixgb_clear_hw_cntrs(struct ixgb_hw *hw);
-extern boolean_t mac_addr_valid(uint8_t *mac_addr);
-
-extern uint16_t ixgb_read_phy_reg(struct ixgb_hw *hw,
-				uint32_t reg_addr,
-				uint32_t phy_addr,
-				uint32_t device_type);
-
-extern void ixgb_write_phy_reg(struct ixgb_hw *hw,
-				uint32_t reg_addr,
-				uint32_t phy_addr,
-				uint32_t device_type,
-				uint16_t data);
 
 extern void ixgb_rar_set(struct ixgb_hw *hw,
 				uint8_t *addr,
@@ -818,8 +803,6 @@
 				 uint32_t offset,
 				 uint32_t value);
 
-extern void ixgb_clear_vfta(struct ixgb_hw *hw);
-
 /* Access functions to eeprom data */
 void ixgb_get_ee_mac_addr(struct ixgb_hw *hw, uint8_t *mac_addr);
 uint32_t ixgb_get_ee_pba_number(struct ixgb_hw *hw);
--- linux-2.6.14-rc5-mm1-full/drivers/net/ixgb/ixgb_hw.c.old	2005-10-30 15:38:11.000000000 +0100
+++ linux-2.6.14-rc5-mm1-full/drivers/net/ixgb/ixgb_hw.c	2005-10-30 15:41:44.000000000 +0100
@@ -47,9 +47,22 @@
 
 static ixgb_phy_type ixgb_identify_phy(struct ixgb_hw *hw);
 
-uint32_t ixgb_mac_reset(struct ixgb_hw *hw);
+static void ixgb_clear_hw_cntrs(struct ixgb_hw *hw);
 
-uint32_t ixgb_mac_reset(struct ixgb_hw *hw)
+static void ixgb_clear_vfta(struct ixgb_hw *hw);
+
+static void ixgb_init_rx_addrs(struct ixgb_hw *hw);
+
+static uint16_t ixgb_read_phy_reg(struct ixgb_hw *hw,
+				  uint32_t reg_address,
+				  uint32_t phy_address,
+				  uint32_t device_type);
+
+static boolean_t ixgb_setup_fc(struct ixgb_hw *hw);
+
+static boolean_t mac_addr_valid(uint8_t *mac_addr);
+
+static uint32_t ixgb_mac_reset(struct ixgb_hw *hw)
 {
 	uint32_t ctrl_reg;
 
@@ -335,7 +348,7 @@
  * of the receive addresss registers. Clears the multicast table. Assumes
  * the receiver is in reset when the routine is called.
  *****************************************************************************/
-void
+static void
 ixgb_init_rx_addrs(struct ixgb_hw *hw)
 {
 	uint32_t i;
@@ -604,7 +617,7 @@
  *
  * hw - Struct containing variables accessed by shared code
  *****************************************************************************/
-void
+static void
 ixgb_clear_vfta(struct ixgb_hw *hw)
 {
 	uint32_t offset;
@@ -620,7 +633,7 @@
  * hw - Struct containing variables accessed by shared code
  *****************************************************************************/
 
-boolean_t
+static boolean_t
 ixgb_setup_fc(struct ixgb_hw *hw)
 {
 	uint32_t ctrl_reg;
@@ -722,7 +735,7 @@
  * This requires that first an address cycle command is sent, followed by a
  * read command.
  *****************************************************************************/
-uint16_t
+static uint16_t
 ixgb_read_phy_reg(struct ixgb_hw *hw,
 		uint32_t reg_address,
 		uint32_t phy_address,
@@ -815,7 +828,7 @@
  * This requires that first an address cycle command is sent, followed by a
  * write command.
  *****************************************************************************/
-void
+static void
 ixgb_write_phy_reg(struct ixgb_hw *hw,
 			uint32_t reg_address,
 			uint32_t phy_address,
@@ -959,7 +972,7 @@
  *
  * hw - Struct containing variables accessed by shared code
  *****************************************************************************/
-void
+static void
 ixgb_clear_hw_cntrs(struct ixgb_hw *hw)
 {
 	volatile uint32_t temp_reg;
@@ -1114,7 +1127,7 @@
  * mac_addr - pointer to MAC address.
  *
  *****************************************************************************/
-boolean_t
+static boolean_t
 mac_addr_valid(uint8_t *mac_addr)
 {
 	boolean_t is_valid = TRUE;
--- linux-2.6.14-rc5-mm1-full/drivers/net/ixgb/ixgb_main.c.old	2005-10-30 15:42:00.000000000 +0100
+++ linux-2.6.14-rc5-mm1-full/drivers/net/ixgb/ixgb_main.c	2005-10-30 15:42:10.000000000 +0100
@@ -45,7 +45,7 @@
  */
 
 char ixgb_driver_name[] = "ixgb";
-char ixgb_driver_string[] = "Intel(R) PRO/10GbE Network Driver";
+static char ixgb_driver_string[] = "Intel(R) PRO/10GbE Network Driver";
 
 #ifndef CONFIG_IXGB_NAPI
 #define DRIVERNAPI

^ permalink raw reply

* [2.6 patch] drivers/net/e1000/: possible cleanups
From: Adrian Bunk @ 2005-10-30 15:53 UTC (permalink / raw)
  To: cramerj, john.ronciak, ganesh.venkatesan; +Cc: jgarzik, netdev, linux-kernel

This patch contains the following possible cleanups:
- make needlessly global code static
- #if 0 the following unused global functions:
  - e1000_hw.c: e1000_mc_addr_list_update
  - e1000_hw.c: e1000_read_reg_io
  - e1000_hw.c: e1000_enable_pciex_master


Signed-off-by: Adrian Bunk <bunk@stusta.de>

---

 drivers/net/e1000/e1000_ethtool.c |    2 
 drivers/net/e1000/e1000_hw.c      |  101 ++++++++++++++++++++----------
 drivers/net/e1000/e1000_hw.h      |   42 ------------
 drivers/net/e1000/e1000_main.c    |   31 ++++-----
 4 files changed, 87 insertions(+), 89 deletions(-)

--- linux-2.6.14-rc5-mm1-full/drivers/net/e1000/e1000_ethtool.c.old	2005-10-30 15:48:13.000000000 +0100
+++ linux-2.6.14-rc5-mm1-full/drivers/net/e1000/e1000_ethtool.c	2005-10-30 15:48:20.000000000 +0100
@@ -1739,7 +1739,7 @@
 	}
 }
 
-struct ethtool_ops e1000_ethtool_ops = {
+static struct ethtool_ops e1000_ethtool_ops = {
 	.get_settings           = e1000_get_settings,
 	.set_settings           = e1000_set_settings,
 	.get_drvinfo            = e1000_get_drvinfo,
--- linux-2.6.14-rc5-mm1-full/drivers/net/e1000/e1000_hw.h.old	2005-10-30 15:48:35.000000000 +0100
+++ linux-2.6.14-rc5-mm1-full/drivers/net/e1000/e1000_hw.h	2005-10-30 16:04:05.000000000 +0100
@@ -284,7 +284,6 @@
 /* Initialization */
 int32_t e1000_reset_hw(struct e1000_hw *hw);
 int32_t e1000_init_hw(struct e1000_hw *hw);
-int32_t e1000_id_led_init(struct e1000_hw * hw);
 int32_t e1000_set_mac_type(struct e1000_hw *hw);
 void e1000_set_media_type(struct e1000_hw *hw);
 
@@ -292,10 +291,8 @@
 int32_t e1000_setup_link(struct e1000_hw *hw);
 int32_t e1000_phy_setup_autoneg(struct e1000_hw *hw);
 void e1000_config_collision_dist(struct e1000_hw *hw);
-int32_t e1000_config_fc_after_link_up(struct e1000_hw *hw);
 int32_t e1000_check_for_link(struct e1000_hw *hw);
 int32_t e1000_get_speed_and_duplex(struct e1000_hw *hw, uint16_t * speed, uint16_t * duplex);
-int32_t e1000_wait_autoneg(struct e1000_hw *hw);
 int32_t e1000_force_mac_fc(struct e1000_hw *hw);
 
 /* PHY */
@@ -303,21 +300,11 @@
 int32_t e1000_write_phy_reg(struct e1000_hw *hw, uint32_t reg_addr, uint16_t data);
 int32_t e1000_phy_hw_reset(struct e1000_hw *hw);
 int32_t e1000_phy_reset(struct e1000_hw *hw);
-int32_t e1000_detect_gig_phy(struct e1000_hw *hw);
 int32_t e1000_phy_get_info(struct e1000_hw *hw, struct e1000_phy_info *phy_info);
-int32_t e1000_phy_m88_get_info(struct e1000_hw *hw, struct e1000_phy_info *phy_info);
-int32_t e1000_phy_igp_get_info(struct e1000_hw *hw, struct e1000_phy_info *phy_info);
-int32_t e1000_get_cable_length(struct e1000_hw *hw, uint16_t *min_length, uint16_t *max_length);
-int32_t e1000_check_polarity(struct e1000_hw *hw, uint16_t *polarity);
-int32_t e1000_check_downshift(struct e1000_hw *hw);
 int32_t e1000_validate_mdi_setting(struct e1000_hw *hw);
 
 /* EEPROM Functions */
 int32_t e1000_init_eeprom_params(struct e1000_hw *hw);
-boolean_t e1000_is_onboard_nvm_eeprom(struct e1000_hw *hw);
-int32_t e1000_read_eeprom_eerd(struct e1000_hw *hw, uint16_t offset, uint16_t words, uint16_t *data);
-int32_t e1000_write_eeprom_eewr(struct e1000_hw *hw, uint16_t offset, uint16_t words, uint16_t *data);
-int32_t e1000_poll_eerd_eewr_done(struct e1000_hw *hw, int eerd);
 
 /* MNG HOST IF functions */
 uint32_t e1000_enable_mng_pass_thru(struct e1000_hw *hw);
@@ -377,13 +364,6 @@
 							uint16_t length);
 boolean_t e1000_check_mng_mode(struct e1000_hw *hw);
 boolean_t e1000_enable_tx_pkt_filtering(struct e1000_hw *hw);
-int32_t e1000_mng_enable_host_if(struct e1000_hw *hw);
-int32_t e1000_mng_host_if_write(struct e1000_hw *hw, uint8_t *buffer,
-                            uint16_t length, uint16_t offset, uint8_t *sum);
-int32_t e1000_mng_write_cmd_header(struct e1000_hw* hw, 
-                                   struct e1000_host_mng_command_header* hdr);
-
-int32_t e1000_mng_write_commit(struct e1000_hw *hw);
 
 int32_t e1000_read_eeprom(struct e1000_hw *hw, uint16_t reg, uint16_t words, uint16_t *data);
 int32_t e1000_validate_eeprom_checksum(struct e1000_hw *hw);
@@ -395,13 +375,10 @@
 void e1000_swfw_sync_release(struct e1000_hw *hw, uint16_t mask);
 
 /* Filters (multicast, vlan, receive) */
-void e1000_init_rx_addrs(struct e1000_hw *hw);
-void e1000_mc_addr_list_update(struct e1000_hw *hw, uint8_t * mc_addr_list, uint32_t mc_addr_count, uint32_t pad, uint32_t rar_used_count);
 uint32_t e1000_hash_mc_addr(struct e1000_hw *hw, uint8_t * mc_addr);
 void e1000_mta_set(struct e1000_hw *hw, uint32_t hash_value);
 void e1000_rar_set(struct e1000_hw *hw, uint8_t * mc_addr, uint32_t rar_index);
 void e1000_write_vfta(struct e1000_hw *hw, uint32_t offset, uint32_t value);
-void e1000_clear_vfta(struct e1000_hw *hw);
 
 /* LED functions */
 int32_t e1000_setup_led(struct e1000_hw *hw);
@@ -412,7 +389,6 @@
 /* Adaptive IFS Functions */
 
 /* Everything else */
-void e1000_clear_hw_cntrs(struct e1000_hw *hw);
 void e1000_reset_adaptive(struct e1000_hw *hw);
 void e1000_update_adaptive(struct e1000_hw *hw);
 void e1000_tbi_adjust_stats(struct e1000_hw *hw, struct e1000_hw_stats *stats, uint32_t frame_len, uint8_t * mac_addr);
@@ -423,29 +399,11 @@
 void e1000_write_pci_cfg(struct e1000_hw *hw, uint32_t reg, uint16_t * value);
 /* Port I/O is only supported on 82544 and newer */
 uint32_t e1000_io_read(struct e1000_hw *hw, unsigned long port);
-uint32_t e1000_read_reg_io(struct e1000_hw *hw, uint32_t offset);
 void e1000_io_write(struct e1000_hw *hw, unsigned long port, uint32_t value);
-void e1000_write_reg_io(struct e1000_hw *hw, uint32_t offset, uint32_t value);
-int32_t e1000_config_dsp_after_link_change(struct e1000_hw *hw, boolean_t link_up);
-int32_t e1000_set_d3_lplu_state(struct e1000_hw *hw, boolean_t active);
-int32_t e1000_set_d0_lplu_state(struct e1000_hw *hw, boolean_t active);
-void e1000_set_pci_express_master_disable(struct e1000_hw *hw);
-void e1000_enable_pciex_master(struct e1000_hw *hw);
 int32_t e1000_disable_pciex_master(struct e1000_hw *hw);
-int32_t e1000_get_auto_rd_done(struct e1000_hw *hw);
-int32_t e1000_get_phy_cfg_done(struct e1000_hw *hw);
 int32_t e1000_get_software_semaphore(struct e1000_hw *hw);
 void e1000_release_software_semaphore(struct e1000_hw *hw);
 int32_t e1000_check_phy_reset_block(struct e1000_hw *hw);
-int32_t e1000_get_hw_eeprom_semaphore(struct e1000_hw *hw);
-void e1000_put_hw_eeprom_semaphore(struct e1000_hw *hw);
-int32_t e1000_commit_shadow_ram(struct e1000_hw *hw);
-uint8_t e1000_arc_subsystem_valid(struct e1000_hw *hw);
-
-#define E1000_READ_REG_IO(a, reg) \
-    e1000_read_reg_io((a), E1000_##reg)
-#define E1000_WRITE_REG_IO(a, reg, val) \
-    e1000_write_reg_io((a), E1000_##reg, val)
 
 /* PCI Device IDs */
 #define E1000_DEV_ID_82542               0x1000
--- linux-2.6.14-rc5-mm1-full/drivers/net/e1000/e1000_hw.c.old	2005-10-30 15:49:27.000000000 +0100
+++ linux-2.6.14-rc5-mm1-full/drivers/net/e1000/e1000_hw.c	2005-10-30 16:05:02.000000000 +0100
@@ -68,6 +68,38 @@
 static int32_t e1000_set_phy_mode(struct e1000_hw *hw);
 static int32_t e1000_host_if_read_cookie(struct e1000_hw *hw, uint8_t *buffer);
 static uint8_t e1000_calculate_mng_checksum(char *buffer, uint32_t length);
+static uint8_t e1000_arc_subsystem_valid(struct e1000_hw *hw);
+static int32_t e1000_check_downshift(struct e1000_hw *hw);
+static int32_t e1000_check_polarity(struct e1000_hw *hw, uint16_t *polarity);
+static void e1000_clear_hw_cntrs(struct e1000_hw *hw);
+static void e1000_clear_vfta(struct e1000_hw *hw);
+static int32_t e1000_commit_shadow_ram(struct e1000_hw *hw);
+static int32_t e1000_config_dsp_after_link_change(struct e1000_hw *hw,
+						  boolean_t link_up);
+static int32_t e1000_config_fc_after_link_up(struct e1000_hw *hw);
+static int32_t e1000_detect_gig_phy(struct e1000_hw *hw);
+static int32_t e1000_get_auto_rd_done(struct e1000_hw *hw);
+static int32_t e1000_get_cable_length(struct e1000_hw *hw,
+				      uint16_t *min_length,
+				      uint16_t *max_length);
+static int32_t e1000_get_hw_eeprom_semaphore(struct e1000_hw *hw);
+static int32_t e1000_get_phy_cfg_done(struct e1000_hw *hw);
+static int32_t e1000_id_led_init(struct e1000_hw * hw);
+static void e1000_init_rx_addrs(struct e1000_hw *hw);
+static boolean_t e1000_is_onboard_nvm_eeprom(struct e1000_hw *hw);
+static int32_t e1000_poll_eerd_eewr_done(struct e1000_hw *hw, int eerd);
+static void e1000_put_hw_eeprom_semaphore(struct e1000_hw *hw);
+static int32_t e1000_read_eeprom_eerd(struct e1000_hw *hw, uint16_t offset,
+				      uint16_t words, uint16_t *data);
+static int32_t e1000_set_d0_lplu_state(struct e1000_hw *hw, boolean_t active);
+static int32_t e1000_set_d3_lplu_state(struct e1000_hw *hw, boolean_t active);
+static int32_t e1000_wait_autoneg(struct e1000_hw *hw);
+
+static void e1000_write_reg_io(struct e1000_hw *hw, uint32_t offset,
+			       uint32_t value);
+
+#define E1000_WRITE_REG_IO(a, reg, val) \
+	    e1000_write_reg_io((a), E1000_##reg, val)
 
 /* IGP cable length table */
 static const
@@ -2035,7 +2067,7 @@
  * based on the flow control negotiated by the PHY. In TBI mode, the TFCE
  * and RFCE bits will be automaticaly set to the negotiated flow control mode.
  *****************************************************************************/
-int32_t
+static int32_t
 e1000_config_fc_after_link_up(struct e1000_hw *hw)
 {
     int32_t ret_val;
@@ -2537,7 +2569,7 @@
 *
 * hw - Struct containing variables accessed by shared code
 ******************************************************************************/
-int32_t
+static int32_t
 e1000_wait_autoneg(struct e1000_hw *hw)
 {
     int32_t ret_val;
@@ -3021,7 +3053,7 @@
 *
 * hw - Struct containing variables accessed by shared code
 ******************************************************************************/
-int32_t
+static int32_t
 e1000_detect_gig_phy(struct e1000_hw *hw)
 {
     int32_t phy_init_status, ret_val;
@@ -3121,7 +3153,7 @@
 * hw - Struct containing variables accessed by shared code
 * phy_info - PHY information structure
 ******************************************************************************/
-int32_t
+static int32_t
 e1000_phy_igp_get_info(struct e1000_hw *hw,
                        struct e1000_phy_info *phy_info)
 {
@@ -3195,7 +3227,7 @@
 * hw - Struct containing variables accessed by shared code
 * phy_info - PHY information structure
 ******************************************************************************/
-int32_t
+static int32_t
 e1000_phy_m88_get_info(struct e1000_hw *hw,
                        struct e1000_phy_info *phy_info)
 {
@@ -3905,7 +3937,7 @@
  * data - word read from the EEPROM
  * words - number of words to read
  *****************************************************************************/
-int32_t
+static int32_t
 e1000_read_eeprom_eerd(struct e1000_hw *hw,
                   uint16_t offset,
                   uint16_t words,
@@ -3939,7 +3971,7 @@
  * data - word read from the EEPROM
  * words - number of words to read
  *****************************************************************************/
-int32_t
+static int32_t
 e1000_write_eeprom_eewr(struct e1000_hw *hw,
                    uint16_t offset,
                    uint16_t words,
@@ -3976,7 +4008,7 @@
  *
  * hw - Struct containing variables accessed by shared code
  *****************************************************************************/
-int32_t
+static int32_t
 e1000_poll_eerd_eewr_done(struct e1000_hw *hw, int eerd)
 {
     uint32_t attempts = 100000;
@@ -4004,7 +4036,7 @@
 *
 * hw - Struct containing variables accessed by shared code
 ****************************************************************************/
-boolean_t
+static boolean_t
 e1000_is_onboard_nvm_eeprom(struct e1000_hw *hw)
 {
     uint32_t eecd = 0;
@@ -4322,7 +4354,7 @@
  * data - word read from the EEPROM
  * words - number of words to read
  *****************************************************************************/
-int32_t
+static int32_t
 e1000_commit_shadow_ram(struct e1000_hw *hw)
 {
     uint32_t attempts = 100000;
@@ -4453,7 +4485,7 @@
  * of the receive addresss registers. Clears the multicast table. Assumes
  * the receiver is in reset when the routine is called.
  *****************************************************************************/
-void
+static void
 e1000_init_rx_addrs(struct e1000_hw *hw)
 {
     uint32_t i;
@@ -4481,6 +4513,7 @@
     }
 }
 
+#if 0
 /******************************************************************************
  * Updates the MAC's list of multicast addresses.
  *
@@ -4564,6 +4597,7 @@
     }
     DEBUGOUT("MC Update Complete\n");
 }
+#endif  /*  0  */
 
 /******************************************************************************
  * Hashes an address to determine its location in the multicast table
@@ -4705,7 +4739,7 @@
  *
  * hw - Struct containing variables accessed by shared code
  *****************************************************************************/
-void
+static void
 e1000_clear_vfta(struct e1000_hw *hw)
 {
     uint32_t offset;
@@ -4735,7 +4769,7 @@
     }
 }
 
-int32_t
+static int32_t
 e1000_id_led_init(struct e1000_hw * hw)
 {
     uint32_t ledctl;
@@ -4997,7 +5031,7 @@
  *
  * hw - Struct containing variables accessed by shared code
  *****************************************************************************/
-void
+static void
 e1000_clear_hw_cntrs(struct e1000_hw *hw)
 {
     volatile uint32_t temp;
@@ -5283,6 +5317,8 @@
         break;
     }
 }
+
+#if 0
 /******************************************************************************
  * Reads a value from one of the devices registers using port I/O (as opposed
  * memory mapped I/O). Only 82544 and newer devices support port I/O.
@@ -5300,6 +5336,7 @@
     e1000_io_write(hw, io_addr, offset);
     return e1000_io_read(hw, io_data);
 }
+#endif  /*  0  */
 
 /******************************************************************************
  * Writes a value to one of the devices registers using port I/O (as opposed to
@@ -5309,7 +5346,7 @@
  * offset - offset to write to
  * value - value to write
  *****************************************************************************/
-void
+static void
 e1000_write_reg_io(struct e1000_hw *hw,
                    uint32_t offset,
                    uint32_t value)
@@ -5337,7 +5374,7 @@
  * register to the minimum and maximum range.
  * For IGP phy's, the function calculates the range by the AGC registers.
  *****************************************************************************/
-int32_t
+static int32_t
 e1000_get_cable_length(struct e1000_hw *hw,
                        uint16_t *min_length,
                        uint16_t *max_length)
@@ -5489,7 +5526,7 @@
  * return 0.  If the link speed is 1000 Mbps the polarity status is in the
  * IGP01E1000_PHY_PCS_INIT_REG.
  *****************************************************************************/
-int32_t
+static int32_t
 e1000_check_polarity(struct e1000_hw *hw,
                      uint16_t *polarity)
 {
@@ -5551,7 +5588,7 @@
  * Link Health register.  In IGP this bit is latched high, so the driver must
  * read it immediately after link is established.
  *****************************************************************************/
-int32_t
+static int32_t
 e1000_check_downshift(struct e1000_hw *hw)
 {
     int32_t ret_val;
@@ -5592,7 +5629,7 @@
  *
  ****************************************************************************/
 
-int32_t
+static int32_t
 e1000_config_dsp_after_link_change(struct e1000_hw *hw,
                                    boolean_t link_up)
 {
@@ -5823,7 +5860,7 @@
  *
  ****************************************************************************/
 
-int32_t
+static int32_t
 e1000_set_d3_lplu_state(struct e1000_hw *hw,
                         boolean_t active)
 {
@@ -5936,7 +5973,7 @@
  *
  ****************************************************************************/
 
-int32_t
+static int32_t
 e1000_set_d0_lplu_state(struct e1000_hw *hw,
                         boolean_t active)
 {
@@ -6103,7 +6140,7 @@
  *            timeout
  *          - E1000_SUCCESS for success.
  ****************************************************************************/
-int32_t
+static int32_t
 e1000_mng_enable_host_if(struct e1000_hw * hw)
 {
     uint32_t hicr;
@@ -6137,7 +6174,7 @@
  *
  * returns  - E1000_SUCCESS for success.
  ****************************************************************************/
-int32_t
+static int32_t
 e1000_mng_host_if_write(struct e1000_hw * hw, uint8_t *buffer,
                         uint16_t length, uint16_t offset, uint8_t *sum)
 {
@@ -6205,7 +6242,7 @@
  *
  * returns  - E1000_SUCCESS for success.
  ****************************************************************************/
-int32_t
+static int32_t
 e1000_mng_write_cmd_header(struct e1000_hw * hw,
                            struct e1000_host_mng_command_header * hdr)
 {
@@ -6243,7 +6280,7 @@
  *
  * returns  - E1000_SUCCESS for success.
  ****************************************************************************/
-int32_t
+static int32_t
 e1000_mng_write_commit(
     struct e1000_hw * hw)
 {
@@ -6496,7 +6533,7 @@
  * returns: - none.
  *
  ***************************************************************************/
-void
+static void
 e1000_set_pci_express_master_disable(struct e1000_hw *hw)
 {
     uint32_t ctrl;
@@ -6511,6 +6548,7 @@
     E1000_WRITE_REG(hw, CTRL, ctrl);
 }
 
+#if 0
 /***************************************************************************
  *
  * Enables PCI-Express master access.
@@ -6534,6 +6572,7 @@
     ctrl &= ~E1000_CTRL_GIO_MASTER_DISABLE;
     E1000_WRITE_REG(hw, CTRL, ctrl);
 }
+#endif  /*  0  */
 
 /*******************************************************************************
  *
@@ -6584,7 +6623,7 @@
  *            E1000_SUCCESS at any other case.
  *
  ******************************************************************************/
-int32_t
+static int32_t
 e1000_get_auto_rd_done(struct e1000_hw *hw)
 {
     int32_t timeout = AUTO_READ_DONE_TIMEOUT;
@@ -6623,7 +6662,7 @@
  *            E1000_SUCCESS at any other case.
  *
  ***************************************************************************/
-int32_t
+static int32_t
 e1000_get_phy_cfg_done(struct e1000_hw *hw)
 {
     int32_t timeout = PHY_CFG_TIMEOUT;
@@ -6666,7 +6705,7 @@
  *            E1000_SUCCESS at any other case.
  *
  ***************************************************************************/
-int32_t
+static int32_t
 e1000_get_hw_eeprom_semaphore(struct e1000_hw *hw)
 {
     int32_t timeout;
@@ -6711,7 +6750,7 @@
  * returns: - None.
  *
  ***************************************************************************/
-void
+static void
 e1000_put_hw_eeprom_semaphore(struct e1000_hw *hw)
 {
     uint32_t swsm;
@@ -6747,7 +6786,7 @@
 	    E1000_BLK_PHY_RESET : E1000_SUCCESS;
 }
 
-uint8_t
+static uint8_t
 e1000_arc_subsystem_valid(struct e1000_hw *hw)
 {
     uint32_t fwsm;
--- linux-2.6.14-rc5-mm1-full/drivers/net/e1000/e1000_main.c.old	2005-10-30 16:05:15.000000000 +0100
+++ linux-2.6.14-rc5-mm1-full/drivers/net/e1000/e1000_main.c	2005-10-30 16:07:44.000000000 +0100
@@ -37,7 +37,7 @@
  */
 
 char e1000_driver_name[] = "e1000";
-char e1000_driver_string[] = "Intel(R) PRO/1000 Network Driver";
+static char e1000_driver_string[] = "Intel(R) PRO/1000 Network Driver";
 #ifndef CONFIG_E1000_NAPI
 #define DRIVERNAPI
 #else
@@ -45,7 +45,7 @@
 #endif
 #define DRV_VERSION "6.1.16-k2"DRIVERNAPI
 char e1000_driver_version[] = DRV_VERSION;
-char e1000_copyright[] = "Copyright (c) 1999-2005 Intel Corporation.";
+static char e1000_copyright[] = "Copyright (c) 1999-2005 Intel Corporation.";
 
 /* e1000_pci_tbl - PCI Device ID Table
  *
@@ -112,14 +112,14 @@
 int e1000_setup_all_rx_resources(struct e1000_adapter *adapter);
 void e1000_free_all_tx_resources(struct e1000_adapter *adapter);
 void e1000_free_all_rx_resources(struct e1000_adapter *adapter);
-int e1000_setup_tx_resources(struct e1000_adapter *adapter,
-                             struct e1000_tx_ring *txdr);
-int e1000_setup_rx_resources(struct e1000_adapter *adapter,
-                             struct e1000_rx_ring *rxdr);
-void e1000_free_tx_resources(struct e1000_adapter *adapter,
-                             struct e1000_tx_ring *tx_ring);
-void e1000_free_rx_resources(struct e1000_adapter *adapter,
-                             struct e1000_rx_ring *rx_ring);
+static int e1000_setup_tx_resources(struct e1000_adapter *adapter,
+				    struct e1000_tx_ring *txdr);
+static int e1000_setup_rx_resources(struct e1000_adapter *adapter,
+				    struct e1000_rx_ring *rxdr);
+static void e1000_free_tx_resources(struct e1000_adapter *adapter,
+				    struct e1000_tx_ring *tx_ring);
+static void e1000_free_rx_resources(struct e1000_adapter *adapter,
+				    struct e1000_rx_ring *rx_ring);
 void e1000_update_stats(struct e1000_adapter *adapter);
 
 /* Local Function Prototypes */
@@ -296,7 +296,8 @@
 		E1000_WRITE_FLUSH(&adapter->hw);
 	}
 }
-void
+
+static void
 e1000_update_mng_vlan(struct e1000_adapter *adapter)
 {
 	struct net_device *netdev = adapter->netdev;
@@ -1141,7 +1142,7 @@
  * Return 0 on success, negative on failure
  **/
 
-int
+static int
 e1000_setup_tx_resources(struct e1000_adapter *adapter,
                          struct e1000_tx_ring *txdr)
 {
@@ -1359,7 +1360,7 @@
  * Returns 0 on success, negative on failure
  **/
 
-int
+static int
 e1000_setup_rx_resources(struct e1000_adapter *adapter,
                          struct e1000_rx_ring *rxdr)
 {
@@ -1747,7 +1748,7 @@
  * Free all transmit software resources
  **/
 
-void
+static void
 e1000_free_tx_resources(struct e1000_adapter *adapter,
                         struct e1000_tx_ring *tx_ring)
 {
@@ -1858,7 +1859,7 @@
  * Free all receive software resources
  **/
 
-void
+static void
 e1000_free_rx_resources(struct e1000_adapter *adapter,
                         struct e1000_rx_ring *rx_ring)
 {

^ permalink raw reply

* Re: [PATCH][MCAST]IPv6: doubt about ipv6_sk_mc_lock usage.
From: David Stevens @ 2005-10-30 17:32 UTC (permalink / raw)
  To: Yan Zheng; +Cc: linux-kernel, netdev, netdev-owner
In-Reply-To: <4364EA58.7040707@21cn.com>

No, ipv6_sk_mc_lock is required for join and leave to protect 
inet6_mc_check()
calls, and modifications to the filter list only happen via ioctls that 
are protected
by the socket lock.

I don't think any of these changes are correct.

                                                +-DLS


netdev-owner@vger.kernel.org wrote on 10/30/2005 07:44:24 AM:

> Hello.
> 
> I think ipv6_sk_mc_lock should protest both ipv6_mc_list and it's 
sflist. 
> because they can are used by 
> inet6_mc_check(...) in softirq and be modified by ip6_mc_source(...) or 
> ip6_mc_msfilter(...) simultaneity.
> I also remove read_lock when traverse ipv6_mc_list, because it's 
protected by 
> lock_sock(sk).
> 

^ permalink raw reply

* Re: [2.6 patch] kernel/: small cleanups
From: Paul E. McKenney @ 2005-10-30 20:53 UTC (permalink / raw)
  To: Adrian Bunk; +Cc: linux-kernel, dwmw2, linux-audit, faith, george, netdev
In-Reply-To: <20051030010200.GT4180@stusta.de>

On Sun, Oct 30, 2005 at 02:02:00AM +0100, Adrian Bunk wrote:
> This patch contains the following cleanups:
> - make needlessly global functions static

Good catch on rcu_torture_alloc()!

							Thanx, Paul

> - every file should include the headers containing the prototypes for
>   it's global functions

Acked-by: <paulmck@us.ibm.com>
> Signed-off-by: Adrian Bunk <bunk@stusta.de>
> 
> ---
> 
>  kernel/audit.c      |    2 +-
>  kernel/irq/proc.c   |    2 ++
>  kernel/rcutorture.c |    2 +-
>  kernel/timer.c      |    1 +
>  4 files changed, 5 insertions(+), 2 deletions(-)
> 
> --- linux-2.6.14-rc5-mm1-full/kernel/timer.c.old	2005-10-30 02:27:36.000000000 +0200
> +++ linux-2.6.14-rc5-mm1-full/kernel/timer.c	2005-10-30 02:27:56.000000000 +0200
> @@ -33,6 +33,7 @@
>  #include <linux/posix-timers.h>
>  #include <linux/cpu.h>
>  #include <linux/syscalls.h>
> +#include <linux/delay.h>
>  
>  #include <asm/uaccess.h>
>  #include <asm/unistd.h>
> --- linux-2.6.14-rc5-mm1-full/kernel/irq/proc.c.old	2005-10-30 02:31:31.000000000 +0200
> +++ linux-2.6.14-rc5-mm1-full/kernel/irq/proc.c	2005-10-30 02:31:48.000000000 +0200
> @@ -10,6 +10,8 @@
>  #include <linux/proc_fs.h>
>  #include <linux/interrupt.h>
>  
> +#include "internals.h"
> +
>  static struct proc_dir_entry *root_irq_dir, *irq_dir[NR_IRQS];
>  
>  #ifdef CONFIG_SMP
> --- linux-2.6.14-rc5-mm1-full/kernel/audit.c.old	2005-10-30 02:33:08.000000000 +0200
> +++ linux-2.6.14-rc5-mm1-full/kernel/audit.c	2005-10-30 02:33:15.000000000 +0200
> @@ -272,7 +272,7 @@
>  	return old;
>  }
>  
> -int kauditd_thread(void *dummy)
> +static int kauditd_thread(void *dummy)
>  {
>  	struct sk_buff *skb;
>  
> --- linux-2.6.14-rc5-mm1-full/kernel/rcutorture.c.old	2005-10-30 02:33:35.000000000 +0200
> +++ linux-2.6.14-rc5-mm1-full/kernel/rcutorture.c	2005-10-30 02:33:53.000000000 +0200
> @@ -99,7 +99,7 @@
>  /*
>   * Allocate an element from the rcu_tortures pool.
>   */
> -struct rcu_torture *
> +static struct rcu_torture *
>  rcu_torture_alloc(void)
>  {
>  	struct list_head *p;
> 
> 

^ permalink raw reply

* Re: [NF+IPsec 4/6]: Make IPsec input processing symetrical to output
From: Patrick McHardy @ 2005-10-30 23:15 UTC (permalink / raw)
  To: Herbert Xu; +Cc: netdev, netfilter-devel
In-Reply-To: <4360E75A.10405@trash.net>

Patrick McHardy wrote:
> Herbert Xu wrote:
> 
>>I presume that you will be changing the output path so that LOCAL_OUT
>>does not see the plain-text packet.  Otherwise it'll be asymmetric with
>>repsect to the inbound side which does not see plain-text packets for
>>transport mode SAs.
> 
> Yes, that was the idea. But since people seem to consider this an
> important case to handle I'm going to try the per-SA flag you
> proposed. I'll send new patches in the next days.

Unfortunately hiding the plain-text packets on output when transport
mode SAs are used and the flag is not set adds a new inconsistency
with NAT. In my last patchsets NAT was handled by redoing the policy
lookup when a packet was NATed at LOCAL_OUT or POST_ROUTING and wasn't
already transformed. If the new lookup yielded a policy
ip_dst_output/__ip_dst_output was called again. The hooks were always
called in the normal order. With a per-SA flag however we don't know
if the packet should be hidden before the second lookup is done, so
with NAT a packet that would usually be hidden might be visible
on LOCAL_OUT and POST_ROUTING, or just LOCAL_OUT. This also affects
ip_queue.

So far the by far cleanest solution from a netfilter point of view
was to ignore transport mode unless its the innermost transform on
output and to always send the decapsulated packets through the stack
again on input. Since Yoshifuji disagrees with this approach we seem
to be deadlocked ..

^ permalink raw reply

* [2.6 patch] drivers/net/hamradio/dmascc.c: remove dmascc_setup()
From: Adrian Bunk @ 2005-10-31  0:33 UTC (permalink / raw)
  To: jgarzik; +Cc: netdev, linux-kernel

It seems dmascc_setup() is a leftover time before dmascc_init() was 
there.


Signed-off-by: Adrian Bunk <bunk@stusta.de>

---

 drivers/net/hamradio/dmascc.c |   10 ----------
 1 file changed, 10 deletions(-)

--- linux-2.6.14-rc5-mm1-full/drivers/net/hamradio/dmascc.c.old	2005-10-31 01:21:39.000000000 +0100
+++ linux-2.6.14-rc5-mm1-full/drivers/net/hamradio/dmascc.c	2005-10-31 01:21:49.000000000 +0100
@@ -311,16 +311,6 @@
 	}
 }
 
-#ifndef MODULE
-void __init dmascc_setup(char *str, int *ints)
-{
-	int i;
-
-	for (i = 0; i < MAX_NUM_DEVS && i < ints[0]; i++)
-		io[i] = ints[i + 1];
-}
-#endif
-
 static int __init dmascc_init(void)
 {
 	int h, i, j, n;

^ permalink raw reply

* Re: [PATCH][MCAST]IPv6: doubt about ipv6_sk_mc_lock usage.
From: Yan Zheng @ 2005-10-31  1:46 UTC (permalink / raw)
  To: David Stevens; +Cc: netdev, linux-kernel
In-Reply-To: <OFE9824801.1D574FF8-ON882570AA.005FC39C-882570AA.006050CD@us.ibm.com>

David Stevens wrote:
> No, ipv6_sk_mc_lock is required for join and leave to protect 
> inet6_mc_check()
> calls, and modifications to the filter list only happen via ioctls that 
> are protected
> by the socket lock.
> 
> I don't think any of these changes are correct.
> 
>                                                 +-DLS

Thanks.

I have one more question. 
Why ip6_mc_source() uses read_lock_bh(&ipv6_sk_mc_lock) and ip6_mc_msfilter() doesn't use ipv6_sk_mc_lock at all. 
when ipv6_mc_list's sflist are accessed by inet6_mc_check(), Can it be modified by ip6_mc_source() or ip6_mc_msfilter() ?
(For example ipv6_mc_list's sflist is freed up by sock_kfree_s(), when inet6_mc_check() uses it)


                                                                   Regards

^ permalink raw reply

* [PATCH][MCAST]IPv6: small fix for ip6_mc_msfilter(...)
From: Yan Zheng @ 2005-10-31  2:52 UTC (permalink / raw)
  To: netdev; +Cc: linux-kernel, David Stevens

Hi.
I think ip6_mc_add_src(...) should be called when number of sources is zero and filter mode is exclude.

Regards



Signed-off-by: Yan Zheng <yanzheng@21cn.com> 

Index: net/ipv6/mcast.c
================================================================================
--- linux-2.6.14/net/ipv6/mcast.c	2005-10-30 23:09:33.000000000 +0800
+++ linux/net/ipv6/mcast.c	2005-10-31 10:37:36.000000000 +0800
@@ -545,8 +545,10 @@ int ip6_mc_msfilter(struct sock *sk, str
 			sock_kfree_s(sk, newpsl, IP6_SFLSIZE(newpsl->sl_max));
 			goto done;
 		}
-	} else
+	} else {
 		newpsl = NULL;
+		ip6_mc_add_src(idev, group, gsf->gf_fmode, 0, NULL, 0);
+	}
 	psl = pmc->sflist;
 	if (psl) {
 		(void) ip6_mc_del_src(idev, group, pmc->sfmode,

^ permalink raw reply

* Re: [NF+IPsec 4/6]: Make IPsec input processing symetrical to output
From: Yasuyuki KOZAKAI @ 2005-10-31  3:19 UTC (permalink / raw)
  To: kaber; +Cc: netdev, netfilter-devel, herbert
In-Reply-To: <43655428.3040904@trash.net>


Hi, Patrick,

From: Patrick McHardy <kaber@trash.net>
Date: Mon, 31 Oct 2005 00:15:52 +0100

> Patrick McHardy wrote:
> > Herbert Xu wrote:
> > 
> >>I presume that you will be changing the output path so that LOCAL_OUT
> >>does not see the plain-text packet.  Otherwise it'll be asymmetric with
> >>repsect to the inbound side which does not see plain-text packets for
> >>transport mode SAs.

I support this way.

> > Yes, that was the idea. But since people seem to consider this an
> > important case to handle I'm going to try the per-SA flag you
> > proposed. I'll send new patches in the next days.

I think pure transport mode is important, too. For example, for users of
L2TP over IPsec.

But I'm not sure that how many people wants to use netfilter hook together.
At least, I don't need that. Because I can use IPsec policy instead of
iptables rule and that's enough for me.

I also think that it's the work for IPsec policy check to decide to
accept or drop decrypted packets on input path of transport mode, that is
not netfilter work.

On the other hand, for the users who want to use local NAT and IPsec
transport mode together, we might have to add netfilter hook to input
path. But I'm not sure how many such users are. If nobody want, hooks
we need are only LOCAL_OUT and POST_ROUTING on output path per tunnel.

> Unfortunately hiding the plain-text packets on output when transport
> mode SAs are used and the flag is not set adds a new inconsistency
> with NAT. In my last patchsets NAT was handled by redoing the policy
> lookup when a packet was NATed at LOCAL_OUT or POST_ROUTING and wasn't
> already transformed. If the new lookup yielded a policy
> ip_dst_output/__ip_dst_output was called again. The hooks were always
> called in the normal order. With a per-SA flag however we don't know
> if the packet should be hidden before the second lookup is done, so
> with NAT a packet that would usually be hidden might be visible
> on LOCAL_OUT and POST_ROUTING, or just LOCAL_OUT. This also affects
> ip_queue.

Sorry, maybe I don't understand. per-SA flag means that packets go through
netfilter hook before handling of its SA on output path ? Why it isn't
'after' ?

> So far the by far cleanest solution from a netfilter point of view
> was to ignore transport mode unless its the innermost transform on
> output and to always send the decapsulated packets through the stack
> again on input. Since Yoshifuji disagrees with this approach we seem
> to be deadlocked ..
> 
> -
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

--- Yasuyuki Kozakai

^ permalink raw reply

* [PATCH][MCAST]IPv6: Check packet size when process Multicast Address and Source Specific Query
From: Yan Zheng @ 2005-10-31  5:20 UTC (permalink / raw)
  To: netdev; +Cc: linux-kernel, David Stevens


Signed-off-by: Yan Zheng <yanzheng@21cn.com>

Index: net/ipv6/mcast.c
================================================================================
--- linux-2.6.14/net/ipv6/mcast.c	2005-10-30 23:09:33.000000000 +0800
+++ linux/net/ipv6/mcast.c	2005-10-31 13:13:10.000000000 +0800
@@ -1156,7 +1156,12 @@ int igmp6_event_query(struct sk_buff *sk
 			return 0;
 		}
 		/* mark sources to include, if group & source-specific */
-		mark = mlh2->nsrcs != 0;
+		if (mlh2->nsrcs != 0) {
+			if (!pskb_may_pull(skb, mlh2->nsrcs * sizeof(struct in6_addr) +
+				(sizeof(struct mld2_query) - sizeof(struct icmp6hdr))))
+				return -EINVAL;
+			mark = 1;
+		}
 	} else {
 		in6_dev_put(idev);
 		return -EINVAL;

^ permalink raw reply

* Re: [PATCH][MCAST]IPv6: Check packet size when process Multicast Address and Source Specific Query
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2005-10-31  5:27 UTC (permalink / raw)
  To: yanzheng; +Cc: netdev, linux-kernel, dlstevens, yoshfuji
In-Reply-To: <4365A995.3050404@21cn.com>

In article <4365A995.3050404@21cn.com> (at Mon, 31 Oct 2005 13:20:21 +0800), Yan Zheng <yanzheng@21cn.com> says:

> 
> Signed-off-by: Yan Zheng <yanzheng@21cn.com>
> 
> Index: net/ipv6/mcast.c
> ================================================================================
> --- linux-2.6.14/net/ipv6/mcast.c	2005-10-30 23:09:33.000000000 +0800
> +++ linux/net/ipv6/mcast.c	2005-10-31 13:13:10.000000000 +0800
> @@ -1156,7 +1156,12 @@ int igmp6_event_query(struct sk_buff *sk
>  			return 0;
>  		}
>  		/* mark sources to include, if group & source-specific */
> -		mark = mlh2->nsrcs != 0;
> +		if (mlh2->nsrcs != 0) {
> +			if (!pskb_may_pull(skb, mlh2->nsrcs * sizeof(struct in6_addr) +
> +				(sizeof(struct mld2_query) - sizeof(struct icmp6hdr))))
> +				return -EINVAL;
> +			mark = 1;
> +		}
>  	} else {
>  		in6_dev_put(idev);
>  		return -EINVAL;

You cannot continue using mlh2, local copy of skb->h.raw
after pskb_may_pull(). Please refresh it.

--yoshfuji

^ permalink raw reply

* [2.6 patch] fix the "QoS and/or fair queueing" menu
From: Adrian Bunk @ 2005-10-31 10:26 UTC (permalink / raw)
  To: Jan Engelhardt; +Cc: Linux Kernel Mailing List, netdev
In-Reply-To: <Pine.LNX.4.61.0510280902470.6910@yvahk01.tjqt.qr>

On Fri, Oct 28, 2005 at 09:04:31AM +0200, Jan Engelhardt wrote:

> Hi,

Hi Jan,

> When CONFIG_NET_CLS is enabled, then "Firewall based classifier", "U32 
> classifier" and some more appear under the "Network options" menu rather 
> than "QoS and/or fair queueing" menu.
> This bug is in the recently released 2.6.14. (And earlier).

thanks for this report, a patch is below.

> Jan Engelhardt

cu
Adrian


<--  snip  -->


This patch adjust some dependencies in net/sched/Kconfig for getting all 
options that belong there under "QoS and/or fair queueing".

There is no actual semantic change in any dependency, the additional 
dependencies are added for helping kconfig to figure out what belongs to 
that menu.


Signed-off-by: Adrian Bunk <bunk@stusta.de>

---

 net/sched/Kconfig |   16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

--- linux-2.6.14-rc5-mm1-full/net/sched/Kconfig.old	2005-10-31 11:08:50.000000000 +0100
+++ linux-2.6.14-rc5-mm1-full/net/sched/Kconfig	2005-10-31 11:18:48.000000000 +0100
@@ -343,6 +343,7 @@
 
 config NET_CLS_ROUTE
 	bool
+	depends on NET_CLS
 	default n
 
 config NET_CLS_FW
@@ -375,7 +376,7 @@
 
 config NET_CLS_IND
 	bool "classify input device (slows things u32/fw) "
-	depends on NET_CLS_U32 || NET_CLS_FW
+	depends on NET_CLS && (NET_CLS_U32 || NET_CLS_FW)
 	help
 	  This option will be killed eventually when a 
           metadata action appears because it slows things a little
@@ -552,13 +553,6 @@
         requires new iproute2
         This allows for packets to be generically edited
 
-config NET_CLS_POLICE
-	bool "Traffic policing (needed for in/egress)"
-	depends on NET_CLS && NET_QOS && NET_CLS_ACT!=y
-	help
-	  Say Y to support traffic policing (bandwidth limits).  Needed for
-	  ingress and egress rate limiting.
-
 config NET_ACT_SIMP
         tristate "Simple action"
         depends on NET_CLS_ACT
@@ -569,3 +563,9 @@
 	All this action will do is print on the console the configured
 	policy string followed by _ then packet count.
 
+config NET_CLS_POLICE
+        bool "Traffic policing (needed for in/egress)"
+        depends on NET_CLS && NET_QOS && NET_CLS_ACT!=y
+        help
+          Say Y to support traffic policing (bandwidth limits).  Needed for
+          ingress and egress rate limiting.

^ permalink raw reply

* (no subject)
From: Yasuyuki KOZAKAI @ 2005-10-31 11:11 UTC (permalink / raw)
  To: acme; +Cc: laforge, netdev, netfilter-devel

[-- Attachment #1: Type: Text/Plain, Size: 1862 bytes --]

Subject: Re: nf_conntrack comments
From: Yasuyuki KOZAKAI <kozakai@isl.rdc.toshiba.co.jp>
Fcc: +backup
In-Reply-To: <20051029135524.GQ4479@sunbeam.de.gnumonks.org>
References: <20051018084924.GD20338@sunbeam.de.gnumonks.org>
	<39e6f6c70510282108i60d78df6w9728f40641dccf80@mail.gmail.com>
	<20051029135524.GQ4479@sunbeam.de.gnumonks.org>
X-Mailer: Mew version 4.2 on Emacs 20.7 / Mule 4.0 (HANANOEN)
----

Hi, Acme and all,

Acme, thank you for reviewing of nf_conntrack.

From: Harald Welte <laforge@netfilter.org>
Date: Sat, 29 Oct 2005 15:55:24 +0200

> > +       if (!h) {
> > +               DEBUGP("icmpv6_error: no match\n");
> > +               return NF_ACCEPT;
> > +       } else {
> > +               if (NF_CT_DIRECTION(h) == IP_CT_DIR_REPLY)
> > +                       *ctinfo += IP_CT_IS_REPLY;
> > +       }
> > +
> > +       /* Update skb to refer to this connection */
> > +       skb->nfct = &nf_ct_tuplehash_to_ctrack(h)->ct_general;
> > +       skb->nfctinfo = *ctinfo;
> > +       return -NF_ACCEPT;
> > +}
> > 
> > I noticed that some of the returns are NF_ACCEPT while at leat this last one
> > returns -NF_ACCEPT, is this a special convention or should all be negative? or
> > positive?
>
> I'll check that, looks like a bug to me, too.

If we don't change, the result is same. If this function return NF_ACCEPT,
connection tracking handles packet as normal packet. But it cannot find invert
tuple for it and stop processing after all. Then no problem.

But it may be better to replace NF_ACCEPT with -NF_ACCEPT in this function to
stop processing early.

BTW, this is common issue in nf_conntrack and ip_conntrack. Then it is
necessary to both of them if we want.

Signed-off-by: Yasuyuki Kozakai <yasuyuki.kozakai@toshiba.co.jp>

Netfilter folks, do you have any problem if I change these return value ?

Regards,

--- Yasuyuki Kozakai

[-- Attachment #2: ct-icmp-error.patch --]
[-- Type: Text/Plain, Size: 6212 bytes --]

[NETFILTER] stop tracking ICMP(v6) error at early point

Currently connection tracking handles ICMP(v6) error like normal packets
if it failed to get related connection. But it fails that after all.

This makes connection tracking stop tracking ICMP(v6) error at early point.

Signed-off-by: Yasuyuki Kozakai <yasuyuki.kozakai@toshiba.co.jp>

---
commit 45d0380701e4980f1276d3d7d83285e1c4a2e4c9
tree e2ae86189f6c961b1a8db032a2b11b814219e5f5
parent 296d553d2cf7856d37e613ab20b4290dbfe38afa
author Yasuyuki Kozakai <yasuyuki.kozakai@toshiba.co.jp> Mon, 31 Oct 2005 20:00:31 +0900
committer Yasuyuki Kozakai <yasuyuki.kozakai@toshiba.co.jp> Mon, 31 Oct 2005 20:00:31 +0900

 net/ipv4/netfilter/ip_conntrack_proto_icmp.c   |   10 +++++-----
 net/ipv4/netfilter/nf_conntrack_proto_icmp.c   |   10 +++++-----
 net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c |   12 ++++++------
 3 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/net/ipv4/netfilter/ip_conntrack_proto_icmp.c b/net/ipv4/netfilter/ip_conntrack_proto_icmp.c
--- a/net/ipv4/netfilter/ip_conntrack_proto_icmp.c
+++ b/net/ipv4/netfilter/ip_conntrack_proto_icmp.c
@@ -151,13 +151,13 @@ icmp_error_message(struct sk_buff *skb,
 	/* Not enough header? */
 	inside = skb_header_pointer(skb, skb->nh.iph->ihl*4, sizeof(_in), &_in);
 	if (inside == NULL)
-		return NF_ACCEPT;
+		return -NF_ACCEPT;
 
 	/* Ignore ICMP's containing fragments (shouldn't happen) */
 	if (inside->ip.frag_off & htons(IP_OFFSET)) {
 		DEBUGP("icmp_error_track: fragment of proto %u\n",
 		       inside->ip.protocol);
-		return NF_ACCEPT;
+		return -NF_ACCEPT;
 	}
 
 	innerproto = ip_conntrack_proto_find_get(inside->ip.protocol);
@@ -166,7 +166,7 @@ icmp_error_message(struct sk_buff *skb,
 	if (!ip_ct_get_tuple(&inside->ip, skb, dataoff, &origtuple, innerproto)) {
 		DEBUGP("icmp_error: ! get_tuple p=%u", inside->ip.protocol);
 		ip_conntrack_proto_put(innerproto);
-		return NF_ACCEPT;
+		return -NF_ACCEPT;
 	}
 
 	/* Ordinarily, we'd expect the inverted tupleproto, but it's
@@ -174,7 +174,7 @@ icmp_error_message(struct sk_buff *skb,
 	if (!ip_ct_invert_tuple(&innertuple, &origtuple, innerproto)) {
 		DEBUGP("icmp_error_track: Can't invert tuple\n");
 		ip_conntrack_proto_put(innerproto);
-		return NF_ACCEPT;
+		return -NF_ACCEPT;
 	}
 	ip_conntrack_proto_put(innerproto);
 
@@ -190,7 +190,7 @@ icmp_error_message(struct sk_buff *skb,
 
 		if (!h) {
 			DEBUGP("icmp_error_track: no match\n");
-			return NF_ACCEPT;
+			return -NF_ACCEPT;
 		}
 		/* Reverse direction from that found */
 		if (DIRECTION(h) != IP_CT_DIR_REPLY)
diff --git a/net/ipv4/netfilter/nf_conntrack_proto_icmp.c b/net/ipv4/netfilter/nf_conntrack_proto_icmp.c
--- a/net/ipv4/netfilter/nf_conntrack_proto_icmp.c
+++ b/net/ipv4/netfilter/nf_conntrack_proto_icmp.c
@@ -159,13 +159,13 @@ icmp_error_message(struct sk_buff *skb,
 	/* Not enough header? */
 	inside = skb_header_pointer(skb, skb->nh.iph->ihl*4, sizeof(_in), &_in);
 	if (inside == NULL)
-		return NF_ACCEPT;
+		return -NF_ACCEPT;
 
 	/* Ignore ICMP's containing fragments (shouldn't happen) */
 	if (inside->ip.frag_off & htons(IP_OFFSET)) {
 		DEBUGP("icmp_error_message: fragment of proto %u\n",
 		       inside->ip.protocol);
-		return NF_ACCEPT;
+		return -NF_ACCEPT;
 	}
 
 	innerproto = nf_ct_find_proto(PF_INET, inside->ip.protocol);
@@ -176,7 +176,7 @@ icmp_error_message(struct sk_buff *skb,
 			     &nf_conntrack_l3proto_ipv4, innerproto)) {
 		DEBUGP("icmp_error_message: ! get_tuple p=%u",
 		       inside->ip.protocol);
-		return NF_ACCEPT;
+		return -NF_ACCEPT;
 	}
 
         /* Ordinarily, we'd expect the inverted tupleproto, but it's
@@ -184,7 +184,7 @@ icmp_error_message(struct sk_buff *skb,
         if (!nf_ct_invert_tuple(&innertuple, &origtuple,
 				&nf_conntrack_l3proto_ipv4, innerproto)) {
 		DEBUGP("icmp_error_message: no match\n");
-		return NF_ACCEPT;
+		return -NF_ACCEPT;
 	}
 
 	*ctinfo = IP_CT_RELATED;
@@ -199,7 +199,7 @@ icmp_error_message(struct sk_buff *skb,
 
 		if (!h) {
 			DEBUGP("icmp_error_message: no match\n");
-			return NF_ACCEPT;
+			return -NF_ACCEPT;
 		}
 
 		/* Reverse direction from that found */
diff --git a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
--- a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
+++ b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
@@ -164,14 +164,14 @@ icmpv6_error_message(struct sk_buff *skb
 	hp = skb_header_pointer(skb, icmp6off, sizeof(_hdr), &_hdr);
 	if (hp == NULL) {
 		DEBUGP("icmpv6_error: Can't get ICMPv6 hdr.\n");
-		return NF_ACCEPT;
+		return -NF_ACCEPT;
 	}
 
 	inip6off = icmp6off + sizeof(_hdr);
 	if (skb_copy_bits(skb, inip6off+offsetof(struct ipv6hdr, nexthdr),
 			  &inprotonum, sizeof(inprotonum)) != 0) {
 		DEBUGP("icmpv6_error: Can't get nexthdr in inner IPv6 header.\n");
-		return NF_ACCEPT;
+		return -NF_ACCEPT;
 	}
 	inprotoff = nf_ct_ipv6_skip_exthdr(skb,
 					   inip6off + sizeof(struct ipv6hdr),
@@ -182,7 +182,7 @@ icmpv6_error_message(struct sk_buff *skb
 	if ((inprotoff < 0) || (inprotoff > skb->len) ||
 	    (inprotonum == NEXTHDR_FRAGMENT)) {
 		DEBUGP("icmpv6_error: Can't get protocol header in ICMPv6 payload.\n");
-		return NF_ACCEPT;
+		return -NF_ACCEPT;
 	}
 
 	inproto = nf_ct_find_proto(PF_INET6, inprotonum);
@@ -191,7 +191,7 @@ icmpv6_error_message(struct sk_buff *skb
 	if (!nf_ct_get_tuple(skb, inip6off, inprotoff, PF_INET6, inprotonum,
 			     &origtuple, &nf_conntrack_l3proto_ipv6, inproto)) {
 		DEBUGP("icmpv6_error: Can't get tuple\n");
-		return NF_ACCEPT;
+		return -NF_ACCEPT;
 	}
 
 	/* Ordinarily, we'd expect the inverted tupleproto, but it's
@@ -199,7 +199,7 @@ icmpv6_error_message(struct sk_buff *skb
 	if (!nf_ct_invert_tuple(&intuple, &origtuple,
 				&nf_conntrack_l3proto_ipv6, inproto)) {
 		DEBUGP("icmpv6_error: Can't invert tuple\n");
-		return NF_ACCEPT;
+		return -NF_ACCEPT;
 	}
 
 	*ctinfo = IP_CT_RELATED;
@@ -207,7 +207,7 @@ icmpv6_error_message(struct sk_buff *skb
 	h = nf_conntrack_find_get(&intuple, NULL);
 	if (!h) {
 		DEBUGP("icmpv6_error: no match\n");
-		return NF_ACCEPT;
+		return -NF_ACCEPT;
 	} else {
 		if (NF_CT_DIRECTION(h) == IP_CT_DIR_REPLY)
 			*ctinfo += IP_CT_IS_REPLY;

^ permalink raw reply

* Re: [PATCH][MCAST]IPv6: Check packet size when process Multicast Address and Source Specific Query
From: Yan Zheng @ 2005-10-31 12:09 UTC (permalink / raw)
  To: netdev; +Cc: linux-kernel, yoshfuji
In-Reply-To: <20051031.142717.40152885.yoshfuji@linux-ipv6.org>

> 
> You cannot continue using mlh2, local copy of skb->h.raw
> after pskb_may_pull(). Please refresh it.
> 
> --yoshfuji
> 

My mistake. sorry.
I hope the new one is correct.

Regards
================================================================================
--- linux-2.6.14/net/ipv6/mcast.c	2005-10-30 23:09:33.000000000 +0800
+++ linux/net/ipv6/mcast.c	2005-10-31 14:16:19.000000000 +0800
@@ -1087,7 +1087,7 @@ static void mld_marksources(struct ifmca
 
 int igmp6_event_query(struct sk_buff *skb)
 {
-	struct mld2_query *mlh2 = (struct mld2_query *) skb->h.raw;
+	struct mld2_query *mlh2 = NULL;
 	struct ifmcaddr6 *ma;
 	struct in6_addr *group;
 	unsigned long max_delay;
@@ -1140,6 +1140,13 @@ int igmp6_event_query(struct sk_buff *sk
 		/* clear deleted report items */
 		mld_clear_delrec(idev);
 	} else if (len >= 28) {
+		int srcs_offset = sizeof(struct mld2_query) - 
+				  sizeof(struct icmp6hdr);
+		if (!pskb_may_pull(skb, srcs_offset)) {
+			in6_dev_put(idev);
+			return -EINVAL;
+		}
+		mlh2 = (struct mld2_query *) skb->h.raw;
 		max_delay = (MLDV2_MRC(ntohs(mlh2->mrc))*HZ)/1000;
 		if (!max_delay)
 			max_delay = 1;
@@ -1156,7 +1163,15 @@ int igmp6_event_query(struct sk_buff *sk
 			return 0;
 		}
 		/* mark sources to include, if group & source-specific */
-		mark = mlh2->nsrcs != 0;
+		if (mlh2->nsrcs != 0) {
+			if (!pskb_may_pull(skb, srcs_offset + 
+				mlh2->nsrcs * sizeof(struct in6_addr))) {
+				in6_dev_put(idev);
+				return -EINVAL;
+			}
+			mlh2 = (struct mld2_query *) skb->h.raw;
+			mark = 1;
+		}
 	} else {
 		in6_dev_put(idev);
 		return -EINVAL;

^ permalink raw reply

* Re: [PATCH][MCAST]IPv6: Check packet size when process Multicast Address and Source Specific Query
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2005-10-31 12:15 UTC (permalink / raw)
  To: yanzheng, acme; +Cc: netdev, linux-kernel, yoshfuji
In-Reply-To: <43660989.2000100@21cn.com>

In article <43660989.2000100@21cn.com> (at Mon, 31 Oct 2005 20:09:45 +0800), Yan Zheng <yanzheng@21cn.com> says:

> I hope the new one is correct.

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

--yoshfuji

^ permalink raw reply

* [PATCH] kill 8139too kernel thread (sorta)
From: Jeff Garzik @ 2005-10-31 13:02 UTC (permalink / raw)
  To: netdev; +Cc: linux-kernel

I just checked this into netdev-2.6.git, and will be appearing in -mm
soon for testing and review.


commit a15e0384dd22ee08f56d62761ce9d770488f6f4e
Author: Jeff Garzik <jgarzik@pobox.com>
Date:   Mon Oct 31 07:59:37 2005 -0500

    [netdrvr 8139too] replace hand-crafted kernel thread with workqueue
    
    Gone are the days when 8139too was a shining example of how to use
    kernel threads.  Delayed workqueues are easier, and map precisely to
    our task:  running code from a kernel thread, after a periodic sleep.


 drivers/net/8139too.c |   87 ++++++++++++++++++--------------------------------
 1 files changed, 33 insertions(+), 54 deletions(-)

diff --git a/drivers/net/8139too.c b/drivers/net/8139too.c
index 30bee11..9de58e2 100644
--- a/drivers/net/8139too.c
+++ b/drivers/net/8139too.c
@@ -590,12 +590,12 @@ struct rtl8139_private {
 	spinlock_t lock;
 	spinlock_t rx_lock;
 	chip_t chipset;
-	pid_t thr_pid;
-	wait_queue_head_t thr_wait;
-	struct completion thr_exited;
 	u32 rx_config;
 	struct rtl_extra_stats xstats;
-	int time_to_die;
+
+	struct work_struct thread;
+	long time_to_die;	/* -1 no thr, 0 thr active, 1 thr cancel */
+
 	struct mii_if_info mii;
 	unsigned int regs_len;
 	unsigned long fifo_copy_timeout;
@@ -620,7 +620,7 @@ static int rtl8139_open (struct net_devi
 static int mdio_read (struct net_device *dev, int phy_id, int location);
 static void mdio_write (struct net_device *dev, int phy_id, int location,
 			int val);
-static void rtl8139_start_thread(struct net_device *dev);
+static void rtl8139_start_thread(struct rtl8139_private *tp);
 static void rtl8139_tx_timeout (struct net_device *dev);
 static void rtl8139_init_ring (struct net_device *dev);
 static int rtl8139_start_xmit (struct sk_buff *skb,
@@ -637,6 +637,7 @@ static struct net_device_stats *rtl8139_
 static void rtl8139_set_rx_mode (struct net_device *dev);
 static void __set_rx_mode (struct net_device *dev);
 static void rtl8139_hw_start (struct net_device *dev);
+static void rtl8139_thread (void *_data);
 static struct ethtool_ops rtl8139_ethtool_ops;
 
 /* write MMIO register, with flush */
@@ -1007,8 +1008,7 @@ static int __devinit rtl8139_init_one (s
 		(debug < 0 ? RTL8139_DEF_MSG_ENABLE : ((1 << debug) - 1));
 	spin_lock_init (&tp->lock);
 	spin_lock_init (&tp->rx_lock);
-	init_waitqueue_head (&tp->thr_wait);
-	init_completion (&tp->thr_exited);
+	INIT_WORK(&tp->thread, rtl8139_thread, dev);
 	tp->mii.dev = dev;
 	tp->mii.mdio_read = mdio_read;
 	tp->mii.mdio_write = mdio_write;
@@ -1345,7 +1345,7 @@ static int rtl8139_open (struct net_devi
 			dev->irq, RTL_R8 (MediaStatus),
 			tp->mii.full_duplex ? "full" : "half");
 
-	rtl8139_start_thread(dev);
+	rtl8139_start_thread(tp);
 
 	return 0;
 }
@@ -1594,56 +1594,45 @@ static inline void rtl8139_thread_iter (
 		 RTL_R8 (Config1));
 }
 
-static int rtl8139_thread (void *data)
+static void rtl8139_thread (void *_data)
 {
-	struct net_device *dev = data;
+	struct net_device *dev = _data;
 	struct rtl8139_private *tp = netdev_priv(dev);
-	unsigned long timeout;
-
-	daemonize("%s", dev->name);
-	allow_signal(SIGTERM);
-
-	while (1) {
-		timeout = next_tick;
-		do {
-			timeout = interruptible_sleep_on_timeout (&tp->thr_wait, timeout);
-			/* make swsusp happy with our thread */
-			try_to_freeze();
-		} while (!signal_pending (current) && (timeout > 0));
 
-		if (signal_pending (current)) {
-			flush_signals(current);
-		}
-
-		if (tp->time_to_die)
-			break;
-
-		if (rtnl_lock_interruptible ())
-			break;
+	if ((tp->time_to_die == 0) &&
+	    (rtnl_lock_interruptible() == 0)) {
 		rtl8139_thread_iter (dev, tp, tp->mmio_addr);
 		rtnl_unlock ();
 	}
 
-	complete_and_exit (&tp->thr_exited, 0);
+	if (tp->time_to_die == 0)
+		schedule_delayed_work(&tp->thread, next_tick);
 }
 
-static void rtl8139_start_thread(struct net_device *dev)
+static void rtl8139_start_thread(struct rtl8139_private *tp)
 {
-	struct rtl8139_private *tp = netdev_priv(dev);
-
-	tp->thr_pid = -1;
 	tp->twistie = 0;
-	tp->time_to_die = 0;
+	tp->time_to_die = -1;
 	if (tp->chipset == CH_8139_K)
 		tp->twistie = 1;
 	else if (tp->drv_flags & HAS_LNK_CHNG)
 		return;
 
-	tp->thr_pid = kernel_thread(rtl8139_thread, dev, CLONE_FS|CLONE_FILES);
-	if (tp->thr_pid < 0) {
-		printk (KERN_WARNING "%s: unable to start kernel thread\n",
-			dev->name);
-	}
+	tp->time_to_die = 0;
+
+	schedule_delayed_work(&tp->thread, next_tick);
+}
+
+static void rtl8139_stop_thread(struct rtl8139_private *tp)
+{
+	if (tp->time_to_die < 0)
+		return;
+
+	tp->time_to_die = 1;
+	wmb();
+
+	if (cancel_delayed_work(&tp->thread) == 0)
+		flush_scheduled_work();
 }
 
 static inline void rtl8139_tx_clear (struct rtl8139_private *tp)
@@ -2224,22 +2213,12 @@ static int rtl8139_close (struct net_dev
 {
 	struct rtl8139_private *tp = netdev_priv(dev);
 	void __iomem *ioaddr = tp->mmio_addr;
-	int ret = 0;
 	unsigned long flags;
 
 	netif_stop_queue (dev);
 
-	if (tp->thr_pid >= 0) {
-		tp->time_to_die = 1;
-		wmb();
-		ret = kill_proc (tp->thr_pid, SIGTERM, 1);
-		if (ret) {
-			printk (KERN_ERR "%s: unable to signal thread\n", dev->name);
-			return ret;
-		}
-		wait_for_completion (&tp->thr_exited);
-	}
-	
+	rtl8139_stop_thread(tp);
+
 	if (netif_msg_ifdown(tp))
 		printk(KERN_DEBUG "%s: Shutting down ethercard, status was 0x%4.4x.\n",
 			dev->name, RTL_R16 (IntrStatus));

^ permalink raw reply related

* Re: [2.6 patch] fix the "QoS and/or fair queueing" menu
From: Thomas Graf @ 2005-10-31 13:27 UTC (permalink / raw)
  To: Adrian Bunk; +Cc: Jan Engelhardt, Linux Kernel Mailing List, netdev
In-Reply-To: <20051031102621.GF8009@stusta.de>

* Adrian Bunk <bunk@stusta.de> 2005-10-31 11:26
> This patch adjust some dependencies in net/sched/Kconfig for getting all 
> options that belong there under "QoS and/or fair queueing".
> 
> There is no actual semantic change in any dependency, the additional 
> dependencies are added for helping kconfig to figure out what belongs to 
> that menu.

Please hold on, I'm reworking the classification menu.

^ permalink raw reply

* Re: [PATCH] 8139cp: Catch all interrupts
From: Pierre Ossman @ 2005-10-31 18:14 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: LKML, netdev, Felipe Damasio
In-Reply-To: <431761BA.5080007@drzeus.cx>

Pierre Ossman wrote:
> Register interrupt handler when net device is registered. Avoids missing
> interrupts if the interrupt mask gets out of sync.
> 
> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
> 
> ---
> 
> The reason this patch is needed for me is that the resume function is
> broken. It enables interrupts unconditionally, but the interrupt handler
> is only registered when the device is up.
> 
> I don't have enough knowledge about the driver to fix the resume
> function so this patch will instead make sure that the interrupt handler
> is registered at all times (which can be a nice safeguard even when the
> resume function gets fixed).
> 

Any comments on this?

^ permalink raw reply

* Re: [PATCH][MCAST]IPv6: Check packet size when process Multicast Address and Source Specific Query
From: David Stevens @ 2005-10-31 19:42 UTC (permalink / raw)
  To: Yan Zheng; +Cc: linux-kernel, netdev
In-Reply-To: <4365A995.3050404@21cn.com>

I think this should be modelled after the equivalent code in IGMPv3.
See igmp_heard_query() in net/ipv4/igmp.c. For ease of maintenance,
the code should be structured exactly the same way, except for
necessary differences, of course.

I haven't seen enough context yet, but  I think you need to check
for the query header itself, too (as done in IGMPv3).

I'm reviewing your other patches as well.

                                        +-DLS

^ permalink raw reply

* airo.c patches
From: Bill Moss @ 2005-10-31 20:14 UTC (permalink / raw)
  To: netdev; +Cc: breed

Below are three patches to 
/usr/src/kernels/2.6.13-1.1532_FC4-i686/drivers/net/wireless/airo.c for 
your consideration.

Patch one. Remove 3 second delay in returning scan results. This delay 
appears to be unnecessary. Users of NetworkManager have found that this 
delay makes NetworkManager slow to connect in certain scenarios. Testing 
has shown no ill effect of removing this delay. This delay does not 
appear in other drivers such as ipw2200/ieee80211

--- airo.c_orig 2005-10-28 20:06:40.000000000 -0400
+++ airo.c      2005-10-28 20:08:16.000000000 -0400
@@ -6918,7 +6918,7 @@
       /* When we are associated again, the scan has surely finished.
        * Just in case, let's make sure enough time has elapsed since
        * we started the scan. - Javier */
-       if(ai->scan_timestamp && 
time_before(jiffies,ai->scan_timestamp+3*HZ)) {
+       if(ai->scan_timestamp && time_before(jiffies,ai->scan_timestamp)) {
               /* Important note : we don't want to block the caller
                * until results are ready for various reasons.
                * First, managing wait queues is complex and racy

Patch two. Report the channel correctly in the output from iwlist.

--- airo.c_orig 2005-10-28 20:06:40.000000000 -0400
+++ airo.c      2005-10-28 20:16:59.000000000 -0400
@@ -6846,7 +6846,7 @@
       /* Add frequency */
       iwe.cmd = SIOCGIWFREQ;
       iwe.u.freq.m = le16_to_cpu(bss->dsChannel);
-       iwe.u.freq.m = frequency_list[iwe.u.freq.m] * 100000;
+       iwe.u.freq.m = frequency_list[iwe.u.freq.m-1] * 100000;
       iwe.u.freq.e = 1;
       current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, 
IW_EV_FREQ_LEN);

Patch three. Introduce minimal ethtool support. Report driver name and 
version. Report link (association). This code was cloned from 
ipw2200/ieee80211. Ethtool support is used by NetworkManager.

--- airo.c_orig 2005-10-28 20:06:40.000000000 -0400
+++ airo.c      2005-10-28 20:21:55.000000000 -0400
@@ -39,6 +39,7 @@
#include <asm/system.h>

#include <linux/netdevice.h>
+#include <linux/ethtool.h>
#include <linux/etherdevice.h>
#include <linux/skbuff.h>
#include <linux/if_arp.h>
@@ -46,6 +47,10 @@
#include <linux/pci.h>
#include <asm/uaccess.h>

+#define DRV_NAME        "airo"
+#define AIRO_VERSION "0.6 (Ben Reed & Javier Achirica)"
+#define DRV_VERSION     AIRO_VERSION
+
#ifdef CONFIG_PCI
static struct pci_device_id card_ids[] = {
       { 0x14b9, 1, PCI_ANY_ID, PCI_ANY_ID, },
@@ -65,7 +70,7 @@
static int airo_pci_resume(struct pci_dev *pdev);

static struct pci_driver airo_driver = {
-       .name     = "airo",
+       .name     = DRV_NAME,
       .id_table = card_ids,
       .probe    = airo_pci_probe,
       .remove   = __devexit_p(airo_pci_remove),
@@ -1069,7 +1074,7 @@
static const struct iw_handler_def     airo_handler_def;
#endif /* WIRELESS_EXT */

-static const char version[] = "airo.c 0.6 (Ben Reed & Javier Achirica)";
+static const char version[] = DRV_VERSION;

struct airo_info;

@@ -2318,6 +2323,28 @@
       return 0;
}

+static void airo_ethtool_get_drvinfo(struct net_device *dev,
+                                                struct ethtool_drvinfo 
*info)
+{
+       strcpy(info->driver, DRV_NAME);
+       strcpy(info->version, DRV_VERSION);
+}
+
+static u32 airo_ethtool_get_link(struct net_device *dev)
+{
+       struct airo_info *local = dev->priv;
+       StatusRid status_rid;
+
+       readStatusRid(local, &status_rid, 1);
+
+       return (status_rid.assocStatus == STAT_ASSOCIATED);
+}
+
+static struct ethtool_ops airo_ethtool_ops = {
+       .get_link = airo_ethtool_get_link,
+       .get_drvinfo = airo_ethtool_get_drvinfo,
+};
+
static int airo_change_mtu(struct net_device *dev, int new_mtu)
{
       if ((new_mtu < 68) || (new_mtu > 2400))
@@ -2757,6 +2784,7 @@
       dev->change_mtu = &airo_change_mtu;
       dev->open = &airo_open;
       dev->stop = &airo_close;
+       dev->ethtool_ops = &airo_ethtool_ops;
       dev->irq = irq;
       dev->base_addr = port;

-- 
Bill Moss
Professor, Mathematical Sciences
Clemson University


-- 
Bill Moss
Professor, Mathematical Sciences
Clemson University

^ 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