diff options
author | Dimitris Michailidis <dm@chelsio.com> | 2010-04-27 19:22:42 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-04-27 19:22:42 -0400 |
commit | 87b6cf51acb4999fff7e6841986874b108679cb4 (patch) | |
tree | 304fe476f4d3acd192ba7991d28b888845114586 /drivers/net/cxgb4 | |
parent | 8cd9b13207f9a38e4da2d69bba51eb8dcbe1ead9 (diff) |
cxgb4: set skb->rxhash
Implement the ->set_flags ethtool method to control NETIF_F_RXHASH and
set skb->rxhash to the HW calculated hash accordingly.
Follow Eric Dumazet's suggestion and use the hash value raw.
Signed-off-by: Dimitris Michailidis <dm@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/cxgb4')
-rw-r--r-- | drivers/net/cxgb4/cxgb4_main.c | 15 | ||||
-rw-r--r-- | drivers/net/cxgb4/sge.c | 7 | ||||
-rw-r--r-- | drivers/net/cxgb4/t4_msg.h | 1 |
3 files changed, 21 insertions, 2 deletions
diff --git a/drivers/net/cxgb4/cxgb4_main.c b/drivers/net/cxgb4/cxgb4_main.c index 5f582dba928f..1bad50041427 100644 --- a/drivers/net/cxgb4/cxgb4_main.c +++ b/drivers/net/cxgb4/cxgb4_main.c | |||
@@ -1711,6 +1711,18 @@ static int set_tso(struct net_device *dev, u32 value) | |||
1711 | return 0; | 1711 | return 0; |
1712 | } | 1712 | } |
1713 | 1713 | ||
1714 | static int set_flags(struct net_device *dev, u32 flags) | ||
1715 | { | ||
1716 | if (flags & ~ETH_FLAG_RXHASH) | ||
1717 | return -EOPNOTSUPP; | ||
1718 | |||
1719 | if (flags & ETH_FLAG_RXHASH) | ||
1720 | dev->features |= NETIF_F_RXHASH; | ||
1721 | else | ||
1722 | dev->features &= ~NETIF_F_RXHASH; | ||
1723 | return 0; | ||
1724 | } | ||
1725 | |||
1714 | static struct ethtool_ops cxgb_ethtool_ops = { | 1726 | static struct ethtool_ops cxgb_ethtool_ops = { |
1715 | .get_settings = get_settings, | 1727 | .get_settings = get_settings, |
1716 | .set_settings = set_settings, | 1728 | .set_settings = set_settings, |
@@ -1741,6 +1753,7 @@ static struct ethtool_ops cxgb_ethtool_ops = { | |||
1741 | .get_wol = get_wol, | 1753 | .get_wol = get_wol, |
1742 | .set_wol = set_wol, | 1754 | .set_wol = set_wol, |
1743 | .set_tso = set_tso, | 1755 | .set_tso = set_tso, |
1756 | .set_flags = set_flags, | ||
1744 | .flash_device = set_flash, | 1757 | .flash_device = set_flash, |
1745 | }; | 1758 | }; |
1746 | 1759 | ||
@@ -3203,7 +3216,7 @@ static int __devinit init_one(struct pci_dev *pdev, | |||
3203 | 3216 | ||
3204 | netdev->features |= NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6; | 3217 | netdev->features |= NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6; |
3205 | netdev->features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM; | 3218 | netdev->features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM; |
3206 | netdev->features |= NETIF_F_GRO | highdma; | 3219 | netdev->features |= NETIF_F_GRO | NETIF_F_RXHASH | highdma; |
3207 | netdev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; | 3220 | netdev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; |
3208 | netdev->vlan_features = netdev->features & VLAN_FEAT; | 3221 | netdev->vlan_features = netdev->features & VLAN_FEAT; |
3209 | 3222 | ||
diff --git a/drivers/net/cxgb4/sge.c b/drivers/net/cxgb4/sge.c index 65d91c4ec9f5..d1f8f225e45a 100644 --- a/drivers/net/cxgb4/sge.c +++ b/drivers/net/cxgb4/sge.c | |||
@@ -1524,6 +1524,8 @@ static void do_gro(struct sge_eth_rxq *rxq, const struct pkt_gl *gl, | |||
1524 | skb->truesize += skb->data_len; | 1524 | skb->truesize += skb->data_len; |
1525 | skb->ip_summed = CHECKSUM_UNNECESSARY; | 1525 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
1526 | skb_record_rx_queue(skb, rxq->rspq.idx); | 1526 | skb_record_rx_queue(skb, rxq->rspq.idx); |
1527 | if (rxq->rspq.netdev->features & NETIF_F_RXHASH) | ||
1528 | skb->rxhash = (__force u32)pkt->rsshdr.hash_val; | ||
1527 | 1529 | ||
1528 | if (unlikely(pkt->vlan_ex)) { | 1530 | if (unlikely(pkt->vlan_ex)) { |
1529 | struct port_info *pi = netdev_priv(rxq->rspq.netdev); | 1531 | struct port_info *pi = netdev_priv(rxq->rspq.netdev); |
@@ -1565,7 +1567,7 @@ int t4_ethrx_handler(struct sge_rspq *q, const __be64 *rsp, | |||
1565 | if (unlikely(*(u8 *)rsp == CPL_TRACE_PKT)) | 1567 | if (unlikely(*(u8 *)rsp == CPL_TRACE_PKT)) |
1566 | return handle_trace_pkt(q->adap, si); | 1568 | return handle_trace_pkt(q->adap, si); |
1567 | 1569 | ||
1568 | pkt = (void *)&rsp[1]; | 1570 | pkt = (const struct cpl_rx_pkt *)rsp; |
1569 | csum_ok = pkt->csum_calc && !pkt->err_vec; | 1571 | csum_ok = pkt->csum_calc && !pkt->err_vec; |
1570 | if ((pkt->l2info & htonl(RXF_TCP)) && | 1572 | if ((pkt->l2info & htonl(RXF_TCP)) && |
1571 | (q->netdev->features & NETIF_F_GRO) && csum_ok && !pkt->ip_frag) { | 1573 | (q->netdev->features & NETIF_F_GRO) && csum_ok && !pkt->ip_frag) { |
@@ -1583,6 +1585,9 @@ int t4_ethrx_handler(struct sge_rspq *q, const __be64 *rsp, | |||
1583 | __skb_pull(skb, RX_PKT_PAD); /* remove ethernet header padding */ | 1585 | __skb_pull(skb, RX_PKT_PAD); /* remove ethernet header padding */ |
1584 | skb->protocol = eth_type_trans(skb, q->netdev); | 1586 | skb->protocol = eth_type_trans(skb, q->netdev); |
1585 | skb_record_rx_queue(skb, q->idx); | 1587 | skb_record_rx_queue(skb, q->idx); |
1588 | if (skb->dev->features & NETIF_F_RXHASH) | ||
1589 | skb->rxhash = (__force u32)pkt->rsshdr.hash_val; | ||
1590 | |||
1586 | pi = netdev_priv(skb->dev); | 1591 | pi = netdev_priv(skb->dev); |
1587 | rxq->stats.pkts++; | 1592 | rxq->stats.pkts++; |
1588 | 1593 | ||
diff --git a/drivers/net/cxgb4/t4_msg.h b/drivers/net/cxgb4/t4_msg.h index fdb117443144..7a981b81afaf 100644 --- a/drivers/net/cxgb4/t4_msg.h +++ b/drivers/net/cxgb4/t4_msg.h | |||
@@ -503,6 +503,7 @@ struct cpl_rx_data_ack { | |||
503 | }; | 503 | }; |
504 | 504 | ||
505 | struct cpl_rx_pkt { | 505 | struct cpl_rx_pkt { |
506 | struct rss_header rsshdr; | ||
506 | u8 opcode; | 507 | u8 opcode; |
507 | #if defined(__LITTLE_ENDIAN_BITFIELD) | 508 | #if defined(__LITTLE_ENDIAN_BITFIELD) |
508 | u8 iff:4; | 509 | u8 iff:4; |