From 8169bd919146f468942f40c3e708f9ada74a30a4 Mon Sep 17 00:00:00 2001 From: Eugene Surovegin Date: Thu, 24 Nov 2005 14:48:40 -0800 Subject: [PATCH] ibm_emac: fix graceful stop timeout handling This patch fixes graceful stop timeout handling in PPC4xx EMAC driver. Currently, when we stop TX/RX channels we just do some number of loops without relying on actual spent time. This has finally bitten me on one of our systems (heavy network traffic during start up, RX channel is stopped several times to configure multicast list). Graceful channel stop can take up to 1 frame time, so I've added device specific timeout counter which depends on current link speed and calls to udelay() to really wait required amount of time before giving up. Signed-off-by: Eugene Surovegin Signed-off-by: Jeff Garzik --- drivers/net/ibm_emac/ibm_emac_core.c | 38 +++++++++++++++++++++++++++--------- drivers/net/ibm_emac/ibm_emac_core.h | 2 ++ 2 files changed, 31 insertions(+), 9 deletions(-) (limited to 'drivers/net') diff --git a/drivers/net/ibm_emac/ibm_emac_core.c b/drivers/net/ibm_emac/ibm_emac_core.c index eb7d6947871..1da8a66f91e 100644 --- a/drivers/net/ibm_emac/ibm_emac_core.c +++ b/drivers/net/ibm_emac/ibm_emac_core.c @@ -65,7 +65,7 @@ */ #define DRV_NAME "emac" -#define DRV_VERSION "3.53" +#define DRV_VERSION "3.54" #define DRV_DESC "PPC 4xx OCP EMAC driver" MODULE_DESCRIPTION(DRV_DESC); @@ -158,6 +158,14 @@ static inline void emac_report_timeout_error(struct ocp_enet_private *dev, #define PHY_POLL_LINK_ON HZ #define PHY_POLL_LINK_OFF (HZ / 5) +/* Graceful stop timeouts in us. + * We should allow up to 1 frame time (full-duplex, ignoring collisions) + */ +#define STOP_TIMEOUT_10 1230 +#define STOP_TIMEOUT_100 124 +#define STOP_TIMEOUT_1000 13 +#define STOP_TIMEOUT_1000_JUMBO 73 + /* Please, keep in sync with struct ibm_emac_stats/ibm_emac_error_stats */ static const char emac_stats_keys[EMAC_ETHTOOL_STATS_COUNT][ETH_GSTRING_LEN] = { "rx_packets", "rx_bytes", "tx_packets", "tx_bytes", "rx_packets_csum", @@ -222,10 +230,12 @@ static void emac_tx_disable(struct ocp_enet_private *dev) r = in_be32(&p->mr0); if (r & EMAC_MR0_TXE) { - int n = 300; + int n = dev->stop_timeout; out_be32(&p->mr0, r & ~EMAC_MR0_TXE); - while (!(in_be32(&p->mr0) & EMAC_MR0_TXI) && n) + while (!(in_be32(&p->mr0) & EMAC_MR0_TXI) && n) { + udelay(1); --n; + } if (unlikely(!n)) emac_report_timeout_error(dev, "TX disable timeout"); } @@ -248,9 +258,11 @@ static void emac_rx_enable(struct ocp_enet_private *dev) if (!(r & EMAC_MR0_RXE)) { if (unlikely(!(r & EMAC_MR0_RXI))) { /* Wait if previous async disable is still in progress */ - int n = 100; - while (!(r = in_be32(&p->mr0) & EMAC_MR0_RXI) && n) + int n = dev->stop_timeout; + while (!(r = in_be32(&p->mr0) & EMAC_MR0_RXI) && n) { + udelay(1); --n; + } if (unlikely(!n)) emac_report_timeout_error(dev, "RX disable timeout"); @@ -273,10 +285,12 @@ static void emac_rx_disable(struct ocp_enet_private *dev) r = in_be32(&p->mr0); if (r & EMAC_MR0_RXE) { - int n = 300; + int n = dev->stop_timeout; out_be32(&p->mr0, r & ~EMAC_MR0_RXE); - while (!(in_be32(&p->mr0) & EMAC_MR0_RXI) && n) + while (!(in_be32(&p->mr0) & EMAC_MR0_RXI) && n) { + udelay(1); --n; + } if (unlikely(!n)) emac_report_timeout_error(dev, "RX disable timeout"); } @@ -395,6 +409,7 @@ static int emac_configure(struct ocp_enet_private *dev) r = EMAC_MR1_BASE(emac_opb_mhz()) | EMAC_MR1_VLE | EMAC_MR1_IST; if (dev->phy.duplex == DUPLEX_FULL) r |= EMAC_MR1_FDE; + dev->stop_timeout = STOP_TIMEOUT_10; switch (dev->phy.speed) { case SPEED_1000: if (emac_phy_gpcs(dev->phy.mode)) { @@ -409,12 +424,16 @@ static int emac_configure(struct ocp_enet_private *dev) r |= EMAC_MR1_MF_1000; r |= EMAC_MR1_RFS_16K; gige = 1; - - if (dev->ndev->mtu > ETH_DATA_LEN) + + if (dev->ndev->mtu > ETH_DATA_LEN) { r |= EMAC_MR1_JPSM; + dev->stop_timeout = STOP_TIMEOUT_1000_JUMBO; + } else + dev->stop_timeout = STOP_TIMEOUT_1000; break; case SPEED_100: r |= EMAC_MR1_MF_100; + dev->stop_timeout = STOP_TIMEOUT_100; /* Fall through */ default: r |= EMAC_MR1_RFS_4K; @@ -2048,6 +2067,7 @@ static int __init emac_probe(struct ocp_device *ocpdev) dev->phy.duplex = DUPLEX_FULL; dev->phy.autoneg = AUTONEG_DISABLE; dev->phy.pause = dev->phy.asym_pause = 0; + dev->stop_timeout = STOP_TIMEOUT_100; init_timer(&dev->link_timer); dev->link_timer.function = emac_link_timer; dev->link_timer.data = (unsigned long)dev; diff --git a/drivers/net/ibm_emac/ibm_emac_core.h b/drivers/net/ibm_emac/ibm_emac_core.h index e9b44d030ac..911abbaf471 100644 --- a/drivers/net/ibm_emac/ibm_emac_core.h +++ b/drivers/net/ibm_emac/ibm_emac_core.h @@ -189,6 +189,8 @@ struct ocp_enet_private { struct timer_list link_timer; int reset_failed; + int stop_timeout; /* in us */ + struct ibm_emac_error_stats estats; struct net_device_stats nstats; -- cgit v1.2.3 From 56344d822efb25e66df87c5ee81aab8accf4d706 Mon Sep 17 00:00:00 2001 From: Ralf Baechle Date: Mon, 21 Nov 2005 21:05:02 +0000 Subject: [PATCH] mipsnet: Fix Copyright notice. Sorry, no sekr1t mips c0dez ;-) Signed-off-by: Ralf Baechle Signed-off-by: Jeff Garzik --- drivers/net/mipsnet.h | 30 +++++------------------------- 1 file changed, 5 insertions(+), 25 deletions(-) (limited to 'drivers/net') diff --git a/drivers/net/mipsnet.h b/drivers/net/mipsnet.h index 878535953cb..026c732024c 100644 --- a/drivers/net/mipsnet.h +++ b/drivers/net/mipsnet.h @@ -1,28 +1,8 @@ -// -// -// Unpublished work (c) MIPS Technologies, Inc. All rights reserved. -// Unpublished rights reserved under the copyright laws of the U.S.A. and -// other countries. -// -// PROPRIETARY / SECRET CONFIDENTIAL INFORMATION OF MIPS TECHNOLOGIES, INC. -// FOR INTERNAL USE ONLY. -// -// Under no circumstances (contract or otherwise) may this information be -// disclosed to, or copied, modified or used by anyone other than employees -// or contractors of MIPS Technologies having a need to know. -// -// -//++ -// File: MIPS_Net.h -// -// Description: -// The definition of the emulated MIPSNET device's interface. -// -// Notes: This include file needs to work from a Linux device drivers. -// -//-- -// - +/* + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + */ #ifndef __MIPSNET_H #define __MIPSNET_H -- cgit v1.2.3 From 23c2a7b5dea983c7cee2813817409552f9714e95 Mon Sep 17 00:00:00 2001 From: Ralf Baechle Date: Tue, 22 Nov 2005 00:16:51 +0000 Subject: [PATCH] jazzsonic: Fix build error. jazz_sonnic_device -> jazz_sonic_device Signed-off-by: Ralf Baechle Signed-off-by: Jeff Garzik --- drivers/net/jazzsonic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/net') diff --git a/drivers/net/jazzsonic.c b/drivers/net/jazzsonic.c index b039bd89ceb..e1151d00388 100644 --- a/drivers/net/jazzsonic.c +++ b/drivers/net/jazzsonic.c @@ -296,7 +296,7 @@ static int __init jazz_sonic_init_module(void) } jazz_sonic_device = platform_device_alloc(jazz_sonic_string, 0); - if (!jazz_sonnic_device) + if (!jazz_sonic_device) goto out_unregister; if (platform_device_add(jazz_sonic_device)) { -- cgit v1.2.3 From ee7ebdf40260c6c5586f20cda5d253bc988e7baa Mon Sep 17 00:00:00 2001 From: Ralf Baechle Date: Tue, 22 Nov 2005 00:19:44 +0000 Subject: [PATCH] jazzsonic: Fix platform device code Use platform_driver_unregister not driver_unregister to unregister a struct platform_driver. Signed-off-by: Ralf Baechle Signed-off-by: Jeff Garzik --- drivers/net/jazzsonic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/net') diff --git a/drivers/net/jazzsonic.c b/drivers/net/jazzsonic.c index e1151d00388..272d331d29c 100644 --- a/drivers/net/jazzsonic.c +++ b/drivers/net/jazzsonic.c @@ -307,7 +307,7 @@ static int __init jazz_sonic_init_module(void) return 0; out_unregister: - driver_unregister(&jazz_sonic_driver); + platform_driver_unregister(&jazz_sonic_driver); return -ENOMEM; } -- cgit v1.2.3 From c08ad1e304061dbd6ef7545d8f2db530b43c0fbd Mon Sep 17 00:00:00 2001 From: Pavel Roskin Date: Tue, 29 Nov 2005 02:59:27 -0500 Subject: [PATCH] orinoco: fix setting power management parameters Power management parameters could not be set by iwconfig due to incorrect error handling. Signed-off-by: Pavel Roskin Signed-off-by: Jeff Garzik --- drivers/net/wireless/orinoco.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/net') diff --git a/drivers/net/wireless/orinoco.c b/drivers/net/wireless/orinoco.c index 488ab06fb79..6fd0bf73683 100644 --- a/drivers/net/wireless/orinoco.c +++ b/drivers/net/wireless/orinoco.c @@ -3512,9 +3512,8 @@ static int orinoco_ioctl_setpower(struct net_device *dev, break; default: err = -EINVAL; - } - if (err) goto out; + } if (prq->flags & IW_POWER_TIMEOUT) { priv->pm_on = 1; -- cgit v1.2.3 From 1096e87174f925bb817a41386ee70573b2a7d6ff Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Mon, 28 Nov 2005 11:38:50 -0800 Subject: [PATCH] skge: handle VLAN checksum correctly on yukon rev 0 If using UDP over VLAN, with the skge driver there is a possibility of generating an incorrect checksum. This is a unlikely occurrence because it is only an issue on Yukon revision 0, and that revision doesn't seem to exist on any current hardware (probably early prototype). Signed-off-by: Stephen Hemminger Signed-off-by: Jeff Garzik --- drivers/net/skge.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'drivers/net') diff --git a/drivers/net/skge.c b/drivers/net/skge.c index 596c93b12da..96ffcc1666b 100644 --- a/drivers/net/skge.c +++ b/drivers/net/skge.c @@ -2300,14 +2300,12 @@ static int skge_xmit_frame(struct sk_buff *skb, struct net_device *dev) td->dma_hi = map >> 32; if (skb->ip_summed == CHECKSUM_HW) { - const struct iphdr *ip - = (const struct iphdr *) (skb->data + ETH_HLEN); int offset = skb->h.raw - skb->data; /* This seems backwards, but it is what the sk98lin * does. Looks like hardware is wrong? */ - if (ip->protocol == IPPROTO_UDP + if (skb->h.ipih->protocol == IPPROTO_UDP && hw->chip_rev == 0 && hw->chip_id == CHIP_ID_YUKON) control = BMU_TCP_CHECK; else -- cgit v1.2.3 From 1d97f384486a697ed227ef4609a26f18a8ea9a11 Mon Sep 17 00:00:00 2001 From: Matthieu CASTET Date: Thu, 1 Dec 2005 02:35:26 -0500 Subject: [wireless airo] reset card in init without this patch after an rmmod, modprobe the card won't work anymore until the next reboot. This patch seem safe to apply for all cards as the bsd driver already do that. I had to add a timeout because strange things happen (issuecommand will fail) if the card is already reseted (after a reboot). PS : it seems there are missing reset when leaving monitor mode... Signed-off-by: Matthieu CASTET --- drivers/net/wireless/airo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/net') diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c index 340ab4ee4b6..7a92b1cbd6a 100644 --- a/drivers/net/wireless/airo.c +++ b/drivers/net/wireless/airo.c @@ -2755,8 +2755,8 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, SET_NETDEV_DEV(dev, dmdev); - if (test_bit(FLAG_MPI,&ai->flags)) - reset_card (dev, 1); + reset_card (dev, 1); + msleep(400); rc = request_irq( dev->irq, airo_interrupt, SA_SHIRQ, dev->name, dev ); if (rc) { -- cgit v1.2.3 From ab80882bf339c5954a69bb0603df0113b17d384f Mon Sep 17 00:00:00 2001 From: Komuro Date: Thu, 1 Dec 2005 02:37:17 -0500 Subject: [netdrvr fmvj18x_cs] fix multicast bug * use set_rx_mode to (re)initialize the multicast table. * MC_FILTERBREAK is 64 (= 8 * 8bit) * remove local_info_t.mc_filter --- drivers/net/pcmcia/fmvj18x_cs.c | 32 +++++++++++--------------------- 1 file changed, 11 insertions(+), 21 deletions(-) (limited to 'drivers/net') diff --git a/drivers/net/pcmcia/fmvj18x_cs.c b/drivers/net/pcmcia/fmvj18x_cs.c index 384a736a0d2..356f5090922 100644 --- a/drivers/net/pcmcia/fmvj18x_cs.c +++ b/drivers/net/pcmcia/fmvj18x_cs.c @@ -131,10 +131,9 @@ typedef struct local_info_t { u_short tx_queue_len; cardtype_t cardtype; u_short sent; - u_char mc_filter[8]; } local_info_t; -#define MC_FILTERBREAK 8 +#define MC_FILTERBREAK 64 /*====================================================================*/ /* @@ -1005,15 +1004,8 @@ static void fjn_reset(struct net_device *dev) for (i = 0; i < 6; i++) outb(dev->dev_addr[i], ioaddr + NODE_ID + i); - /* Switch to bank 1 */ - if (lp->cardtype == MBH10302) - outb(BANK_1, ioaddr + CONFIG_1); - else - outb(BANK_1U, ioaddr + CONFIG_1); - - /* set the multicast table to accept none. */ - for (i = 0; i < 8; i++) - outb(0x00, ioaddr + MAR_ADR + i); + /* (re)initialize the multicast table */ + set_rx_mode(dev); /* Switch to bank 2 (runtime mode) */ if (lp->cardtype == MBH10302) @@ -1264,11 +1256,11 @@ static struct net_device_stats *fjn_get_stats(struct net_device *dev) static void set_rx_mode(struct net_device *dev) { kio_addr_t ioaddr = dev->base_addr; - struct local_info_t *lp = netdev_priv(dev); u_char mc_filter[8]; /* Multicast hash filter */ u_long flags; int i; + int saved_bank; int saved_config_0 = inb(ioaddr + CONFIG_0); local_irq_save(flags); @@ -1306,15 +1298,13 @@ static void set_rx_mode(struct net_device *dev) outb(2, ioaddr + RX_MODE); /* Use normal mode. */ } - if (memcmp(mc_filter, lp->mc_filter, sizeof(mc_filter))) { - int saved_bank = inb(ioaddr + CONFIG_1); - /* Switch to bank 1 and set the multicast table. */ - outb(0xe4, ioaddr + CONFIG_1); - for (i = 0; i < 8; i++) - outb(mc_filter[i], ioaddr + MAR_ADR + i); - memcpy(lp->mc_filter, mc_filter, sizeof(mc_filter)); - outb(saved_bank, ioaddr + CONFIG_1); - } + /* Switch to bank 1 and set the multicast table. */ + saved_bank = inb(ioaddr + CONFIG_1); + outb(0xe4, ioaddr + CONFIG_1); + + for (i = 0; i < 8; i++) + outb(mc_filter[i], ioaddr + MAR_ADR + i); + outb(saved_bank, ioaddr + CONFIG_1); outb(saved_config_0, ioaddr + CONFIG_0); -- cgit v1.2.3 From ea182d4aefa3a27847d890b1592a608d1180aa45 Mon Sep 17 00:00:00 2001 From: Jeff Garzik Date: Thu, 1 Dec 2005 04:31:32 -0500 Subject: [netdrvr skge] fix typo, fix build --- drivers/net/skge.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/net') diff --git a/drivers/net/skge.c b/drivers/net/skge.c index 96ffcc1666b..716467879b9 100644 --- a/drivers/net/skge.c +++ b/drivers/net/skge.c @@ -2305,7 +2305,7 @@ static int skge_xmit_frame(struct sk_buff *skb, struct net_device *dev) /* This seems backwards, but it is what the sk98lin * does. Looks like hardware is wrong? */ - if (skb->h.ipih->protocol == IPPROTO_UDP + if (skb->h.ipiph->protocol == IPPROTO_UDP && hw->chip_rev == 0 && hw->chip_id == CHIP_ID_YUKON) control = BMU_TCP_CHECK; else -- cgit v1.2.3