aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/tsi108_eth.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/tsi108_eth.c')
-rw-r--r--drivers/net/tsi108_eth.c34
1 files changed, 10 insertions, 24 deletions
diff --git a/drivers/net/tsi108_eth.c b/drivers/net/tsi108_eth.c
index 7030bd5e9848..5b1fbb3c3b51 100644
--- a/drivers/net/tsi108_eth.c
+++ b/drivers/net/tsi108_eth.c
@@ -38,7 +38,6 @@
38#include <linux/etherdevice.h> 38#include <linux/etherdevice.h>
39#include <linux/ethtool.h> 39#include <linux/ethtool.h>
40#include <linux/skbuff.h> 40#include <linux/skbuff.h>
41#include <linux/slab.h>
42#include <linux/spinlock.h> 41#include <linux/spinlock.h>
43#include <linux/delay.h> 42#include <linux/delay.h>
44#include <linux/crc32.h> 43#include <linux/crc32.h>
@@ -48,6 +47,7 @@
48#include <linux/rtnetlink.h> 47#include <linux/rtnetlink.h>
49#include <linux/timer.h> 48#include <linux/timer.h>
50#include <linux/platform_device.h> 49#include <linux/platform_device.h>
50#include <linux/gfp.h>
51 51
52#include <asm/system.h> 52#include <asm/system.h>
53#include <asm/io.h> 53#include <asm/io.h>
@@ -802,13 +802,11 @@ static int tsi108_refill_rx(struct net_device *dev, int budget)
802 int rx = data->rxhead; 802 int rx = data->rxhead;
803 struct sk_buff *skb; 803 struct sk_buff *skb;
804 804
805 data->rxskbs[rx] = skb = netdev_alloc_skb(dev, 805 skb = netdev_alloc_skb_ip_align(dev, TSI108_RXBUF_SIZE);
806 TSI108_RXBUF_SIZE + 2); 806 data->rxskbs[rx] = skb;
807 if (!skb) 807 if (!skb)
808 break; 808 break;
809 809
810 skb_reserve(skb, 2); /* Align the data on a 4-byte boundary. */
811
812 data->rxring[rx].buf0 = dma_map_single(NULL, skb->data, 810 data->rxring[rx].buf0 = dma_map_single(NULL, skb->data,
813 TSI108_RX_SKB_SIZE, 811 TSI108_RX_SKB_SIZE,
814 DMA_FROM_DEVICE); 812 DMA_FROM_DEVICE);
@@ -1186,29 +1184,19 @@ static void tsi108_set_rx_mode(struct net_device *dev)
1186 1184
1187 rxcfg &= ~(TSI108_EC_RXCFG_UFE | TSI108_EC_RXCFG_MFE); 1185 rxcfg &= ~(TSI108_EC_RXCFG_UFE | TSI108_EC_RXCFG_MFE);
1188 1186
1189 if (dev->flags & IFF_ALLMULTI || dev->mc_count) { 1187 if (dev->flags & IFF_ALLMULTI || !netdev_mc_empty(dev)) {
1190 int i; 1188 int i;
1191 struct dev_mc_list *mc = dev->mc_list; 1189 struct dev_mc_list *mc;
1192 rxcfg |= TSI108_EC_RXCFG_MFE | TSI108_EC_RXCFG_MC_HASH; 1190 rxcfg |= TSI108_EC_RXCFG_MFE | TSI108_EC_RXCFG_MC_HASH;
1193 1191
1194 memset(data->mc_hash, 0, sizeof(data->mc_hash)); 1192 memset(data->mc_hash, 0, sizeof(data->mc_hash));
1195 1193
1196 while (mc) { 1194 netdev_for_each_mc_addr(mc, dev) {
1197 u32 hash, crc; 1195 u32 hash, crc;
1198 1196
1199 if (mc->dmi_addrlen == 6) { 1197 crc = ether_crc(6, mc->dmi_addr);
1200 crc = ether_crc(6, mc->dmi_addr); 1198 hash = crc >> 23;
1201 hash = crc >> 23; 1199 __set_bit(hash, &data->mc_hash[0]);
1202
1203 __set_bit(hash, &data->mc_hash[0]);
1204 } else {
1205 printk(KERN_ERR
1206 "%s: got multicast address of length %d instead of 6.\n",
1207 dev->name,
1208 mc->dmi_addrlen);
1209 }
1210
1211 mc = mc->next;
1212 } 1200 }
1213 1201
1214 TSI_WRITE(TSI108_EC_HASHADDR, 1202 TSI_WRITE(TSI108_EC_HASHADDR,
@@ -1356,7 +1344,7 @@ static int tsi108_open(struct net_device *dev)
1356 for (i = 0; i < TSI108_RXRING_LEN; i++) { 1344 for (i = 0; i < TSI108_RXRING_LEN; i++) {
1357 struct sk_buff *skb; 1345 struct sk_buff *skb;
1358 1346
1359 skb = netdev_alloc_skb(dev, TSI108_RXBUF_SIZE + NET_IP_ALIGN); 1347 skb = netdev_alloc_skb_ip_align(dev, TSI108_RXBUF_SIZE);
1360 if (!skb) { 1348 if (!skb) {
1361 /* Bah. No memory for now, but maybe we'll get 1349 /* Bah. No memory for now, but maybe we'll get
1362 * some more later. 1350 * some more later.
@@ -1370,8 +1358,6 @@ static int tsi108_open(struct net_device *dev)
1370 } 1358 }
1371 1359
1372 data->rxskbs[i] = skb; 1360 data->rxskbs[i] = skb;
1373 /* Align the payload on a 4-byte boundary */
1374 skb_reserve(skb, 2);
1375 data->rxskbs[i] = skb; 1361 data->rxskbs[i] = skb;
1376 data->rxring[i].buf0 = virt_to_phys(data->rxskbs[i]->data); 1362 data->rxring[i].buf0 = virt_to_phys(data->rxskbs[i]->data);
1377 data->rxring[i].misc = TSI108_RX_OWN | TSI108_RX_INT; 1363 data->rxring[i].misc = TSI108_RX_OWN | TSI108_RX_INT;