Commit 1697b806 authored by Linus Torvalds's avatar Linus Torvalds

Merge bk://kernel.bkbits.net/jgarzik/net-drivers-2.5

into home.transmeta.com:/home/torvalds/v2.5/linux
parents 2cd16b83 f755fa58
......@@ -721,7 +721,7 @@ static void __attach_bond_to_agg(struct port *port)
}
/**
* __detach_bond_to_agg
* __detach_bond_from_agg
* @port: the port we're looking at
*
* Handle the detaching of the port's control parser/multiplexer from the
......@@ -828,6 +828,55 @@ static struct aggregator *__get_active_agg(struct aggregator *aggregator)
return retval;
}
/**
* __update_lacpdu_from_port - update a port's lacpdu fields
* @port: the port we're looking at
*
*/
static inline void __update_lacpdu_from_port(struct port *port)
{
struct lacpdu *lacpdu = &port->lacpdu;
/* update current actual Actor parameters */
/* lacpdu->subtype initialized
* lacpdu->version_number initialized
* lacpdu->tlv_type_actor_info initialized
* lacpdu->actor_information_length initialized
*/
lacpdu->actor_system_priority = port->actor_system_priority;
lacpdu->actor_system = port->actor_system;
lacpdu->actor_key = port->actor_oper_port_key;
lacpdu->actor_port_priority = port->actor_port_priority;
lacpdu->actor_port = port->actor_port_number;
lacpdu->actor_state = port->actor_oper_port_state;
/* lacpdu->reserved_3_1 initialized
* lacpdu->tlv_type_partner_info initialized
* lacpdu->partner_information_length initialized
*/
lacpdu->partner_system_priority = port->partner_oper_system_priority;
lacpdu->partner_system = port->partner_oper_system;
lacpdu->partner_key = port->partner_oper_key;
lacpdu->partner_port_priority = port->partner_oper_port_priority;
lacpdu->partner_port = port->partner_oper_port_number;
lacpdu->partner_state = port->partner_oper_port_state;
/* lacpdu->reserved_3_2 initialized
* lacpdu->tlv_type_collector_info initialized
* lacpdu->collector_information_length initialized
* collector_max_delay initialized
* reserved_12[12] initialized
* tlv_type_terminator initialized
* terminator_length initialized
* reserved_50[50] initialized
*/
/* Convert all non u8 parameters to Big Endian for transmit */
__ntohs_lacpdu(lacpdu);
}
//////////////////////////////////////////////////////////////////////////////////////
// ================= main 802.3ad protocol code ======================================
//////////////////////////////////////////////////////////////////////////////////////
......@@ -1177,43 +1226,11 @@ static void ad_rx_machine(struct lacpdu *lacpdu, struct port *port)
*/
static void ad_tx_machine(struct port *port)
{
struct lacpdu *lacpdu = &port->lacpdu;
// check if tx timer expired, to verify that we do not send more than 3 packets per second
if (port->sm_tx_timer_counter && !(--port->sm_tx_timer_counter)) {
// check if there is something to send
if (port->ntt && (port->sm_vars & AD_PORT_LACP_ENABLED)) {
//update current actual Actor parameters
//lacpdu->subtype initialized
//lacpdu->version_number initialized
//lacpdu->tlv_type_actor_info initialized
//lacpdu->actor_information_length initialized
lacpdu->actor_system_priority = port->actor_system_priority;
lacpdu->actor_system = port->actor_system;
lacpdu->actor_key = port->actor_oper_port_key;
lacpdu->actor_port_priority = port->actor_port_priority;
lacpdu->actor_port = port->actor_port_number;
lacpdu->actor_state = port->actor_oper_port_state;
//lacpdu->reserved_3_1 initialized
//lacpdu->tlv_type_partner_info initialized
//lacpdu->partner_information_length initialized
lacpdu->partner_system_priority = port->partner_oper_system_priority;
lacpdu->partner_system = port->partner_oper_system;
lacpdu->partner_key = port->partner_oper_key;
lacpdu->partner_port_priority = port->partner_oper_port_priority;
lacpdu->partner_port = port->partner_oper_port_number;
lacpdu->partner_state = port->partner_oper_port_state;
//lacpdu->reserved_3_2 initialized
//lacpdu->tlv_type_collector_info initialized
//lacpdu->collector_information_length initialized
//collector_max_delay initialized
//reserved_12[12] initialized
//tlv_type_terminator initialized
//terminator_length initialized
//reserved_50[50] initialized
// We need to convert all non u8 parameters to Big Endian for transmit
__ntohs_lacpdu(lacpdu);
__update_lacpdu_from_port(port);
// send the lacpdu
if (ad_lacpdu_send(port) >= 0) {
BOND_PRINT_DBG(("Sent LACPDU on port %d", port->actor_port_number));
......@@ -1971,13 +1988,13 @@ void bond_3ad_unbind_slave(struct slave *slave)
return;
}
// disable the port
ad_disable_collecting_distributing(port);
BOND_PRINT_DBG(("Unbinding Link Aggregation Group %d", aggregator->aggregator_identifier));
// deinitialize port's locks if necessary(os-specific)
__deinitialize_port_locks(port);
/* Tell the partner that this port is not suitable for aggregation */
port->actor_oper_port_state &= ~AD_STATE_AGGREGATION;
__update_lacpdu_from_port(port);
ad_lacpdu_send(port);
BOND_PRINT_DBG(("Unbinding Link Aggregation Group %d", aggregator->aggregator_identifier));
// check if this aggregator is occupied
if (aggregator->lag_ports) {
// check if there are other ports related to this aggregator except
......
......@@ -2220,7 +2220,7 @@ static void bond_mii_monitor(struct net_device *master)
}
printk(KERN_INFO
"%s: link status definitely down "
"for interface %s, disabling it\n",
"for interface %s, disabling it",
master->name,
dev->name);
......@@ -2994,6 +2994,7 @@ static int bond_ioctl(struct net_device *master_dev, struct ifreq *ifr, int cmd)
struct ifbond *u_binfo = NULL, k_binfo;
struct ifslave *u_sinfo = NULL, k_sinfo;
struct mii_ioctl_data *mii = NULL;
int prev_abi_ver = orig_app_abi_ver;
int ret = 0;
#ifdef BONDING_DEBUG
......@@ -3112,6 +3113,15 @@ static int bond_ioctl(struct net_device *master_dev, struct ifreq *ifr, int cmd)
}
dev_put(slave_dev);
}
if (ret < 0) {
/* The ioctl failed, so there's no point in changing the
* orig_app_abi_ver. We'll restore it's value just in case
* we've changed it earlier in this function.
*/
orig_app_abi_ver = prev_abi_ver;
}
return ret;
}
......
......@@ -1715,7 +1715,7 @@ static int autodetect;
static int n_eepro;
/* For linux 2.1.xx */
MODULE_AUTHOR("Pascal Dupuis <dupuis@lei.ucl.ac.be> for the 2.1 stuff (locking,...)");
MODULE_AUTHOR("Pascal Dupuis, and aris@cathedrallabs.org");
MODULE_DESCRIPTION("Intel i82595 ISA EtherExpressPro10/10+ driver");
MODULE_LICENSE("GPL");
......
......@@ -84,11 +84,14 @@
- Fix bug of custom mac address
(StationAddr register only accept word write)
Version LK1.09 (D-Link):
- Fix the flowctrl bug.
- Set Pause bit in MII ANAR if flow control enabled.
*/
#define DRV_NAME "sundance"
#define DRV_VERSION "1.01+LK1.08a"
#define DRV_RELDATE "23-Apr-2003"
#define DRV_VERSION "1.01+LK1.09a"
#define DRV_RELDATE "16-May-2003"
/* The user-configurable values.
......@@ -671,8 +674,8 @@ static int __devinit sundance_probe1 (struct pci_dev *pdev,
np->an_enable = 1;
}
}
if (flowctrl == 0)
np->flowctrl = 0;
if (flowctrl == 1)
np->flowctrl = 1;
}
/* Fibre PHY? */
......@@ -687,6 +690,9 @@ static int __devinit sundance_probe1 (struct pci_dev *pdev,
/* Reset PHY */
mdio_write (dev, np->phys[0], MII_BMCR, BMCR_RESET);
mdelay (300);
/* If flow control enabled, we need to advertise it.*/
if (np->flowctrl)
mdio_write (dev, np->phys[0], MII_ADVERTISE, np->mii_if.advertising | 0x0400);
mdio_write (dev, np->phys[0], MII_BMCR, BMCR_ANENABLE|BMCR_ANRESTART);
/* Force media type */
if (!np->an_enable) {
......@@ -935,7 +941,7 @@ static void check_duplex(struct net_device *dev)
printk(KERN_INFO "%s: Setting %s-duplex based on MII #%d "
"negotiated capability %4.4x.\n", dev->name,
duplex ? "full" : "half", np->phys[0], negotiated);
writew(duplex ? 0x20 : 0, ioaddr + MACCtrl0);
writew(readw(ioaddr + MACCtrl0) | duplex ? 0x20 : 0, ioaddr + MACCtrl0);
}
}
......@@ -1455,9 +1461,12 @@ static void netdev_error(struct net_device *dev, int intr_status)
"full" : "half");
}
check_duplex (dev);
if (np->flowctrl == 0)
writew(readw(ioaddr + MACCtrl0) & ~EnbFlowCtrl,
if (np->flowctrl && np->mii_if.full_duplex) {
writew(readw(ioaddr + MulticastFilter1+2) | 0x0200,
ioaddr + MulticastFilter1+2);
writew(readw(ioaddr + MACCtrl0) | EnbFlowCtrl,
ioaddr + MACCtrl0);
}
}
if (intr_status & StatsMax) {
get_stats(dev);
......@@ -1500,6 +1509,7 @@ static struct net_device_stats *get_stats(struct net_device *dev)
static void set_rx_mode(struct net_device *dev)
{
long ioaddr = dev->base_addr;
struct netdev_private *np = dev->priv;
u16 mc_filter[4]; /* Multicast hash filter */
u32 rx_mode;
int i;
......@@ -1532,6 +1542,9 @@ static void set_rx_mode(struct net_device *dev)
writeb(AcceptBroadcast | AcceptMyPhys, ioaddr + RxMode);
return;
}
if (np->mii_if.full_duplex && np->flowctrl)
mc_filter[3] |= 0x0200;
for (i = 0; i < 4; i++)
writew(mc_filter[i], ioaddr + MulticastFilter0 + i*2);
writeb(rx_mode, ioaddr + RxMode);
......
......@@ -2,9 +2,7 @@
#include <linux/types.h>
#include <linux/netdevice.h>
#include <linux/interrupt.h>
#include <linux/version.h>
#include "lmc_ver.h"
#include "lmc_debug.h"
/*
......
......@@ -11,7 +11,7 @@
* With Help By:
* David Boggs
* Ron Crane
* Allan Cox
* Alan Cox
*
* This software may be used and distributed according to the terms
* of the GNU General Public License version 2, incorporated herein by reference.
......@@ -38,7 +38,6 @@
/* $Id: lmc_main.c,v 1.36 2000/04/11 05:25:25 asj Exp $ */
#include <linux/version.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/string.h>
......@@ -51,9 +50,6 @@
#include <linux/pci.h>
#include <linux/delay.h>
#include <linux/init.h>
#if LINUX_VERSION_CODE < 0x20155
#include <linux/bios32.h>
#endif
#include <linux/in.h>
#include <linux/if_arp.h>
#include <linux/netdevice.h>
......@@ -67,12 +63,8 @@
#include <asm/bitops.h>
#include <asm/io.h>
#include <asm/dma.h>
#if LINUX_VERSION_CODE >= 0x20200
#include <asm/uaccess.h>
//#include <asm/spinlock.h>
#else /* 2.0 kernel */
#define ARPHRD_HDLC 513
#endif
#define DRIVER_MAJOR_VERSION 1
#define DRIVER_MINOR_VERSION 34
......@@ -80,7 +72,6 @@
#define DRIVER_VERSION ((DRIVER_MAJOR_VERSION << 8) + DRIVER_MINOR_VERSION)
#include "lmc_ver.h"
#include "lmc.h"
#include "lmc_var.h"
#include "lmc_ioctl.h"
......@@ -127,10 +118,8 @@ static void lmc_watchdog(unsigned long data);
static int lmc_init(struct net_device * const);
static void lmc_reset(lmc_softc_t * const sc);
static void lmc_dec_reset(lmc_softc_t * const sc);
#if LINUX_VERSION_CODE >= 0x20363
static void lmc_driver_timeout(struct net_device *dev);
int lmc_setup(void);
#endif
/*
......@@ -165,7 +154,8 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) /*fold00*/
* To date internally, just copy this out to the user.
*/
case LMCIOCGINFO: /*fold01*/
LMC_COPY_TO_USER(ifr->ifr_data, &sc->ictl, sizeof (lmc_ctl_t));
if (copy_to_user(ifr->ifr_data, &sc->ictl, sizeof (lmc_ctl_t)))
return -EFAULT;
ret = 0;
break;
......@@ -181,7 +171,8 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) /*fold00*/
break;
}
LMC_COPY_FROM_USER(&ctl, ifr->ifr_data, sizeof (lmc_ctl_t));
if (copy_from_user(&ctl, ifr->ifr_data, sizeof (lmc_ctl_t)))
return -EFAULT;
sc->lmc_media->set_status (sc, &ctl);
......@@ -211,7 +202,8 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) /*fold00*/
break;
}
LMC_COPY_FROM_USER(&new_type, ifr->ifr_data, sizeof(u_int16_t));
if (copy_from_user(&new_type, ifr->ifr_data, sizeof(u_int16_t)))
return -EFAULT;
if (new_type == old_type)
......@@ -248,8 +240,9 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) /*fold00*/
sc->lmc_xinfo.Magic1 = 0xDEADBEEF;
LMC_COPY_TO_USER(ifr->ifr_data, &sc->lmc_xinfo,
sizeof (struct lmc_xinfo));
if (copy_to_user(ifr->ifr_data, &sc->lmc_xinfo,
sizeof (struct lmc_xinfo)))
return -EFAULT;
ret = 0;
break;
......@@ -279,8 +272,9 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) /*fold00*/
regVal & T1FRAMER_SEF_MASK;
}
LMC_COPY_TO_USER(ifr->ifr_data, &sc->stats,
sizeof (struct lmc_statistics));
if (copy_to_user(ifr->ifr_data, &sc->stats,
sizeof (struct lmc_statistics)))
return -EFAULT;
ret = 0;
break;
......@@ -310,7 +304,8 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) /*fold00*/
break;
}
LMC_COPY_FROM_USER(&ctl, ifr->ifr_data, sizeof (lmc_ctl_t));
if (copy_from_user(&ctl, ifr->ifr_data, sizeof (lmc_ctl_t)))
return -EFAULT;
sc->lmc_media->set_circuit_type(sc, ctl.circuit_type);
sc->ictl.circuit_type = ctl.circuit_type;
ret = 0;
......@@ -335,8 +330,10 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) /*fold00*/
#ifdef DEBUG
case LMCIOCDUMPEVENTLOG:
LMC_COPY_TO_USER(ifr->ifr_data, &lmcEventLogIndex, sizeof (u32));
LMC_COPY_TO_USER(ifr->ifr_data + sizeof (u32), lmcEventLogBuf, sizeof (lmcEventLogBuf));
if (copy_to_user(ifr->ifr_data, &lmcEventLogIndex, sizeof (u32)))
return -EFAULT;
if (copy_to_user(ifr->ifr_data + sizeof (u32), lmcEventLogBuf, sizeof (lmcEventLogBuf)))
return -EFAULT;
ret = 0;
break;
......@@ -359,9 +356,10 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) /*fold00*/
/*
* Stop the xwitter whlie we restart the hardware
*/
LMC_XMITTER_BUSY(dev);
netif_stop_queue(dev);
LMC_COPY_FROM_USER(&xc, ifr->ifr_data, sizeof (struct lmc_xilinx_control));
if (copy_from_user(&xc, ifr->ifr_data, sizeof (struct lmc_xilinx_control)))
return -EFAULT;
switch(xc.command){
case lmc_xilinx_reset: /*fold02*/
{
......@@ -620,7 +618,7 @@ int lmc_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) /*fold00*/
break;
}
LMC_XMITTER_FREE(dev);
netif_wake_queue(dev);
sc->lmc_txfull = 0;
}
......@@ -646,7 +644,7 @@ static void lmc_watchdog (unsigned long data) /*fold00*/
lmc_softc_t *sc;
int link_status;
u_int32_t ticks;
LMC_SPIN_FLAGS;
unsigned long flags;
sc = dev->priv;
......@@ -836,11 +834,7 @@ static struct net_device *lmc_probe1 (struct net_device *dev, unsigned long ioad
* Allocate our own device structure
*/
#if LINUX_VERSION_CODE < 0x20363
dev = kmalloc (sizeof (struct ppp_device)+8, GFP_KERNEL);
#else
dev = kmalloc (sizeof (struct net_device)+8, GFP_KERNEL);
#endif
if (dev == NULL){
printk (KERN_ERR "lmc: kmalloc for device failed\n");
return NULL;
......@@ -909,10 +903,8 @@ static struct net_device *lmc_probe1 (struct net_device *dev, unsigned long ioad
dev->get_stats = lmc_get_stats;
dev->do_ioctl = lmc_ioctl;
dev->set_config = lmc_set_config;
#if LINUX_VERSION_CODE >= 0x20363
dev->tx_timeout = lmc_driver_timeout;
dev->watchdog_timeo = (HZ); /* 1 second */
#endif
/*
* Why were we changing this???
......@@ -923,8 +915,6 @@ static struct net_device *lmc_probe1 (struct net_device *dev, unsigned long ioad
spin_lock_init(&sc->lmc_lock);
LMC_SETUP_20_DEV;
printk ("%s: detected at %lx, irq %d\n", dev->name, ioaddr, dev->irq);
if (register_netdev (dev) != 0) {
......@@ -1048,7 +1038,7 @@ int lmc_probe (struct net_device *dev) /*fold00*/
* PCI bus, we are in trouble.
*/
if (!LMC_PCI_PRESENT()) {
if (!pci_present()) {
/* printk ("%s: We really want a pci bios!\n", dev->name);*/
return -1;
}
......@@ -1124,11 +1114,7 @@ int lmc_probe (struct net_device *dev) /*fold00*/
if (cards_found < 1)
return -1;
#if LINUX_VERSION_CODE >= 0x20200
return foundaddr;
#else
return 0;
#endif
}
/* After this is called, packets can be sent.
......@@ -1199,11 +1185,7 @@ static int lmc_open (struct net_device *dev) /*fold00*/
dev->do_ioctl = lmc_ioctl;
LMC_XMITTER_INIT(dev);
#if LINUX_VERSION_CODE < 0x20363
dev->start = 1;
#endif
netif_start_queue(dev);
sc->stats.tx_tbusy0++ ;
......@@ -1277,7 +1259,7 @@ static void lmc_running_reset (struct net_device *dev) /*fold00*/
//dev->flags |= IFF_RUNNING;
LMC_XMITTER_FREE(dev);
netif_wake_queue(dev);
sc->lmc_txfull = 0;
sc->stats.tx_tbusy0++ ;
......@@ -1327,7 +1309,7 @@ static int lmc_ifdown (struct net_device *dev) /*fold00*/
/* Don't let anything else go on right now */
// dev->start = 0;
LMC_XMITTER_BUSY(dev);
netif_stop_queue(dev);
sc->stats.tx_tbusy1++ ;
/* stop interrupts */
......@@ -1360,23 +1342,20 @@ static int lmc_ifdown (struct net_device *dev) /*fold00*/
sc->lmc_rxring[i].length = 0;
sc->lmc_rxring[i].buffer1 = 0xDEADBEEF;
if (skb != NULL)
{
LMC_SKB_FREE(skb, 1);
LMC_DEV_KFREE_SKB (skb);
}
dev_kfree_skb(skb);
sc->lmc_rxq[i] = NULL;
}
for (i = 0; i < LMC_TXDESCS; i++)
{
if (sc->lmc_txq[i] != NULL)
LMC_DEV_KFREE_SKB (sc->lmc_txq[i]);
dev_kfree_skb(sc->lmc_txq[i]);
sc->lmc_txq[i] = NULL;
}
lmc_led_off (sc, LMC_MII16_LED_ALL);
LMC_XMITTER_FREE(dev);
netif_wake_queue(dev);
sc->stats.tx_tbusy0++ ;
lmc_trace(dev, "lmc_ifdown out");
......@@ -1496,14 +1475,12 @@ static irqreturn_t lmc_interrupt (int irq, void *dev_instance, struct pt_regs *r
}
else {
#if LINUX_VERSION_CODE >= 0x20200
sc->stats.tx_bytes += sc->lmc_txring[i].length & 0x7ff;
#endif
sc->stats.tx_packets++;
}
// LMC_DEV_KFREE_SKB (sc->lmc_txq[i]);
// dev_kfree_skb(sc->lmc_txq[i]);
dev_kfree_skb_irq(sc->lmc_txq[i]);
sc->lmc_txq[i] = 0;
......@@ -1518,20 +1495,14 @@ static irqreturn_t lmc_interrupt (int irq, void *dev_instance, struct pt_regs *r
}
LMC_EVENT_LOG(LMC_EVENT_TBUSY0, n_compl, 0);
sc->lmc_txfull = 0;
LMC_XMITTER_FREE(dev);
netif_wake_queue(dev);
sc->stats.tx_tbusy0++ ;
#if LINUX_VERSION_CODE < 0x20363
mark_bh (NET_BH); /* Tell Linux to give me more packets */
#endif
#ifdef DEBUG
sc->stats.dirtyTx = badtx;
sc->stats.lmc_next_tx = sc->lmc_next_tx;
sc->stats.lmc_txfull = sc->lmc_txfull;
#if LINUX_VERSION_CODE < 0x20363
sc->stats.tbusy = dev->tbusy;
#endif
#endif
sc->lmc_taint_tx = badtx;
......@@ -1592,7 +1563,7 @@ static int lmc_start_xmit (struct sk_buff *skb, struct net_device *dev) /*fold00
u32 flag;
int entry;
int ret = 0;
LMC_SPIN_FLAGS;
unsigned long flags;
lmc_trace(dev, "lmc_start_xmit in");
......@@ -1600,60 +1571,6 @@ static int lmc_start_xmit (struct sk_buff *skb, struct net_device *dev) /*fold00
spin_lock_irqsave(&sc->lmc_lock, flags);
/*
* If the transmitter is busy
* this must be the 5 second polling
* from the kernel which called us.
* Poke the chip and try to get it running
*
*/
#if LINUX_VERSION_CODE < 0x20363
if(dev->tbusy != 0){
u32 csr6;
printk("%s: Xmitter busy|\n", dev->name);
sc->stats.tx_tbusy_calls++ ;
if (jiffies - dev->trans_start < TX_TIMEOUT) {
ret = 1;
goto lmc_start_xmit_bug_out;
}
/*
* Chip seems to have locked up
* Reset it
* This whips out all our decriptor
* table and starts from scartch
*/
LMC_EVENT_LOG(LMC_EVENT_XMTPRCTMO,
LMC_CSR_READ (sc, csr_status),
sc->stats.tx_ProcTimeout);
lmc_running_reset (dev);
LMC_EVENT_LOG(LMC_EVENT_RESET1, LMC_CSR_READ (sc, csr_status), 0);
LMC_EVENT_LOG(LMC_EVENT_RESET2,
lmc_mii_readreg (sc, 0, 16),
lmc_mii_readreg (sc, 0, 17));
/* restart the tx processes */
csr6 = LMC_CSR_READ (sc, csr_command);
LMC_CSR_WRITE (sc, csr_command, csr6 | 0x0002);
LMC_CSR_WRITE (sc, csr_command, csr6 | 0x2002);
/* immediate transmit */
LMC_CSR_WRITE (sc, csr_txpoll, 0);
sc->stats.tx_errors++;
sc->stats.tx_ProcTimeout++; /* -baz */
dev->trans_start = jiffies;
ret = 1;
goto lmc_start_xmit_bug_out;
}
#endif
/* normal path, tbusy known to be zero */
entry = sc->lmc_next_tx % LMC_TXDESCS;
......@@ -1669,26 +1586,26 @@ static int lmc_start_xmit (struct sk_buff *skb, struct net_device *dev) /*fold00
{
/* Do not interrupt on completion of this packet */
flag = 0x60000000;
LMC_XMITTER_FREE(dev);
netif_wake_queue(dev);
}
else if (sc->lmc_next_tx - sc->lmc_taint_tx == LMC_TXDESCS / 2)
{
/* This generates an interrupt on completion of this packet */
flag = 0xe0000000;
LMC_XMITTER_FREE(dev);
netif_wake_queue(dev);
}
else if (sc->lmc_next_tx - sc->lmc_taint_tx < LMC_TXDESCS - 1)
{
/* Do not interrupt on completion of this packet */
flag = 0x60000000;
LMC_XMITTER_FREE(dev);
netif_wake_queue(dev);
}
else
{
/* This generates an interrupt on completion of this packet */
flag = 0xe0000000;
sc->lmc_txfull = 1;
LMC_XMITTER_BUSY(dev);
netif_stop_queue(dev);
}
#else
flag = LMC_TDES_INTERRUPT_ON_COMPLETION;
......@@ -1696,7 +1613,7 @@ static int lmc_start_xmit (struct sk_buff *skb, struct net_device *dev) /*fold00
if (sc->lmc_next_tx - sc->lmc_taint_tx >= LMC_TXDESCS - 1)
{ /* ring full, go busy */
sc->lmc_txfull = 1;
LMC_XMITTER_BUSY(dev);
netif_stop_queue(dev);
sc->stats.tx_tbusy1++ ;
LMC_EVENT_LOG(LMC_EVENT_TBUSY1, entry, 0);
}
......@@ -1726,10 +1643,6 @@ static int lmc_start_xmit (struct sk_buff *skb, struct net_device *dev) /*fold00
dev->trans_start = jiffies;
#if LINUX_VERSION_CODE < 0x20363
lmc_start_xmit_bug_out:
#endif
spin_unlock_irqrestore(&sc->lmc_lock, flags);
lmc_trace(dev, "lmc_start_xmit_out");
......@@ -1815,7 +1728,6 @@ static int lmc_rx (struct net_device *dev) /*fold00*/
if(skb == 0x0){
nsb = dev_alloc_skb (LMC_PKT_BUF_SZ + 2);
if (nsb) {
LMC_SKB_FREE(nsb, 1);
sc->lmc_rxq[i] = nsb;
nsb->dev = dev;
sc->lmc_rxring[i].buffer1 = virt_to_bus (nsb->tail);
......@@ -1859,7 +1771,6 @@ static int lmc_rx (struct net_device *dev) /*fold00*/
*/
nsb = dev_alloc_skb (LMC_PKT_BUF_SZ + 2);
if (nsb) {
LMC_SKB_FREE(nsb, 1);
sc->lmc_rxq[i] = nsb;
nsb->dev = dev;
sc->lmc_rxring[i].buffer1 = virt_to_bus (nsb->tail);
......@@ -1948,7 +1859,7 @@ static int lmc_rx (struct net_device *dev) /*fold00*/
static struct net_device_stats *lmc_get_stats (struct net_device *dev) /*fold00*/
{
lmc_softc_t *sc;
LMC_SPIN_FLAGS;
unsigned long flags;
lmc_trace(dev, "lmc_get_stats in");
......@@ -2148,7 +2059,6 @@ static void lmc_softreset (lmc_softc_t * const sc) /*fold00*/
}
skb->dev = sc->lmc_device;
LMC_SKB_FREE(skb, 1);
/* owned by 21140 */
sc->lmc_rxring[i].status = 0x80000000;
......@@ -2367,11 +2277,10 @@ static void lmc_initcsrs(lmc_softc_t * const sc, lmc_csrptr_t csr_base, /*fold00
lmc_trace(sc->lmc_device, "lmc_initcsrs out");
}
#if LINUX_VERSION_CODE >= 0x20363
static void lmc_driver_timeout(struct net_device *dev) { /*fold00*/
lmc_softc_t *sc;
u32 csr6;
LMC_SPIN_FLAGS;
unsigned long flags;
lmc_trace(dev, "lmc_driver_timeout in");
......@@ -2430,4 +2339,3 @@ int lmc_setup(void) { /*FOLD00*/
return lmc_probe(NULL);
}
#endif
/* $Id: lmc_media.c,v 1.13 2000/04/11 05:25:26 asj Exp $ */
#include <linux/version.h>
#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/string.h>
......@@ -11,9 +10,6 @@
#include <linux/slab.h>
#include <linux/interrupt.h>
#include <linux/pci.h>
#if LINUX_VERSION_CODE < 0x20155
#include <linux/bios32.h>
#endif
#include <linux/in.h>
#include <linux/if_arp.h>
#include <linux/netdevice.h>
......@@ -28,11 +24,8 @@
#include <asm/io.h>
#include <asm/dma.h>
#if LINUX_VERSION_CODE >= 0x20200
#include <asm/uaccess.h>
#endif
#include "lmc_ver.h"
#include "lmc.h"
#include "lmc_var.h"
#include "lmc_ioctl.h"
......
......@@ -19,7 +19,6 @@
* Driver for the LanMedia LMC5200, LMC5245, LMC1000, LMC1200 cards.
*/
#include <linux/version.h>
#include <linux/kernel.h>
#include <linux/string.h>
#include <linux/timer.h>
......@@ -46,7 +45,6 @@
#include <asm/dma.h>
#include <asm/smp.h>
#include "lmc_ver.h"
#include "lmc.h"
#include "lmc_var.h"
#include "lmc_debug.h"
......@@ -66,14 +64,6 @@
#define SPPP_attach(d) (void)0
#define SPPP_do_ioctl(d,i,c) -EOPNOTSUPP
#else
#if LINUX_VERSION_CODE < 0x20363
#define SPPP_attach(x) sppp_attach((struct ppp_device *)(x)->lmc_device)
#define SPPP_detach(x) sppp_detach((x)->lmc_device)
#define SPPP_open(x) sppp_open((x)->lmc_device)
#define SPPP_reopen(x) sppp_reopen((x)->lmc_device)
#define SPPP_close(x) sppp_close((x)->lmc_device)
#define SPPP_do_ioctl(x, y, z) sppp_do_ioctl((x)->lmc_device, (y), (z))
#else
#define SPPP_attach(x) sppp_attach((x)->pd)
#define SPPP_detach(x) sppp_detach((x)->pd->dev)
#define SPPP_open(x) sppp_open((x)->pd->dev)
......@@ -81,7 +71,6 @@
#define SPPP_close(x) sppp_close((x)->pd->dev)
#define SPPP_do_ioctl(x, y, z) sppp_do_ioctl((x)->pd->dev, (y), (z))
#endif
#endif
// init
void lmc_proto_init(lmc_softc_t *sc) /*FOLD00*/
......@@ -89,15 +78,12 @@ void lmc_proto_init(lmc_softc_t *sc) /*FOLD00*/
lmc_trace(sc->lmc_device, "lmc_proto_init in");
switch(sc->if_type){
case LMC_PPP:
#if LINUX_VERSION_CODE >= 0x20363
sc->pd = kmalloc(sizeof(struct ppp_device), GFP_KERNEL);
if (!sc->pd) {
printk("lmc_proto_init(): kmalloc failure!\n");
return;
}
sc->pd->dev = sc->lmc_device;
#endif
sc->if_ptr = sc->pd;
break;
case LMC_RAW:
......
......@@ -48,9 +48,6 @@ typedef struct lmc___ctl lmc_ctl_t;
#define u_int16_t u16
#define u_int8_t u8
#define tulip_uint32_t u32
#if LINUX_VERSION_CODE < 0x20155
#define u_int32_t u32
#endif
#define LMC_REG_RANGE 0x80
......@@ -410,9 +407,7 @@ struct lmc___softc {
u32 last_int;
u32 num_int;
#if LINUX_VERSION_CODE >= 0x20200
spinlock_t lmc_lock;
#endif
u_int16_t if_type; /* PPP or NET */
struct ppp_device *pd;
......@@ -550,10 +545,6 @@ struct lmc___softc {
#define LMC_CRC_LEN_16 2 /* 16-bit CRC */
#define LMC_CRC_LEN_32 4
#if LINUX_VERSION_CODE < 0x20100
#define test_and_set_bit(val, addr) set_bit(val, addr)
#endif
#ifdef LMC_HDLC
/* definition of an hdlc header. */
struct hdlc_hdr
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment