|
@@ -1,5 +1,5 @@
|
|
/*********************************************************************
|
|
/*********************************************************************
|
|
- *
|
|
|
|
|
|
+ *
|
|
* Filename: netwave_cs.c
|
|
* Filename: netwave_cs.c
|
|
* Version: 0.4.1
|
|
* Version: 0.4.1
|
|
* Description: Netwave AirSurfer Wireless LAN PC Card driver
|
|
* Description: Netwave AirSurfer Wireless LAN PC Card driver
|
|
@@ -10,27 +10,27 @@
|
|
* Created at: A long time ago!
|
|
* Created at: A long time ago!
|
|
* Modified at: Mon Nov 10 11:54:37 1997
|
|
* Modified at: Mon Nov 10 11:54:37 1997
|
|
* Modified by: Dag Brattli <dagb@cs.uit.no>
|
|
* Modified by: Dag Brattli <dagb@cs.uit.no>
|
|
- *
|
|
|
|
|
|
+ *
|
|
* Copyright (c) 1997 University of Tromsø, Norway
|
|
* Copyright (c) 1997 University of Tromsø, Norway
|
|
*
|
|
*
|
|
* Revision History:
|
|
* Revision History:
|
|
*
|
|
*
|
|
* 08-Nov-97 15:14:47 John Markus Bjørndalen <johnm@cs.uit.no>
|
|
* 08-Nov-97 15:14:47 John Markus Bjørndalen <johnm@cs.uit.no>
|
|
- * - Fixed some bugs in netwave_rx and cleaned it up a bit.
|
|
|
|
|
|
+ * - Fixed some bugs in netwave_rx and cleaned it up a bit.
|
|
* (One of the bugs would have destroyed packets when receiving
|
|
* (One of the bugs would have destroyed packets when receiving
|
|
- * multiple packets per interrupt).
|
|
|
|
- * - Cleaned up parts of newave_hw_xmit.
|
|
|
|
- * - A few general cleanups.
|
|
|
|
|
|
+ * multiple packets per interrupt).
|
|
|
|
+ * - Cleaned up parts of newave_hw_xmit.
|
|
|
|
+ * - A few general cleanups.
|
|
* 24-Oct-97 13:17:36 Dag Brattli <dagb@cs.uit.no>
|
|
* 24-Oct-97 13:17:36 Dag Brattli <dagb@cs.uit.no>
|
|
* - Fixed netwave_rx receive function (got updated docs)
|
|
* - Fixed netwave_rx receive function (got updated docs)
|
|
* Others:
|
|
* Others:
|
|
- * - Changed name from xircnw to netwave, take a look at
|
|
|
|
|
|
+ * - Changed name from xircnw to netwave, take a look at
|
|
* http://www.netwave-wireless.com
|
|
* http://www.netwave-wireless.com
|
|
* - Some reorganizing of the code
|
|
* - Some reorganizing of the code
|
|
* - Removed possible race condition between interrupt handler and transmit
|
|
* - Removed possible race condition between interrupt handler and transmit
|
|
* function
|
|
* function
|
|
* - Started to add wireless extensions, but still needs some coding
|
|
* - Started to add wireless extensions, but still needs some coding
|
|
- * - Added watchdog for better handling of transmission timeouts
|
|
|
|
|
|
+ * - Added watchdog for better handling of transmission timeouts
|
|
* (hopefully this works better)
|
|
* (hopefully this works better)
|
|
********************************************************************/
|
|
********************************************************************/
|
|
|
|
|
|
@@ -101,7 +101,7 @@
|
|
|
|
|
|
/*
|
|
/*
|
|
* Commands used in the extended command buffer
|
|
* Commands used in the extended command buffer
|
|
- * NETWAVE_EREG_CB (0x100-0x10F)
|
|
|
|
|
|
+ * NETWAVE_EREG_CB (0x100-0x10F)
|
|
*/
|
|
*/
|
|
#define NETWAVE_CMD_NOP 0x00
|
|
#define NETWAVE_CMD_NOP 0x00
|
|
#define NETWAVE_CMD_SRC 0x01
|
|
#define NETWAVE_CMD_SRC 0x01
|
|
@@ -133,7 +133,7 @@ static const unsigned int corConfIENA = 0x01; /* Interrupt enable */
|
|
static const unsigned int corConfLVLREQ = 0x40; /* Keep high */
|
|
static const unsigned int corConfLVLREQ = 0x40; /* Keep high */
|
|
|
|
|
|
static const unsigned int rxConfRxEna = 0x80; /* Receive Enable */
|
|
static const unsigned int rxConfRxEna = 0x80; /* Receive Enable */
|
|
-static const unsigned int rxConfMAC = 0x20; /* MAC host receive mode*/
|
|
|
|
|
|
+static const unsigned int rxConfMAC = 0x20; /* MAC host receive mode*/
|
|
static const unsigned int rxConfPro = 0x10; /* Promiscuous */
|
|
static const unsigned int rxConfPro = 0x10; /* Promiscuous */
|
|
static const unsigned int rxConfAMP = 0x08; /* Accept Multicast Packets */
|
|
static const unsigned int rxConfAMP = 0x08; /* Accept Multicast Packets */
|
|
static const unsigned int rxConfBcast = 0x04; /* Accept Broadcast Packets */
|
|
static const unsigned int rxConfBcast = 0x04; /* Accept Broadcast Packets */
|
|
@@ -152,15 +152,15 @@ static const unsigned int txConfLoop = 0x01; /* Loopback mode */
|
|
/* Choose the domain, default is 0x100 */
|
|
/* Choose the domain, default is 0x100 */
|
|
static u_int domain = 0x100;
|
|
static u_int domain = 0x100;
|
|
|
|
|
|
-/* Scramble key, range from 0x0 to 0xffff.
|
|
|
|
- * 0x0 is no scrambling.
|
|
|
|
|
|
+/* Scramble key, range from 0x0 to 0xffff.
|
|
|
|
+ * 0x0 is no scrambling.
|
|
*/
|
|
*/
|
|
static u_int scramble_key = 0x0;
|
|
static u_int scramble_key = 0x0;
|
|
|
|
|
|
-/* Shared memory speed, in ns. The documentation states that
|
|
|
|
- * the card should not be read faster than every 400ns.
|
|
|
|
- * This timing should be provided by the HBA. If it becomes a
|
|
|
|
- * problem, try setting mem_speed to 400.
|
|
|
|
|
|
+/* Shared memory speed, in ns. The documentation states that
|
|
|
|
+ * the card should not be read faster than every 400ns.
|
|
|
|
+ * This timing should be provided by the HBA. If it becomes a
|
|
|
|
+ * problem, try setting mem_speed to 400.
|
|
*/
|
|
*/
|
|
static int mem_speed;
|
|
static int mem_speed;
|
|
|
|
|
|
@@ -229,7 +229,7 @@ struct site_survey {
|
|
u_short length;
|
|
u_short length;
|
|
u_char struct_revision;
|
|
u_char struct_revision;
|
|
u_char roaming_state;
|
|
u_char roaming_state;
|
|
-
|
|
|
|
|
|
+
|
|
u_char sp_existsFlag;
|
|
u_char sp_existsFlag;
|
|
u_char sp_link_quality;
|
|
u_char sp_link_quality;
|
|
u_char sp_max_link_quality;
|
|
u_char sp_max_link_quality;
|
|
@@ -239,12 +239,12 @@ struct site_survey {
|
|
u_char sp_goodness;
|
|
u_char sp_goodness;
|
|
u_char sp_hotheadcount;
|
|
u_char sp_hotheadcount;
|
|
u_char roaming_condition;
|
|
u_char roaming_condition;
|
|
-
|
|
|
|
|
|
+
|
|
net_addr sp;
|
|
net_addr sp;
|
|
u_char numAPs;
|
|
u_char numAPs;
|
|
net_addr nearByAccessPoints[MAX_ESA];
|
|
net_addr nearByAccessPoints[MAX_ESA];
|
|
-};
|
|
|
|
-
|
|
|
|
|
|
+};
|
|
|
|
+
|
|
typedef struct netwave_private {
|
|
typedef struct netwave_private {
|
|
struct pcmcia_device *p_dev;
|
|
struct pcmcia_device *p_dev;
|
|
spinlock_t spinlock; /* Serialize access to the hardware (SMP) */
|
|
spinlock_t spinlock; /* Serialize access to the hardware (SMP) */
|
|
@@ -261,7 +261,7 @@ typedef struct netwave_private {
|
|
* The Netwave card is little-endian, so won't work for big endian
|
|
* The Netwave card is little-endian, so won't work for big endian
|
|
* systems.
|
|
* systems.
|
|
*/
|
|
*/
|
|
-static inline unsigned short get_uint16(u_char __iomem *staddr)
|
|
|
|
|
|
+static inline unsigned short get_uint16(u_char __iomem *staddr)
|
|
{
|
|
{
|
|
return readw(staddr); /* Return only 16 bits */
|
|
return readw(staddr); /* Return only 16 bits */
|
|
}
|
|
}
|
|
@@ -271,38 +271,38 @@ static inline short get_int16(u_char __iomem * staddr)
|
|
return readw(staddr);
|
|
return readw(staddr);
|
|
}
|
|
}
|
|
|
|
|
|
-/*
|
|
|
|
- * Wait until the WOC (Write Operation Complete) bit in the
|
|
|
|
- * ASR (Adapter Status Register) is asserted.
|
|
|
|
- * This should have aborted if it takes too long time.
|
|
|
|
|
|
+/*
|
|
|
|
+ * Wait until the WOC (Write Operation Complete) bit in the
|
|
|
|
+ * ASR (Adapter Status Register) is asserted.
|
|
|
|
+ * This should have aborted if it takes too long time.
|
|
*/
|
|
*/
|
|
static inline void wait_WOC(unsigned int iobase)
|
|
static inline void wait_WOC(unsigned int iobase)
|
|
{
|
|
{
|
|
/* Spin lock */
|
|
/* Spin lock */
|
|
- while ((inb(iobase + NETWAVE_REG_ASR) & 0x8) != 0x8) ;
|
|
|
|
|
|
+ while ((inb(iobase + NETWAVE_REG_ASR) & 0x8) != 0x8) ;
|
|
}
|
|
}
|
|
|
|
|
|
-static void netwave_snapshot(netwave_private *priv, u_char __iomem *ramBase,
|
|
|
|
|
|
+static void netwave_snapshot(netwave_private *priv, u_char __iomem *ramBase,
|
|
unsigned int iobase) {
|
|
unsigned int iobase) {
|
|
u_short resultBuffer;
|
|
u_short resultBuffer;
|
|
|
|
|
|
- /* if time since last snapshot is > 1 sec. (100 jiffies?) then take
|
|
|
|
- * new snapshot, else return cached data. This is the recommended rate.
|
|
|
|
|
|
+ /* if time since last snapshot is > 1 sec. (100 jiffies?) then take
|
|
|
|
+ * new snapshot, else return cached data. This is the recommended rate.
|
|
*/
|
|
*/
|
|
- if ( jiffies - priv->lastExec > 100) {
|
|
|
|
- /* Take site survey snapshot */
|
|
|
|
|
|
+ if ( jiffies - priv->lastExec > 100) {
|
|
|
|
+ /* Take site survey snapshot */
|
|
/*printk( KERN_DEBUG "Taking new snapshot. %ld\n", jiffies -
|
|
/*printk( KERN_DEBUG "Taking new snapshot. %ld\n", jiffies -
|
|
priv->lastExec); */
|
|
priv->lastExec); */
|
|
- wait_WOC(iobase);
|
|
|
|
- writeb(NETWAVE_CMD_SSS, ramBase + NETWAVE_EREG_CB + 0);
|
|
|
|
- writeb(NETWAVE_CMD_EOC, ramBase + NETWAVE_EREG_CB + 1);
|
|
|
|
- wait_WOC(iobase);
|
|
|
|
-
|
|
|
|
- /* Get result and copy to cach */
|
|
|
|
- resultBuffer = readw(ramBase + NETWAVE_EREG_CRBP);
|
|
|
|
- copy_from_pc( &priv->nss, ramBase+resultBuffer,
|
|
|
|
- sizeof(struct site_survey));
|
|
|
|
- }
|
|
|
|
|
|
+ wait_WOC(iobase);
|
|
|
|
+ writeb(NETWAVE_CMD_SSS, ramBase + NETWAVE_EREG_CB + 0);
|
|
|
|
+ writeb(NETWAVE_CMD_EOC, ramBase + NETWAVE_EREG_CB + 1);
|
|
|
|
+ wait_WOC(iobase);
|
|
|
|
+
|
|
|
|
+ /* Get result and copy to cach */
|
|
|
|
+ resultBuffer = readw(ramBase + NETWAVE_EREG_CRBP);
|
|
|
|
+ copy_from_pc( &priv->nss, ramBase+resultBuffer,
|
|
|
|
+ sizeof(struct site_survey));
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
/*
|
|
/*
|
|
@@ -312,21 +312,21 @@ static void netwave_snapshot(netwave_private *priv, u_char __iomem *ramBase,
|
|
*
|
|
*
|
|
*/
|
|
*/
|
|
static struct iw_statistics *netwave_get_wireless_stats(struct net_device *dev)
|
|
static struct iw_statistics *netwave_get_wireless_stats(struct net_device *dev)
|
|
-{
|
|
|
|
|
|
+{
|
|
unsigned long flags;
|
|
unsigned long flags;
|
|
unsigned int iobase = dev->base_addr;
|
|
unsigned int iobase = dev->base_addr;
|
|
netwave_private *priv = netdev_priv(dev);
|
|
netwave_private *priv = netdev_priv(dev);
|
|
u_char __iomem *ramBase = priv->ramBase;
|
|
u_char __iomem *ramBase = priv->ramBase;
|
|
struct iw_statistics* wstats;
|
|
struct iw_statistics* wstats;
|
|
-
|
|
|
|
|
|
+
|
|
wstats = &priv->iw_stats;
|
|
wstats = &priv->iw_stats;
|
|
|
|
|
|
spin_lock_irqsave(&priv->spinlock, flags);
|
|
spin_lock_irqsave(&priv->spinlock, flags);
|
|
-
|
|
|
|
|
|
+
|
|
netwave_snapshot( priv, ramBase, iobase);
|
|
netwave_snapshot( priv, ramBase, iobase);
|
|
|
|
|
|
wstats->status = priv->nss.roaming_state;
|
|
wstats->status = priv->nss.roaming_state;
|
|
- wstats->qual.qual = readb( ramBase + NETWAVE_EREG_SPCQ);
|
|
|
|
|
|
+ wstats->qual.qual = readb( ramBase + NETWAVE_EREG_SPCQ);
|
|
wstats->qual.level = readb( ramBase + NETWAVE_EREG_ISPLQ);
|
|
wstats->qual.level = readb( ramBase + NETWAVE_EREG_ISPLQ);
|
|
wstats->qual.noise = readb( ramBase + NETWAVE_EREG_SPU) & 0x3f;
|
|
wstats->qual.noise = readb( ramBase + NETWAVE_EREG_SPU) & 0x3f;
|
|
wstats->discard.nwid = 0L;
|
|
wstats->discard.nwid = 0L;
|
|
@@ -334,7 +334,7 @@ static struct iw_statistics *netwave_get_wireless_stats(struct net_device *dev)
|
|
wstats->discard.misc = 0L;
|
|
wstats->discard.misc = 0L;
|
|
|
|
|
|
spin_unlock_irqrestore(&priv->spinlock, flags);
|
|
spin_unlock_irqrestore(&priv->spinlock, flags);
|
|
-
|
|
|
|
|
|
+
|
|
return &priv->iw_stats;
|
|
return &priv->iw_stats;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -352,8 +352,8 @@ static const struct net_device_ops netwave_netdev_ops = {
|
|
/*
|
|
/*
|
|
* Function netwave_attach (void)
|
|
* Function netwave_attach (void)
|
|
*
|
|
*
|
|
- * Creates an "instance" of the driver, allocating local data
|
|
|
|
- * structures for one device. The device is registered with Card
|
|
|
|
|
|
+ * Creates an "instance" of the driver, allocating local data
|
|
|
|
+ * structures for one device. The device is registered with Card
|
|
* Services.
|
|
* Services.
|
|
*
|
|
*
|
|
* The dev_link structure is initialized, but we don't actually
|
|
* The dev_link structure is initialized, but we don't actually
|
|
@@ -378,14 +378,14 @@ static int netwave_probe(struct pcmcia_device *link)
|
|
/* The io structure describes IO port mapping */
|
|
/* The io structure describes IO port mapping */
|
|
link->io.NumPorts1 = 16;
|
|
link->io.NumPorts1 = 16;
|
|
link->io.Attributes1 = IO_DATA_PATH_WIDTH_16;
|
|
link->io.Attributes1 = IO_DATA_PATH_WIDTH_16;
|
|
- /* link->io.NumPorts2 = 16;
|
|
|
|
|
|
+ /* link->io.NumPorts2 = 16;
|
|
link->io.Attributes2 = IO_DATA_PATH_WIDTH_16; */
|
|
link->io.Attributes2 = IO_DATA_PATH_WIDTH_16; */
|
|
link->io.IOAddrLines = 5;
|
|
link->io.IOAddrLines = 5;
|
|
-
|
|
|
|
|
|
+
|
|
/* Interrupt setup */
|
|
/* Interrupt setup */
|
|
link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
|
|
link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
|
|
link->irq.Handler = &netwave_interrupt;
|
|
link->irq.Handler = &netwave_interrupt;
|
|
-
|
|
|
|
|
|
+
|
|
/* General socket configuration */
|
|
/* General socket configuration */
|
|
link->conf.Attributes = CONF_ENABLE_IRQ;
|
|
link->conf.Attributes = CONF_ENABLE_IRQ;
|
|
link->conf.IntType = INT_MEMORY_AND_IO;
|
|
link->conf.IntType = INT_MEMORY_AND_IO;
|
|
@@ -457,7 +457,7 @@ static int netwave_set_nwid(struct net_device *dev,
|
|
|
|
|
|
if(!wrqu->nwid.disabled) {
|
|
if(!wrqu->nwid.disabled) {
|
|
domain = wrqu->nwid.value;
|
|
domain = wrqu->nwid.value;
|
|
- printk( KERN_DEBUG "Setting domain to 0x%x%02x\n",
|
|
|
|
|
|
+ printk( KERN_DEBUG "Setting domain to 0x%x%02x\n",
|
|
(domain >> 8) & 0x01, domain & 0xff);
|
|
(domain >> 8) & 0x01, domain & 0xff);
|
|
wait_WOC(iobase);
|
|
wait_WOC(iobase);
|
|
writeb(NETWAVE_CMD_SMD, ramBase + NETWAVE_EREG_CB + 0);
|
|
writeb(NETWAVE_CMD_SMD, ramBase + NETWAVE_EREG_CB + 0);
|
|
@@ -468,7 +468,7 @@ static int netwave_set_nwid(struct net_device *dev,
|
|
|
|
|
|
/* ReEnable interrupts & restore flags */
|
|
/* ReEnable interrupts & restore flags */
|
|
spin_unlock_irqrestore(&priv->spinlock, flags);
|
|
spin_unlock_irqrestore(&priv->spinlock, flags);
|
|
-
|
|
|
|
|
|
+
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -511,7 +511,7 @@ static int netwave_set_scramble(struct net_device *dev,
|
|
|
|
|
|
/* ReEnable interrupts & restore flags */
|
|
/* ReEnable interrupts & restore flags */
|
|
spin_unlock_irqrestore(&priv->spinlock, flags);
|
|
spin_unlock_irqrestore(&priv->spinlock, flags);
|
|
-
|
|
|
|
|
|
+
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -566,19 +566,19 @@ static int netwave_get_range(struct net_device *dev,
|
|
/* Set the Wireless Extension versions */
|
|
/* Set the Wireless Extension versions */
|
|
range->we_version_compiled = WIRELESS_EXT;
|
|
range->we_version_compiled = WIRELESS_EXT;
|
|
range->we_version_source = 9; /* Nothing for us in v10 and v11 */
|
|
range->we_version_source = 9; /* Nothing for us in v10 and v11 */
|
|
-
|
|
|
|
|
|
+
|
|
/* Set information in the range struct */
|
|
/* Set information in the range struct */
|
|
range->throughput = 450 * 1000; /* don't argue on this ! */
|
|
range->throughput = 450 * 1000; /* don't argue on this ! */
|
|
range->min_nwid = 0x0000;
|
|
range->min_nwid = 0x0000;
|
|
range->max_nwid = 0x01FF;
|
|
range->max_nwid = 0x01FF;
|
|
|
|
|
|
range->num_channels = range->num_frequency = 0;
|
|
range->num_channels = range->num_frequency = 0;
|
|
-
|
|
|
|
|
|
+
|
|
range->sensitivity = 0x3F;
|
|
range->sensitivity = 0x3F;
|
|
range->max_qual.qual = 255;
|
|
range->max_qual.qual = 255;
|
|
range->max_qual.level = 255;
|
|
range->max_qual.level = 255;
|
|
range->max_qual.noise = 0;
|
|
range->max_qual.noise = 0;
|
|
-
|
|
|
|
|
|
+
|
|
range->num_bitrates = 1;
|
|
range->num_bitrates = 1;
|
|
range->bitrate[0] = 1000000; /* 1 Mb/s */
|
|
range->bitrate[0] = 1000000; /* 1 Mb/s */
|
|
|
|
|
|
@@ -614,7 +614,7 @@ static int netwave_get_snap(struct net_device *dev,
|
|
|
|
|
|
/* ReEnable interrupts & restore flags */
|
|
/* ReEnable interrupts & restore flags */
|
|
spin_unlock_irqrestore(&priv->spinlock, flags);
|
|
spin_unlock_irqrestore(&priv->spinlock, flags);
|
|
-
|
|
|
|
|
|
+
|
|
return(0);
|
|
return(0);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -625,8 +625,8 @@ static int netwave_get_snap(struct net_device *dev,
|
|
|
|
|
|
static const struct iw_priv_args netwave_private_args[] = {
|
|
static const struct iw_priv_args netwave_private_args[] = {
|
|
/*{ cmd, set_args, get_args, name } */
|
|
/*{ cmd, set_args, get_args, name } */
|
|
- { SIOCGIPSNAP, 0,
|
|
|
|
- IW_PRIV_TYPE_BYTE | IW_PRIV_SIZE_FIXED | sizeof(struct site_survey),
|
|
|
|
|
|
+ { SIOCGIPSNAP, 0,
|
|
|
|
+ IW_PRIV_TYPE_BYTE | IW_PRIV_SIZE_FIXED | sizeof(struct site_survey),
|
|
"getsitesurvey" },
|
|
"getsitesurvey" },
|
|
};
|
|
};
|
|
|
|
|
|
@@ -698,9 +698,9 @@ static const struct iw_handler_def netwave_handler_def =
|
|
/*
|
|
/*
|
|
* Function netwave_pcmcia_config (link)
|
|
* Function netwave_pcmcia_config (link)
|
|
*
|
|
*
|
|
- * netwave_pcmcia_config() is scheduled to run after a CARD_INSERTION
|
|
|
|
|
|
+ * netwave_pcmcia_config() is scheduled to run after a CARD_INSERTION
|
|
* event is received, to configure the PCMCIA socket, and to make the
|
|
* event is received, to configure the PCMCIA socket, and to make the
|
|
- * device available to the system.
|
|
|
|
|
|
+ * device available to the system.
|
|
*
|
|
*
|
|
*/
|
|
*/
|
|
|
|
|
|
@@ -758,7 +758,7 @@ static int netwave_pcmcia_config(struct pcmcia_device *link) {
|
|
ret = pcmcia_request_window(link, &req, &link->win);
|
|
ret = pcmcia_request_window(link, &req, &link->win);
|
|
if (ret)
|
|
if (ret)
|
|
goto failed;
|
|
goto failed;
|
|
- mem.CardOffset = 0x20000; mem.Page = 0;
|
|
|
|
|
|
+ mem.CardOffset = 0x20000; mem.Page = 0;
|
|
ret = pcmcia_map_mem_page(link, link->win, &mem);
|
|
ret = pcmcia_map_mem_page(link, link->win, &mem);
|
|
if (ret)
|
|
if (ret)
|
|
goto failed;
|
|
goto failed;
|
|
@@ -783,7 +783,7 @@ static int netwave_pcmcia_config(struct pcmcia_device *link) {
|
|
netwave_doreset(dev->base_addr, ramBase);
|
|
netwave_doreset(dev->base_addr, ramBase);
|
|
|
|
|
|
/* Read the ethernet address and fill in the Netwave registers. */
|
|
/* Read the ethernet address and fill in the Netwave registers. */
|
|
- for (i = 0; i < 6; i++)
|
|
|
|
|
|
+ for (i = 0; i < 6; i++)
|
|
dev->dev_addr[i] = readb(ramBase + NETWAVE_EREG_PA + i);
|
|
dev->dev_addr[i] = readb(ramBase + NETWAVE_EREG_PA + i);
|
|
|
|
|
|
printk(KERN_INFO "%s: Netwave: port %#3lx, irq %d, mem %lx, "
|
|
printk(KERN_INFO "%s: Netwave: port %#3lx, irq %d, mem %lx, "
|
|
@@ -795,7 +795,7 @@ static int netwave_pcmcia_config(struct pcmcia_device *link) {
|
|
dev->dev_addr);
|
|
dev->dev_addr);
|
|
|
|
|
|
/* get revision words */
|
|
/* get revision words */
|
|
- printk(KERN_DEBUG "Netwave_reset: revision %04x %04x\n",
|
|
|
|
|
|
+ printk(KERN_DEBUG "Netwave_reset: revision %04x %04x\n",
|
|
get_uint16(ramBase + NETWAVE_EREG_ARW),
|
|
get_uint16(ramBase + NETWAVE_EREG_ARW),
|
|
get_uint16(ramBase + NETWAVE_EREG_ARW+2));
|
|
get_uint16(ramBase + NETWAVE_EREG_ARW+2));
|
|
return 0;
|
|
return 0;
|
|
@@ -864,7 +864,7 @@ static void netwave_doreset(unsigned int ioBase, u_char __iomem *ramBase)
|
|
/*
|
|
/*
|
|
* Function netwave_reset (dev)
|
|
* Function netwave_reset (dev)
|
|
*
|
|
*
|
|
- * Reset and restore all of the netwave registers
|
|
|
|
|
|
+ * Reset and restore all of the netwave registers
|
|
*/
|
|
*/
|
|
static void netwave_reset(struct net_device *dev) {
|
|
static void netwave_reset(struct net_device *dev) {
|
|
/* u_char state; */
|
|
/* u_char state; */
|
|
@@ -879,24 +879,24 @@ static void netwave_reset(struct net_device *dev) {
|
|
/* Reset card */
|
|
/* Reset card */
|
|
netwave_doreset(iobase, ramBase);
|
|
netwave_doreset(iobase, ramBase);
|
|
printk(KERN_DEBUG "netwave_reset: Done with hardware reset\n");
|
|
printk(KERN_DEBUG "netwave_reset: Done with hardware reset\n");
|
|
-
|
|
|
|
|
|
+
|
|
/* Write a NOP to check the card */
|
|
/* Write a NOP to check the card */
|
|
wait_WOC(iobase);
|
|
wait_WOC(iobase);
|
|
writeb(NETWAVE_CMD_NOP, ramBase + NETWAVE_EREG_CB + 0);
|
|
writeb(NETWAVE_CMD_NOP, ramBase + NETWAVE_EREG_CB + 0);
|
|
writeb(NETWAVE_CMD_EOC, ramBase + NETWAVE_EREG_CB + 1);
|
|
writeb(NETWAVE_CMD_EOC, ramBase + NETWAVE_EREG_CB + 1);
|
|
-
|
|
|
|
|
|
+
|
|
/* Set receive conf */
|
|
/* Set receive conf */
|
|
wait_WOC(iobase);
|
|
wait_WOC(iobase);
|
|
writeb(NETWAVE_CMD_SRC, ramBase + NETWAVE_EREG_CB + 0);
|
|
writeb(NETWAVE_CMD_SRC, ramBase + NETWAVE_EREG_CB + 0);
|
|
writeb(rxConfRxEna + rxConfBcast, ramBase + NETWAVE_EREG_CB + 1);
|
|
writeb(rxConfRxEna + rxConfBcast, ramBase + NETWAVE_EREG_CB + 1);
|
|
writeb(NETWAVE_CMD_EOC, ramBase + NETWAVE_EREG_CB + 2);
|
|
writeb(NETWAVE_CMD_EOC, ramBase + NETWAVE_EREG_CB + 2);
|
|
-
|
|
|
|
|
|
+
|
|
/* Set transmit conf */
|
|
/* Set transmit conf */
|
|
wait_WOC(iobase);
|
|
wait_WOC(iobase);
|
|
writeb(NETWAVE_CMD_STC, ramBase + NETWAVE_EREG_CB + 0);
|
|
writeb(NETWAVE_CMD_STC, ramBase + NETWAVE_EREG_CB + 0);
|
|
writeb(txConfTxEna, ramBase + NETWAVE_EREG_CB + 1);
|
|
writeb(txConfTxEna, ramBase + NETWAVE_EREG_CB + 1);
|
|
writeb(NETWAVE_CMD_EOC, ramBase + NETWAVE_EREG_CB + 2);
|
|
writeb(NETWAVE_CMD_EOC, ramBase + NETWAVE_EREG_CB + 2);
|
|
-
|
|
|
|
|
|
+
|
|
/* Now set the MU Domain */
|
|
/* Now set the MU Domain */
|
|
printk(KERN_DEBUG "Setting domain to 0x%x%02x\n", (domain >> 8) & 0x01, domain & 0xff);
|
|
printk(KERN_DEBUG "Setting domain to 0x%x%02x\n", (domain >> 8) & 0x01, domain & 0xff);
|
|
wait_WOC(iobase);
|
|
wait_WOC(iobase);
|
|
@@ -904,7 +904,7 @@ static void netwave_reset(struct net_device *dev) {
|
|
writeb(domain & 0xff, ramBase + NETWAVE_EREG_CB + 1);
|
|
writeb(domain & 0xff, ramBase + NETWAVE_EREG_CB + 1);
|
|
writeb((domain>>8) & 0x01, ramBase + NETWAVE_EREG_CB + 2);
|
|
writeb((domain>>8) & 0x01, ramBase + NETWAVE_EREG_CB + 2);
|
|
writeb(NETWAVE_CMD_EOC, ramBase + NETWAVE_EREG_CB + 3);
|
|
writeb(NETWAVE_CMD_EOC, ramBase + NETWAVE_EREG_CB + 3);
|
|
-
|
|
|
|
|
|
+
|
|
/* Set scramble key */
|
|
/* Set scramble key */
|
|
printk(KERN_DEBUG "Setting scramble key to 0x%x\n", scramble_key);
|
|
printk(KERN_DEBUG "Setting scramble key to 0x%x\n", scramble_key);
|
|
wait_WOC(iobase);
|
|
wait_WOC(iobase);
|
|
@@ -914,8 +914,8 @@ static void netwave_reset(struct net_device *dev) {
|
|
writeb(NETWAVE_CMD_EOC, ramBase + NETWAVE_EREG_CB + 3);
|
|
writeb(NETWAVE_CMD_EOC, ramBase + NETWAVE_EREG_CB + 3);
|
|
|
|
|
|
/* Enable interrupts, bit 4 high to keep unused
|
|
/* Enable interrupts, bit 4 high to keep unused
|
|
- * source from interrupting us, bit 2 high to
|
|
|
|
- * set interrupt enable, 567 to enable TxDN,
|
|
|
|
|
|
+ * source from interrupting us, bit 2 high to
|
|
|
|
+ * set interrupt enable, 567 to enable TxDN,
|
|
* RxErr and RxRdy
|
|
* RxErr and RxRdy
|
|
*/
|
|
*/
|
|
wait_WOC(iobase);
|
|
wait_WOC(iobase);
|
|
@@ -926,29 +926,29 @@ static void netwave_reset(struct net_device *dev) {
|
|
* skriv 80 til d000:3688
|
|
* skriv 80 til d000:3688
|
|
* sjekk om det ble 80
|
|
* sjekk om det ble 80
|
|
*/
|
|
*/
|
|
-
|
|
|
|
|
|
+
|
|
/* Enable Receiver */
|
|
/* Enable Receiver */
|
|
wait_WOC(iobase);
|
|
wait_WOC(iobase);
|
|
writeb(NETWAVE_CMD_ER, ramBase + NETWAVE_EREG_CB + 0);
|
|
writeb(NETWAVE_CMD_ER, ramBase + NETWAVE_EREG_CB + 0);
|
|
writeb(NETWAVE_CMD_EOC, ramBase + NETWAVE_EREG_CB + 1);
|
|
writeb(NETWAVE_CMD_EOC, ramBase + NETWAVE_EREG_CB + 1);
|
|
-
|
|
|
|
|
|
+
|
|
/* Set the IENA bit in COR */
|
|
/* Set the IENA bit in COR */
|
|
wait_WOC(iobase);
|
|
wait_WOC(iobase);
|
|
outb(corConfIENA + corConfLVLREQ, iobase + NETWAVE_REG_COR);
|
|
outb(corConfIENA + corConfLVLREQ, iobase + NETWAVE_REG_COR);
|
|
}
|
|
}
|
|
|
|
|
|
/*
|
|
/*
|
|
- * Function netwave_hw_xmit (data, len, dev)
|
|
|
|
|
|
+ * Function netwave_hw_xmit (data, len, dev)
|
|
*/
|
|
*/
|
|
static int netwave_hw_xmit(unsigned char* data, int len,
|
|
static int netwave_hw_xmit(unsigned char* data, int len,
|
|
struct net_device* dev) {
|
|
struct net_device* dev) {
|
|
unsigned long flags;
|
|
unsigned long flags;
|
|
unsigned int TxFreeList,
|
|
unsigned int TxFreeList,
|
|
curBuff,
|
|
curBuff,
|
|
- MaxData,
|
|
|
|
|
|
+ MaxData,
|
|
DataOffset;
|
|
DataOffset;
|
|
- int tmpcount;
|
|
|
|
-
|
|
|
|
|
|
+ int tmpcount;
|
|
|
|
+
|
|
netwave_private *priv = netdev_priv(dev);
|
|
netwave_private *priv = netdev_priv(dev);
|
|
u_char __iomem * ramBase = priv->ramBase;
|
|
u_char __iomem * ramBase = priv->ramBase;
|
|
unsigned int iobase = dev->base_addr;
|
|
unsigned int iobase = dev->base_addr;
|
|
@@ -979,23 +979,23 @@ static int netwave_hw_xmit(unsigned char* data, int len,
|
|
TxFreeList = get_uint16(ramBase + NETWAVE_EREG_TDP);
|
|
TxFreeList = get_uint16(ramBase + NETWAVE_EREG_TDP);
|
|
MaxData = get_uint16(ramBase + NETWAVE_EREG_TDP+2);
|
|
MaxData = get_uint16(ramBase + NETWAVE_EREG_TDP+2);
|
|
DataOffset = get_uint16(ramBase + NETWAVE_EREG_TDP+4);
|
|
DataOffset = get_uint16(ramBase + NETWAVE_EREG_TDP+4);
|
|
-
|
|
|
|
|
|
+
|
|
pr_debug("TxFreeList %x, MaxData %x, DataOffset %x\n",
|
|
pr_debug("TxFreeList %x, MaxData %x, DataOffset %x\n",
|
|
TxFreeList, MaxData, DataOffset);
|
|
TxFreeList, MaxData, DataOffset);
|
|
|
|
|
|
/* Copy packet to the adapter fragment buffers */
|
|
/* Copy packet to the adapter fragment buffers */
|
|
- curBuff = TxFreeList;
|
|
|
|
- tmpcount = 0;
|
|
|
|
|
|
+ curBuff = TxFreeList;
|
|
|
|
+ tmpcount = 0;
|
|
while (tmpcount < len) {
|
|
while (tmpcount < len) {
|
|
- int tmplen = len - tmpcount;
|
|
|
|
- copy_to_pc(ramBase + curBuff + DataOffset, data + tmpcount,
|
|
|
|
|
|
+ int tmplen = len - tmpcount;
|
|
|
|
+ copy_to_pc(ramBase + curBuff + DataOffset, data + tmpcount,
|
|
(tmplen < MaxData) ? tmplen : MaxData);
|
|
(tmplen < MaxData) ? tmplen : MaxData);
|
|
tmpcount += MaxData;
|
|
tmpcount += MaxData;
|
|
-
|
|
|
|
|
|
+
|
|
/* Advance to next buffer */
|
|
/* Advance to next buffer */
|
|
curBuff = get_uint16(ramBase + curBuff);
|
|
curBuff = get_uint16(ramBase + curBuff);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
/* Now issue transmit list */
|
|
/* Now issue transmit list */
|
|
wait_WOC(iobase);
|
|
wait_WOC(iobase);
|
|
writeb(NETWAVE_CMD_TL, ramBase + NETWAVE_EREG_CB + 0);
|
|
writeb(NETWAVE_CMD_TL, ramBase + NETWAVE_EREG_CB + 0);
|
|
@@ -1020,7 +1020,7 @@ static netdev_tx_t netwave_start_xmit(struct sk_buff *skb,
|
|
{
|
|
{
|
|
short length = ETH_ZLEN < skb->len ? skb->len : ETH_ZLEN;
|
|
short length = ETH_ZLEN < skb->len ? skb->len : ETH_ZLEN;
|
|
unsigned char* buf = skb->data;
|
|
unsigned char* buf = skb->data;
|
|
-
|
|
|
|
|
|
+
|
|
if (netwave_hw_xmit( buf, length, dev) == 1) {
|
|
if (netwave_hw_xmit( buf, length, dev) == 1) {
|
|
/* Some error, let's make them call us another time? */
|
|
/* Some error, let's make them call us another time? */
|
|
netif_start_queue(dev);
|
|
netif_start_queue(dev);
|
|
@@ -1028,7 +1028,7 @@ static netdev_tx_t netwave_start_xmit(struct sk_buff *skb,
|
|
dev->trans_start = jiffies;
|
|
dev->trans_start = jiffies;
|
|
}
|
|
}
|
|
dev_kfree_skb(skb);
|
|
dev_kfree_skb(skb);
|
|
-
|
|
|
|
|
|
+
|
|
return NETDEV_TX_OK;
|
|
return NETDEV_TX_OK;
|
|
} /* netwave_start_xmit */
|
|
} /* netwave_start_xmit */
|
|
|
|
|
|
@@ -1036,7 +1036,7 @@ static netdev_tx_t netwave_start_xmit(struct sk_buff *skb,
|
|
* Function netwave_interrupt (irq, dev_id)
|
|
* Function netwave_interrupt (irq, dev_id)
|
|
*
|
|
*
|
|
* This function is the interrupt handler for the Netwave card. This
|
|
* This function is the interrupt handler for the Netwave card. This
|
|
- * routine will be called whenever:
|
|
|
|
|
|
+ * routine will be called whenever:
|
|
* 1. A packet is received.
|
|
* 1. A packet is received.
|
|
* 2. A packet has successfully been transferred and the unit is
|
|
* 2. A packet has successfully been transferred and the unit is
|
|
* ready to transmit another packet.
|
|
* ready to transmit another packet.
|
|
@@ -1050,29 +1050,29 @@ static irqreturn_t netwave_interrupt(int irq, void* dev_id)
|
|
struct netwave_private *priv = netdev_priv(dev);
|
|
struct netwave_private *priv = netdev_priv(dev);
|
|
struct pcmcia_device *link = priv->p_dev;
|
|
struct pcmcia_device *link = priv->p_dev;
|
|
int i;
|
|
int i;
|
|
-
|
|
|
|
|
|
+
|
|
if (!netif_device_present(dev))
|
|
if (!netif_device_present(dev))
|
|
return IRQ_NONE;
|
|
return IRQ_NONE;
|
|
-
|
|
|
|
|
|
+
|
|
iobase = dev->base_addr;
|
|
iobase = dev->base_addr;
|
|
ramBase = priv->ramBase;
|
|
ramBase = priv->ramBase;
|
|
-
|
|
|
|
|
|
+
|
|
/* Now find what caused the interrupt, check while interrupts ready */
|
|
/* Now find what caused the interrupt, check while interrupts ready */
|
|
for (i = 0; i < 10; i++) {
|
|
for (i = 0; i < 10; i++) {
|
|
u_char status;
|
|
u_char status;
|
|
-
|
|
|
|
- wait_WOC(iobase);
|
|
|
|
|
|
+
|
|
|
|
+ wait_WOC(iobase);
|
|
if (!(inb(iobase+NETWAVE_REG_CCSR) & 0x02))
|
|
if (!(inb(iobase+NETWAVE_REG_CCSR) & 0x02))
|
|
break; /* None of the interrupt sources asserted (normal exit) */
|
|
break; /* None of the interrupt sources asserted (normal exit) */
|
|
-
|
|
|
|
|
|
+
|
|
status = inb(iobase + NETWAVE_REG_ASR);
|
|
status = inb(iobase + NETWAVE_REG_ASR);
|
|
-
|
|
|
|
|
|
+
|
|
if (!pcmcia_dev_present(link)) {
|
|
if (!pcmcia_dev_present(link)) {
|
|
pr_debug("netwave_interrupt: Interrupt with status 0x%x "
|
|
pr_debug("netwave_interrupt: Interrupt with status 0x%x "
|
|
"from removed or suspended card!\n", status);
|
|
"from removed or suspended card!\n", status);
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
/* RxRdy */
|
|
/* RxRdy */
|
|
if (status & 0x80) {
|
|
if (status & 0x80) {
|
|
netwave_rx(dev);
|
|
netwave_rx(dev);
|
|
@@ -1082,24 +1082,24 @@ static irqreturn_t netwave_interrupt(int irq, void* dev_id)
|
|
/* RxErr */
|
|
/* RxErr */
|
|
if (status & 0x40) {
|
|
if (status & 0x40) {
|
|
u_char rser;
|
|
u_char rser;
|
|
-
|
|
|
|
- rser = readb(ramBase + NETWAVE_EREG_RSER);
|
|
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+ rser = readb(ramBase + NETWAVE_EREG_RSER);
|
|
|
|
+
|
|
if (rser & 0x04) {
|
|
if (rser & 0x04) {
|
|
++dev->stats.rx_dropped;
|
|
++dev->stats.rx_dropped;
|
|
++dev->stats.rx_crc_errors;
|
|
++dev->stats.rx_crc_errors;
|
|
}
|
|
}
|
|
if (rser & 0x02)
|
|
if (rser & 0x02)
|
|
++dev->stats.rx_frame_errors;
|
|
++dev->stats.rx_frame_errors;
|
|
-
|
|
|
|
|
|
+
|
|
/* Clear the RxErr bit in RSER. RSER+4 is the
|
|
/* Clear the RxErr bit in RSER. RSER+4 is the
|
|
- * write part. Also clear the RxCRC (0x04) and
|
|
|
|
|
|
+ * write part. Also clear the RxCRC (0x04) and
|
|
* RxBig (0x02) bits if present */
|
|
* RxBig (0x02) bits if present */
|
|
wait_WOC(iobase);
|
|
wait_WOC(iobase);
|
|
writeb(0x40 | (rser & 0x06), ramBase + NETWAVE_EREG_RSER + 4);
|
|
writeb(0x40 | (rser & 0x06), ramBase + NETWAVE_EREG_RSER + 4);
|
|
|
|
|
|
/* Write bit 6 high to ASCC to clear RxErr in ASR,
|
|
/* Write bit 6 high to ASCC to clear RxErr in ASR,
|
|
- * WOC must be set first!
|
|
|
|
|
|
+ * WOC must be set first!
|
|
*/
|
|
*/
|
|
wait_WOC(iobase);
|
|
wait_WOC(iobase);
|
|
writeb(0x40, ramBase + NETWAVE_EREG_ASCC);
|
|
writeb(0x40, ramBase + NETWAVE_EREG_ASCC);
|
|
@@ -1114,31 +1114,31 @@ static irqreturn_t netwave_interrupt(int irq, void* dev_id)
|
|
txStatus = readb(ramBase + NETWAVE_EREG_TSER);
|
|
txStatus = readb(ramBase + NETWAVE_EREG_TSER);
|
|
pr_debug("Transmit done. TSER = %x id %x\n",
|
|
pr_debug("Transmit done. TSER = %x id %x\n",
|
|
txStatus, readb(ramBase + NETWAVE_EREG_TSER + 1));
|
|
txStatus, readb(ramBase + NETWAVE_EREG_TSER + 1));
|
|
-
|
|
|
|
|
|
+
|
|
if (txStatus & 0x20) {
|
|
if (txStatus & 0x20) {
|
|
/* Transmitting was okay, clear bits */
|
|
/* Transmitting was okay, clear bits */
|
|
wait_WOC(iobase);
|
|
wait_WOC(iobase);
|
|
writeb(0x2f, ramBase + NETWAVE_EREG_TSER + 4);
|
|
writeb(0x2f, ramBase + NETWAVE_EREG_TSER + 4);
|
|
++dev->stats.tx_packets;
|
|
++dev->stats.tx_packets;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
if (txStatus & 0xd0) {
|
|
if (txStatus & 0xd0) {
|
|
if (txStatus & 0x80) {
|
|
if (txStatus & 0x80) {
|
|
++dev->stats.collisions; /* Because of /proc/net/dev*/
|
|
++dev->stats.collisions; /* Because of /proc/net/dev*/
|
|
/* ++dev->stats.tx_aborted_errors; */
|
|
/* ++dev->stats.tx_aborted_errors; */
|
|
/* printk("Collision. %ld\n", jiffies - dev->trans_start); */
|
|
/* printk("Collision. %ld\n", jiffies - dev->trans_start); */
|
|
}
|
|
}
|
|
- if (txStatus & 0x40)
|
|
|
|
|
|
+ if (txStatus & 0x40)
|
|
++dev->stats.tx_carrier_errors;
|
|
++dev->stats.tx_carrier_errors;
|
|
/* 0x80 TxGU Transmit giveup - nine times and no luck
|
|
/* 0x80 TxGU Transmit giveup - nine times and no luck
|
|
* 0x40 TxNOAP No access point. Discarded packet.
|
|
* 0x40 TxNOAP No access point. Discarded packet.
|
|
- * 0x10 TxErr Transmit error. Always set when
|
|
|
|
|
|
+ * 0x10 TxErr Transmit error. Always set when
|
|
* TxGU and TxNOAP is set. (Those are the only ones
|
|
* TxGU and TxNOAP is set. (Those are the only ones
|
|
* to set TxErr).
|
|
* to set TxErr).
|
|
*/
|
|
*/
|
|
pr_debug("netwave_interrupt: TxDN with error status %x\n",
|
|
pr_debug("netwave_interrupt: TxDN with error status %x\n",
|
|
txStatus);
|
|
txStatus);
|
|
-
|
|
|
|
|
|
+
|
|
/* Clear out TxGU, TxNOAP, TxErr and TxTrys */
|
|
/* Clear out TxGU, TxNOAP, TxErr and TxTrys */
|
|
wait_WOC(iobase);
|
|
wait_WOC(iobase);
|
|
writeb(0xdf & txStatus, ramBase+NETWAVE_EREG_TSER+4);
|
|
writeb(0xdf & txStatus, ramBase+NETWAVE_EREG_TSER+4);
|
|
@@ -1190,31 +1190,31 @@ static int netwave_rx(struct net_device *dev)
|
|
int dataCount, dataOffset;
|
|
int dataCount, dataOffset;
|
|
int i;
|
|
int i;
|
|
u_char *ptr;
|
|
u_char *ptr;
|
|
-
|
|
|
|
|
|
+
|
|
pr_debug("xinw_rx: Receiving ... \n");
|
|
pr_debug("xinw_rx: Receiving ... \n");
|
|
|
|
|
|
/* Receive max 10 packets for now. */
|
|
/* Receive max 10 packets for now. */
|
|
for (i = 0; i < 10; i++) {
|
|
for (i = 0; i < 10; i++) {
|
|
/* Any packets? */
|
|
/* Any packets? */
|
|
wait_WOC(iobase);
|
|
wait_WOC(iobase);
|
|
- rxStatus = readb(ramBase + NETWAVE_EREG_RSER);
|
|
|
|
|
|
+ rxStatus = readb(ramBase + NETWAVE_EREG_RSER);
|
|
if ( !( rxStatus & 0x80)) /* No more packets */
|
|
if ( !( rxStatus & 0x80)) /* No more packets */
|
|
break;
|
|
break;
|
|
-
|
|
|
|
|
|
+
|
|
/* Check if multicast/broadcast or other */
|
|
/* Check if multicast/broadcast or other */
|
|
/* multicast = (rxStatus & 0x20); */
|
|
/* multicast = (rxStatus & 0x20); */
|
|
-
|
|
|
|
|
|
+
|
|
/* The receive list pointer and length of the packet */
|
|
/* The receive list pointer and length of the packet */
|
|
wait_WOC(iobase);
|
|
wait_WOC(iobase);
|
|
rcvLen = get_int16( ramBase + NETWAVE_EREG_RDP);
|
|
rcvLen = get_int16( ramBase + NETWAVE_EREG_RDP);
|
|
rcvList = get_uint16( ramBase + NETWAVE_EREG_RDP + 2);
|
|
rcvList = get_uint16( ramBase + NETWAVE_EREG_RDP + 2);
|
|
-
|
|
|
|
|
|
+
|
|
if (rcvLen < 0) {
|
|
if (rcvLen < 0) {
|
|
- printk(KERN_DEBUG "netwave_rx: Receive packet with len %d\n",
|
|
|
|
|
|
+ printk(KERN_DEBUG "netwave_rx: Receive packet with len %d\n",
|
|
rcvLen);
|
|
rcvLen);
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
skb = dev_alloc_skb(rcvLen+5);
|
|
skb = dev_alloc_skb(rcvLen+5);
|
|
if (skb == NULL) {
|
|
if (skb == NULL) {
|
|
pr_debug("netwave_rx: Could not allocate an sk_buff of "
|
|
pr_debug("netwave_rx: Could not allocate an sk_buff of "
|
|
@@ -1233,21 +1233,21 @@ static int netwave_rx(struct net_device *dev)
|
|
/* Copy packet fragments to the skb data area */
|
|
/* Copy packet fragments to the skb data area */
|
|
ptr = (u_char*) skb->data;
|
|
ptr = (u_char*) skb->data;
|
|
curBuffer = rcvList;
|
|
curBuffer = rcvList;
|
|
- tmpcount = 0;
|
|
|
|
|
|
+ tmpcount = 0;
|
|
while ( tmpcount < rcvLen) {
|
|
while ( tmpcount < rcvLen) {
|
|
/* Get length and offset of current buffer */
|
|
/* Get length and offset of current buffer */
|
|
dataCount = get_uint16( ramBase+curBuffer+2);
|
|
dataCount = get_uint16( ramBase+curBuffer+2);
|
|
dataOffset = get_uint16( ramBase+curBuffer+4);
|
|
dataOffset = get_uint16( ramBase+curBuffer+4);
|
|
-
|
|
|
|
|
|
+
|
|
copy_from_pc( ptr + tmpcount,
|
|
copy_from_pc( ptr + tmpcount,
|
|
ramBase+curBuffer+dataOffset, dataCount);
|
|
ramBase+curBuffer+dataOffset, dataCount);
|
|
|
|
|
|
tmpcount += dataCount;
|
|
tmpcount += dataCount;
|
|
-
|
|
|
|
|
|
+
|
|
/* Point to next buffer */
|
|
/* Point to next buffer */
|
|
curBuffer = get_uint16(ramBase + curBuffer);
|
|
curBuffer = get_uint16(ramBase + curBuffer);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
skb->protocol = eth_type_trans(skb,dev);
|
|
skb->protocol = eth_type_trans(skb,dev);
|
|
/* Queue packet for network layer */
|
|
/* Queue packet for network layer */
|
|
netif_rx(skb);
|
|
netif_rx(skb);
|
|
@@ -1269,7 +1269,7 @@ static int netwave_open(struct net_device *dev) {
|
|
struct pcmcia_device *link = priv->p_dev;
|
|
struct pcmcia_device *link = priv->p_dev;
|
|
|
|
|
|
dev_dbg(&link->dev, "netwave_open: starting.\n");
|
|
dev_dbg(&link->dev, "netwave_open: starting.\n");
|
|
-
|
|
|
|
|
|
+
|
|
if (!pcmcia_dev_present(link))
|
|
if (!pcmcia_dev_present(link))
|
|
return -ENODEV;
|
|
return -ENODEV;
|
|
|
|
|
|
@@ -1277,7 +1277,7 @@ static int netwave_open(struct net_device *dev) {
|
|
|
|
|
|
netif_start_queue(dev);
|
|
netif_start_queue(dev);
|
|
netwave_reset(dev);
|
|
netwave_reset(dev);
|
|
-
|
|
|
|
|
|
+
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1336,7 +1336,7 @@ static void set_multicast_list(struct net_device *dev)
|
|
netwave_private *priv = netdev_priv(dev);
|
|
netwave_private *priv = netdev_priv(dev);
|
|
u_char __iomem * ramBase = priv->ramBase;
|
|
u_char __iomem * ramBase = priv->ramBase;
|
|
u_char rcvMode = 0;
|
|
u_char rcvMode = 0;
|
|
-
|
|
|
|
|
|
+
|
|
#ifdef PCMCIA_DEBUG
|
|
#ifdef PCMCIA_DEBUG
|
|
{
|
|
{
|
|
xstatic int old;
|
|
xstatic int old;
|
|
@@ -1347,7 +1347,7 @@ static void set_multicast_list(struct net_device *dev)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
#endif
|
|
#endif
|
|
-
|
|
|
|
|
|
+
|
|
if (!netdev_mc_empty(dev) || (dev->flags & IFF_ALLMULTI)) {
|
|
if (!netdev_mc_empty(dev) || (dev->flags & IFF_ALLMULTI)) {
|
|
/* Multicast Mode */
|
|
/* Multicast Mode */
|
|
rcvMode = rxConfRxEna + rxConfAMP + rxConfBcast;
|
|
rcvMode = rxConfRxEna + rxConfAMP + rxConfBcast;
|
|
@@ -1358,7 +1358,7 @@ static void set_multicast_list(struct net_device *dev)
|
|
/* Normal mode */
|
|
/* Normal mode */
|
|
rcvMode = rxConfRxEna + rxConfBcast;
|
|
rcvMode = rxConfRxEna + rxConfBcast;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
/* printk("netwave set_multicast_list: rcvMode to %x\n", rcvMode);*/
|
|
/* printk("netwave set_multicast_list: rcvMode to %x\n", rcvMode);*/
|
|
/* Now set receive mode */
|
|
/* Now set receive mode */
|
|
wait_WOC(iobase);
|
|
wait_WOC(iobase);
|