* [PATCH 1/6] skge: FIFO Ram calculation error
2007-11-26 19:54 [PATCH 0/6] skge update (for 2.6.24) Stephen Hemminger
@ 2007-11-26 19:54 ` Stephen Hemminger
2007-12-01 21:33 ` Jeff Garzik
2007-11-26 19:54 ` [PATCH 2/6] skge: receive flush logic Stephen Hemminger
` (4 subsequent siblings)
5 siblings, 1 reply; 10+ messages in thread
From: Stephen Hemminger @ 2007-11-26 19:54 UTC (permalink / raw)
To: Jeff Garzik; +Cc: netdev
[-- Attachment #1: skge-ram-offset.patch --]
[-- Type: text/plain, Size: 908 bytes --]
The calculation of usable FIFO RAM is wrong in the skge driver.
First, is doesn't take into account the reserved area on the original
SysKonnect Genesis boards. Second it has an off-by-one error because
hw->ports is either 1 or 2.
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
--- a/drivers/net/skge.c 2007-11-21 09:50:08.000000000 -0800
+++ b/drivers/net/skge.c 2007-11-21 12:18:59.000000000 -0800
@@ -2619,8 +2619,8 @@ static int skge_up(struct net_device *de
yukon_mac_init(hw, port);
spin_unlock_bh(&hw->phy_lock);
- /* Configure RAMbuffers */
- chunk = hw->ram_size / ((hw->ports + 1)*2);
+ /* Configure RAMbuffers - equally between ports and tx/rx */
+ chunk = (hw->ram_size - hw->ram_offset) / (hw->ports * 2);
ram_addr = hw->ram_offset + 2 * chunk * port;
skge_ramset(hw, rxqaddr[port], ram_addr, chunk);
--
Stephen Hemminger <shemminger@linux-foundation.org>
^ permalink raw reply [flat|nested] 10+ messages in thread* [PATCH 2/6] skge: receive flush logic
2007-11-26 19:54 [PATCH 0/6] skge update (for 2.6.24) Stephen Hemminger
2007-11-26 19:54 ` [PATCH 1/6] skge: FIFO Ram calculation error Stephen Hemminger
@ 2007-11-26 19:54 ` Stephen Hemminger
2007-11-26 19:54 ` [PATCH 3/6] skge: retry on MAC shutdown Stephen Hemminger
` (3 subsequent siblings)
5 siblings, 0 replies; 10+ messages in thread
From: Stephen Hemminger @ 2007-11-26 19:54 UTC (permalink / raw)
To: Jeff Garzik; +Cc: netdev
[-- Attachment #1: skge-no-rcv-flush.patch --]
[-- Type: text/plain, Size: 1025 bytes --]
Receive FIFO overrun is not catastrophic condition, so don't flush when
it happens.
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
--- a/drivers/net/skge.c 2007-11-21 14:36:31.000000000 -0800
+++ b/drivers/net/skge.c 2007-11-21 14:40:58.000000000 -0800
@@ -1801,11 +1801,6 @@ static void genesis_mac_intr(struct skge
xm_write32(hw, port, XM_MODE, XM_MD_FTF);
++dev->stats.tx_fifo_errors;
}
-
- if (status & XM_IS_RXF_OV) {
- xm_write32(hw, port, XM_MODE, XM_MD_FRF);
- ++dev->stats.rx_fifo_errors;
- }
}
static void genesis_link_up(struct skge_port *skge)
@@ -1862,9 +1857,9 @@ static void genesis_link_up(struct skge_
xm_write32(hw, port, XM_MODE, mode);
- /* Turn on detection of Tx underrun, Rx overrun */
+ /* Turn on detection of Tx underrun */
msk = xm_read16(hw, port, XM_IMSK);
- msk &= ~(XM_IS_RXF_OV | XM_IS_TXF_UR);
+ msk &= ~XM_IS_TXF_UR;
xm_write16(hw, port, XM_IMSK, msk);
xm_read16(hw, port, XM_ISRC);
--
Stephen Hemminger <shemminger@linux-foundation.org>
^ permalink raw reply [flat|nested] 10+ messages in thread* [PATCH 3/6] skge: retry on MAC shutdown
2007-11-26 19:54 [PATCH 0/6] skge update (for 2.6.24) Stephen Hemminger
2007-11-26 19:54 ` [PATCH 1/6] skge: FIFO Ram calculation error Stephen Hemminger
2007-11-26 19:54 ` [PATCH 2/6] skge: receive flush logic Stephen Hemminger
@ 2007-11-26 19:54 ` Stephen Hemminger
2007-11-26 19:54 ` [PATCH 4/6] skge: fiber link up/down fix Stephen Hemminger
` (2 subsequent siblings)
5 siblings, 0 replies; 10+ messages in thread
From: Stephen Hemminger @ 2007-11-26 19:54 UTC (permalink / raw)
To: Jeff Garzik; +Cc: netdev
[-- Attachment #1: skge-stopping-retry.patch --]
[-- Type: text/plain, Size: 1469 bytes --]
Make sure and retry when shutting down the MAC. This code is copied
from sk98lin driver.
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
--- a/drivers/net/skge.c 2007-11-21 14:40:58.000000000 -0800
+++ b/drivers/net/skge.c 2007-11-21 14:44:02.000000000 -0800
@@ -1713,7 +1713,7 @@ static void genesis_stop(struct skge_por
{
struct skge_hw *hw = skge->hw;
int port = skge->port;
- u32 reg;
+ unsigned retries = 1000;
genesis_reset(hw, port);
@@ -1721,20 +1721,17 @@ static void genesis_stop(struct skge_por
skge_write16(hw, B3_PA_CTRL,
port == 0 ? PA_CLR_TO_TX1 : PA_CLR_TO_TX2);
- /*
- * If the transfer sticks at the MAC the STOP command will not
- * terminate if we don't flush the XMAC's transmit FIFO !
- */
- xm_write32(hw, port, XM_MODE,
- xm_read32(hw, port, XM_MODE)|XM_MD_FTF);
-
-
/* Reset the MAC */
- skge_write16(hw, SK_REG(port, TX_MFF_CTRL1), MFF_SET_MAC_RST);
+ skge_write16(hw, SK_REG(port, TX_MFF_CTRL1), MFF_CLR_MAC_RST);
+ do {
+ skge_write16(hw, SK_REG(port, TX_MFF_CTRL1), MFF_SET_MAC_RST);
+ if (!(skge_read16(hw, SK_REG(port, TX_MFF_CTRL1)) & MFF_SET_MAC_RST))
+ break;
+ } while (--retries > 0);
/* For external PHYs there must be special handling */
if (hw->phy_type != SK_PHY_XMAC) {
- reg = skge_read32(hw, B2_GP_IO);
+ u32 reg = skge_read32(hw, B2_GP_IO);
if (port == 0) {
reg |= GP_DIR_0;
reg &= ~GP_IO_0;
--
Stephen Hemminger <shemminger@linux-foundation.org>
^ permalink raw reply [flat|nested] 10+ messages in thread* [PATCH 4/6] skge: fiber link up/down fix
2007-11-26 19:54 [PATCH 0/6] skge update (for 2.6.24) Stephen Hemminger
` (2 preceding siblings ...)
2007-11-26 19:54 ` [PATCH 3/6] skge: retry on MAC shutdown Stephen Hemminger
@ 2007-11-26 19:54 ` Stephen Hemminger
2007-11-26 19:54 ` [PATCH 5/6] skge: increase TX threshold for Jumbo Stephen Hemminger
2007-11-26 19:54 ` [PATCH 6/6] skge version 1.13 Stephen Hemminger
5 siblings, 0 replies; 10+ messages in thread
From: Stephen Hemminger @ 2007-11-26 19:54 UTC (permalink / raw)
To: Jeff Garzik; +Cc: netdev
[-- Attachment #1: skge-link-down.patch --]
[-- Type: text/plain, Size: 1865 bytes --]
The driver would not work over fibre if other end when down then
came back up (would require reloading driver). The correct way
to manage the link the same way for both TP and fibre.
Resloves problem described in: http://lkml.org/lkml/2007/11/6/395
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
--- a/drivers/net/skge.c 2007-11-21 14:44:02.000000000 -0800
+++ b/drivers/net/skge.c 2007-11-21 14:46:34.000000000 -0800
@@ -1095,16 +1095,9 @@ static void xm_link_down(struct skge_hw
{
struct net_device *dev = hw->dev[port];
struct skge_port *skge = netdev_priv(dev);
- u16 cmd = xm_read16(hw, port, XM_MMU_CMD);
xm_write16(hw, port, XM_IMSK, XM_IMSK_DISABLE);
- cmd &= ~(XM_MMU_ENA_RX | XM_MMU_ENA_TX);
- xm_write16(hw, port, XM_MMU_CMD, cmd);
-
- /* dummy read to ensure writing */
- xm_read16(hw, port, XM_MMU_CMD);
-
if (netif_carrier_ok(dev))
skge_link_down(skge);
}
@@ -1194,6 +1187,7 @@ static void genesis_init(struct skge_hw
static void genesis_reset(struct skge_hw *hw, int port)
{
const u8 zero[8] = { 0 };
+ u32 reg;
skge_write8(hw, SK_REG(port, GMAC_IRQ_MSK), 0);
@@ -1209,6 +1203,11 @@ static void genesis_reset(struct skge_hw
xm_write16(hw, port, PHY_BCOM_INT_MASK, 0xffff);
xm_outhash(hw, port, XM_HSM, zero);
+
+ /* Flush TX and RX fifo */
+ reg = xm_read32(hw, port, XM_MODE);
+ xm_write32(hw, port, XM_MODE, reg | XM_MD_FTF);
+ xm_write32(hw, port, XM_MODE, reg | XM_MD_FRF);
}
@@ -1714,6 +1713,12 @@ static void genesis_stop(struct skge_por
struct skge_hw *hw = skge->hw;
int port = skge->port;
unsigned retries = 1000;
+ u16 cmd;
+
+ /* Disable Tx and Rx */
+ cmd = xm_read16(hw, port, XM_MMU_CMD);
+ cmd &= ~(XM_MMU_ENA_RX | XM_MMU_ENA_TX);
+ xm_write16(hw, port, XM_MMU_CMD, cmd);
genesis_reset(hw, port);
--
Stephen Hemminger <shemminger@linux-foundation.org>
^ permalink raw reply [flat|nested] 10+ messages in thread* [PATCH 5/6] skge: increase TX threshold for Jumbo
2007-11-26 19:54 [PATCH 0/6] skge update (for 2.6.24) Stephen Hemminger
` (3 preceding siblings ...)
2007-11-26 19:54 ` [PATCH 4/6] skge: fiber link up/down fix Stephen Hemminger
@ 2007-11-26 19:54 ` Stephen Hemminger
2007-11-26 19:54 ` [PATCH 6/6] skge version 1.13 Stephen Hemminger
5 siblings, 0 replies; 10+ messages in thread
From: Stephen Hemminger @ 2007-11-26 19:54 UTC (permalink / raw)
To: Jeff Garzik; +Cc: netdev
[-- Attachment #1: skge-tx-thr.patch --]
[-- Type: text/plain, Size: 1004 bytes --]
Need to increase TX threshold when doing Jumbo frames on dual port board
to avoid underruns. (Code from sk98lin).
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
--- a/drivers/net/skge.c 2007-11-21 14:05:59.000000000 -0800
+++ b/drivers/net/skge.c 2007-11-21 14:06:15.000000000 -0800
@@ -1633,15 +1633,14 @@ static void genesis_mac_init(struct skge
}
xm_write16(hw, port, XM_RX_CMD, r);
-
/* We want short frames padded to 60 bytes. */
xm_write16(hw, port, XM_TX_CMD, XM_TX_AUTO_PAD);
- /*
- * Bump up the transmit threshold. This helps hold off transmit
- * underruns when we're blasting traffic from both ports at once.
- */
- xm_write16(hw, port, XM_TX_THR, 512);
+ /* Increase threshold for jumbo frames on dual port */
+ if (hw->ports > 1 && jumbo)
+ xm_write16(hw, port, XM_TX_THR, 1020);
+ else
+ xm_write16(hw, port, XM_TX_THR, 512);
/*
* Enable the reception of all error frames. This is is
--
Stephen Hemminger <shemminger@linux-foundation.org>
^ permalink raw reply [flat|nested] 10+ messages in thread* [PATCH 6/6] skge version 1.13
2007-11-26 19:54 [PATCH 0/6] skge update (for 2.6.24) Stephen Hemminger
` (4 preceding siblings ...)
2007-11-26 19:54 ` [PATCH 5/6] skge: increase TX threshold for Jumbo Stephen Hemminger
@ 2007-11-26 19:54 ` Stephen Hemminger
2007-11-28 22:23 ` [PATCH 1/2] skge: serial mode register values Stephen Hemminger
5 siblings, 1 reply; 10+ messages in thread
From: Stephen Hemminger @ 2007-11-26 19:54 UTC (permalink / raw)
To: Jeff Garzik; +Cc: netdev
[-- Attachment #1: skge-vers.patch --]
[-- Type: text/plain, Size: 455 bytes --]
Version for 2.6.24
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
--- a/drivers/net/skge.c 2007-11-21 14:07:37.000000000 -0800
+++ b/drivers/net/skge.c 2007-11-21 14:08:35.000000000 -0800
@@ -44,7 +44,7 @@
#include "skge.h"
#define DRV_NAME "skge"
-#define DRV_VERSION "1.12"
+#define DRV_VERSION "1.13"
#define PFX DRV_NAME " "
#define DEFAULT_TX_RING_SIZE 128
--
Stephen Hemminger <shemminger@linux-foundation.org>
^ permalink raw reply [flat|nested] 10+ messages in thread* [PATCH 1/2] skge: serial mode register values
2007-11-26 19:54 ` [PATCH 6/6] skge version 1.13 Stephen Hemminger
@ 2007-11-28 22:23 ` Stephen Hemminger
2007-11-28 22:25 ` [PATCH 2/2] skge: MTU changing fix Stephen Hemminger
0 siblings, 1 reply; 10+ messages in thread
From: Stephen Hemminger @ 2007-11-28 22:23 UTC (permalink / raw)
To: Jeff Garzik; +Cc: netdev
For compatiablity with sk98lin, make sure and set same values
in serial mode register.
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
---
Please apply for 2.6.24 (upstream-fixes) after the previous group
of skge patches (1.13)
--- a/drivers/net/skge.c 2007-11-28 09:27:02.000000000 -0800
+++ b/drivers/net/skge.c 2007-11-28 10:53:26.000000000 -0800
@@ -2190,9 +2190,12 @@ static void yukon_mac_init(struct skge_h
TX_JAM_IPG_VAL(TX_JAM_IPG_DEF) |
TX_IPG_JAM_DATA(TX_IPG_JAM_DEF));
- /* serial mode register */
- reg = GM_SMOD_VLAN_ENA | IPG_DATA_VAL(IPG_DATA_DEF);
- if (hw->dev[port]->mtu > 1500)
+ /* configure the Serial Mode Register */
+ reg = DATA_BLIND_VAL(DATA_BLIND_DEF)
+ | GM_SMOD_VLAN_ENA
+ | IPG_DATA_VAL(IPG_DATA_DEF);
+
+ if (hw->dev[port]->mtu > ETH_DATA_LEN)
reg |= GM_SMOD_JUMBO_ENA;
gma_write16(hw, port, GM_SERIAL_MODE, reg);
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 2/2] skge: MTU changing fix
2007-11-28 22:23 ` [PATCH 1/2] skge: serial mode register values Stephen Hemminger
@ 2007-11-28 22:25 ` Stephen Hemminger
0 siblings, 0 replies; 10+ messages in thread
From: Stephen Hemminger @ 2007-11-28 22:25 UTC (permalink / raw)
To: Jeff Garzik; +Cc: netdev
The code to change MTU doesn't correctly handle all the chip variations
and requirements for restarting. On Genesis chips changing MTU would just
cause receiver to hang.
Use a simpler approach of just taking link down/up if needed.
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
---
Please apply to 2.6.24 (upstream-fixes).
--- a/drivers/net/skge.c 2007-11-28 11:49:15.000000000 -0800
+++ b/drivers/net/skge.c 2007-11-28 11:49:48.000000000 -0800
@@ -2896,11 +2896,7 @@ static void skge_tx_timeout(struct net_d
static int skge_change_mtu(struct net_device *dev, int new_mtu)
{
- struct skge_port *skge = netdev_priv(dev);
- struct skge_hw *hw = skge->hw;
- int port = skge->port;
int err;
- u16 ctl, reg;
if (new_mtu < ETH_ZLEN || new_mtu > ETH_JUMBO_MTU)
return -EINVAL;
@@ -2910,40 +2906,13 @@ static int skge_change_mtu(struct net_de
return 0;
}
- skge_write32(hw, B0_IMSK, 0);
- dev->trans_start = jiffies; /* prevent tx timeout */
- netif_stop_queue(dev);
- napi_disable(&skge->napi);
-
- ctl = gma_read16(hw, port, GM_GP_CTRL);
- gma_write16(hw, port, GM_GP_CTRL, ctl & ~GM_GPCR_RX_ENA);
-
- skge_rx_clean(skge);
- skge_rx_stop(hw, port);
+ skge_down(dev);
dev->mtu = new_mtu;
- reg = GM_SMOD_VLAN_ENA | IPG_DATA_VAL(IPG_DATA_DEF);
- if (new_mtu > 1500)
- reg |= GM_SMOD_JUMBO_ENA;
- gma_write16(hw, port, GM_SERIAL_MODE, reg);
-
- skge_write8(hw, RB_ADDR(rxqaddr[port], RB_CTRL), RB_ENA_OP_MD);
-
- err = skge_rx_fill(dev);
- wmb();
- if (!err)
- skge_write8(hw, Q_ADDR(rxqaddr[port], Q_CSR), CSR_START | CSR_IRQ_CL_F);
- skge_write32(hw, B0_IMSK, hw->intr_mask);
-
+ err = skge_up(dev);
if (err)
dev_close(dev);
- else {
- gma_write16(hw, port, GM_GP_CTRL, ctl);
-
- napi_enable(&skge->napi);
- netif_wake_queue(dev);
- }
return err;
}
^ permalink raw reply [flat|nested] 10+ messages in thread