aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDaniele Venzano <venza@brownhat.org>2006-04-17 04:28:06 -0400
committerJeff Garzik <jeff@garzik.org>2006-04-20 17:29:43 -0400
commitd269a69fbbbb7ddd2081af7a768feac754b8357a (patch)
tree339e4e580ef66551a3f090bf6f6481755db1b59a /drivers
parent5ad05b990062c1b7a797f0ca293f6bdde62a50d9 (diff)
[PATCH] Add VLAN (802.1q) support to sis900 driver
The attached patch adds support for VLANs to the sis900 driver and bumps the version number. It is based on an old (2003) patch for the 2.4 series by Hamid Hashemi Golpayegani. It applies on top of 2.6.16(.5). I have one report that it works and behaves as intended. Please review and consider for inclusion. Signed-off-by: Daniele Venzano <venza@brownhat.org> -- Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/sis900.c26
-rw-r--r--drivers/net/sis900.h10
2 files changed, 28 insertions, 8 deletions
diff --git a/drivers/net/sis900.c b/drivers/net/sis900.c
index b82191d2bee1..3b3e1046d0a4 100644
--- a/drivers/net/sis900.c
+++ b/drivers/net/sis900.c
@@ -1,6 +1,6 @@
1/* sis900.c: A SiS 900/7016 PCI Fast Ethernet driver for Linux. 1/* sis900.c: A SiS 900/7016 PCI Fast Ethernet driver for Linux.
2 Copyright 1999 Silicon Integrated System Corporation 2 Copyright 1999 Silicon Integrated System Corporation
3 Revision: 1.08.09 Sep. 19 2005 3 Revision: 1.08.10 Apr. 2 2006
4 4
5 Modified from the driver which is originally written by Donald Becker. 5 Modified from the driver which is originally written by Donald Becker.
6 6
@@ -17,9 +17,10 @@
17 SiS 7014 Single Chip 100BASE-TX/10BASE-T Physical Layer Solution, 17 SiS 7014 Single Chip 100BASE-TX/10BASE-T Physical Layer Solution,
18 preliminary Rev. 1.0 Jan. 18, 1998 18 preliminary Rev. 1.0 Jan. 18, 1998
19 19
20 Rev 1.08.10 Apr. 2 2006 Daniele Venzano add vlan (jumbo packets) support
20 Rev 1.08.09 Sep. 19 2005 Daniele Venzano add Wake on LAN support 21 Rev 1.08.09 Sep. 19 2005 Daniele Venzano add Wake on LAN support
21 Rev 1.08.08 Jan. 22 2005 Daniele Venzano use netif_msg for debugging messages 22 Rev 1.08.08 Jan. 22 2005 Daniele Venzano use netif_msg for debugging messages
22 Rev 1.08.07 Nov. 2 2003 Daniele Venzano <webvenza@libero.it> add suspend/resume support 23 Rev 1.08.07 Nov. 2 2003 Daniele Venzano <venza@brownhat.org> add suspend/resume support
23 Rev 1.08.06 Sep. 24 2002 Mufasa Yang bug fix for Tx timeout & add SiS963 support 24 Rev 1.08.06 Sep. 24 2002 Mufasa Yang bug fix for Tx timeout & add SiS963 support
24 Rev 1.08.05 Jun. 6 2002 Mufasa Yang bug fix for read_eeprom & Tx descriptor over-boundary 25 Rev 1.08.05 Jun. 6 2002 Mufasa Yang bug fix for read_eeprom & Tx descriptor over-boundary
25 Rev 1.08.04 Apr. 25 2002 Mufasa Yang <mufasa@sis.com.tw> added SiS962 support 26 Rev 1.08.04 Apr. 25 2002 Mufasa Yang <mufasa@sis.com.tw> added SiS962 support
@@ -77,7 +78,7 @@
77#include "sis900.h" 78#include "sis900.h"
78 79
79#define SIS900_MODULE_NAME "sis900" 80#define SIS900_MODULE_NAME "sis900"
80#define SIS900_DRV_VERSION "v1.08.09 Sep. 19 2005" 81#define SIS900_DRV_VERSION "v1.08.10 Apr. 2 2006"
81 82
82static char version[] __devinitdata = 83static char version[] __devinitdata =
83KERN_INFO "sis900.c: " SIS900_DRV_VERSION "\n"; 84KERN_INFO "sis900.c: " SIS900_DRV_VERSION "\n";
@@ -1401,6 +1402,11 @@ static void sis900_set_mode (long ioaddr, int speed, int duplex)
1401 rx_flags |= RxATX; 1402 rx_flags |= RxATX;
1402 } 1403 }
1403 1404
1405#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
1406 /* Can accept Jumbo packet */
1407 rx_flags |= RxAJAB;
1408#endif
1409
1404 outl (tx_flags, ioaddr + txcfg); 1410 outl (tx_flags, ioaddr + txcfg);
1405 outl (rx_flags, ioaddr + rxcfg); 1411 outl (rx_flags, ioaddr + rxcfg);
1406} 1412}
@@ -1713,18 +1719,26 @@ static int sis900_rx(struct net_device *net_dev)
1713 1719
1714 while (rx_status & OWN) { 1720 while (rx_status & OWN) {
1715 unsigned int rx_size; 1721 unsigned int rx_size;
1722 unsigned int data_size;
1716 1723
1717 if (--rx_work_limit < 0) 1724 if (--rx_work_limit < 0)
1718 break; 1725 break;
1719 1726
1720 rx_size = (rx_status & DSIZE) - CRC_SIZE; 1727 data_size = rx_status & DSIZE;
1728 rx_size = data_size - CRC_SIZE;
1729
1730#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
1731 /* ``TOOLONG'' flag means jumbo packet recived. */
1732 if ((rx_status & TOOLONG) && data_size <= MAX_FRAME_SIZE)
1733 rx_status &= (~ ((unsigned int)TOOLONG));
1734#endif
1721 1735
1722 if (rx_status & (ABORT|OVERRUN|TOOLONG|RUNT|RXISERR|CRCERR|FAERR)) { 1736 if (rx_status & (ABORT|OVERRUN|TOOLONG|RUNT|RXISERR|CRCERR|FAERR)) {
1723 /* corrupted packet received */ 1737 /* corrupted packet received */
1724 if (netif_msg_rx_err(sis_priv)) 1738 if (netif_msg_rx_err(sis_priv))
1725 printk(KERN_DEBUG "%s: Corrupted packet " 1739 printk(KERN_DEBUG "%s: Corrupted packet "
1726 "received, buffer status = 0x%8.8x.\n", 1740 "received, buffer status = 0x%8.8x/%d.\n",
1727 net_dev->name, rx_status); 1741 net_dev->name, rx_status, data_size);
1728 sis_priv->stats.rx_errors++; 1742 sis_priv->stats.rx_errors++;
1729 if (rx_status & OVERRUN) 1743 if (rx_status & OVERRUN)
1730 sis_priv->stats.rx_over_errors++; 1744 sis_priv->stats.rx_over_errors++;
diff --git a/drivers/net/sis900.h b/drivers/net/sis900.h
index 50323941e3c0..4834e3a15694 100644
--- a/drivers/net/sis900.h
+++ b/drivers/net/sis900.h
@@ -310,8 +310,14 @@ enum sis630_revision_id {
310#define CRC_SIZE 4 310#define CRC_SIZE 4
311#define MAC_HEADER_SIZE 14 311#define MAC_HEADER_SIZE 14
312 312
313#define TX_BUF_SIZE 1536 313#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
314#define RX_BUF_SIZE 1536 314#define MAX_FRAME_SIZE (1518 + 4)
315#else
316#define MAX_FRAME_SIZE 1518
317#endif /* CONFIG_VLAN_802_1Q */
318
319#define TX_BUF_SIZE (MAX_FRAME_SIZE+18)
320#define RX_BUF_SIZE (MAX_FRAME_SIZE+18)
315 321
316#define NUM_TX_DESC 16 /* Number of Tx descriptor registers. */ 322#define NUM_TX_DESC 16 /* Number of Tx descriptor registers. */
317#define NUM_RX_DESC 16 /* Number of Rx descriptor registers. */ 323#define NUM_RX_DESC 16 /* Number of Rx descriptor registers. */