aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bnx2x_main.c
diff options
context:
space:
mode:
authorVladislav Zolotarov <vladz@broadcom.com>2010-07-06 00:09:43 -0400
committerDavid S. Miller <davem@davemloft.net>2010-07-07 18:45:00 -0400
commit6f3c72a2148f5f99c4dcc97cbcea06916136c862 (patch)
tree7b391458927693c963af123491c17bd3826c8967 /drivers/net/bnx2x_main.c
parent49085bd7d498c47d635851cfda22627b085cd9af (diff)
bnx2x: Set RXHASH for LRO packets
Set Toeplitz hash both for LRO and none-LRO skbs. The first CQE (TPA_START) will contain a hash for an LRO packet. Current code sets skb->rx_hash for none-LRO skbs only. Signed-off-by: Vladislav Zolotarov <vladz@broadcom.com> Signed-off-by: Eilon Greenstein <eilong@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bnx2x_main.c')
-rw-r--r--drivers/net/bnx2x_main.c28
1 files changed, 21 insertions, 7 deletions
diff --git a/drivers/net/bnx2x_main.c b/drivers/net/bnx2x_main.c
index 29e293f97dba..51b788339c90 100644
--- a/drivers/net/bnx2x_main.c
+++ b/drivers/net/bnx2x_main.c
@@ -1545,6 +1545,20 @@ static inline void bnx2x_update_rx_prod(struct bnx2x *bp,
1545 fp->index, bd_prod, rx_comp_prod, rx_sge_prod); 1545 fp->index, bd_prod, rx_comp_prod, rx_sge_prod);
1546} 1546}
1547 1547
1548/* Set Toeplitz hash value in the skb using the value from the
1549 * CQE (calculated by HW).
1550 */
1551static inline void bnx2x_set_skb_rxhash(struct bnx2x *bp, union eth_rx_cqe *cqe,
1552 struct sk_buff *skb)
1553{
1554 /* Set Toeplitz hash from CQE */
1555 if ((bp->dev->features & NETIF_F_RXHASH) &&
1556 (cqe->fast_path_cqe.status_flags &
1557 ETH_FAST_PATH_RX_CQE_RSS_HASH_FLG))
1558 skb->rxhash =
1559 le32_to_cpu(cqe->fast_path_cqe.rss_hash_result);
1560}
1561
1548static int bnx2x_rx_int(struct bnx2x_fastpath *fp, int budget) 1562static int bnx2x_rx_int(struct bnx2x_fastpath *fp, int budget)
1549{ 1563{
1550 struct bnx2x *bp = fp->bp; 1564 struct bnx2x *bp = fp->bp;
@@ -1582,7 +1596,7 @@ static int bnx2x_rx_int(struct bnx2x_fastpath *fp, int budget)
1582 struct sw_rx_bd *rx_buf = NULL; 1596 struct sw_rx_bd *rx_buf = NULL;
1583 struct sk_buff *skb; 1597 struct sk_buff *skb;
1584 union eth_rx_cqe *cqe; 1598 union eth_rx_cqe *cqe;
1585 u8 cqe_fp_flags, cqe_fp_status_flags; 1599 u8 cqe_fp_flags;
1586 u16 len, pad; 1600 u16 len, pad;
1587 1601
1588 comp_ring_cons = RCQ_BD(sw_comp_cons); 1602 comp_ring_cons = RCQ_BD(sw_comp_cons);
@@ -1598,7 +1612,6 @@ static int bnx2x_rx_int(struct bnx2x_fastpath *fp, int budget)
1598 1612
1599 cqe = &fp->rx_comp_ring[comp_ring_cons]; 1613 cqe = &fp->rx_comp_ring[comp_ring_cons];
1600 cqe_fp_flags = cqe->fast_path_cqe.type_error_flags; 1614 cqe_fp_flags = cqe->fast_path_cqe.type_error_flags;
1601 cqe_fp_status_flags = cqe->fast_path_cqe.status_flags;
1602 1615
1603 DP(NETIF_MSG_RX_STATUS, "CQE type %x err %x status %x" 1616 DP(NETIF_MSG_RX_STATUS, "CQE type %x err %x status %x"
1604 " queue %x vlan %x len %u\n", CQE_TYPE(cqe_fp_flags), 1617 " queue %x vlan %x len %u\n", CQE_TYPE(cqe_fp_flags),
@@ -1634,6 +1647,10 @@ static int bnx2x_rx_int(struct bnx2x_fastpath *fp, int budget)
1634 1647
1635 bnx2x_tpa_start(fp, queue, skb, 1648 bnx2x_tpa_start(fp, queue, skb,
1636 bd_cons, bd_prod); 1649 bd_cons, bd_prod);
1650
1651 /* Set Toeplitz hash for an LRO skb */
1652 bnx2x_set_skb_rxhash(bp, cqe, skb);
1653
1637 goto next_rx; 1654 goto next_rx;
1638 } 1655 }
1639 1656
@@ -1726,11 +1743,8 @@ reuse_rx:
1726 1743
1727 skb->protocol = eth_type_trans(skb, bp->dev); 1744 skb->protocol = eth_type_trans(skb, bp->dev);
1728 1745
1729 if ((bp->dev->features & NETIF_F_RXHASH) && 1746 /* Set Toeplitz hash for a none-LRO skb */
1730 (cqe_fp_status_flags & 1747 bnx2x_set_skb_rxhash(bp, cqe, skb);
1731 ETH_FAST_PATH_RX_CQE_RSS_HASH_FLG))
1732 skb->rxhash = le32_to_cpu(
1733 cqe->fast_path_cqe.rss_hash_result);
1734 1748
1735 skb->ip_summed = CHECKSUM_NONE; 1749 skb->ip_summed = CHECKSUM_NONE;
1736 if (bp->rx_csum) { 1750 if (bp->rx_csum) {