-diff -Naur linux-2.6.24.orig/drivers/net/via-velocity.c linux-2.6.24/drivers/net/via-velocity.c
---- linux-2.6.24.orig/drivers/net/via-velocity.c 2008-01-31 23:11:26.000000000 -0600
-+++ linux-2.6.24/drivers/net/via-velocity.c 2008-02-01 01:12:15.000000000 -0600
-@@ -254,11 +254,31 @@
+Index: linux-2.6.24.7/drivers/net/via-velocity.c
+===================================================================
+--- linux-2.6.24.7.orig/drivers/net/via-velocity.c
++++ linux-2.6.24.7/drivers/net/via-velocity.c
+@@ -254,11 +254,31 @@ MODULE_AUTHOR("VIA Networking Technologi
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("VIA Networking Velocity Family Gigabit Ethernet Adapter Driver");
#define RX_DESC_MIN 64
#define RX_DESC_MAX 255
#define RX_DESC_DEF 64
-@@ -557,12 +577,12 @@
+@@ -557,12 +577,12 @@ static void __devinit velocity_set_bool_
if (val == -1)
*opt |= (def ? flag : 0);
else if (val < 0 || val > 1) {
*opt |= (val ? flag : 0);
}
}
-@@ -580,6 +600,7 @@
+@@ -580,6 +600,7 @@ static void __devinit velocity_set_bool_
static void __devinit velocity_get_options(struct velocity_opt *opts, int index, char *devname)
{
velocity_set_int_opt(&opts->rx_thresh, rx_thresh[index], RX_THRESH_MIN, RX_THRESH_MAX, RX_THRESH_DEF, "rx_thresh", devname);
velocity_set_int_opt(&opts->DMA_length, DMA_length[index], DMA_LENGTH_MIN, DMA_LENGTH_MAX, DMA_LENGTH_DEF, "DMA_length", devname);
velocity_set_int_opt(&opts->numrx, RxDescriptors[index], RX_DESC_MIN, RX_DESC_MAX, RX_DESC_DEF, "RxDescriptors", devname);
-@@ -593,6 +614,7 @@
+@@ -593,6 +614,7 @@ static void __devinit velocity_get_optio
velocity_set_int_opt((int *) &opts->wol_opts, wol_opts[index], WOL_OPT_MIN, WOL_OPT_MAX, WOL_OPT_DEF, "Wake On Lan options", devname);
velocity_set_int_opt((int *) &opts->int_works, int_works[index], INT_WORKS_MIN, INT_WORKS_MAX, INT_WORKS_DEF, "Interrupt service works", devname);
opts->numrx = (opts->numrx & ~3);
}
/**
-@@ -608,6 +630,8 @@
+@@ -608,6 +630,8 @@ static void velocity_init_cam_filter(str
struct mac_regs __iomem * regs = vptr->mac_regs;
unsigned short vid;
/* Turn on MCFG_PQEN, turn off MCFG_RTGOPT */
WORD_REG_BITS_SET(MCFG_PQEN, MCFG_RTGOPT, ®s->MCFG);
WORD_REG_BITS_ON(MCFG_VIDFR, ®s->MCFG);
-@@ -636,8 +660,10 @@
+@@ -636,8 +660,10 @@ static void velocity_init_cam_filter(str
} else {
u16 temp = 0;
mac_set_vlan_cam(regs, 0, (u8 *) &temp);
}
}
-@@ -675,13 +701,15 @@
+@@ -675,13 +701,15 @@ static void velocity_rx_reset(struct vel
struct mac_regs __iomem * regs = vptr->mac_regs;
int i;
writew(vptr->options.numrx, ®s->RBRDU);
writel(vptr->rd_pool_dma, ®s->RDBaseLo);
-@@ -704,12 +732,15 @@
+@@ -704,12 +732,15 @@ static void velocity_init_registers(stru
struct mac_regs __iomem * regs = vptr->mac_regs;
int i, mii_status;
netif_stop_queue(vptr->dev);
/*
-@@ -737,12 +768,13 @@
+@@ -737,12 +768,13 @@ static void velocity_init_registers(stru
case VELOCITY_INIT_COLD:
default:
mac_eeprom_reload(regs);
for (i = 0; i < 6; i++) {
writeb(vptr->dev->dev_addr[i], &(regs->PAR[i]));
-@@ -760,11 +792,16 @@
+@@ -760,11 +792,16 @@ static void velocity_init_registers(stru
*/
BYTE_REG_BITS_SET(CFGB_OFSET, (CFGB_CRANDOM | CFGB_CAP | CFGB_MBA | CFGB_BAKOPT), ®s->CFGB);
/*
* Set packet filter: Receive directed and broadcast address
*/
-@@ -774,10 +811,12 @@
+@@ -774,10 +811,12 @@ static void velocity_init_registers(stru
* Enable MII auto-polling
*/
enable_mii_autopoll(regs);
writew(vptr->options.numrx - 1, ®s->RDCSize);
mac_rx_queue_run(regs);
mac_rx_queue_wake(regs);
-@@ -785,10 +824,13 @@
+@@ -785,10 +824,13 @@ static void velocity_init_registers(stru
writew(vptr->options.numtx - 1, ®s->TDCSize);
for (i = 0; i < vptr->num_txq; i++) {
init_flow_control_register(vptr);
writel(CR0_STOP, ®s->CR0Clr);
-@@ -807,8 +849,10 @@
+@@ -807,8 +849,10 @@ static void velocity_init_registers(stru
enable_flow_control_ability(vptr);
mac_hw_mibs_init(regs);
}
}
-@@ -826,6 +870,7 @@
+@@ -826,6 +870,7 @@ static int velocity_soft_reset(struct ve
struct mac_regs __iomem * regs = vptr->mac_regs;
int i = 0;
writel(CR0_SFRST, ®s->CR0Set);
for (i = 0; i < W_MAX_TIMEOUT; i++) {
-@@ -888,6 +933,7 @@
+@@ -888,6 +933,7 @@ static int __devinit velocity_found1(str
VELOCITY_FULL_DRV_NAM, VELOCITY_VERSION);
printk(KERN_INFO "Copyright (c) 2002, 2003 VIA Networking Technologies, Inc.\n");
printk(KERN_INFO "Copyright (c) 2004 Red Hat Inc.\n");
first = 0;
}
-@@ -1104,6 +1150,7 @@
+@@ -1104,6 +1150,7 @@ static int velocity_init_rings(struct ve
dma_addr_t pool_dma;
u8 *pool;
/*
* Allocate all RD/TD rings a single pool
*/
-@@ -1166,6 +1213,7 @@
+@@ -1166,6 +1213,7 @@ static int velocity_init_rings(struct ve
static void velocity_free_rings(struct velocity_info *vptr)
{
int size;
size = vptr->options.numrx * sizeof(struct rx_desc) +
vptr->options.numtx * sizeof(struct tx_desc) * vptr->num_txq;
-@@ -1182,6 +1230,7 @@
+@@ -1182,6 +1230,7 @@ static inline void velocity_give_many_rx
struct mac_regs __iomem *regs = vptr->mac_regs;
int avail, dirty, unusable;
/*
* RD number must be equal to 4X per hardware spec
* (programming guide rev 1.20, p.13)
-@@ -1195,7 +1244,8 @@
+@@ -1195,7 +1244,8 @@ static inline void velocity_give_many_rx
dirty = vptr->rd_dirty - unusable;
for (avail = vptr->rd_filled & 0xfffc; avail; avail--) {
dirty = (dirty > 0) ? dirty - 1 : vptr->options.numrx - 1;
}
writew(vptr->rd_filled & 0xfffc, ®s->RBRDU);
-@@ -1205,12 +1255,14 @@
+@@ -1205,12 +1255,14 @@ static inline void velocity_give_many_rx
static int velocity_rx_refill(struct velocity_info *vptr)
{
int dirty = vptr->rd_dirty, done = 0, ret = 0;
break;
if (!vptr->rd_info[dirty].skb) {
-@@ -1244,6 +1296,7 @@
+@@ -1244,6 +1296,7 @@ static int velocity_init_rd_ring(struct
int ret;
int mtu = vptr->dev->mtu;
vptr->rx_buf_sz = (mtu <= ETH_DATA_LEN) ? PKT_BUF_SZ : mtu + 32;
vptr->rd_info = kcalloc(vptr->options.numrx,
-@@ -1275,6 +1328,7 @@
+@@ -1275,6 +1328,7 @@ static void velocity_free_rd_ring(struct
{
int i;
if (vptr->rd_info == NULL)
return;
-@@ -1314,6 +1368,7 @@
+@@ -1314,6 +1368,7 @@ static int velocity_init_td_ring(struct
struct tx_desc *td;
struct velocity_td_info *td_info;
/* Init the TD ring entries */
for (j = 0; j < vptr->num_txq; j++) {
curr = vptr->td_pool_dma[j];
-@@ -1350,6 +1405,7 @@
+@@ -1350,6 +1405,7 @@ static void velocity_free_td_ring_entry(
struct velocity_td_info * td_info = &(vptr->td_infos[q][n]);
int i;
if (td_info == NULL)
return;
-@@ -1379,6 +1435,7 @@
+@@ -1379,6 +1435,7 @@ static void velocity_free_td_ring(struct
{
int i, j;
for (j = 0; j < vptr->num_txq; j++) {
if (vptr->td_infos[j] == NULL)
continue;
-@@ -1406,34 +1463,42 @@
+@@ -1406,34 +1463,42 @@ static int velocity_rx_srv(struct veloci
struct net_device_stats *stats = &vptr->stats;
int rd_curr = vptr->rd_curr;
int works = 0;
vptr->dev->last_rx = jiffies;
-@@ -1464,13 +1529,21 @@
+@@ -1464,13 +1529,21 @@ static int velocity_rx_srv(struct veloci
static inline void velocity_rx_csum(struct rx_desc *rd, struct sk_buff *skb)
{
return;
}
}
-@@ -1496,9 +1569,11 @@
+@@ -1496,9 +1569,11 @@ static inline int velocity_rx_copy(struc
{
int ret = -1;
new_skb = dev_alloc_skb(pkt_size + 2);
if (new_skb) {
new_skb->dev = vptr->dev;
-@@ -1529,10 +1604,12 @@
+@@ -1529,10 +1604,12 @@ static inline int velocity_rx_copy(struc
static inline void velocity_iph_realign(struct velocity_info *vptr,
struct sk_buff *skb, int pkt_size)
{
for (i = pkt_size; i >= 0; i--)
*(skb->data + i + 2) = *(skb->data + i);
skb_reserve(skb, 2);
-@@ -1551,19 +1628,27 @@
+@@ -1551,19 +1628,27 @@ static inline void velocity_iph_realign(
static int velocity_receive_frame(struct velocity_info *vptr, int idx)
{
void (*pci_action)(struct pci_dev *, dma_addr_t, size_t, int);
vptr->stats.multicast++;
skb = rd_info->skb;
-@@ -1576,7 +1661,8 @@
+@@ -1576,7 +1661,8 @@ static int velocity_receive_frame(struct
*/
if (vptr->flags & VELOCITY_FLAGS_VAL_PKT_LEN) {
stats->rx_length_errors++;
return -EINVAL;
}
-@@ -1620,6 +1706,7 @@
+@@ -1620,6 +1706,7 @@ static int velocity_alloc_rx_buf(struct
struct rx_desc *rd = &(vptr->rd_ring[idx]);
struct velocity_rd_info *rd_info = &(vptr->rd_info[idx]);
rd_info->skb = dev_alloc_skb(vptr->rx_buf_sz + 64);
if (rd_info->skb == NULL)
return -ENOMEM;
-@@ -1637,10 +1724,14 @@
+@@ -1637,10 +1724,14 @@ static int velocity_alloc_rx_buf(struct
*/
*((u32 *) & (rd->rdesc0)) = 0;
return 0;
}
-@@ -1661,9 +1752,11 @@
+@@ -1661,9 +1752,11 @@ static int velocity_tx_srv(struct veloci
int full = 0;
int idx;
int works = 0;
for (qnum = 0; qnum < vptr->num_txq; qnum++) {
for (idx = vptr->td_tail[qnum]; vptr->td_used[qnum] > 0;
idx = (idx + 1) % vptr->options.numtx) {
-@@ -1674,22 +1767,29 @@
+@@ -1674,22 +1767,29 @@ static int velocity_tx_srv(struct veloci
td = &(vptr->td_rings[qnum][idx]);
tdinfo = &(vptr->td_infos[qnum][idx]);
stats->tx_window_errors++;
} else {
stats->tx_packets++;
-@@ -1778,6 +1878,7 @@
+@@ -1778,6 +1878,7 @@ static void velocity_print_link_status(s
static void velocity_error(struct velocity_info *vptr, int status)
{
if (status & ISR_TXSTLI) {
struct mac_regs __iomem * regs = vptr->mac_regs;
-@@ -1867,6 +1968,7 @@
+@@ -1867,6 +1968,7 @@ static void velocity_free_tx_buf(struct
struct sk_buff *skb = tdinfo->skb;
int i;
/*
* Don't unmap the pre-allocated tx_bufs
*/
-@@ -2067,6 +2169,7 @@
+@@ -2067,6 +2169,7 @@ static int velocity_xmit(struct sk_buff
struct velocity_td_info *tdinfo;
unsigned long flags;
int index;
int pktlen = skb->len;
-@@ -2083,9 +2186,18 @@
+@@ -2083,9 +2186,18 @@ static int velocity_xmit(struct sk_buff
td_ptr = &(vptr->td_rings[qnum][index]);
tdinfo = &(vptr->td_infos[qnum][index]);
/*
* Pad short frames.
-@@ -2097,20 +2209,36 @@
+@@ -2097,20 +2209,36 @@ static int velocity_xmit(struct sk_buff
memset(tdinfo->buf + skb->len, 0, ETH_ZLEN - skb->len);
tdinfo->skb = skb;
tdinfo->skb_dma[0] = tdinfo->buf_dma;
td_ptr->tdesc0.pktsize =
td_ptr->td_buf[0].pa_low = cpu_to_le32(tdinfo->skb_dma[0]);
td_ptr->td_buf[0].pa_high = 0;
-@@ -2127,6 +2255,7 @@
+@@ -2127,6 +2255,7 @@ static int velocity_xmit(struct sk_buff
/* FIXME: support 48bit DMA later */
td_ptr->td_buf[i].pa_low = cpu_to_le32(tdinfo->skb_dma);
td_ptr->td_buf[i].pa_high = 0;
td_ptr->td_buf[i].bufsize = skb->len->skb->data_len;
for (i = 0; i < nfrags; i++) {
-@@ -2144,7 +2273,7 @@
+@@ -2144,7 +2273,7 @@ static int velocity_xmit(struct sk_buff
}
} else
{
/*
* Map the linear network buffer into PCI space and
-@@ -2152,19 +2281,29 @@
+@@ -2152,19 +2281,29 @@ static int velocity_xmit(struct sk_buff
*/
tdinfo->skb = skb;
tdinfo->skb_dma[0] = pci_map_single(vptr->pdev, skb->data, pktlen, PCI_DMA_TODEVICE);
}
/*
-@@ -2174,26 +2313,34 @@
+@@ -2174,26 +2313,34 @@ static int velocity_xmit(struct sk_buff
&& (skb->ip_summed == CHECKSUM_PARTIAL)) {
const struct iphdr *ip = ip_hdr(skb);
if (ip->protocol == IPPROTO_TCP)
mac_tx_queue_wake(vptr->mac_regs, qnum);
}
dev->trans_start = jiffies;
-@@ -2219,7 +2366,7 @@
+@@ -2219,7 +2366,7 @@ static int velocity_intr(int irq, void *
u32 isr_status;
int max_count = 0;
spin_lock(&vptr->lock);
isr_status = mac_read_isr(vptr->mac_regs);
-@@ -2238,7 +2385,10 @@
+@@ -2238,7 +2385,10 @@ static int velocity_intr(int irq, void *
while (isr_status != 0) {
mac_write_isr(vptr->mac_regs, isr_status);
velocity_error(vptr, isr_status);
if (isr_status & (ISR_PRXI | ISR_PPRXI))
max_count += velocity_rx_srv(vptr, isr_status);
-@@ -2276,6 +2426,7 @@
+@@ -2276,6 +2426,7 @@ static void velocity_set_multi(struct ne
int i;
struct dev_mc_list *mclist;
if (dev->flags & IFF_PROMISC) { /* Set promiscuous. */
writel(0xffffffff, ®s->MARCAM[0]);
writel(0xffffffff, ®s->MARCAM[4]);
-@@ -2319,6 +2470,7 @@
+@@ -2319,6 +2470,7 @@ static struct net_device_stats *velocity
{
struct velocity_info *vptr = netdev_priv(dev);
/* If the hardware is down, don't touch MII */
if(!netif_running(dev))
return &vptr->stats;
-@@ -2363,6 +2515,7 @@
+@@ -2363,6 +2515,7 @@ static int velocity_ioctl(struct net_dev
struct velocity_info *vptr = netdev_priv(dev);
int ret;
/* If we are asked for information and the device is power
saving then we need to bring the device back up to talk to it */
-@@ -2581,6 +2734,8 @@
+@@ -2581,6 +2734,8 @@ static int velocity_mii_read(struct mac_
{
u16 ww;
/*
* Disable MIICR_MAUTO, so that mii addr can be set normally
*/
-diff -Naur linux-2.6.24.orig/drivers/net/via-velocity.h linux-2.6.24/drivers/net/via-velocity.h
---- linux-2.6.24.orig/drivers/net/via-velocity.h 2008-01-31 23:11:26.000000000 -0600
-+++ linux-2.6.24/drivers/net/via-velocity.h 2008-02-01 01:12:15.000000000 -0600
+Index: linux-2.6.24.7/drivers/net/via-velocity.h
+===================================================================
+--- linux-2.6.24.7.orig/drivers/net/via-velocity.h
++++ linux-2.6.24.7/drivers/net/via-velocity.h
@@ -196,64 +196,70 @@
* Receive descriptor
*/
struct td_buf td_buf[7];
};
-@@ -279,6 +285,16 @@
+@@ -279,6 +285,16 @@ enum velocity_owner {
OWNED_BY_NIC = 1
};
/*
* MAC registers and macros.
-@@ -1512,6 +1528,7 @@
+@@ -1512,6 +1528,7 @@ enum velocity_flow_cntl_type {
};
struct velocity_opt {