Netdev List
 help / color / mirror / Atom feed
* [RFC] bridge: check address size
From: Stephen Hemminger @ 2009-10-29 22:24 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: Neulinger, Nathan, netdev
In-Reply-To: <20091029151222.156945ca@nehalam>

Check the address size of underlying device because the bridge assumes
the underlying device has ethernet address format. See forwarding table
and STP, for places where this true.

Also, add some comments to explain errors.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

--- a/net/bridge/br_if.c	2009-10-29 15:18:48.363916679 -0700
+++ b/net/bridge/br_if.c	2009-10-29 15:21:38.142667043 -0700
@@ -377,12 +377,17 @@ int br_add_if(struct net_bridge *br, str
 	struct net_bridge_port *p;
 	int err = 0;
 
-	if (dev->flags & IFF_LOOPBACK || dev->type != ARPHRD_ETHER)
+	/* Don't allow bridging non ethernet like devices */
+	if (dev->flags & IFF_LOOPBACK
+	    || dev->type != ARPHRD_ETHER
+	    || dev->addr_len != ETH_ALEN)
 		return -EINVAL;
 
+	/* No bridging of bridges */
 	if (dev->netdev_ops->ndo_start_xmit == br_dev_xmit)
 		return -ELOOP;
 
+	/* Device is already being bridged */
 	if (dev->br_port != NULL)
 		return -EBUSY;
 


^ permalink raw reply

* Re: [PATCH] net: allow netdev_wait_allrefs() to run faster
From: Eric W. Biederman @ 2009-10-29 23:07 UTC (permalink / raw)
  To: Benjamin LaHaise; +Cc: Eric Dumazet, Octavian Purdila, netdev, Cosmin Ratiu
In-Reply-To: <20091021165139.GL877@kvack.org>

Benjamin LaHaise <bcrl@lhnet.ca> writes:

> On Wed, Oct 21, 2009 at 05:40:07PM +0200, Eric Dumazet wrote:
>> Ben patch only address interface deletion, and one part of the problem,
>> maybe the more visible one for the current kernel.
>
> The first part I've been tackling has been the overhead in procfs, sysctl 
> and sysfs.  

Could you keep me in the loop with that.  I have some pending cleanups for
all of those pieces of code and may be able to help/advice/review.

Eric

^ permalink raw reply

* Re: [PATCH] net: allow netdev_wait_allrefs() to run faster
From: Benjamin LaHaise @ 2009-10-29 23:38 UTC (permalink / raw)
  To: Eric W. Biederman; +Cc: Eric Dumazet, Octavian Purdila, netdev, Cosmin Ratiu
In-Reply-To: <m1d445yf2x.fsf@fess.ebiederm.org>

On Thu, Oct 29, 2009 at 04:07:18PM -0700, Eric W. Biederman wrote:
> Could you keep me in the loop with that.  I have some pending cleanups for
> all of those pieces of code and may be able to help/advice/review.

Here are the sysfs scaling improvements.  I have to break them up, as there 
are 3 separate changes in this patch: 1. use an rbtree for name lookup in 
sysfs, 2. keep track of the number of directories for the purpose of 
generating the link count, as otherwise too much cpu time is spent in 
sysfs_count_nlink when new entries are added, and 3. when adding a new 
sysfs_dirent, walk the list backwards when linking it in, as higher 
numbered inodes tend to be at the end of the list, not the beginning.

		-ben


diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
index 5fad489..38ad7c8 100644
--- a/fs/sysfs/dir.c
+++ b/fs/sysfs/dir.c
@@ -43,10 +43,18 @@ static DEFINE_IDA(sysfs_ino_ida);
 static void sysfs_link_sibling(struct sysfs_dirent *sd)
 {
 	struct sysfs_dirent *parent_sd = sd->s_parent;
-	struct sysfs_dirent **pos;
+	struct sysfs_dirent **pos, *prev = NULL;
+	struct rb_node **new, *parent;
 
 	BUG_ON(sd->s_sibling);
 
+	if (parent_sd->s_dir.children_tail &&
+	    parent_sd->s_dir.children_tail->s_ino < sd->s_ino) {
+		prev = parent_sd->s_dir.children_tail;
+		pos = &prev->s_sibling;
+		goto got_it;
+	}
+
 	/* Store directory entries in order by ino.  This allows
 	 * readdir to properly restart without having to add a
 	 * cursor into the s_dir.children list.
@@ -54,9 +62,36 @@ static void sysfs_link_sibling(struct sysfs_dirent *sd)
 	for (pos = &parent_sd->s_dir.children; *pos; pos = &(*pos)->s_sibling) {
 		if (sd->s_ino < (*pos)->s_ino)
 			break;
+		prev = *pos;
 	}
+got_it:
+	if (prev == parent_sd->s_dir.children_tail)
+		parent_sd->s_dir.children_tail = sd;
 	sd->s_sibling = *pos;
+	sd->s_sibling_prev = prev;
 	*pos = sd;
+	parent_sd->s_nr_children_dir += (sysfs_type(sd) == SYSFS_DIR);
+
+	// rb tree insert
+	new = &(parent_sd->s_dir.child_rb_root.rb_node);
+	parent = NULL;
+
+	while (*new) {
+		struct sysfs_dirent *this =
+			container_of(*new, struct sysfs_dirent, s_rb_node);
+		int result = strcmp(sd->s_name, this->s_name);
+
+		parent = *new;
+		if (result < 0)
+			new = &((*new)->rb_left);
+		else if (result > 0)
+			new = &((*new)->rb_right);
+		else
+			BUG();
+	}
+
+	rb_link_node(&sd->s_rb_node, parent, new);
+	rb_insert_color(&sd->s_rb_node, &parent_sd->s_dir.child_rb_root);
 }
 
 /**
@@ -71,16 +106,22 @@ static void sysfs_link_sibling(struct sysfs_dirent *sd)
  */
 static void sysfs_unlink_sibling(struct sysfs_dirent *sd)
 {
-	struct sysfs_dirent **pos;
+	struct sysfs_dirent **pos, *prev = NULL;
 
-	for (pos = &sd->s_parent->s_dir.children; *pos;
-	     pos = &(*pos)->s_sibling) {
-		if (*pos == sd) {
-			*pos = sd->s_sibling;
-			sd->s_sibling = NULL;
-			break;
-		}
-	}
+	prev = sd->s_sibling_prev;
+	if (prev)
+		pos = &prev->s_sibling;
+	else
+		pos = &sd->s_parent->s_dir.children;
+	if (sd == sd->s_parent->s_dir.children_tail)
+		sd->s_parent->s_dir.children_tail = prev;
+	*pos = sd->s_sibling;
+	if (sd->s_sibling)
+		sd->s_sibling->s_sibling_prev = prev;
+	
+	sd->s_parent->s_nr_children_dir -= (sysfs_type(sd) == SYSFS_DIR);
+	sd->s_sibling_prev = NULL;
+	rb_erase(&sd->s_rb_node, &sd->s_parent->s_dir.child_rb_root);
 }
 
 /**
@@ -331,6 +372,9 @@ struct sysfs_dirent *sysfs_new_dirent(const char *name, umode_t mode, int type)
 	sd->s_mode = mode;
 	sd->s_flags = type;
 
+	if (type == SYSFS_DIR)
+		sd->s_dir.child_rb_root = RB_ROOT;
+
 	return sd;
 
  err_out2:
@@ -630,11 +674,20 @@ void sysfs_addrm_finish(struct sysfs_addrm_cxt *acxt)
 struct sysfs_dirent *sysfs_find_dirent(struct sysfs_dirent *parent_sd,
 				       const unsigned char *name)
 {
-	struct sysfs_dirent *sd;
-
-	for (sd = parent_sd->s_dir.children; sd; sd = sd->s_sibling)
-		if (!strcmp(sd->s_name, name))
-			return sd;
+	struct rb_node *node = parent_sd->s_dir.child_rb_root.rb_node;
+
+	while (node) {
+		struct sysfs_dirent *data =
+			container_of(node, struct sysfs_dirent, s_rb_node);
+		int result;
+		result = strcmp(name, data->s_name);
+		if (result < 0)
+			node = node->rb_left;
+		else if (result > 0)
+			node = node->rb_right;
+		else
+			return data;
+	}
 	return NULL;
 }
 
diff --git a/fs/sysfs/inode.c b/fs/sysfs/inode.c
index e28cecf..ff6e960 100644
--- a/fs/sysfs/inode.c
+++ b/fs/sysfs/inode.c
@@ -191,14 +191,7 @@ static struct lock_class_key sysfs_inode_imutex_key;
 
 static int sysfs_count_nlink(struct sysfs_dirent *sd)
 {
-	struct sysfs_dirent *child;
-	int nr = 0;
-
-	for (child = sd->s_dir.children; child; child = child->s_sibling)
-		if (sysfs_type(child) == SYSFS_DIR)
-			nr++;
-
-	return nr + 2;
+	return sd->s_nr_children_dir + 2;
 }
 
 static void sysfs_init_inode(struct sysfs_dirent *sd, struct inode *inode)
diff --git a/fs/sysfs/sysfs.h b/fs/sysfs/sysfs.h
index af4c4e7..22fd1bc 100644
--- a/fs/sysfs/sysfs.h
+++ b/fs/sysfs/sysfs.h
@@ -9,6 +9,7 @@
  */
 
 #include <linux/fs.h>
+#include <linux/rbtree.h>
 
 struct sysfs_open_dirent;
 
@@ -16,7 +17,10 @@ struct sysfs_open_dirent;
 struct sysfs_elem_dir {
 	struct kobject		*kobj;
 	/* children list starts here and goes through sd->s_sibling */
+	
 	struct sysfs_dirent	*children;
+	struct sysfs_dirent	*children_tail;
+	struct rb_root		child_rb_root;
 };
 
 struct sysfs_elem_symlink {
@@ -52,6 +56,8 @@ struct sysfs_dirent {
 	atomic_t		s_active;
 	struct sysfs_dirent	*s_parent;
 	struct sysfs_dirent	*s_sibling;
+	struct sysfs_dirent	*s_sibling_prev;
+	struct rb_node		s_rb_node;
 	const char		*s_name;
 
 	union {
@@ -65,6 +71,8 @@ struct sysfs_dirent {
 	ino_t			s_ino;
 	umode_t			s_mode;
 	struct sysfs_inode_attrs *s_iattr;
+
+	int			s_nr_children_dir;
 };
 
 #define SD_DEACTIVATED_BIAS		INT_MIN

^ permalink raw reply related

* [net-2.6 PATCH] e100: e100_phy_init() isolates selected PHY, causes 10 second boot delay
From: Jeff Kirsher @ 2009-10-29 23:42 UTC (permalink / raw)
  To: davem; +Cc: netdev, gospo, Bernhard Kaindl, Bruce Allan, Jeff Kirsher

From: Bruce Allan <bruce.w.allan@intel.com>

A change in how PHYs are electrically isolated caused all PHYs to be
isolated followed by reverting that isolation for the selected PHY.
Unfortunately, isolating the selected PHY for even a short period of
time can result in DHCP negotiation taking more than 10 seconds on certain
embedded configurations delaying boot time as reported by Bernhard Kaindl.
This patch reverts the change to how PHYs are isolated yet still works
around the issue for 82552 needing the selected PHY's BMCR register to
be written after the unused PHYs are isolated.  This code is moved below
the setting of nic->phy ID in order to do the 82552-specific workaround.

Cc: Bernhard Kaindl <bernhard.kaindl@gmx.net>
Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---

 drivers/net/e100.c |   26 +++++++++++++++++++-------
 1 files changed, 19 insertions(+), 7 deletions(-)

diff --git a/drivers/net/e100.c b/drivers/net/e100.c
index 679965c..d19b084 100644
--- a/drivers/net/e100.c
+++ b/drivers/net/e100.c
@@ -1426,19 +1426,31 @@ static int e100_phy_init(struct nic *nic)
 	} else
 		DPRINTK(HW, DEBUG, "phy_addr = %d\n", nic->mii.phy_id);
 
-	/* Isolate all the PHY ids */
-	for (addr = 0; addr < 32; addr++)
-		mdio_write(netdev, addr, MII_BMCR, BMCR_ISOLATE);
-	/* Select the discovered PHY */
-	bmcr &= ~BMCR_ISOLATE;
-	mdio_write(netdev, nic->mii.phy_id, MII_BMCR, bmcr);
-
 	/* Get phy ID */
 	id_lo = mdio_read(netdev, nic->mii.phy_id, MII_PHYSID1);
 	id_hi = mdio_read(netdev, nic->mii.phy_id, MII_PHYSID2);
 	nic->phy = (u32)id_hi << 16 | (u32)id_lo;
 	DPRINTK(HW, DEBUG, "phy ID = 0x%08X\n", nic->phy);
 
+	/* Select the phy and isolate the rest */
+	for (addr = 0; addr < 32; addr++) {
+		if (addr != nic->mii.phy_id) {
+			mdio_write(netdev, addr, MII_BMCR, BMCR_ISOLATE);
+		} else if (nic->phy != phy_82552_v) {
+			bmcr = mdio_read(netdev, addr, MII_BMCR);
+			mdio_write(netdev, addr, MII_BMCR,
+				bmcr & ~BMCR_ISOLATE);
+		}
+	}
+	/*
+	 * Workaround for 82552:
+	 * Clear the ISOLATE bit on selected phy_id last (mirrored on all
+	 * other phy_id's) using bmcr value from addr discovery loop above.
+	 */
+	if (nic->phy == phy_82552_v)
+		mdio_write(netdev, nic->mii.phy_id, MII_BMCR,
+			bmcr & ~BMCR_ISOLATE);
+
 	/* Handle National tx phys */
 #define NCS_PHY_MODEL_MASK	0xFFF0FFFF
 	if ((nic->phy & NCS_PHY_MODEL_MASK) == phy_nsc_tx) {


^ permalink raw reply related

* [net-2.6 PATCH 1/2] e1000e: config PHY via software after resets
From: Jeff Kirsher @ 2009-10-29 23:45 UTC (permalink / raw)
  To: davem; +Cc: netdev, gospo, Bruce Allan, Jeff Kirsher

From: Bruce Allan <bruce.w.allan@intel.com>

On PCH-based (82577/82578) and some ICH8-based parts (82566) there is an
issue with the hardware automatically configuring the PHY with contents
from the EEPROM after the PHY is reset, so do the configuration by the
driver instead.  This was already similarly done for some 82566 parts in
e1000_phy_hw_reset_ich8lan() but needs to be done after other resets,
so move the PHY configuration code to its own function and call after
all PHY resets.

Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---

 drivers/net/e1000e/defines.h |    1 
 drivers/net/e1000e/ich8lan.c |  295 +++++++++++++++++++++++++++++++-----------
 2 files changed, 218 insertions(+), 78 deletions(-)

diff --git a/drivers/net/e1000e/defines.h b/drivers/net/e1000e/defines.h
index c0f185b..4741ef9 100644
--- a/drivers/net/e1000e/defines.h
+++ b/drivers/net/e1000e/defines.h
@@ -347,6 +347,7 @@
 /* Extended Configuration Control and Size */
 #define E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP      0x00000020
 #define E1000_EXTCNF_CTRL_LCD_WRITE_ENABLE       0x00000001
+#define E1000_EXTCNF_CTRL_OEM_WRITE_ENABLE       0x00000008
 #define E1000_EXTCNF_CTRL_SWFLAG                 0x00000020
 #define E1000_EXTCNF_SIZE_EXT_PCIE_LENGTH_MASK   0x00FF0000
 #define E1000_EXTCNF_SIZE_EXT_PCIE_LENGTH_SHIFT          16
diff --git a/drivers/net/e1000e/ich8lan.c b/drivers/net/e1000e/ich8lan.c
index b6388b9..095ffa5 100644
--- a/drivers/net/e1000e/ich8lan.c
+++ b/drivers/net/e1000e/ich8lan.c
@@ -124,9 +124,20 @@
 
 #define SW_FLAG_TIMEOUT    1000 /* SW Semaphore flag timeout in milliseconds */
 
+/* SMBus Address Phy Register */
+#define HV_SMB_ADDR            PHY_REG(768, 26)
+#define HV_SMB_ADDR_PEC_EN     0x0200
+#define HV_SMB_ADDR_VALID      0x0080
+
+/* Strapping Option Register - RO */
+#define E1000_STRAP                     0x0000C
+#define E1000_STRAP_SMBUS_ADDRESS_MASK  0x00FE0000
+#define E1000_STRAP_SMBUS_ADDRESS_SHIFT 17
+
 /* OEM Bits Phy Register */
 #define HV_OEM_BITS            PHY_REG(768, 25)
 #define HV_OEM_BITS_LPLU       0x0004 /* Low Power Link Up */
+#define HV_OEM_BITS_GBE_DIS    0x0040 /* Gigabit Disable */
 #define HV_OEM_BITS_RESTART_AN 0x0400 /* Restart Auto-negotiation */
 
 /* ICH GbE Flash Hardware Sequencing Flash Status Register bit breakdown */
@@ -208,6 +219,7 @@ static s32 e1000_cleanup_led_pchlan(struct e1000_hw *hw);
 static s32 e1000_led_on_pchlan(struct e1000_hw *hw);
 static s32 e1000_led_off_pchlan(struct e1000_hw *hw);
 static s32 e1000_set_lplu_state_pchlan(struct e1000_hw *hw, bool active);
+static void e1000_lan_init_done_ich8lan(struct e1000_hw *hw);
 
 static inline u16 __er16flash(struct e1000_hw *hw, unsigned long reg)
 {
@@ -794,6 +806,191 @@ static s32 e1000_phy_force_speed_duplex_ich8lan(struct e1000_hw *hw)
 }
 
 /**
+ *  e1000_sw_lcd_config_ich8lan - SW-based LCD Configuration
+ *  @hw:   pointer to the HW structure
+ *
+ *  SW should configure the LCD from the NVM extended configuration region
+ *  as a workaround for certain parts.
+ **/
+static s32 e1000_sw_lcd_config_ich8lan(struct e1000_hw *hw)
+{
+	struct e1000_phy_info *phy = &hw->phy;
+	u32 i, data, cnf_size, cnf_base_addr, sw_cfg_mask;
+	s32 ret_val;
+	u16 word_addr, reg_data, reg_addr, phy_page = 0;
+
+	ret_val = hw->phy.ops.acquire_phy(hw);
+	if (ret_val)
+		return ret_val;
+
+	/*
+	 * Initialize the PHY from the NVM on ICH platforms.  This
+	 * is needed due to an issue where the NVM configuration is
+	 * not properly autoloaded after power transitions.
+	 * Therefore, after each PHY reset, we will load the
+	 * configuration data out of the NVM manually.
+	 */
+	if ((hw->mac.type == e1000_ich8lan && phy->type == e1000_phy_igp_3) ||
+		(hw->mac.type == e1000_pchlan)) {
+		struct e1000_adapter *adapter = hw->adapter;
+
+		/* Check if SW needs to configure the PHY */
+		if ((adapter->pdev->device == E1000_DEV_ID_ICH8_IGP_M_AMT) ||
+		    (adapter->pdev->device == E1000_DEV_ID_ICH8_IGP_M) ||
+		    (hw->mac.type == e1000_pchlan))
+			sw_cfg_mask = E1000_FEXTNVM_SW_CONFIG_ICH8M;
+		else
+			sw_cfg_mask = E1000_FEXTNVM_SW_CONFIG;
+
+		data = er32(FEXTNVM);
+		if (!(data & sw_cfg_mask))
+			goto out;
+
+		/* Wait for basic configuration completes before proceeding */
+		e1000_lan_init_done_ich8lan(hw);
+
+		/*
+		 * Make sure HW does not configure LCD from PHY
+		 * extended configuration before SW configuration
+		 */
+		data = er32(EXTCNF_CTRL);
+		if (data & E1000_EXTCNF_CTRL_LCD_WRITE_ENABLE)
+			goto out;
+
+		cnf_size = er32(EXTCNF_SIZE);
+		cnf_size &= E1000_EXTCNF_SIZE_EXT_PCIE_LENGTH_MASK;
+		cnf_size >>= E1000_EXTCNF_SIZE_EXT_PCIE_LENGTH_SHIFT;
+		if (!cnf_size)
+			goto out;
+
+		cnf_base_addr = data & E1000_EXTCNF_CTRL_EXT_CNF_POINTER_MASK;
+		cnf_base_addr >>= E1000_EXTCNF_CTRL_EXT_CNF_POINTER_SHIFT;
+
+		if (!(data & E1000_EXTCNF_CTRL_OEM_WRITE_ENABLE) &&
+		    (hw->mac.type == e1000_pchlan)) {
+			/*
+			 * HW configures the SMBus address and LEDs when the
+			 * OEM and LCD Write Enable bits are set in the NVM.
+			 * When both NVM bits are cleared, SW will configure
+			 * them instead.
+			 */
+			data = er32(STRAP);
+			data &= E1000_STRAP_SMBUS_ADDRESS_MASK;
+			reg_data = data >> E1000_STRAP_SMBUS_ADDRESS_SHIFT;
+			reg_data |= HV_SMB_ADDR_PEC_EN | HV_SMB_ADDR_VALID;
+			ret_val = e1000_write_phy_reg_hv_locked(hw, HV_SMB_ADDR,
+			                                        reg_data);
+			if (ret_val)
+				goto out;
+
+			data = er32(LEDCTL);
+			ret_val = e1000_write_phy_reg_hv_locked(hw,
+			                                        HV_LED_CONFIG,
+			                                        (u16)data);
+			if (ret_val)
+				goto out;
+		}
+		/* Configure LCD from extended configuration region. */
+
+		/* cnf_base_addr is in DWORD */
+		word_addr = (u16)(cnf_base_addr << 1);
+
+		for (i = 0; i < cnf_size; i++) {
+			ret_val = e1000_read_nvm(hw, (word_addr + i * 2), 1,
+			                           &reg_data);
+			if (ret_val)
+				goto out;
+
+			ret_val = e1000_read_nvm(hw, (word_addr + i * 2 + 1),
+			                           1, &reg_addr);
+			if (ret_val)
+				goto out;
+
+			/* Save off the PHY page for future writes. */
+			if (reg_addr == IGP01E1000_PHY_PAGE_SELECT) {
+				phy_page = reg_data;
+				continue;
+			}
+
+			reg_addr &= PHY_REG_MASK;
+			reg_addr |= phy_page;
+
+			ret_val = phy->ops.write_phy_reg_locked(hw,
+			                                    (u32)reg_addr,
+			                                    reg_data);
+			if (ret_val)
+				goto out;
+		}
+	}
+
+out:
+	hw->phy.ops.release_phy(hw);
+	return ret_val;
+}
+
+/**
+ *  e1000_oem_bits_config_ich8lan - SW-based LCD Configuration
+ *  @hw:       pointer to the HW structure
+ *  @d0_state: boolean if entering d0 or d3 device state
+ *
+ *  SW will configure Gbe Disable and LPLU based on the NVM. The four bits are
+ *  collectively called OEM bits.  The OEM Write Enable bit and SW Config bit
+ *  in NVM determines whether HW should configure LPLU and Gbe Disable.
+ **/
+static s32 e1000_oem_bits_config_ich8lan(struct e1000_hw *hw, bool d0_state)
+{
+	s32 ret_val = 0;
+	u32 mac_reg;
+	u16 oem_reg;
+
+	if (hw->mac.type != e1000_pchlan)
+		return ret_val;
+
+	ret_val = hw->phy.ops.acquire_phy(hw);
+	if (ret_val)
+		return ret_val;
+
+	mac_reg = er32(EXTCNF_CTRL);
+	if (mac_reg & E1000_EXTCNF_CTRL_OEM_WRITE_ENABLE)
+		goto out;
+
+	mac_reg = er32(FEXTNVM);
+	if (!(mac_reg & E1000_FEXTNVM_SW_CONFIG_ICH8M))
+		goto out;
+
+	mac_reg = er32(PHY_CTRL);
+
+	ret_val = hw->phy.ops.read_phy_reg_locked(hw, HV_OEM_BITS, &oem_reg);
+	if (ret_val)
+		goto out;
+
+	oem_reg &= ~(HV_OEM_BITS_GBE_DIS | HV_OEM_BITS_LPLU);
+
+	if (d0_state) {
+		if (mac_reg & E1000_PHY_CTRL_GBE_DISABLE)
+			oem_reg |= HV_OEM_BITS_GBE_DIS;
+
+		if (mac_reg & E1000_PHY_CTRL_D0A_LPLU)
+			oem_reg |= HV_OEM_BITS_LPLU;
+	} else {
+		if (mac_reg & E1000_PHY_CTRL_NOND0A_GBE_DISABLE)
+			oem_reg |= HV_OEM_BITS_GBE_DIS;
+
+		if (mac_reg & E1000_PHY_CTRL_NOND0A_LPLU)
+			oem_reg |= HV_OEM_BITS_LPLU;
+	}
+	/* Restart auto-neg to activate the bits */
+	oem_reg |= HV_OEM_BITS_RESTART_AN;
+	ret_val = hw->phy.ops.write_phy_reg_locked(hw, HV_OEM_BITS, oem_reg);
+
+out:
+	hw->phy.ops.release_phy(hw);
+
+	return ret_val;
+}
+
+
+/**
  *  e1000_hv_phy_workarounds_ich8lan - A series of Phy workarounds to be
  *  done after every PHY reset.
  **/
@@ -882,11 +1079,8 @@ static void e1000_lan_init_done_ich8lan(struct e1000_hw *hw)
  **/
 static s32 e1000_phy_hw_reset_ich8lan(struct e1000_hw *hw)
 {
-	struct e1000_phy_info *phy = &hw->phy;
-	u32 i;
-	u32 data, cnf_size, cnf_base_addr, sw_cfg_mask;
-	s32 ret_val;
-	u16 reg, word_addr, reg_data, reg_addr, phy_page = 0;
+	s32 ret_val = 0;
+	u16 reg;
 
 	ret_val = e1000e_phy_hw_reset_generic(hw);
 	if (ret_val)
@@ -905,81 +1099,16 @@ static s32 e1000_phy_hw_reset_ich8lan(struct e1000_hw *hw)
 	if (hw->mac.type == e1000_pchlan)
 		e1e_rphy(hw, BM_WUC, &reg);
 
-	/*
-	 * Initialize the PHY from the NVM on ICH platforms.  This
-	 * is needed due to an issue where the NVM configuration is
-	 * not properly autoloaded after power transitions.
-	 * Therefore, after each PHY reset, we will load the
-	 * configuration data out of the NVM manually.
-	 */
-	if (hw->mac.type == e1000_ich8lan && phy->type == e1000_phy_igp_3) {
-		struct e1000_adapter *adapter = hw->adapter;
-
-		/* Check if SW needs configure the PHY */
-		if ((adapter->pdev->device == E1000_DEV_ID_ICH8_IGP_M_AMT) ||
-		    (adapter->pdev->device == E1000_DEV_ID_ICH8_IGP_M))
-			sw_cfg_mask = E1000_FEXTNVM_SW_CONFIG_ICH8M;
-		else
-			sw_cfg_mask = E1000_FEXTNVM_SW_CONFIG;
-
-		data = er32(FEXTNVM);
-		if (!(data & sw_cfg_mask))
-			return 0;
-
-		/* Wait for basic configuration completes before proceeding */
-		e1000_lan_init_done_ich8lan(hw);
-
-		/*
-		 * Make sure HW does not configure LCD from PHY
-		 * extended configuration before SW configuration
-		 */
-		data = er32(EXTCNF_CTRL);
-		if (data & E1000_EXTCNF_CTRL_LCD_WRITE_ENABLE)
-			return 0;
-
-		cnf_size = er32(EXTCNF_SIZE);
-		cnf_size &= E1000_EXTCNF_SIZE_EXT_PCIE_LENGTH_MASK;
-		cnf_size >>= E1000_EXTCNF_SIZE_EXT_PCIE_LENGTH_SHIFT;
-		if (!cnf_size)
-			return 0;
-
-		cnf_base_addr = data & E1000_EXTCNF_CTRL_EXT_CNF_POINTER_MASK;
-		cnf_base_addr >>= E1000_EXTCNF_CTRL_EXT_CNF_POINTER_SHIFT;
-
-		/* Configure LCD from extended configuration region. */
-
-		/* cnf_base_addr is in DWORD */
-		word_addr = (u16)(cnf_base_addr << 1);
-
-		for (i = 0; i < cnf_size; i++) {
-			ret_val = e1000_read_nvm(hw,
-						(word_addr + i * 2),
-						1,
-						&reg_data);
-			if (ret_val)
-				return ret_val;
-
-			ret_val = e1000_read_nvm(hw,
-						(word_addr + i * 2 + 1),
-						1,
-						&reg_addr);
-			if (ret_val)
-				return ret_val;
-
-			/* Save off the PHY page for future writes. */
-			if (reg_addr == IGP01E1000_PHY_PAGE_SELECT) {
-				phy_page = reg_data;
-				continue;
-			}
-
-			reg_addr |= phy_page;
+	/* Configure the LCD with the extended configuration region in NVM */
+	ret_val = e1000_sw_lcd_config_ich8lan(hw);
+	if (ret_val)
+		goto out;
 
-			ret_val = e1e_wphy(hw, (u32)reg_addr, reg_data);
-			if (ret_val)
-				return ret_val;
-		}
-	}
+	/* Configure the LCD with the OEM bits in NVM */
+	if (hw->mac.type == e1000_pchlan)
+		ret_val = e1000_oem_bits_config_ich8lan(hw, true);
 
+out:
 	return 0;
 }
 
@@ -2386,6 +2515,15 @@ static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw)
 	if (hw->mac.type == e1000_pchlan)
 		e1e_rphy(hw, BM_WUC, &reg);
 
+	ret_val = e1000_sw_lcd_config_ich8lan(hw);
+	if (ret_val)
+		goto out;
+
+	if (hw->mac.type == e1000_pchlan) {
+		ret_val = e1000_oem_bits_config_ich8lan(hw, true);
+		if (ret_val)
+			goto out;
+	}
 	/*
 	 * For PCH, this write will make sure that any noise
 	 * will be detected as a CRC error and be dropped rather than show up
@@ -2404,6 +2542,7 @@ static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw)
 	if (hw->mac.type == e1000_pchlan)
 		ret_val = e1000_hv_phy_workarounds_ich8lan(hw);
 
+out:
 	return ret_val;
 }
 


^ permalink raw reply related

* [net-2.6 PATCH 2/2] e1000e: rework disable K1 at 1000Mbps for 82577/82578
From: Jeff Kirsher @ 2009-10-29 23:46 UTC (permalink / raw)
  To: davem; +Cc: netdev, gospo, Bruce Allan, Jeff Kirsher
In-Reply-To: <20091029234545.5413.9667.stgit@localhost.localdomain>

From: Bruce Allan <bruce.w.allan@intel.com>

This patch reworks a previous workaround (commit 7d3cabbcc) for an issue
in hardware where noise on the interconnect between the MAC and PHY could
be generated by a lower power mode (K1) at 1000Mbps resulting in bad
packets.  Disable K1 while at 1000 Mbps but keep it enabled for 10/100Mbps
and when the cable is disconnected.  The original version of this
workaround was found to be incomplete.

Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---

 drivers/net/e1000e/defines.h |    1 
 drivers/net/e1000e/e1000.h   |   14 +++
 drivers/net/e1000e/hw.h      |    1 
 drivers/net/e1000e/ich8lan.c |  187 ++++++++++++++++++++++++++++++++++++++----
 drivers/net/e1000e/phy.c     |   15 +--
 5 files changed, 190 insertions(+), 28 deletions(-)

diff --git a/drivers/net/e1000e/defines.h b/drivers/net/e1000e/defines.h
index 4741ef9..1190167 100644
--- a/drivers/net/e1000e/defines.h
+++ b/drivers/net/e1000e/defines.h
@@ -76,6 +76,7 @@
 /* Extended Device Control */
 #define E1000_CTRL_EXT_SDP7_DATA 0x00000080 /* Value of SW Definable Pin 7 */
 #define E1000_CTRL_EXT_EE_RST    0x00002000 /* Reinitialize from EEPROM */
+#define E1000_CTRL_EXT_SPD_BYPS  0x00008000 /* Speed Select Bypass */
 #define E1000_CTRL_EXT_RO_DIS    0x00020000 /* Relaxed Ordering disable */
 #define E1000_CTRL_EXT_DMA_DYN_CLK_EN 0x00080000 /* DMA Dynamic Clock Gating */
 #define E1000_CTRL_EXT_LINK_MODE_MASK 0x00C00000
diff --git a/drivers/net/e1000e/e1000.h b/drivers/net/e1000e/e1000.h
index 405a144..189dfa2 100644
--- a/drivers/net/e1000e/e1000.h
+++ b/drivers/net/e1000e/e1000.h
@@ -141,6 +141,20 @@ struct e1000_info;
 #define HV_TNCRS_UPPER		PHY_REG(778, 29) /* Transmit with no CRS */
 #define HV_TNCRS_LOWER		PHY_REG(778, 30)
 
+/* BM PHY Copper Specific Status */
+#define BM_CS_STATUS                      17
+#define BM_CS_STATUS_LINK_UP              0x0400
+#define BM_CS_STATUS_RESOLVED             0x0800
+#define BM_CS_STATUS_SPEED_MASK           0xC000
+#define BM_CS_STATUS_SPEED_1000           0x8000
+
+/* 82577 Mobile Phy Status Register */
+#define HV_M_STATUS                       26
+#define HV_M_STATUS_AUTONEG_COMPLETE      0x1000
+#define HV_M_STATUS_SPEED_MASK            0x0300
+#define HV_M_STATUS_SPEED_1000            0x0200
+#define HV_M_STATUS_LINK_UP               0x0040
+
 enum e1000_boards {
 	board_82571,
 	board_82572,
diff --git a/drivers/net/e1000e/hw.h b/drivers/net/e1000e/hw.h
index 7b05cf4..aaea41e 100644
--- a/drivers/net/e1000e/hw.h
+++ b/drivers/net/e1000e/hw.h
@@ -903,6 +903,7 @@ struct e1000_shadow_ram {
 struct e1000_dev_spec_ich8lan {
 	bool kmrn_lock_loss_workaround_enabled;
 	struct e1000_shadow_ram shadow_ram[E1000_ICH8_SHADOW_RAM_WORDS];
+	bool nvm_k1_enabled;
 };
 
 struct e1000_hw {
diff --git a/drivers/net/e1000e/ich8lan.c b/drivers/net/e1000e/ich8lan.c
index 095ffa5..51ddb04 100644
--- a/drivers/net/e1000e/ich8lan.c
+++ b/drivers/net/e1000e/ich8lan.c
@@ -140,6 +140,9 @@
 #define HV_OEM_BITS_GBE_DIS    0x0040 /* Gigabit Disable */
 #define HV_OEM_BITS_RESTART_AN 0x0400 /* Restart Auto-negotiation */
 
+#define E1000_NVM_K1_CONFIG 0x1B /* NVM K1 Config Word */
+#define E1000_NVM_K1_ENABLE 0x1  /* NVM Enable K1 bit */
+
 /* ICH GbE Flash Hardware Sequencing Flash Status Register bit breakdown */
 /* Offset 04h HSFSTS */
 union ich8_hws_flash_status {
@@ -220,6 +223,8 @@ static s32 e1000_led_on_pchlan(struct e1000_hw *hw);
 static s32 e1000_led_off_pchlan(struct e1000_hw *hw);
 static s32 e1000_set_lplu_state_pchlan(struct e1000_hw *hw, bool active);
 static void e1000_lan_init_done_ich8lan(struct e1000_hw *hw);
+static s32  e1000_k1_gig_workaround_hv(struct e1000_hw *hw, bool link);
+static s32 e1000_configure_k1_ich8lan(struct e1000_hw *hw, bool k1_enable);
 
 static inline u16 __er16flash(struct e1000_hw *hw, unsigned long reg)
 {
@@ -495,14 +500,6 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw)
 		goto out;
 	}
 
-	if (hw->mac.type == e1000_pchlan) {
-		ret_val = e1000e_write_kmrn_reg(hw,
-		                                   E1000_KMRNCTRLSTA_K1_CONFIG,
-		                                   E1000_KMRNCTRLSTA_K1_ENABLE);
-		if (ret_val)
-			goto out;
-	}
-
 	/*
 	 * First we want to see if the MII Status Register reports
 	 * link.  If so, then we want to get the current speed/duplex
@@ -512,6 +509,12 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw)
 	if (ret_val)
 		goto out;
 
+	if (hw->mac.type == e1000_pchlan) {
+		ret_val = e1000_k1_gig_workaround_hv(hw, link);
+		if (ret_val)
+			goto out;
+	}
+
 	if (!link)
 		goto out; /* No link detected */
 
@@ -929,6 +932,141 @@ out:
 }
 
 /**
+ *  e1000_k1_gig_workaround_hv - K1 Si workaround
+ *  @hw:   pointer to the HW structure
+ *  @link: link up bool flag
+ *
+ *  If K1 is enabled for 1Gbps, the MAC might stall when transitioning
+ *  from a lower speed.  This workaround disables K1 whenever link is at 1Gig
+ *  If link is down, the function will restore the default K1 setting located
+ *  in the NVM.
+ **/
+static s32 e1000_k1_gig_workaround_hv(struct e1000_hw *hw, bool link)
+{
+	s32 ret_val = 0;
+	u16 status_reg = 0;
+	bool k1_enable = hw->dev_spec.ich8lan.nvm_k1_enabled;
+
+	if (hw->mac.type != e1000_pchlan)
+		goto out;
+
+	/* Wrap the whole flow with the sw flag */
+	ret_val = hw->phy.ops.acquire_phy(hw);
+	if (ret_val)
+		goto out;
+
+	/* Disable K1 when link is 1Gbps, otherwise use the NVM setting */
+	if (link) {
+		if (hw->phy.type == e1000_phy_82578) {
+			ret_val = hw->phy.ops.read_phy_reg_locked(hw,
+			                                          BM_CS_STATUS,
+			                                          &status_reg);
+			if (ret_val)
+				goto release;
+
+			status_reg &= BM_CS_STATUS_LINK_UP |
+			              BM_CS_STATUS_RESOLVED |
+			              BM_CS_STATUS_SPEED_MASK;
+
+			if (status_reg == (BM_CS_STATUS_LINK_UP |
+			                   BM_CS_STATUS_RESOLVED |
+			                   BM_CS_STATUS_SPEED_1000))
+				k1_enable = false;
+		}
+
+		if (hw->phy.type == e1000_phy_82577) {
+			ret_val = hw->phy.ops.read_phy_reg_locked(hw,
+			                                          HV_M_STATUS,
+			                                          &status_reg);
+			if (ret_val)
+				goto release;
+
+			status_reg &= HV_M_STATUS_LINK_UP |
+			              HV_M_STATUS_AUTONEG_COMPLETE |
+			              HV_M_STATUS_SPEED_MASK;
+
+			if (status_reg == (HV_M_STATUS_LINK_UP |
+			                   HV_M_STATUS_AUTONEG_COMPLETE |
+			                   HV_M_STATUS_SPEED_1000))
+				k1_enable = false;
+		}
+
+		/* Link stall fix for link up */
+		ret_val = hw->phy.ops.write_phy_reg_locked(hw, PHY_REG(770, 19),
+		                                           0x0100);
+		if (ret_val)
+			goto release;
+
+	} else {
+		/* Link stall fix for link down */
+		ret_val = hw->phy.ops.write_phy_reg_locked(hw, PHY_REG(770, 19),
+		                                           0x4100);
+		if (ret_val)
+			goto release;
+	}
+
+	ret_val = e1000_configure_k1_ich8lan(hw, k1_enable);
+
+release:
+	hw->phy.ops.release_phy(hw);
+out:
+	return ret_val;
+}
+
+/**
+ *  e1000_configure_k1_ich8lan - Configure K1 power state
+ *  @hw: pointer to the HW structure
+ *  @enable: K1 state to configure
+ *
+ *  Configure the K1 power state based on the provided parameter.
+ *  Assumes semaphore already acquired.
+ *
+ *  Success returns 0, Failure returns -E1000_ERR_PHY (-2)
+ **/
+static s32 e1000_configure_k1_ich8lan(struct e1000_hw *hw, bool k1_enable)
+{
+	s32 ret_val = 0;
+	u32 ctrl_reg = 0;
+	u32 ctrl_ext = 0;
+	u32 reg = 0;
+	u16 kmrn_reg = 0;
+
+	ret_val = e1000e_read_kmrn_reg_locked(hw,
+	                                     E1000_KMRNCTRLSTA_K1_CONFIG,
+	                                     &kmrn_reg);
+	if (ret_val)
+		goto out;
+
+	if (k1_enable)
+		kmrn_reg |= E1000_KMRNCTRLSTA_K1_ENABLE;
+	else
+		kmrn_reg &= ~E1000_KMRNCTRLSTA_K1_ENABLE;
+
+	ret_val = e1000e_write_kmrn_reg_locked(hw,
+	                                      E1000_KMRNCTRLSTA_K1_CONFIG,
+	                                      kmrn_reg);
+	if (ret_val)
+		goto out;
+
+	udelay(20);
+	ctrl_ext = er32(CTRL_EXT);
+	ctrl_reg = er32(CTRL);
+
+	reg = ctrl_reg & ~(E1000_CTRL_SPD_1000 | E1000_CTRL_SPD_100);
+	reg |= E1000_CTRL_FRCSPD;
+	ew32(CTRL, reg);
+
+	ew32(CTRL_EXT, ctrl_ext | E1000_CTRL_EXT_SPD_BYPS);
+	udelay(20);
+	ew32(CTRL, ctrl_reg);
+	ew32(CTRL_EXT, ctrl_ext);
+	udelay(20);
+
+out:
+	return ret_val;
+}
+
+/**
  *  e1000_oem_bits_config_ich8lan - SW-based LCD Configuration
  *  @hw:       pointer to the HW structure
  *  @d0_state: boolean if entering d0 or d3 device state
@@ -1030,10 +1168,20 @@ static s32 e1000_hv_phy_workarounds_ich8lan(struct e1000_hw *hw)
 	ret_val = hw->phy.ops.acquire_phy(hw);
 	if (ret_val)
 		return ret_val;
+
 	hw->phy.addr = 1;
-	e1000e_write_phy_reg_mdic(hw, IGP01E1000_PHY_PAGE_SELECT, 0);
+	ret_val = e1000e_write_phy_reg_mdic(hw, IGP01E1000_PHY_PAGE_SELECT, 0);
+	if (ret_val)
+		goto out;
 	hw->phy.ops.release_phy(hw);
 
+	/*
+	 * Configure the K1 Si workaround during phy reset assuming there is
+	 * link so that it disables K1 if link is in 1Gbps.
+	 */
+	ret_val = e1000_k1_gig_workaround_hv(hw, true);
+
+out:
 	return ret_val;
 }
 
@@ -2435,6 +2583,7 @@ static s32 e1000_get_bus_info_ich8lan(struct e1000_hw *hw)
  **/
 static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw)
 {
+	struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan;
 	u16 reg;
 	u32 ctrl, icr, kab;
 	s32 ret_val;
@@ -2470,6 +2619,18 @@ static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw)
 		ew32(PBS, E1000_PBS_16K);
 	}
 
+	if (hw->mac.type == e1000_pchlan) {
+		/* Save the NVM K1 bit setting*/
+		ret_val = e1000_read_nvm(hw, E1000_NVM_K1_CONFIG, 1, &reg);
+		if (ret_val)
+			return ret_val;
+
+		if (reg & E1000_NVM_K1_ENABLE)
+			dev_spec->nvm_k1_enabled = true;
+		else
+			dev_spec->nvm_k1_enabled = false;
+	}
+
 	ctrl = er32(CTRL);
 
 	if (!e1000_check_reset_block(hw)) {
@@ -2847,14 +3008,6 @@ static s32 e1000_get_link_up_info_ich8lan(struct e1000_hw *hw, u16 *speed,
 	if (ret_val)
 		return ret_val;
 
-	if ((hw->mac.type == e1000_pchlan) && (*speed == SPEED_1000)) {
-		ret_val = e1000e_write_kmrn_reg(hw,
-		                                  E1000_KMRNCTRLSTA_K1_CONFIG,
-		                                  E1000_KMRNCTRLSTA_K1_DISABLE);
-		if (ret_val)
-			return ret_val;
-	}
-
 	if ((hw->mac.type == e1000_ich8lan) &&
 	    (hw->phy.type == e1000_phy_igp_3) &&
 	    (*speed == SPEED_1000)) {
diff --git a/drivers/net/e1000e/phy.c b/drivers/net/e1000e/phy.c
index f9d33ab..03175b3 100644
--- a/drivers/net/e1000e/phy.c
+++ b/drivers/net/e1000e/phy.c
@@ -95,13 +95,6 @@ static const u16 e1000_igp_2_cable_length_table[] =
 /* BM PHY Copper Specific Control 1 */
 #define BM_CS_CTRL1                       16
 
-/* BM PHY Copper Specific Status */
-#define BM_CS_STATUS                      17
-#define BM_CS_STATUS_LINK_UP              0x0400
-#define BM_CS_STATUS_RESOLVED             0x0800
-#define BM_CS_STATUS_SPEED_MASK           0xC000
-#define BM_CS_STATUS_SPEED_1000           0x8000
-
 #define HV_MUX_DATA_CTRL               PHY_REG(776, 16)
 #define HV_MUX_DATA_CTRL_GEN_TO_MAC    0x0400
 #define HV_MUX_DATA_CTRL_FORCE_SPEED   0x0004
@@ -563,7 +556,7 @@ s32 e1000e_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data)
 }
 
 /**
- *  e1000_read_kmrn_reg_locked -  Read kumeran register
+ *  e1000e_read_kmrn_reg_locked -  Read kumeran register
  *  @hw: pointer to the HW structure
  *  @offset: register offset to be read
  *  @data: pointer to the read data
@@ -572,7 +565,7 @@ s32 e1000e_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data)
  *  information retrieved is stored in data.
  *  Assumes semaphore already acquired.
  **/
-s32 e1000_read_kmrn_reg_locked(struct e1000_hw *hw, u32 offset, u16 *data)
+s32 e1000e_read_kmrn_reg_locked(struct e1000_hw *hw, u32 offset, u16 *data)
 {
 	return __e1000_read_kmrn_reg(hw, offset, data, true);
 }
@@ -631,7 +624,7 @@ s32 e1000e_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data)
 }
 
 /**
- *  e1000_write_kmrn_reg_locked -  Write kumeran register
+ *  e1000e_write_kmrn_reg_locked -  Write kumeran register
  *  @hw: pointer to the HW structure
  *  @offset: register offset to write to
  *  @data: data to write at register offset
@@ -639,7 +632,7 @@ s32 e1000e_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data)
  *  Write the data to PHY register at the offset using the kumeran interface.
  *  Assumes semaphore already acquired.
  **/
-s32 e1000_write_kmrn_reg_locked(struct e1000_hw *hw, u32 offset, u16 data)
+s32 e1000e_write_kmrn_reg_locked(struct e1000_hw *hw, u32 offset, u16 data)
 {
 	return __e1000_write_kmrn_reg(hw, offset, data, true);
 }


^ permalink raw reply related

* Re: How to use gretap with bridge?
From: Herbert Xu @ 2009-10-29 23:47 UTC (permalink / raw)
  To: Neulinger, Nathan; +Cc: Stephen Hemminger, netdev
In-Reply-To: <846C5B546E47494CBBD796CA8CA1617EA3B439@MST-VMAIL1.srv.mst.edu>

On Thu, Oct 29, 2009 at 05:04:02PM -0500, Neulinger, Nathan wrote:
> Now I see it - Stephen actually had it right on - the problem is that
> the gre tunnel is creating a MAC address on the fly based on the tunnel
> endpoint ip address, so if the tunnel endpoint address starts with an
> odd number, it hits the multicast check in the bridging code. (I'm sure
> that's what he meant and I just missed it entirely.)
> 
> Simplest option would probably be to just mask off the first octet with
> 0xFD or using the ip as the last four octets of the mac instead of the
> first four.

This looks like a bug in either iproute or the kernel.  It's
not supposed to set a MAC address unless the user specifically
gives one.  If one is not given the kernel will generate a valid
MAC address.

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

* RE: How to use gretap with bridge?
From: Neulinger, Nathan @ 2009-10-29 23:51 UTC (permalink / raw)
  To: Herbert Xu; +Cc: Stephen Hemminger, netdev
In-Reply-To: <20091029234756.GA1595@gondor.apana.org.au>

Actually, it looks like it's broke here in ipgre_tunnel_init:

--- net/ipv4/ip_gre.c.orig      2009-10-29 18:45:29.335723326 -0500
+++ net/ipv4/ip_gre.c   2009-10-29 18:45:13.069697015 -0500
@@ -1240,7 +1240,8 @@
        tunnel->dev = dev;
        strcpy(tunnel->parms.name, dev->name);
 
-       memcpy(dev->dev_addr, &tunnel->parms.iph.saddr, 4);
+       /* assign random mac addr on init */
+       random_ether_addr(dev->dev_addr);
        memcpy(dev->broadcast, &tunnel->parms.iph.daddr, 4);
 
        if (iph->daddr) {

The above change fixes it for me, but I'm no expert on this chunk of
code. (Perhaps it it shouldn't set dev_addr at all?)

-- Nathan

------------------------------------------------------------
Nathan Neulinger                       nneul@mst.edu
Missouri S&T Information Technology    (573) 612-1412
System Administrator - Principal       KD0DMH


> -----Original Message-----
> From: Herbert Xu [mailto:herbert@gondor.apana.org.au]
> Sent: Thursday, October 29, 2009 6:48 PM
> To: Neulinger, Nathan
> Cc: Stephen Hemminger; netdev@vger.kernel.org
> Subject: Re: How to use gretap with bridge?
> 
> On Thu, Oct 29, 2009 at 05:04:02PM -0500, Neulinger, Nathan wrote:
> > Now I see it - Stephen actually had it right on - the problem is
that
> > the gre tunnel is creating a MAC address on the fly based on the
> tunnel
> > endpoint ip address, so if the tunnel endpoint address starts with
an
> > odd number, it hits the multicast check in the bridging code. (I'm
> sure
> > that's what he meant and I just missed it entirely.)
> >
> > Simplest option would probably be to just mask off the first octet
> with
> > 0xFD or using the ip as the last four octets of the mac instead of
> the
> > first four.
> 
> This looks like a bug in either iproute or the kernel.  It's
> not supposed to set a MAC address unless the user specifically
> gives one.  If one is not given the kernel will generate a valid
> MAC address.
> 
> 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] sky2: set carrier off in probe
From: Brandon Philips @ 2009-10-29 23:58 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev

Before bringing up a sky2 interface up ethtool reports 
"Link detected: yes". Do as ixgbe does and netif_carrier_off() on
probe().

Signed-off-by: Brandon Philips <bphilips@suse.de>

---
 drivers/net/sky2.c |    2 ++
 1 file changed, 2 insertions(+)

Index: linux-2.6/drivers/net/sky2.c
===================================================================
--- linux-2.6.orig/drivers/net/sky2.c
+++ linux-2.6/drivers/net/sky2.c
@@ -4538,6 +4538,8 @@ static int __devinit sky2_probe(struct p
 		goto err_out_free_netdev;
 	}
 
+	netif_carrier_off(dev);
+
 	netif_napi_add(dev, &hw->napi, sky2_poll, NAPI_WEIGHT);
 
 	err = request_irq(pdev->irq, sky2_intr,

^ permalink raw reply

* [PATCH 0/6] Bonding simplifications and netns support
From: Eric W. Biederman @ 2009-10-30  0:16 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Jay Vosburgh


I recently had it pointed out to me that the bonding driver does not
work in a network namespace.  So I have simplified the bonding driver
a bit, added support for ip link add and ip link del, and finally made
the bonding driver work in multiple network namespaces.

The most note worthy change in the patchset is the addition of support
in the networking core for registering a sysfs group for a device.

Using this in the bonding driver simplifies the code and removes a
userspace race between actions triggered by the netlink event and the
bonding sysfs attributes appearing.

Eric



^ permalink raw reply

* [PATCH 1/6] net: Allow devices to specify a device specific sysfs group.
From: Eric W. Biederman @ 2009-10-30  0:18 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Jay Vosburgh, Eric W. Biederman
In-Reply-To: <m1tyxhwxah.fsf@fess.ebiederm.org>

From: Eric W. Biederman <ebiederm@aristanetworks.com>

This isn't beautifully abstracted, but it is simple,
simplifies uses and so far is only needed for the bonding driver.

Signed-off-by: Eric W. Biederman <ebiederm@aristanetworks.com>
---
 include/linux/netdevice.h |    4 ++--
 net/core/net-sysfs.c      |    5 ++++-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index ffc3106..b37f01e 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -899,8 +899,8 @@ struct net_device
 
 	/* class/net/name entry */
 	struct device		dev;
-	/* space for optional statistics and wireless sysfs groups */
-	const struct attribute_group *sysfs_groups[3];
+	/* space for optional device, statistics, and wireless sysfs groups */
+	const struct attribute_group *sysfs_groups[4];
 
 	/* rtnetlink link ops */
 	const struct rtnl_link_ops *rtnl_link_ops;
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index 89de182..157645c 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -544,8 +544,11 @@ int netdev_register_kobject(struct net_device *net)
 	dev_set_name(dev, "%s", net->name);
 
 #ifdef CONFIG_SYSFS
-	*groups++ = &netstat_group;
+	/* Allow for a device specific group */
+	if (*groups)
+		groups++;
 
+	*groups++ = &netstat_group;
 #ifdef CONFIG_WIRELESS_EXT_SYSFS
 	if (net->ieee80211_ptr)
 		*groups++ = &wireless_group;
-- 
1.6.3.1.54.g99dd.dirty


^ permalink raw reply related

* [PATCH 2/6] bond: Simply bond sysfs group creation
From: Eric W. Biederman @ 2009-10-30  0:18 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Jay Vosburgh, Eric W. Biederman
In-Reply-To: <m1tyxhwxah.fsf@fess.ebiederm.org>

From: Eric W. Biederman <ebiederm@aristanetworks.com>

This patch delegates the work of creating the sysfs groups
to the netdev layer and ultimately to the device layer.  This
closes races between uevents.

Signed-off-by: Eric W. Biederman <ebiederm@aristanetworks.com>
---
 drivers/net/bonding/bond_main.c  |   11 +----------
 drivers/net/bonding/bond_sysfs.c |   20 ++------------------
 drivers/net/bonding/bonding.h    |    3 +--
 3 files changed, 4 insertions(+), 30 deletions(-)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 8c5ebfb..f73d2de 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -2011,7 +2011,6 @@ static void bond_uninit(struct net_device *bond_dev)
 	struct bonding *bond = netdev_priv(bond_dev);
 
 	bond_deinit(bond_dev);
-	bond_destroy_sysfs_entry(bond);
 
 	if (bond->wq)
 		destroy_workqueue(bond->wq);
@@ -3457,9 +3456,6 @@ static int bond_event_changename(struct bonding *bond)
 	bond_remove_proc_entry(bond);
 	bond_create_proc_entry(bond);
 
-	bond_destroy_sysfs_entry(bond);
-	bond_create_sysfs_entry(bond);
-
 	return NOTIFY_DONE;
 }
 
@@ -5078,6 +5074,7 @@ static int bond_init(struct net_device *bond_dev)
 	bond_create_proc_entry(bond);
 	list_add_tail(&bond->bond_list, &bond_dev_list);
 
+	bond_prepare_sysfs_group(bond);
 	return 0;
 }
 
@@ -5120,15 +5117,9 @@ int bond_create(const char *name)
 	if (res < 0)
 		goto out_bond;
 
-	res = bond_create_sysfs_entry(netdev_priv(bond_dev));
-	if (res < 0)
-		goto out_unreg;
-
 	rtnl_unlock();
 	return 0;
 
-out_unreg:
-	unregister_netdevice(bond_dev);
 out_bond:
 	bond_deinit(bond_dev);
 out_netdev:
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
index dca7d82..f924a0b 100644
--- a/drivers/net/bonding/bond_sysfs.c
+++ b/drivers/net/bonding/bond_sysfs.c
@@ -1616,24 +1616,8 @@ void bond_destroy_sysfs(void)
  * Initialize sysfs for each bond.  This sets up and registers
  * the 'bondctl' directory for each individual bond under /sys/class/net.
  */
-int bond_create_sysfs_entry(struct bonding *bond)
+void bond_prepare_sysfs_group(struct bonding *bond)
 {
-	struct net_device *dev = bond->dev;
-	int err;
-
-	err = sysfs_create_group(&(dev->dev.kobj), &bonding_group);
-	if (err)
-		pr_emerg("eek! didn't create group!\n");
-
-	return err;
-}
-/*
- * Remove sysfs entries for each bond.
- */
-void bond_destroy_sysfs_entry(struct bonding *bond)
-{
-	struct net_device *dev = bond->dev;
-
-	sysfs_remove_group(&(dev->dev.kobj), &bonding_group);
+	bond->dev->sysfs_groups[0] = &bonding_group;
 }
 
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
index 9b520b0..013be29 100644
--- a/drivers/net/bonding/bonding.h
+++ b/drivers/net/bonding/bonding.h
@@ -331,8 +331,7 @@ int bond_create(const char *name);
 int  bond_release_and_destroy(struct net_device *bond_dev, struct net_device *slave_dev);
 int bond_create_sysfs(void);
 void bond_destroy_sysfs(void);
-void bond_destroy_sysfs_entry(struct bonding *bond);
-int bond_create_sysfs_entry(struct bonding *bond);
+void bond_prepare_sysfs_group(struct bonding *bond);
 int bond_create_slave_symlinks(struct net_device *master, struct net_device *slave);
 void bond_destroy_slave_symlinks(struct net_device *master, struct net_device *slave);
 int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev);
-- 
1.6.3.1.54.g99dd.dirty


^ permalink raw reply related

* [PATCH 3/6] bond: Simplify bond_create.
From: Eric W. Biederman @ 2009-10-30  0:18 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Jay Vosburgh, Eric W. Biederman
In-Reply-To: <m1tyxhwxah.fsf@fess.ebiederm.org>

From: Eric W. Biederman <ebiederm@aristanetworks.com>

Stop calling dev_get_by_name to see if the bond device already
exists.  register_netdevice already does that.

Stop calling bond_deinit if register_netdevice fails as bond_uninit
is guaranteed to be called if bond_init succeeds.

Signed-off-by: Eric W. Biederman <ebiederm@aristanetworks.com>
---
 drivers/net/bonding/bond_main.c |   22 ++++------------------
 1 files changed, 4 insertions(+), 18 deletions(-)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index f73d2de..3ce31e7 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -5089,14 +5089,6 @@ int bond_create(const char *name)
 	int res;
 
 	rtnl_lock();
-	/* Check to see if the bond already exists. */
-	/* FIXME: pass netns from caller */
-	if (name && __dev_get_by_name(&init_net, name)) {
-		pr_err(DRV_NAME ": cannot add bond %s; already exists\n",
-		       name);
-		res = -EEXIST;
-		goto out_rtnl;
-	}
 
 	bond_dev = alloc_netdev(sizeof(struct bonding), name ? name : "",
 				bond_setup);
@@ -5104,7 +5096,7 @@ int bond_create(const char *name)
 		pr_err(DRV_NAME ": %s: eek! can't alloc netdev!\n",
 		       name);
 		res = -ENOMEM;
-		goto out_rtnl;
+		goto out;
 	}
 
 	if (!name) {
@@ -5114,19 +5106,13 @@ int bond_create(const char *name)
 	}
 
 	res = register_netdevice(bond_dev);
-	if (res < 0)
-		goto out_bond;
 
+out:
 	rtnl_unlock();
-	return 0;
-
-out_bond:
-	bond_deinit(bond_dev);
+	return res;
 out_netdev:
 	free_netdev(bond_dev);
-out_rtnl:
-	rtnl_unlock();
-	return res;
+	goto out;
 }
 
 static int __init bonding_init(void)
-- 
1.6.3.1.54.g99dd.dirty


^ permalink raw reply related

* [PATCH 5/6] bond: Implement a basic set of rtnl link ops
From: Eric W. Biederman @ 2009-10-30  0:18 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Jay Vosburgh, Eric W. Biederman
In-Reply-To: <m1tyxhwxah.fsf@fess.ebiederm.org>

From: Eric W. Biederman <ebiederm@aristanetworks.com>

This implements a basic set of rtnl link ops and takes advantage of
the fact that rtnl_link_unregister kills all of the surviving
devices to all us to kill bond_free_all.  A module alias
is added so ip link add can pull in the bonding module.

Signed-off-by: Eric W. Biederman <ebiederm@aristanetworks.com>
---
 drivers/net/bonding/bond_main.c |   55 +++++++++++++++++++++-----------------
 1 files changed, 30 insertions(+), 25 deletions(-)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 7a37ecf..6da2a82 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -4612,22 +4612,6 @@ static void bond_uninit(struct net_device *bond_dev)
 	netif_addr_unlock_bh(bond_dev);
 }
 
-/* Unregister and free all bond devices.
- * Caller must hold rtnl_lock.
- */
-static void bond_free_all(void)
-{
-	struct bonding *bond, *nxt;
-
-	list_for_each_entry_safe(bond, nxt, &bond_dev_list, bond_list) {
-		struct net_device *bond_dev = bond->dev;
-
-		unregister_netdevice(bond_dev);
-	}
-
-	bond_destroy_proc_dir();
-}
-
 /*------------------------- Module initialization ---------------------------*/
 
 /*
@@ -5065,6 +5049,23 @@ static int bond_init(struct net_device *bond_dev)
 	return 0;
 }
 
+static int bond_validate(struct nlattr *tb[], struct nlattr *data[])
+{
+	if (tb[IFLA_ADDRESS]) {
+		if (nla_len(tb[IFLA_ADDRESS]) != ETH_ALEN)
+			return -EINVAL;
+		if (!is_valid_ether_addr(nla_data(tb[IFLA_ADDRESS])))
+			return -EADDRNOTAVAIL;
+	}
+	return 0;
+}
+
+static struct rtnl_link_ops bond_link_ops __read_mostly = {
+	.kind		= "bond",
+	.setup		= bond_setup,
+	.validate	= bond_validate,
+};
+
 /* Create a new bond based on the specified name and bonding parameters.
  * If name is NULL, obtain a suitable "bond%d" name for us.
  * Caller must NOT hold rtnl_lock; we need to release it here before we
@@ -5086,6 +5087,8 @@ int bond_create(const char *name)
 		goto out;
 	}
 
+	bond_dev->rtnl_link_ops = &bond_link_ops;
+
 	if (!name) {
 		res = dev_alloc_name(bond_dev, "bond%d");
 		if (res < 0)
@@ -5115,6 +5118,10 @@ static int __init bonding_init(void)
 
 	bond_create_proc_dir();
 
+	res = rtnl_link_register(&bond_link_ops);
+	if (res)
+		goto err;
+
 	for (i = 0; i < max_bonds; i++) {
 		res = bond_create(NULL);
 		if (res)
@@ -5128,14 +5135,12 @@ static int __init bonding_init(void)
 	register_netdevice_notifier(&bond_netdev_notifier);
 	register_inetaddr_notifier(&bond_inetaddr_notifier);
 	bond_register_ipv6_notifier();
-
-	goto out;
-err:
-	rtnl_lock();
-	bond_free_all();
-	rtnl_unlock();
 out:
 	return res;
+err:
+	rtnl_link_unregister(&bond_link_ops);
+	bond_destroy_proc_dir();
+	goto out;
 
 }
 
@@ -5147,9 +5152,8 @@ static void __exit bonding_exit(void)
 
 	bond_destroy_sysfs();
 
-	rtnl_lock();
-	bond_free_all();
-	rtnl_unlock();
+	rtnl_link_unregister(&bond_link_ops);
+	bond_destroy_proc_dir();
 }
 
 module_init(bonding_init);
@@ -5158,3 +5162,4 @@ MODULE_LICENSE("GPL");
 MODULE_VERSION(DRV_VERSION);
 MODULE_DESCRIPTION(DRV_DESCRIPTION ", v" DRV_VERSION);
 MODULE_AUTHOR("Thomas Davis, tadavis@lbl.gov and many others");
+MODULE_ALIAS_RTNL_LINK("bond");
-- 
1.6.3.1.54.g99dd.dirty


^ permalink raw reply related

* [PATCH 4/6] bond: Simplify bond device destruction
From: Eric W. Biederman @ 2009-10-30  0:18 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Jay Vosburgh, Eric W. Biederman
In-Reply-To: <m1tyxhwxah.fsf@fess.ebiederm.org>

From: Eric W. Biederman <ebiederm@aristanetworks.com>

Manually inline the code from bond_deinit to bond_uninit.  bond_uninit
is the only caller and it is short.

Move the call of bond_release_all from the netdev notifier into
bond_uninit.  The call site is effectively the same and performing
the call explicitly allows all the paths for destroying a
bonding device to behave the same way.

Signed-off-by: Eric W. Biederman <ebiederm@aristanetworks.com>
---
 drivers/net/bonding/bond_main.c |   45 +++++++++++++-------------------------
 1 files changed, 16 insertions(+), 29 deletions(-)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 3ce31e7..7a37ecf 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -227,7 +227,7 @@ struct bond_parm_tbl ad_select_tbl[] = {
 
 static void bond_send_gratuitous_arp(struct bonding *bond);
 static int bond_init(struct net_device *bond_dev);
-static void bond_deinit(struct net_device *bond_dev);
+static void bond_uninit(struct net_device *bond_dev);
 
 /*---------------------------- General routines -----------------------------*/
 
@@ -2003,24 +2003,6 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev)
 }
 
 /*
-* Destroy a bonding device.
-* Must be under rtnl_lock when this function is called.
-*/
-static void bond_uninit(struct net_device *bond_dev)
-{
-	struct bonding *bond = netdev_priv(bond_dev);
-
-	bond_deinit(bond_dev);
-
-	if (bond->wq)
-		destroy_workqueue(bond->wq);
-
-	netif_addr_lock_bh(bond_dev);
-	bond_mc_list_destroy(bond);
-	netif_addr_unlock_bh(bond_dev);
-}
-
-/*
 * First release a slave and than destroy the bond if no more slaves are left.
 * Must be under rtnl_lock when this function is called.
 */
@@ -3467,9 +3449,6 @@ static int bond_master_netdev_event(unsigned long event,
 	switch (event) {
 	case NETDEV_CHANGENAME:
 		return bond_event_changename(event_bond);
-	case NETDEV_UNREGISTER:
-		bond_release_all(event_bond->dev);
-		break;
 	default:
 		break;
 	}
@@ -4608,18 +4587,29 @@ static void bond_work_cancel_all(struct bonding *bond)
 		cancel_delayed_work(&bond->ad_work);
 }
 
-/* De-initialize device specific data.
- * Caller must hold rtnl_lock.
- */
-static void bond_deinit(struct net_device *bond_dev)
+/*
+* Destroy a bonding device.
+* Must be under rtnl_lock when this function is called.
+*/
+static void bond_uninit(struct net_device *bond_dev)
 {
 	struct bonding *bond = netdev_priv(bond_dev);
 
+	/* Release the bonded slaves */
+	bond_release_all(bond_dev);
+
 	list_del(&bond->bond_list);
 
 	bond_work_cancel_all(bond);
 
 	bond_remove_proc_entry(bond);
+
+	if (bond->wq)
+		destroy_workqueue(bond->wq);
+
+	netif_addr_lock_bh(bond_dev);
+	bond_mc_list_destroy(bond);
+	netif_addr_unlock_bh(bond_dev);
 }
 
 /* Unregister and free all bond devices.
@@ -4632,9 +4622,6 @@ static void bond_free_all(void)
 	list_for_each_entry_safe(bond, nxt, &bond_dev_list, bond_list) {
 		struct net_device *bond_dev = bond->dev;
 
-		bond_work_cancel_all(bond);
-		/* Release the bonded slaves */
-		bond_release_all(bond_dev);
 		unregister_netdevice(bond_dev);
 	}
 
-- 
1.6.3.1.54.g99dd.dirty


^ permalink raw reply related

* [PATCH 6/6] bond: Add support for multiple network namespaces
From: Eric W. Biederman @ 2009-10-30  0:18 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Jay Vosburgh, Eric W. Biederman
In-Reply-To: <m1tyxhwxah.fsf@fess.ebiederm.org>

From: Eric W. Biederman <ebiederm@aristanetworks.com>

Signed-off-by: Eric W. Biederman <ebiederm@aristanetworks.com>
---
 drivers/net/bonding/bond_3ad.c   |    3 -
 drivers/net/bonding/bond_alb.c   |    3 -
 drivers/net/bonding/bond_ipv6.c  |    7 +--
 drivers/net/bonding/bond_main.c  |  111 +++++++++++++++++++++++++-------------
 drivers/net/bonding/bond_sysfs.c |   19 ++++---
 drivers/net/bonding/bonding.h    |   14 ++++--
 6 files changed, 99 insertions(+), 58 deletions(-)

diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
index 3cd8153..1d05819 100644
--- a/drivers/net/bonding/bond_3ad.c
+++ b/drivers/net/bonding/bond_3ad.c
@@ -2445,9 +2445,6 @@ int bond_3ad_lacpdu_recv(struct sk_buff *skb, struct net_device *dev, struct pac
 	struct slave *slave = NULL;
 	int ret = NET_RX_DROP;
 
-	if (dev_net(dev) != &init_net)
-		goto out;
-
 	if (!(dev->flags & IFF_MASTER))
 		goto out;
 
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c
index 9b5936f..0d30d1e 100644
--- a/drivers/net/bonding/bond_alb.c
+++ b/drivers/net/bonding/bond_alb.c
@@ -355,9 +355,6 @@ static int rlb_arp_recv(struct sk_buff *skb, struct net_device *bond_dev, struct
 	struct arp_pkt *arp = (struct arp_pkt *)skb->data;
 	int res = NET_RX_DROP;
 
-	if (dev_net(bond_dev) != &init_net)
-		goto out;
-
 	while (bond_dev->priv_flags & IFF_802_1Q_VLAN)
 		bond_dev = vlan_dev_real_dev(bond_dev);
 
diff --git a/drivers/net/bonding/bond_ipv6.c b/drivers/net/bonding/bond_ipv6.c
index 83921ab..b72e1dc 100644
--- a/drivers/net/bonding/bond_ipv6.c
+++ b/drivers/net/bonding/bond_ipv6.c
@@ -25,6 +25,7 @@
 #include <net/ipv6.h>
 #include <net/ndisc.h>
 #include <net/addrconf.h>
+#include <net/netns/generic.h>
 #include "bonding.h"
 
 /*
@@ -152,11 +153,9 @@ static int bond_inet6addr_event(struct notifier_block *this,
 	struct net_device *vlan_dev, *event_dev = ifa->idev->dev;
 	struct bonding *bond;
 	struct vlan_entry *vlan;
+	struct bond_net *bn = net_generic(dev_net(event_dev), bond_net_id);
 
-	if (dev_net(event_dev) != &init_net)
-		return NOTIFY_DONE;
-
-	list_for_each_entry(bond, &bond_dev_list, bond_list) {
+	list_for_each_entry(bond, &bn->dev_list, bond_list) {
 		if (bond->dev == event_dev) {
 			switch (event) {
 			case NETDEV_UP:
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 6da2a82..568609e 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -75,6 +75,7 @@
 #include <linux/jiffies.h>
 #include <net/route.h>
 #include <net/net_namespace.h>
+#include <net/netns/generic.h>
 #include "bonding.h"
 #include "bond_3ad.h"
 #include "bond_alb.h"
@@ -157,11 +158,7 @@ MODULE_PARM_DESC(fail_over_mac, "For active-backup, do not set all slaves to the
 static const char * const version =
 	DRV_DESCRIPTION ": v" DRV_VERSION " (" DRV_RELDATE ")\n";
 
-LIST_HEAD(bond_dev_list);
-
-#ifdef CONFIG_PROC_FS
-static struct proc_dir_entry *bond_proc_dir;
-#endif
+int bond_net_id;
 
 static __be32 arp_target[BOND_MAX_ARP_TARGETS];
 static int arp_ip_count;
@@ -2586,7 +2583,7 @@ static void bond_arp_send_all(struct bonding *bond, struct slave *slave)
 		fl.fl4_dst = targets[i];
 		fl.fl4_tos = RTO_ONLINK;
 
-		rv = ip_route_output_key(&init_net, &rt, &fl);
+		rv = ip_route_output_key(dev_net(bond->dev), &rt, &fl);
 		if (rv) {
 			if (net_ratelimit()) {
 				pr_warning(DRV_NAME
@@ -2694,9 +2691,6 @@ static int bond_arp_rcv(struct sk_buff *skb, struct net_device *dev, struct pack
 	unsigned char *arp_ptr;
 	__be32 sip, tip;
 
-	if (dev_net(dev) != &init_net)
-		goto out;
-
 	if (!(dev->priv_flags & IFF_BONDING) || !(dev->flags & IFF_MASTER))
 		goto out;
 
@@ -3359,10 +3353,11 @@ static const struct file_operations bond_info_fops = {
 static void bond_create_proc_entry(struct bonding *bond)
 {
 	struct net_device *bond_dev = bond->dev;
+	struct bond_net *bn = net_generic(dev_net(bond_dev), bond_net_id);
 
-	if (bond_proc_dir) {
+	if (bn->proc_dir) {
 		bond->proc_entry = proc_create_data(bond_dev->name,
-						    S_IRUGO, bond_proc_dir,
+						    S_IRUGO, bn->proc_dir,
 						    &bond_info_fops, bond);
 		if (bond->proc_entry == NULL)
 			pr_warning(DRV_NAME
@@ -3375,8 +3370,11 @@ static void bond_create_proc_entry(struct bonding *bond)
 
 static void bond_remove_proc_entry(struct bonding *bond)
 {
-	if (bond_proc_dir && bond->proc_entry) {
-		remove_proc_entry(bond->proc_file_name, bond_proc_dir);
+	struct net_device *bond_dev = bond->dev;
+	struct bond_net *bn = net_generic(dev_net(bond_dev), bond_net_id);
+
+	if (bn->proc_dir && bond->proc_entry) {
+		remove_proc_entry(bond->proc_file_name, bn->proc_dir);
 		memset(bond->proc_file_name, 0, IFNAMSIZ);
 		bond->proc_entry = NULL;
 	}
@@ -3385,11 +3383,11 @@ static void bond_remove_proc_entry(struct bonding *bond)
 /* Create the bonding directory under /proc/net, if doesn't exist yet.
  * Caller must hold rtnl_lock.
  */
-static void bond_create_proc_dir(void)
+static void bond_create_proc_dir(struct bond_net *bn)
 {
-	if (!bond_proc_dir) {
-		bond_proc_dir = proc_mkdir(DRV_NAME, init_net.proc_net);
-		if (!bond_proc_dir)
+	if (!bn->proc_dir) {
+		bn->proc_dir = proc_mkdir(DRV_NAME, bn->net->proc_net);
+		if (!bn->proc_dir)
 			pr_warning(DRV_NAME
 				": Warning: cannot create /proc/net/%s\n",
 				DRV_NAME);
@@ -3399,11 +3397,11 @@ static void bond_create_proc_dir(void)
 /* Destroy the bonding directory under /proc/net, if empty.
  * Caller must hold rtnl_lock.
  */
-static void bond_destroy_proc_dir(void)
+static void bond_destroy_proc_dir(struct bond_net *bn)
 {
-	if (bond_proc_dir) {
-		remove_proc_entry(DRV_NAME, init_net.proc_net);
-		bond_proc_dir = NULL;
+	if (bn->proc_dir) {
+		remove_proc_entry(DRV_NAME, bn->net->proc_net);
+		bn->proc_dir = NULL;
 	}
 }
 
@@ -3417,11 +3415,11 @@ static void bond_remove_proc_entry(struct bonding *bond)
 {
 }
 
-static void bond_create_proc_dir(void)
+static void bond_create_proc_dir(struct bond_net *bn)
 {
 }
 
-static void bond_destroy_proc_dir(void)
+static void bond_destroy_proc_dir(struct bond_net *bn)
 {
 }
 
@@ -3540,9 +3538,6 @@ static int bond_netdev_event(struct notifier_block *this,
 {
 	struct net_device *event_dev = (struct net_device *)ptr;
 
-	if (dev_net(event_dev) != &init_net)
-		return NOTIFY_DONE;
-
 	pr_debug("event_dev: %s, event: %lx\n",
 		(event_dev ? event_dev->name : "None"),
 		event);
@@ -3575,13 +3570,11 @@ static int bond_inetaddr_event(struct notifier_block *this, unsigned long event,
 {
 	struct in_ifaddr *ifa = ptr;
 	struct net_device *vlan_dev, *event_dev = ifa->ifa_dev->dev;
+	struct bond_net *bn = net_generic(dev_net(event_dev), bond_net_id);
 	struct bonding *bond;
 	struct vlan_entry *vlan;
 
-	if (dev_net(ifa->ifa_dev->dev) != &init_net)
-		return NOTIFY_DONE;
-
-	list_for_each_entry(bond, &bond_dev_list, bond_list) {
+	list_for_each_entry(bond, &bn->dev_list, bond_list) {
 		if (bond->dev == event_dev) {
 			switch (event) {
 			case NETDEV_UP:
@@ -3950,7 +3943,7 @@ static int bond_do_ioctl(struct net_device *bond_dev, struct ifreq *ifr, int cmd
 	if (!capable(CAP_NET_ADMIN))
 		return -EPERM;
 
-	slave_dev = dev_get_by_name(&init_net, ifr->ifr_slave);
+	slave_dev = dev_get_by_name(dev_net(bond_dev), ifr->ifr_slave);
 
 	pr_debug("slave_dev=%p: \n", slave_dev);
 
@@ -5031,6 +5024,7 @@ static void bond_set_lockdep_class(struct net_device *dev)
 static int bond_init(struct net_device *bond_dev)
 {
 	struct bonding *bond = netdev_priv(bond_dev);
+	struct bond_net *bn = net_generic(dev_net(bond_dev), bond_net_id);
 
 	pr_debug("Begin bond_init for %s\n", bond_dev->name);
 
@@ -5043,7 +5037,7 @@ static int bond_init(struct net_device *bond_dev)
 	netif_carrier_off(bond_dev);
 
 	bond_create_proc_entry(bond);
-	list_add_tail(&bond->bond_list, &bond_dev_list);
+	list_add_tail(&bond->bond_list, &bn->dev_list);
 
 	bond_prepare_sysfs_group(bond);
 	return 0;
@@ -5071,7 +5065,7 @@ static struct rtnl_link_ops bond_link_ops __read_mostly = {
  * Caller must NOT hold rtnl_lock; we need to release it here before we
  * set up our sysfs entries.
  */
-int bond_create(const char *name)
+int bond_create(struct net *net, const char *name)
 {
 	struct net_device *bond_dev;
 	int res;
@@ -5087,6 +5081,7 @@ int bond_create(const char *name)
 		goto out;
 	}
 
+	dev_net_set(bond_dev, net);
 	bond_dev->rtnl_link_ops = &bond_link_ops;
 
 	if (!name) {
@@ -5105,6 +5100,46 @@ out_netdev:
 	goto out;
 }
 
+static int bond_net_init(struct net *net)
+{
+	struct bond_net *bn;
+	int err;
+
+	err = -ENOMEM;
+	bn = kzalloc(sizeof(struct bond_net), GFP_KERNEL);
+	if (bn == NULL)
+		goto out;
+
+	bn->net = net;
+	INIT_LIST_HEAD(&bn->dev_list);
+
+	err = net_assign_generic(net, bond_net_id, bn);
+	if (err)
+		goto out_free;
+
+	bond_create_proc_dir(bn);
+out:
+	return err;
+out_free:
+	kfree(bn);
+	goto out;
+}
+
+static void bond_net_exit(struct net *net)
+{
+	struct bond_net *bn;
+
+	bn = net_generic(net, bond_net_id);
+
+	bond_destroy_proc_dir(bn);
+	kfree(bn);
+}
+
+static struct pernet_operations bond_net_ops = {
+	.init = bond_net_init,
+	.exit = bond_net_exit,
+};
+
 static int __init bonding_init(void)
 {
 	int i;
@@ -5116,14 +5151,16 @@ static int __init bonding_init(void)
 	if (res)
 		goto out;
 
-	bond_create_proc_dir();
+	res = register_pernet_gen_subsys(&bond_net_id, &bond_net_ops);
+	if (res)
+		goto out;
 
 	res = rtnl_link_register(&bond_link_ops);
 	if (res)
 		goto err;
 
 	for (i = 0; i < max_bonds; i++) {
-		res = bond_create(NULL);
+		res = bond_create(&init_net, NULL);
 		if (res)
 			goto err;
 	}
@@ -5139,7 +5176,7 @@ out:
 	return res;
 err:
 	rtnl_link_unregister(&bond_link_ops);
-	bond_destroy_proc_dir();
+	unregister_pernet_gen_subsys(bond_net_id, &bond_net_ops);
 	goto out;
 
 }
@@ -5153,7 +5190,7 @@ static void __exit bonding_exit(void)
 	bond_destroy_sysfs();
 
 	rtnl_link_unregister(&bond_link_ops);
-	bond_destroy_proc_dir();
+	unregister_pernet_gen_subsys(bond_net_id, &bond_net_ops);
 }
 
 module_init(bonding_init);
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
index f924a0b..a59094f 100644
--- a/drivers/net/bonding/bond_sysfs.c
+++ b/drivers/net/bonding/bond_sysfs.c
@@ -35,6 +35,8 @@
 #include <linux/rtnetlink.h>
 #include <linux/etherdevice.h>
 #include <net/net_namespace.h>
+#include <net/netns/generic.h>
+#include <linux/nsproxy.h>
 
 #include "bonding.h"
 
@@ -47,12 +49,14 @@
  */
 static ssize_t bonding_show_bonds(struct class *cls, char *buf)
 {
+	struct net *net = current->nsproxy->net_ns;
+	struct bond_net *bn = net_generic(net, bond_net_id);
 	int res = 0;
 	struct bonding *bond;
 
 	rtnl_lock();
 
-	list_for_each_entry(bond, &bond_dev_list, bond_list) {
+	list_for_each_entry(bond, &bn->dev_list, bond_list) {
 		if (res > (PAGE_SIZE - IFNAMSIZ)) {
 			/* not enough space for another interface name */
 			if ((PAGE_SIZE - res) > 10)
@@ -69,11 +73,12 @@ static ssize_t bonding_show_bonds(struct class *cls, char *buf)
 	return res;
 }
 
-static struct net_device *bond_get_by_name(const char *ifname)
+static struct net_device *bond_get_by_name(struct net *net, const char *ifname)
 {
+	struct bond_net *bn = net_generic(net, bond_net_id);
 	struct bonding *bond;
 
-	list_for_each_entry(bond, &bond_dev_list, bond_list) {
+	list_for_each_entry(bond, &bn->dev_list, bond_list) {
 		if (strncmp(bond->dev->name, ifname, IFNAMSIZ) == 0)
 			return bond->dev;
 	}
@@ -91,6 +96,7 @@ static struct net_device *bond_get_by_name(const char *ifname)
 static ssize_t bonding_store_bonds(struct class *cls,
 				   const char *buffer, size_t count)
 {
+	struct net *net = current->nsproxy->net_ns;
 	char command[IFNAMSIZ + 1] = {0, };
 	char *ifname;
 	int rv, res = count;
@@ -104,7 +110,7 @@ static ssize_t bonding_store_bonds(struct class *cls,
 	if (command[0] == '+') {
 		pr_info(DRV_NAME
 			": %s is being created...\n", ifname);
-		rv = bond_create(ifname);
+		rv = bond_create(net, ifname);
 		if (rv) {
 			pr_info(DRV_NAME ": Bond creation failed.\n");
 			res = rv;
@@ -113,7 +119,7 @@ static ssize_t bonding_store_bonds(struct class *cls,
 		struct net_device *bond_dev;
 
 		rtnl_lock();
-		bond_dev = bond_get_by_name(ifname);
+		bond_dev = bond_get_by_name(net, ifname);
 		if (bond_dev) {
 			pr_info(DRV_NAME ": %s is being deleted...\n",
 				ifname);
@@ -238,8 +244,7 @@ static ssize_t bonding_store_slaves(struct device *d,
 		/* Got a slave name in ifname.  Is it already in the list? */
 		found = 0;
 
-		/* FIXME: get netns from sysfs object */
-		dev = __dev_get_by_name(&init_net, ifname);
+		dev = __dev_get_by_name(dev_net(bond->dev), ifname);
 		if (!dev) {
 			pr_info(DRV_NAME
 			       ": %s: Interface %s does not exist!\n",
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
index 013be29..a51ae7d 100644
--- a/drivers/net/bonding/bonding.h
+++ b/drivers/net/bonding/bonding.h
@@ -30,8 +30,6 @@
 
 #define BOND_MAX_ARP_TARGETS	16
 
-extern struct list_head bond_dev_list;
-
 #define IS_UP(dev)					   \
 	      ((((dev)->flags & IFF_UP) == IFF_UP)	&& \
 	       netif_running(dev)			&& \
@@ -327,7 +325,7 @@ static inline void bond_unset_master_alb_flags(struct bonding *bond)
 
 struct vlan_entry *bond_next_vlan(struct bonding *bond, struct vlan_entry *curr);
 int bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb, struct net_device *slave_dev);
-int bond_create(const char *name);
+int bond_create(struct net *net, const char *name);
 int  bond_release_and_destroy(struct net_device *bond_dev, struct net_device *slave_dev);
 int bond_create_sysfs(void);
 void bond_destroy_sysfs(void);
@@ -346,8 +344,16 @@ void bond_change_active_slave(struct bonding *bond, struct slave *new_active);
 void bond_register_arp(struct bonding *);
 void bond_unregister_arp(struct bonding *);
 
+struct bond_net {
+	struct net *		net;	/* Associated network namespace */
+	struct list_head	dev_list;
+#ifdef CONFIG_PROC_FS
+	struct proc_dir_entry *	proc_dir;
+#endif
+};
+
 /* exported from bond_main.c */
-extern struct list_head bond_dev_list;
+extern int bond_net_id;
 extern const struct bond_parm_tbl bond_lacp_tbl[];
 extern const struct bond_parm_tbl bond_mode_tbl[];
 extern const struct bond_parm_tbl xmit_hashtype_tbl[];
-- 
1.6.3.1.54.g99dd.dirty


^ permalink raw reply related

* Re: [PATCH] net: allow netdev_wait_allrefs() to run faster
From: Eric W. Biederman @ 2009-10-30  1:45 UTC (permalink / raw)
  To: Benjamin LaHaise; +Cc: Eric Dumazet, Octavian Purdila, netdev, Cosmin Ratiu
In-Reply-To: <20091029233848.GV3141@kvack.org>

Benjamin LaHaise <bcrl@lhnet.ca> writes:

> On Thu, Oct 29, 2009 at 04:07:18PM -0700, Eric W. Biederman wrote:
>> Could you keep me in the loop with that.  I have some pending cleanups for
>> all of those pieces of code and may be able to help/advice/review.
>
> Here are the sysfs scaling improvements.  I have to break them up, as there 
> are 3 separate changes in this patch: 1. use an rbtree for name lookup in 
> sysfs, 2. keep track of the number of directories for the purpose of 
> generating the link count, as otherwise too much cpu time is spent in 
> sysfs_count_nlink when new entries are added, and 3. when adding a new 
> sysfs_dirent, walk the list backwards when linking it in, as higher 
> numbered inodes tend to be at the end of the list, not the beginning.

The reason for the existence of sysfs_dirent is as things grow larger
we want to keep the amount of RAM consumed down.  So we don't pin
everything in the dcache.  So we try and keep the amount of memory
consumed down.

So I would like to see how much we can par down.

For dealing with seeks in the middle of readdir I expect the best way
to do that is to be inspired by htrees in extNfs and return a hash of
the filename as our position, and keep the filename list sorted by
that hash.  Since we are optimizing for size we don't need to store
that hash.  Then we can turn that list into a some flavor of sorted
binary tree.

I'm surprised sysfs_count_nlink shows up, as it is not directly on the
add or remove path.  I think the answer there is to change s_flags
into a set of bitfields and make link_count one of them, perhaps
16bits long.  If we ever overflow our bitfield we can just set link
count to 0, and userspace (aka find) will know it can't optimized
based on link count.

I was expecting someone to run into problems with the linear directory
of sysfs someday.

Eric


^ permalink raw reply

* Re: wanPMC-CxT1E1
From: Krzysztof Halasa @ 2009-10-30  1:52 UTC (permalink / raw)
  To: Bob Beers; +Cc: Greg KH, netdev
In-Reply-To: <4f6ba3b0910271048n10ff37fek9af191b133892e1e@mail.gmail.com>

Bob Beers <bob.beers@gmail.com> writes:

> ok, so where do I start, I have a system ready to start
>  git cloning, and creating patches. I googled for a while
>  but didn't find a nice recipe for participating in the -staging
>  process.

I gave it a try. At least compiles with few warnings. Not sure about the
WORK_INIT() change.

Created drivers/net/wan/cxt1e1, moved all relevant SBE's .c and .h
there, added a simple Makefile/Kconfig. Quick and dirty. There is a
_lot_ of work to be done before it meets the usual kernel standards.

It's not in staging/ so the paths need to be corrected but I can't work
further on it at this time. Hand-edited but I tried to be careful.

Signed-off-by: Krzysztof Hałasa <khc@pm.waw.pl>

 drivers/net/wan/Kconfig         |   22 ++++++++++++++++++++++
 drivers/net/wan/Makefile        |    1 +
 drivers/net/wan/cxt1e1/Makefile |    3 +++
 drivers/net/wan/cxt1e1/functions.c           |  117 +----
 drivers/net/wan/cxt1e1/hwprobe.c             |   30 +-
 drivers/net/wan/cxt1e1/libsbew.h             |    4 -
 drivers/net/wan/cxt1e1/linux.c               |  631 +++++++------------------
 drivers/net/wan/cxt1e1/musycc.c              |  237 +----------
 drivers/net/wan/cxt1e1/musycc.h              |   51 +--
 drivers/net/wan/cxt1e1/pmcc4_defs.h          |   28 +--
 drivers/net/wan/cxt1e1/pmcc4_drv.c           |  114 +-----
 drivers/net/wan/cxt1e1/pmcc4_private.h       |   34 +--
 drivers/net/wan/cxt1e1/pmcc4_sysdep.h        |   77 +---
 drivers/net/wan/cxt1e1/sbecom_inline_linux.h |   65 +---
 drivers/net/wan/cxt1e1/sbeid.c               |   38 +--
 drivers/net/wan/cxt1e1/sbeproc.c             |   70 +---
 drivers/net/wan/cxt1e1/sbeproc.h             |   39 +--

diff --git a/drivers/net/wan/Kconfig b/drivers/net/wan/Kconfig
index d08ce6a..0c3c761 100644
--- a/drivers/net/wan/Kconfig
+++ b/drivers/net/wan/Kconfig
@@ -342,6 +342,28 @@ config IXP4XX_HSS
 	  Say Y here if you want to use built-in HSS ports
 	  on IXP4xx processor.
 
+config CXT1E1
+	tristate "SBE wanPMC-C[421]T1E1 hardware support"
+	depends on HDLC && PCI
+	help
+	  This driver supports the SBE wanPMC-CxT1E1 1, 2 and 4 port T1
+	  channelized stream WAN adapter card which contains a HDLC/Transparent
+	  mode controller.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called cxt1e1.
+
+	  If unsure, say N.
+
+config SBE_PMCC4_NCOMM
+	bool "SBE PMCC4 NCOMM support"
+	depends on SBE_PMCC4
+	help
+          SBE supplies optional support for NCOMM products.
+
+	  If you have purchased this optional support you must say Y or M
+	  here to allow the driver to operate with the NCOMM product.
+
 config DLCI
 	tristate "Frame Relay DLCI support"
 	---help---
diff --git a/drivers/net/wan/Makefile b/drivers/net/wan/Makefile
index 19d14bc..1715c14 100644
--- a/drivers/net/wan/Makefile
+++ b/drivers/net/wan/Makefile
@@ -42,6 +42,7 @@ obj-$(CONFIG_WANXL)		+= wanxl.o
 obj-$(CONFIG_PCI200SYN)		+= pci200syn.o
 obj-$(CONFIG_PC300TOO)		+= pc300too.o
 obj-$(CONFIG_IXP4XX_HSS)	+= ixp4xx_hss.o
+obj-$(CONFIG_CXT1E1)		+= cxt1e1/
 
 clean-files := wanxlfw.inc
 $(obj)/wanxl.o:	$(obj)/wanxlfw.inc
diff --git a/drivers/net/wan/cxt1e1/Makefile b/drivers/net/wan/cxt1e1/Makefile
new file mode 100644
index 0000000..82b9118
--- /dev/null
+++ b/drivers/net/wan/cxt1e1/Makefile
@@ -0,0 +1,3 @@
+obj-$(CONFIG_CXT1E1) += cxt1e1.o
+
+cxt1e1-objs := comet.o comet_tables.o functions.o hwprobe.o linux.o musycc.o pmc93x6_eeprom.o pmcc4_drv.o sbecrc.o sbeid.o sbeproc.o
diff --git a/drivers/net/wan/cxt1e1/functions.c b/drivers/net/wan/cxt1e1/functions.c
index e490b5e..52581d7 100644
--- a/drivers/net/wan/cxt1e1/functions.c
+++ b/drivers/net/wan/cxt1e1/functions.c
@@ -1,10 +1,4 @@
 /*
- * $Id: functions.c,v 2.1 2007/08/15 21:59:46 rickd PMCC4_3_1B $
- */
-
-/*-----------------------------------------------------------------------------
- * functions.c -
- *
  * Copyright (C) 2003-2005  SBE, Inc.
  *
  *   This program is free software; you can redistribute it and/or modify
@@ -16,47 +10,15 @@
  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *   GNU General Public License for more details.
- *
- * For further information, contact via email: support@sbei.com
- * SBE, Inc.  San Ramon, California  U.S.A.
- *-----------------------------------------------------------------------------
- * RCS info:
- * RCS revision: $Revision: 2.1 $
- * Last changed on $Date: 2007/08/15 21:59:46 $
- * Changed by $Author: rickd $
- *-----------------------------------------------------------------------------
- * $Log: functions.c,v $
- * Revision 2.1  2007/08/15 21:59:46  rickd
- * Watchdog data address casting to *ULONG* for 64bit kernel compatibility.
- *
- * Revision 2.0  2005/09/28 00:10:05  rickd
- * Add inlining of functions. Use OS_ function-name prefix.
- *
- * Revision 1.3  2005/05/10 22:45:12  rickd
- * Add c4_sem_init().  Fix udelay for large delays which use mdelay()
- * and then udelay() for remnants and short delays per Linux documentation
- * suggestions that udelay() for long delays is not accurate.
- * CI prior to major code upgrade to standardize to 256T3 code model.
- *
- * Revision 1.2  2005/04/28 23:54:48  rickd
- * Add RCS tracking header.
- *
- *-----------------------------------------------------------------------------
  */
 
-char        SBEid_pmcc4_functionsc[] =
-"@(#)functions.c - $Revision: 2.1 $      (c) Copyright 2002-2005 SBE, Inc.";
-
-
-#include "pmcc4_sysdep.h"
 #include <linux/slab.h>
-#include <asm/io.h>
-#include <asm/byteorder.h>
-#include <asm/semaphore.h>
 #include <linux/netdevice.h>
 #include <linux/delay.h>
 #include <linux/hdlc.h>
-
+#include <asm/io.h>
+#include <asm/byteorder.h>
+#include "pmcc4_sysdep.h"
 #include "sbecom_inline_linux.h"
 #include "libsbew.h"
 #include "pmcc4.h"
@@ -159,41 +121,22 @@ watchdog_func (unsigned long arg)
             printk (KERN_WARNING "watchdog_func: drvr not available (%x)\n", drvr_state);
         return;
     }
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-    /* Initialize the tq entry only the first time */
-    if (wd->init_tq)
-    {
-        wd->init_tq = 0;
-        wd->tq.routine = wd->func;
-        wd->tq.sync = 0;
-        wd->tq.data = wd->softc;
-    }
-    schedule_task (&wd->tq);
-#else
     schedule_work (&wd->work);
-#endif
     mod_timer (&wd->h, jiffies + wd->ticks);
 }
 
-int         OS_init_watchdog (struct watchdog * wdp, void (*f) (void *), void *c, int usec)
+int OS_init_watchdog(struct watchdog *wdp, void (*f)(struct work_struct *),
+		     void *c, int usec)
 {
-    wdp->func = f;
-    wdp->softc = c;
-    wdp->ticks = (HZ) * (usec / 1000) / 1000;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-    wdp->init_tq = 1;               /* initialize the tq entry only the first
-                                     * time */
-#else
-    INIT_WORK (&wdp->work, f, c);
-#endif
-    init_timer (&wdp->h);
-    {
-        ci_t       *ci = (ci_t *) c;
-
+	ci_t *ci = (ci_t *)c;
+	wdp->func = f;
+	wdp->softc = c;
+	wdp->ticks = (HZ) * (usec / 1000) / 1000;
+	INIT_WORK(&wdp->work, f);
+	init_timer(&wdp->h);
         wdp->h.data = (unsigned long) &ci->wd;
-    }
-    wdp->h.function = watchdog_func;
-    return 0;
+	wdp->h.function = watchdog_func;
+	return 0;
 }
 
 void
@@ -303,35 +246,15 @@ sd_queue_stopped (void *user)
     return (netif_queue_stopped (ndev));
 }
 
-void
-sd_recv_consume (void *token, size_t len, void *user)
+void sd_recv_consume(void *token, size_t len, void *user)
 {
-    struct net_device *ndev = user;
-    struct sk_buff *skb = token;
-
-    skb->dev = ndev;
-    ndev->last_rx = jiffies;
-    skb_put (skb, len);
-    skb->mac.raw = skb->data;
-#if !defined(GENERIC_HDLC_VERSION) || (GENERIC_HDLC_VERSION < 4)
-    V7 (hdlc_netif_rx) (dev_to_hdlc (ndev), skb);
-#else
-#ifdef CONFIG_SBE_HDLC_V20
-    /*
-     * hdlc implementation under 2.4.20 seems to contain an interim <hdlc>
-     * stack
-     */
-    skb->protocol = htons (ETH_P_HDLC);
-#else
-    /*
-     * hdlc implementation under 2.4.21+ seems to contain an augmented <hdlc>
-     * stack whereby linux/hdlc.h contains the following "inline" routine
-     */
+	struct sk_buff *skb = token;
+	struct net_device *dev = user;
 
-    skb->protocol = hdlc_type_trans (skb, ndev);
-#endif
-    netif_rx (skb);
-#endif
+	skb->dev = dev;
+	skb_put(skb, len);
+	skb->protocol = hdlc_type_trans(skb, dev);
+	netif_rx(skb);
 }
 
 
diff --git a/drivers/net/wan/cxt1e1/hwprobe.c b/drivers/net/wan/cxt1e1/hwprobe.c
index 8f5b1d1..8b5d955 100644
--- a/drivers/net/wan/cxt1e1/hwprobe.c
+++ b/drivers/net/wan/cxt1e1/hwprobe.c
@@ -107,7 +107,7 @@ show_two (hdw_info_t * hi, int brdno)
     bp = banner;
     memset (banner, 0, 80);         /* clear print buffer */
 
-    ci = (ci_t *) hi->ndev->priv;
+    ci = netdev_priv(hi->ndev);
     bid = sbeid_get_bdname (ci);
     switch (hi->promfmt)
     {
@@ -243,27 +243,25 @@ cleanup_ioremap (void)
 }
 
 
-void
-cleanup_devs (void)
+void cleanup_devs(void)
 {
-    hdw_info_t *hi;
-    int         i;
+	hdw_info_t *hi;
+	int i;
 
-    for (i = 0, hi = hdw_info; i < MAX_BOARDS; i++, hi++)
-    {
-        if (hi->pci_slot == 0xff || !hi->ndev)
-            break;
-        c4_stopwd (hi->ndev->priv);
+	for (i = 0, hi = hdw_info; i < MAX_BOARDS; i++, hi++) {
+		if (hi->pci_slot == 0xff || !hi->ndev)
+			break;
+		c4_stopwd(netdev_priv(hi->ndev));
 #ifdef CONFIG_PROC_FS
-        sbecom_proc_brd_cleanup (hi->ndev->priv);
+		sbecom_proc_brd_cleanup(netdev_priv(hi->ndev));
 #endif
-        unregister_netdev (hi->ndev);
-        free_irq (hi->pdev[0]->irq, hi->ndev);
+		unregister_netdev(hi->ndev);
+		free_irq (hi->pdev[0]->irq, hi->ndev);
 #ifdef CONFIG_SBE_PMCC4_NCOMM
-        free_irq (hi->pdev[1]->irq, hi->ndev);
+		free_irq(hi->pdev[1]->irq, hi->ndev);
 #endif
-        OS_kfree (hi->ndev);
-    }
+		OS_kfree(hi->ndev);
+	}
 }
 
 
diff --git a/drivers/net/wan/cxt1e1/libsbew.h b/drivers/net/wan/cxt1e1/libsbew.h
index 5c99646..359a36a 100644
--- a/drivers/net/wan/cxt1e1/libsbew.h
+++ b/drivers/net/wan/cxt1e1/libsbew.h
@@ -232,9 +232,7 @@ struct sbecom_port_param
     u_int8_t    portP;          /* more port parameters (clock source - 0x80;
                                  * and LBO - 0xf; */
                                 /* bits 0x70 are reserved for future use ) */
-#ifdef SBE_PMCC4_ENABLE
 	u_int32_t   hypersize;  /* RLD DEBUG - add this in until I learn how to make this entry obsolete */
-#endif
     int         reserved[3-1];    /* reserved for future use */
     int    _res[4];
 };
@@ -271,11 +269,9 @@ struct sbecom_port_param
     struct sbecom_chan_param
     {
         u_int32_t   channum;    /* 0: */
-#ifdef SBE_PMCC4_ENABLE
 	u_int32_t   card;  /* RLD DEBUG - add this in until I learn how to make this entry obsolete */
 	u_int32_t   port;  /* RLD DEBUG - add this in until I learn how to make this entry obsolete */
 	u_int8_t bitmask[32];
-#endif
         u_int32_t   intr_mask;  /* 4: interrupt mask, specify ored
                                  * (SS7_)INTR_* to disable */
         u_int8_t    status;     /* 8: channel transceiver status (TX_ENABLED,
diff --git a/drivers/net/wan/cxt1e1/linux.c b/drivers/net/wan/cxt1e1/linux.c
index a8d6784..de33908 100644
--- a/drivers/net/wan/cxt1e1/linux.c
+++ b/drivers/net/wan/cxt1e1/linux.c
@@ -1,11 +1,4 @@
-/*
- * $Id: linux.c,v 2.11 2008/01/03 20:53:03 rdobbs PMCC4_3_1B $
- */
-
-/*-----------------------------------------------------------------------------
- * linux.c -
- *
- * Copyright (C) 2007-2008  One Stop Systems
+/* Copyright (C) 2007-2008  One Stop Systems
  * Copyright (C) 2003-2006  SBE, Inc.
  *
  *   This program is free software; you can redistribute it and/or modify
@@ -17,86 +10,17 @@
  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *   GNU General Public License for more details.
- *
- * For further information, contact via email: support@onestopsystems.com
- * One Stop Systems  Escondido, California  U.S.A.
- *-----------------------------------------------------------------------------
- * RCS info:
- * RCS revision: $Revision: 2.11 $
- * Last changed on $Date: 2008/01/03 20:53:03 $
- * Changed by $Author: rdobbs $
- *-----------------------------------------------------------------------------
- * $Log: linux.c,v $
- * Revision 2.11  2008/01/03 20:53:03  rdobbs
- * Release string name from SBE to OSSI.
- *
- * Revision 2.10  2007/08/15 22:04:02  rickd
- * Correct casting to *ULONG* w/in do_reset() to support 64bit compatibility.
- *
- * Revision 2.9  2007/05/02 22:50:19  rickd
- * Add GCC compiler checks from kernel's init/main.c
- *
- * Revision 2.8  2006/04/21 00:56:40  rickd
- * workqueue files now prefixed with <sbecom> prefix.
- *
- * Revision 2.7  2005/11/03 00:03:26  rickd
- * Routine c4_add_dev() can be declared __init.
- *
- * Revision 2.6  2005/11/02 23:48:22  rickd
- * Routine create_chan() was erroneoulsy declared __init, which is causing
- * panic under 2.6.13 as code is correctly removed from kernel space due
- * to the declaration (so removed declaration).
- *
- * Revision 2.5  2005/11/01 19:23:48  rickd
- * Add sanity checks against max_port for ioctl functions.
- * Several functions should return status_t for consistant usage of same.
- *
- * Revision 2.4  2005/10/27 18:54:18  rickd
- * Return c4_chan_up() failure code.  Clean out old code.
- *
- * Revision 2.3  2005/10/17 23:55:27  rickd
- * Initial port of NCOMM support patches from original work found
- * in pmc_c4t1e1 as updated by NCOMM.  Ref: CONFIG_SBE_PMCC4_NCOMM.
- * Added cleanup w/in c4_add_dev() if c4_init2() fails.
- *
- * Revision 2.2  2005/10/13 20:36:28  rickd
- * Fix compiler warning causaed by mixing code/declarations of <priv>.
- *
- * Revision 2.1  2005/10/11 18:35:15  rickd
- * Remove option ifname, it's not supported by the system's hdlc driver
- * which explicitly names interface only <hdlc>.
- *
- * Revision 2.0  2005/09/28 00:10:06  rickd
- * Implement 2.6 workqueue for TX/RX restart. Use board's
- * serial number.
- *
- * Revision 1.4  2005/08/12 17:47:03  rickd
- * Major rewrite including MUSYCC bug fix updates.
- *
- * Revision 1.3  2005/05/10 22:40:54  rickd
- * Start switch to common structure variable names and routines.
- * Switch to THIS_MODULE usage in printks to handle alternate driver names.
- *
- * Revision 1.2  2005/04/28 23:54:48  rickd
- * Add RCS tracking header.
- *
- *-----------------------------------------------------------------------------
  */
 
-char        OSSIid_pmcc4_linuxc[] =
-"@(#)linux.c - $Revision: 2.11 $   (c) Copyright 2008 One Stop Systems";
-
-
 #include <linux/types.h>
-#include "pmcc4_sysdep.h"
 #include <linux/netdevice.h>
 #include <linux/hdlc.h>
 #include <linux/if_arp.h>
 #include <linux/init.h>
-#include <asm/uaccess.h>
 #include <linux/rtnetlink.h>
 #include <linux/skbuff.h>
-
+#include <asm/uaccess.h>
+#include "pmcc4_sysdep.h"
 #include "sbecom_inline_linux.h"
 #include "libsbew.h"
 #include "pmcc4.h"
@@ -139,7 +63,6 @@ status_t    c4_chan_work_init (mpi_t *, mch_t *);
 void        musycc_wq_chan_restart (void *);
 status_t __init c4_init (ci_t *, u_char *, u_char *);
 status_t __init c4_init2 (ci_t *);
-ci_t       *__init c4_new (void *);
 int __init  c4hw_attach_all (void);
 void __init hdw_sn_get (hdw_info_t *, int);
 
@@ -160,7 +83,7 @@ status_t    musycc_chan_down (ci_t *, int);
 irqreturn_t musycc_intr_th_handler (void *);
 int         musycc_start_xmit (ci_t *, int, void *);
 
-extern char pmcc4_OSSI_release[];
+static const char pmcc4_OSSI_release[] = "based on PMCC4_3_1B";
 extern ci_t *CI;
 extern struct s_hdw_info hdw_info[];
 
@@ -185,24 +108,23 @@ extern int  unregister_hdlc_device_v7 (hdlc_device *);
 int         error_flag;         /* module load error reporting */
 int         log_level = LOG_ERROR;
 int         log_level_default = LOG_ERROR;
+module_param(log_level, int, 0444);
 
-MODULE_PARM (log_level, "i");
 int         max_mru = MUSYCC_MRU;
 int         max_mru_default = MUSYCC_MRU;
+module_param(max_mru, int, 0444);
 
-MODULE_PARM (max_mru, "i");
 int         max_mtu = MUSYCC_MTU;
 int         max_mtu_default = MUSYCC_MTU;
+module_param(max_mtu, int, 0444);
 
-MODULE_PARM (max_mtu, "i");
 int         max_txdesc_used = MUSYCC_TXDESC_MIN;
 int         max_txdesc_default = MUSYCC_TXDESC_MIN;
+module_param(max_txdesc_used, int, 0444);
 
-MODULE_PARM (max_txdesc_used, "i");
 int         max_rxdesc_used = MUSYCC_RXDESC_MIN;
 int         max_rxdesc_default = MUSYCC_RXDESC_MIN;
-
-MODULE_PARM (max_rxdesc_used, "i");
+module_param(max_rxdesc_used, int, 0444);
 
 /****************************************************************************/
 /****************************************************************************/
@@ -218,10 +140,6 @@ getuserbychan (int channum)
 }
 
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-#define DEV_TO_PRIV(dev) ( * (struct c4_priv **) ((hdlc_device*)(dev)+1))
-#else
-
 char       *
 get_hdlc_name (hdlc_device * hdlc)
 {
@@ -230,7 +148,6 @@ get_hdlc_name (hdlc_device * hdlc)
 
     return dev->name;
 }
-#endif
 
 
 static      status_t
@@ -282,19 +199,11 @@ c4_wk_chan_restart (mch_t * ch)
     queue_work (pi->wq_port, &ch->ch_work);
 }
 
-status_t
-c4_wk_chan_init (mpi_t * pi, mch_t * ch)
+status_t c4_wk_chan_init(mpi_t * pi, mch_t * ch)
 {
-    /*
-     * this will be used to restart a stopped channel
-     */
-
-    /** INIT_WORK (struct work_struct *work,
-     **            void (*function)(void *),
-     **            void *data);
-     **/
-    INIT_WORK (&ch->ch_work, musycc_wq_chan_restart, ch);
-    return 0;                       /* success */
+	/* this will be used to restart a stopped channel */
+	INIT_WORK (&ch->ch_work, musycc_wq_chan_restart);
+	return 0;
 }
 
 status_t
@@ -337,14 +246,11 @@ c4_wq_port_cleanup (mpi_t * pi)
 
 /***************************************************************************/
 
-irqreturn_t
-c4_linux_interrupt (int irq, void *dev_instance, struct pt_regs * regs)
+irqreturn_t c4_linux_interrupt(int irq, void *dev_instance)
 {
-    struct net_device *ndev = dev_instance;
+	struct net_device *ndev = dev_instance;
 
-    if (!ndev->priv)
-        return IRQ_NONE;
-    return musycc_intr_th_handler (ndev->priv);
+	return musycc_intr_th_handler(netdev_priv(ndev));
 }
 
 
@@ -362,12 +268,6 @@ c4_ebus_interrupt (int irq, void *dev_instance, struct pt_regs * regs)
 
 
 static int
-void_init (struct net_device * ndev)
-{
-    return 0;
-}
-
-static int
 void_open (struct net_device * ndev)
 {
     printk ("%s: trying to open master device !\n", ndev->name);
@@ -375,161 +275,50 @@ void_open (struct net_device * ndev)
 }
 
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-#if !defined(GENERIC_HDLC_VERSION) || (GENERIC_HDLC_VERSION < 4)
-
-/** Linux 2.4.18-19 **/
-STATIC int
-chan_open (hdlc_device * hdlc)
-{
-    status_t    ret;
-
-    if ((ret = c4_chan_up (DEV_TO_PRIV (hdlc)->ci, DEV_TO_PRIV (hdlc)->channum)))
-        return -ret;
-    MOD_INC_USE_COUNT;
-    netif_start_queue (hdlc_to_dev (hdlc));
-    return 0;                       /* no error = success */
-}
-
-#else
-
-/** Linux 2.4.20 and higher **/
-STATIC int
-chan_open (struct net_device * ndev)
+STATIC int chan_open(struct net_device *ndev)
 {
-    hdlc_device *hdlc = dev_to_hdlc (ndev);
-    status_t    ret;
-
-    hdlc->proto = IF_PROTO_HDLC;
-    if ((ret = hdlc_open (hdlc)))
-    {
-        printk ("%s: hdlc_open failure, err %d.\n", THIS_MODULE->name, ret);
-        return ret;
-    }
-    if ((ret = c4_chan_up (DEV_TO_PRIV (hdlc)->ci, DEV_TO_PRIV (hdlc)->channum)))
-        return -ret;
-    MOD_INC_USE_COUNT;
-    netif_start_queue (hdlc_to_dev (hdlc));
-    return 0;                       /* no error = success */
-}
-#endif
-
-#else
-
-/** Linux 2.6 **/
-STATIC int
-chan_open (struct net_device * ndev)
-{
-    hdlc_device *hdlc = dev_to_hdlc (ndev);
-    const struct c4_priv *priv = hdlc->priv;
-    int         ret;
-
-    hdlc->proto.id = IF_PROTO_HDLC;
-    if ((ret = hdlc_open (ndev)))
-    {
-        printk ("%s: hdlc_open failure, err %d.\n", THIS_MODULE->name, ret);
-        return ret;
-    }
-    if ((ret = c4_chan_up (priv->ci, priv->channum)))
-        return -ret;
-    try_module_get (THIS_MODULE);
-    netif_start_queue (ndev);
-    return 0;                       /* no error = success */
+	hdlc_device *hdlc = dev_to_hdlc (ndev);
+	const struct c4_priv *priv = hdlc->priv;
+	int ret;
+
+	if ((ret = hdlc_open (ndev))) {
+		printk ("%s: hdlc_open failure, err %d.\n",
+			THIS_MODULE->name, ret);
+		return ret;
+	}
+	if ((ret = c4_chan_up (priv->ci, priv->channum)))
+		return -ret;
+	try_module_get(THIS_MODULE);
+	netif_start_queue(ndev);
+	return 0;
 }
-#endif
 
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-#if !defined(GENERIC_HDLC_VERSION) || (GENERIC_HDLC_VERSION < 4)
-
-/** Linux 2.4.18-19 **/
-STATIC void
-chan_close (hdlc_device * hdlc)
+STATIC int chan_close(struct net_device *ndev)
 {
-    netif_stop_queue (hdlc_to_dev (hdlc));
-    musycc_chan_down ((ci_t *) 0, DEV_TO_PRIV (hdlc)->channum);
-    MOD_DEC_USE_COUNT;
+	hdlc_device *hdlc = dev_to_hdlc (ndev);
+	const struct c4_priv *priv = hdlc->priv;
+
+	netif_stop_queue (ndev);
+	musycc_chan_down ((ci_t *) 0, priv->channum);
+	hdlc_close (ndev);
+	module_put (THIS_MODULE);
+	return 0;
 }
-#else
 
-/** Linux 2.4.20 and higher **/
-STATIC int
-chan_close (struct net_device * ndev)
-{
-    hdlc_device *hdlc = dev_to_hdlc (ndev);
-
-    netif_stop_queue (hdlc_to_dev (hdlc));
-    musycc_chan_down ((ci_t *) 0, DEV_TO_PRIV (hdlc)->channum);
-    hdlc_close (hdlc);
-    MOD_DEC_USE_COUNT;
-    return 0;
-}
-#endif
 
-#else
-
-/** Linux 2.6 **/
-STATIC int
-chan_close (struct net_device * ndev)
+STATIC int chan_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
 {
-    hdlc_device *hdlc = dev_to_hdlc (ndev);
-    const struct c4_priv *priv = hdlc->priv;
-
-    netif_stop_queue (ndev);
-    musycc_chan_down ((ci_t *) 0, priv->channum);
-    hdlc_close (ndev);
-    module_put (THIS_MODULE);
-    return 0;
+    return hdlc_ioctl(dev, ifr, cmd);
 }
-#endif
-
 
-#if !defined(GENERIC_HDLC_VERSION) || (GENERIC_HDLC_VERSION < 4)
 
-/** Linux 2.4.18-19 **/
-STATIC int
-chan_ioctl (hdlc_device * hdlc, struct ifreq * ifr, int cmd)
-{
-    if (cmd == HDLCSCLOCK)
-    {
-        ifr->ifr_ifru.ifru_ivalue = LINE_DEFAULT;
-        return 0;
-    }
-    return -EINVAL;
-}
-#endif
-
-
-#if !defined(GENERIC_HDLC_VERSION) || (GENERIC_HDLC_VERSION < 4)
-STATIC int
-chan_dev_ioctl (struct net_device * hdlc, struct ifreq * ifr, int cmd)
-{
-    if (cmd == HDLCSCLOCK)
-    {
-        ifr->ifr_ifru.ifru_ivalue = LINE_DEFAULT;
-        return 0;
-    }
-    return -EINVAL;
-}
-#else
-STATIC int
-chan_dev_ioctl (struct net_device * dev, struct ifreq * ifr, int cmd)
-{
-    return hdlc_ioctl (dev, ifr, cmd);
-}
-
-
-STATIC int
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-chan_attach_noop (hdlc_device * hdlc, unsigned short foo_1, unsigned short foo_2)
-#else
-chan_attach_noop (struct net_device * ndev, unsigned short foo_1, unsigned short foo_2)
-#endif
+STATIC int chan_attach_noop(struct net_device *ndev, unsigned short foo_1,
+			    unsigned short foo_2)
 {
     return 0;                   /* our driver has nothing to do here, show's
                                  * over, go home */
 }
-#endif
 
 
 STATIC struct net_device_stats *
@@ -539,23 +328,16 @@ chan_get_stats (struct net_device * ndev)
     struct net_device_stats *nstats;
     struct sbecom_chan_stats *stats;
     int         channum;
+    struct c4_priv *priv;
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-    channum = DEV_TO_PRIV (ndev)->channum;
-#else
-    {
-        struct c4_priv *priv;
-
-        priv = (struct c4_priv *) dev_to_hdlc (ndev)->priv;
-        channum = priv->channum;
-    }
-#endif
+    priv = (struct c4_priv *)dev_to_hdlc(ndev)->priv;
+    channum = priv->channum;
 
     ch = c4_find_chan (channum);
     if (ch == NULL)
         return NULL;
 
-    nstats = &dev_to_hdlc (ndev)->stats;
+    nstats = &ndev->stats;
     stats = &ch->s;
 
     memset (nstats, 0, sizeof (struct net_device_stats));
@@ -589,46 +371,34 @@ chan_get_stats (struct net_device * ndev)
 }
 
 
-static ci_t *
-get_ci_by_dev (struct net_device * ndev)
+static ci_t* get_ci_by_dev(struct net_device *ndev)
 {
-    return (ci_t *) ndev->priv;
+	return (ci_t *)netdev_priv(ndev);
 }
 
 
-#if !defined(GENERIC_HDLC_VERSION) || (GENERIC_HDLC_VERSION < 4)
-STATIC int
-c4_linux_xmit (hdlc_device * hdlc, struct sk_buff * skb)
+STATIC int c4_linux_xmit(struct sk_buff *skb, struct net_device *ndev)
 {
-    int         rval;
+	const struct c4_priv *priv;
+	int rval;
+	hdlc_device *hdlc = dev_to_hdlc(ndev);
 
-    rval = musycc_start_xmit (DEV_TO_PRIV (hdlc)->ci, DEV_TO_PRIV (hdlc)->channum, skb);
-    return -rval;
+	priv = hdlc->priv;
+	rval = musycc_start_xmit (priv->ci, priv->channum, skb);
+	return -rval;
 }
-#else                           /* new */
-STATIC int
-c4_linux_xmit (struct sk_buff * skb, struct net_device * ndev)
-{
-    const struct c4_priv *priv;
-    int         rval;
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-    priv = DEV_TO_PRIV (ndev);
-#else
-    hdlc_device *hdlc = dev_to_hdlc (ndev);
-
-    priv = hdlc->priv;
-#endif
 
-    rval = musycc_start_xmit (priv->ci, priv->channum, skb);
-    return -rval;
-}
-#endif                          /* GENERIC_HDLC_VERSION */
 
+static const struct net_device_ops chan_ops = {
+	.ndo_open       = chan_open,
+	.ndo_stop       = chan_close,
+	.ndo_start_xmit = c4_linux_xmit,
+	.ndo_do_ioctl   = chan_dev_ioctl,
+	.ndo_get_stats  = chan_get_stats,
+};
 
-STATIC struct net_device *
-create_chan (struct net_device * ndev, ci_t * ci,
-             struct sbecom_chan_param * cp)
+STATIC struct net_device* create_chan(struct net_device *ndev, ci_t *ci,
+				      struct sbecom_chan_param *cp)
 {
     hdlc_device *hdlc;
     struct net_device *dev;
@@ -638,27 +408,6 @@ create_chan (struct net_device * ndev, ci_t * ci,
     if (c4_find_chan (cp->channum))
         return 0;                   /* channel already exists */
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-    hdlc = (hdlc_device *) OS_kmalloc (sizeof (hdlc_device) + sizeof (void *));
-    if (!hdlc)
-    {
-        printk (KERN_WARNING "%s: no memory for hdlc_device !\n", ci->devname);
-        return 0;
-    }
-    dev = hdlc_to_dev (hdlc);
-
-    /* allocate and fill in private data structure */
-    DEV_TO_PRIV (dev) = kmalloc (sizeof (struct c4_priv), GFP_KERNEL);
-    if (!DEV_TO_PRIV (dev))
-    {
-        printk (KERN_WARNING "%s: no memory for c4_priv !\n", ci->devname);
-        OS_kfree (hdlc);
-        return 0;
-    }
-    DEV_TO_PRIV (dev)->ci = ci;
-    DEV_TO_PRIV (dev)->channum = cp->channum;
-
-#else
     {
         struct c4_priv *priv;
 
@@ -681,13 +430,10 @@ create_chan (struct net_device * ndev, ci_t * ci,
     }
 
     hdlc = dev_to_hdlc (dev);
-#endif
 
     dev->base_addr = 0;             /* not I/O mapped */
     dev->irq = ndev->irq;
-    dev->init = void_init;
     dev->type = ARPHRD_RAWHDLC;
-    dev->do_ioctl = chan_dev_ioctl;
     *dev->name = 0;                 /* default ifconfig name = "hdlc" */
 
     hi = (hdw_info_t *) ci->hdw_info;
@@ -711,15 +457,7 @@ create_chan (struct net_device * ndev, ci_t * ci,
     }
 
     hdlc->xmit = c4_linux_xmit;
-
-#if !defined(GENERIC_HDLC_VERSION) || (GENERIC_HDLC_VERSION < 4)
-    hdlc->open = chan_open;
-    hdlc->close = chan_close;
-    hdlc->ioctl = chan_ioctl;
-#else                               /* new */
-    dev->hard_start_xmit = c4_linux_xmit;
-    dev->open = chan_open;
-    dev->stop = chan_close;
+    dev->netdev_ops = &chan_ops;
     /*
      * The native hdlc stack calls this 'attach' routine during
      * hdlc_raw_ioctl(), passing parameters for line encoding and parity.
@@ -730,16 +468,10 @@ create_chan (struct net_device * ndev, ci_t * ci,
      */
 
     hdlc->attach = chan_attach_noop;
-#endif                              /* GENERIC_HDLC_VERSION */
 
     rtnl_unlock ();                 /* needed due to Ioctl calling sequence */
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-    ret = V7 (register_hdlc_device) (hdlc);
-#else
     ret = register_hdlc_device (dev);
-#endif
     /* NOTE: <stats> setting must occur AFTER registration in order to "take" */
-    dev->get_stats = chan_get_stats;
     dev->tx_queue_len = MAX_DEFAULT_IFQLEN;
 
     rtnl_lock ();                   /* needed due to Ioctl calling sequence */
@@ -748,12 +480,7 @@ create_chan (struct net_device * ndev, ci_t * ci,
         if (log_level >= LOG_WARN)
             printk ("%s: create_chan[%d] registration error = %d.\n",
                     ci->devname, cp->channum, ret);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-        OS_kfree (DEV_TO_PRIV (dev));   /* cleanup */
-        OS_kfree (hdlc);            /* cleanup */
-#else
         free_netdev (dev);          /* cleanup */
-#endif
         return 0;                   /* failed to register */
     }
     return dev;
@@ -1036,26 +763,26 @@ do_deluser (struct net_device * ndev, int lockit)
     return 0;
 }
 
-int
-do_del_chan (struct net_device * musycc_dev, void *data)
+int do_del_chan(struct net_device *musycc_dev, void *data)
 {
     struct sbecom_chan_param cp;
-    char        buf[sizeof (CHANNAME) + 3];
+    char buf[sizeof(CHANNAME) + 3];
     struct net_device *dev;
-    int         ret;
-
-    if (copy_from_user (&cp, data,
-                        sizeof (struct sbecom_chan_param)))
-        return -EFAULT;
-    sprintf (buf, CHANNAME "%d", cp.channum);
-    if (!(dev = dev_get_by_name (buf)))
-        return -ENOENT;
-    dev_put (dev);
-    ret = do_deluser (dev, 1);
+    int ret;
+
+    if (copy_from_user(&cp, data,
+		       sizeof(struct sbecom_chan_param)))
+	    return -EFAULT;
+    sprintf(buf, CHANNAME "%d", cp.channum);
+    if (!(dev = dev_get_by_name(&init_net, buf)))
+	    return -ENOENT;
+    dev_put(dev);
+    ret = do_deluser(dev, 1);
     if (ret)
-        return ret;
-    return c4_del_chan (cp.channum);
+	    return ret;
+    return c4_del_chan(cp.channum);
 }
+
 int         c4_reset_board (void *);
 
 int
@@ -1070,20 +797,16 @@ do_reset (struct net_device * musycc_dev, void *data)
         char        buf[sizeof (CHANNAME) + 3];
 
         sprintf (buf, CHANNAME "%d", i);
-        if (!(ndev = dev_get_by_name (buf)))
+        if (!(ndev = dev_get_by_name (&init_net, buf)))
             continue;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-        priv = DEV_TO_PRIV (ndev);
-#else
         priv = dev_to_hdlc (ndev)->priv;
-#endif
 
 #if 0
         if ((unsigned long) (DEV_TO_PRIV (ndev)->ci) ==
             (unsigned long) (musycc_dev->priv))
 #else
         if ((unsigned long) (priv->ci) ==
-            (unsigned long) (musycc_dev->priv))
+            (unsigned long) (netdev_priv(musycc_dev)))
 #endif
         {
             ndev->flags &= ~IFF_UP;
@@ -1227,107 +950,108 @@ c4_ioctl (struct net_device * ndev, struct ifreq * ifr, int cmd)
 }
 
 
-struct net_device *__init
-c4_add_dev (hdw_info_t * hi, int brdno, unsigned long f0, unsigned long f1,
-            int irq0, int irq1)
-{
-    struct net_device *ndev;
-    ci_t       *ci;
+static const struct net_device_ops c4_ops = {
+	.ndo_open       = void_open,
+	.ndo_start_xmit = c4_linux_xmit,
+	.ndo_do_ioctl   = c4_ioctl,
+};
 
-    ndev = (struct net_device *) OS_kmalloc (sizeof (struct net_device));
-    if (!ndev)
-    {
-        printk (KERN_WARNING "%s: no memory for struct net_device !\n", hi->devname);
-        error_flag = ENOMEM;
-        return 0;
-    }
-    ndev->base_addr = 0;            /* not I/O mapped */
-    ndev->irq = irq0;
-    ndev->init = void_init;
-    ndev->type = ARPHRD_VOID;
-    ndev->open = void_open;
-    ndev->do_ioctl = c4_ioctl;
-    dev_alloc_name (ndev, SBE_IFACETMPL);
-
-    ndev->priv = c4_new ((void *) hi);
-    if (!ndev->priv)
-    {
-        printk (KERN_WARNING "%s: no memory for struct card_info !\n", hi->devname);
-        OS_kfree (ndev);
-        error_flag = ENOMEM;
-        return 0;
-    }
-    ci = (ci_t *) ndev->priv;
-    strcpy (ci->devname, hi->devname);
-    ci->release = &pmcc4_OSSI_release[0];
 
-    /* tasklet */
+static void c4_setup(struct net_device *dev)
+{
+	dev->type = ARPHRD_VOID;
+	dev->netdev_ops = &c4_ops;
+}
+
+struct net_device *__init c4_add_dev(hdw_info_t *hi, int brdno,
+				     unsigned long f0, unsigned long f1,
+				     int irq0, int irq1)
+{
+	struct net_device *ndev;
+	ci_t *ci;
+
+	ndev = alloc_netdev(sizeof(ci_t), SBE_IFACETMPL, c4_setup);
+	if (!ndev) {
+		printk(KERN_WARNING "%s: no memory for struct net_device !\n",
+		       hi->devname);
+		error_flag = ENOMEM;
+		return 0;
+	}
+	ci = netdev_priv(ndev);
+	ndev->irq = irq0;
+
+	ci->hdw_info = hi;
+	ci->state = C_INIT;         /* mark as hardware not available */
+	ci->next = c4_list;
+	c4_list = ci;
+	ci->brdno = ci->next ? ci->next->brdno + 1 : 0;
+
+	if (CI == 0)
+		CI = ci;                    /* DEBUG, only board 0 usage */
+
+	strcpy (ci->devname, hi->devname);
+	ci->release = &pmcc4_OSSI_release[0];
+
+	/* tasklet */
 #if defined(SBE_ISR_TASKLET)
-    tasklet_init (&ci->ci_musycc_isr_tasklet,
-                  (void (*) (unsigned long)) musycc_intr_bh_tasklet,
-                  (unsigned long) ci);
+	tasklet_init (&ci->ci_musycc_isr_tasklet,
+		      (void (*) (unsigned long)) musycc_intr_bh_tasklet,
+		      (unsigned long) ci);
 
-    if (atomic_read (&ci->ci_musycc_isr_tasklet.count) == 0)
-        tasklet_disable_nosync (&ci->ci_musycc_isr_tasklet);
+	if (atomic_read (&ci->ci_musycc_isr_tasklet.count) == 0)
+		tasklet_disable_nosync (&ci->ci_musycc_isr_tasklet);
 #elif defined(SBE_ISR_IMMEDIATE)
-    ci->ci_musycc_isr_tq.routine = (void *) (unsigned long) musycc_intr_bh_tasklet;
-    ci->ci_musycc_isr_tq.data = ci;
+	ci->ci_musycc_isr_tq.routine = (void *) (unsigned long) musycc_intr_bh_tasklet;
+	ci->ci_musycc_isr_tq.data = ci;
 #endif
 
 
-    if (register_netdev (ndev) ||
-        (c4_init (ci, (u_char *) f0, (u_char *) f1) != SBE_DRVR_SUCCESS))
-    {
-        OS_kfree (ndev->priv);
-        OS_kfree (ndev);
-        error_flag = ENODEV;
-        return 0;
-    }
-    /*************************************************************
-     *  int request_irq(unsigned int irq,
-     *                  void (*handler)(int, void *, struct pt_regs *),
-     *                  unsigned long flags, const char *dev_name, void *dev_id);
-     *  wherein:
-     *  irq      -> The interrupt number that is being requested.
-     *  handler  -> Pointer to handling function being installed.
-     *  flags    -> A bit mask of options related to interrupt management.
-     *  dev_name -> String used in /proc/interrupts to show owner of interrupt.
-     *  dev_id   -> Pointer (for shared interrupt lines) to point to its own
-     *              private data area (to identify which device is interrupting).
-     *
-     *  extern void free_irq(unsigned int irq, void *dev_id);
-     **************************************************************/
-
-    if (request_irq (irq0, &c4_linux_interrupt,
-#if defined(SBE_ISR_TASKLET)
-                     SA_INTERRUPT | SA_SHIRQ,
-#elif defined(SBE_ISR_IMMEDIATE)
-                     SA_INTERRUPT | SA_SHIRQ,
+	if (register_netdev (ndev) ||
+	    (c4_init (ci, (u_char *) f0, (u_char *) f1) != SBE_DRVR_SUCCESS)) {
+		free_netdev(ndev);
+		error_flag = ENODEV;
+		return 0;
+	}
+	/*************************************************************
+	 *  int request_irq(unsigned int irq,
+	 *                  void (*handler)(int, void *, struct pt_regs *),
+	 *                  unsigned long flags, const char *dev_name, void *dev_id);
+	 *  wherein:
+	 *  irq      -> The interrupt number that is being requested.
+	 *  handler  -> Pointer to handling function being installed.
+	 *  flags    -> A bit mask of options related to interrupt management.
+	 *  dev_name -> String used in /proc/interrupts to show owner of interrupt.
+	 *  dev_id   -> Pointer (for shared interrupt lines) to point to its own
+	 *              private data area (to identify which device is interrupting).
+	 *
+	 *  extern void free_irq(unsigned int irq, void *dev_id);
+	 **************************************************************/
+
+	if (request_irq(irq0, &c4_linux_interrupt,
+#if defined(SBE_ISR_TASKLET) || defined(SBE_ISR_IMMEDIATE)
+			 IRQF_DISABLED | IRQF_SHARED,
 #elif defined(SBE_ISR_INLINE)
-                     SA_SHIRQ,
+			 IRQF_SHARED,
 #endif
-                     ndev->name, ndev))
-    {
-        printk (KERN_WARNING "%s: MUSYCC could not get irq: %d\n",
-                ndev->name, irq0);
-        unregister_netdev (ndev);
-        OS_kfree (ndev->priv);
-        OS_kfree (ndev);
-        error_flag = EIO;
-        return 0;
-    }
+			 ndev->name, ndev)) {
+		printk(KERN_WARNING "%s: MUSYCC could not get irq: %d\n",
+			ndev->name, irq0);
+		unregister_netdev(ndev);
+		free_netdev(ndev);
+		error_flag = EIO;
+		return 0;
+	}
 #ifdef CONFIG_SBE_PMCC4_NCOMM
-    if (request_irq (irq1, &c4_ebus_interrupt, SA_SHIRQ, ndev->name, ndev))
-    {
-        printk (KERN_WARNING "%s: EBUS could not get irq: %d\n",
-                hi->devname, irq1);
-        unregister_netdev (ndev);
-        free_irq (irq0, ndev);
-        OS_kfree (ndev->priv);
-        OS_kfree (ndev);
-        error_flag = EIO;
-        return 0;
-    }
+	if (request_irq(irq1, &c4_ebus_interrupt, IRQF_SHARED, ndev->name, ndev))
+	{
+		printk (KERN_WARNING "%s: EBUS could not get irq: %d\n",
+			hi->devname, irq1);
+		unregister_netdev(ndev);
+		free_irq(irq0, ndev);
+		free_netdev(ndev);
+		error_flag = EIO;
+		return 0;
+	}
 #endif
 
     /* setup board identification information */
@@ -1382,8 +1106,7 @@ c4_add_dev (hdw_info_t * hi, int brdno, unsigned long f0, unsigned long f1,
         unregister_netdev (ndev);
         free_irq (irq1, ndev);
         free_irq (irq0, ndev);
-        OS_kfree (ndev->priv);
-        OS_kfree (ndev);
+	free_netdev(ndev);
         return 0;                   /* failure, error_flag is set */
     }
     return ndev;
@@ -1443,7 +1166,7 @@ cleanup_hdlc (void)
     {
         if (hi->ndev)               /* a board has been attached */
         {
-            ci = (ci_t *) hi->ndev->priv;
+	    ci = (ci_t *) netdev_priv(hi->ndev);
             for (j = 0; j < ci->max_port; j++)
                 for (k = 0; k < MUSYCC_NCHANS; k++)
                     if ((ndev = ci->port[j].chan[k]->user))
diff --git a/drivers/net/wan/cxt1e1/musycc.c b/drivers/net/wan/cxt1e1/musycc.c
index 8fc42dd..d72f610 100644
--- a/drivers/net/wan/cxt1e1/musycc.c
+++ b/drivers/net/wan/cxt1e1/musycc.c
@@ -1,14 +1,7 @@
-/*
- * $Id: musycc.c,v 2.1 2007/08/15 23:32:17 rickd PMCC4_3_1B $
- */
-
 unsigned int max_intcnt = 0;
 unsigned int max_bh = 0;
 
-/*-----------------------------------------------------------------------------
- * musycc.c -
- *
- * Copyright (C) 2007  One Stop Systems, Inc.
+/* Copyright (C) 2007  One Stop Systems, Inc.
  * Copyright (C) 2003-2006  SBE, Inc.
  *
  *   This program is free software; you can redistribute it and/or modify
@@ -20,63 +13,12 @@ unsigned int max_bh = 0;
  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *   GNU General Public License for more details.
- *
- * For further information, contact via email: support@onestopsystems.com
- * One Stop Systems, Inc.  Escondido, California  U.S.A.
- *-----------------------------------------------------------------------------
- * RCS info:
- * RCS revision: $Revision: 2.1 $
- * Last changed on $Date: 2007/08/15 23:32:17 $
- * Changed by $Author: rickd $
- *-----------------------------------------------------------------------------
- * $Log: musycc.c,v $
- * Revision 2.1  2007/08/15 23:32:17  rickd
- * Use 'if 0' instead of GNU comment delimeter to avoid line wrap induced compiler errors.
- *
- * Revision 2.0  2007/08/15 22:13:20  rickd
- * Update to printf pointer %p usage and correct some UINT to ULONG for
- * 64bit comptibility.
- *
- * Revision 1.7  2006/04/21 00:56:40  rickd
- * workqueue files now prefixed with <sbecom> prefix.
- *
- * Revision 1.6  2005/10/27 18:54:19  rickd
- * Clean out old code.  Default to HDLC_FCS16, not TRANS.
- *
- * Revision 1.5  2005/10/17 23:55:28  rickd
- * Initial port of NCOMM support patches from original work found
- * in pmc_c4t1e1 as updated by NCOMM.  Ref: CONFIG_SBE_PMCC4_NCOMM.
- *
- * Revision 1.4  2005/10/13 20:35:25  rickd
- * Cleanup warning for unused <flags> variable.
- *
- * Revision 1.3  2005/10/13 19:19:22  rickd
- * Disable redundant driver removal cleanup code.
- *
- * Revision 1.2  2005/10/11 18:36:16  rickd
- * Clean up warning messages caused by de-implemented some <flags> associated
- * with spin_lock() removals.
- *
- * Revision 1.1  2005/10/05 00:45:28  rickd
- * Re-enable xmit on flow-controlled and full channel to fix restart hang.
- * Add some temp spin-lock debug code (rld_spin_owner).
- *
- * Revision 1.0  2005/09/28 00:10:06  rickd
- * Initial release for C4T1E1 support. Lots of transparent
- * mode updates.
- *
- *-----------------------------------------------------------------------------
  */
-
-char        SBEid_pmcc4_musyccc[] =
-"@(#)musycc.c - $Revision: 2.1 $      (c) Copyright 2004-2006 SBE, Inc.";
-
-
 #include <linux/types.h>
-#include "pmcc4_sysdep.h"
 #include <linux/kernel.h>
 #include <linux/errno.h>
 #include <linux/init.h>
+#include "pmcc4_sysdep.h"
 #include "sbecom_inline_linux.h"
 #include "libsbew.h"
 #include "pmcc4_private.h"
@@ -706,9 +648,7 @@ rewrite:
 }
 
 
-#ifdef  SBE_PMCC4_ENABLE
-void
-musycc_update_timeslots (mpi_t * pi)
+void musycc_update_timeslots(mpi_t *pi)
 {
     int         i, ch;
     char        e1mode = IS_FRAME_ANY_E1 (pi->p.port_mode);
@@ -773,43 +713,6 @@ musycc_update_timeslots (mpi_t * pi)
     musycc_serv_req (pi, SR_SUBCHANNEL_MAP | SR_RX_DIRECTION);
     musycc_serv_req (pi, SR_SUBCHANNEL_MAP | SR_TX_DIRECTION);
 }
-#endif
-
-
-#ifdef SBE_WAN256T3_ENABLE
-void
-musycc_update_timeslots (mpi_t * pi)
-{
-    mch_t      *ch;
-
-    u_int8_t    ts, hmask, tsen;
-    int         gchan;
-    int         i;
-
-#ifdef SBE_PMCC4_ENABLE
-    hmask = (0x1f << pi->up->p.hypersize) & 0x1f;
-#endif
-#ifdef SBE_WAN256T3_ENABLE
-    hmask = (0x1f << hyperdummy) & 0x1f;
-#endif
-    for (i = 0; i < 128; i++)
-    {
-        gchan = ((pi->portnum * MUSYCC_NCHANS) + (i & hmask)) % MUSYCC_NCHANS;
-        ch = pi->chan[gchan];
-        if (ch->p.mode_56k)
-            tsen = MODE_56KBPS;
-        else
-            tsen = MODE_64KBPS;     /* also the default */
-        ts = ((pi->portnum % 4) == (i / 32)) ? (tsen << 5) | (i & hmask) : 0;
-        pi->regram->rtsm[i] = ts;
-        pi->regram->ttsm[i] = ts;
-    }
-    FLUSH_MEM_WRITE ();
-    musycc_serv_req (pi, SR_TIMESLOT_MAP | SR_RX_DIRECTION);
-    musycc_serv_req (pi, SR_TIMESLOT_MAP | SR_TX_DIRECTION);
-}
-#endif
-
 
  /*
   * This routine converts a generic library channel configuration parameter
@@ -841,41 +744,6 @@ musycc_chan_proto (int proto)
     return reg;
 }
 
-#ifdef SBE_WAN256T3_ENABLE
-STATIC void __init
-musycc_init_port (mpi_t * pi)
-{
-    pci_write_32 ((u_int32_t *) &pi->reg->gbp, OS_vtophys (pi->regram));
-
-    pi->regram->grcd =
-        __constant_cpu_to_le32 (MUSYCC_GRCD_RX_ENABLE |
-                                MUSYCC_GRCD_TX_ENABLE |
-                                MUSYCC_GRCD_SF_ALIGN |
-                                MUSYCC_GRCD_SUBCHAN_DISABLE |
-                                MUSYCC_GRCD_OOFMP_DISABLE |
-                                MUSYCC_GRCD_COFAIRQ_DISABLE |
-                                MUSYCC_GRCD_MC_ENABLE |
-                       (MUSYCC_GRCD_POLLTH_32 << MUSYCC_GRCD_POLLTH_SHIFT));
-
-    pi->regram->pcd =
-        __constant_cpu_to_le32 (MUSYCC_PCD_E1X4_MODE |
-                                MUSYCC_PCD_TXDATA_RISING |
-                                MUSYCC_PCD_TX_DRIVEN);
-
-    /* Message length descriptor */
-    pi->regram->mld = __constant_cpu_to_le32 (max_mru | (max_mru << 16));
-    FLUSH_MEM_WRITE ();
-
-    musycc_serv_req (pi, SR_GROUP_INIT | SR_RX_DIRECTION);
-    musycc_serv_req (pi, SR_GROUP_INIT | SR_TX_DIRECTION);
-
-    musycc_init_mdt (pi);
-
-    musycc_update_timeslots (pi);
-}
-#endif
-
-
 status_t    __init
 musycc_init (ci_t * ci)
 {
@@ -969,10 +837,6 @@ musycc_init (ci_t * ci)
                 THIS_MODULE->name, max_mtu, 0xffe);
         max_mtu = 0xffe;
     }
-#ifdef SBE_WAN256T3_ENABLE
-    for (i = 0; i < MUSYCC_NPORTS; i++)
-        musycc_init_port (&ci->port[i]);
-#endif
 
     return SBE_DRVR_SUCCESS;        /* no error */
 }
@@ -1072,24 +936,6 @@ musycc_bh_tx_eom (mpi_t * pi, int gchan)
             atomic_sub (OS_mem_token_tlen (md->mem_token), &ch->tx_pending);
             /* upcount card */
             atomic_sub (OS_mem_token_tlen (md->mem_token), &pi->up->tx_pending);
-#ifdef SBE_WAN256T3_ENABLE
-            if (!atomic_read (&pi->up->tx_pending))
-                wan256t3_led (pi->up, LED_TX, 0);
-#endif
-
-#ifdef CONFIG_SBE_WAN256T3_NCOMM
-            /* callback that our packet was sent */
-            {
-                int         hdlcnum = (pi->portnum * 32 + gchan);
-
-                if (hdlcnum >= 228)
-                {
-                    if (nciProcess_TX_complete)
-                        (*nciProcess_TX_complete) (hdlcnum,
-                                                   getuserbychan (gchan));
-                }
-            }
-#endif                              /*** CONFIG_SBE_WAN256T3_NCOMM ***/
 
             OS_mem_token_free_irq (md->mem_token);
             md->mem_token = 0;
@@ -1197,21 +1043,6 @@ musycc_bh_rx_eom (mpi_t * pi, int gchan)
         error = (status >> 16) & 0xf;
         if (error == 0)
         {
-#ifdef CONFIG_SBE_WAN256T3_NCOMM
-            int         hdlcnum = (pi->portnum * 32 + gchan);
-
-            /*
-             * if the packet number belongs to NCOMM, then send it to the TMS
-             * driver
-             */
-            if (hdlcnum >= 228)
-            {
-                if (nciProcess_RX_packet)
-                    (*nciProcess_RX_packet) (hdlcnum, status & 0x3fff, m, ch->user);
-            } else
-#endif                              /*** CONFIG_SBE_WAN256T3_NCOMM ***/
-
-            {
                 if ((m2 = OS_mem_token_alloc (max_mru)))
                 {
                     /* substitute the mbuf+cluster */
@@ -1226,7 +1057,6 @@ musycc_bh_rx_eom (mpi_t * pi, int gchan)
                 {
                     ch->s.rx_dropped++;
                 }
-            }
         } else if (error == ERR_FCS)
         {
             ch->s.rx_crc_errors++;
@@ -1750,9 +1580,7 @@ musycc_new_chan (ci_t * ci, int channum, void *user)
 #endif
 
 
-#ifdef SBE_PMCC4_ENABLE
-status_t
-musycc_chan_down (ci_t * dummy, int channum)
+status_t musycc_chan_down(ci_t *dummy, int channum)
 {
     mpi_t      *pi;
     mch_t      *ch;
@@ -1803,7 +1631,6 @@ musycc_chan_down (ci_t * dummy, int channum)
     pi->openchans--;
     return 0;
 }
-#endif
 
 
 int
@@ -2035,9 +1862,6 @@ musycc_start_xmit (ci_t * ci, int channum, void *mem_token)
         musycc_chan_restart (ch);
 #endif
     }
-#ifdef SBE_WAN256T3_ENABLE
-    wan256t3_led (ci, LED_TX, LEDV_G);
-#endif
     return 0;
 }
 
@@ -2125,56 +1949,3 @@ musycc_get_chan_stats (ci_t * ci, int channum, struct sbecom_chan_stats * p)
     p->tx_pending = atomic_read (&ch->tx_pending);
     return 0;
 }
-
-
-
-#ifdef SBE_WAN256T3_ENABLE
-int
-musycc_chan_down (ci_t * ci, int channum)
-{
-    mch_t      *ch;
-    mpi_t      *pi;
-    int         i, gchan;
-
-    if (!(ch = sd_find_chan (ci, channum)))
-        return EINVAL;
-    pi = ch->up;
-    gchan = ch->gchan;
-
-    /* Deactivate the channel */
-    musycc_serv_req (pi, SR_CHANNEL_DEACTIVATE | SR_RX_DIRECTION | gchan);
-    ch->ch_start_rx = 0;
-    musycc_serv_req (pi, SR_CHANNEL_DEACTIVATE | SR_TX_DIRECTION | gchan);
-    ch->ch_start_tx = 0;
-
-    if (ch->state == DOWN)
-        return 0;
-    ch->state = DOWN;
-
-    pi->regram->thp[gchan] = 0;
-    pi->regram->tmp[gchan] = 0;
-    pi->regram->rhp[gchan] = 0;
-    pi->regram->rmp[gchan] = 0;
-    FLUSH_MEM_WRITE ();
-    for (i = 0; i < ch->txd_num; i++)
-    {
-        if (ch->mdt[i].mem_token != 0)
-            OS_mem_token_free (ch->mdt[i].mem_token);
-    }
-
-    for (i = 0; i < ch->rxd_num; i++)
-    {
-        if (ch->mdr[i].mem_token != 0)
-            OS_mem_token_free (ch->mdr[i].mem_token);
-    }
-
-    OS_kfree (ch->mdt);
-    ch->mdt = 0;
-    OS_kfree (ch->mdr);
-    ch->mdr = 0;
-
-    return 0;
-}
-#endif
-
-/*** End-of-File ***/
diff --git a/drivers/net/wan/cxt1e1/musycc.h b/drivers/net/wan/cxt1e1/musycc.h
index d2c91ef..c4c074c 100644
--- a/drivers/net/wan/cxt1e1/musycc.h
+++ b/drivers/net/wan/cxt1e1/musycc.h
@@ -1,12 +1,7 @@
-/*
- * $Id: musycc.h,v 1.3 2005/09/28 00:10:08 rickd PMCC4_3_1B $
- */
-
 #ifndef _INC_MUSYCC_H_
 #define _INC_MUSYCC_H_
 
-/*-----------------------------------------------------------------------------
- * musycc.h - Multichannel Synchronous Communications Controller
+/* musycc.h - Multichannel Synchronous Communications Controller
  *            CN8778/8474A/8472A/8471A
  *
  * Copyright (C) 2002-2005  SBE, Inc.
@@ -20,40 +15,13 @@
  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *   GNU General Public License for more details.
- *
- * For further information, contact via email: support@sbei.com
- * SBE, Inc.  San Ramon, California  U.S.A.
- *-----------------------------------------------------------------------------
- * RCS info:
- * RCS revision: $Revision: 1.3 $
- * Last changed on $Date: 2005/09/28 00:10:08 $
- * Changed by $Author: rickd $
- *-----------------------------------------------------------------------------
- * $Log: musycc.h,v $
- * Revision 1.3  2005/09/28 00:10:08  rickd
- * Add GNU license info. Add PMCC4 PCI/DevIDs.  Implement new
- * musycc reg&bits namings. Use PORTMAP_0 GCD grouping.
- *
- * Revision 1.2  2005/04/28 23:43:04  rickd
- * Add RCS tracking heading.
- *
- *-----------------------------------------------------------------------------
  */
 
-#if defined (__FreeBSD__) || defined (__NetBSD__)
-#include <sys/types.h>
-#else
 #include <linux/types.h>
-#endif
 
 #define VINT8   volatile u_int8_t
 #define VINT32  volatile u_int32_t
 
-#ifdef __cplusplus
-extern      "C"
-{
-#endif
-
 #include "pmcc4_defs.h"
 
 
@@ -149,19 +117,10 @@ extern      "C"
                                          * etc... */
 
 /* and board specific assignments... */
-#ifdef SBE_WAN256T3_ENABLE
-#define BLAPSE_VAL      0
-#define ALAPSE_VAL      0
-#define ELAPSE_VAL      7
-#define PORTMAP_VAL     MUSYCC_GCD_PORTMAP_2
-#endif
-
-#ifdef SBE_PMCC4_ENABLE
 #define BLAPSE_VAL      7
 #define ALAPSE_VAL      3
 #define ELAPSE_VAL      7
 #define PORTMAP_VAL     MUSYCC_GCD_PORTMAP_0
-#endif
 
 #define GCD_MAGIC   (((BLAPSE_VAL)<<(MUSYCC_GCD_BLAPSE)) | \
                      ((ALAPSE_VAL)<<(MUSYCC_GCD_ALAPSE)) | \
@@ -448,13 +407,7 @@ extern      "C"
 /*  This must be defined on an entire channel group (Port) basis */
 #define SUERM_THRESHOLD     0x1f
 
-#ifdef __cplusplus
-}
-#endif
-
 #undef VINT32
 #undef VINT8
 
-#endif                          /*** _INC_MUSYCC_H_ ***/
-
-/*** End-of-File ***/
+#endif
diff --git a/drivers/net/wan/cxt1e1/pmcc4_defs.h b/drivers/net/wan/cxt1e1/pmcc4_defs.h
index 186347b..2c6e95c 100644
--- a/drivers/net/wan/cxt1e1/pmcc4_defs.h
+++ b/drivers/net/wan/cxt1e1/pmcc4_defs.h
@@ -1,14 +1,7 @@
-/*
- * $Id: pmcc4_defs.h,v 1.0 2005/09/28 00:10:09 rickd PMCC4_3_1B $
- */
-
 #ifndef _INC_PMCC4_DEFS_H_
 #define _INC_PMCC4_DEFS_H_
 
-/*-----------------------------------------------------------------------------
- * c4_defs.h -
- *
- *   Implementation elements of the wanPMC-C4T1E1 device driver
+/*   Implementation elements of the wanPMC-C4T1E1 device driver
  *
  * Copyright (C) 2005  SBE, Inc.
  *
@@ -21,32 +14,13 @@
  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *   GNU General Public License for more details.
- *
- * For further information, contact via email: support@sbei.com
- * SBE, Inc.  San Ramon, California  U.S.A.
- *-----------------------------------------------------------------------------
- * RCS info:
- * RCS revision: $Revision: 1.0 $
- * Last changed on $Date: 2005/09/28 00:10:09 $
- * Changed by $Author: rickd $
- *-----------------------------------------------------------------------------
- * $Log: pmcc4_defs.h,v $
- * Revision 1.0  2005/09/28 00:10:09  rickd
- * Initial revision
- *
- *-----------------------------------------------------------------------------
  */
 
 
 #define MAX_BOARDS          8
 #define MAX_CHANS_USED      128
 
-#ifdef  SBE_PMCC4_ENABLE
 #define MUSYCC_NPORTS       4     /* CN8474 */
-#endif
-#ifdef SBE_WAN256T3_ENABLE
-#define MUSYCC_NPORTS       8     /* CN8478 */
-#endif
 #define MUSYCC_NCHANS       32    /* actually, chans per port */
 
 #define MUSYCC_NIQD         0x1000    /* power of 2 */
diff --git a/drivers/net/wan/cxt1e1/pmcc4_drv.c b/drivers/net/wan/cxt1e1/pmcc4_drv.c
index 27f2a74..8647cac 100644
--- a/drivers/net/wan/cxt1e1/pmcc4_drv.c
+++ b/drivers/net/wan/cxt1e1/pmcc4_drv.c
@@ -1,12 +1,4 @@
-/*
- * $Id: pmcc4_drv.c,v 3.1 2007/08/15 23:32:17 rickd PMCC4_3_1B $
- */
-
-
-/*-----------------------------------------------------------------------------
- * pmcc4_drv.c -
- *
- * Copyright (C) 2007  One Stop Systems, Inc.
+/* Copyright (C) 2007  One Stop Systems, Inc.
  * Copyright (C) 2002-2006  SBE, Inc.
  *
  *   This program is free software; you can redistribute it and/or modify
@@ -18,87 +10,16 @@
  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *   GNU General Public License for more details.
- *
- * For further information, contact via email: support@onestopsystems.com
- * One Stop Systems, Inc.  Escondido, California  U.S.A.
- *-----------------------------------------------------------------------------
- * RCS info:
- * RCS revision: $Revision: 3.1 $
- * Last changed on $Date: 2007/08/15 23:32:17 $
- * Changed by $Author: rickd $
- *-----------------------------------------------------------------------------
- * $Log: pmcc4_drv.c,v $
- * Revision 3.1  2007/08/15 23:32:17  rickd
- * Use 'if 0' instead of GNU comment delimeter to avoid line wrap induced compiler errors.
- *
- * Revision 3.0  2007/08/15 22:19:55  rickd
- * Correct sizeof() castings and pi->regram to support 64bit compatibility.
- *
- * Revision 2.10  2006/04/21 00:56:40  rickd
- * workqueue files now prefixed with <sbecom> prefix.
- *
- * Revision 2.9  2005/11/01 19:22:49  rickd
- * Add sanity checks against max_port for ioctl functions.
- *
- * Revision 2.8  2005/10/27 18:59:25  rickd
- * Code cleanup.  Default channel config to HDLC_FCS16.
- *
- * Revision 2.7  2005/10/18 18:16:30  rickd
- * Further NCOMM code repairs - (1) interrupt matrix usage inconsistant
- * for indexing into nciInterrupt[][], code missing double parameters.
- * (2) check input of ncomm interrupt registration cardID for correct
- * boundary values.
- *
- * Revision 2.6  2005/10/17 23:55:28  rickd
- * Initial port of NCOMM support patches from original work found
- * in pmc_c4t1e1 as updated by NCOMM.  Ref: CONFIG_SBE_PMCC4_NCOMM.
- * Corrected NCOMMs wanpmcC4T1E1_getBaseAddress() to correctly handle
- * multiple boards.
- *
- * Revision 2.5  2005/10/13 23:01:28  rickd
- * Correct panic for illegal address reference w/in get_brdinfo on
- * first_if/last_if name acquistion under Linux 2.6
- *
- * Revision 2.4  2005/10/13 21:20:19  rickd
- * Correction of c4_cleanup() wherein next should be acquired before
- * ci_t structure is free'd.
- *
- * Revision 2.3  2005/10/13 19:20:10  rickd
- * Correct driver removal cleanup code for multiple boards.
- *
- * Revision 2.2  2005/10/11 18:34:04  rickd
- * New routine added to determine number of ports (comets) on board.
- *
- * Revision 2.1  2005/10/05 00:48:13  rickd
- * Add some RX activation trace code.
- *
- * Revision 2.0  2005/09/28 00:10:06  rickd
- * Implement 2.6 workqueue for TX/RX restart.  Correction to
- * hardware register boundary checks allows expanded access of MUSYCC.
- * Implement new musycc reg&bits namings.
- *
- *-----------------------------------------------------------------------------
  */
 
-char        OSSIid_pmcc4_drvc[] =
-"@(#)pmcc4_drv.c - $Revision: 3.1 $   (c) Copyright 2002-2007 One Stop Systems, Inc.";
-
-
-#if defined (__FreeBSD__) || defined (__NetBSD__)
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/errno.h>
-#else
 #include <linux/types.h>
-#include "pmcc4_sysdep.h"
 #include <linux/errno.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>        /* include for timer */
 #include <linux/timer.h>        /* include for timer */
 #include <linux/hdlc.h>
 #include <asm/io.h>
-#endif
-
+#include "pmcc4_sysdep.h"
 #include "sbecom_inline_linux.h"
 #include "libsbew.h"
 #include "pmcc4_private.h"
@@ -118,12 +39,9 @@ char        OSSIid_pmcc4_drvc[] =
 #define KERN_WARN KERN_WARNING
 
 /* forward references */
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,41)
 status_t    c4_wk_chan_init (mpi_t *, mch_t *);
 void        c4_wq_port_cleanup (mpi_t *);
 status_t    c4_wq_port_init (mpi_t *);
-
-#endif
 int         c4_loop_port (ci_t *, int, u_int8_t);
 status_t    c4_set_port (ci_t *, int);
 status_t    musycc_chan_down (ci_t *, int);
@@ -201,34 +119,6 @@ c4_find_chan (int channum)
 }
 
 
-ci_t       *__init
-c4_new (void *hi)
-{
-    ci_t       *ci;
-
-#ifdef SBE_MAP_DEBUG
-    printk (KERN_WARNING "%s: c4_new() entered, ci needs %u.\n",
-            THIS_MODULE->name, (unsigned int) sizeof (ci_t));
-#endif
-
-    ci = (ci_t *) OS_kmalloc (sizeof (ci_t));
-    if (ci)
-    {
-        ci->hdw_info = hi;
-        ci->state = C_INIT;         /* mark as hardware not available */
-        ci->next = c4_list;
-        c4_list = ci;
-        ci->brdno = ci->next ? ci->next->brdno + 1 : 0;
-    } else
-        printk (KERN_WARNING "%s: failed CI malloc, size %u.\n",
-                THIS_MODULE->name, (unsigned int) sizeof (ci_t));
-
-    if (CI == 0)
-        CI = ci;                    /* DEBUG, only board 0 usage */
-    return ci;
-}
-
-
 /***
  * Check port state and set LED states using watchdog or ioctl...
  * also check for in-band SF loopback commands (& cause results if they are there)
diff --git a/drivers/net/wan/cxt1e1/pmcc4_private.h b/drivers/net/wan/cxt1e1/pmcc4_private.h
index 4ee424f..431a718 100644
--- a/drivers/net/wan/cxt1e1/pmcc4_private.h
+++ b/drivers/net/wan/cxt1e1/pmcc4_private.h
@@ -1,14 +1,7 @@
-/*
- * $Id: pmcc4_private.h,v 1.4 2005/10/27 18:54:19 rickd PMCC4_3_1B $
- */
-
 #ifndef _INC_PMCC4_PRIVATE_H_
 #define _INC_PMCC4_PRIVATE_H_
 
-/*-----------------------------------------------------------------------------
- * pmcc4_private.h -
- *
- * Copyright (C) 2005  SBE, Inc.
+/* Copyright (C) 2005  SBE, Inc.
  *
  *   This program is free software; you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License as published by
@@ -19,40 +12,15 @@
  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *   GNU General Public License for more details.
- *
- * For further information, contact via email: support@sbei.com
- * SBE, Inc.  San Ramon, California  U.S.A.
- *-----------------------------------------------------------------------------
- * RCS info:
- * RCS revision: $Revision: 1.4 $
- * Last changed on $Date: 2005/10/27 18:54:19 $
- * Changed by $Author: rickd $
- *-----------------------------------------------------------------------------
- * $Log: pmcc4_private.h,v $
- * Revision 1.4  2005/10/27 18:54:19  rickd
- * Clean out old watchdog_copy code.  Msg Desc <status> to volatile.
- *
- * Revision 1.3  2005/09/28 00:10:09  rickd
- * Add GNU License info.  Name changed from c4_private.h.
- *
- * Revision 1.2  2005/04/28 23:43:03  rickd
- * Add RCS tracking heading.
- *
- *-----------------------------------------------------------------------------
  */
 
 
 #include <linux/kernel.h>
 #include <linux/sched.h>
 #include <linux/spinlock.h>
-#include <asm/semaphore.h>
 #include <linux/interrupt.h>    /* support for tasklets */
 #include <linux/timer.h>        /* support for timer */
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-#include <linux/tqueue.h>       /* support for tq_struct */
-#else
 #include <linux/workqueue.h>
-#endif
 #include <linux/hdlc.h>
 
 #include "libsbew.h"
diff --git a/drivers/net/wan/cxt1e1/pmcc4_sysdep.h b/drivers/net/wan/cxt1e1/pmcc4_sysdep.h
index 9e71a8b..bde7f0a 100644
--- a/drivers/net/wan/cxt1e1/pmcc4_sysdep.h
+++ b/drivers/net/wan/cxt1e1/pmcc4_sysdep.h
@@ -1,12 +1,9 @@
-/*
- * $Id: pmcc4_sysdep.h,v 1.1 2005/09/28 00:10:09 rickd PMCC4_3_1B $
- */
-
 #ifndef _INC_PMCC4_SYSDEP_H_
 #define _INC_PMCC4_SYSDEP_H_
 
-/*-----------------------------------------------------------------------------
- * pmcc4_sysdep.h -
+#include <linux/kernel.h>
+
+/*
  *
  * Copyright (C) 2005  SBE, Inc.
  *
@@ -20,55 +17,8 @@
  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *   GNU General Public License for more details.
  *
- * For further information, contact via email: support@sbei.com
- * SBE, Inc.  San Ramon, California  U.S.A.
- *-----------------------------------------------------------------------------
- * RCS info:
- * RCS revision: $Revision: 1.1 $
- * Last changed on $Date: 2005/09/28 00:10:09 $
- * Changed by $Author: rickd $
- *-----------------------------------------------------------------------------
- * $Log: pmcc4_sysdep.h,v $
- * Revision 1.1  2005/09/28 00:10:09  rickd
- * Add GNU License info.
- *
- * Revision 1.0  2005/05/04 17:19:25  rickd
- * Initial revision
- *
- *-----------------------------------------------------------------------------
  */
 
-
-#if defined (__FreeBSD__) || defined (__NetBSD__)
-#   include <sys/types.h>
-#else
-#   include <linux/types.h>
-#   include <linux/config.h>
-#   if defined(CONFIG_SMP) && ! defined(__SMP__)
-#      define __SMP__
-#   endif
-#   if defined(CONFIG_MODVERSIONS) && defined(MODULE) && ! defined(MODVERSIONS)
-#      define MODVERSIONS
-#   endif
-#
-#   include <linux/version.h>
-#   ifdef MODULE
-#      ifdef MODVERSIONS
-#         if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-#            include <linux/modversions.h>
-#         else
-#            include <config/modversions.h>
-#         endif
-#      endif
-#      include <linux/module.h>
-#   else
-#      define MOD_INC_USE_COUNT
-#      define MOD_DEC_USE_COUNT
-#      define SET_MODULE_OWNER(dev)
-#      define MODULE_DEVICE_TABLE(pci, pci_tbl)
-#   endif
-#endif
-
 /* reduce multiple autoconf entries to a single definition */
 
 #ifdef CONFIG_SBE_PMCC4_HDLC_V7_MODULE
@@ -86,39 +36,22 @@
  * otherwise a memory barrier needs to be inserted.
  */
 
-#if defined (__FreeBSD__) || defined (__NetBSD__)
-#else
-#define IO_CACHE_COHERENT      1
-#define MEM_CACHE_COHERENT     0
-#if IO_CACHE_COHERENT
-#define FLUSH_PCI_READ()
-#define FLUSH_PCI_WRITE()
-#else
 #define FLUSH_PCI_READ()     rmb()
 #define FLUSH_PCI_WRITE()    wmb()
-#endif
-#if MEM_CACHE_COHERENT
-#define FLUSH_MEM_READ()
-#define FLUSH_MEM_WRITE()
-#else
 #define FLUSH_MEM_READ()     rmb()
 #define FLUSH_MEM_WRITE()    wmb()
-#endif
-#endif
-
 
 /*
  * System dependent callbacks routines, not inlined...
  * For inlined system dependent routines, see include/sbecom_inlinux_linux.h
  */
-                                                                                
+
 /*
  * passes received memory token back to the system, <user> is parameter from
  * sd_new_chan() used to create the channel which the data arrived on
  */
 
 void        sd_recv_consume (void *token, size_t len, void *user);
-
 void        sd_disable_xmit (void *user);
 void        sd_enable_xmit (void *user);
 int         sd_line_is_ok (void *user);
@@ -126,4 +59,4 @@ void        sd_line_is_up (void *user);
 void        sd_line_is_down (void *user);
 int         sd_queue_stopped (void *user);
 
-#endif                          /*** _INC_PMCC4_SYSDEP_H_ ***/
+#endif
diff --git a/drivers/net/wan/cxt1e1/sbecom_inline_linux.h b/drivers/net/wan/cxt1e1/sbecom_inline_linux.h
index c1d8cba..d2a2b95 100644
--- a/drivers/net/wan/cxt1e1/sbecom_inline_linux.h
+++ b/drivers/net/wan/cxt1e1/sbecom_inline_linux.h
@@ -1,14 +1,7 @@
-/*
- * $Id: sbecom_inline_linux.h,v 1.2 2007/08/15 22:51:35 rickd PMCC4_3_1B $
- */
-
 #ifndef _INC_SBECOM_INLNX_H_
 #define _INC_SBECOM_INLNX_H_
 
-/*-----------------------------------------------------------------------------
- * sbecom_inline_linux.h - SBE common Linux inlined routines
- *
- * Copyright (C) 2007  One Stop Systems, Inc.
+/* Copyright (C) 2007  One Stop Systems, Inc.
  * Copyright (C) 2005  SBE, Inc.
  *
  *   This program is free software; you can redistribute it and/or modify
@@ -20,57 +13,12 @@
  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *   GNU General Public License for more details.
- *
- * For further information, contact via email: support@onestopsystems.com
- * One Stop Systems, Inc.  Escondido, California  U.S.A.
- *-----------------------------------------------------------------------------
- * RCS info:
- * RCS revision: $Revision: 1.2 $
- * Last changed on $Date: 2007/08/15 22:51:35 $
- * Changed by $Author: rickd $
- *-----------------------------------------------------------------------------
- * $Log: sbecom_inline_linux.h,v $
- * Revision 1.2  2007/08/15 22:51:35  rickd
- * Remove duplicate version.h entry.
- *
- * Revision 1.1  2007/08/15 22:50:29  rickd
- * Update linux/config for 2.6.18 and later.
- *
- * Revision 1.0  2005/09/28 00:10:09  rickd
- * Initial revision
- *
- *-----------------------------------------------------------------------------
  */
 
 
-#if defined (__FreeBSD__) || defined (__NetBSD__)
-#include <sys/types.h>
-#else
+#include <linux/kernel.h>       /* resolves kmalloc references */
 #include <linux/types.h>
 #include <linux/version.h>
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
-#include <linux/config.h>
-#endif
-#if defined(CONFIG_SMP) && ! defined(__SMP__)
-#define __SMP__
-#endif
-#if defined(CONFIG_MODVERSIONS) && defined(MODULE) && ! defined(MODVERSIONS)
-#define MODVERSIONS
-#endif
-
-#ifdef MODULE
-#ifdef MODVERSIONS
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-#include <linux/modversions.h>
-#else
-#include <config/modversions.h>
-#endif
-#endif
-#include <linux/module.h>
-#endif
-#endif
-
-#include <linux/kernel.h>       /* resolves kmalloc references */
 #include <linux/skbuff.h>       /* resolves skb references */
 #include <linux/netdevice.h>    /* resolves dev_kree_skb_any */
 #include <asm/byteorder.h>      /* resolves cpu_to_le32 */
@@ -260,13 +208,9 @@ OS_sem_free (void *sem)
 struct watchdog
 {
     struct timer_list h;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-    struct tq_struct tq;
-#else
     struct work_struct work;
-#endif
     void       *softc;
-    void        (*func) (void *softc);
+    void        (*func)(struct work_struct *softc);
     int         ticks;
     int         init_tq;
 };
@@ -304,7 +248,8 @@ void        OS_uwait_dummy (void);
 
 
 /* watchdog functions */
-int         OS_init_watchdog (struct watchdog * wdp, void (*f) (void *), void *ci, int usec);
+int OS_init_watchdog (struct watchdog * wdp, void (*f) (struct work_struct *),
+		      void *ci, int usec);
 
 
 #endif                          /*** _INC_SBECOM_INLNX_H_ ***/
diff --git a/drivers/net/wan/cxt1e1/sbeid.c b/drivers/net/wan/cxt1e1/sbeid.c
index 37c7629..7a1c66a 100644
--- a/drivers/net/wan/cxt1e1/sbeid.c
+++ b/drivers/net/wan/cxt1e1/sbeid.c
@@ -1,11 +1,4 @@
-/*
- * $Id: sbeid.c,v 1.2 2005/10/13 19:13:23 rickd PMCC4_3_1B $
- */
-
-/*-----------------------------------------------------------------------------
- * sbeid.c - generic board identification routines
- *
- * Copyright (C) 2005  SBE, Inc.
+/* Copyright (C) 2005  SBE, Inc.
  *
  *   This program is free software; you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License as published by
@@ -16,36 +9,9 @@
  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *   GNU General Public License for more details.
- *
- * For further information, contact via email: support@sbei.com
- * SBE, Inc.  San Ramon, California  U.S.A.
- *-----------------------------------------------------------------------------
- * RCS info:
- * RCS revision: $Revision: 1.2 $
- * Last changed on $Date: 2005/10/13 19:13:23 $
- * Changed by $Author: rickd $
- *-----------------------------------------------------------------------------
- * $Log: sbeid.c,v $
- * Revision 1.2  2005/10/13 19:13:23  rickd
- * Fix PMCC4 enabling by correction of "ifdef" flag usage.
- *
- * Revision 1.1  2005/10/11 18:32:21  rickd
- * Maximum ports setting set elsewhere during module initialization.
- * C4T1E1 PCI BID appears to be global, now further parse this setting
- * and reassign number based upon number of found ports.
- *
- * Revision 1.0  2005/09/28 00:10:07  rickd
- * Initial revision
- *
- *-----------------------------------------------------------------------------
  */
 
-char        SBEid_sbeid[] =
-"@(#)sbeid.c - $Revision: 1.2 $      (c) Copyright 2005 SBE, Inc.";
-
-
 #include "pmcc4_sysdep.h"
-
 #include "sbecom_inline_linux.h"
 #include "libsbew.h"
 #include "pmcc4_private.h"
@@ -154,7 +120,6 @@ sbeid_set_hdwbid (ci_t * ci)
     case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T1E1_L):
         ci->hdw_bid = SBE_BID_PMC_C1T1E1;       /* 0xC1 - SBE wanPMC-C1T1E1 */
         break;
-#ifdef SBE_PMCC4_ENABLE
         /*
          * This case is entered as a result of the inability to obtain the
          * <bid> from the board's EEPROM.  Assume a PCI board and set
@@ -164,7 +129,6 @@ sbeid_set_hdwbid (ci_t * ci)
         /* start by assuming 4-port for ZERO casing */
         ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C4T1E1);
         /* drop thru to set hdw_bid and alternate PCI CxT1E1 settings */
-#endif
     case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C4T1E1):
         /*
          * This Board ID is a generic identification.  Use the number of
diff --git a/drivers/net/wan/cxt1e1/sbeproc.c b/drivers/net/wan/cxt1e1/sbeproc.c
index d9ccb19..c435639 100644
--- a/drivers/net/wan/cxt1e1/sbeproc.c
+++ b/drivers/net/wan/cxt1e1/sbeproc.c
@@ -1,11 +1,4 @@
-/*
- * $Id: sbeproc.c,v 1.5 2005/10/31 20:26:37 rickd PMCC4_3_1B $
- */
-
-/*-----------------------------------------------------------------------------
- * sbeproc.c -
- *
- * Copyright (C) 2004-2005  SBE, Inc.
+/* Copyright (C) 2004-2005  SBE, Inc.
  *
  *   This program is free software; you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License as published by
@@ -16,50 +9,8 @@
  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *   GNU General Public License for more details.
- *
- * For further information, contact via email: support@sbei.com
- * SBE, Inc.  San Ramon, California  U.S.A.
- *-----------------------------------------------------------------------------
- * RCS info:
- * RCS revision: $Revision: 1.5 $
- * Last changed on $Date: 2005/10/31 20:26:37 $
- * Changed by $Author: rickd $
- *-----------------------------------------------------------------------------
- * $Log: sbeproc.c,v $
- * Revision 1.5  2005/10/31 20:26:37  rickd
- * Fix for compilation warning re: declaration w/in ...get_sge_info().
- *
- * Revision 1.4  2005/10/27 18:54:19  rickd
- * Display driver tuning variable settings.
- *
- * Revision 1.3  2005/10/11 18:31:22  rickd
- * Add number of physical ports to displayed board info.
- *
- * Revision 1.2  2005/09/28 00:10:07  rickd
- * Add EEPROM Type 2 info.  Switch from os_ to OS_ named functions.
- *
- * Revision 1.3  2005/06/06 23:47:51  rickd
- * OS support routine names changed from sd_ to OS_.  Implement
- * in-line OS function support via inclusion of sbecom_inline_linux.h
- *
- * Revision 1.2  2005/04/18 21:23:20  rickd
- * Make directory within /proc/driver using proc_root_driver because
- * trying w/in /proc failed for multiple cards/drivers.
- *
- * Revision 1.1  2005/04/01 00:17:52  rickd
- * Use alternate proc_mkdir() to create driver/board directory.
- *
- * Revision 1.0  2004/12/03 23:32:07  rickd
- * Initial CI.
- *
- *-----------------------------------------------------------------------------
  */
 
-
-char        SBEid_sbeproc_c[] =
-"@(#)sbeproc.c        $Revision: 1.5 $      (c) Copyright 2004-2005 SBE, Inc.";
-
-
 #include "pmcc4_sysdep.h"
 #include <linux/types.h>
 #include <linux/module.h>
@@ -73,8 +24,7 @@ char        SBEid_sbeproc_c[] =
 #include "pmcc4_private.h"
 #include "sbeproc.h"
 
-/* forwards */
-void        sbecom_get_brdinfo (ci_t *, struct sbe_brd_info *, u_int8_t *);
+void sbecom_get_brdinfo (ci_t *, struct sbe_brd_info *, u_int8_t *);
 extern struct s_hdw_info hdw_info[MAX_BOARDS];
 
 #ifdef CONFIG_PROC_FS
@@ -83,14 +33,15 @@ extern struct s_hdw_info hdw_info[MAX_BOARDS];
 /* procfs stuff                                                     */
 /********************************************************************/
 
-
 void
 sbecom_proc_brd_cleanup (ci_t * ci)
 {
     if (ci->dir_dev)
     {
+	char dir[7 + SBE_IFACETMPL_SIZE + 1];
+	snprintf(dir, sizeof(dir), "driver/%s", ci->devname);
         remove_proc_entry ("info", ci->dir_dev);
-        remove_proc_entry (ci->devname, proc_root_driver);
+        remove_proc_entry (dir, NULL);
         ci->dir_dev = NULL;
     }
 }
@@ -214,9 +165,7 @@ sbecom_proc_get_sbe_info (char *buffer, char **start, off_t offset,
     }
     len += sprintf (buffer + len, "PCI Bus Speed: %s\n", spd);
     len += sprintf (buffer + len, "Release:       %s\n", ci->release);
-    len += sprintf (buffer + len, "Module Name:   %s\n", ci->dir_dev->owner->name);
 
-#ifdef SBE_PMCC4_ENABLE
     {
         extern int max_mru;
 #if 0
@@ -224,7 +173,7 @@ sbecom_proc_get_sbe_info (char *buffer, char **start, off_t offset,
         extern int max_mtu;
 #endif
         extern int max_rxdesc_used, max_txdesc_used;
-                                                                                                        
+
         len += sprintf (buffer + len, "\nmax_mru:         %d\n", max_mru);
 #if 0
         len += sprintf (buffer + len, "\nmax_chans_used:  %d\n", max_chans_used);
@@ -233,7 +182,6 @@ sbecom_proc_get_sbe_info (char *buffer, char **start, off_t offset,
         len += sprintf (buffer + len, "max_rxdesc_used: %d\n", max_rxdesc_used);
         len += sprintf (buffer + len, "max_txdesc_used: %d\n", max_txdesc_used);
     }
-#endif
 
     OS_kfree (bip);                 /* cleanup */
 
@@ -359,16 +307,17 @@ int         __init
 sbecom_proc_brd_init (ci_t * ci)
 {
     struct proc_dir_entry *e;
+    char dir[7 + SBE_IFACETMPL_SIZE + 1];
 
     /* create a directory in the root procfs */
-    ci->dir_dev = proc_mkdir (ci->devname, proc_root_driver);
+    snprintf(dir, sizeof(dir), "driver/%s", ci->devname);
+    ci->dir_dev = proc_mkdir(dir, NULL);
     if (!ci->dir_dev)
     {
         printk (KERN_ERR "%s: Unable to create directory /proc/driver/%s\n",
                 THIS_MODULE->name, ci->devname);
         goto fail;
     }
-    ci->dir_dev->owner = THIS_MODULE;
     e = create_proc_read_entry ("info", S_IFREG | S_IRUGO,
                                 ci->dir_dev, sbecom_proc_get_sbe_info, ci);
     if (!e)
@@ -377,7 +326,6 @@ sbecom_proc_brd_init (ci_t * ci)
                 THIS_MODULE->name, ci->devname);
         goto fail;
     }
-    e->owner = THIS_MODULE;
     return 0;
 
 fail:
diff --git a/drivers/net/wan/cxt1e1/sbeproc.h b/drivers/net/wan/cxt1e1/sbeproc.h
index 4aa53f4..f8025f7 100644
--- a/drivers/net/wan/cxt1e1/sbeproc.h
+++ b/drivers/net/wan/cxt1e1/sbeproc.h
@@ -1,14 +1,7 @@
-/*
- * $Id: sbeproc.h,v 1.2 2005/10/17 23:55:28 rickd PMCC4_3_1B $
- */
-
 #ifndef _INC_SBEPROC_H_
 #define _INC_SBEPROC_H_
 
-/*-----------------------------------------------------------------------------
- * sbeproc.h -
- *
- * Copyright (C) 2004-2005  SBE, Inc.
+/* Copyright (C) 2004-2005  SBE, Inc.
  *
  *   This program is free software; you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License as published by
@@ -19,34 +12,14 @@
  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  *   GNU General Public License for more details.
- *
- * For further information, contact via email: support@sbei.com
- * SBE, Inc.  San Ramon, California  U.S.A.
- *-----------------------------------------------------------------------------
- * RCS info:
- * RCS revision: $Revision: 1.2 $
- * Last changed on $Date: 2005/10/17 23:55:28 $
- * Changed by $Author: rickd $
- *-----------------------------------------------------------------------------
- * $Log: sbeproc.h,v $
- * Revision 1.2  2005/10/17 23:55:28  rickd
- * sbecom_proc_brd_init() is an declared an __init function.
- *
- * Revision 1.1  2005/09/28 00:10:09  rickd
- * Remove unneeded inclusion of c4_private.h.
- *
- * Revision 1.0  2005/05/10 22:21:46  rickd
- * Initial check-in.
- *
- *-----------------------------------------------------------------------------
  */
 
 
 #ifdef CONFIG_PROC_FS
 #ifdef __KERNEL__
-void        sbecom_proc_brd_cleanup (ci_t *);
-int __init  sbecom_proc_brd_init (ci_t *);
+void sbecom_proc_brd_cleanup(ci_t *);
+int __init sbecom_proc_brd_init(ci_t *);
 
-#endif                          /*** __KERNEL__ ***/
-#endif                          /*** CONFIG_PROC_FS ***/
-#endif                          /*** _INC_SBEPROC_H_ ***/
+#endif
+#endif
+#endif

-- 
Krzysztof Halasa

^ permalink raw reply related

* Re: [PATCH] sky2: set carrier off in probe
From: Stephen Hemminger @ 2009-10-30  3:09 UTC (permalink / raw)
  To: Brandon Philips; +Cc: netdev
In-Reply-To: <20091029235807.GF3228@jenkins.home.ifup.org>

On Thu, 29 Oct 2009 16:58:07 -0700
Brandon Philips <bphilips@suse.de> wrote:

> Before bringing up a sky2 interface up ethtool reports 
> "Link detected: yes". Do as ixgbe does and netif_carrier_off() on
> probe().
> 
> Signed-off-by: Brandon Philips <bphilips@suse.de>
> 
> ---
>  drivers/net/sky2.c |    2 ++
>  1 file changed, 2 insertions(+)
> 
> Index: linux-2.6/drivers/net/sky2.c
> ===================================================================
> --- linux-2.6.orig/drivers/net/sky2.c
> +++ linux-2.6/drivers/net/sky2.c
> @@ -4538,6 +4538,8 @@ static int __devinit sky2_probe(struct p
>  		goto err_out_free_netdev;
>  	}
>  
> +	netif_carrier_off(dev);
> +
>  	netif_napi_add(dev, &hw->napi, sky2_poll, NAPI_WEIGHT);
>  
>  	err = request_irq(pdev->irq, sky2_intr,

IMHO carrier is meaningless until device is up? What software
cares?

-- 

^ permalink raw reply

* linux-next: manual merge of the net/wireless tree with the staging.current tree
From: Stephen Rothwell @ 2009-10-30  3:18 UTC (permalink / raw)
  To: David Miller, netdev
  Cc: linux-next, linux-kernel, Randy Dunlap, Greg Kroah-Hartman,
	Larry Finger, John W. Linville

Hi all,

Today's linux-next merge of the net tree got conflicts in
drivers/staging/rtl8187se/Kconfig and drivers/staging/rtl8192e/Kconfig
between commit a26961e914c88e3e2ed46ef67f83a33ad7b57c36 ("Staging: fix
wireless drivers depends") from the staging.current tree and commit
125b181aec7a67c71234284ecf6d9c729d05deda ("staging: Add proper selection
of WIRELESS_EXT and WEXT_PRIV") from the net/wireless tree.

Just context changes.  I fixed it up (see below) and can carry the fix
for a while.
-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --cc drivers/staging/rtl8187se/Kconfig
index 203c79b,faf6c60..0000000
--- a/drivers/staging/rtl8187se/Kconfig
+++ b/drivers/staging/rtl8187se/Kconfig
@@@ -1,6 -1,7 +1,7 @@@
  config RTL8187SE
  	tristate "RealTek RTL8187SE Wireless LAN NIC driver"
 -	depends on PCI
 +	depends on PCI && WLAN
- 	depends on WIRELESS_EXT
+ 	select WIRELESS_EXT
+ 	select WEXT_PRIV
  	default N
  	---help---
diff --cc drivers/staging/rtl8192e/Kconfig
index 37e4fde,5c077b9..0000000
--- a/drivers/staging/rtl8192e/Kconfig
+++ b/drivers/staging/rtl8192e/Kconfig
@@@ -1,6 -1,7 +1,7 @@@
  config RTL8192E
  	tristate "RealTek RTL8192E Wireless LAN NIC driver"
 -	depends on PCI
 +	depends on PCI && WLAN
- 	depends on WIRELESS_EXT
+ 	select WIRELESS_EXT
+ 	select WEXT_PRIV
  	default N
  	---help---

^ permalink raw reply

* Re: [PATCH] udev: create empty regular files to represent net interfaces
From: Marco d'Itri @ 2009-10-30  3:30 UTC (permalink / raw)
  To: dann frazier
  Cc: Greg KH, Matt Domsch, Kay Sievers, linux-hotplug, Narendra_K,
	netdev, Jordan_Hargrave, Charles_Rose, Ben Hutchings
In-Reply-To: <20091029174600.GC3612@ldl.fc.hp.com>

[-- Attachment #1: Type: text/plain, Size: 324 bytes --]

On Oct 29, dann frazier <dannf@dannf.org> wrote:

> That would make a lot of users much happier (myself included), but it
> does restrict us into one view. At different times, admins think of
> their NICs by different properties. I may want to do IP assignment by
[Citation needed]

(An admin.)

-- 
ciao,
Marco

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply

* Re: linux-next: manual merge of the net/wireless tree with the staging.current tree
From: Greg KH @ 2009-10-30  3:44 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: David Miller, netdev, linux-next, linux-kernel, Randy Dunlap,
	Larry Finger, John W. Linville
In-Reply-To: <20091030141800.eb72e320.sfr@canb.auug.org.au>

On Fri, Oct 30, 2009 at 02:18:00PM +1100, Stephen Rothwell wrote:
> Hi all,
> 
> Today's linux-next merge of the net tree got conflicts in
> drivers/staging/rtl8187se/Kconfig and drivers/staging/rtl8192e/Kconfig
> between commit a26961e914c88e3e2ed46ef67f83a33ad7b57c36 ("Staging: fix
> wireless drivers depends") from the staging.current tree and commit
> 125b181aec7a67c71234284ecf6d9c729d05deda ("staging: Add proper selection
> of WIRELESS_EXT and WEXT_PRIV") from the net/wireless tree.
> 
> Just context changes.  I fixed it up (see below) and can carry the fix
> for a while.

Thanks, the fix looks fine to me.

greg k-h

^ permalink raw reply

* Re: [PATCH] sky2: set carrier off in probe
From: Brandon Philips @ 2009-10-30  3:51 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev
In-Reply-To: <20091029200905.00f4c13d@nehalam>

On 20:09 Thu 29 Oct 2009, Stephen Hemminger wrote:
> On Thu, 29 Oct 2009 16:58:07 -0700
> Brandon Philips <bphilips@suse.de> wrote:
> 
> > Before bringing up a sky2 interface up ethtool reports 
> > "Link detected: yes". Do as ixgbe does and netif_carrier_off() on
> > probe().
> > 
> > Signed-off-by: Brandon Philips <bphilips@suse.de>
> > 
> > ---
> >  drivers/net/sky2.c |    2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > Index: linux-2.6/drivers/net/sky2.c
> > ===================================================================
> > --- linux-2.6.orig/drivers/net/sky2.c
> > +++ linux-2.6/drivers/net/sky2.c
> > @@ -4538,6 +4538,8 @@ static int __devinit sky2_probe(struct p
> >  		goto err_out_free_netdev;
> >  	}
> >  
> > +	netif_carrier_off(dev);
> > +
> >  	netif_napi_add(dev, &hw->napi, sky2_poll, NAPI_WEIGHT);
> >  
> >  	err = request_irq(pdev->irq, sky2_intr,
> 
> IMHO carrier is meaningless until device is up? What software
> cares?

A customer had a script that was testing for ethtool reporting "Link
detected: yes" and taking some sort of action. They found other
drivers reported "Link detected: No" until the first interface up.

The right thing to do is up the interface first before looking at the
the Link state, and I told them to do that, but I figured that this
patch made sense too to fix the initial buglet.

Cheers,

	Brandon

^ permalink raw reply

* Re: [PATCH] sky2: set carrier off in probe
From: David Miller @ 2009-10-30  4:12 UTC (permalink / raw)
  To: bphilips; +Cc: shemminger, netdev
In-Reply-To: <20091030035128.GA3380@jenkins.home.ifup.org>

From: Brandon Philips <bphilips@suse.de>
Date: Thu, 29 Oct 2009 20:51:28 -0700

> The right thing to do is up the interface first before looking at the
> the Link state, and I told them to do that, but I figured that this
> patch made sense too to fix the initial buglet.

It is not valid to expect link status before bringing the interface
up.

Otherwise, if link status is expected in this case, drivers cannot
fully power down all elements of the chip when the device is not even
brought up.

^ permalink raw reply

* Re: [PATCH v3 4/7] fsl_pq_mdio: Add Suport for etsec2.0 devices.
From: David Miller @ 2009-10-30  4:21 UTC (permalink / raw)
  To: Sandeep.Kumar; +Cc: netdev, afleming
In-Reply-To: <1256826229-529-1-git-send-email-Sandeep.Kumar@freescale.com>

From: Sandeep Gopalpet <Sandeep.Kumar@freescale.com>
Date: Thu, 29 Oct 2009 19:53:49 +0530

> From: Sandeep Gopalpet <sandeep.kumar@freescale.com>
> 
> This patch adds mdio support for etsec2.0 devices.
> 
> Modified the fsl_pq_mdio structure to include the new mdio
> members.
> 
> Signed-off-by: Sandeep Gopalpet <sandeep.kumar@freescale.com>
> ---
>  *. Rebased to the net-next-2.6 tree as of 20091028 cloned from
>     http://www.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6.git

It does not apply, again.

And again, here is the bundle I tried to apply using "git am --signoff":

	http://vger.kernel.org/~davem/bundle-641.mbox

--------------------
davem@sunset:~/src/GIT/net-next-2.6$ git am --signoff bundle-641.mbox 
Applying: gianfar: Add per queue structure support
Applying: gianfar: Introduce logical group support.
Applying: gianfar: Add Multiple Queue Support
Applying: fsl_pq_mdio: Add Suport for etsec2.0 devices.
error: patch failed: drivers/net/fsl_pq_mdio.c:405
error: drivers/net/fsl_pq_mdio.c: patch does not apply
Patch failed at 0004 fsl_pq_mdio: Add Suport for etsec2.0 devices.
When you have resolved this problem run "git am --resolved".
If you would prefer to skip this patch, instead run "git am --skip".
To restore the original branch and stop patching run "git am --abort".
--------------------

Did you try the bundle I posted yesterday which failed?  This
one is identical, you didn't change anything.

This is getting rediculious.

Try again, and when you do take the patches from patchwork at:

	http://patchwork.ozlabs.org/project/netdev/list/

and you try to apply them to net-next-2.6 using git (_not_ 'patch',
'patch' is way too lenient about fuzz and line offsets) so that you
can see what's happening.

I'm completely ignoring your patch postings until you sort this out.

You cannot have line offsets or fuzz when you send patches that are to
be applied by GIT, and that is the problem with patch #4:

davem@sunset:~/src/GIT/net-next-2.6$ patch -p1 <diff
patching file drivers/net/fsl_pq_mdio.c
Hunk #6 succeeded at 436 with fuzz 1.
patching file drivers/net/fsl_pq_mdio.h

GIT does not allow line fuzz, you must make absolutely pristine
patches, and therefore if you are testing your submission with just
'patch' that absolutely will not work.

Thanks.

^ 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