From cdd0db058d64f2619b08e7d098ee0014aa0a5bc1 Mon Sep 17 00:00:00 2001 From: Eric Dumazet Date: Thu, 28 May 2009 00:00:41 +0000 Subject: net: dont update dev->trans_start Second round of drivers for Gb cards (and NIU one I forgot in the 10GB round) Now that core network takes care of trans_start updates, dont do it in drivers themselves, if possible. Drivers can avoid one cache miss (on dev->trans_start) in their start_xmit() handler. Exceptions are NETIF_F_LLTX drivers Signed-off-by: Eric Dumazet Signed-off-by: David S. Miller --- drivers/net/sis190.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'drivers/net/sis190.c') diff --git a/drivers/net/sis190.c b/drivers/net/sis190.c index 55ccd51d247..13b8ca41d57 100644 --- a/drivers/net/sis190.c +++ b/drivers/net/sis190.c @@ -1204,8 +1204,6 @@ static int sis190_start_xmit(struct sk_buff *skb, struct net_device *dev) SIS_W32(TxControl, 0x1a00 | CmdReset | CmdTxEnb); - dev->trans_start = jiffies; - dirty_tx = tp->dirty_tx; if ((tp->cur_tx - NUM_TX_DESC) == dirty_tx) { netif_stop_queue(dev); -- cgit v1.2.3-70-g09d2 From 744c6b2976778ac6944e580fc413842df85be84e Mon Sep 17 00:00:00 2001 From: Riccardo Ghetta Date: Sun, 7 Jun 2009 19:47:58 +0000 Subject: sis190: fix for x86_64 (bug 11509) Corrected dma sync handling on small packets. Should fix http://bugzilla.kernel.org/show_bug.cgi?id=11509 Note: While this bug was reported only on x86_64, it could have affected any architecture. Signed-off-by: Riccardo Ghetta Signed-off-by: David S. Miller --- drivers/net/sis190.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/net/sis190.c') diff --git a/drivers/net/sis190.c b/drivers/net/sis190.c index 13b8ca41d57..9ea13c09f00 100644 --- a/drivers/net/sis190.c +++ b/drivers/net/sis190.c @@ -539,8 +539,8 @@ static bool sis190_try_rx_copy(struct sis190_private *tp, if (!skb) goto out; - pci_dma_sync_single_for_device(tp->pci_dev, addr, pkt_size, - PCI_DMA_FROMDEVICE); + pci_dma_sync_single_for_cpu(tp->pci_dev, addr, tp->rx_buf_sz, + PCI_DMA_FROMDEVICE); skb_reserve(skb, 2); skb_copy_to_linear_data(skb, sk_buff[0]->data, pkt_size); *sk_buff = skb; -- cgit v1.2.3-70-g09d2 From c3223d2446a7ce7438be49d68c4e65267fc6e0b2 Mon Sep 17 00:00:00 2001 From: Riccardo Ghetta Date: Thu, 4 Jun 2009 09:04:55 +0000 Subject: sis190: better message on unknown PHY Signed-off-by: Riccardo Ghetta Signed-off-by: David S. Miller --- drivers/net/sis190.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'drivers/net/sis190.c') diff --git a/drivers/net/sis190.c b/drivers/net/sis190.c index 9ea13c09f00..ee32ad26b96 100644 --- a/drivers/net/sis190.c +++ b/drivers/net/sis190.c @@ -347,7 +347,7 @@ static struct { u32 msg_enable; } debug = { -1 }; -MODULE_DESCRIPTION("SiS sis190 Gigabit Ethernet driver"); +MODULE_DESCRIPTION("SiS sis190/191 Gigabit Ethernet driver"); module_param(rx_copybreak, int, 0); MODULE_PARM_DESC(rx_copybreak, "Copy breakpoint for copy-only-tiny-frames"); module_param_named(debug, debug.msg_enable, int, 0); @@ -1313,12 +1313,15 @@ static void sis190_init_phy(struct net_device *dev, struct sis190_private *tp, ((mii_status & (BMSR_100FULL | BMSR_100HALF)) ? LAN : HOME) : p->type; tp->features |= p->feature; - } else + net_probe(tp, KERN_INFO "%s: %s transceiver at address %d.\n", + pci_name(tp->pci_dev), p->name, phy_id); + } else { phy->type = UNKNOWN; - - net_probe(tp, KERN_INFO "%s: %s transceiver at address %d.\n", - pci_name(tp->pci_dev), - (phy->type == UNKNOWN) ? "Unknown PHY" : p->name, phy_id); + net_probe(tp, KERN_INFO + "%s: unknown PHY 0x%x:0x%x transceiver at address %d\n", + pci_name(tp->pci_dev), + phy->id[0], (phy->id[1] & 0xfff0), phy_id); + } } static void sis190_mii_probe_88e1111_fixup(struct sis190_private *tp) -- cgit v1.2.3-70-g09d2 From 856f8f41d44c9a310665213745bba655e52641fd Mon Sep 17 00:00:00 2001 From: Riccardo Ghetta Date: Thu, 4 Jun 2009 09:05:07 +0000 Subject: sis190: add new phy found on asus F5Sr laptop Signed-off-by: Riccardo Ghetta Signed-off-by: David S. Miller --- drivers/net/sis190.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/net/sis190.c') diff --git a/drivers/net/sis190.c b/drivers/net/sis190.c index ee32ad26b96..75bd947d40b 100644 --- a/drivers/net/sis190.c +++ b/drivers/net/sis190.c @@ -317,6 +317,7 @@ static struct mii_chip_info { unsigned int type; u32 feature; } mii_chip_table[] = { + { "Atheros PHY", { 0x004d, 0xd010 }, LAN, 0 }, { "Atheros PHY AR8012", { 0x004d, 0xd020 }, LAN, 0 }, { "Broadcom PHY BCM5461", { 0x0020, 0x60c0 }, LAN, F_PHY_BCM5461 }, { "Broadcom PHY AC131", { 0x0143, 0xbc70 }, LAN, 0 }, -- cgit v1.2.3-70-g09d2 From 1feede014bf3c58f60b35f91dcd8a2f89b3908ad Mon Sep 17 00:00:00 2001 From: Riccardo Ghetta Date: Thu, 4 Jun 2009 09:05:20 +0000 Subject: sis190: fix gigabit negotiation Fixes an initialization error; the chip negotiates gigabit, but the driver mistakenly handled it as 100Mb. Changes based on both SiS own GPL driver and forcedeth. Hopefully should fix http://bugzilla.kernel.org/show_bug.cgi?id=9735 http://bugzilla.kernel.org/show_bug.cgi?id=11149 Signed-off-by: Riccardo Ghetta Signed-off-by: David S. Miller --- drivers/net/sis190.c | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) (limited to 'drivers/net/sis190.c') diff --git a/drivers/net/sis190.c b/drivers/net/sis190.c index 75bd947d40b..e2247669a49 100644 --- a/drivers/net/sis190.c +++ b/drivers/net/sis190.c @@ -47,7 +47,7 @@ #define PHY_ID_ANY 0x1f #define MII_REG_ANY 0x1f -#define DRV_VERSION "1.2" +#define DRV_VERSION "1.3" #define DRV_NAME "sis190" #define SIS190_DRIVER_NAME DRV_NAME " Gigabit Ethernet driver " DRV_VERSION #define PFX DRV_NAME ": " @@ -943,9 +943,9 @@ static void sis190_phy_task(struct work_struct *work) u32 ctl; const char *msg; } reg31[] = { - { LPA_1000XFULL | LPA_SLCT, 0x07000c00 | 0x00001000, + { LPA_1000FULL, 0x07000c00 | 0x00001000, "1000 Mbps Full Duplex" }, - { LPA_1000XHALF | LPA_SLCT, 0x07000c00, + { LPA_1000HALF, 0x07000c00, "1000 Mbps Half Duplex" }, { LPA_100FULL, 0x04000800 | 0x00001000, "100 Mbps Full Duplex" }, @@ -956,22 +956,35 @@ static void sis190_phy_task(struct work_struct *work) { LPA_10HALF, 0x04000400, "10 Mbps Half Duplex" }, { 0, 0x04000400, "unknown" } - }, *p; - u16 adv; + }, *p = NULL; + u16 adv, autoexp, gigadv, gigrec; val = mdio_read(ioaddr, phy_id, 0x1f); net_link(tp, KERN_INFO "%s: mii ext = %04x.\n", dev->name, val); val = mdio_read(ioaddr, phy_id, MII_LPA); adv = mdio_read(ioaddr, phy_id, MII_ADVERTISE); - net_link(tp, KERN_INFO "%s: mii lpa = %04x adv = %04x.\n", - dev->name, val, adv); - - val &= adv; + autoexp = mdio_read(ioaddr, phy_id, MII_EXPANSION); + net_link(tp, KERN_INFO "%s: mii lpa=%04x adv=%04x exp=%04x.\n", + dev->name, val, adv, autoexp); + + if (val & LPA_NPAGE && autoexp & EXPANSION_NWAY) { + /* check for gigabit speed */ + gigadv = mdio_read(ioaddr, phy_id, MII_CTRL1000); + gigrec = mdio_read(ioaddr, phy_id, MII_STAT1000); + val = (gigadv & (gigrec >> 2)); + if (val & ADVERTISE_1000FULL) + p = reg31; + else if (val & ADVERTISE_1000HALF) + p = reg31 + 1; + } + if (!p) { + val &= adv; - for (p = reg31; p->val; p++) { - if ((val & p->val) == p->val) - break; + for (p = reg31; p->val; p++) { + if ((val & p->val) == p->val) + break; + } } p->ctl |= SIS_R32(StationControl) & ~0x0f001c00; -- cgit v1.2.3-70-g09d2 From c2f3f3a2fe4e35db352cfe1176e384e36bfd91b1 Mon Sep 17 00:00:00 2001 From: françois romieu Date: Wed, 17 Jun 2009 11:43:11 +0000 Subject: sis190: use an adequate phy list entry as a fallback When sis190 driver is trying to get default phy, if it doesn't find home or lan phy, it falls back to the first phy in the phy list but list_entry() points to a bogus entry. list_first_entry() should be used instead. Signed-off-by: Arnaud Patard Acked-off-by: Francois Romieu Signed-off-by: David S. Miller --- drivers/net/sis190.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/net/sis190.c') diff --git a/drivers/net/sis190.c b/drivers/net/sis190.c index e2247669a49..1f040e8a000 100644 --- a/drivers/net/sis190.c +++ b/drivers/net/sis190.c @@ -1281,7 +1281,7 @@ static u16 sis190_default_phy(struct net_device *dev) else if (phy_lan) phy_default = phy_lan; else - phy_default = list_entry(&tp->first_phy, + phy_default = list_first_entry(&tp->first_phy, struct sis190_phy, list); } -- cgit v1.2.3-70-g09d2