diff options
author | David S. Miller <davem@davemloft.net> | 2010-04-22 18:48:17 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-04-22 18:48:17 -0400 |
commit | 3cfa856d6d43894ebffdc28d2f0587595280893b (patch) | |
tree | 73d38c87c33a9c856eb36406d03f39f6b63d83dd | |
parent | 927b1375f9c53456b309ae12d048d41388f9f963 (diff) |
niu: Add skb->rxhash support.
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/niu.c | 52 | ||||
-rw-r--r-- | drivers/net/niu.h | 7 |
2 files changed, 45 insertions, 14 deletions
diff --git a/drivers/net/niu.c b/drivers/net/niu.c index 493e25cf101..30abb4e436f 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 | ||
42 | static char version[] __devinitdata = | 42 | static 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 | ||
7921 | static 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 | |||
7913 | static const struct ethtool_ops niu_ethtool_ops = { | 7933 | static 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 | ||
7931 | static int niu_ldg_assign_ldn(struct niu *np, struct niu_parent *parent, | 7953 | static 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 | ||
9779 | static 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 | |||
9757 | static int __devinit niu_pci_init_one(struct pci_dev *pdev, | 9785 | static 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]), |
diff --git a/drivers/net/niu.h b/drivers/net/niu.h index 3bd0b5933d5..d6715465f35 100644 --- a/drivers/net/niu.h +++ b/drivers/net/niu.h | |||
@@ -2706,7 +2706,7 @@ struct rx_pkt_hdr0 { | |||
2706 | #if defined(__LITTLE_ENDIAN_BITFIELD) | 2706 | #if defined(__LITTLE_ENDIAN_BITFIELD) |
2707 | u8 inputport:2, | 2707 | u8 inputport:2, |
2708 | maccheck:1, | 2708 | maccheck:1, |
2709 | class:4; | 2709 | class:5; |
2710 | u8 vlan:1, | 2710 | u8 vlan:1, |
2711 | llcsnap:1, | 2711 | llcsnap:1, |
2712 | noport:1, | 2712 | noport:1, |
@@ -2715,7 +2715,7 @@ struct rx_pkt_hdr0 { | |||
2715 | tres:2, | 2715 | tres:2, |
2716 | tzfvld:1; | 2716 | tzfvld:1; |
2717 | #elif defined(__BIG_ENDIAN_BITFIELD) | 2717 | #elif defined(__BIG_ENDIAN_BITFIELD) |
2718 | u8 class:4, | 2718 | u8 class:5, |
2719 | maccheck:1, | 2719 | maccheck:1, |
2720 | inputport:2; | 2720 | inputport:2; |
2721 | u8 tzfvld:1, | 2721 | u8 tzfvld:1, |
@@ -2775,6 +2775,9 @@ struct rx_pkt_hdr1 { | |||
2775 | /* Bits 7:0 of hash value, H1. */ | 2775 | /* Bits 7:0 of hash value, H1. */ |
2776 | u8 hashval1_2; | 2776 | u8 hashval1_2; |
2777 | 2777 | ||
2778 | u8 hwrsvd5; | ||
2779 | u8 hwrsvd6; | ||
2780 | |||
2778 | u8 usrdata_0; /* Bits 39:32 of user data. */ | 2781 | u8 usrdata_0; /* Bits 39:32 of user data. */ |
2779 | u8 usrdata_1; /* Bits 31:24 of user data. */ | 2782 | u8 usrdata_1; /* Bits 31:24 of user data. */ |
2780 | u8 usrdata_2; /* Bits 23:16 of user data. */ | 2783 | u8 usrdata_2; /* Bits 23:16 of user data. */ |