aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/niu.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/niu.c')
-rw-r--r--drivers/net/niu.c52
1 files changed, 40 insertions, 12 deletions
diff --git a/drivers/net/niu.c b/drivers/net/niu.c
index 493e25cf1014..30abb4e436f1 100644
--- a/drivers/net/niu.c
+++ b/drivers/net/niu.c
@@ -36,8 +36,8 @@
36#include "niu.h" 36#include "niu.h"
37 37
38#define DRV_MODULE_NAME "niu" 38#define DRV_MODULE_NAME "niu"
39#define DRV_MODULE_VERSION "1.0" 39#define DRV_MODULE_VERSION "1.1"
40#define DRV_MODULE_RELDATE "Nov 14, 2008" 40#define DRV_MODULE_RELDATE "Apr 22, 2010"
41 41
42static char version[] __devinitdata = 42static char version[] __devinitdata =
43 DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n"; 43 DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n";
@@ -3444,6 +3444,7 @@ static int niu_process_rx_pkt(struct napi_struct *napi, struct niu *np,
3444 struct rx_ring_info *rp) 3444 struct rx_ring_info *rp)
3445{ 3445{
3446 unsigned int index = rp->rcr_index; 3446 unsigned int index = rp->rcr_index;
3447 struct rx_pkt_hdr1 *rh;
3447 struct sk_buff *skb; 3448 struct sk_buff *skb;
3448 int len, num_rcr; 3449 int len, num_rcr;
3449 3450
@@ -3477,9 +3478,6 @@ static int niu_process_rx_pkt(struct napi_struct *napi, struct niu *np,
3477 if (num_rcr == 1) { 3478 if (num_rcr == 1) {
3478 int ptype; 3479 int ptype;
3479 3480
3480 off += 2;
3481 append_size -= 2;
3482
3483 ptype = (val >> RCR_ENTRY_PKT_TYPE_SHIFT); 3481 ptype = (val >> RCR_ENTRY_PKT_TYPE_SHIFT);
3484 if ((ptype == RCR_PKT_TYPE_TCP || 3482 if ((ptype == RCR_PKT_TYPE_TCP ||
3485 ptype == RCR_PKT_TYPE_UDP) && 3483 ptype == RCR_PKT_TYPE_UDP) &&
@@ -3488,8 +3486,7 @@ static int niu_process_rx_pkt(struct napi_struct *napi, struct niu *np,
3488 skb->ip_summed = CHECKSUM_UNNECESSARY; 3486 skb->ip_summed = CHECKSUM_UNNECESSARY;
3489 else 3487 else
3490 skb->ip_summed = CHECKSUM_NONE; 3488 skb->ip_summed = CHECKSUM_NONE;
3491 } 3489 } else if (!(val & RCR_ENTRY_MULTI))
3492 if (!(val & RCR_ENTRY_MULTI))
3493 append_size = len - skb->len; 3490 append_size = len - skb->len;
3494 3491
3495 niu_rx_skb_append(skb, page, off, append_size); 3492 niu_rx_skb_append(skb, page, off, append_size);
@@ -3510,8 +3507,17 @@ static int niu_process_rx_pkt(struct napi_struct *napi, struct niu *np,
3510 } 3507 }
3511 rp->rcr_index = index; 3508 rp->rcr_index = index;
3512 3509
3513 skb_reserve(skb, NET_IP_ALIGN); 3510 len += sizeof(*rh);
3514 __pskb_pull_tail(skb, min(len, VLAN_ETH_HLEN)); 3511 len = min_t(int, len, sizeof(*rh) + VLAN_ETH_HLEN);
3512 __pskb_pull_tail(skb, len);
3513
3514 rh = (struct rx_pkt_hdr1 *) skb->data;
3515 if (np->dev->features & NETIF_F_RXHASH)
3516 skb->rxhash = ((u32)rh->hashval2_0 << 24 |
3517 (u32)rh->hashval2_1 << 16 |
3518 (u32)rh->hashval1_1 << 8 |
3519 (u32)rh->hashval1_2 << 0);
3520 skb_pull(skb, sizeof(*rh));
3515 3521
3516 rp->rx_packets++; 3522 rp->rx_packets++;
3517 rp->rx_bytes += skb->len; 3523 rp->rx_bytes += skb->len;
@@ -4946,7 +4952,9 @@ static int niu_init_one_rx_channel(struct niu *np, struct rx_ring_info *rp)
4946 RX_DMA_CTL_STAT_RCRTO | 4952 RX_DMA_CTL_STAT_RCRTO |
4947 RX_DMA_CTL_STAT_RBR_EMPTY)); 4953 RX_DMA_CTL_STAT_RBR_EMPTY));
4948 nw64(RXDMA_CFIG1(channel), rp->mbox_dma >> 32); 4954 nw64(RXDMA_CFIG1(channel), rp->mbox_dma >> 32);
4949 nw64(RXDMA_CFIG2(channel), (rp->mbox_dma & 0x00000000ffffffc0)); 4955 nw64(RXDMA_CFIG2(channel),
4956 ((rp->mbox_dma & RXDMA_CFIG2_MBADDR_L) |
4957 RXDMA_CFIG2_FULL_HDR));
4950 nw64(RBR_CFIG_A(channel), 4958 nw64(RBR_CFIG_A(channel),
4951 ((u64)rp->rbr_table_size << RBR_CFIG_A_LEN_SHIFT) | 4959 ((u64)rp->rbr_table_size << RBR_CFIG_A_LEN_SHIFT) |
4952 (rp->rbr_dma & (RBR_CFIG_A_STADDR_BASE | RBR_CFIG_A_STADDR))); 4960 (rp->rbr_dma & (RBR_CFIG_A_STADDR_BASE | RBR_CFIG_A_STADDR)));
@@ -7910,6 +7918,18 @@ static int niu_phys_id(struct net_device *dev, u32 data)
7910 return 0; 7918 return 0;
7911} 7919}
7912 7920
7921static int niu_set_flags(struct net_device *dev, u32 data)
7922{
7923 if (data & (ETH_FLAG_LRO | ETH_FLAG_NTUPLE))
7924 return -EOPNOTSUPP;
7925
7926 if (data & ETH_FLAG_RXHASH)
7927 dev->features |= NETIF_F_RXHASH;
7928 else
7929 dev->features &= ~NETIF_F_RXHASH;
7930 return 0;
7931}
7932
7913static const struct ethtool_ops niu_ethtool_ops = { 7933static const struct ethtool_ops niu_ethtool_ops = {
7914 .get_drvinfo = niu_get_drvinfo, 7934 .get_drvinfo = niu_get_drvinfo,
7915 .get_link = ethtool_op_get_link, 7935 .get_link = ethtool_op_get_link,
@@ -7926,6 +7946,8 @@ static const struct ethtool_ops niu_ethtool_ops = {
7926 .phys_id = niu_phys_id, 7946 .phys_id = niu_phys_id,
7927 .get_rxnfc = niu_get_nfc, 7947 .get_rxnfc = niu_get_nfc,
7928 .set_rxnfc = niu_set_nfc, 7948 .set_rxnfc = niu_set_nfc,
7949 .set_flags = niu_set_flags,
7950 .get_flags = ethtool_op_get_flags,
7929}; 7951};
7930 7952
7931static int niu_ldg_assign_ldn(struct niu *np, struct niu_parent *parent, 7953static int niu_ldg_assign_ldn(struct niu *np, struct niu_parent *parent,
@@ -9754,6 +9776,12 @@ static void __devinit niu_device_announce(struct niu *np)
9754 } 9776 }
9755} 9777}
9756 9778
9779static void __devinit niu_set_basic_features(struct net_device *dev)
9780{
9781 dev->features |= (NETIF_F_SG | NETIF_F_HW_CSUM |
9782 NETIF_F_GRO | NETIF_F_RXHASH);
9783}
9784
9757static int __devinit niu_pci_init_one(struct pci_dev *pdev, 9785static int __devinit niu_pci_init_one(struct pci_dev *pdev,
9758 const struct pci_device_id *ent) 9786 const struct pci_device_id *ent)
9759{ 9787{
@@ -9838,7 +9866,7 @@ static int __devinit niu_pci_init_one(struct pci_dev *pdev,
9838 } 9866 }
9839 } 9867 }
9840 9868
9841 dev->features |= (NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_GRO); 9869 niu_set_basic_features(dev);
9842 9870
9843 np->regs = pci_ioremap_bar(pdev, 0); 9871 np->regs = pci_ioremap_bar(pdev, 0);
9844 if (!np->regs) { 9872 if (!np->regs) {
@@ -10080,7 +10108,7 @@ static int __devinit niu_of_probe(struct of_device *op,
10080 goto err_out_free_dev; 10108 goto err_out_free_dev;
10081 } 10109 }
10082 10110
10083 dev->features |= (NETIF_F_SG | NETIF_F_HW_CSUM); 10111 niu_set_basic_features(dev);
10084 10112
10085 np->regs = of_ioremap(&op->resource[1], 0, 10113 np->regs = of_ioremap(&op->resource[1], 0,
10086 resource_size(&op->resource[1]), 10114 resource_size(&op->resource[1]),