Re: [PATCH 11/21] e1000: disable CRC stripping workaround

2006-06-21 Thread Ben Greear

Kok, Auke wrote:

CRC stripping is breaking SMBUS-connected BMC's. We disable this
feature to make it work. This fixes related bugs regarding SOL.


Shouldn't you also have to subtract 4 bytes when setting the skb len
in the receive logic?  Perhaps when setting the rx-bytes counter as well?

Ben

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


[PATCH 15/21] e1000: check return value of _get_speed_and_duplex

2006-06-21 Thread Kok, Auke

We were not checking the return value of get_speed_and_duplex
properly, whih may contain an error value.

Signed-off-by: Jesse Brandeburg <[EMAIL PROTECTED]>
Signed-off-by: Auke Kok <[EMAIL PROTECTED]>
---

 drivers/net/e1000/e1000_hw.c |8 ++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/net/e1000/e1000_hw.c b/drivers/net/e1000/e1000_hw.c
index 37eb351..784f950 100644
--- a/drivers/net/e1000/e1000_hw.c
+++ b/drivers/net/e1000/e1000_hw.c
@@ -2737,8 +2737,12 @@ e1000_check_for_link(struct e1000_hw *hw
  */
 if(hw->tbi_compatibility_en) {
 uint16_t speed, duplex;
-e1000_get_speed_and_duplex(hw, &speed, &duplex);
-if(speed != SPEED_1000) {
+ret_val = e1000_get_speed_and_duplex(hw, &speed, &duplex);
+if (ret_val) {
+DEBUGOUT("Error getting link speed and duplex\n");
+return ret_val;
+}
+if (speed != SPEED_1000) {
 /* If link speed is not set to gigabit speed, we do not need
  * to enable TBI compatibility.
  */



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


[PATCH 20/21] e1000: add ich8lan device ID's

2006-06-21 Thread Kok, Auke

Add the device ID's of the supported ICH8 LAN devices.

Signed-off-by: Jesse Brandeburg <[EMAIL PROTECTED]>
Signed-off-by: Auke Kok <[EMAIL PROTECTED]>
---

 drivers/net/e1000/e1000_main.c |7 +++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 95f4435..4fdc564 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -73,6 +73,11 @@ static struct pci_device_id e1000_pci_tb
INTEL_E1000_ETHERNET_DEVICE(0x1026),
INTEL_E1000_ETHERNET_DEVICE(0x1027),
INTEL_E1000_ETHERNET_DEVICE(0x1028),
+   INTEL_E1000_ETHERNET_DEVICE(0x1049),
+   INTEL_E1000_ETHERNET_DEVICE(0x104A),
+   INTEL_E1000_ETHERNET_DEVICE(0x104B),
+   INTEL_E1000_ETHERNET_DEVICE(0x104C),
+   INTEL_E1000_ETHERNET_DEVICE(0x104D),
INTEL_E1000_ETHERNET_DEVICE(0x105E),
INTEL_E1000_ETHERNET_DEVICE(0x105F),
INTEL_E1000_ETHERNET_DEVICE(0x1060),
@@ -96,6 +101,8 @@ static struct pci_device_id e1000_pci_tb
INTEL_E1000_ETHERNET_DEVICE(0x109A),
INTEL_E1000_ETHERNET_DEVICE(0x10B5),
INTEL_E1000_ETHERNET_DEVICE(0x10B9),
+   INTEL_E1000_ETHERNET_DEVICE(0x10BA),
+   INTEL_E1000_ETHERNET_DEVICE(0x10BB),
/* required last entry */
{0,}
 };



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


Re: Suspending 802.11 drivers

2006-06-21 Thread Luis R. Rodriguez

On 6/21/06, Michael Buesch <[EMAIL PROTECTED]> wrote:

On Wednesday 21 June 2006 17:08, Luis R. Rodriguez wrote:
> On 6/16/06, Stefan Rompf <[EMAIL PROTECTED]> wrote:
> > Am Donnerstag 15 Juni 2006 21:58 schrieb Michael Buesch:
> >
> > I think the most important question is how a suspend/resume action should be
> > translated. For the managed case, it is clearly an association loss, 
normally
> > signalled by netif_carrier_on/off() and a corresponding SIOCGIWAP event.
> > Supplicants can act on this. In AP mode, suspend is equal to disassociating
> > all stations. Ad-hoc... dunno.
> >
> > For a softmac stack like devicescape, it makes sense to have a function that
> > abstracts these scenarios as it is the stack anyway that handles association
> > stuff. However, I'd rather extend the existing function
> > ieee80211_netif_oper().
>
> Since d80211 is already being patched for sysfs how about we use sysfs
> (and kobjects) to maintain the state at suspend() and resume(). This
> would allow userspace tools like supplicant running in the background
> to pick up from sysfs where it left off and for our drivers to save
> where we left off. ieee80211_hw can then just refer to their suspend()
> and resume() routines from its respective struct pci_driver or struct
> usb_device.

Ok, so you mean we remove the full responsibility to recover a connection
from the driver resume() handler and let a userspace daemon keep
track of this?
So basically stay with the current implementation of suspend() and
resume() in the drivers and assume userspace does the right thing
and detects a resume and recovers connections and so on?
Did I understand that right? If yes, I think that's a very nice idea, too.
Probably the best.


Michael, yes that was what I meant.
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 19/21] e1000: allow user to disable ich8 lock loss workaround

2006-06-21 Thread Kok, Auke

The workaround for the ich8 lock loss problem is only needed for
a very small amount of systems. This adds an option for the user
to disable the workaround.

Signed-off-by: Jesse Brandeburg <[EMAIL PROTECTED]>
Signed-off-by: Auke Kok <[EMAIL PROTECTED]>
---

 drivers/net/e1000/e1000_param.c |   21 +
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/drivers/net/e1000/e1000_param.c b/drivers/net/e1000/e1000_param.c
index bd6c040..0ef4131 100644
--- a/drivers/net/e1000/e1000_param.c
+++ b/drivers/net/e1000/e1000_param.c
@@ -202,6 +202,15 @@ E1000_PARAM(InterruptThrottleRate, "Inte
 
 E1000_PARAM(SmartPowerDownEnable, "Enable PHY smart power down");
 
+/* Enable Kumeran Lock Loss workaround
+ *
+ * Valid Range: 0, 1
+ *
+ * Default Value: 1 (enabled)
+ */
+
+E1000_PARAM(KumeranLockLoss, "Enable Kumeran lock loss workaround");
+
 #define AUTONEG_ADV_DEFAULT  0x2F
 #define AUTONEG_ADV_MASK 0x2F
 #define FLOW_CONTROL_DEFAULT FLOW_CONTROL_FULL
@@ -484,6 +493,18 @@ e1000_check_options(struct e1000_adapter
e1000_validate_option(&spd, &opt, adapter);
adapter->smart_power_down = spd;
}
+   { /* Kumeran Lock Loss Workaround */
+   struct e1000_option opt = {
+   .type = enable_option,
+   .name = "Kumeran Lock Loss Workaround",
+   .err  = "defaulting to Enabled",
+   .def  = OPTION_ENABLED
+   };
+
+   int kmrn_lock_loss = KumeranLockLoss[bd];
+   e1000_validate_option(&kmrn_lock_loss, &opt, adapter);
+   adapter->hw.kmrn_lock_loss_workaround_disabled = 
!kmrn_lock_loss;
+   }
 
switch (adapter->hw.media_type) {
case e1000_media_type_fiber:



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


[PATCH 14/21] e1000: M88 PHY workaround

2006-06-21 Thread Kok, Auke

M88 rev 2 PHY needs a longer downshift to function properly. This adds
a much longer downshift counter for this specific device.

Signed-off-by: Jesse Brandeburg <[EMAIL PROTECTED]>
Signed-off-by: Auke Kok <[EMAIL PROTECTED]>
---

 drivers/net/e1000/e1000_hw.c |   46 ++
 drivers/net/e1000/e1000_hw.h |   11 ++
 2 files changed, 40 insertions(+), 17 deletions(-)

diff --git a/drivers/net/e1000/e1000_hw.c b/drivers/net/e1000/e1000_hw.c
index 1c5b184..37eb351 100644
--- a/drivers/net/e1000/e1000_hw.c
+++ b/drivers/net/e1000/e1000_hw.c
@@ -1565,28 +1565,40 @@ e1000_copper_link_mgp_setup(struct e1000
 phy_data &= ~M88E1000_PSCR_POLARITY_REVERSAL;
 if(hw->disable_polarity_correction == 1)
 phy_data |= M88E1000_PSCR_POLARITY_REVERSAL;
-ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, phy_data);
-if(ret_val)
-return ret_val;
-
-/* Force TX_CLK in the Extended PHY Specific Control Register
- * to 25MHz clock.
- */
-ret_val = e1000_read_phy_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, &phy_data);
-if(ret_val)
+ret_val = e1000_write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, phy_data);
+if (ret_val)
 return ret_val;
 
-phy_data |= M88E1000_EPSCR_TX_CLK_25;
-
 if (hw->phy_revision < M88E1011_I_REV_4) {
-/* Configure Master and Slave downshift values */
-phy_data &= ~(M88E1000_EPSCR_MASTER_DOWNSHIFT_MASK |
+/* Force TX_CLK in the Extended PHY Specific Control Register
+ * to 25MHz clock.
+ */
+ret_val = e1000_read_phy_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, 
&phy_data);
+if (ret_val)
+return ret_val;
+
+phy_data |= M88E1000_EPSCR_TX_CLK_25;
+
+if ((hw->phy_revision == E1000_REVISION_2) &&
+(hw->phy_id == M88E_I_PHY_ID)) {
+/* Vidalia Phy, set the downshift counter to 5x */
+phy_data &= ~(M88EC018_EPSCR_DOWNSHIFT_COUNTER_MASK);
+phy_data |= M88EC018_EPSCR_DOWNSHIFT_COUNTER_5X;
+ret_val = e1000_write_phy_reg(hw,
+M88E1000_EXT_PHY_SPEC_CTRL, phy_data);
+if (ret_val)
+return ret_val;
+} else {
+/* Configure Master and Slave downshift values */
+phy_data &= ~(M88E1000_EPSCR_MASTER_DOWNSHIFT_MASK |
   M88E1000_EPSCR_SLAVE_DOWNSHIFT_MASK);
-phy_data |= (M88E1000_EPSCR_MASTER_DOWNSHIFT_1X |
+phy_data |= (M88E1000_EPSCR_MASTER_DOWNSHIFT_1X |
  M88E1000_EPSCR_SLAVE_DOWNSHIFT_1X);
-ret_val = e1000_write_phy_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, 
phy_data);
-if(ret_val)
-return ret_val;
+ret_val = e1000_write_phy_reg(hw,
+M88E1000_EXT_PHY_SPEC_CTRL, phy_data);
+if (ret_val)
+   return ret_val;
+}
 }
 
 /* SW Reset the PHY so all changes take effect */
diff --git a/drivers/net/e1000/e1000_hw.h b/drivers/net/e1000/e1000_hw.h
index 376a2ef..bfbc7d8 100644
--- a/drivers/net/e1000/e1000_hw.h
+++ b/drivers/net/e1000/e1000_hw.h
@@ -2765,6 +2765,17 @@ struct e1000_host_command_info {
 #define M88E1000_EPSCR_TX_CLK_25  0x0070 /* 25  MHz TX_CLK */
 #define M88E1000_EPSCR_TX_CLK_0   0x /* NO  TX_CLK */
 
+/* M88EC018 Rev 2 specific DownShift settings */
+#define M88EC018_EPSCR_DOWNSHIFT_COUNTER_MASK  0x0E00
+#define M88EC018_EPSCR_DOWNSHIFT_COUNTER_1X0x
+#define M88EC018_EPSCR_DOWNSHIFT_COUNTER_2X0x0200
+#define M88EC018_EPSCR_DOWNSHIFT_COUNTER_3X0x0400
+#define M88EC018_EPSCR_DOWNSHIFT_COUNTER_4X0x0600
+#define M88EC018_EPSCR_DOWNSHIFT_COUNTER_5X0x0800
+#define M88EC018_EPSCR_DOWNSHIFT_COUNTER_6X0x0A00
+#define M88EC018_EPSCR_DOWNSHIFT_COUNTER_7X0x0C00
+#define M88EC018_EPSCR_DOWNSHIFT_COUNTER_8X0x0E00
+
 /* IGP01E1000 Specific Port Config Register - R/W */
 #define IGP01E1000_PSCFR_AUTO_MDIX_PAR_DETECT  0x0010
 #define IGP01E1000_PSCFR_PRE_EN0x0020



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


[PATCH 16/21] e1000: disable ERT

2006-06-21 Thread Kok, Auke

Hardware is reported to have problems with ERT. We disable it for
all hardware to make sure we are not seeing unexplainable user
problems.

Signed-off-by: Jesse Brandeburg <[EMAIL PROTECTED]>
Signed-off-by: Auke Kok <[EMAIL PROTECTED]>
---

 drivers/net/e1000/e1000_main.c |3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 7787299..f5689fa 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -1814,9 +1814,6 @@ e1000_configure_rx(struct e1000_adapter 
E1000_WRITE_REG(hw, RXCSUM, rxcsum);
}
 
-   if (hw->mac_type == e1000_82573)
-   E1000_WRITE_REG(hw, ERT, 0x0100);
-
/* Enable Receives */
E1000_WRITE_REG(hw, RCTL, rctl);
 }



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


[PATCH 21/21] e1000: increase version to 7.1.9-k2

2006-06-21 Thread Kok, Auke

Increment the version to 7.1.9-k2

Signed-off-by: Jesse Brandeburg <[EMAIL PROTECTED]>
Signed-off-by: Auke Kok <[EMAIL PROTECTED]>
---

 drivers/net/e1000/e1000_main.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 4fdc564..f238700 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -36,7 +36,7 @@ static char e1000_driver_string[] = "Int
 #else
 #define DRIVERNAPI "-NAPI"
 #endif
-#define DRV_VERSION "7.0.38-k4"DRIVERNAPI
+#define DRV_VERSION "7.1.9-k2"DRIVERNAPI
 char e1000_driver_version[] = DRV_VERSION;
 static char e1000_copyright[] = "Copyright (c) 1999-2006 Intel Corporation.";
 



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


[PATCH 13/21] e1000: add E1000_BIG_ENDIAN symbol

2006-06-21 Thread Kok, Auke

This adds a private symbol to signify endianess in our driver.

Signed-off-by: Jesse Brandeburg <[EMAIL PROTECTED]>
Signed-off-by: Auke Kok <[EMAIL PROTECTED]>
---

 drivers/net/e1000/e1000_hw.h|2 +-
 drivers/net/e1000/e1000_osdep.h |3 +++
 2 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/drivers/net/e1000/e1000_hw.h b/drivers/net/e1000/e1000_hw.h
index 941b47d..376a2ef 100644
--- a/drivers/net/e1000/e1000_hw.h
+++ b/drivers/net/e1000/e1000_hw.h
@@ -351,7 +351,7 @@ struct e1000_host_mng_command_info {
 struct e1000_host_mng_command_header command_header;  /* Command 
Head/Command Result Head has 4 bytes */
 uint8_t command_data[E1000_HI_MAX_MNG_DATA_LENGTH];   /* Command data can 
length 0..0x658*/
 };
-#ifdef __BIG_ENDIAN
+#ifdef E1000_BIG_ENDIAN
 struct e1000_host_mng_dhcp_cookie{
 uint32_t signature;
 uint16_t vlan_id;
diff --git a/drivers/net/e1000/e1000_osdep.h b/drivers/net/e1000/e1000_osdep.h
index 048d052..6130a42 100644
--- a/drivers/net/e1000/e1000_osdep.h
+++ b/drivers/net/e1000/e1000_osdep.h
@@ -83,6 +83,9 @@ typedef enum {
 #define DEBUGOUT3 DEBUGOUT2
 #define DEBUGOUT7 DEBUGOUT3
 
+#ifdef __BIG_ENDIAN
+#define E1000_BIG_ENDIAN __BIG_ENDIAN
+#endif
 
 #define E1000_WRITE_REG(a, reg, value) ( \
 writel((value), ((a)->hw_addr + \



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


[PATCH 10/21] e1000: force register write flushes to circumvent broken platforms

2006-06-21 Thread Kok, Auke

A certain AMD64 bridge (8132) has an option to turn on write combining
which breaks our adapter. To circumvent this we need to flush every write.

Signed-off-by: Jesse Brandeburg <[EMAIL PROTECTED]>
Signed-off-by: Auke Kok <[EMAIL PROTECTED]>
---

 drivers/net/e1000/e1000_hw.c   |   24 ++--
 drivers/net/e1000/e1000_main.c |   18 +++---
 2 files changed, 33 insertions(+), 9 deletions(-)

diff --git a/drivers/net/e1000/e1000_hw.c b/drivers/net/e1000/e1000_hw.c
index 3959039..749d621 100644
--- a/drivers/net/e1000/e1000_hw.c
+++ b/drivers/net/e1000/e1000_hw.c
@@ -705,8 +705,12 @@ e1000_init_hw(struct e1000_hw *hw)
 /* Zero out the Multicast HASH table */
 DEBUGOUT("Zeroing the MTA\n");
 mta_size = E1000_MC_TBL_SIZE;
-for(i = 0; i < mta_size; i++)
+for(i = 0; i < mta_size; i++) {
 E1000_WRITE_REG_ARRAY(hw, MTA, i, 0);
+/* use write flush to prevent Memory Write Block (MWB) from
+ * occuring when accessing our register space */
+E1000_WRITE_FLUSH(hw);
+}
 
 /* Set the PCI priority bit correctly in the CTRL register.  This
  * determines if the adapter gives priority to receives, or if it
@@ -5106,7 +5110,9 @@ e1000_init_rx_addrs(struct e1000_hw *hw)
 DEBUGOUT("Clearing RAR[1-15]\n");
 for(i = 1; i < rar_num; i++) {
 E1000_WRITE_REG_ARRAY(hw, RA, (i << 1), 0);
+E1000_WRITE_FLUSH(hw);
 E1000_WRITE_REG_ARRAY(hw, RA, ((i << 1) + 1), 0);
+E1000_WRITE_FLUSH(hw);
 }
 }
 
@@ -5153,7 +5159,9 @@ e1000_mc_addr_list_update(struct e1000_h
 
 for(i = rar_used_count; i < num_rar_entry; i++) {
 E1000_WRITE_REG_ARRAY(hw, RA, (i << 1), 0);
+E1000_WRITE_FLUSH(hw);
 E1000_WRITE_REG_ARRAY(hw, RA, ((i << 1) + 1), 0);
+E1000_WRITE_FLUSH(hw);
 }
 
 /* Clear the MTA */
@@ -5161,6 +5169,7 @@ e1000_mc_addr_list_update(struct e1000_h
 num_mta_entry = E1000_NUM_MTA_REGISTERS;
 for(i = 0; i < num_mta_entry; i++) {
 E1000_WRITE_REG_ARRAY(hw, MTA, i, 0);
+E1000_WRITE_FLUSH(hw);
 }
 
 /* Add the new addresses */
@@ -5275,9 +5284,12 @@ e1000_mta_set(struct e1000_hw *hw,
 if((hw->mac_type == e1000_82544) && ((hash_reg & 0x1) == 1)) {
 temp = E1000_READ_REG_ARRAY(hw, MTA, (hash_reg - 1));
 E1000_WRITE_REG_ARRAY(hw, MTA, hash_reg, mta);
+E1000_WRITE_FLUSH(hw);
 E1000_WRITE_REG_ARRAY(hw, MTA, (hash_reg - 1), temp);
+E1000_WRITE_FLUSH(hw);
 } else {
 E1000_WRITE_REG_ARRAY(hw, MTA, hash_reg, mta);
+E1000_WRITE_FLUSH(hw);
 }
 }
 
@@ -5334,7 +5346,9 @@ e1000_rar_set(struct e1000_hw *hw,
 }
 
 E1000_WRITE_REG_ARRAY(hw, RA, (index << 1), rar_low);
+E1000_WRITE_FLUSH(hw);
 E1000_WRITE_REG_ARRAY(hw, RA, ((index << 1) + 1), rar_high);
+E1000_WRITE_FLUSH(hw);
 }
 
 /**
@@ -5354,9 +5368,12 @@ e1000_write_vfta(struct e1000_hw *hw,
 if((hw->mac_type == e1000_82544) && ((offset & 0x1) == 1)) {
 temp = E1000_READ_REG_ARRAY(hw, VFTA, (offset - 1));
 E1000_WRITE_REG_ARRAY(hw, VFTA, offset, value);
+E1000_WRITE_FLUSH(hw);
 E1000_WRITE_REG_ARRAY(hw, VFTA, (offset - 1), temp);
+E1000_WRITE_FLUSH(hw);
 } else {
 E1000_WRITE_REG_ARRAY(hw, VFTA, offset, value);
+E1000_WRITE_FLUSH(hw);
 }
 }
 
@@ -5392,6 +5409,7 @@ e1000_clear_vfta(struct e1000_hw *hw)
  * manageability unit */
 vfta_value = (offset == vfta_offset) ? vfta_bit_in_reg : 0;
 E1000_WRITE_REG_ARRAY(hw, VFTA, offset, vfta_value);
+E1000_WRITE_FLUSH(hw);
 }
 }
 
@@ -6928,8 +6946,10 @@ e1000_mng_write_cmd_header(struct e1000_
 
 length >>= 2;
 /* The device driver writes the relevant command block into the ram area. 
*/
-for (i = 0; i < length; i++)
+for (i = 0; i < length; i++) {
 E1000_WRITE_REG_ARRAY_DWORD(hw, HOST_IF, i, *((uint32_t *) hdr + i));
+E1000_WRITE_FLUSH(hw);
+}
 
 return E1000_SUCCESS;
 }
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index c58fafd..c44ed6f 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -1370,11 +1370,11 @@ e1000_configure_tx(struct e1000_adapter 
tdba = adapter->tx_ring[0].dma;
tdlen = adapter->tx_ring[0].count *
sizeof(struct e1000_tx_desc);
-   E1000_WRITE_REG(hw, TDBAL, (tdba & 0xULL));
-   E1000_WRITE_REG(hw, TDBAH, (tdba >> 32));
E1000_WRITE_REG(hw, TDLEN, tdlen);
-   E1000_WRITE_REG(hw, TDH, 0);
+   E1000_WRITE_REG(hw, TDBAH, (tdba >> 32));
+   E1000_WRITE_REG(hw, TDBAL, (tdba & 0xULL));
E1000_WRITE_REG(hw, TDT, 0);
+   E1000_WRITE_REG(hw, TDH, 0);
adapter->tx_ring[0].tdh = E1000_TDH;

[PATCH 12/21] e1000: fix adapter led blinking inconsistency

2006-06-21 Thread Kok, Auke

Several e1000 adapters were not blinking correctly or inconsistently. This
patch cleans this up and makes them all behave the same as far as possible.

Signed-off-by: Jeff Kirsher <[EMAIL PROTECTED]>
Signed-off-by: Auke Kok <[EMAIL PROTECTED]>
---

 drivers/net/e1000/e1000_ethtool.c |   15 +--
 drivers/net/e1000/e1000_hw.c  |   38 +
 drivers/net/e1000/e1000_hw.h  |1 +
 3 files changed, 40 insertions(+), 14 deletions(-)

diff --git a/drivers/net/e1000/e1000_ethtool.c 
b/drivers/net/e1000/e1000_ethtool.c
index cf5c5f4..0609155 100644
--- a/drivers/net/e1000/e1000_ethtool.c
+++ b/drivers/net/e1000/e1000_ethtool.c
@@ -1786,21 +1786,8 @@ e1000_phys_id(struct net_device *netdev,
mod_timer(&adapter->blink_timer, jiffies);
msleep_interruptible(data * 1000);
del_timer_sync(&adapter->blink_timer);
-   } else if (adapter->hw.mac_type < e1000_82573) {
-   E1000_WRITE_REG(&adapter->hw, LEDCTL,
-   (E1000_LEDCTL_LED2_BLINK_RATE |
-E1000_LEDCTL_LED0_BLINK | E1000_LEDCTL_LED2_BLINK |
-(E1000_LEDCTL_MODE_LED_ON << 
E1000_LEDCTL_LED2_MODE_SHIFT) |
-(E1000_LEDCTL_MODE_LINK_ACTIVITY << 
E1000_LEDCTL_LED0_MODE_SHIFT) |
-(E1000_LEDCTL_MODE_LED_OFF << 
E1000_LEDCTL_LED1_MODE_SHIFT)));
-   msleep_interruptible(data * 1000);
} else {
-   E1000_WRITE_REG(&adapter->hw, LEDCTL,
-   (E1000_LEDCTL_LED2_BLINK_RATE |
-E1000_LEDCTL_LED1_BLINK | E1000_LEDCTL_LED2_BLINK |
-(E1000_LEDCTL_MODE_LED_ON << 
E1000_LEDCTL_LED2_MODE_SHIFT) |
-(E1000_LEDCTL_MODE_LINK_ACTIVITY << 
E1000_LEDCTL_LED1_MODE_SHIFT) |
-(E1000_LEDCTL_MODE_LED_OFF << 
E1000_LEDCTL_LED0_MODE_SHIFT)));
+   e1000_blink_led_start(&adapter->hw);
msleep_interruptible(data * 1000);
}
 
diff --git a/drivers/net/e1000/e1000_hw.c b/drivers/net/e1000/e1000_hw.c
index 749d621..1c5b184 100644
--- a/drivers/net/e1000/e1000_hw.c
+++ b/drivers/net/e1000/e1000_hw.c
@@ -5537,6 +5537,44 @@ e1000_setup_led(struct e1000_hw *hw)
 }
 
 /**
+ * Used on 82571 and later Si that has LED blink bits.
+ * Callers must use their own timer and should have already called
+ * e1000_id_led_init()
+ * Call e1000_cleanup led() to stop blinking
+ *
+ * hw - Struct containing variables accessed by shared code
+ */
+int32_t
+e1000_blink_led_start(struct e1000_hw *hw)
+{
+int16_t  i;
+uint32_t ledctl_blink = 0;
+
+DEBUGFUNC("e1000_id_led_blink_on");
+
+if (hw->mac_type < e1000_82571) {
+/* Nothing to do */
+return E1000_SUCCESS;
+}
+if (hw->media_type == e1000_media_type_fiber) {
+/* always blink LED0 for PCI-E fiber */
+ledctl_blink = E1000_LEDCTL_LED0_BLINK |
+ (E1000_LEDCTL_MODE_LED_ON << 
E1000_LEDCTL_LED0_MODE_SHIFT);
+} else {
+/* set the blink bit for each LED that's "on" (0x0E) in ledctl_mode2 */
+ledctl_blink = hw->ledctl_mode2;
+for (i=0; i < 4; i++)
+if (((hw->ledctl_mode2 >> (i * 8)) & 0xFF) ==
+E1000_LEDCTL_MODE_LED_ON)
+ledctl_blink |= (E1000_LEDCTL_LED0_BLINK << (i * 8));
+}
+
+E1000_WRITE_REG(hw, LEDCTL, ledctl_blink);
+
+return E1000_SUCCESS;
+}
+
+/**
  * Restores the saved state of the SW controlable LED.
  *
  * hw - Struct containing variables accessed by shared code
diff --git a/drivers/net/e1000/e1000_hw.h b/drivers/net/e1000/e1000_hw.h
index 467c9ed..941b47d 100644
--- a/drivers/net/e1000/e1000_hw.h
+++ b/drivers/net/e1000/e1000_hw.h
@@ -401,6 +401,7 @@ int32_t e1000_setup_led(struct e1000_hw 
 int32_t e1000_cleanup_led(struct e1000_hw *hw);
 int32_t e1000_led_on(struct e1000_hw *hw);
 int32_t e1000_led_off(struct e1000_hw *hw);
+int32_t e1000_blink_led_start(struct e1000_hw *hw);
 
 /* Adaptive IFS Functions */
 



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


[PATCH 02/21] e1000: rework driver hardware reset locking

2006-06-21 Thread Kok, Auke

After studying the driver mac reset code it was found that there
were multiple race conditions possible to reset the unit twice or
bring it e1000_up() double. This fixes all occurences where the
driver needs to reset the mac.

We also remove irq requesting/releasing into _open and _close so
that while the device is _up we will never touch the irq's. This fixes
the double free irq bug that people saw.

To make sure that the watchdog task doesn't cause another race we let
it run as a non-scheduled task.

Signed-off-by: Jesse Brandeburg <[EMAIL PROTECTED]>
Signed-off-by: Auke Kok <[EMAIL PROTECTED]>
---

 drivers/net/e1000/e1000.h |8 ++
 drivers/net/e1000/e1000_ethtool.c |   46 --
 drivers/net/e1000/e1000_main.c|  126 +
 3 files changed, 105 insertions(+), 75 deletions(-)

diff --git a/drivers/net/e1000/e1000.h b/drivers/net/e1000/e1000.h
index 2bc34fb..2b96ad0 100644
--- a/drivers/net/e1000/e1000.h
+++ b/drivers/net/e1000/e1000.h
@@ -69,7 +69,6 @@
 #ifdef NETIF_F_TSO
 #include 
 #endif
-#include 
 #include 
 #include 
 #include 
@@ -255,7 +254,6 @@ struct e1000_adapter {
spinlock_t tx_queue_lock;
 #endif
atomic_t irq_sem;
-   struct work_struct watchdog_task;
struct work_struct reset_task;
uint8_t fc_autoneg;
 
@@ -340,8 +338,13 @@ struct e1000_adapter {
 #ifdef NETIF_F_TSO
boolean_t tso_force;
 #endif
+   unsigned long flags;
 };
 
+enum e1000_state_t {
+   __E1000_DRIVER_TESTING,
+   __E1000_RESETTING,
+};
 
 /*  e1000_main.c  */
 extern char e1000_driver_name[];
@@ -349,6 +352,7 @@ extern char e1000_driver_version[];
 int e1000_up(struct e1000_adapter *adapter);
 void e1000_down(struct e1000_adapter *adapter);
 void e1000_reset(struct e1000_adapter *adapter);
+void e1000_reinit_locked(struct e1000_adapter *adapter);
 int e1000_setup_all_tx_resources(struct e1000_adapter *adapter);
 void e1000_free_all_tx_resources(struct e1000_adapter *adapter);
 int e1000_setup_all_rx_resources(struct e1000_adapter *adapter);
diff --git a/drivers/net/e1000/e1000_ethtool.c 
b/drivers/net/e1000/e1000_ethtool.c
index 845d293..cf5c5f4 100644
--- a/drivers/net/e1000/e1000_ethtool.c
+++ b/drivers/net/e1000/e1000_ethtool.c
@@ -203,11 +203,9 @@ e1000_set_settings(struct net_device *ne
 
/* reset the link */
 
-   if (netif_running(adapter->netdev)) {
-   e1000_down(adapter);
-   e1000_reset(adapter);
-   e1000_up(adapter);
-   } else
+   if (netif_running(adapter->netdev))
+   e1000_reinit_locked(adapter);
+   else
e1000_reset(adapter);
 
return 0;
@@ -254,10 +252,9 @@ e1000_set_pauseparam(struct net_device *
hw->original_fc = hw->fc;
 
if (adapter->fc_autoneg == AUTONEG_ENABLE) {
-   if (netif_running(adapter->netdev)) {
-   e1000_down(adapter);
-   e1000_up(adapter);
-   } else
+   if (netif_running(adapter->netdev))
+   e1000_reinit_locked(adapter);
+   else
e1000_reset(adapter);
} else
return ((hw->media_type == e1000_media_type_fiber) ?
@@ -279,10 +276,9 @@ e1000_set_rx_csum(struct net_device *net
struct e1000_adapter *adapter = netdev_priv(netdev);
adapter->rx_csum = data;
 
-   if (netif_running(netdev)) {
-   e1000_down(adapter);
-   e1000_up(adapter);
-   } else
+   if (netif_running(netdev))
+   e1000_reinit_locked(adapter);
+   else
e1000_reset(adapter);
return 0;
 }
@@ -631,6 +627,9 @@ e1000_set_ringparam(struct net_device *n
tx_ring_size = sizeof(struct e1000_tx_ring) * adapter->num_tx_queues;
rx_ring_size = sizeof(struct e1000_rx_ring) * adapter->num_rx_queues;
 
+   while (test_and_set_bit(__E1000_RESETTING, &adapter->flags))
+   msleep(1);
+
if (netif_running(adapter->netdev))
e1000_down(adapter);
 
@@ -691,9 +690,11 @@ e1000_set_ringparam(struct net_device *n
adapter->rx_ring = rx_new;
adapter->tx_ring = tx_new;
if ((err = e1000_up(adapter)))
-   return err;
+   goto err_setup;
}
 
+   clear_bit(__E1000_RESETTING, &adapter->flags);
+
return 0;
 err_setup_tx:
e1000_free_all_rx_resources(adapter);
@@ -701,6 +702,8 @@ err_setup_rx:
adapter->rx_ring = rx_old;
adapter->tx_ring = tx_old;
e1000_up(adapter);
+err_setup:
+   clear_bit(__E1000_RESETTING, &adapter->flags);
return err;
 }
 
@@ -1568,6 +1571,7 @@ e1000_diag_test(struct net_device *netde
struct e1000_adapter *adapter = netdev_priv(netdev);
boolean_t if_running = netif_running(netdev);
 
+   set_bit(__E1000_DRIVER_TESTING, &adapter->flags);
if (eth_test->fl

[PATCH 07/21] e1000: change printk into DPRINTK

2006-06-21 Thread Kok, Auke

Changing a printk message to make clear that this message is originating
from e1000.

Signed-off-by: Jesse Brandeburg <[EMAIL PROTECTED]>
Signed-off-by: Auke Kok <[EMAIL PROTECTED]>
---

 drivers/net/e1000/e1000_main.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index ea18f30..fc39cbc 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -2841,7 +2841,7 @@ e1000_xmit_frame(struct sk_buff *skb, st
case e1000_82573:
pull_size = min((unsigned int)4, skb->data_len);
if (!__pskb_pull_tail(skb, pull_size)) {
-   printk(KERN_ERR
+   DPRINTK(DRV, ERR,
"__pskb_pull_tail failed.\n");
dev_kfree_skb_any(skb);
return NETDEV_TX_OK;



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


[PATCH 08/21] e1000: recycle skb

2006-06-21 Thread Kok, Auke

Recycle an skb to improve performance a bit.

Signed-off-by: Jesse Brandeburg <[EMAIL PROTECTED]>
Signed-off-by: Auke Kok <[EMAIL PROTECTED]>
---

 drivers/net/e1000/e1000_main.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index fc39cbc..c58fafd 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -3604,7 +3604,8 @@ e1000_clean_rx_irq(struct e1000_adapter 
/* All receives must fit into a single buffer */
E1000_DBG("%s: Receive packet consumed multiple"
  " buffers\n", netdev->name);
-   dev_kfree_skb_irq(skb);
+   /* recycle */
+   buffer_info-> skb = skb;
goto next_desc;
}
 



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


[PATCH 05/21] e1000: small performance tweak by removing double code

2006-06-21 Thread Kok, Auke

buffer_info is already filled at the end of this while() loop.

Signed-off-by: Jesse Brandeburg <[EMAIL PROTECTED]>
Signed-off-by: Auke Kok <[EMAIL PROTECTED]>
---

 drivers/net/e1000/e1000_main.c |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 7cf5e5d..76e36a4 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -3717,7 +3717,6 @@ e1000_clean_rx_irq_ps(struct e1000_adapt
buffer_info = &rx_ring->buffer_info[i];
 
while (staterr & E1000_RXD_STAT_DD) {
-   buffer_info = &rx_ring->buffer_info[i];
ps_page = &rx_ring->ps_page[i];
ps_page_dma = &rx_ring->ps_page_dma[i];
 #ifdef CONFIG_E1000_NAPI



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


[PATCH 01/21] e1000: fix loopback ethtool test

2006-06-21 Thread Kok, Auke

Ethtool was reporting that loopback failed randomly on esb2
systems. Upon study it was found that the phy manual was changed
with respect to the loopback mode bits. The new value fixes it.

Signed-off-by: Jesse Brandeburg <[EMAIL PROTECTED]>
Signed-off-by: Auke Kok <[EMAIL PROTECTED]>
---

 drivers/net/e1000/e1000_ethtool.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/e1000/e1000_ethtool.c 
b/drivers/net/e1000/e1000_ethtool.c
index 6ed7f59..845d293 100644
--- a/drivers/net/e1000/e1000_ethtool.c
+++ b/drivers/net/e1000/e1000_ethtool.c
@@ -1246,7 +1246,7 @@ e1000_integrated_phy_loopback(struct e10
} else if (adapter->hw.phy_type == e1000_phy_gg82563) {
e1000_write_phy_reg(&adapter->hw,
GG82563_PHY_KMRN_MODE_CTRL,
-   0x1CE);
+   0x1CC);
}
/* force 1000, set loopback */
e1000_write_phy_reg(&adapter->hw, PHY_CTRL, 0x4140);



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


[PATCH 00/21] e1000: driver update to 7.1.9-k2

2006-06-21 Thread Kok, Auke

Hi,

A large number of e1000 patches this update, including the release of
the integrated NIC in the ICH8 motherboard chipset, which has been
officially released into the public. Also known as i965, the lan
chipset on this motherboard is fully supported by this driver.

The motherboard actually comes with two different PHY's, one that
supports gigabit speeds and one that only does 10/100. This driver
supports both of them.

All of these changes correspond with the 7.1.9 release on SF this
week, and have been tested and validated by our team, who did and
an excellent job ;^).

Furthermore, the patches included also fixes included in the 7.0.38
and 7.0.41 releases, which were not yet merged into the kernel. This
patch series brings the kernel driver up to current.


---

Summary of patches:

[01]: fix loopback ethtool test
[02]: rework driver hardware reset locking
[03]: Make PHY powerup/down a function
[04]: fix CONFIG_PM blocks
[05]: small performance tweak by removing double code
[06]: add smart power down code
[07]: change printk into DPRINTK
[08]: recycle skb
[09]: rework module param code with uninitialized values
[10]: force register write flushes to circumvent broken platforms
[11]: disable CRC stripping workaround
[12]: fix adapter led blinking inconsistency
[13]: add E1000_BIG_ENDIAN symbol
[14]: M88 PHY workaround
[15]: check return value of _get_speed_and_duplex
[16]: disable ERT
[17]: add ich8lan core functions
[18]: integrate ich8 support into driver
[19]: allow user to disable ich8 lock loss workaround
[20]: add ich8lan device ID's
[21]: increase version to 7.1.9-k2


---

Since these patches are rather large together, they are also available
over http here:
http://foo-projects.org/~sofar/e1000-7.1.9-k2/
And in a tarball:
http://foo-projects.org/~sofar/e1000-7.1.9-k2/e1000-patches-7.1.9-k2.tar.bz2
---

Jeff, please pull from our git repository:

git://lost.foo-projects.org/~ahkok/git/netdev-2.6 upstream


These patches are against
netdev-2.6#upstream 612eff0e3715a6faff5ba1b74873b99e036c59fe
(Brian Haley <[EMAIL PROTECTED]> / [PATCH] s2io: netpoll support)

Cheers,

Auke


---
 drivers/net/e1000/e1000.h |   10 
 drivers/net/e1000/e1000_ethtool.c |  143 +--
 drivers/net/e1000/e1000_hw.c  | 1770 +++---
 drivers/net/e1000/e1000_hw.h  |  400 
 drivers/net/e1000/e1000_main.c|  386 +---
 drivers/net/e1000/e1000_osdep.h   |   16 
 drivers/net/e1000/e1000_param.c   |  213 ++--
 7 files changed, 2539 insertions(+), 399 deletions(-)


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


[PATCH 03/21] e1000: Make PHY powerup/down a function

2006-06-21 Thread Kok, Auke

In relation to the irq work done earlier we also move the PHY powerup
and powerdown functions into separate functions and move the calls to
_close and _open, making the PHY stay in it's power state as long as
the device is _up.

Signed-off-by: Jesse Brandeburg <[EMAIL PROTECTED]>
Signed-off-by: Auke Kok <[EMAIL PROTECTED]>
---

 drivers/net/e1000/e1000_main.c |   76 ++--
 1 files changed, 49 insertions(+), 27 deletions(-)

diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 52d698b..813d5e0 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -428,14 +428,6 @@ e1000_up(struct e1000_adapter *adapter)
 
/* hardware has been reset, we need to reload some things */
 
-   /* Reset the PHY if it was previously powered down */
-   if (adapter->hw.media_type == e1000_media_type_copper) {
-   uint16_t mii_reg;
-   e1000_read_phy_reg(&adapter->hw, PHY_CTRL, &mii_reg);
-   if (mii_reg & MII_CR_POWER_DOWN)
-   e1000_phy_hw_reset(&adapter->hw);
-   }
-
e1000_set_multi(netdev);
 
e1000_restore_vlan(adapter);
@@ -464,12 +456,56 @@ e1000_up(struct e1000_adapter *adapter)
return 0;
 }
 
+/**
+ * e1000_power_up_phy - restore link in case the phy was powered down
+ * @adapter: address of board private structure
+ *
+ * The phy may be powered down to save power and turn off link when the
+ * driver is unloaded and wake on lan is not enabled (among others)
+ * *** this routine MUST be followed by a call to e1000_reset ***
+ *
+ **/
+
+static void e1000_power_up_phy(struct e1000_adapter *adapter)
+{
+   uint16_t mii_reg = 0;
+
+   /* Just clear the power down bit to wake the phy back up */
+   if (adapter->hw.media_type == e1000_media_type_copper) {
+   /* according to the manual, the phy will retain its
+* settings across a power-down/up cycle */
+   e1000_read_phy_reg(&adapter->hw, PHY_CTRL, &mii_reg);
+   mii_reg &= ~MII_CR_POWER_DOWN;
+   e1000_write_phy_reg(&adapter->hw, PHY_CTRL, mii_reg);
+   }
+}
+
+static void e1000_power_down_phy(struct e1000_adapter *adapter)
+{
+   boolean_t mng_mode_enabled = (adapter->hw.mac_type >= e1000_82571) &&
+ e1000_check_mng_mode(&adapter->hw);
+   /* Power down the PHY so no link is implied when interface is down
+* The PHY cannot be powered down if any of the following is TRUE
+* (a) WoL is enabled
+* (b) AMT is active
+* (c) SoL/IDER session is active */
+   if (!adapter->wol && adapter->hw.mac_type >= e1000_82540 &&
+   adapter->hw.media_type == e1000_media_type_copper &&
+   !(E1000_READ_REG(&adapter->hw, MANC) & E1000_MANC_SMBUS_EN) &&
+   !mng_mode_enabled &&
+   !e1000_check_phy_reset_block(&adapter->hw)) {
+   uint16_t mii_reg = 0;
+   e1000_read_phy_reg(&adapter->hw, PHY_CTRL, &mii_reg);
+   mii_reg |= MII_CR_POWER_DOWN;
+   e1000_write_phy_reg(&adapter->hw, PHY_CTRL, mii_reg);
+   mdelay(1);
+   }
+}
+
 void
 e1000_down(struct e1000_adapter *adapter)
 {
struct net_device *netdev = adapter->netdev;
-   boolean_t mng_mode_enabled = (adapter->hw.mac_type >= e1000_82571) &&
- e1000_check_mng_mode(&adapter->hw);
 
e1000_irq_disable(adapter);
 
@@ -489,23 +525,6 @@ e1000_down(struct e1000_adapter *adapter
e1000_reset(adapter);
e1000_clean_all_tx_rings(adapter);
e1000_clean_all_rx_rings(adapter);
-
-   /* Power down the PHY so no link is implied when interface is down *
-* The PHY cannot be powered down if any of the following is TRUE *
-* (a) WoL is enabled
-* (b) AMT is active
-* (c) SoL/IDER session is active */
-   if (!adapter->wol && adapter->hw.mac_type >= e1000_82540 &&
-  adapter->hw.media_type == e1000_media_type_copper &&
-  !(E1000_READ_REG(&adapter->hw, MANC) & E1000_MANC_SMBUS_EN) &&
-  !mng_mode_enabled &&
-  !e1000_check_phy_reset_block(&adapter->hw)) {
-   uint16_t mii_reg;
-   e1000_read_phy_reg(&adapter->hw, PHY_CTRL, &mii_reg);
-   mii_reg |= MII_CR_POWER_DOWN;
-   e1000_write_phy_reg(&adapter->hw, PHY_CTRL, mii_reg);
-   mdelay(1);
-   }
 }
 
 void
@@ -1117,6 +1136,8 @@ e1000_open(struct net_device *netdev)
if (err)
goto err_up;
 
+   e1000_power_up_phy(adapter);
+
if ((err = e1000_up(adapter)))
goto err_up;
adapter->mng_vlan_id = E1000_MNG_VLAN_NONE;
@@ -1162,6 +1183,7 @@ e1000_close(struct net_device *netdev)
 
WARN_ON(test_bit(__E1000_RESETTING, &adapter->flags));
e1000_down(adapter);
+   e1000_power_down_phy(adapter);
  

[PATCH 06/21] e1000: add smart power down code

2006-06-21 Thread Kok, Auke

Smart Power Down is a power saving feature in newer e1000 hardware. We
disable it because it causes time to link to be long, but make it a
user choice.

Signed-off-by: Jesse Brandeburg <[EMAIL PROTECTED]>
Signed-off-by: Auke Kok <[EMAIL PROTECTED]>
---

 drivers/net/e1000/e1000.h   |1 +
 drivers/net/e1000/e1000_main.c  |   15 +++
 drivers/net/e1000/e1000_param.c |   25 +
 3 files changed, 41 insertions(+), 0 deletions(-)

diff --git a/drivers/net/e1000/e1000.h b/drivers/net/e1000/e1000.h
index 2b96ad0..dbdaa33 100644
--- a/drivers/net/e1000/e1000.h
+++ b/drivers/net/e1000/e1000.h
@@ -338,6 +338,7 @@ struct e1000_adapter {
 #ifdef NETIF_F_TSO
boolean_t tso_force;
 #endif
+   boolean_t smart_power_down; /* phy smart power down */
unsigned long flags;
 };
 
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 76e36a4..ea18f30 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -607,6 +607,21 @@ e1000_reset(struct e1000_adapter *adapte
 
e1000_reset_adaptive(&adapter->hw);
e1000_phy_get_info(&adapter->hw, &adapter->phy_info);
+
+   if (!adapter->smart_power_down &&
+   (adapter->hw.mac_type == e1000_82571 ||
+adapter->hw.mac_type == e1000_82572)) {
+   uint16_t phy_data = 0;
+   /* speed up time to link by disabling smart power down, ignore
+* the return value of this function because there is nothing
+* different we would do if it failed */
+   e1000_read_phy_reg(&adapter->hw, IGP02E1000_PHY_POWER_MGMT,
+  &phy_data);
+   phy_data &= ~IGP02E1000_PM_SPD;
+   e1000_write_phy_reg(&adapter->hw, IGP02E1000_PHY_POWER_MGMT,
+   phy_data);
+   }
+
if (adapter->en_mng_pt) {
manc = E1000_READ_REG(&adapter->hw, MANC);
manc |= (E1000_MANC_ARP_EN | E1000_MANC_EN_MNG2HOST);
diff --git a/drivers/net/e1000/e1000_param.c b/drivers/net/e1000/e1000_param.c
index e55f896..a8d9295 100644
--- a/drivers/net/e1000/e1000_param.c
+++ b/drivers/net/e1000/e1000_param.c
@@ -183,6 +183,15 @@ E1000_PARAM(RxAbsIntDelay, "Receive Abso
 
 E1000_PARAM(InterruptThrottleRate, "Interrupt Throttling Rate");
 
+/* Enable Smart Power Down of the PHY
+ *
+ * Valid Range: 0, 1
+ *
+ * Default Value: 0 (disabled)
+ */
+
+E1000_PARAM(SmartPowerDownEnable, "Enable PHY smart power down");
+
 #define AUTONEG_ADV_DEFAULT  0x2F
 #define AUTONEG_ADV_MASK 0x2F
 #define FLOW_CONTROL_DEFAULT FLOW_CONTROL_FULL
@@ -494,6 +503,22 @@ e1000_check_options(struct e1000_adapter
adapter->itr = opt.def;
}
}
+   { /* Smart Power Down */
+   struct e1000_option opt = {
+   .type = enable_option,
+   .name = "PHY Smart Power Down",
+   .err  = "defaulting to Disabled",
+   .def  = OPTION_DISABLED
+   };
+
+   if (num_SmartPowerDownEnable > bd) {
+   int spd = SmartPowerDownEnable[bd];
+   e1000_validate_option(&spd, &opt, adapter);
+   adapter->smart_power_down = spd;
+   } else {
+   adapter->smart_power_down = opt.def;
+   }
+   }
 
switch (adapter->hw.media_type) {
case e1000_media_type_fiber:



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


[PATCH 09/21] e1000: rework module param code with uninitialized values

2006-06-21 Thread Kok, Auke

We can take uninitialized values into account which minimizes code
and allows us to simplify the parameter checking code greatly.

Signed-off-by: Jesse Brandeburg <[EMAIL PROTECTED]>
Signed-off-by: Auke Kok <[EMAIL PROTECTED]>
---

 drivers/net/e1000/e1000_param.c |  167 ++-
 1 files changed, 61 insertions(+), 106 deletions(-)

diff --git a/drivers/net/e1000/e1000_param.c b/drivers/net/e1000/e1000_param.c
index a8d9295..bd6c040 100644
--- a/drivers/net/e1000/e1000_param.c
+++ b/drivers/net/e1000/e1000_param.c
@@ -45,6 +45,16 @@
  */
 
 #define E1000_PARAM_INIT { [0 ... E1000_MAX_NIC] = OPTION_UNSET }
+/* Module Parameters are always initialized to -1, so that the driver
+ * can tell the difference between no user specified value or the
+ * user asking for the default value.
+ * The true default values are loaded in when e1000_check_options is called.
+ *
+ * This is a GCC extension to ANSI C.
+ * See the item "Labeled Elements in Initializers" in the section
+ * "Extensions to the C Language Family" of the GCC documentation.
+ */
+
 #define E1000_PARAM(X, desc) \
static int __devinitdata X[E1000_MAX_NIC+1] = E1000_PARAM_INIT; \
static int num_##X = 0; \
@@ -305,6 +315,7 @@ e1000_check_options(struct e1000_adapter
DPRINTK(PROBE, NOTICE,
   "Warning: no configuration for board #%i\n", bd);
DPRINTK(PROBE, NOTICE, "Using defaults for all values\n");
+   bd = E1000_MAX_NIC;
}
 
{ /* Transmit Descriptor Count */
@@ -322,14 +333,9 @@ e1000_check_options(struct e1000_adapter
opt.arg.r.max = mac_type < e1000_82544 ?
E1000_MAX_TXD : E1000_MAX_82544_TXD;
 
-   if (num_TxDescriptors > bd) {
-   tx_ring->count = TxDescriptors[bd];
-   e1000_validate_option(&tx_ring->count, &opt, adapter);
-   E1000_ROUNDUP(tx_ring->count,
-   REQ_TX_DESCRIPTOR_MULTIPLE);
-   } else {
-   tx_ring->count = opt.def;
-   }
+   tx_ring->count = TxDescriptors[bd];
+   e1000_validate_option(&tx_ring->count, &opt, adapter);
+   E1000_ROUNDUP(tx_ring->count, REQ_TX_DESCRIPTOR_MULTIPLE);
for (i = 0; i < adapter->num_tx_queues; i++)
tx_ring[i].count = tx_ring->count;
}
@@ -348,14 +354,9 @@ e1000_check_options(struct e1000_adapter
opt.arg.r.max = mac_type < e1000_82544 ? E1000_MAX_RXD :
E1000_MAX_82544_RXD;
 
-   if (num_RxDescriptors > bd) {
-   rx_ring->count = RxDescriptors[bd];
-   e1000_validate_option(&rx_ring->count, &opt, adapter);
-   E1000_ROUNDUP(rx_ring->count,
-   REQ_RX_DESCRIPTOR_MULTIPLE);
-   } else {
-   rx_ring->count = opt.def;
-   }
+   rx_ring->count = RxDescriptors[bd];
+   e1000_validate_option(&rx_ring->count, &opt, adapter);
+   E1000_ROUNDUP(rx_ring->count, REQ_RX_DESCRIPTOR_MULTIPLE);
for (i = 0; i < adapter->num_rx_queues; i++)
rx_ring[i].count = rx_ring->count;
}
@@ -367,13 +368,9 @@ e1000_check_options(struct e1000_adapter
.def  = OPTION_ENABLED
};
 
-   if (num_XsumRX > bd) {
-   int rx_csum = XsumRX[bd];
-   e1000_validate_option(&rx_csum, &opt, adapter);
-   adapter->rx_csum = rx_csum;
-   } else {
-   adapter->rx_csum = opt.def;
-   }
+   int rx_csum = XsumRX[bd];
+   e1000_validate_option(&rx_csum, &opt, adapter);
+   adapter->rx_csum = rx_csum;
}
{ /* Flow Control */
 
@@ -393,13 +390,9 @@ e1000_check_options(struct e1000_adapter
 .p = fc_list }}
};
 
-   if (num_FlowControl > bd) {
-   int fc = FlowControl[bd];
-   e1000_validate_option(&fc, &opt, adapter);
-   adapter->hw.fc = adapter->hw.original_fc = fc;
-   } else {
-   adapter->hw.fc = adapter->hw.original_fc = opt.def;
-   }
+   int fc = FlowControl[bd];
+   e1000_validate_option(&fc, &opt, adapter);
+   adapter->hw.fc = adapter->hw.original_fc = fc;
}
{ /* Transmit Interrupt Delay */
struct e1000_option opt = {
@@ -411,13 +404,8 @@ e1000_check_options(struct e1000_adapter
 .max = MAX_TXDELAY }}
};
 
-   if (num_TxIntDelay > bd) {
-   adapte

[PATCH 11/21] e1000: disable CRC stripping workaround

2006-06-21 Thread Kok, Auke

CRC stripping is breaking SMBUS-connected BMC's. We disable this
feature to make it work. This fixes related bugs regarding SOL.

Signed-off-by: Jesse Brandeburg <[EMAIL PROTECTED]>
Signed-off-by: Auke Kok <[EMAIL PROTECTED]>
---

 drivers/net/e1000/e1000_main.c |7 ++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index c44ed6f..7787299 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -1628,8 +1628,11 @@ e1000_setup_rctl(struct e1000_adapter *a
E1000_RCTL_LBM_NO | E1000_RCTL_RDMTS_HALF |
(adapter->hw.mc_filter_type << E1000_RCTL_MO_SHIFT);
 
+   /* disable hardware stripping of CRC because it breaks
+* BMC firmware connected over SMBUS
if (adapter->hw.mac_type > e1000_82543)
rctl |= E1000_RCTL_SECRC;
+*/
 
if (adapter->hw.tbi_compatibility_on == 1)
rctl |= E1000_RCTL_SBP;
@@ -1696,7 +1699,9 @@ e1000_setup_rctl(struct e1000_adapter *a
rfctl |= E1000_RFCTL_IPV6_DIS;
E1000_WRITE_REG(&adapter->hw, RFCTL, rfctl);
 
-   rctl |= E1000_RCTL_DTYP_PS | E1000_RCTL_SECRC;
+   /* disable the stripping of CRC because it breaks
+* BMC firmware connected over SMBUS */
+   rctl |= E1000_RCTL_DTYP_PS /* | E1000_RCTL_SECRC */;
 
psrctl |= adapter->rx_ps_bsize0 >>
E1000_PSRCTL_BSIZE0_SHIFT;



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


[PATCH 04/21] e1000: fix CONFIG_PM blocks

2006-06-21 Thread Kok, Auke

e1000_suspend is called even when !CONFIG_PM. The non-PM code inside of it
is properly #ifdef'd. This fixes the compiler warnings when !CONFIG_PM.

Signed-off-by: Jesse Brandeburg <[EMAIL PROTECTED]>
Signed-off-by: Auke Kok <[EMAIL PROTECTED]>
---

 drivers/net/e1000/e1000_main.c |6 --
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 813d5e0..7cf5e5d 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -177,8 +177,8 @@ static void e1000_vlan_rx_add_vid(struct
 static void e1000_vlan_rx_kill_vid(struct net_device *netdev, uint16_t vid);
 static void e1000_restore_vlan(struct e1000_adapter *adapter);
 
-#ifdef CONFIG_PM
 static int e1000_suspend(struct pci_dev *pdev, pm_message_t state);
+#ifdef CONFIG_PM
 static int e1000_resume(struct pci_dev *pdev);
 #endif
 static void e1000_shutdown(struct pci_dev *pdev);
@@ -205,8 +205,8 @@ static struct pci_driver e1000_driver = 
.probe= e1000_probe,
.remove   = __devexit_p(e1000_remove),
/* Power Managment Hooks */
-#ifdef CONFIG_PM
.suspend  = e1000_suspend,
+#ifdef CONFIG_PM
.resume   = e1000_resume,
 #endif
.shutdown = e1000_shutdown,
@@ -4498,7 +4498,9 @@ e1000_suspend(struct pci_dev *pdev, pm_m
struct e1000_adapter *adapter = netdev_priv(netdev);
uint32_t ctrl, ctrl_ext, rctl, manc, status;
uint32_t wufc = adapter->wol;
+#ifdef CONFIG_PM
int retval = 0;
+#endif
 
netif_device_detach(netdev);
 



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


Re: New Qlogic qla3xxx NIC Driver v2.02.00k31 for upstream inclusion

2006-06-21 Thread Andrew Morton
On Wed, 21 Jun 2006 14:24:27 -0700
"Ron Mercer" <[EMAIL PROTECTED]> wrote:

> Please add the qla3xxx NIC driver to the next netdev-2.6 GIT tree. 

- We won't be able to include this withot a Signed-off-by: as per section
  11 of Documentation/SubmittingPatches.

- The driver does a lot of:

static void ql_write_page0_reg(struct ql3_adapter *qdev,
   volatile u32 * pRegister, u32 value)
{
...
writel(value, (u32 *) pRegister);

The volatile is undesirable (and, for writel, unneeded) (and ity has been
typecast away anwyay).

And the arg to writel is of the type `void __iomem *'.  Really, this
function should take an arg of type `void __iomem *pRegister' or `u32
__iomem *pRegister'.

Treat __iomem as a C type, and propagate it correctly from top to bottom
and you cannot go wrong.

- What's going on here?

static void fm93c56a_deselect(struct ql3_adapter *qdev)
{
struct ql3xxx_port_registers *port_regs =
(struct ql3xxx_port_registers *)qdev->mem_map_registers;

  ->mem_map_registers is already of type `struct ql3xxx_port_registers
  __iomem *', so all the cast here does is to remove the __iomem, making
  the code incorrect...

  (many instances)

- Is there a better way of doing this?

static void ql_swap_mac_addr(u8 * macAddress)
{
#ifdef __BIG_ENDIAN
u8 temp;
temp = macAddress[0];
macAddress[0] = macAddress[1];
macAddress[1] = temp;
temp = macAddress[2];
macAddress[2] = macAddress[3];
macAddress[3] = temp;
temp = macAddress[4];
macAddress[4] = macAddress[5];
macAddress[5] = temp;
#endif
}

  It seems like a common sort of thing to do?

- ql_mii_write_reg_ex() has two up-to-10-millisecond busywaits.

- In fact, those up-to-10-millisecond busywaits are all over the place.

- The driver would be cleaner if it had a helper function rather than
  open-coding all those up-to-10-millisecond busywaits.


Have some random tweaks:


From: Andrew Morton <[EMAIL PROTECTED]>

- coding style

- use cpu_relax()

- use msleep()

Cc: "Ron Mercer" <[EMAIL PROTECTED]>
Cc: Jeff Garzik <[EMAIL PROTECTED]>
Cc: Stephen Hemminger <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
---

 drivers/net/qla3xxx.c |  164 +++-
 1 file changed, 65 insertions(+), 99 deletions(-)

diff -puN drivers/net/qla3xxx.c~qla3xxx-NIC-driver-tidy drivers/net/qla3xxx.c
--- a/drivers/net/qla3xxx.c~qla3xxx-NIC-driver-tidy
+++ a/drivers/net/qla3xxx.c
@@ -57,7 +57,7 @@ static int debug = -1;/* defaults abov
 module_param(debug, int, 0);
 MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)");
 
-static int msi = 0;
+static int msi;
 module_param(msi, int, 0);
 MODULE_PARM_DESC(msi, "Turn on Message Signaled Interrupts.");
 
@@ -84,6 +84,7 @@ static void ql_sem_spinlock(struct ql3_a
spin_unlock_irqrestore(&qdev->hw_lock, hw_flags);
if ((value & (sem_mask >> 16)) == sem_bits)
break;
+   cpu_relax();
}
 }
 
@@ -121,12 +122,11 @@ static int ql_wait_for_drvr_lock(struct 
 (QL_RESOURCE_BITS_BASE_CODE | (qdev->mac_index)
  * 2) << 1)) {
if (i < 10) {
-   set_current_state(TASK_UNINTERRUPTIBLE);
-   schedule_timeout(1 * HZ);
+   msleep(1000);
i++;
} else {
-   printk(KERN_ERR PFX
-  "%s: Timed out waiting for driver 
lock...\n",
+   printk(KERN_ERR PFX "%s: Timed out waiting for "
+  "driver lock...\n",
   qdev->ndev->name);
return 0;
}
@@ -149,7 +149,7 @@ static u32 ql_read_common_reg(struct ql3
value = readl(pRegister);
spin_unlock_irqrestore(&qdev->hw_lock, hw_flags);
 
-   return (value);
+   return value;
 }
 
 static u32 ql_read_page0_reg(struct ql3_adapter *qdev, volatile u32 * 
pRegister)
@@ -170,7 +170,7 @@ static u32 ql_read_page0_reg(struct ql3_
value = readl(pRegister);
 
spin_unlock_irqrestore(&qdev->hw_lock, hw_flags);
-   return (value);
+   return value;
 }
 
 static void ql_write_common_reg(struct ql3_adapter *qdev,
@@ -324,7 +324,7 @@ static struct ql_rcv_buf_cb *ql_get_from
qdev->lrg_buf_free_count--;
}
 
-   return (lrg_buf_cb);
+   return lrg_buf_cb;
 }
 
 static u32 addrBits = EEPROM_NO_ADDR_BITS;
@@ -439,7 +439,7 @@ static void fm93c56a_deselect(struct ql3
 {
struct ql3xxx_port_registers *port_regs =
(struct ql3xxx_port_registers *)qdev->mem_map_registers;
-   qdev->eeprom_cmd_data = AUBURN_EEPROM_CS_0;
+   qde

Re: Locking validator output on DCCP

2006-06-21 Thread Ian McDonald

On 6/21/06, Ingo Molnar <[EMAIL PROTECTED]> wrote:


* Herbert Xu <[EMAIL PROTECTED]> wrote:

> > Can someone tell me whether I am correct in my thinking or not? If I
> > am then I will work out how to tell the lock validator not to worry
> > about it.
>
> I agree, this looks bogus.  Ingo, could you please take a look?

sure - Ian, could you try Arjan's fix below?

Ingo


Subject: lock validator: annotate vlan "master" device locks
From: Arjan van de Ven <[EMAIL PROTECTED]>


The fix you sent here was the incorrect one but I did test Arjan's as
per previous e-mail.

Real dumb question time. The lock validator is testing for recursive
lock holding. Given that this is a lock at a different address can we
eliminate all such cases? Or are you trying to detect code here that
keeps on locking same type of lock in case of error and we should
explicitly flag...

Ian
--
Ian McDonald
Web: http://wand.net.nz/~iam4
Blog: http://imcdnzl.blogspot.com
WAND Network Research Group
Department of Computer Science
University of Waikato
New Zealand
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Locking validator output on DCCP

2006-06-21 Thread Ian McDonald

On 6/21/06, Arjan van de Ven <[EMAIL PROTECTED]> wrote:

On Wed, 2006-06-21 at 10:34 +1000, Herbert Xu wrote:
> > As I read this it is not a recursive lock as sk_clone is occurring
> > second and is actually creating a new socket so they are trying to
> > lock on different sockets.
> >
> > Can someone tell me whether I am correct in my thinking or not? If I
> > am then I will work out how to tell the lock validator not to worry
> > about it.
>
> I agree, this looks bogus.  Ingo, could you please take a look?

Fix is relatively easy:


sk_clone creates a new socket, and thus can never deadlock, and in fact
can be called with the original socket locked. This therefore is a
legitimate nesting case; mark it as such.

Signed-off-by: Arjan van de Ven <[EMAIL PROTECTED]>


---
 net/core/sock.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6.17-rc6-mm2/net/core/sock.c
===
--- linux-2.6.17-rc6-mm2.orig/net/core/sock.c
+++ linux-2.6.17-rc6-mm2/net/core/sock.c
@@ -846,7 +846,7 @@ struct sock *sk_clone(const struct sock
/* SANITY */
sk_node_init(&newsk->sk_node);
sock_lock_init(newsk);
-   bh_lock_sock(newsk);
+   bh_lock_sock_nested(newsk);

atomic_set(&newsk->sk_rmem_alloc, 0);
atomic_set(&newsk->sk_wmem_alloc, 0);



When I do this it now shifts around. I'll investigate further
(probably tomorrow).

Now get

Jun 22 14:20:48 localhost kernel: [ 1276.424531]
=
Jun 22 14:20:48 localhost kernel: [ 1276.424541] [ INFO: possible
recursive locking detected ]
Jun 22 14:20:48 localhost kernel: [ 1276.424546]
-
Jun 22 14:20:48 localhost kernel: [ 1276.424553] idle/0 is trying to
acquire lock:
Jun 22 14:20:48 localhost kernel: [ 1276.424559]
(&sk->sk_lock.slock#5/1){-+..}, at: [] sk_clone+0x5f/0x195
Jun 22 14:20:48 localhost kernel: [ 1276.424585]
Jun 22 14:20:48 localhost kernel: [ 1276.424587] but task is already
holding lock:
Jun 22 14:20:48 localhost kernel: [ 1276.424592]
(&sk->sk_lock.slock#5/1){-+..}, at: []
tcp_v4_rcv+0x42e/0x9b3
Jun 22 14:20:48 localhost kernel: [ 1276.424616]
Jun 22 14:20:48 localhost kernel: [ 1276.424618] other info that might
help us debug this:
Jun 22 14:20:48 localhost kernel: [ 1276.424624] 2 locks held by idle/0:
Jun 22 14:20:48 localhost kernel: [ 1276.424628]  #0:
(&tp->rx_lock){-+..}, at: [] rtl8139_poll+0x42/0x41c
[8139too]
Jun 22 14:20:48 localhost kernel: [ 1276.424666]  #1:
(&sk->sk_lock.slock#5/1){-+..}, at: []
tcp_v4_rcv+0x42e/0x9b3
Jun 22 14:20:48 localhost kernel: [ 1276.424685]
Jun 22 14:20:48 localhost kernel: [ 1276.424686] stack backtrace:
Jun 22 14:20:48 localhost kernel: [ 1276.425002]  []
show_trace_log_lvl+0x53/0xff
Jun 22 14:20:48 localhost kernel: [ 1276.425038]  []
show_trace+0x16/0x19
Jun 22 14:20:48 localhost kernel: [ 1276.425068]  []
dump_stack+0x1a/0x1f
Jun 22 14:20:48 localhost kernel: [ 1276.425099]  []
__lock_acquire+0x8e6/0x902
Jun 22 14:20:48 localhost kernel: [ 1276.425311]  []
lock_acquire+0x4e/0x66
Jun 22 14:20:48 localhost kernel: [ 1276.425510]  []
_spin_lock_nested+0x26/0x36
Jun 22 14:20:48 localhost kernel: [ 1276.425726]  []
sk_clone+0x5f/0x195
Jun 22 14:20:48 localhost kernel: [ 1276.427191]  []
inet_csk_clone+0xf/0x67
Jun 22 14:20:48 localhost kernel: [ 1276.428879]  []
tcp_create_openreq_child+0x15/0x32b
Jun 22 14:20:48 localhost kernel: [ 1276.430598]  []
tcp_v4_syn_recv_sock+0x47/0x29c
Jun 22 14:20:48 localhost kernel: [ 1276.432313]  []
tcp_v6_syn_recv_sock+0x37/0x534 [ipv6]
Jun 22 14:20:48 localhost kernel: [ 1276.432482]  []
tcp_check_req+0x1a0/0x2db
Jun 22 14:20:48 localhost kernel: [ 1276.434198]  []
tcp_v4_do_rcv+0x9f/0x2fe
Jun 22 14:20:48 localhost kernel: [ 1276.435911]  []
tcp_v4_rcv+0x932/0x9b3
Jun 22 14:20:48 localhost kernel: [ 1276.437632]  []
ip_local_deliver+0x159/0x1f1
Jun 22 14:20:48 localhost kernel: [ 1276.439305]  []
ip_rcv+0x3e9/0x416
Jun 22 14:20:48 localhost kernel: [ 1276.440977]  []
netif_receive_skb+0x287/0x317
Jun 22 14:20:48 localhost kernel: [ 1276.442542]  []
rtl8139_poll+0x294/0x41c [8139too]
Jun 22 14:20:48 localhost kernel: [ 1276.442590]  []
net_rx_action+0x8b/0x17c
Jun 22 14:20:48 localhost kernel: [ 1276.444160]  []
__do_softirq+0x54/0xb3
Jun 22 14:20:48 localhost kernel: [ 1276.444335]  []
do_softirq+0x2f/0x47
Jun 22 14:20:48 localhost kernel: [ 1276.60]  []
irq_exit+0x39/0x46
Jun 22 14:20:48 localhost kernel: [ 1276.444585]  [] do_IRQ+0x77/0x84
Jun 22 14:20:48 localhost kernel: [ 1276.444621]  []
common_interrupt+0x25/0x2c



--
Ian McDonald
Web: http://wand.net.nz/~iam4
Blog: http://imcdnzl.blogspot.com
WAND Network Research Group
Department of Computer Science
University of Waikato
New Zealand
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info a

Re: [PATCH 1/3] Rough VJ Channel Implementation - vj_core.patch

2006-06-21 Thread YOSHIFUJI Hideaki / 吉藤英明
In article <[EMAIL PROTECTED]> (at Wed, 21 Jun 2006 23:58:56 -0400 (EDT)), 
James Morris <[EMAIL PROTECTED]> says:

> On Thu, 22 Jun 2006, Kelly Daly wrote:
> 
> > +   switch (bp->netchan_buf_proto) {
> > +   case __constant_htons(ETH_P_IP): {
> 
> __constant_htons and friends should not be used in runtime code, only for 
> data being initialized at compile time.

I disagree.  For "case," use __constant_{hton,ntoh}{s,l}(), please.

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


Re: [PATCH 1/3] Rough VJ Channel Implementation - vj_core.patch

2006-06-21 Thread Arnaldo Carvalho de Melo

On 6/22/06, James Morris <[EMAIL PROTECTED]> wrote:

On Thu, 22 Jun 2006, Kelly Daly wrote:

> + switch (bp->netchan_buf_proto) {
> + case __constant_htons(ETH_P_IP): {

__constant_htons and friends should not be used in runtime code, only for
data being initialized at compile time.


... because they generate the same code, so, to make source code less
cluttered  ... :-)

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


Re: [patch 2.6.17] s2io driver irq fix

2006-06-21 Thread Andrew Morton
On Wed, 21 Jun 2006 15:50:49 -0400 (EDT)
Ananda Raju <[EMAIL PROTECTED]> wrote:

> + if (sp->intr_type == MSI_X) {
> + int i;
>  
> - free_irq(vector, arg);
> + for (i=1; (sp->s2io_entries[i].in_use == MSIX_FLG); i++) {
> + if (sp->s2io_entries[i].type == MSIX_FIFO_TYPE) {
> + sprintf(sp->desc[i], "%s:MSI-X-%d-TX",
> + dev->name, i);
> + err = request_irq(sp->entries[i].vector,
> +   s2io_msix_fifo_handle, 0, sp->desc[i],
> +   sp->s2io_entries[i].arg);

Is it usual to prohibit IRQ sharing with msix?

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


Re: [PATCH 1/3] Rough VJ Channel Implementation - vj_core.patch

2006-06-21 Thread James Morris
On Thu, 22 Jun 2006, Kelly Daly wrote:

> + switch (bp->netchan_buf_proto) {
> + case __constant_htons(ETH_P_IP): {

__constant_htons and friends should not be used in runtime code, only for 
data being initialized at compile time.



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


Re: Memory corruption in 8390.c ? (was Re: Possible leaks in network drivers)

2006-06-21 Thread Herbert Xu
On Thu, Jun 22, 2006 at 10:55:44AM +1000, Herbert Xu wrote:
> 
> I think skb_padto simply shouldn't allocate a new skb.  It only needs
> to extend the data area.

OK, here is a patch to make it do that.

[NET]: Avoid allocating skb in skb_pad

First of all it is unnecessary to allocate a new skb in skb_pad since
the existing one is not shared.  More importantly, our hard_start_xmit
interface does not allow a new skb to be allocated since that breaks
requeueing.

This patch uses pskb_expand_head to expand the existing skb and linearize
it if needed.  Actually, someone should sift through every instance of
skb_pad on a non-linear skb as they do not fit the reasons why this was
originally created.

Incidentally, this fixes a minor bug when the skb is cloned (tcpdump,
TCP, etc.).  As it is skb_pad will simply write over a cloned skb.  Because
of the position of the write it is unlikely to cause problems but still
it's best if we don't do it.

Signed-off-by: Herbert Xu <[EMAIL PROTECTED]>

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[EMAIL PROTECTED]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
diff --git a/drivers/net/3c527.c b/drivers/net/3c527.c
index 1b1cb00..157eda5 100644
--- a/drivers/net/3c527.c
+++ b/drivers/net/3c527.c
@@ -1031,8 +1031,7 @@ static int mc32_send_packet(struct sk_bu
return 1;
}
 
-   skb = skb_padto(skb, ETH_ZLEN);
-   if (skb == NULL) {
+   if (skb_padto(skb, ETH_ZLEN)) {
netif_wake_queue(dev);
return 0;
}
diff --git a/drivers/net/82596.c b/drivers/net/82596.c
index da0c878..8a9f7d6 100644
--- a/drivers/net/82596.c
+++ b/drivers/net/82596.c
@@ -1070,8 +1070,7 @@ static int i596_start_xmit(struct sk_buf
skb->len, (unsigned int)skb->data));
 
if (skb->len < ETH_ZLEN) {
-   skb = skb_padto(skb, ETH_ZLEN);
-   if (skb == NULL)
+   if (skb_padto(skb, ETH_ZLEN))
return 0;
length = ETH_ZLEN;
}
diff --git a/drivers/net/8390.c b/drivers/net/8390.c
index f870274..00abe83 100644
--- a/drivers/net/8390.c
+++ b/drivers/net/8390.c
@@ -277,8 +277,7 @@ static int ei_start_xmit(struct sk_buff 
unsigned long flags;
 
if (skb->len < ETH_ZLEN) {
-   skb = skb_padto(skb, ETH_ZLEN);
-   if (skb == NULL)
+   if (skb_padto(skb, ETH_ZLEN))
return 0;
send_length = ETH_ZLEN;
}
diff --git a/drivers/net/a2065.c b/drivers/net/a2065.c
index 79bb56b..71165ac 100644
--- a/drivers/net/a2065.c
+++ b/drivers/net/a2065.c
@@ -573,8 +573,7 @@ static int lance_start_xmit (struct sk_b

if (len < ETH_ZLEN) {
len = ETH_ZLEN;
-   skb = skb_padto(skb, ETH_ZLEN);
-   if (skb == NULL)
+   if (skb_padto(skb, ETH_ZLEN))
return 0;
}
 
diff --git a/drivers/net/ariadne.c b/drivers/net/ariadne.c
index d1b6b1f..a9bb7a4 100644
--- a/drivers/net/ariadne.c
+++ b/drivers/net/ariadne.c
@@ -607,8 +607,7 @@ #endif
 /* FIXME: is the 79C960 new enough to do its own padding right ? */
 if (skb->len < ETH_ZLEN)
 {
-   skb = skb_padto(skb, ETH_ZLEN);
-   if (skb == NULL)
+   if (skb_padto(skb, ETH_ZLEN))
return 0;
len = ETH_ZLEN;
 }
diff --git a/drivers/net/arm/ether1.c b/drivers/net/arm/ether1.c
index 36475eb..312955d 100644
--- a/drivers/net/arm/ether1.c
+++ b/drivers/net/arm/ether1.c
@@ -700,8 +700,7 @@ ether1_sendpacket (struct sk_buff *skb, 
}
 
if (skb->len < ETH_ZLEN) {
-   skb = skb_padto(skb, ETH_ZLEN);
-   if (skb == NULL)
+   if (skb_padto(skb, ETH_ZLEN))
goto out;
}
 
diff --git a/drivers/net/arm/ether3.c b/drivers/net/arm/ether3.c
index f1d5b10..0810741 100644
--- a/drivers/net/arm/ether3.c
+++ b/drivers/net/arm/ether3.c
@@ -518,8 +518,7 @@ ether3_sendpacket(struct sk_buff *skb, s
 
length = (length + 1) & ~1;
if (length != skb->len) {
-   skb = skb_padto(skb, length);
-   if (skb == NULL)
+   if (skb_padto(skb, length))
goto out;
}
 
diff --git a/drivers/net/atarilance.c b/drivers/net/atarilance.c
index 442b2cb..91783a8 100644
--- a/drivers/net/atarilance.c
+++ b/drivers/net/atarilance.c
@@ -804,8 +804,7 @@ static int lance_start_xmit( struct sk_b
++len;

if (len > skb->len) {
-   skb = skb_padto(skb, len);
-   if (skb == NULL)
+   if (skb_padto(skb, len))
return 0;
}

diff --git a/drivers/net/cassini.c b/drivers/net/cassini.c
index 39f36aa..565a54f 100644
--- a/drivers/net/cassini.c
+++ b/drivers/net/cassini

Re: [PATCH 1/3] Rough VJ Channel Implementation - vj_core.patch

2006-06-21 Thread Kelly Daly
> The hash table bits look good, just as they did last time :-)
> So I'll put this part into my vj-2.6 tree now, thanks.
Rockin' - thanks...

Sorry for the massive delay - here's the next attempt.

---

diff -urp davem/include/linux/netchannel.h kelly_new/include/linux/netchannel.h
--- davem/include/linux/netchannel.h2006-06-16 15:14:15.0 +1000
+++ kelly_new/include/linux/netchannel.h2006-06-22 11:47:04.0 
+1000
@@ -19,6 +19,7 @@ struct netchannel {
void(*netchan_callb)(struct netchannel *);
void*netchan_callb_data;
unsigned long   netchan_head;
+   wait_queue_head_t   wq;
 };
 
 extern void netchannel_init(struct netchannel *,
@@ -56,6 +57,11 @@ static inline unsigned char *netchan_buf
return netchan_buf_base(bp) + bp->netchan_buf_offset;
 }
 
+static inline int netchan_data_len(const struct netchannel_buftrailer *bp)
+{
+   return bp->netchan_buf_len - bp->netchan_buf_offset;
+}
+
 extern int netchannel_enqueue(struct netchannel *, struct 
netchannel_buftrailer *);
 extern struct netchannel_buftrailer *__netchannel_dequeue(struct netchannel *);
 static inline struct netchannel_buftrailer *netchannel_dequeue(struct 
netchannel *np)
@@ -65,6 +71,7 @@ static inline struct netchannel_buftrail
return __netchannel_dequeue(np);
 }
 
+extern struct netchannel *find_netchannel(const struct netchannel_buftrailer 
*bp);
 extern struct sk_buff *skb_netchan_graft(struct netchannel_buftrailer *, 
gfp_t);
 
 #endif /* _LINUX_NETCHANNEL_H */
diff -urp davem/include/net/inet_hashtables.h 
kelly_new/include/net/inet_hashtables.h
--- davem/include/net/inet_hashtables.h 2006-06-16 14:34:20.0 +1000
+++ kelly_new/include/net/inet_hashtables.h 2006-06-19 10:42:45.0 
+1000
@@ -418,4 +418,7 @@ static inline struct sock *inet_lookup(s
 
 extern int inet_hash_connect(struct inet_timewait_death_row *death_row,
 struct sock *sk);
+extern void  inet_hash_register(u8 proto, struct inet_hashinfo *hashinfo);
+extern struct sock *inet_lookup_proto(u8 protocol, u32 saddr, u16 sport, u32 
daddr, u16 dport, int ifindex);
+
 #endif /* _INET_HASHTABLES_H */
diff -urp davem/include/net/sock.h kelly_new/include/net/sock.h
--- davem/include/net/sock.h2006-06-16 15:14:16.0 +1000
+++ kelly_new/include/net/sock.h2006-06-19 10:42:45.0 +1000
@@ -196,6 +196,7 @@ struct sock {
unsigned short  sk_type;
int sk_rcvbuf;
socket_lock_t   sk_lock;
+   struct netchannel   *sk_channel;
wait_queue_head_t   *sk_sleep;
struct dst_entry*sk_dst_cache;
struct xfrm_policy  *sk_policy[2];
diff -urp davem/net/core/dev.c kelly_new/net/core/dev.c
--- davem/net/core/dev.c2006-06-16 15:14:16.0 +1000
+++ kelly_new/net/core/dev.c2006-06-22 11:45:55.0 +1000
@@ -113,9 +113,12 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
+#include 
 
 /*
  * The list of packet types we will receive (as opposed to discard)
@@ -190,6 +193,8 @@ static inline struct hlist_head *dev_ind
return &dev_index_head[ifindex & ((1wq);
+
np->netchan_callb   = callb;
np->netchan_callb_data  = callb_data;
 }
@@ -1912,6 +1924,76 @@ struct netchannel_buftrailer *__netchann
 }
 EXPORT_SYMBOL_GPL(__netchannel_dequeue);
 
+/* Find the channel for a packet, or return default channel. */
+struct netchannel *find_netchannel(const struct netchannel_buftrailer *bp)
+{
+   struct sock *sk = NULL;
+   int datalen = netchan_data_len(bp);
+
+   switch (bp->netchan_buf_proto) {
+   case __constant_htons(ETH_P_IP): {
+   struct iphdr *ip = (void *)bp - datalen;
+   int iphl = ip->ihl * 4;
+
+   /* FIXME: Do sanity checks, parse packet. */
+
+   if (datalen >+ (iphl + 4) && iphl == sizeof(struct iphdr)) {
+   u16 *ports = (u16 *)ip + 1;
+   sk = inet_lookup_proto(ip->protocol, 
+ip->saddr, ports[0],
+ip->daddr, ports[1],
+bp->netchan_buf_dev->ifindex);
+   }
+   break;
+   }
+   }
+
+   if (sk && sk->sk_channel)
+   return sk->sk_channel;
+   return &default_netchannel;
+}
+EXPORT_SYMBOL_GPL(find_netchannel);
+
+static int sock_add_netchannel(struct sock *sk)
+{
+   struct netchannel *np;
+
+   np = kmalloc(sizeof(struct netchannel), GFP_KERNEL);
+   if (!np)
+   return -ENOMEM;
+   netchannel_init(np, netchannel_w

Re: [1/5] [NET]: Merge TSO/UFO fields in sk_buff

2006-06-21 Thread David Miller
From: Herbert Xu <[EMAIL PROTECTED]>
Date: Thu, 22 Jun 2006 11:09:25 +1000

> ECE just needs to be replicated so it would seem to be a safe bet unless
> Dave knows some really broken hardware out there? If not I'd say that
> we should just assume that it works and add a new bit it if said broken
> stuff does turn up.

ECE simply needs to persist while the ECE condition is true.
If it is true when we build the TSO frame, it would have
thus been true during the time in which we had built each
individual sub-frame.

I don't anticipate any problems if you just mirror the ECE
bit in each chopped up frame.

> Thanks a lot for looking into this!

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


Re: [1/5] [NET]: Merge TSO/UFO fields in sk_buff

2006-06-21 Thread Herbert Xu
On Wed, Jun 21, 2006 at 05:46:24PM -0700, Michael Chan wrote:
>
> OK, if time permits, I'll cook up some patches to support generic TSO
> ECN with or without hardware support.  Without hardware ECN, it will use
> GSO to split up the packet with CWR.  Can we assume that all hardware
> will handle ECE properly?

ECE just needs to be replicated so it would seem to be a safe bet unless
Dave knows some really broken hardware out there? If not I'd say that
we should just assume that it works and add a new bit it if said broken
stuff does turn up.

Thanks a lot for looking into this!

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


Re: [1/5] [NET]: Merge TSO/UFO fields in sk_buff

2006-06-21 Thread Michael Chan
On Thu, 2006-06-22 at 09:27 +1000, Herbert Xu wrote:
> Hi Michael:
> 
> On Wed, Jun 21, 2006 at 02:48:15PM -0700, Michael Chan wrote:
> > 
> > We have some hardware that supports TSO and ECN.  Is something like the
> > patch below what you had in mind to support NETIF_F_TSO_ECN?  Or are you
> > thinking about something more generic that works with or without
> > hardware support?
> 
> Yeah I was thinking of something more generic because packets with CWR
> set should be rare.
> 
OK, if time permits, I'll cook up some patches to support generic TSO
ECN with or without hardware support.  Without hardware ECN, it will use
GSO to split up the packet with CWR.  Can we assume that all hardware
will handle ECE properly?

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


Re: Memory corruption in 8390.c ? (was Re: Possible leaks in network drivers)

2006-06-21 Thread Herbert Xu
Alan Cox <[EMAIL PROTECTED]> wrote:
> 
> skb_padto() returns either a new buffer or the existing one depending
> upon the space situation. If it returns a new buffer then it frees the
> old one.

I think skb_padto simply shouldn't allocate a new skb.  It only needs
to extend the data area.

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


Re: [PATCH] Export accept queue len of a TCP listening socket via /proc/net/tcp{6}

2006-06-21 Thread Herbert Xu
Sridhar Samudrala <[EMAIL PROTECTED]> wrote:
>> 
>> What about using the same fields (rqueue/wqueue) as you did for /proc?
> 
> I meant extending tcp_info structure to add new fields. I think the user
> space also uses this structure.

What about putting it into inet_idiag_msg.idiag_[rw]queue instead?

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


Re: PATCHv3 2.6.17-rc5 tulip free_irq() called too late

2006-06-21 Thread Valerie Henson
On Tue, Jun 13, 2006 at 05:55:31PM -0600, Grant Grundler wrote:
> On Thu, Jun 08, 2006 at 11:01:20AM -0600, Grant Grundler wrote:
> > Here is a new patch that moves free_irq() into tulip_down().
> > The resulting code is structured the same as cp_close().
> 
> Val,
> Two details are wrong in version 2 and are fixed in v3 (appended below):
> 
> o we don't need synchronize_irq() before calling free_irq().
>   (It should be removed from cp_close() too)
>   Thanks to willy for pointing me at kernel/irq/manage.c.
> 
> o tulip_stop_rxtx() has to be called _after_ free_irq().
>   ie. v2 patch didn't fix the original race condition
>   and when under test, dies about as fast as the original code.
> 
> Tested on rx4640 (HP IA64) for several hours.
> Please apply.

Hi folks,

The quick summary of my thoughts on this patch is that it isn't the
ideal patch, but it works and it's well-tested.  Doing my preferred
fix (adding a shutdown flag) would be invasive and take many weeks to
reach the level of stability of Grant's patch.  So I'm taking this
patch but adding a comment describing my preferred fix.

Here's the long version.  The obvious ordering of bringing up the card
is:

request_irq()
setup DMA resources
enable interrupts
start DMA engine

And the obvious ordering of shutting it down is:

stop DMA engine
disable interrupts
remove DMA resources
free_irq()

The problem with the above shutdown order is that we can receive an
interrupt in between stopping DMA and disabling interrupts, and the
tulip irq handler will reenable DMA =><= Boom!  The solution I prefer
is to make the irq handler aware of whether we are shutting down or
not, and not reenable DMA in that case.  However, it is a non-trivial
patch to get right, and I would rather have the bug fixed short-term
with the ordering Grant uses:

disable interrupts
free_irq()
stop rxtx
remove DMA resources

Make sense to everyone?  I'll redo the patch with the comment and get
Grant's sign-off.

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


Re: [PATCH] Export accept queue len of a TCP listening socket via /proc/net/tcp{6}

2006-06-21 Thread Sridhar Samudrala
On Thu, 2006-06-22 at 10:21 +1000, Herbert Xu wrote:
> Sridhar Samudrala <[EMAIL PROTECTED]> wrote:
> > 
> > In order to support this with netstat/ss that use netlink mechanism to
> > get the socket info, i think we need to extend tcp_info to add this field.
> > Can this be done in a backward compatible way?
> 
> What about using the same fields (rqueue/wqueue) as you did for /proc?

I meant extending tcp_info structure to add new fields. I think the user
space also uses this structure.

Thanks
Sridhar

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


Re: ipv6 source address selection in addrconf.c (2.6.17)

2006-06-21 Thread YOSHIFUJI Hideaki / 吉藤英明
In article <[EMAIL PROTECTED]> (at Thu, 22 Jun 2006 00:57:56 +0200), Lukasz 
Stelmach <[EMAIL PROTECTED]> says:

> Lukasz Stelmach wrote:
> > Lukasz Stelmach wrote:
> > 
> >> [...] when trying to connect to
> >>
> >> 2001:200:0:8002:203:47ff:fea5:3085 (www.kame.net)
> >>
> >> with two global addresses assigned to the ethernet card
> >>
> >> fd24:6f44:46bd:face::254
> >> 2002:531f:d667:face::254
> >>
> >> rule 8 does not work and the first address is chosen.
> > 
> > The answer is that fc00::/7 matches 2001:: better because it gets the same
> > label (ipv6_saddr_label()). Although fc00::/7 addresses are defined as 
> > global
> > unicast IMHO they should be treated *slightly* different. This is the patch.
> > Since 6to4 has its own label I have decided to assign one to Teredo too.
> 
> There still, however, remains one issue. Aditional labels prevent kernel from
> selecting fc00::/7 prematurly. But there is no way to stop it from selecting
> it in rule 7. A wrong assumption has been taken that there is only one
> "private" address per interface and it is always the best choice. If there are
> four addresses on the interface:
> 
> fd24:6f44:46bd:face:EUI64 fd24:6f44:46bd:face:RANDOM
> and
> 2002:531f:d667:face:EUI64 2002:531f:d667:face::RANDOM
> 
> there seem to be no way to prefere 2002:: over fc00:: in rule 7 and it will be
> selected as long as it is before 2002:: on the list. I can see here that an
> implicit assumption has been made that an interface either is multihomed or
> "private". The seventh rule should not IMHO break the whole process of
> selection but rather mark as selectable all "private" (random) addresses. And
> it should rather be done before rule 6.

Hmm? We do not have such intention.
In above case, when you connect to 2001:200:0:8002:203:47ff:fea5:3085,
either 2002:531f:d667:face:EUI64 or 2002:531f:d667:face::RANDOM
should be selected (depending on if use_tempaddr >= 2),
by the longest matching rule (Rule 8).

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


Re: [PATCH] Export accept queue len of a TCP listening socket via /proc/net/tcp{6}

2006-06-21 Thread Herbert Xu
Sridhar Samudrala <[EMAIL PROTECTED]> wrote:
> 
> In order to support this with netstat/ss that use netlink mechanism to
> get the socket info, i think we need to extend tcp_info to add this field.
> Can this be done in a backward compatible way?

What about using the same fields (rqueue/wqueue) as you did for /proc?

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


[PATCH] Export accept queue len of a TCP listening socket via /proc/net/tcp{6}

2006-06-21 Thread Sridhar Samudrala
While debugging a TCP server hang issue, we noticed that currently there is 
no way for a user to find the acceptq backlog value for a TCP listen socket.

All the standard networking utilities that display socket info like netstat,
ss and /proc/net/tcp have 2 fields called rx_queue and tx_queue. I think these
fields do not mean much for listening sockets and they are always zero. So why
not use one of these fields(rx_queue) to export the accept queue len for 
listening
sockets?
The attached patch implements this, but it only works with /proc/net/tcp and
/proc/net/tcp6.

In order to support this with netstat/ss that use netlink mechanism to
get the socket info, i think we need to extend tcp_info to add this field.
Can this be done in a backward compatible way?

Anyway, i think it is useful to have this value exported via /proc.

Thanks
Sridhar


Signed-off-by: Sridhar Samudrala <[EMAIL PROTECTED]>

diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 25ecc6e..4c6ef47 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -1726,7 +1726,8 @@ static void get_tcp4_sock(struct sock *s
sprintf(tmpbuf, "%4d: %08X:%04X %08X:%04X %02X %08X:%08X %02X:%08lX "
"%08X %5d %8d %lu %d %p %u %u %u %u %d",
i, src, srcp, dest, destp, sp->sk_state,
-   tp->write_seq - tp->snd_una, tp->rcv_nxt - tp->copied_seq,
+   tp->write_seq - tp->snd_una,
+   (sp->sk_state == TCP_LISTEN) ? sp->sk_ack_backlog : 
(tp->rcv_nxt - tp->copied_seq),
timer_active,
jiffies_to_clock_t(timer_expires - jiffies),
icsk->icsk_retransmits,
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index a50eb30..b36d5b2 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -1469,7 +1469,8 @@ static void get_tcp6_sock(struct seq_fil
   dest->s6_addr32[0], dest->s6_addr32[1],
   dest->s6_addr32[2], dest->s6_addr32[3], destp,
   sp->sk_state, 
-  tp->write_seq-tp->snd_una, tp->rcv_nxt-tp->copied_seq,
+  tp->write_seq-tp->snd_una,
+  (sp->sk_state == TCP_LISTEN) ? sp->sk_ack_backlog : 
(tp->rcv_nxt - tp->copied_seq),
   timer_active,
   jiffies_to_clock_t(timer_expires - jiffies),
   icsk->icsk_retransmits,


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


Re: [1/5] [NET]: Merge TSO/UFO fields in sk_buff

2006-06-21 Thread Herbert Xu
Hi Michael:

On Wed, Jun 21, 2006 at 02:48:15PM -0700, Michael Chan wrote:
> 
> We have some hardware that supports TSO and ECN.  Is something like the
> patch below what you had in mind to support NETIF_F_TSO_ECN?  Or are you
> thinking about something more generic that works with or without
> hardware support?

Yeah I was thinking of something more generic because packets with CWR
set should be rare.

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


[2.6 patch] drivers/net/irda/mcs7780.c: make struct mcs_driver static

2006-06-21 Thread Adrian Bunk
This patch makes a needlessly global struct static.

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

--- linux-2.6.17-mm1-full/drivers/net/irda/mcs7780.c.old2006-06-22 
00:38:41.0 +0200
+++ linux-2.6.17-mm1-full/drivers/net/irda/mcs7780.c2006-06-22 
00:38:50.0 +0200
@@ -101,7 +101,7 @@
 module_param(transceiver_type, int, 0444);
 MODULE_PARM_DESC(transceiver_type, "IR transceiver type, see mcs7780.h.");
 
-struct usb_driver mcs_driver = {
+static struct usb_driver mcs_driver = {
.name = "mcs7780",
.probe = mcs_probe,
.disconnect = mcs_disconnect,

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


Re: ipv6 source address selection in addrconf.c (2.6.17)

2006-06-21 Thread Lukasz Stelmach
Lukasz Stelmach wrote:
> Lukasz Stelmach wrote:
> 
>> [...] when trying to connect to
>>
>> 2001:200:0:8002:203:47ff:fea5:3085 (www.kame.net)
>>
>> with two global addresses assigned to the ethernet card
>>
>> fd24:6f44:46bd:face::254
>> 2002:531f:d667:face::254
>>
>> rule 8 does not work and the first address is chosen.
> 
> The answer is that fc00::/7 matches 2001:: better because it gets the same
> label (ipv6_saddr_label()). Although fc00::/7 addresses are defined as global
> unicast IMHO they should be treated *slightly* different. This is the patch.
> Since 6to4 has its own label I have decided to assign one to Teredo too.

There still, however, remains one issue. Aditional labels prevent kernel from
selecting fc00::/7 prematurly. But there is no way to stop it from selecting
it in rule 7. A wrong assumption has been taken that there is only one
"private" address per interface and it is always the best choice. If there are
four addresses on the interface:

fd24:6f44:46bd:face:EUI64 fd24:6f44:46bd:face:RANDOM
and
2002:531f:d667:face:EUI64 2002:531f:d667:face::RANDOM

there seem to be no way to prefere 2002:: over fc00:: in rule 7 and it will be
selected as long as it is before 2002:: on the list. I can see here that an
implicit assumption has been made that an interface either is multihomed or
"private". The seventh rule should not IMHO break the whole process of
selection but rather mark as selectable all "private" (random) addresses. And
it should rather be done before rule 6.

Yet another issue with privacy enhancement is how not to choose "private"
address (let's even forget for a moment about fc00::/7) when connecting to
certain hosts or networks. For example I would like to hide MAC adresses of my
client machines when connecting to some foreign servers but I want to see
permanent addresses in the logfiles of my servers. Maybe even use them to
create som ACLs. This is an interesting case.


Kind regards,
-- 
Było mi bardzo miło.Czwarta pospolita klęska, [...]
>Łukasz<  Już nie katolicka lecz złodziejska.  (c)PP



signature.asc
Description: OpenPGP digital signature


Re: New Qlogic qla3xxx NIC Driver v2.02.00k31 for upstream inclusion

2006-06-21 Thread Francois Romieu
Ron Mercer <[EMAIL PROTECTED]> :
[...]
> Please add the qla3xxx NIC driver to the next netdev-2.6 GIT tree. 

$ less qla3xxxpatch1-v2.02.00-k31.txt
[...]
+ * See LICENSE.qla3xxx for copyright and licensing details.

1 - The patch contains no such file (though the file is MODULE_LICENSE("GPL")).
Please fix it.

2 - The description of the patch contains no Signed-off-by: attribute
as per Documentation/SubmittingPatches. Can you send one ?

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


Re: Suspending 802.11 drivers

2006-06-21 Thread Stefan Rompf
Am Mittwoch 21 Juni 2006 17:08 schrieb Luis R. Rodriguez:

> Since d80211 is already being patched for sysfs how about we use sysfs
> (and kobjects) to maintain the state at suspend() and resume(). This
> would allow userspace tools like supplicant running in the background
> to pick up from sysfs where it left off and for our drivers to save
> where we left off.

Forgive me that I'm so insistant on this question, but this is important: What 
state that goes beyond the data settable with wireless ioctls/iwconfig (that 
is kept anyway) needs to be saved by the stack? Last association info is 
worthless, the assocation can be restored using the ESSID/BSSID/channel set 
with iwconfig or by wpa_supplicant. Important is that userspace is notified 
about the connection loss. Is there _any_ other information not recreatable 
from iwconfig settings that needs to be kept?

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


Re: [1/5] [NET]: Merge TSO/UFO fields in sk_buff

2006-06-21 Thread Michael Chan
On Tue, 2006-06-20 at 19:10 +1000, Herbert Xu wrote:

> I've made gso_type a conjunction.  The idea is that you have a base type
> (e.g., SKB_GSO_TCPV4) that can be modified further to support new features.
> For example, if we add a hardware TSO type that supports ECN, they would
> declare NETIF_F_TSO | NETIF_F_TSO_ECN.

Hi Herbert,

We have some hardware that supports TSO and ECN.  Is something like the
patch below what you had in mind to support NETIF_F_TSO_ECN?  Or are you
thinking about something more generic that works with or without
hardware support?

[NET]: Add hardware TSO support for ECN

In the current TSO implementation, NETIF_F_TSO and ECN cannot be
turned on together in a TCP connection.  This patch adds a new
feature NETIF_F_TSO_ECN for hardware that supports TSO and ECN.

To support NETIF_F_TSO_ECN, hardware has to set the ECE flag in the
TCP flags for all segments if the first TSO segment has the ECE flag set.
If the CWR flag is set in the first TSO segment, hardware has to set
CWR in the first segment only and clear it in all subsequent segments.

Signed-off-by: Michael Chan <[EMAIL PROTECTED]>


diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index a3af961..825b66d 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -316,6 +316,7 @@ struct net_device
 #define NETIF_F_GSO_SHIFT  16
 #define NETIF_F_TSO(SKB_GSO_TCPV4 << NETIF_F_GSO_SHIFT)
 #define NETIF_F_UFO(SKB_GSO_UDPV4 << NETIF_F_GSO_SHIFT)
+#define NETIF_F_TSO_ECN(SKB_GSO_TCPV4_ECN << NETIF_F_GSO_SHIFT)
 
 #define NETIF_F_GEN_CSUM   (NETIF_F_NO_CSUM | NETIF_F_HW_CSUM)
 #define NETIF_F_ALL_CSUM   (NETIF_F_IP_CSUM | NETIF_F_GEN_CSUM)
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 679feab..818f478 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -173,6 +173,7 @@ enum {
 enum {
SKB_GSO_TCPV4 = 1 << 0,
SKB_GSO_UDPV4 = 1 << 1,
+   SKB_GSO_TCPV4_ECN = 1 << 2,
 };
 
 /** 
diff --git a/include/net/sock.h b/include/net/sock.h
index 6aac245..7c1ac0c 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -1034,7 +1034,8 @@ static inline void sk_setup_caps(struct 
if (sk->sk_route_caps & NETIF_F_GSO)
sk->sk_route_caps |= NETIF_F_TSO;
if (sk->sk_route_caps & NETIF_F_TSO) {
-   if (sock_flag(sk, SOCK_NO_LARGESEND) || dst->header_len)
+   if ((sock_flag(sk, SOCK_NO_LARGESEND) &&
+   !(sk->sk_route_caps & NETIF_F_TSO_ECN)) || dst->header_len)
sk->sk_route_caps &= ~NETIF_F_TSO;
else 
sk->sk_route_caps |= NETIF_F_SG | NETIF_F_HW_CSUM;
diff --git a/include/net/tcp_ecn.h b/include/net/tcp_ecn.h
index c6b8439..c8a3b48 100644
--- a/include/net/tcp_ecn.h
+++ b/include/net/tcp_ecn.h
@@ -31,7 +31,8 @@ static inline void TCP_ECN_send_syn(stru
struct sk_buff *skb)
 {
tp->ecn_flags = 0;
-   if (sysctl_tcp_ecn && !(sk->sk_route_caps & NETIF_F_TSO)) {
+   if (sysctl_tcp_ecn && (!(sk->sk_route_caps & NETIF_F_TSO) ||
+   (sk->sk_route_caps & NETIF_F_TSO_ECN))) {
TCP_SKB_CB(skb)->flags |= TCPCB_FLAG_ECE|TCPCB_FLAG_CWR;
tp->ecn_flags = TCP_ECN_OK;
sock_set_flag(sk, SOCK_NO_LARGESEND);
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index bdd71db..a65fe56 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -2044,7 +2044,8 @@ struct sk_buff * tcp_make_synack(struct 
memset(th, 0, sizeof(struct tcphdr));
th->syn = 1;
th->ack = 1;
-   if (dst->dev->features&NETIF_F_TSO)
+   if ((dst->dev->features&NETIF_F_TSO) &&
+   !(dst->dev->features&NETIF_F_TSO_ECN))
ireq->ecn_ok = 0;
TCP_ECN_make_synack(req, th);
th->source = inet_sk(sk)->sport;


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


RE: New Qlogic qla3xxx NIC Driver v2.02.00k31 for upstream inclusion

2006-06-21 Thread Ron Mercer
Jeff,

Please add the qla3xxx NIC driver to the next netdev-2.6 GIT tree. 

Regards,
Ron Mercer

> -Original Message-
> From: Ron Mercer 
> Sent: Monday, June 12, 2006 1:33 PM
> To: '[EMAIL PROTECTED]'
> Cc: '[EMAIL PROTECTED]'; 'netdev@vger.kernel.org'
> Subject: New Qlogic qla3xxx NIC Driver v2.02.00k31 for 
> upstream inclusion
> 
> Jeff,
> 
> Please find the Qlogic qla3xxx Ethernet driver posted at the 
> URL below. This is a complementary network driver for our 
> ISP4XXX parts.
> There is a concurrent effort underway to get the iSCSI driver 
> (qla4xxx) integrated upstream as well.
> 
> I have been through several iterations with the linux-netdev 
> list and have had much response from Stephen Hemminger. In 
> his last response he suggested I submit the driver to you.
> 
> This submission is contained in a patch file that does the following:
> 
> Adds:
> drivers/net/qla3xxx.c
> drivers/net/qla3xxx.h
> 
> Modifies:
> MAINTAINERS
> drivers/net/Makefile
> drivers/net/Kconfig
> 
> Patch file qla3xxxpatch1-v2.02.00-k31.txt is at the following link:
> 
>
ftp://ftp.qlogic.com/outgoing/linux/network/upstream/2.02.00k31/qla3xxxp
atch1-v2.02.00-k31.txt
> 
> 
> Some notes on the driver/hardware:
> 
> - Built and tested using kernel 2.6.17-rc4.
> - The chip supports two ethernet and two iSCSI functions.
> - The functions ql_sem_lock, ql_sem_spinlock, ql_sem_unlock, 
> and ql_wait_for_drvr_lock are used to protect resources that 
> are shared across the network and iSCSI functions.  This 
> protection is mostly during chip initialization and resets, 
> but also include link management.
> - The PHY/MII are not exported through ethtool due to the 
> fact that the iSCSI function will control the common link at 
> least 50% of the time.
> 
> 
> 
> Regards,
> 
> Ron Mercer
> Qlogic Corporation
> 
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/3] PAL: Support of the fixed PHY

2006-06-21 Thread Michael Buesch
On Wednesday 21 June 2006 18:09, Vitaly Bordug wrote:

> +static int fixed_mdio_update_regs(struct fixed_info *fixed)
> +{
> + u16 *regs = fixed->regs;
> + u16 bmsr = 0;
> + u16 bmcr = 0;
> +
> + if(!regs) {
> + printk(KERN_ERR "%s: regs not set up", __FUNCTION__);
> + return -1;

-EINVAL perhaps?

> +static int fixed_mdio_register_device(int number, int speed, int duplex)
> +{
> + struct mii_bus *new_bus;
> + struct fixed_info *fixed;
> + struct phy_device *phydev;
> + int err = 0;
> +
> + struct device* dev = kzalloc(sizeof(struct device), GFP_KERNEL);
> +
> + if (NULL == dev)
> + return -EINVAL;

-ENOMEM here.

> + new_bus = kzalloc(sizeof(struct mii_bus), GFP_KERNEL);
> +
> + if (NULL == new_bus) {
> + kfree(dev);
> + return -ENOMEM;
> + }
> + fixed = fixed_ptr = kzalloc(sizeof(struct fixed_info), GFP_KERNEL);
> +
> + if (NULL == fixed) {
> + kfree(dev);
> + kfree(new_bus);
> + return -ENOMEM;
> + }
> +
> + fixed->regs = kzalloc(MII_REGS_NUM*sizeof(int), GFP_KERNEL);
> +
> + if (NULL == fixed->regs) {
> + kfree(dev);
> + kfree(new_bus);
> + kfree (fixed);
> + return -ENOMEM;
> + }
> +
> + fixed->regs_num = MII_REGS_NUM;
> + fixed->phy_status.speed = speed;
> + fixed->phy_status.duplex = duplex;
> + fixed->phy_status.link = 1;
> +
> + new_bus->name = "Fixed MII Bus",
> + new_bus->read = &fixed_mii_read,
> + new_bus->write = &fixed_mii_write,
> + new_bus->reset = &fixed_mii_reset,
> +
> + /*set up workspace*/
> + fixed_mdio_update_regs(fixed);
> + new_bus->priv = fixed;
> +
> + new_bus->dev = dev;
> + dev_set_drvdata(dev, new_bus);
> +
> + /* create phy_device and register it on the mdio bus */
> + phydev = phy_device_create(new_bus, 0, 0);
> +
> + /*
> +  Put the phydev pointer into the fixed pack so that bus read/write code 
> could be able
> +  to access for instance attached netdev. Well it doesn't have  to do 
> so, only in case
> +  of utilizing user-specified link-update...
> +  */
> + fixed->phydev = phydev;
> +
> + if (IS_ERR(phydev)) {
> + err = PTR_ERR(-ENOMEM);
> + goto bus_register_fail;
> + }
> +
> + phydev->irq = -1;
> + phydev->dev.bus = &mdio_bus_type;
> +
> + if(number)
> + snprintf(phydev->dev.bus_id, BUS_ID_SIZE,
> + "[EMAIL PROTECTED]:%d", number, speed, duplex);
> + else
> + snprintf(phydev->dev.bus_id, BUS_ID_SIZE,
> + "[EMAIL PROTECTED]:%d", speed, duplex);
> + phydev->bus = new_bus;
> +
> + err = device_register(&phydev->dev);
> + if(err) {
> + printk(KERN_ERR "Phy %s failed to register\n",
> + phydev->dev.bus_id);
> + goto bus_register_fail;
> + }
> +
> + /*
> +the mdio bus has phy_id match... In order not to do it
> +artificially, we are binding the driver here by hand;
> +it will be the same
> +for all the fixed phys anyway.
> +  */
> + down_write(&phydev->dev.bus->subsys.rwsem);
> +
> + phydev->dev.driver = &fixed_mdio_driver.driver;
> +
> + err = phydev->dev.driver->probe(&phydev->dev);
> + if(err < 0) {
> + printk(KERN_ERR "Phy %s: problems with fixed driver\n",
> + phydev->dev.bus_id);
> + up_write(&phydev->dev.bus->subsys.rwsem);
> + goto bus_register_fail;

Probably need some additional error unwinding code.
Of doesn't device_register() have to be reverted?
What about phy_device_create()?

> + }
> +
> + device_bind_driver(&phydev->dev);
> + up_write(&phydev->dev.bus->subsys.rwsem);
> +
> + return 0;
> +
> +bus_register_fail:
> + kfree(dev);
> + kfree (fixed);
> + kfree(new_bus);
> +
> + return err;
> +}

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


RE: [PATCH 01/06] MLSXFRM: Granular IPSec associations for use in MLS environments

2006-06-21 Thread Venkat Yekkirala
> Can you clarify whether, with this patch, Linux will then 
> have a complete 
> labeled network implementation in terms of both LSPP 
> compliance and common 
> user requirements?

I can't comment on the LSPP compliance issue since the specific/proprietary
security target being used might really decide what's needed.

As for common user requirements, at least as I understand them, I would
look for the following in addition to this patch:

- Auto-labelling of child sockets for TCP (I am planning on sending a
separate
  patch out in the next few days).
- Using the label from the incoming packet while sending timewait
acknowledgements
  and other packets sent on behalf of kernel sockets.
- sid prioritization among the current mix of secmark, ipsec, and the
upcoming netlabel
- Replacing secmark on output with an access check in postrouting.
- localhost traffic handling with regard to labelling.

> 
> > Outstanding items/issues: 
> > - Timewait acknowledgements and such are generated in the 
> > current/upstream implementation using a NULL socket 
> resulting in the 
> > any_socket sid (SYSTEM_HIGH) to be used. This problem is 
> not addressed 
> > by this patch set.
> 
> This needs to be resolved, along with labeling for all kernel owned 
> socket/tw objects.

Resolved these should be, but given the fact that this patch doesn't
introduce this problem in the first place, and given the value it adds to
the
xfrm stuff, my hope would be for this patch to be treated separately. I am
hoping
for 2.6.18 if possible.

>  I'm not entirely clear on why this 
> doesn't already 
> work, as it is using IPsec, which should certainly be able to 
> encapsulate 
> all of this traffic.

Sans label-based checks, no problem. But with label-enhanced checks in
place,
we need to have the label to use, which we don't since there's no real
socket present which normally provided the label. One way to handle
this would be to use the label on the incoming packet for the response
as mentioned earlier.

> 
> It would also be interesting to know what kind of testing 
> this code as 
> had.

Primarily functional testing. Joy Latten at IBM is planning
on further testing this using the framework built for the original
work I believe.
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Suspending 802.11 drivers

2006-06-21 Thread Michael Buesch
On Wednesday 21 June 2006 17:08, Luis R. Rodriguez wrote:
> On 6/16/06, Stefan Rompf <[EMAIL PROTECTED]> wrote:
> > Am Donnerstag 15 Juni 2006 21:58 schrieb Michael Buesch:
> >
> > I think the most important question is how a suspend/resume action should be
> > translated. For the managed case, it is clearly an association loss, 
> > normally
> > signalled by netif_carrier_on/off() and a corresponding SIOCGIWAP event.
> > Supplicants can act on this. In AP mode, suspend is equal to disassociating
> > all stations. Ad-hoc... dunno.
> >
> > For a softmac stack like devicescape, it makes sense to have a function that
> > abstracts these scenarios as it is the stack anyway that handles association
> > stuff. However, I'd rather extend the existing function
> > ieee80211_netif_oper().
> 
> Since d80211 is already being patched for sysfs how about we use sysfs
> (and kobjects) to maintain the state at suspend() and resume(). This
> would allow userspace tools like supplicant running in the background
> to pick up from sysfs where it left off and for our drivers to save
> where we left off. ieee80211_hw can then just refer to their suspend()
> and resume() routines from its respective struct pci_driver or struct
> usb_device.

Ok, so you mean we remove the full responsibility to recover a connection
from the driver resume() handler and let a userspace daemon keep
track of this?
So basically stay with the current implementation of suspend() and
resume() in the drivers and assume userspace does the right thing
and detects a resume and recovers connections and so on?
Did I understand that right? If yes, I think that's a very nice idea, too.
Probably the best.

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


[RFC 3/7] NetLabel: CIPSOv4 engine

2006-06-21 Thread paul . moore
Add support for the Commercial IP Security Option (CIPSO) to the IPv4 network
stack.  CIPSO has become a de-facto standard for trusted/labeled networking
amongst existing Trusted Operating Systems such as Trusted Solaris, HP-UX CMW,
etc.  This implementation is designed to be used with the NetLabel subsystem
to provide explicit packet labeling to LSM developers.

The CIPSO/IPv4 packet labeling works by the LSM calling a NetLabel API function
which attaches a CIPSO label (IPv4 option) to a given socket; this in turn
attaches the CIPSO label to every packet leaving the socket without any extra
processing on the outbound side.  On the inbound side the individual packet's
sk_buff is examined through a call to a NetLabel API function to determine if a
CIPSO/IPv4 label is present and if so the security attributes of the CIPSO
label are returned to the caller of the NetLabel API function.
---
 include/net/cipso_ipv4.h |  165 
 net/ipv4/cipso_ipv4.c| 1755 +++
 2 files changed, 1920 insertions(+)

Index: linux-2.6.17.i686-quilt/include/net/cipso_ipv4.h
===
--- /dev/null
+++ linux-2.6.17.i686-quilt/include/net/cipso_ipv4.h
@@ -0,0 +1,165 @@
+/*
+ * CIPSO - Commercial IP Security Option
+ *
+ * This is an implementation of the CIPSO 2.2 protocol as specified in
+ * draft-ietf-cipso-ipsecurity-01.txt with additional tag types as found in
+ * FIPS-188, copies of both documents can be found in the Documentation
+ * directory.  While CIPSO never became a full IETF RFC standard many vendors
+ * have chosen to adopt the protocol and over the years it has become a
+ * de-facto standard for labeled networking.
+ *
+ * Author: Paul Moore <[EMAIL PROTECTED]>
+ *
+ */
+
+/*
+ * (c) Copyright Hewlett-Packard Development Company, L.P., 2006
+ *
+ * This program is free software;  you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY;  without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program;  if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef _CIPSO_IPV4_H
+#define _CIPSO_IPV4_H
+
+#include 
+#include 
+#include 
+#include 
+
+/* known doi values */
+#define CIPSO_V4_DOI_UNKNOWN  0x
+
+/* tag types */
+#define CIPSO_V4_TAG_INVALID  0
+#define CIPSO_V4_TAG_RBITMAP  1
+#define CIPSO_V4_TAG_ENUM 2
+#define CIPSO_V4_TAG_RANGE5
+#define CIPSO_V4_TAG_PBITMAP  6
+#define CIPSO_V4_TAG_FREEFORM 7
+
+/* doi mapping types */
+#define CIPSO_V4_MAP_UNKNOWN  0
+#define CIPSO_V4_MAP_STD  1
+#define CIPSO_V4_MAP_PASS 2
+
+/* limits */
+#define CIPSO_V4_MAX_REM_LVLS 256
+#define CIPSO_V4_INV_LVL  0x8000
+#define CIPSO_V4_MAX_LOC_LVLS (CIPSO_V4_INV_LVL - 1)
+#define CIPSO_V4_MAX_REM_CATS 65536
+#define CIPSO_V4_INV_CAT  0x8000
+#define CIPSO_V4_MAX_LOC_CATS (CIPSO_V4_INV_CAT - 1)
+
+/*
+ * CIPSO DOI definitions
+ */
+
+/* DOI definition struct */
+#define CIPSO_V4_TAG_MAXCNT   5
+struct cipso_v4_doi {
+   u32 doi;
+   u32 type;
+   union {
+   struct cipso_v4_std_map_tbl *std;
+   } map;
+   u8 tags[CIPSO_V4_TAG_MAXCNT];
+
+   u32 valid;
+   struct list_head list;
+   struct rcu_head rcu;
+   struct list_head dom_list;
+};
+
+/* Standard CIPSO mapping table */
+/* NOTE: the highest order bit (i.e. 0x8000) is an 'invalid' flag, if the
+ *   bit is set then consider that value as unspecified, meaning the
+ *   mapping for that particular level/category is invalid */
+struct cipso_v4_std_map_tbl {
+   struct {
+   u32 *cipso;
+   u32 *local;
+   u32 cipso_size;
+   u32 local_size;
+   } lvl;
+   struct {
+   u32 *cipso;
+   u32 *local;
+   u32 cipso_size;
+   u32 local_size;
+   } cat;
+};
+
+/*
+ * Helper Functions
+ */
+
+#define CIPSO_V4_OPTEXIST(x) (IPCB(x)->opt.cipso != 0)
+#define CIPSO_V4_OPTPTR(x) ((x)->nh.raw + IPCB(x)->opt.cipso)
+
+/*
+ * DOI List Functions
+ */
+
+int cipso_v4_doi_add(struct cipso_v4_doi *doi_def);
+int cipso_v4_doi_remove(const u32 doi,
+   void (*callback) (struct rcu_head * head));
+struct cipso_v4_doi *cipso_v4_doi_getdef(const u32 doi);
+
+struct sk_buff *cipso_v4_doi_dump(const u32 doi, const u32 headroom);

[RFC 7/7] NetLabel: unlabeled packet handling

2006-06-21 Thread paul . moore
Add unlabeled packet support to the NetLabel subsystem.  NetLabel does not do
any processing on unlabled packets, but it must support passing unlabled
packets on both the inbound and outbound sides.
---
 net/netlabel/netlabel_unlabeled.c |  287 ++
 net/netlabel/netlabel_unlabeled.h |   83 ++
 2 files changed, 370 insertions(+)

Index: linux-2.6.17.i686-quilt/net/netlabel/netlabel_unlabeled.c
===
--- /dev/null
+++ linux-2.6.17.i686-quilt/net/netlabel/netlabel_unlabeled.c
@@ -0,0 +1,287 @@
+/*
+ * NetLabel Unlabeled Support
+ *
+ * This file defines functions for dealing with unlabeled packets for the
+ * NetLabel system.  The NetLabel system manages static and dynamic label
+ * mappings for network protocols such as CIPSO and RIPSO.
+ *
+ * Author: Paul Moore <[EMAIL PROTECTED]>
+ *
+ */
+
+/*
+ * (c) Copyright Hewlett-Packard Development Company, L.P., 2006
+ *
+ * This program is free software;  you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY;  without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program;  if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "netlabel_user.h"
+#include "netlabel_domainhash.h"
+#include "netlabel_unlabeled.h"
+
+/* Accept unlabeled packets flag */
+static atomic_t netlabel_unlabel_accept_flg = ATOMIC_INIT(0);
+
+/*
+ * Local Prototypes
+ */
+
+static void netlbl_unlabel_send_ack(const struct sk_buff *req_skb,
+   const u32 ret_code);
+
+/*
+ * Helper Functions
+ */
+
+/**
+ * netlbl_unlabel_put_hdr - Write a Unlabeled NetLabel header into a buffer
+ * @buffer: the buffer
+ * @opcode: the NetLabel Unlabeled opcode
+ *
+ * Description:
+ * Use the given values to write a NetLabel Unlabeled header into the given
+ * buffer.
+ *
+ */
+static void netlbl_unlabel_put_hdr(unsigned char *buffer, const u32 opcode)
+{
+   ((struct netlbl_unlabel_msghdr *)buffer)->opcode = opcode;
+}
+
+/**
+ * netlbl_unlabel_putinc_hdr - Write a Unlabeled NetLabel header into a buffer
+ * @buffer: the buffer
+ * @opcode: the NetLabel Unlabeled opcode
+ *
+ * Description:
+ * Use the given values to write a NetLabel Unlabeled header into the given
+ * buffer and increment the buffer pointer past the header.
+ *
+ */
+static void netlbl_unlabel_putinc_hdr(unsigned char **buffer, const u32 opcode)
+{
+   netlbl_unlabel_put_hdr(*buffer, opcode);
+   *buffer += sizeof(struct netlbl_unlabel_msghdr);
+}
+
+/**
+ * netlbl_unlabel_payload_len - Return the length of the payload
+ * @skb: the NETLINK buffer
+ *
+ * Description:
+ * This function returns the length of the NetLabel unlabeled payload.
+ *
+ */
+static u32 netlbl_unlabel_payload_len(const struct sk_buff *skb)
+{
+   const struct nlmsghdr *nl_hdr = (struct nlmsghdr *)skb->data;
+
+   if (nlmsg_len(nl_hdr) <= sizeof(struct netlbl_unlabel_msghdr))
+   return 0;
+   return nlmsg_len(nl_hdr) - sizeof(struct netlbl_unlabel_msghdr);
+}
+
+/**
+ * netlbl_unlabel_payload_data - Returns a pointer to the start of the data
+ * @skb: the NETLINK buffer
+ *
+ * Description:
+ * This function returns a pointer to the start of the NetLabel unlabeled
+ * payload.
+ *
+ */
+static unsigned char *netlbl_unlabel_payload_data(const struct sk_buff *skb)
+{
+   return nlmsg_data((struct nlmsghdr *)skb->data)
+   + sizeof(struct netlbl_unlabel_msghdr);
+}
+
+/*
+ * Label Mapping Functions
+ */
+
+/**
+ * netlbl_unlabel_accept - Handle an ACCEPT message
+ * @req_skb: the NETLINK buffer
+ * @msg: the NetLabel management message
+ *
+ * Description:
+ * Process a user generated ACCEPT message and set the accept flag accordingly.
+ *
+ */
+static void netlbl_unlabel_accept(const struct sk_buff *req_skb,
+const unsigned char *msg)
+{
+   u32 value;
+
+   if (netlbl_unlabel_payload_len(req_skb) == 4) {
+   value = netlbl_get_u32(msg);
+   if (value == 1 || value == 0) {
+   atomic_set(&netlabel_unlabel_accept_flg, value);
+   netlbl_unlabel_send_ack(req_skb, NETLBL_E_OK);
+   return;
+   }
+   }
+
+   netlbl_unlabel_send_ack(req_skb, EINVAL);
+   return;
+}
+
+/*
+ * NetLabel Protocol Ha

[RFC 1/7] NetLabel: documentation

2006-06-21 Thread paul . moore
Documentation for the NetLabel system, this includes a basic overview of how
NetLabel works and how LSM developers can integrate it into their favorite
LSM.  Also, due to the difficulty of finding expired IETF drafts, I am
including the IETF CIPSO draft that is the basis of the NetLabel CIPSO
implementation.
---
 CREDITS   |7 
 Documentation/00-INDEX|2 
 Documentation/netlabel/00-INDEX   |   10 
 Documentation/netlabel/cipso_ipv4.txt |   48 
 Documentation/netlabel/draft-ietf-cipso-ipsecurity-01.txt |  791 ++
 Documentation/netlabel/introduction.txt   |   52 
 Documentation/netlabel/lsm_interface.txt  |   47 
 7 files changed, 957 insertions(+)

Index: linux-2.6.17.i686-quilt/CREDITS
===
--- linux-2.6.17.i686-quilt.orig/CREDITS
+++ linux-2.6.17.i686-quilt/CREDITS
@@ -2383,6 +2383,13 @@ N: Thomas Molina
 E: [EMAIL PROTECTED]
 D: bug fixes, documentation, minor hackery
 
+N: Paul Moore
+E: [EMAIL PROTECTED]
+D: NetLabel author
+S: Hewlett-Packard
+S: 110 Spit Brook Road
+S: Nashua, NH 03062
+
 N: James Morris
 E: [EMAIL PROTECTED]
 W: http://namei.org/
Index: linux-2.6.17.i686-quilt/Documentation/00-INDEX
===
--- linux-2.6.17.i686-quilt.orig/Documentation/00-INDEX
+++ linux-2.6.17.i686-quilt/Documentation/00-INDEX
@@ -184,6 +184,8 @@ mtrr.txt
- how to use PPro Memory Type Range Registers to increase performance.
 nbd.txt
- info on a TCP implementation of a network block device.
+netlabel/
+   - directory with information on the NetLabel subsystem.
 networking/
- directory with info on various aspects of networking with Linux.
 nfsroot.txt
Index: linux-2.6.17.i686-quilt/Documentation/netlabel/00-INDEX
===
--- /dev/null
+++ linux-2.6.17.i686-quilt/Documentation/netlabel/00-INDEX
@@ -0,0 +1,10 @@
+00-INDEX
+   - this file.
+cipso_ipv4.txt
+   - documentation on the IPv4 CIPSO protocol engine.
+draft-ietf-cipso-ipsecurity-01.txt
+   - IETF draft of the CIPSO protocol, dated 16 July 1992.
+introduction.txt
+   - NetLabel introduction, READ THIS FIRST.
+lsm_interface.txt
+   - documentation on the NetLabel kernel security module API.
Index: linux-2.6.17.i686-quilt/Documentation/netlabel/cipso_ipv4.txt
===
--- /dev/null
+++ linux-2.6.17.i686-quilt/Documentation/netlabel/cipso_ipv4.txt
@@ -0,0 +1,48 @@
+NetLabel CIPSO/IPv4 Protocol Engine
+==
+Paul Moore, [EMAIL PROTECTED]
+
+May 17, 2006
+
+ * Overview
+
+The NetLabel CIPSO/IPv4 protocol engine is based on the IETF Commercial IP
+Security Option (CIPSO) draft from July 16, 1992.  A copy of this draft can be
+found in this directory, consult '00-INDEX' for the filename.  While the IETF
+draft never made it to an RFC standard it has become a de-facto standard for
+labeled networking and is used in many trusted operating systems.
+
+ * Outbound Packet Processing
+
+The CIPSO/IPv4 protocol engine applies the CIPSO IP option to packets by
+adding the CIPSO label to the socket.  This causes all packets leaving the
+system through the socket to have the CIPSO IP option applied.  The socket's
+CIPSO label can be changed at any point in time, however, it is recommended
+that it is set upon the socket's creation.  The LSM can set the socket's CIPSO
+label by using the NetLabel security module API; if the NetLabel "domain" is
+configured to use CIPSO for packet labeling then a CIPSO IP option will be
+generated and attached to the socket.
+
+ * Inbound Packet Processing
+
+The CIPSO/IPv4 protocol engine validates every CIPSO IP option it finds at the
+IP layer without any special handling required by the LSM.  However, in order
+to decode and translate the CIPSO label on the packet the LSM must use the
+NetLabel security module API to extract the security attributes of the packet.
+This is typically done at the socket layer using the 'socket_sock_rcv_skb()'
+LSM hook.
+
+ * Label Translation
+
+The CIPSO/IPv4 protocol engine contains a mechanism to translate CIPSO security
+attributes such as sensitivity level and category to values which are
+appropriate for the host.  These mappings are defined as part of a CIPSO
+Domain Of Interpretation (DOI) definition and are configured through the
+NetLabel user space communication layer.  Each DOI definition can have a
+different security attribute mapping table.
+
+ * Label Translation Cache
+
+The NetLabel system provides a framework for caching security attribute
+mappings from the network labels to the corresponding LSM identifiers.  The
+CIPSO/IPv4 protocol engine supports this ca

[RFC 0/7] Updated NetLabel patch

2006-06-21 Thread paul . moore
This is an updated version of the NetLabel patch I sent out on May 25th.  It
contains a variety of fixes and incorporates comments from James Morris,
Stephen Smalley, and Steve Grubb.  An intermediate version of this patch set
has also been tested against Trusted Solaris and HP-UX CMW for CIPSO
interoperability.  I have tested this patch set on x86 and x86_64
architectures running both the targeted/enforcing and mls/permissive SELinux
policies.

Just like before I am sending this patch out in an effort to solicit feedback
from developers, any comments you can afford to send would be greatly
appreciated.  While the patch is still "unfinished" my current todo list is
much shorter, the major tasks still remaining are:

 * protect against setsockopt() calls
 * address the remaining "PM" comments

For those wishing to try the patch for themselves you will need to download
and install the NetLabel tools.  The tools are used to configure the NetLabel
subsystem, documentation (including a man page) is included in the tarball.
The NetLabel tools, as well as more information, can be found here:

 * http://free.linux.hp.com/~pmoore/projects/linux_cipso

Thanks.

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


[RFC 5/7] NetLabel: SELinux support

2006-06-21 Thread paul . moore
Add NetLabel support to the SELinux LSM.  The most significant part of this
patch is the addition of NetLabel hooks into the following SELinux LSM hooks:

 * selinux_file_permission()
 * selinux_socket_sendmsg()
 * selinux_socket_post_create()
 * selinux_socket_post_accept() [NEW]
 * selinux_socket_sock_rcv_skb()
 * selinux_socket_getpeersec_stream()
 * selinux_socket_getpeersec_dgram()

The basic reasoning behind this patch is that outgoing packets are "NetLabel'd"
by labeling their socket and the NetLabel security attributes are checked via
the additional hook in selinux_socket_sock_rcv_skb().  NetLabel itself is only
a labeling mechanism, similar to filesystem extended attributes, it is up to
the SELinux enforcement mechanism to perform the actual access checks.

In addition to the changes outlined above this patch also includes some changes
to the extended bitmap (ebitmap) and multi-level security (mls) code to import
and export SELinux TE/MLS attributes into and out of NetLabel.
---
 security/selinux/hooks.c |   59 ++
 security/selinux/include/av_inherit.h|1 
 security/selinux/include/av_perm_to_string.h |1 
 security/selinux/include/av_permissions.h|1 
 security/selinux/include/flask.h |1 
 security/selinux/include/objsec.h|   11 
 security/selinux/include/security.h  |2 
 security/selinux/include/selinux_netlabel.h  |   94 
 security/selinux/nlmsgtab.c  |   15 
 security/selinux/ss/Makefile |3 
 security/selinux/ss/ebitmap.c|  155 +++
 security/selinux/ss/ebitmap.h|6 
 security/selinux/ss/mls.c|  160 +++
 security/selinux/ss/mls.h|   25 +
 security/selinux/ss/selinux_netlabel.c   |  574 +++
 security/selinux/ss/services.c   |   12 
 security/selinux/ss/services.h   |2 
 17 files changed, 1109 insertions(+), 13 deletions(-)

Index: linux-2.6.17.i686-quilt/security/selinux/hooks.c
===
--- linux-2.6.17.i686-quilt.orig/security/selinux/hooks.c
+++ linux-2.6.17.i686-quilt/security/selinux/hooks.c
@@ -12,6 +12,8 @@
  *  Copyright (C) 2003 Red Hat, Inc., James Morris <[EMAIL PROTECTED]>
  *  Copyright (C) 2004-2005 Trusted Computer Solutions, Inc.
  *  <[EMAIL PROTECTED]>
+ *  Copyright (C) 2006 Hewlett-Packard Development Company, L.P.
+ * Paul Moore, <[EMAIL PROTECTED]>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2,
@@ -74,6 +76,7 @@
 #include "objsec.h"
 #include "netif.h"
 #include "xfrm.h"
+#include "selinux_netlabel.h"
 
 #define XATTR_SELINUX_SUFFIX "selinux"
 #define XATTR_NAME_SELINUX XATTR_SECURITY_PREFIX XATTR_SELINUX_SUFFIX
@@ -2293,6 +2296,7 @@ static int selinux_inode_listsecurity(st
 
 static int selinux_file_permission(struct file *file, int mask)
 {
+   int rc;
struct inode *inode = file->f_dentry->d_inode;
 
if (!mask) {
@@ -2304,8 +2308,12 @@ static int selinux_file_permission(struc
if ((file->f_flags & O_APPEND) && (mask & MAY_WRITE))
mask |= MAY_APPEND;
 
-   return file_has_perm(current, file,
-file_mask_to_av(inode->i_mode, mask));
+   rc = file_has_perm(current, file,
+  file_mask_to_av(inode->i_mode, mask));
+   if (rc)
+   return rc;
+
+   return selinux_netlbl_inode_permission(inode, mask);
 }
 
 static int selinux_file_alloc_security(struct file *file)
@@ -2922,8 +2930,8 @@ out:
return err;
 }
 
-static void selinux_socket_post_create(struct socket *sock, int family,
-  int type, int protocol, int kern)
+static int selinux_socket_post_create(struct socket *sock, int family,
+ int type, int protocol, int kern)
 {
struct inode_security_struct *isec;
struct task_security_struct *tsec;
@@ -2935,7 +2943,7 @@ static void selinux_socket_post_create(s
isec->sid = kern ? SECINITSID_KERNEL : tsec->sid;
isec->initialized = 1;
 
-   return;
+   return selinux_netlbl_socket_create(sock, family, isec->sid);
 }
 
 /* Range of port numbers used to automatically bind.
@@ -3113,10 +3121,24 @@ static int selinux_socket_accept(struct 
return 0;
 }
 
+#ifdef CONFIG_NETLABEL
+static void selinux_socket_post_accept(struct socket *sock,
+  struct socket *newsock)
+{
+   selinux_netlbl_socket_accept(sock, newsock);
+}
+#endif /* CONFIG_NETLABEL */
+
 static int selinux_socket_sendmsg(struct socket *sock, struct msghdr *msg,
  int size)
 {
-   return socket_has_perm(current, sock, SOCKET__WRITE);
+   int rc;
+

Re: Intel ixgb driver bug in linux-2.6.17-rc6-mm2

2006-06-21 Thread Linas Vepstas
On Tue, Jun 20, 2006 at 02:13:45PM -0700, Jesse Brandeburg wrote:
> On 6/20/06, Linas Vepstas <[EMAIL PROTECTED]> wrote:
> >
> >I sat down to do some testing of the ixgb driver a few days ago, and
> >get failures within seconds.  From what I can tell, I'm getting either a
> >DMA to a bad address or some other PCI bus error, not sure which.
> >The problem appears to happen only for the driver that's in
> >2.6.17-rc6-mm2. As a sanity check, I'm testing the SuSE SLES10 beta,
> >which is 2.6.16 based, and it doesn't seem to have any problems.
> >
> >My test is dirt-simple: telnet to the chargen port.  After an eyeblink,
> >I get the pci bus error, that's that. "eyeblink" is after about 300MBytes
> >transfered.  That was with a driver with NAPI enabled. I tried again
> >with NAPI disabled, and got to about 1.8 GB transfered in two eyeblinks.
> >
> >To make sure that I'm not dealing with faulty hardware, I tried the same
> >thing w/ SLES10 2.6.16.18-1.8  and have gotten to RX bytes:20889480686
> >(19921.7 Mb) so far, with no problems. I don't have easy access to a PCI
> >bus analyzer, otherwise, I'd tell you more. Ideas? Suggestions?
> >
> >I could try taking the diff between these two driver versions, and
> >seeing what change caused the problem, but thought I should email first,
> >before doing that.

> try disabling TSO using ethtool and see if that helps any.

Bing!  That appears to have fixed it !

> you're running 1.0.109, correct?

Yes.  DRV_VERSION "1.0.109-k2"

> what does cat /proc/interrupts say (are you running MSI?)

No MSI, this is on older hardware.  
163:   3769 450130  14983 439113   XICS  Edge nic5

> I'd also like to know if LLTX support (recently added) is causing you
> the issue.  What hardware platform? pSeries?  does it EEH? what does
> the dump say?

Yes, its pseries; yes, I see this as EEH errors. However, the EEH error
detection is asynchronous, and so the Linux tack trace is throughly
boring: the error is first noticed when the watchdog runs, typically.

--linas

p.s. version 1.0.100-k2 works gret with NAPI on, and the defal TSO.
I haven't yet tried 1.0.109 with NAPI on and TSO off.

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


[RFC 2/7] NetLabel: core network changes

2006-06-21 Thread paul . moore
Changes to the core network stack to support the NetLabel subsystem.  This
includes changes to support the NetLabel NETLINK communication mechanism,
changes to the IPv4 option handling to support CIPSO labels, minor changes
to the socket_post_create() LSM hook so that it can return error codes, and
a new NetLabel hook in inet_accept() to handle NetLabel attributes across
an accept().
---
 include/linux/ip.h   |1 +
 include/linux/netlink.h  |1 +
 include/linux/security.h |   16 
 include/net/inet_sock.h  |2 +-
 net/ipv4/Makefile|3 +++
 net/ipv4/af_inet.c   |3 +++
 net/ipv4/ah4.c   |2 +-
 net/ipv4/ip_options.c|   19 +++
 net/socket.c |   13 +++--
 security/dummy.c |   12 ++--
 10 files changed, 54 insertions(+), 18 deletions(-)

Index: linux-2.6.17.i686-quilt/include/linux/ip.h
===
--- linux-2.6.17.i686-quilt.orig/include/linux/ip.h
+++ linux-2.6.17.i686-quilt/include/linux/ip.h
@@ -57,6 +57,7 @@
 #define IPOPT_SEC  (2 |IPOPT_CONTROL|IPOPT_COPY)
 #define IPOPT_LSRR (3 |IPOPT_CONTROL|IPOPT_COPY)
 #define IPOPT_TIMESTAMP(4 |IPOPT_MEASUREMENT)
+#define IPOPT_CIPSO(6 |IPOPT_CONTROL|IPOPT_COPY)
 #define IPOPT_RR   (7 |IPOPT_CONTROL)
 #define IPOPT_SID  (8 |IPOPT_CONTROL|IPOPT_COPY)
 #define IPOPT_SSRR (9 |IPOPT_CONTROL|IPOPT_COPY)
Index: linux-2.6.17.i686-quilt/include/linux/netlink.h
===
--- linux-2.6.17.i686-quilt.orig/include/linux/netlink.h
+++ linux-2.6.17.i686-quilt/include/linux/netlink.h
@@ -21,6 +21,7 @@
 #define NETLINK_DNRTMSG14  /* DECnet routing messages */
 #define NETLINK_KOBJECT_UEVENT 15  /* Kernel messages to userspace */
 #define NETLINK_GENERIC16
+#define NETLINK_NETLABEL   17  /* Network packet labeling */
 
 #define MAX_LINKS 32   
 
Index: linux-2.6.17.i686-quilt/include/linux/security.h
===
--- linux-2.6.17.i686-quilt.orig/include/linux/security.h
+++ linux-2.6.17.i686-quilt/include/linux/security.h
@@ -1267,8 +1267,8 @@ struct security_operations {
int (*unix_may_send) (struct socket * sock, struct socket * other);
 
int (*socket_create) (int family, int type, int protocol, int kern);
-   void (*socket_post_create) (struct socket * sock, int family,
-   int type, int protocol, int kern);
+   int (*socket_post_create) (struct socket * sock, int family,
+  int type, int protocol, int kern);
int (*socket_bind) (struct socket * sock,
struct sockaddr * address, int addrlen);
int (*socket_connect) (struct socket * sock,
@@ -2677,13 +2677,13 @@ static inline int security_socket_create
return security_ops->socket_create(family, type, protocol, kern);
 }
 
-static inline void security_socket_post_create(struct socket * sock, 
-  int family,
-  int type, 
-  int protocol, int kern)
+static inline int security_socket_post_create(struct socket * sock,
+ int family,
+ int type,
+ int protocol, int kern)
 {
-   security_ops->socket_post_create(sock, family, type,
-protocol, kern);
+   return security_ops->socket_post_create(sock, family, type,
+   protocol, kern);
 }
 
 static inline int security_socket_bind(struct socket * sock, 
Index: linux-2.6.17.i686-quilt/include/net/inet_sock.h
===
--- linux-2.6.17.i686-quilt.orig/include/net/inet_sock.h
+++ linux-2.6.17.i686-quilt/include/net/inet_sock.h
@@ -52,7 +52,7 @@ struct ip_options {
ts_needtime:1,
ts_needaddr:1;
unsigned char   router_alert;
-   unsigned char   __pad1;
+   unsigned char   cipso;
unsigned char   __pad2;
unsigned char   __data[0];
 };
Index: linux-2.6.17.i686-quilt/net/ipv4/Makefile
===
--- linux-2.6.17.i686-quilt.orig/net/ipv4/Makefile
+++ linux-2.6.17.i686-quilt/net/ipv4/Makefile
@@ -42,6 +42,9 @@ obj-$(CONFIG_TCP_CONG_HYBLA) += tcp_hybl
 obj-$(CONFIG_TCP_CONG_HTCP) += tcp_htcp.o
 obj-$(CONFIG_TCP_CONG_VEGAS) += tcp_vegas.o
 obj-$(CONFIG_TCP_CONG_SCALABLE) += tcp_scalable.o
+ifeq ($(CONFIG_NETLABEL_CIPSOV4),y)
+obj-y += cipso_ipv4.o
+endif
 
 obj-$(CONFIG_XFRM) += xfrm4_policy.o xfrm4_state.o xfrm4_input.o \
  xfrm4_output.o
Index: l

[RFC 6/7] NetLabel: CIPSOv4 integration

2006-06-21 Thread paul . moore
Add CIPSO/IPv4 support and management to the NetLabel subsystem.  These changes
integrate the CIPSO/IPv4 configuration into the existing NetLabel code and
enable the use of CIPSO/IPv4 within the overall NetLabel framework.
---
 net/netlabel/netlabel_cipso_v4.c |  583 +++
 net/netlabel/netlabel_cipso_v4.h |  201 +
 2 files changed, 784 insertions(+)

Index: linux-2.6.17.i686-quilt/net/netlabel/netlabel_cipso_v4.c
===
--- /dev/null
+++ linux-2.6.17.i686-quilt/net/netlabel/netlabel_cipso_v4.c
@@ -0,0 +1,583 @@
+/*
+ * NetLabel CIPSO/IPv4 Support
+ *
+ * This file defines the CIPSO/IPv4 functions for the NetLabel system.  The
+ * NetLabel system manages static and dynamic label mappings for network
+ * protocols such as CIPSO and RIPSO.
+ *
+ * Author: Paul Moore <[EMAIL PROTECTED]>
+ *
+ */
+
+/*
+ * (c) Copyright Hewlett-Packard Development Company, L.P., 2006
+ *
+ * This program is free software;  you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY;  without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program;  if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "netlabel_user.h"
+#include "netlabel_cipso_v4.h"
+
+/*
+ * Local Prototypes
+ */
+
+static void netlbl_cipsov4_send_ack(const struct sk_buff *req_skb,
+   const u32 ret_code);
+
+/*
+ * Helper Functions
+ */
+
+/**
+ * netlbl_cipsov4_put_hdr - Write a CIPSO NetLabel header into a buffer
+ * @buffer: the buffer
+ * @opcode: the NetLabel CIPSOv4 opcode
+ * @doi: the CIPSO DOI value
+ *
+ * Description:
+ * Use the given values to write a NetLabel CIPSOv4 header into the given
+ * buffer.
+ *
+ */
+static void netlbl_cipsov4_put_hdr(unsigned char *buffer,
+  const u32 opcode,
+  const u32 doi)
+{
+   struct netlbl_cipsov4_msghdr *hdr =
+   (struct netlbl_cipsov4_msghdr *)buffer;
+   hdr->opcode = opcode;
+   hdr->doi = doi;
+}
+
+/**
+ * netlbl_cipsov4_putinc_hdr - Write a CIPSO NetLabel header into a buffer
+ * @buffer: the buffer
+ * @opcode: the NetLabel CIPSOv4 opcode
+ * @doi: the CIPSO DOI value
+ *
+ * Description:
+ * Use the given values to write a NetLabel CIPSOv4 header into the given
+ * buffer and increment the buffer pointer past the header.
+ *
+ */
+static void netlbl_cipsov4_putinc_hdr(unsigned char **buffer,
+ const u32 opcode,
+ const u32 doi)
+{
+   netlbl_cipsov4_put_hdr(*buffer, opcode, doi);
+   *buffer += sizeof(struct netlbl_cipsov4_msghdr);
+}
+
+/**
+ * netlbl_cipsov4_payload_len - Return the length of the payload
+ * @skb: the NETLINK buffer
+ *
+ * Description:
+ * This function returns the length of the CIPSO V4 NetLabel payload.
+ *
+ */
+static u32 netlbl_cipsov4_payload_len(const struct sk_buff *skb)
+{
+   const struct nlmsghdr *nl_hdr = (struct nlmsghdr *)skb->data;
+
+   if (nlmsg_len(nl_hdr) <= sizeof(struct netlbl_cipsov4_msghdr))
+   return 0;
+   return nlmsg_len(nl_hdr) - sizeof(struct netlbl_cipsov4_msghdr);
+}
+
+/**
+ * netlbl_cipsov4_payload_data - Returns a pointer to the start of the data
+ * @skb: the NETLINK buffer
+ *
+ * Description:
+ * This function returns a pointer to the start of the CIPSO V4 NetLabel
+ * payload.
+ *
+ */
+static unsigned char *netlbl_cipsov4_payload_data(const struct sk_buff *skb)
+{
+   return nlmsg_data((struct nlmsghdr *)skb->data) +
+   sizeof(struct netlbl_cipsov4_msghdr);
+}
+
+/**
+ * netlbl_cipsov4_doi_free - Frees a CIPSO V4 DOI definition
+ * @entry: the entry's RCU field
+ *
+ * Description:
+ * This function is designed to be used as a callback to the call_rcu()
+ * function so that the memory allocated to the DOI definition can be released
+ * safely.
+ *
+ */
+static void netlbl_cipsov4_doi_free(struct rcu_head *entry)
+{
+   struct cipso_v4_doi *ptr;
+
+   ptr = container_of(entry, struct cipso_v4_doi, rcu);
+   switch (ptr->type) {
+   case CIPSO_V4_MAP_STD:
+   if (ptr->map.std->lvl.cipso_size > 0)
+   kfree(ptr->map.std->lvl.cipso);
+   if (ptr->map.std->lvl.local_size > 0)
+   kfree(ptr->map.std->lvl.local);
+   

Re: [PATCH 0/2][RFC] Network Event Notifier Mechanism

2006-06-21 Thread YOSHIFUJI Hideaki / 吉藤英明
In article <[EMAIL PROTECTED]> (at Wed, 21 Jun 2006 13:45:19 -0500), Steve Wise 
<[EMAIL PROTECTED]> says:

> This patch implements a mechanism that allows interested clients to
> register for notification of certain network events. The intended use
> is to allow RDMA devices (linux/drivers/infiniband) to be notified of
> neighbour updates, ICMP redirects, path MTU changes, and route changes.

Why not netlink?
Neighbor / routing updates should be transmitted via netlink, at least.

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


[PATCH 0/2][RFC] Network Event Notifier Mechanism

2006-06-21 Thread Steve Wise

This patch implements a mechanism that allows interested clients to
register for notification of certain network events. The intended use
is to allow RDMA devices (linux/drivers/infiniband) to be notified of
neighbour updates, ICMP redirects, path MTU changes, and route changes.

The reason these devices need update events is because they typically
cache this information in hardware and need to be notified when this
information has been updated.

This approach is one of many possibilities and may be preferred because it
uses an existing notification mechanism that has precedent in the stack.
An alternative would be to add a netdev method to notify affect devices
of these events.

This code does not yet implement path MTU change because the number of
places in which this value is updated is large and if this mechanism
seems reasonable, it would be probably be best to funnel these updates
through a single function.

We would like to get this or similar functionality included in 2.6.19
and request comments.

This patchset consists of 2 patches:

1) New files implementing the Network Event Notifier
2) Core network changes to generate network event notifications

Signed-off-by: Tom Tucker <[EMAIL PROTECTED]>
Signed-off-by: Steve Wise <[EMAIL PROTECTED]>
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/2] Network Event Notifier Mechanism.

2006-06-21 Thread Steve Wise

This patch uses notifier blocks to implement a network event
notifier mechanism.

Clients register their callback function by calling
register_netevent_notifier() like this:

static struct notifier_block nb = {
.notifier_call = my_callback_func
};

...

register_netevent_notifier(&nb);
---

 include/net/netevent.h |   41 +
 net/core/netevent.c|   67 
 2 files changed, 108 insertions(+), 0 deletions(-)

diff --git a/include/net/netevent.h b/include/net/netevent.h
new file mode 100644
index 000..9ceab27
--- /dev/null
+++ b/include/net/netevent.h
@@ -0,0 +1,41 @@
+#ifndef _NET_EVENT_H
+#define _NET_EVENT_H
+
+/*
+ * Generic netevent notifiers
+ *
+ * Authors:
+ *  Tom Tucker  <[EMAIL PROTECTED]>
+ *
+ * Changes:
+ */
+
+#ifdef __KERNEL__
+
+#include 
+
+struct netevent_redirect {
+   struct dst_entry *old;
+   struct dst_entry *new;
+};
+
+struct netevent_route_change {
+int event;
+struct fib_info *fib_info;
+};
+
+enum netevent_notif_type {
+   NETEVENT_NEIGH_UPDATE = 1, /* arg is * struct neighbour */
+   NETEVENT_ROUTE_UPDATE, /* arg is * netevent_route_change */
+   NETEVENT_PMTU_UPDATE,
+   NETEVENT_REDIRECT, /* arg is * struct netevent_redirect */
+};
+
+extern int register_netevent_notifier(struct notifier_block *nb);
+extern int unregister_netevent_notifier(struct notifier_block *nb);
+extern int call_netevent_notifiers(unsigned long val, void *v);
+
+#endif
+#endif
+
+
diff --git a/net/core/netevent.c b/net/core/netevent.c
new file mode 100644
index 000..2261fb3
--- /dev/null
+++ b/net/core/netevent.c
@@ -0,0 +1,67 @@
+/*
+ * Network event notifiers
+ *
+ * Authors:
+ *  Tom Tucker <[EMAIL PROTECTED]>
+ *
+ * This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU General Public License
+ *  as published by the Free Software Foundation; either version
+ *  2 of the License, or (at your option) any later version.
+ *
+ * Fixes:
+ */
+
+#include 
+#include 
+
+static struct atomic_notifier_head netevent_notif_chain;
+
+/**
+ * register_netevent_notifier - register a netevent notifier block
+ * @nb: notifier
+ *
+ * Register a notifier to be called when a netevent occurs.
+ * The notifier passed is linked into the kernel structures and must
+ * not be reused until it has been unregistered. A negative errno code
+ * is returned on a failure.
+ */
+int register_netevent_notifier(struct notifier_block *nb)
+{
+   int err;
+
+   err = atomic_notifier_chain_register(&netevent_notif_chain, nb);
+   return err;
+}
+
+/**
+ * netevent_unregister_notifier - unregister a netevent notifier block
+ * @nb: notifier
+ *
+ * Unregister a notifier previously registered by
+ * register_neigh_notifier(). The notifier is unlinked into the
+ * kernel structures and may then be reused. A negative errno code
+ * is returned on a failure.
+ */
+
+int unregister_netevent_notifier(struct notifier_block *nb)
+{
+   return atomic_notifier_chain_unregister(&netevent_notif_chain, nb);
+}
+
+/**
+ * call_netevent_notifiers - call all netevent notifier blocks
+ *  @val: value passed unmodified to notifier function
+ *  @v:   pointer passed unmodified to notifier function
+ *
+ * Call all neighbour notifier blocks.  Parameters and return value
+ * are as for notifier_call_chain().
+ */
+
+int call_netevent_notifiers(unsigned long val, void *v)
+{
+   return atomic_notifier_call_chain(&netevent_notif_chain, val, v);
+}
+
+EXPORT_SYMBOL_GPL(register_netevent_notifier);
+EXPORT_SYMBOL_GPL(unregister_netevent_notifier);
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/2] Core network changes to support network event notification.

2006-06-21 Thread Steve Wise

This patch adds event calls for neighbour change, route update, and
routing redirect events.

TODO: PMTU change events.
---

 net/core/Makefile|2 +-
 net/core/neighbour.c |8 
 net/ipv4/fib_semantics.c |7 +++
 net/ipv4/route.c |6 ++
 4 files changed, 22 insertions(+), 1 deletions(-)

diff --git a/net/core/Makefile b/net/core/Makefile
index e9bd246..2645ba4 100644
--- a/net/core/Makefile
+++ b/net/core/Makefile
@@ -7,7 +7,7 @@ obj-y := sock.o request_sock.o skbuff.o 
 
 obj-$(CONFIG_SYSCTL) += sysctl_net_core.o
 
-obj-y   += dev.o ethtool.o dev_mcast.o dst.o \
+obj-y   += dev.o ethtool.o dev_mcast.o dst.o netevent.o \
neighbour.o rtnetlink.o utils.o link_watch.o filter.o
 
 obj-$(CONFIG_XFRM) += flow.o
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 50a8c73..c637897 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -30,9 +30,11 @@ #include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
+#include 
 
 #define NEIGH_DEBUG 1
 
@@ -755,6 +757,7 @@ #endif
neigh->nud_state = NUD_STALE;
neigh->updated = jiffies;
neigh_suspect(neigh);
+   call_netevent_notifiers(NETEVENT_NEIGH_UPDATE, neigh);
}
} else if (state & NUD_DELAY) {
if (time_before_eq(now, 
@@ -763,6 +766,7 @@ #endif
neigh->nud_state = NUD_REACHABLE;
neigh->updated = jiffies;
neigh_connect(neigh);
+   call_netevent_notifiers(NETEVENT_NEIGH_UPDATE, neigh);
next = neigh->confirmed + neigh->parms->reachable_time;
} else {
NEIGH_PRINTK2("neigh %p is probed.\n", neigh);
@@ -783,6 +787,7 @@ #endif
neigh->nud_state = NUD_FAILED;
neigh->updated = jiffies;
notify = 1;
+   call_netevent_notifiers(NETEVENT_NEIGH_UPDATE, neigh);
NEIGH_CACHE_STAT_INC(neigh->tbl, res_failed);
NEIGH_PRINTK2("neigh %p is failed.\n", neigh);
 
@@ -1056,6 +1061,9 @@ out:
(neigh->flags | NTF_ROUTER) :
(neigh->flags & ~NTF_ROUTER);
}
+
+   call_netevent_notifiers(NETEVENT_NEIGH_UPDATE, neigh);
+
write_unlock_bh(&neigh->lock);
 #ifdef CONFIG_ARPD
if (notify && neigh->parms->app_probes)
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index 0f4145b..67a30af 100644
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -45,6 +45,7 @@ #include 
 #include 
 #include 
 #include 
+#include 
 
 #include "fib_lookup.h"
 
@@ -278,9 +279,15 @@ void rtmsg_fib(int event, u32 key, struc
   struct nlmsghdr *n, struct netlink_skb_parms *req)
 {
struct sk_buff *skb;
+   struct netevent_route_change rev;
+
u32 pid = req ? req->pid : n->nlmsg_pid;
int size = NLMSG_SPACE(sizeof(struct rtmsg)+256);
 
+   rev.event = event;
+   rev.fib_info = fa->fa_info;
+   call_netevent_notifiers(NETEVENT_ROUTE_UPDATE, &rev);
+
skb = alloc_skb(size, GFP_KERNEL);
if (!skb)
return;
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index cc9423d..e9ba831 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -105,6 +105,7 @@ #include 
 #include 
 #include 
 #include 
+#include 
 #ifdef CONFIG_SYSCTL
 #include 
 #endif
@@ -1120,6 +1121,7 @@ void ip_rt_redirect(u32 old_gw, u32 dadd
struct rtable *rth, **rthp;
u32  skeys[2] = { saddr, 0 };
int  ikeys[2] = { dev->ifindex, 0 };
+   struct netevent_redirect netevent;
 
if (!in_dev)
return;
@@ -1211,6 +1213,10 @@ void ip_rt_redirect(u32 old_gw, u32 dadd
rt_drop(rt);
goto do_next;
}
+   
+   netevent.old = &rth->u.dst;
+   netevent.new = &rt->u.dst;
+   call_netevent_notifiers(NETEVENT_REDIRECT, 
&netevent);
 
rt_del(hash, rth);
if (!rt_intern_hash(hash, rt, &rt))
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v3 1/7] AMSO1100 Low Level Driver.

2006-06-21 Thread Steve Wise

> ok pci posting...
> 
> basically, if you use writel() and co, the PCI bridges in the middle are
> allowed (and the more fancy ones do) cache the write, to see if more
> writes follow, so that the bridge can do the writes as a single burst to
> the device, rather than as individual writes. This is of course great...
> ... except when you really want the write to hit the device before the
> driver continues with other actions. 
> 
> Now the PCI spec is set up such that any traffic in the other direction
> (basically readl() and co) will first flush the write through the system
> before the read is actually sent to the device, so doing a dummy readl()
> is a good way to flush any pending posted writes.
> 
> Where does this matter? 
> it matters most at places such as irq enabling/disabling, IO submission
> and possibly IRQ acking, but also often in eeprom-like read/write logic
> (where you do manual clocking and need to do delays between the
> write()'s). But in general... any place where you do writel() without
> doing any readl() before doing nothing to the card for a long time, or
> where you are waiting for the card to do something (or want it done NOW,
> such as IRQ disabling) you need to issue a (dummy) readl() to flush
> pending writes out to the hardware.
> 
> 
> does this explanation make any sense? if not please feel free to ask any
> questions, I know I'm not always very good at explaining things.

Yep.  I get it.  I believe we're ok in this respect, but I'll review the
code again with an eye for this issue...

Steve.



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


Re: [openib-general] [PATCH v3 1/7] AMSO1100 Low Level Driver.

2006-06-21 Thread Grant Grundler
On Wed, Jun 21, 2006 at 11:32:51AM -0500, Steve Wise wrote:
> Um, what's a 'PCI posting flush'?  Can you point me where its
> described/used so I can see if we need it?  Thanx.

I've written this up before:
http://iou.parisc-linux.org/ols_2002/4Posted_vs_Non_Posted.html

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


Re: [PATCH v3 1/7] AMSO1100 Low Level Driver.

2006-06-21 Thread Arjan van de Ven
>  0;
> > > +
> > > + __raw_writew(0, elem->hw_desc + C2_RXP_STATUS);
> > > + __raw_writew(0, elem->hw_desc + C2_RXP_COUNT);
> > > + __raw_writew(0, elem->hw_desc + C2_RXP_LEN);
> > 
> > you seem to be a fan of the __raw_write() functions... any reason why?
> > __raw_ is not a magic "go faster" prefix
> > 
> 
> In this particular case, I believe this is done to avoid a swap of '0'
> since its not necessary.  

but.. that should writew() and co just autodetect (or do it at compile
time)...
(maybe it doesn't and we have an optimization opportunity here ;)

> > Also on a related note, have you checked the driver for the needed PCI
> > posting flushes?
> > 
> 
> Um, what's a 'PCI posting flush'?  Can you point me where its
> described/used so I can see if we need it?  Thanx.

ok pci posting...

basically, if you use writel() and co, the PCI bridges in the middle are
allowed (and the more fancy ones do) cache the write, to see if more
writes follow, so that the bridge can do the writes as a single burst to
the device, rather than as individual writes. This is of course great...
... except when you really want the write to hit the device before the
driver continues with other actions. 

Now the PCI spec is set up such that any traffic in the other direction
(basically readl() and co) will first flush the write through the system
before the read is actually sent to the device, so doing a dummy readl()
is a good way to flush any pending posted writes.

Where does this matter? 
it matters most at places such as irq enabling/disabling, IO submission
and possibly IRQ acking, but also often in eeprom-like read/write logic
(where you do manual clocking and need to do delays between the
write()'s). But in general... any place where you do writel() without
doing any readl() before doing nothing to the card for a long time, or
where you are waiting for the card to do something (or want it done NOW,
such as IRQ disabling) you need to issue a (dummy) readl() to flush
pending writes out to the hardware.


does this explanation make any sense? if not please feel free to ask any
questions, I know I'm not always very good at explaining things.

Greetings,
   Arjan van de Ven

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


Re: [PATCH v3 1/7] AMSO1100 Low Level Driver.

2006-06-21 Thread Steve Wise
On Tue, 2006-06-20 at 22:43 +0200, Arjan van de Ven wrote:
> On Tue, 2006-06-20 at 15:30 -0500, Steve Wise wrote:
> 
> > +/*
> > + * Allocate TX ring elements and chain them together.
> > + * One-to-one association of adapter descriptors with ring elements.
> > + */
> > +static int c2_tx_ring_alloc(struct c2_ring *tx_ring, void *vaddr,
> > +   dma_addr_t base, void __iomem * mmio_txp_ring)
> > +{
> > +   struct c2_tx_desc *tx_desc;
> > +   struct c2_txp_desc __iomem *txp_desc;
> > +   struct c2_element *elem;
> > +   int i;
> > +
> > +   tx_ring->start = kmalloc(sizeof(*elem) * tx_ring->count, GFP_KERNEL);
> 
> I would think this needs a dma_alloc_coherent() rather than a kmalloc...
> 

No, this memory is used to describe the tx ring from the host's
perspective.  The HW never touches this memory.  The HW's TX descriptor
ring is in adapter memory and is mapped into host memory (see
c2dev->mmio_txp_ring).

> 
> > +
> > +/* Free all buffers in RX ring, assumes receiver stopped */
> > +static void c2_rx_clean(struct c2_port *c2_port)
> > +{
> > +   struct c2_dev *c2dev = c2_port->c2dev;
> > +   struct c2_ring *rx_ring = &c2_port->rx_ring;
> > +   struct c2_element *elem;
> > +   struct c2_rx_desc *rx_desc;
> > +
> > +   elem = rx_ring->start;
> > +   do {
> > +   rx_desc = elem->ht_desc;
> > +   rx_desc->len = 0;
> > +
> > +   __raw_writew(0, elem->hw_desc + C2_RXP_STATUS);
> > +   __raw_writew(0, elem->hw_desc + C2_RXP_COUNT);
> > +   __raw_writew(0, elem->hw_desc + C2_RXP_LEN);
> 
> you seem to be a fan of the __raw_write() functions... any reason why?
> __raw_ is not a magic "go faster" prefix
> 

In this particular case, I believe this is done to avoid a swap of '0'
since its not necessary.  In other places, __raw is used because the
adapter needs the data in BE and we want to explicitly swap it using
cpu_to_be* then raw_write it to the adapter memory...


> Also on a related note, have you checked the driver for the needed PCI
> posting flushes?
> 

Um, what's a 'PCI posting flush'?  Can you point me where its
described/used so I can see if we need it?  Thanx.


> > +
> > +   /* Disable IRQs by clearing the interrupt mask */
> > +   writel(1, c2dev->regs + C2_IDIS);
> > +   writel(0, c2dev->regs + C2_NIMR0);
> 
> like here...
> > +
> > +   elem = tx_ring->to_use;
> > +   elem->skb = skb;
> > +   elem->mapaddr = mapaddr;
> > +   elem->maplen = maplen;
> > +
> > +   /* Tell HW to xmit */
> > +   __raw_writeq(cpu_to_be64(mapaddr), elem->hw_desc + C2_TXP_ADDR);
> > +   __raw_writew(cpu_to_be16(maplen), elem->hw_desc + C2_TXP_LEN);
> > +   __raw_writew(cpu_to_be16(TXP_HTXD_READY), elem->hw_desc + C2_TXP_FLAGS);
> 
> or here
> 
> > +static int c2_change_mtu(struct net_device *netdev, int new_mtu)
> > +{
> > +   int ret = 0;
> > +
> > +   if (new_mtu < ETH_ZLEN || new_mtu > ETH_JUMBO_MTU)
> > +   return -EINVAL;
> > +
> > +   netdev->mtu = new_mtu;
> > +
> > +   if (netif_running(netdev)) {
> > +   c2_down(netdev);
> > +
> > +   c2_up(netdev);
> > +   }
> 
> this looks odd...
> 

The 1100 hardware caches the dma address of the next skb that will be
used to place data.  When the MTU changes, we want to free the SKBs in
the RX descriptor ring and get new ones that sufficient for the new MTU.
To effectively flush that cached address of the old skb, we must quiesce
the HW and firmware (via c2_down()), then reinitialize everything with
skb's big enough for the new mtu. 

Steve.


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


[PATCH 1/3] PAL: Support of the fixed PHY

2006-06-21 Thread Vitaly Bordug

This makes it possible for HW PHY-less boards to utilize PAL goodies.
Generic routines to connect to fixed PHY are provided, as well as ability
to specify software callback that fills up link, speed, etc. information
into PHY descriptor (the latter feature not tested so far).

Signed-off-by: Vitaly Bordug <[EMAIL PROTECTED]>
---

 drivers/net/phy/Kconfig  |   17 ++
 drivers/net/phy/fixed.c  |  385 ++
 drivers/net/phy/phy_device.c |   51 +++---
 include/linux/phy.h  |1 
 4 files changed, 433 insertions(+), 21 deletions(-)

diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
index cda3e53..425be84 100644
--- a/drivers/net/phy/Kconfig
+++ b/drivers/net/phy/Kconfig
@@ -51,5 +51,22 @@ config SMSC_PHY
---help---
  Currently supports the LAN83C185 PHY
 
+config FIXED_PHY
+   tristate "Drivers for PHY emulation on fixed speed/link"
+   depends on PHYLIB
+   ---help---
+ Adds the driver to PHY layer to cover the boards that do not have any 
PHY bound,
+ but with the ability to manipulate with speed/link in software. The 
relavant MII
+ speed/duplex parameters could be effectively handled in 
user-specified  fuction.
+ Currently tested with mpc866ads.
+
+config FIXED_MII_10_FDX
+   bool "Emulation for 10M Fdx fixed PHY behavior"
+   depends on FIXED_PHY
+
+config FIXED_MII_100_FDX
+   bool "Emulation for 100M Fdx fixed PHY behavior"
+   depends on FIXED_PHY
+
 endmenu
 
diff --git a/drivers/net/phy/fixed.c b/drivers/net/phy/fixed.c
new file mode 100644
index 000..0360f65
--- /dev/null
+++ b/drivers/net/phy/fixed.c
@@ -0,0 +1,385 @@
+/*
+ * drivers/net/phy/fixed.c
+ *
+ * Driver for fixed PHYs, when transceiver is able to operate in one fixed 
mode.
+ *
+ * Author: Vitaly Bordug
+ *
+ * Copyright (c) 2006 MontaVista Software, 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 the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ *
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#define MII_REGS_NUM   7
+
+/*
+The idea is to emulate normal phy behavior by responding with
+pre-defined values to mii BMCR read, so that read_status hook could
+take all the needed info.
+*/
+
+struct fixed_phy_status {
+   u8  link;
+   u16 speed;
+   u8  duplex;
+};
+
+/*-
+ *  Private information hoder for mii_bus
+ 
*-*/
+struct fixed_info {
+   u16 *regs;
+   u8 regs_num;
+   struct fixed_phy_status phy_status;
+   struct phy_device *phydev; /* pointer to the container */
+   /* link & speed cb */
+   int(*link_update)(struct net_device*, struct fixed_phy_status*);
+
+};
+
+/*
+This is made global to free all the allocations on _exit call.
+Looks a bit odd, seems the only way.
+*/
+static struct fixed_info *fixed_ptr;
+
+/*-
+ *  If something weird is required to be done with link/speed,
+ * network driver is able to assign a function to implement this.
+ * May be useful for PHY's that need to be software-driven.
+ 
*-*/
+int fixed_mdio_set_link_update(struct phy_device* phydev,
+   int(*link_update)(struct net_device*, struct fixed_phy_status*))
+{
+   struct fixed_info *fixed;
+
+   if(link_update == NULL)
+   return -EINVAL;
+
+   if(phydev) {
+   if(phydev->bus) {
+   fixed = phydev->bus->priv;
+   fixed->link_update = link_update;
+   return 0;
+   }
+   }
+   return -EINVAL;
+}
+EXPORT_SYMBOL(fixed_mdio_set_link_update);
+
+/*-
+ *  This is used for updating internal mii regs from the status
+ 
*-*/
+static int fixed_mdio_update_regs(struct fixed_info *fixed)
+{
+   u16 *regs = fixed->regs;
+   u16 bmsr = 0;
+   u16 bmcr = 0;
+
+   if(!regs) {
+   printk(KERN_ERR "%s: regs not set up", __FUNCTION__);
+   return -1;
+   }
+
+   if(fixed->phy_status.link)
+   bmsr |= BMSR_LSTATUS;
+
+   if(fixed->phy_status.duplex) {
+   bmcr |= BMCR_FULLDPLX;
+
+   switch ( fixed->phy_status.speed ) {
+ 

[PATCH 3/3] FS_ENET: phydev pointer may be dereferenced without NULL check

2006-06-21 Thread Vitaly Bordug

When interface is down, phy is "disconnected" from the bus and phydev is NULL.
But ethtool may try to get/set phy regs even at that time, which results in
NULL pointer dereference and OOPS hereby.

Signed-off-by: Vitaly Bordug <[EMAIL PROTECTED]>
---

 drivers/net/fs_enet/fs_enet-main.c |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/net/fs_enet/fs_enet-main.c 
b/drivers/net/fs_enet/fs_enet-main.c
index 302ecaa..e475e22 100644
--- a/drivers/net/fs_enet/fs_enet-main.c
+++ b/drivers/net/fs_enet/fs_enet-main.c
@@ -882,12 +882,16 @@ static void fs_get_regs(struct net_devic
 static int fs_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
 {
struct fs_enet_private *fep = netdev_priv(dev);
+   if (!fep->phydev)
+   return -EINVAL;
return phy_ethtool_gset(fep->phydev, cmd);
 }
 
 static int fs_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
 {
struct fs_enet_private *fep = netdev_priv(dev);
+   if (!fep->phydev)
+   return -EINVAL;
phy_ethtool_sset(fep->phydev, cmd);
return 0;
 }

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


Re: [patch] ipv6 source address selection in addrconf.c (2.6.17)

2006-06-21 Thread Lukasz Stelmach
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1


- --- linux/net/ipv6/addrconf.c.orig2006-06-21 11:41:22.0 +0200
+++ linux/net/ipv6/addrconf.c   2006-06-21 17:18:56.0 +0200
@@ -862,6 +862,8 @@ static int inline ipv6_saddr_label(const
   *2002::/16   2
   *::/96   3
   *:::0:0/96   4
+  *fc00::/75
+  *2001::/32   6
   */
if (type & IPV6_ADDR_LOOPBACK)
return 0;
@@ -869,8 +871,12 @@ static int inline ipv6_saddr_label(const
return 3;
else if (type & IPV6_ADDR_MAPPED)
return 4;
+   else if (addr->s6_addr32[0] == htonl(0x2001))
+   return 6;
else if (addr->s6_addr16[0] == htons(0x2002))
return 2;
+   else if ((addr->s6_addr[0] & 0xfe) == 0xfc)
+   return 5;
return 1;
 }

Two additional labels (RFC 3484, sec. 10.3) for IPv6 addreses
are defined to make a distinction between global unicast
addresses and Unique Local Addresses (fc00::/7, RFC 4193) and
Teredo (2001::/32, RFC 4380). It is necessary to avoid attempts
of connection that would either fail (eg. fec0:: to 2001:feed::)
or be sub-optimal (2001:0:: to 2001:feed::).

Signed-off-by: Łukasz Stelmach <[EMAIL PROTECTED]>
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.2.2 (GNU/Linux)

iD4DBQFEmW0LNdzY8sm9K9wRAjVGAKCOS1MVIro3bJ6szHzuAzaXXNaq/gCY4jfO
timfJc6SmrygMer36Tdqzg==
=Qzch
-END PGP SIGNATURE-

-- 
Było mi bardzo miło.Czwarta pospolita klęska, [...]
>Łukasz<  Już nie katolicka lecz złodziejska.  (c)PP


--
Zobacz nowosci salonu moto w Madrycie >>> http://link.interia.pl/f1961

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


Re: [PATCH 2/6] ehea: pHYP interface

2006-06-21 Thread Roland Dreier
I think this code needs to be refactored so that it can share with the
ehca InfiniBand driver (which should be merged upstream soon).  For
example, you have ehea_hcall_7arg_7ret() and the ehca driver has an
identical ehca_hcall_7arg_7ret().

Also:

 > +++ kernel/drivers/net/ehea/ehea_hcall.h 2006-06-21 04:44:50.158485520 
 > -0700

 > +/**
 > + * This file contains HCALL defines that are to be included in the 
 > appropriate
 > + * kernel files later
 > + */

this stuff should go in  with the other
constants, right?
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[IPV6] ADDRCONF: Fix default source address selection without CONFIG_IPV6_PRIVACY

2006-06-21 Thread YOSHIFUJI Hideaki / 吉藤英明
We need to update hiscore.rule even if we don't enable CONFIG_IPV6_PRIVACY,
because we have more less significant rule; longest match.

I think it is suitable for -stable as well.

Signed-off-by: YOSHIFUJI Hideaki <[EMAIL PROTECTED]>
---
 net/ipv6/addrconf.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -1069,6 +1069,9 @@ #ifdef CONFIG_IPV6_PRIVACY
if (hiscore.attrs & IPV6_SADDR_SCORE_PRIVACY)
continue;
}
+#else
+   if (hiscore.rule < 7)
+   hiscore.rule++;
 #endif
/* Rule 8: Use longest matching prefix */
if (hiscore.rule < 8) {

-- 
YOSHIFUJI Hideaki @ USAGI Project  <[EMAIL PROTECTED]>
GPG-FP  : 9022 65EB 1ECF 3AD1 0BDF  80D8 4807 F894 E062 0EEA
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [patch] ipv6 source address selection in addrconf.c (2.6.17)

2006-06-21 Thread YOSHIFUJI Hideaki / 吉藤英明
In article <[EMAIL PROTECTED]> (at Wed, 21 Jun 2006 15:42:11 +0200), Lukasz 
Stelmach <[EMAIL PROTECTED]> says:

> --- /usr/src/linux/net/ipv6/addrconf.c~   2006-06-21 11:41:22.0 
> +0200
> +++ /usr/src/linux/net/ipv6/addrconf.c2006-06-21 15:33:26.0 
> +0200
> @@ -862,6 +862,8 @@
>*  2002::/16   2
>*  ::/96   3
>*  :::0:0/96   4
> +  *  fc00::/75
> +  *  2001::/32   6
>*/
>   if (type & IPV6_ADDR_LOOPBACK)
>   return 0;
> @@ -871,6 +873,10 @@
>   return 4;
>   else if (addr->s6_addr16[0] == htons(0x2002))
>   return 2;
> + else if ((addr->s6_addr[0] & 0xfe) == 0xfc)
> + return 5;
> + else if (addr->s6_addr32[0] == htonl(0x2001))
> + return 6;
>   return 1;
>  }
>  

Please put the comparison for 2001::/32 before 2002::/16.
Otherwise, I'm fine with it.

In addition, give us your sign-off, please.

Regards,

-- 
YOSHIFUJI Hideaki @ USAGI Project  <[EMAIL PROTECTED]>
GPG-FP  : 9022 65EB 1ECF 3AD1 0BDF  80D8 4807 F894 E062 0EEA
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Suspending 802.11 drivers

2006-06-21 Thread Luis R. Rodriguez

On 6/16/06, Stefan Rompf <[EMAIL PROTECTED]> wrote:

Am Donnerstag 15 Juni 2006 21:58 schrieb Michael Buesch:

I think the most important question is how a suspend/resume action should be
translated. For the managed case, it is clearly an association loss, normally
signalled by netif_carrier_on/off() and a corresponding SIOCGIWAP event.
Supplicants can act on this. In AP mode, suspend is equal to disassociating
all stations. Ad-hoc... dunno.

For a softmac stack like devicescape, it makes sense to have a function that
abstracts these scenarios as it is the stack anyway that handles association
stuff. However, I'd rather extend the existing function
ieee80211_netif_oper().


Since d80211 is already being patched for sysfs how about we use sysfs
(and kobjects) to maintain the state at suspend() and resume(). This
would allow userspace tools like supplicant running in the background
to pick up from sysfs where it left off and for our drivers to save
where we left off. ieee80211_hw can then just refer to their suspend()
and resume() routines from its respective struct pci_driver or struct
usb_device.

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


[-mm patch] drivers/net/ni5010.c: fix compile error

2006-06-21 Thread Adrian Bunk
On Wed, Jun 21, 2006 at 03:48:57AM -0700, Andrew Morton wrote:
>...
> Changes since 2.6.17-rc6-mm2:
>...
> +ni5010-netcard-cleanup.patch
> 
>  netdev cleanup
>...

This patch fixes the following compile error with CONFIG_NI5010=y:

<--  snip  -->

...
  LD  .tmp_vmlinux1
drivers/built-in.o:(.init.data+0x2b280): undefined reference to `ni5010_probe'
make: *** [.tmp_vmlinux1] Error 1

<--  snip  -->

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

--- linux-2.6.17-mm1-full/drivers/net/ni5010.c.old  2006-06-21 
16:21:26.0 +0200
+++ linux-2.6.17-mm1-full/drivers/net/ni5010.c  2006-06-21 16:21:46.0 
+0200
@@ -117,7 +117,7 @@
 static int io;
 static int irq;
 
-static struct net_device * __init ni5010_probe(int unit)
+struct net_device * __init ni5010_probe(int unit)
 {
struct net_device *dev = alloc_etherdev(sizeof(struct ni5010_local));
int *port;

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


Re: [PATCH 0/2] NET: Accurate packet scheduling for ATM/ADSL

2006-06-21 Thread Krzysztof Matusik
Dnia środa, 21 czerwca 2006 14:54, Patrick McHardy napisał:
> > I'd love to see this one implemented. I'm using HFSC more than a year and
> > it never provides proper QoS on ATM/ADSL links; low delays can never be
> > achieved even with significant throttling below the h/w link bandwidth.
>
> Mhh .. I trust you picked a proper clocksource and timer frequency?

250Hz or 1000Hz and jiffies (for a SMP machine)
I don't mean I've got big delays though and those are lowest with HFSC, when 
link is satiated.

IMHO since ATM is sending small packets constantly thorough its link (ATM 
specific) encapsulated data defragmentation cannot simply be achieved (or it 
simply isn't done by modems). As a result one can't simply throttle qdisc 
basing on computations like 
UpperLimit = ( bandwidth*(1 - header_bits/frame_size )
having bandwidth specified by ATM link speed rate, as it can be reported by 
modem, and expect it won't ever be congested.
This seems to be main problem. Link asymmetry, window size etc don't affect 
line congestion and so delays that much I suppose.
The same with incorrect timer :-).

> I hacked up a patch yesterday. I want to do a bit more testing before
> posting it, but its hard to really test the effectiveness because even
> without this patch my DSL line already delivers higher throughput and
> much better delay than it should (its a throttled SDSL line sold as
> ADSL). I'll try to do some testing on an ethernet link now.

I'll follow this thread then.

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


Re: ipv6 source address selection in addrconf.c (2.6.17)

2006-06-21 Thread YOSHIFUJI Hideaki / 吉藤英明
In article <[EMAIL PROTECTED]> (at Tue, 20 Jun 2006 23:38:46 +0200), Lukasz 
Stelmach <[EMAIL PROTECTED]> says:

> Greetings.
> 
> net/ipv6/addrconf.c:971 is
> /* Rule 2: Prefer appropriate scope */
> if (hiscore.rule < 2) {
> hiscore.scope = __ipv6_addr_src_scope(hiscore.addr_type);
> hiscore.rule++;
> }
> 
> I am afraid, that it does not make any sense for I find no place where a value
> is assigned to hiscore.addr_type. There are some more references to
> hiscore.addr_type below but the only assignment is when the whole structure is
> cleaned with memset(3)

hiscore is copied from score.

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


[patch] ipv6 source address selection in addrconf.c (2.6.17)

2006-06-21 Thread Lukasz Stelmach
Lukasz Stelmach wrote:

> I found it when I was trying to figure out why when trying to connect to
> 
> 2001:200:0:8002:203:47ff:fea5:3085 (www.kame.net)
> 
> with two global addresses assigned to the ethernet card
> 
> fd24:6f44:46bd:face::254
> 2002:531f:d667:face::254
> 
> rule 8 does not work and the first address is chosen.

The answer is that fc00::/7 matches 2001:: better because it gets the same
label (ipv6_saddr_label()). Although fc00::/7 addresses are defined as global
unicast IMHO they should be treated *slightly* different. This is the patch.
Since 6to4 has its own label I have decided to assign one to Teredo too.

However, I still haven't found any clue in referneces to unassigned value of
hiscore.addr_type.

-- 
Było mi bardzo miło.Czwarta pospolita klęska, [...]
>Łukasz<  Już nie katolicka lecz złodziejska.  (c)PP


--
Zobacz nowosci salonu moto w Madrycie >>> http://link.interia.pl/f1961
--- /usr/src/linux/net/ipv6/addrconf.c~	2006-06-21 11:41:22.0 +0200
+++ /usr/src/linux/net/ipv6/addrconf.c	2006-06-21 15:33:26.0 +0200
@@ -862,6 +862,8 @@
   * 	2002::/16		2
   * 	::/96			3
   * 	:::0:0/96		4
+  *	fc00::/7		5
+  * 	2001::/32		6
   */
 	if (type & IPV6_ADDR_LOOPBACK)
 		return 0;
@@ -871,6 +873,10 @@
 		return 4;
 	else if (addr->s6_addr16[0] == htons(0x2002))
 		return 2;
+	else if ((addr->s6_addr[0] & 0xfe) == 0xfc)
+		return 5;
+	else if (addr->s6_addr32[0] == htonl(0x2001))
+		return 6;
 	return 1;
 }
 


signature.asc
Description: OpenPGP digital signature


No interfaces under /proc/sys/net/ipv4/conf/

2006-06-21 Thread Hasso Tepper
After upgrade to 2.6.16.20 from 2.6.11 I discovered that no dynamic 
interfaces (vlans, tunnels) appear under /proc/sys/net/ipv4/conf/.
/proc/sys/net/ipv6/conf/ is OK.

Bug? Or feature?


with my best wishes,

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


Re: [PATCH 0/2] NET: Accurate packet scheduling for ATM/ADSL

2006-06-21 Thread Patrick McHardy
Krzysztof Matusik wrote:
> Dnia wtorek, 20 czerwca 2006 17:16, Patrick McHardy napisał:
> 
>>The code wouldn't be very complicated, it just adds some overhead. If
>>you do something like I described in my previous mail the overhead for
>>people not using it would be an additional pointer test before reading
>>skb->len. I guess we could also make it a compile time option.
>>I personally think this is something that really improves our quality
>>of implementation, after all, its "wire" resources qdiscs are meant
>>to manage.
> 
> 
> I'd love to see this one implemented. I'm using HFSC more than a year and it 
> never provides proper QoS on ATM/ADSL links; low delays can never be achieved 
> even with significant throttling below the h/w link bandwidth.

Mhh .. I trust you picked a proper clocksource and timer frequency?

> This would help a lot regarding the amount of adsl users but on the other 
> hand- there's not many HFSC implementations in real-life I guess (users seem 
> to be afraid of it's 'complexity'). 
> This idea doesn't seem look dirty- is there a chance to implement it in the 
> kernel and iproute?

I hacked up a patch yesterday. I want to do a bit more testing before
posting it, but its hard to really test the effectiveness because even
without this patch my DSL line already delivers higher throughput and
much better delay than it should (its a throttled SDSL line sold as
ADSL). I'll try to do some testing on an ethernet link now.
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 6/6] ehea: Makefile & Kconfig

2006-06-21 Thread Jan-Bernd Themann

Signed-off-by: Jan-Bernd Themann <[EMAIL PROTECTED]>


 drivers/net/Kconfig  |7 +++
 drivers/net/Makefile |1 +
 2 files changed, 8 insertions(+)



diff -Nurp -X dontdiff linux-2.6.17.1/drivers/net/Kconfig 
patched_kernel/drivers/net/Kconfig
--- linux-2.6.17.1/drivers/net/Kconfig  2006-06-20 02:31:55.0 -0700
+++ patched_kernel/drivers/net/Kconfig  2006-06-20 03:53:45.896352432 -0700
@@ -2247,6 +2247,13 @@ config CHELSIO_T1
   To compile this driver as a module, choose M here: the module
   will be called cxgb.

+config EHEA
+tristate "eHEA Ethernet support"
+depends on IBMEBUS
+---help---
+  This driver supports the eHEA IBM ethernet adapter for eServer 
System p
+
+
 config IXGB
tristate "Intel(R) PRO/10GbE support"
depends on PCI
diff -Nurp -X dontdiff linux-2.6.17.1/drivers/net/Makefile 
patched_kernel/drivers/net/Makefile
--- linux-2.6.17.1/drivers/net/Makefile 2006-06-20 02:31:55.0 -0700
+++ patched_kernel/drivers/net/Makefile 2006-06-20 03:54:17.239380552 -0700
@@ -10,6 +10,7 @@ obj-$(CONFIG_E1000) += e1000/
 obj-$(CONFIG_IBM_EMAC) += ibm_emac/
 obj-$(CONFIG_IXGB) += ixgb/
 obj-$(CONFIG_CHELSIO_T1) += chelsio/
+obj-$(CONFIG_EHEA) += ehea/
 obj-$(CONFIG_BONDING) += bonding/
 obj-$(CONFIG_GIANFAR) += gianfar_driver.o


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


[PATCH 4/6] ehea: main header files

2006-06-21 Thread Jan-Bernd Themann

Signed-off-by: Jan-Bernd Themann <[EMAIL PROTECTED]>


 drivers/net/ehea/ehea.h|  434 +
 drivers/net/ehea/ehea_hw.h |  319 +
 2 files changed, 753 insertions(+)



--- linux-2.6.17.1-orig/drivers/net/ehea/ehea.h 1969-12-31 16:00:00.0 
-0800
+++ kernel/drivers/net/ehea/ehea.h  2006-06-21 04:44:50.917370152 -0700
@@ -0,0 +1,434 @@
+/*
+ *  linux/drivers/net/ehea/ehea.h
+ *
+ *  eHEA ethernet device driver for IBM eServer System p
+ *
+ *  (C) Copyright IBM Corp. 2006
+ *
+ *  Authors:
+ *   Christoph Raisch <[EMAIL PROTECTED]>
+ *   Jan-Bernd Themann <[EMAIL PROTECTED]>
+ *   Heiko-Joerg Schick <[EMAIL PROTECTED]>
+ *   Thomas Klein <[EMAIL PROTECTED]>
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef __EHEA_H__
+#define __EHEA_H__
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+
+#define EHEA_DRIVER_NAME   "IBM eHEA"
+#define EHEA_DRIVER_VERSION"EHEA_0007"
+
+/* #define EHEA_CQE_TIMER */
+ #define EHEA_ADDITIONAL_STATISTICS
+
+#ifdef EHEA_SMALL_QUEUES
+#define EHEA_MAX_CQE_COUNT 1020
+#define EHEA_MAX_ENTRIES_SQ1020
+#define EHEA_MAX_ENTRIES_RQ1   4080
+#define EHEA_MAX_ENTRIES_RQ2   1020
+#define EHEA_MAX_ENTRIES_RQ3   1020
+#define EHEA_SWQE_REFILL_TH 100
+#else
+#define EHEA_MAX_CQE_COUNT32000
+#define EHEA_MAX_ENTRIES_SQ   16000
+#define EHEA_MAX_ENTRIES_RQ1  32080
+#define EHEA_MAX_ENTRIES_RQ2   4020
+#define EHEA_MAX_ENTRIES_RQ3   4020
+#define EHEA_SWQE_REFILL_TH1000
+#endif
+
+#define EHEA_MAX_ENTRIES_EQ   20
+
+#define EHEA_SG_SQ  2
+#define EHEA_SG_RQ1 1
+#define EHEA_SG_RQ2 0
+#define EHEA_SG_RQ3 0
+
+#define EHEA_MAX_PACKET_SIZE9022   /* for jumbo frame */
+#define EHEA_LL_PKT_SIZE 256
+
+/* Send completion signaling */
+#define EHEA_SIG_IV 1000
+#define EHEA_SIG_IV_LONG 4
+#define EHEA_SQ_HL_TRIGGER 5000
+
+/* Protection Domain Identifier */
+#define EHEA_PD_ID0xaabcdeff
+
+#define EHEA_RQ2_THRESHOLD 1
+#define EHEA_RQ3_THRESHOLD 5
+
+#define EHEA_SPEED_10G 1
+#define EHEA_SPEED_1G   1000
+#define EHEA_SPEED_100M  100
+#define EHEA_SPEED_10M10
+
+/* Broadcast/Multicast registration types */
+#define EHEA_BCMC_SCOPE_ALL0x08
+#define EHEA_BCMC_SCOPE_SINGLE 0x00
+#define EHEA_BCMC_MULTICAST0x04
+#define EHEA_BCMC_BROADCAST0x00
+#define EHEA_BCMC_UNTAGGED 0x02
+#define EHEA_BCMC_TAGGED   0x00
+#define EHEA_BCMC_VLANID_ALL   0x01
+#define EHEA_BCMC_VLANID_SINGLE0x00
+
+/* Use this define to kmallocate PHYP control blocks */
+#define H_CB_ALIGNMENT 4096
+
+#define EHEA_PAGESHIFT  12
+#define EHEA_PAGESIZE   4096UL
+#define EHEA_PT_ENTRIES 512UL
+#define EHEA_CACHE_LINE 128
+
+#define EHEA_ENABLE1
+#define EHEA_DISABLE   0
+
+void ehea_set_ethtool_ops(struct net_device *netdev);
+
+#ifndef KEEP_EDEBS_BELOW
+#define KEEP_EDEBS_BELOW 8
+#endif
+
+extern int ehea_trace_level;
+extern struct ehea_adapter *adapter_global;
+
+#ifdef EHEA_NO_EDEB
+#define EDEB_P_GENERIC(level, idstring, format, args...) \
+   while (0 == 1) { \
+   if(unlikely (level <= ehea_trace_level)) { \
+   printk("%s " idstring " "format "\n", \
+   __func__, ##args); \
+ } \
+   } \
+
+#else
+
+#define EDEB_P_GENERIC(level,idstring,format,args...) \
+if (level < KEEP_EDEBS_BELOW) { \
+   do { \
+   if(unlikely (level <= ehea_trace_level)) { \
+   printk("%s " idstring " "format "\n", \
+   __func__, ##args); \
+ } \
+   } while (1 == 0); \
+}
+#endif
+
+#define EDEB(level, format, args...) \
+EDEB_P_GENERIC(level, "", format, ##args)
+
+#define EDEB_ERR(level, format, args...) \
+EDEB_P_GENERIC(level, "EHEA_ERROR", format, ##args)
+
+#define EDEB_EN(level, format, args...) \
+EDEB_P_GENERIC(level, ">>>", format, ##args)
+
+#define EDEB_EX(level, format, args...) \
+EDEB_P_GENERIC(level, "<<<", format, ##args)
+
+#define EHEA_BMASK(pos, length) (((pos) << 16) + (

[PATCH 2/6] ehea: pHYP interface

2006-06-21 Thread Jan-Bernd Themann

Signed-off-by: Jan-Bernd Themann <[EMAIL PROTECTED]>


 drivers/net/ehea/ehea_hcall.h |   52 ++
 drivers/net/ehea/ehea_phyp.c  | 1020 ++
 drivers/net/ehea/ehea_phyp.h  |  625 +
 3 files changed, 1697 insertions(+)



--- linux-2.6.17.1-orig/drivers/net/ehea/ehea_phyp.c1969-12-31 
16:00:00.0 -0800
+++ kernel/drivers/net/ehea/ehea_phyp.c 2006-06-21 04:44:50.147487192 -0700
@@ -0,0 +1,1020 @@
+/*
+ *  linux/drivers/net/ehea/ehea_phyp.c
+ *
+ *  eHEA ethernet device driver for IBM eServer System p
+ *
+ *  (C) Copyright IBM Corp. 2006
+ *
+ *  Authors:
+ *   Christoph Raisch <[EMAIL PROTECTED]>
+ *   Jan-Bernd Themann <[EMAIL PROTECTED]>
+ *   Heiko-Joerg Schick <[EMAIL PROTECTED]>
+ *   Thomas Klein <[EMAIL PROTECTED]>
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include "ehea_phyp.h"
+
+
+static inline u16 get_order_of_qentries(u16 queue_entries)
+{
+   u8 ld = 1;  /*  logarithmus dualis */
+   EDEB_EN(7, "queue_entries=0x%X", queue_entries);
+   while (((1U << ld) - 1) < queue_entries) {
+   ld++;
+   };
+   EDEB_EX(7, "mapped queue_entries=%d", ld - 1);
+   return ld - 1;
+}
+
+
+/* Defines for H_CALL H_ALLOC_RESOURCE */
+#define H_ALL_RES_TYPE_QP1
+#define H_ALL_RES_TYPE_CQ2
+#define H_ALL_RES_TYPE_EQ3
+#define H_ALL_RES_TYPE_MR5
+#define H_ALL_RES_TYPE_MW6
+
+u64 ehea_h_query_ehea_qp(const u64 hcp_adapter_handle,
+const u8 qp_category,
+const u64 qp_handle, const u64 sel_mask, void *cb_addr)
+{
+   u64 hret = H_ADAPTER_PARM;
+   u64 dummy = 0;
+
+   EDEB_EN(7, "hcp_adapter_handle=%lX cat=%X qp_handle=%lX sel_mask=%lX "
+   "cb_addr=%p\n",
+   hcp_adapter_handle,
+   (u16) qp_category, qp_handle, sel_mask, cb_addr);
+   EDEB_DMP(7, (u8 *) cb_addr, sizeof(struct hcp_modify_qp_cb_0),
+"Before HCALL");
+
+   if u64)cb_addr) & (PAGE_SIZE - 1)) != 0)
+   panic("query_ehea_qp: cb_addr not on page boundary!!!");
+
+   hret = ehea_hcall_7arg_7ret(H_QUERY_HEA_QP,
+   hcp_adapter_handle, /* R4 */
+   qp_category,/* R5 */
+   qp_handle,  /* R6 */
+   sel_mask,   /* R7 */
+   virt_to_abs(cb_addr),   /* R8 */
+   0, 0,   /* R9-R10 */
+   &dummy, /* R4 */
+   &dummy, /* R5 */
+   &dummy, /* R6 */
+   &dummy, /* R7 */
+   &dummy, /* R8 */
+   &dummy, /* R9 */
+   &dummy);/* R10 */
+
+   EDEB_DMP(7, (u8 *) cb_addr, sizeof(struct hcp_modify_qp_cb_0),
+"After HCALL");
+   EDEB_EX(7, "");
+   return hret;
+}
+
+/* input param R5 */
+#define H_ALL_RES_QP_EQPO EHEA_BMASK_IBM(9, 11)
+#define H_ALL_RES_QP_QPP  EHEA_BMASK_IBM(12, 12)
+#define H_ALL_RES_QP_RQR  EHEA_BMASK_IBM(13, 15)
+#define H_ALL_RES_QP_EQEG EHEA_BMASK_IBM(16, 16)
+#define H_ALL_RES_QP_LL_QPEHEA_BMASK_IBM(17, 17)
+#define H_ALL_RES_QP_DMA128   EHEA_BMASK_IBM(19, 19)
+#define H_ALL_RES_QP_HSM  EHEA_BMASK_IBM(20, 21)
+#define H_ALL_RES_QP_SIGT EHEA_BMASK_IBM(22, 23)
+#define H_ALL_RES_QP_TENURE   EHEA_BMASK_IBM(48, 55)
+#define H_ALL_RES_QP_RES_TYP  EHEA_BMASK_IBM(56, 63)
+
+/* input param R9  */
+#define H_ALL_RES_QP_TOKENEHEA_BMASK_IBM(0, 31)
+#define H_ALL_RES_QP_PD   EHEA_BMASK_IBM(32,63)
+
+/* input param R10 */
+#define H_ALL_RES_QP_MAX_SWQE EHEA_BMASK_IBM(4, 7)
+#define H_ALL_RES_QP_MAX_R1WQEEHEA_BMASK_IBM(12, 15)
+#define H_ALL_RES_QP_MAX_R2WQEEHEA_BMASK_IBM(20, 23)
+#define H_ALL_RES_QP_MAX_R3WQEEHEA_BMASK_IBM(28, 31)
+/* Max Send Scatter Ga

[PATCH 5/6] ehea: eHEA Makefile

2006-06-21 Thread Jan-Bernd Themann

Signed-off-by: Jan-Bernd Themann <[EMAIL PROTECTED]>


 drivers/net/ehea/Makefile |7 +++
 1 file changed, 7 insertions(+)



--- linux-2.6.17.1-orig/drivers/net/ehea/Makefile   1969-12-31 
16:00:00.0 -0800
+++ kernel/drivers/net/ehea/Makefile2006-06-21 04:44:50.132489472 -0700
@@ -0,0 +1,7 @@
+#
+# Makefile for the eHEA ethernet device driver for IBM eServer System p
+#
+
+ehea_mod-objs = ehea_main.o ehea_phyp.o ehea_qmr.o ehea_ethtool.o ehea_phyp.o
+obj-$(CONFIG_EHEA) += ehea_mod.o
+

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


[PATCH 0/6] ehea: IBM eHEA Ethernet Device Driver

2006-06-21 Thread Jan-Bernd Themann

Hi,

one piece of the patch set posted on Thu, 08 Jun 2006 got lost
due to the spam filter of this mailing list. Here is the complete
patch set once again including the (previously missing) main component
in the patch 1/5.

Feedback is highly appreciated.

Thanks,
Jan-Bernd

Signed-off-by: Jan-Bernd Themann <[EMAIL PROTECTED]>
Changelog-by:  Jan-Bernd Themann <[EMAIL PROTECTED]>

Differences to patch set http://www.spinics.net/lists/netdev/msg06022.html

Changelog:
- Comments triggering the spam filter removed


 drivers/net/Kconfig |7
 drivers/net/Makefile|1
 drivers/net/ehea/Makefile   |7
 drivers/net/ehea/ehea.h |  434 ++
 drivers/net/ehea/ehea_ethtool.c |  325 +
 drivers/net/ehea/ehea_hcall.h   |   52
 drivers/net/ehea/ehea_hw.h  |  319 
 drivers/net/ehea/ehea_main.c| 2557 
 drivers/net/ehea/ehea_phyp.c| 1020 +++
 drivers/net/ehea/ehea_phyp.h|  625 +
 drivers/net/ehea/ehea_qmr.c |  719 +++
 drivers/net/ehea/ehea_qmr.h |  390 ++
 12 files changed, 6456 insertions(+)



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


[PATCH 3/6] ehea: queue management

2006-06-21 Thread Jan-Bernd Themann

Signed-off-by: Jan-Bernd Themann <[EMAIL PROTECTED]>


 drivers/net/ehea/ehea_ethtool.c |  325 ++
 drivers/net/ehea/ehea_qmr.c |  719 
 drivers/net/ehea/ehea_qmr.h |  390 +
 3 files changed, 1434 insertions(+)



--- linux-2.6.17.1-orig/drivers/net/ehea/ehea_qmr.c 1969-12-31 
16:00:00.0 -0800
+++ kernel/drivers/net/ehea/ehea_qmr.c  2006-06-21 04:44:50.152486432 -0700
@@ -0,0 +1,719 @@
+/*
+ *  linux/drivers/net/ehea/ehea_qmr.c
+ *
+ *  eHEA ethernet device driver for IBM eServer System p
+ *
+ *  (C) Copyright IBM Corp. 2006
+ *
+ *  Authors:
+ *   Christoph Raisch <[EMAIL PROTECTED]>
+ *   Jan-Bernd Themann <[EMAIL PROTECTED]>
+ *   Heiko-Joerg Schick <[EMAIL PROTECTED]>
+ *   Thomas Klein <[EMAIL PROTECTED]>
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include "ehea.h"
+#include "ehea_phyp.h"
+#include "ehea_qmr.h"
+
+static void *ipz_qpageit_get_inc(struct ipz_queue *queue)
+{
+   void *retvalue = ipz_qeit_get(queue);
+   queue->current_q_offset += queue->pagesize;
+   if (queue->current_q_offset > queue->queue_length) {
+   queue->current_q_offset -= queue->pagesize;
+   retvalue = NULL;
+   }
+   else if u64) retvalue) & (EHEA_PAGESIZE-1)) != 0) {
+   EDEB(4, "ERROR!! not at PAGE-Boundary");
+   return NULL;
+   }
+   EDEB(7, "queue=%p retvalue=%p", queue, retvalue);
+   return retvalue;
+}
+
+static int ipz_queue_ctor(struct ipz_queue *queue,
+ const u32 nr_of_pages,
+ const u32 pagesize, const u32 qe_size,
+ const u32 nr_of_sg)
+{
+   int f;
+   EDEB_EN(7, "nr_of_pages=%x pagesize=%x qe_size=%x",
+   nr_of_pages, pagesize, qe_size);
+   queue->queue_length = nr_of_pages * pagesize;
+   queue->queue_pages = vmalloc(nr_of_pages * sizeof(void *));
+   if (!queue->queue_pages) {
+   EDEB(4, "ERROR!! didn't get the memory");
+   return 0;
+   }
+   memset(queue->queue_pages, 0, nr_of_pages * sizeof(void *));
+
+   for (f = 0; f < nr_of_pages; f++) {
+   (queue->queue_pages)[f] =
+   (struct ipz_page *)get_zeroed_page(GFP_KERNEL);
+   if (!(queue->queue_pages)[f]) {
+   break;
+   }
+   }
+   if (f < nr_of_pages) {
+   int g;
+   EDEB_ERR(4, "couldn't get 0ed pages queue=%p f=%x "
+"nr_of_pages=%x", queue, f, nr_of_pages);
+   for (g = 0; g < f; g++) {
+   free_page((unsigned long)(queue->queue_pages)[g]);
+   }
+   return 0;
+   }
+   queue->current_q_offset = 0;
+   queue->qe_size = qe_size;
+   queue->act_nr_of_sg = nr_of_sg;
+   queue->pagesize = pagesize;
+   queue->toggle_state = 1;
+   EDEB_EX(7, "queue_length=%x queue_pages=%p qe_size=%x"
+   " act_nr_of_sg=%x", queue->queue_length, queue->queue_pages,
+   queue->qe_size, queue->act_nr_of_sg);
+   return 1;
+}
+
+static int ipz_queue_dtor(struct ipz_queue *queue)
+{
+   int g;
+   EDEB_EN(7, "ipz_queue pointer=%p", queue);
+   if (!queue) {
+   return 0;
+   }
+   if (!queue->queue_pages) {
+   return 0;
+   }
+   EDEB(7, "destructing a queue with the following properties:\n"
+"queue_length=%x act_nr_of_sg=%x pagesize=%x qe_size=%x",
+queue->queue_length, queue->act_nr_of_sg, queue->pagesize,
+queue->qe_size);
+   for (g = 0; g < (queue->queue_length / queue->pagesize); g++) {
+   free_page((unsigned long)(queue->queue_pages)[g]);
+   }
+   vfree(queue->queue_pages);
+
+   EDEB_EX(7, "queue freed!");
+   return 1;
+}
+
+struct ehea_cq *ehea_cq_new(void)
+{
+   struct ehea_cq *cq = vmalloc(sizeof(*cq));
+   if (cq)
+   memset(cq, 0, sizeof(*cq));
+   return cq;
+}
+
+void ehea_cq_delete(struct ehea_cq *cq)
+{
+   vfree(cq);
+}
+
+struct ehea_cq *ehea_create_cq(struct ehea_adapter *adapter,
+  int nr_of_cqe, u64 eq_handle, u32 cq_token)
+{
+   st

Re: + myri10ge-build-fix.patch added to -mm tree

2006-06-21 Thread Herbert Xu
On Wed, Jun 21, 2006 at 12:09:51PM +, Brice Goglin wrote:
> 
> Actually, we use 64 segments when TSO in enabled
> (MYRI10GE_MAX_SEND_DESC_TSO):
> 
> #define MYRI10GE_MAX_SEND_DESC_TSO ((65536 / 2048) * 2)

You're right, I missed that bit.  Sorry about the noise.
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[EMAIL PROTECTED]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/2] NET: Accurate packet scheduling for ATM/ADSL

2006-06-21 Thread Krzysztof Matusik
Dnia wtorek, 20 czerwca 2006 17:16, Patrick McHardy napisał:
> jamal wrote:
> > On Tue, 2006-20-06 at 03:04 +0200, Patrick McHardy wrote:
> >>It would be nice to have support for HFSC as well, which unfortunately
> >>needs to be done in the kernel since it doesn't use rate tables.
> >>What about qdiscs like SFQ (which uses the packet size in quantum
> >>calculations)? I guess it would make sense to use the wire-length
> >>there as well.
> >
> > Didnt even think of that ;->
> > Is it getting too complicated?
>
> The code wouldn't be very complicated, it just adds some overhead. If
> you do something like I described in my previous mail the overhead for
> people not using it would be an additional pointer test before reading
> skb->len. I guess we could also make it a compile time option.
> I personally think this is something that really improves our quality
> of implementation, after all, its "wire" resources qdiscs are meant
> to manage.

I'd love to see this one implemented. I'm using HFSC more than a year and it 
never provides proper QoS on ATM/ADSL links; low delays can never be achieved 
even with significant throttling below the h/w link bandwidth.
This would help a lot regarding the amount of adsl users but on the other 
hand- there's not many HFSC implementations in real-life I guess (users seem 
to be afraid of it's 'complexity'). 
This idea doesn't seem look dirty- is there a chance to implement it in the 
kernel and iproute?

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


Re: + myri10ge-build-fix.patch added to -mm tree

2006-06-21 Thread Brice Goglin
Herbert Xu wrote:
> On Tue, Jun 20, 2006 at 09:33:42PM -0700, [EMAIL PROTECTED] wrote:
>> diff -puN drivers/net/myri10ge/myri10ge.c~myri10ge-build-fix
>> drivers/net/myri10ge/myri10ge.c
>> --- a/drivers/net/myri10ge/myri10ge.c~myri10ge-build-fix
>> +++ a/drivers/net/myri10ge/myri10ge.c
>> @@ -2120,7 +2120,7 @@ abort_linearize:
>> goto drop;
>> }
>>
>> - if (skb_linearize(skb, GFP_ATOMIC))
>> + if (skb_linearize(skb))
>> goto drop;
>
> Actually I think this driver (in conjunction with TSO) is buggy.
> It has a maximum segment count of 12. However TSO can send 13 pages
> or more of data on i386. If this happens it looks like this driver
> will go into an infinite loop forever trying to linearize the skb.
>
> Cheers,

Actually, we use 64 segments when TSO in enabled
(MYRI10GE_MAX_SEND_DESC_TSO):

#define MYRI10GE_MAX_SEND_DESC_TSO ((65536 / 2048) * 2)

<.>

max_segments = MXGEFW_MAX_SEND_DESC;

#ifdef NETIF_F_TSO
if (skb->len > (dev->mtu + ETH_HLEN)) {
mss = skb_shinfo(skb)->tso_size;
if (mss != 0)
max_segments = MYRI10GE_MAX_SEND_DESC_TSO;
}
#endif /*NETIF_F_TSO */


And we never try to linearize a TSO frame:

if (skb_shinfo(skb)->tso_size) {
printk(KERN_ERR "myri10ge: %s: TSO but wanted to linearize?!?!?\n",
mgp->dev->name);
goto drop;
}

Brice

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


Re: Locking validator output on DCCP

2006-06-21 Thread Ingo Molnar

* Herbert Xu <[EMAIL PROTECTED]> wrote:

> > Can someone tell me whether I am correct in my thinking or not? If I 
> > am then I will work out how to tell the lock validator not to worry 
> > about it.
> 
> I agree, this looks bogus.  Ingo, could you please take a look?

sure - Ian, could you try Arjan's fix below?

Ingo


Subject: lock validator: annotate vlan "master" device locks
From: Arjan van de Ven <[EMAIL PROTECTED]>

vlan devices are "masters" of normal "slave" devices and thus need their 
own lock key. (this will be switched to the reinit_key APIs once they 
are available)

Signed-off-by: Arjan van de Ven <[EMAIL PROTECTED]>
Signed-off-by: Ingo Molnar <[EMAIL PROTECTED]>

---
 net/8021q/vlan.c |2 ++
 1 file changed, 2 insertions(+)

Index: linux-2.6.17-rc6-mm2/net/8021q/vlan.c
===
--- linux-2.6.17-rc6-mm2.orig/net/8021q/vlan.c
+++ linux-2.6.17-rc6-mm2/net/8021q/vlan.c
@@ -463,6 +463,8 @@ static struct net_device *register_vlan_
if (new_dev == NULL)
goto out_unlock;
 
+   spin_lock_init(&dev->xmit_lock);
+
 #ifdef VLAN_DEBUG
printk(VLAN_DBG "Allocated new name -:%s:-\n", new_dev->name);
 #endif

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


Re: Locking validator output on DCCP

2006-06-21 Thread Arjan van de Ven
On Wed, 2006-06-21 at 10:34 +1000, Herbert Xu wrote:
> > As I read this it is not a recursive lock as sk_clone is occurring
> > second and is actually creating a new socket so they are trying to
> > lock on different sockets.
> > 
> > Can someone tell me whether I am correct in my thinking or not? If I
> > am then I will work out how to tell the lock validator not to worry
> > about it.
> 
> I agree, this looks bogus.  Ingo, could you please take a look?

Fix is relatively easy:


sk_clone creates a new socket, and thus can never deadlock, and in fact
can be called with the original socket locked. This therefore is a
legitimate nesting case; mark it as such.

Signed-off-by: Arjan van de Ven <[EMAIL PROTECTED]>


---
 net/core/sock.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6.17-rc6-mm2/net/core/sock.c
===
--- linux-2.6.17-rc6-mm2.orig/net/core/sock.c
+++ linux-2.6.17-rc6-mm2/net/core/sock.c
@@ -846,7 +846,7 @@ struct sock *sk_clone(const struct sock 
/* SANITY */
sk_node_init(&newsk->sk_node);
sock_lock_init(newsk);
-   bh_lock_sock(newsk);
+   bh_lock_sock_nested(newsk);
 
atomic_set(&newsk->sk_rmem_alloc, 0);
atomic_set(&newsk->sk_wmem_alloc, 0);

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


Re: Suspending 802.11 drivers

2006-06-21 Thread Stefan Rompf
Am Freitag 16 Juni 2006 20:36 schrieb Stefan Rompf:

> (But that's an interesting point. Will sniff whether ipw2200 hardware sends
> a final packet on suspend.)

neither on suspend to RAM nor on suspend to disk a disassociation is sent by 
ipw2200 - for the AP, the client just vanishes.

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


Re: Sanitise ethtool.h and mii.h for userspace.

2006-06-21 Thread David Woodhouse
On Tue, 2006-06-20 at 21:18 -0400, Jeff Garzik wrote:
> How can reviewers make an informed decision, when you completely failed 
> to note:
> 
> * This breaks the primary userspace user of this header, ethtool(8)

I cannot reproduce with either an ethtool-3 tarball or a fresh checkout
from your git tree. Can you show me the error?

It's a somewhat surprising allegation, because ethtool doesn't even
_use_ the header directly from the kernel. It has its own copy, and
currently includes it like this...

typedef unsigned long long u64; /* hack, so we may include kernel's 
ethtool.h */
typedef __uint32_t u32; /* ditto */
typedef __uint16_t u16; /* ditto */
typedef __uint8_t u8;   /* ditto */
#include "ethtool-copy.h"

> * The patch was NAK'd (and I don't even get a "Naked-by:" header :))

Sorry, my recollection was that you backed down after everyone turned on
you and declared that "but I _want_ to use 'u32' for userspace stuff
because underscores hurt my eyes" was too silly for words. You didn't
get a mention in the commit comment because I'd already committed it by
the time we had the discussion. But I did mention it to Andrew at the
time I asked him to put the hdrcleanup tree into -mm, and he seemed
perfectly happy with the change.

> * Despite knowing all this for quite some time, no associated userspace 
> fix patch has ever appeared.

That's because to the best of my knowledge, userspace doesn't _need_ any
fix at the moment. We've built the whole of the Fedora Core 6 test 1
release against (a subset of) these headers, and that includes ethtool.

> If you are going to break stuff, AT LEAST TELL PEOPLE IN ALL CAPS ABOUT 
> IT, rather than providing the highly deceptive description as above. 
> And be courteous enough to help fix the breakage, if you please. 

If I break stuff, I promise I'll bear that in mind.

-- 
dwmw2

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


Re: [PATCH 2/3] FS_ENET: use PAL for mii management

2006-06-21 Thread Gerhard Jaeger
Hi,

On Tuesday 20 June 2006 16:58, Vitaly Bordug wrote:
> 
> This patch should update the fs_enet infrastructure to utilize
> Phy Abstraction Layer subsystem. Inside there are generic driver rehaul,
> board-specific portion to respect driver changes (for 8272ads and 866ads).
> 
> Signed-off-by: Vitaly Bordug <[EMAIL PROTECTED]>
> ---
> 
>  arch/ppc/platforms/mpc8272ads_setup.c |  154 ++
>  arch/ppc/platforms/mpc866ads_setup.c  |  192 ++--
>  arch/ppc/platforms/mpc885ads_setup.c  |  179 
>  arch/ppc/syslib/mpc8xx_devices.c  |8 +
>  arch/ppc/syslib/mpc8xx_sys.c  |6 
>  arch/ppc/syslib/pq2_devices.c |5 
>  arch/ppc/syslib/pq2_sys.c |3 
>  drivers/net/fs_enet/Makefile  |6 
>  drivers/net/fs_enet/fec.h |   42 +++
>  drivers/net/fs_enet/fs_enet-main.c|  207 -
>  drivers/net/fs_enet/fs_enet-mii.c |  507 
> -
>  drivers/net/fs_enet/fs_enet.h |   40 ++-
>  drivers/net/fs_enet/mac-fcc.c |   10 -
>  drivers/net/fs_enet/mac-fec.c |  132 +
>  drivers/net/fs_enet/mac-scc.c |4 
>  drivers/net/fs_enet/mii-bitbang.c |  384 +++--
>  drivers/net/fs_enet/mii-fec.c |  243 
>  drivers/net/fs_enet/mii-fixed.c   |   92 --
>  include/asm-ppc/mpc8260.h |1 
>  include/asm-ppc/mpc8xx.h  |1 
>  include/linux/fs_enet_pd.h|   50 +--
>  21 files changed, 983 insertions(+), 1283 deletions(-)

[SNIPSNAP]
> diff --git a/drivers/net/fs_enet/mii-bitbang.c 
> b/drivers/net/fs_enet/mii-bitbang.c
> index 24a5e2e..145bf4c 100644
> --- a/drivers/net/fs_enet/mii-bitbang.c
> +++ b/drivers/net/fs_enet/mii-bitbang.c
> @@ -34,6 +34,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  
>  #include 
>  #include 
> @@ -41,6 +42,7 @@
>  
>  #include "fs_enet.h"
>  
> +
>  #ifdef CONFIG_8xx
>  static int bitbang_prep_bit(u8 **dirp, u8 **datp, u8 *mskp, int port, int 
> bit)
>  {
> @@ -106,64 +108,25 @@ static int bitbang_prep_bit(u8 **dirp, u
>  }
>  #endif
>  
> -#ifdef CONFIG_8260
> -static int bitbang_prep_bit(u8 **dirp, u8 **datp, u8 *mskp, int port, int 
> bit)
> +static int bitbang_prep_bit(u8 **datp, u8 *mskp,
> + struct fs_mii_bit *mii_bit)

is it possible, that in case of CONFIG_8xx you'll have two times this 
bitbang_prep_bit() function? 

Gerhard

-- 
Gerhard Jaeger <[EMAIL PROTECTED]>
SYSGO AG  Embedded and Real-Time Software
www.sysgo.com | www.elinos.com | www.pikeos.com | www.osek.de 

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