[git patch] net driver fix

2007-10-05 Thread Jeff Garzik

Fix a rather large performance regression.

Please pull from 'upstream-linus' branch of
master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6.git 
upstream-linus

to receive the following updates:

 drivers/net/r8169.c |   16 +---
 1 files changed, 13 insertions(+), 3 deletions(-)

Francois Romieu (1):
  r8169: revert part of 6dccd16b7c2703e8bbf8bca62b5cf248332afbe2

diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index c921ec3..c76dd29 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -1918,7 +1918,11 @@ static void rtl_hw_start_8169(struct net_device *dev)
 
rtl_set_rx_max_size(ioaddr);
 
-   rtl_set_rx_tx_config_registers(tp);
+   if ((tp->mac_version == RTL_GIGA_MAC_VER_01) ||
+   (tp->mac_version == RTL_GIGA_MAC_VER_02) ||
+   (tp->mac_version == RTL_GIGA_MAC_VER_03) ||
+   (tp->mac_version == RTL_GIGA_MAC_VER_04))
+   rtl_set_rx_tx_config_registers(tp);
 
tp->cp_cmd |= rtl_rw_cpluscmd(ioaddr) | PCIMulRW;
 
@@ -1941,6 +1945,14 @@ static void rtl_hw_start_8169(struct net_device *dev)
 
rtl_set_rx_tx_desc_registers(tp, ioaddr);
 
+   if ((tp->mac_version != RTL_GIGA_MAC_VER_01) &&
+   (tp->mac_version != RTL_GIGA_MAC_VER_02) &&
+   (tp->mac_version != RTL_GIGA_MAC_VER_03) &&
+   (tp->mac_version != RTL_GIGA_MAC_VER_04)) {
+   RTL_W8(ChipCmd, CmdTxEnb | CmdRxEnb);
+   rtl_set_rx_tx_config_registers(tp);
+   }
+
RTL_W8(Cfg9346, Cfg9346_Lock);
 
/* Initially a 10 us delay. Turned it into a PCI commit. - FR */
@@ -1955,8 +1967,6 @@ static void rtl_hw_start_8169(struct net_device *dev)
 
/* Enable all known interrupts by setting the interrupt mask. */
RTL_W16(IntrMask, tp->intr_event);
-
-   RTL_W8(ChipCmd, CmdTxEnb | CmdRxEnb);
 }
 
 static void rtl_hw_start_8168(struct net_device *dev)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[git patch] net driver fix

2007-10-05 Thread Jeff Garzik

Fix a rather large performance regression.

Please pull from 'upstream-linus' branch of
master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6.git 
upstream-linus

to receive the following updates:

 drivers/net/r8169.c |   16 +---
 1 files changed, 13 insertions(+), 3 deletions(-)

Francois Romieu (1):
  r8169: revert part of 6dccd16b7c2703e8bbf8bca62b5cf248332afbe2

diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index c921ec3..c76dd29 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -1918,7 +1918,11 @@ static void rtl_hw_start_8169(struct net_device *dev)
 
rtl_set_rx_max_size(ioaddr);
 
-   rtl_set_rx_tx_config_registers(tp);
+   if ((tp-mac_version == RTL_GIGA_MAC_VER_01) ||
+   (tp-mac_version == RTL_GIGA_MAC_VER_02) ||
+   (tp-mac_version == RTL_GIGA_MAC_VER_03) ||
+   (tp-mac_version == RTL_GIGA_MAC_VER_04))
+   rtl_set_rx_tx_config_registers(tp);
 
tp-cp_cmd |= rtl_rw_cpluscmd(ioaddr) | PCIMulRW;
 
@@ -1941,6 +1945,14 @@ static void rtl_hw_start_8169(struct net_device *dev)
 
rtl_set_rx_tx_desc_registers(tp, ioaddr);
 
+   if ((tp-mac_version != RTL_GIGA_MAC_VER_01) 
+   (tp-mac_version != RTL_GIGA_MAC_VER_02) 
+   (tp-mac_version != RTL_GIGA_MAC_VER_03) 
+   (tp-mac_version != RTL_GIGA_MAC_VER_04)) {
+   RTL_W8(ChipCmd, CmdTxEnb | CmdRxEnb);
+   rtl_set_rx_tx_config_registers(tp);
+   }
+
RTL_W8(Cfg9346, Cfg9346_Lock);
 
/* Initially a 10 us delay. Turned it into a PCI commit. - FR */
@@ -1955,8 +1967,6 @@ static void rtl_hw_start_8169(struct net_device *dev)
 
/* Enable all known interrupts by setting the interrupt mask. */
RTL_W16(IntrMask, tp-intr_event);
-
-   RTL_W8(ChipCmd, CmdTxEnb | CmdRxEnb);
 }
 
 static void rtl_hw_start_8168(struct net_device *dev)
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[git patch] net driver fix

2007-09-29 Thread Jeff Garzik

Please pull from 'upstream-linus' branch of
master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6.git 
upstream-linus

to receive the following updates:

 drivers/net/mv643xx_eth.c |2 +-
 drivers/net/mv643xx_eth.h |4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

Dale Farnsworth (1):
  mv643xx_eth: Check ETH_INT_CAUSE_STATE bit

diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
index 456d1e1..34288fe 100644
--- a/drivers/net/mv643xx_eth.c
+++ b/drivers/net/mv643xx_eth.c
@@ -534,7 +534,7 @@ static irqreturn_t mv643xx_eth_int_handler(int irq, void 
*dev_id)
}
 
/* PHY status changed */
-   if (eth_int_cause_ext & ETH_INT_CAUSE_PHY) {
+   if (eth_int_cause_ext & (ETH_INT_CAUSE_PHY | ETH_INT_CAUSE_STATE)) {
struct ethtool_cmd cmd;
 
if (mii_link_ok(>mii)) {
diff --git a/drivers/net/mv643xx_eth.h b/drivers/net/mv643xx_eth.h
index 82f8c0c..565b966 100644
--- a/drivers/net/mv643xx_eth.h
+++ b/drivers/net/mv643xx_eth.h
@@ -64,7 +64,9 @@
 #define ETH_INT_CAUSE_TX_ERROR (ETH_TX_QUEUES_ENABLED << 8)
 #define ETH_INT_CAUSE_TX   (ETH_INT_CAUSE_TX_DONE | ETH_INT_CAUSE_TX_ERROR)
 #define ETH_INT_CAUSE_PHY  0x0001
-#define ETH_INT_UNMASK_ALL_EXT (ETH_INT_CAUSE_TX | ETH_INT_CAUSE_PHY)
+#define ETH_INT_CAUSE_STATE0x0010
+#define ETH_INT_UNMASK_ALL_EXT (ETH_INT_CAUSE_TX | ETH_INT_CAUSE_PHY | \
+   ETH_INT_CAUSE_STATE)
 
 #define ETH_INT_MASK_ALL   0x
 #define ETH_INT_MASK_ALL_EXT   0x
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[git patch] net driver fix

2007-09-29 Thread Jeff Garzik

Please pull from 'upstream-linus' branch of
master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6.git 
upstream-linus

to receive the following updates:

 drivers/net/mv643xx_eth.c |2 +-
 drivers/net/mv643xx_eth.h |4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

Dale Farnsworth (1):
  mv643xx_eth: Check ETH_INT_CAUSE_STATE bit

diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
index 456d1e1..34288fe 100644
--- a/drivers/net/mv643xx_eth.c
+++ b/drivers/net/mv643xx_eth.c
@@ -534,7 +534,7 @@ static irqreturn_t mv643xx_eth_int_handler(int irq, void 
*dev_id)
}
 
/* PHY status changed */
-   if (eth_int_cause_ext  ETH_INT_CAUSE_PHY) {
+   if (eth_int_cause_ext  (ETH_INT_CAUSE_PHY | ETH_INT_CAUSE_STATE)) {
struct ethtool_cmd cmd;
 
if (mii_link_ok(mp-mii)) {
diff --git a/drivers/net/mv643xx_eth.h b/drivers/net/mv643xx_eth.h
index 82f8c0c..565b966 100644
--- a/drivers/net/mv643xx_eth.h
+++ b/drivers/net/mv643xx_eth.h
@@ -64,7 +64,9 @@
 #define ETH_INT_CAUSE_TX_ERROR (ETH_TX_QUEUES_ENABLED  8)
 #define ETH_INT_CAUSE_TX   (ETH_INT_CAUSE_TX_DONE | ETH_INT_CAUSE_TX_ERROR)
 #define ETH_INT_CAUSE_PHY  0x0001
-#define ETH_INT_UNMASK_ALL_EXT (ETH_INT_CAUSE_TX | ETH_INT_CAUSE_PHY)
+#define ETH_INT_CAUSE_STATE0x0010
+#define ETH_INT_UNMASK_ALL_EXT (ETH_INT_CAUSE_TX | ETH_INT_CAUSE_PHY | \
+   ETH_INT_CAUSE_STATE)
 
 #define ETH_INT_MASK_ALL   0x
 #define ETH_INT_MASK_ALL_EXT   0x
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[git patch] net driver fix

2007-01-23 Thread Jeff Garzik
As the patch indicates, the Al Viro patch had already been merged into
my history (and another branch depending on it, making rebasing
difficult if not impossible), but since it was merged by Linus, the
actual patch isn't shown here by 'git diff'.

Please pull from 'upstream-linus' branch of
master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6.git 
upstream-linus

to receive the following updates:

 drivers/net/mv643xx_eth.c |   11 +--
 1 files changed, 9 insertions(+), 2 deletions(-)

Al Viro (1):
  s2io bogus memset

Dale Farnsworth (1):
  mv643xx_eth: Fix race condition in mv643xx_eth_free_tx_descs

diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
index c41ae42..b3bf864 100644
--- a/drivers/net/mv643xx_eth.c
+++ b/drivers/net/mv643xx_eth.c
@@ -314,6 +314,13 @@ int mv643xx_eth_free_tx_descs(struct net_device *dev, int 
force)
 
while (mp->tx_desc_count > 0) {
spin_lock_irqsave(>lock, flags);
+
+   /* tx_desc_count might have changed before acquiring the lock */
+   if (mp->tx_desc_count <= 0) {
+   spin_unlock_irqrestore(>lock, flags);
+   return released;
+   }
+
tx_index = mp->tx_used_desc_q;
desc = >p_tx_desc_area[tx_index];
cmd_sts = desc->cmd_sts;
@@ -332,13 +339,13 @@ int mv643xx_eth_free_tx_descs(struct net_device *dev, int 
force)
if (skb)
mp->tx_skb[tx_index] = NULL;
 
-   spin_unlock_irqrestore(>lock, flags);
-
if (cmd_sts & ETH_ERROR_SUMMARY) {
printk("%s: Error in TX\n", dev->name);
mp->stats.tx_errors++;
}
 
+   spin_unlock_irqrestore(>lock, flags);
+
if (cmd_sts & ETH_TX_FIRST_DESC)
dma_unmap_single(NULL, addr, count, DMA_TO_DEVICE);
else
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[git patch] net driver fix

2007-01-23 Thread Jeff Garzik
As the patch indicates, the Al Viro patch had already been merged into
my history (and another branch depending on it, making rebasing
difficult if not impossible), but since it was merged by Linus, the
actual patch isn't shown here by 'git diff'.

Please pull from 'upstream-linus' branch of
master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6.git 
upstream-linus

to receive the following updates:

 drivers/net/mv643xx_eth.c |   11 +--
 1 files changed, 9 insertions(+), 2 deletions(-)

Al Viro (1):
  s2io bogus memset

Dale Farnsworth (1):
  mv643xx_eth: Fix race condition in mv643xx_eth_free_tx_descs

diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
index c41ae42..b3bf864 100644
--- a/drivers/net/mv643xx_eth.c
+++ b/drivers/net/mv643xx_eth.c
@@ -314,6 +314,13 @@ int mv643xx_eth_free_tx_descs(struct net_device *dev, int 
force)
 
while (mp-tx_desc_count  0) {
spin_lock_irqsave(mp-lock, flags);
+
+   /* tx_desc_count might have changed before acquiring the lock */
+   if (mp-tx_desc_count = 0) {
+   spin_unlock_irqrestore(mp-lock, flags);
+   return released;
+   }
+
tx_index = mp-tx_used_desc_q;
desc = mp-p_tx_desc_area[tx_index];
cmd_sts = desc-cmd_sts;
@@ -332,13 +339,13 @@ int mv643xx_eth_free_tx_descs(struct net_device *dev, int 
force)
if (skb)
mp-tx_skb[tx_index] = NULL;
 
-   spin_unlock_irqrestore(mp-lock, flags);
-
if (cmd_sts  ETH_ERROR_SUMMARY) {
printk(%s: Error in TX\n, dev-name);
mp-stats.tx_errors++;
}
 
+   spin_unlock_irqrestore(mp-lock, flags);
+
if (cmd_sts  ETH_TX_FIRST_DESC)
dma_unmap_single(NULL, addr, count, DMA_TO_DEVICE);
else
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/