diff options
-rw-r--r-- | drivers/net/tc35815.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/drivers/net/tc35815.c b/drivers/net/tc35815.c index 44126c463fac..308f365270e9 100644 --- a/drivers/net/tc35815.c +++ b/drivers/net/tc35815.c | |||
@@ -37,6 +37,7 @@ static const char *version = "tc35815.c:v" DRV_VERSION "\n"; | |||
37 | #include <linux/interrupt.h> | 37 | #include <linux/interrupt.h> |
38 | #include <linux/ioport.h> | 38 | #include <linux/ioport.h> |
39 | #include <linux/in.h> | 39 | #include <linux/in.h> |
40 | #include <linux/if_vlan.h> | ||
40 | #include <linux/slab.h> | 41 | #include <linux/slab.h> |
41 | #include <linux/string.h> | 42 | #include <linux/string.h> |
42 | #include <linux/spinlock.h> | 43 | #include <linux/spinlock.h> |
@@ -341,7 +342,7 @@ struct BDesc { | |||
341 | Tx_En) /* maybe 0x7b01 */ | 342 | Tx_En) /* maybe 0x7b01 */ |
342 | #endif | 343 | #endif |
343 | #define RX_CTL_CMD (Rx_EnGood | Rx_EnRxPar | Rx_EnLongErr | Rx_EnOver \ | 344 | #define RX_CTL_CMD (Rx_EnGood | Rx_EnRxPar | Rx_EnLongErr | Rx_EnOver \ |
344 | | Rx_EnCRCErr | Rx_EnAlign | Rx_RxEn) /* maybe 0x6f01 */ | 345 | | Rx_EnCRCErr | Rx_EnAlign | Rx_StripCRC | Rx_RxEn) /* maybe 0x6f11 */ |
345 | #define INT_EN_CMD (Int_NRAbtEn | \ | 346 | #define INT_EN_CMD (Int_NRAbtEn | \ |
346 | Int_DmParErrEn | Int_DParDEn | Int_DParErrEn | \ | 347 | Int_DmParErrEn | Int_DParDEn | Int_DParErrEn | \ |
347 | Int_SSysErrEn | Int_RMasAbtEn | Int_RTargAbtEn | \ | 348 | Int_SSysErrEn | Int_RMasAbtEn | Int_RTargAbtEn | \ |
@@ -373,9 +374,11 @@ struct BDesc { | |||
373 | #if RX_CTL_CMD & Rx_LongEn | 374 | #if RX_CTL_CMD & Rx_LongEn |
374 | #define RX_BUF_SIZE PAGE_SIZE | 375 | #define RX_BUF_SIZE PAGE_SIZE |
375 | #elif RX_CTL_CMD & Rx_StripCRC | 376 | #elif RX_CTL_CMD & Rx_StripCRC |
376 | #define RX_BUF_SIZE ALIGN(ETH_FRAME_LEN + 4 + 2, 32) /* +2: reserve */ | 377 | #define RX_BUF_SIZE \ |
378 | L1_CACHE_ALIGN(ETH_FRAME_LEN + VLAN_HLEN + NET_IP_ALIGN) | ||
377 | #else | 379 | #else |
378 | #define RX_BUF_SIZE ALIGN(ETH_FRAME_LEN + 2, 32) /* +2: reserve */ | 380 | #define RX_BUF_SIZE \ |
381 | L1_CACHE_ALIGN(ETH_FRAME_LEN + VLAN_HLEN + ETH_FCS_LEN + NET_IP_ALIGN) | ||
379 | #endif | 382 | #endif |
380 | #endif /* TC35815_USE_PACKEDBUFFER */ | 383 | #endif /* TC35815_USE_PACKEDBUFFER */ |
381 | #define RX_FD_RESERVE (2 / 2) /* max 2 BD per RxFD */ | 384 | #define RX_FD_RESERVE (2 / 2) /* max 2 BD per RxFD */ |
@@ -1666,7 +1669,7 @@ tc35815_rx(struct net_device *dev) | |||
1666 | struct RxFD *next_rfd; | 1669 | struct RxFD *next_rfd; |
1667 | #endif | 1670 | #endif |
1668 | #if (RX_CTL_CMD & Rx_StripCRC) == 0 | 1671 | #if (RX_CTL_CMD & Rx_StripCRC) == 0 |
1669 | pkt_len -= 4; | 1672 | pkt_len -= ETH_FCS_LEN; |
1670 | #endif | 1673 | #endif |
1671 | 1674 | ||
1672 | if (netif_msg_rx_status(lp)) | 1675 | if (netif_msg_rx_status(lp)) |
@@ -1685,14 +1688,14 @@ tc35815_rx(struct net_device *dev) | |||
1685 | #endif | 1688 | #endif |
1686 | #ifdef TC35815_USE_PACKEDBUFFER | 1689 | #ifdef TC35815_USE_PACKEDBUFFER |
1687 | BUG_ON(bd_count > 2); | 1690 | BUG_ON(bd_count > 2); |
1688 | skb = dev_alloc_skb(pkt_len + 2); /* +2: for reserve */ | 1691 | skb = dev_alloc_skb(pkt_len + NET_IP_ALIGN); |
1689 | if (skb == NULL) { | 1692 | if (skb == NULL) { |
1690 | printk(KERN_NOTICE "%s: Memory squeeze, dropping packet.\n", | 1693 | printk(KERN_NOTICE "%s: Memory squeeze, dropping packet.\n", |
1691 | dev->name); | 1694 | dev->name); |
1692 | dev->stats.rx_dropped++; | 1695 | dev->stats.rx_dropped++; |
1693 | break; | 1696 | break; |
1694 | } | 1697 | } |
1695 | skb_reserve(skb, 2); /* 16 bit alignment */ | 1698 | skb_reserve(skb, NET_IP_ALIGN); |
1696 | 1699 | ||
1697 | data = skb_put(skb, pkt_len); | 1700 | data = skb_put(skb, pkt_len); |
1698 | 1701 | ||
@@ -1744,8 +1747,9 @@ tc35815_rx(struct net_device *dev) | |||
1744 | pci_unmap_single(lp->pci_dev, | 1747 | pci_unmap_single(lp->pci_dev, |
1745 | lp->rx_skbs[cur_bd].skb_dma, | 1748 | lp->rx_skbs[cur_bd].skb_dma, |
1746 | RX_BUF_SIZE, PCI_DMA_FROMDEVICE); | 1749 | RX_BUF_SIZE, PCI_DMA_FROMDEVICE); |
1747 | if (!HAVE_DMA_RXALIGN(lp)) | 1750 | if (!HAVE_DMA_RXALIGN(lp) && NET_IP_ALIGN) |
1748 | memmove(skb->data, skb->data - 2, pkt_len); | 1751 | memmove(skb->data, skb->data - NET_IP_ALIGN, |
1752 | pkt_len); | ||
1749 | data = skb_put(skb, pkt_len); | 1753 | data = skb_put(skb, pkt_len); |
1750 | #endif /* TC35815_USE_PACKEDBUFFER */ | 1754 | #endif /* TC35815_USE_PACKEDBUFFER */ |
1751 | if (netif_msg_pktdata(lp)) | 1755 | if (netif_msg_pktdata(lp)) |