aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Herbert <therbert@google.com>2010-04-23 03:10:52 -0400
committerDavid S. Miller <davem@davemloft.net>2010-04-23 03:10:52 -0400
commitc68ed255265968c3948fa2678bf59d15c471b055 (patch)
treea5f325dd8380b461ea41fcc72be19ca8bd370041
parentefe91932e79cfe59a562b70d8eb18049b36debc6 (diff)
bnx2x: add support for receive hashing
Add support to bnx2x to extract Toeplitz hash out of the receive descriptor for use in skb->rxhash. Signed-off-by: Tom Herbert <therbert@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/bnx2x.h2
-rw-r--r--drivers/net/bnx2x_main.c26
2 files changed, 19 insertions, 9 deletions
diff --git a/drivers/net/bnx2x.h b/drivers/net/bnx2x.h
index 081953005b8..8bd23687c53 100644
--- a/drivers/net/bnx2x.h
+++ b/drivers/net/bnx2x.h
@@ -1330,7 +1330,7 @@ static inline u32 reg_poll(struct bnx2x *bp, u32 reg, u32 expected, int ms,
1330 AEU_INPUTS_ATTN_BITS_MCP_LATCHED_UMP_TX_PARITY | \ 1330 AEU_INPUTS_ATTN_BITS_MCP_LATCHED_UMP_TX_PARITY | \
1331 AEU_INPUTS_ATTN_BITS_MCP_LATCHED_SCPAD_PARITY) 1331 AEU_INPUTS_ATTN_BITS_MCP_LATCHED_SCPAD_PARITY)
1332 1332
1333#define MULTI_FLAGS(bp) \ 1333#define RSS_FLAGS(bp) \
1334 (TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV4_CAPABILITY | \ 1334 (TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV4_CAPABILITY | \
1335 TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV4_TCP_CAPABILITY | \ 1335 TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV4_TCP_CAPABILITY | \
1336 TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV6_CAPABILITY | \ 1336 TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV6_CAPABILITY | \
diff --git a/drivers/net/bnx2x_main.c b/drivers/net/bnx2x_main.c
index 0c6dba24e37..613f7274654 100644
--- a/drivers/net/bnx2x_main.c
+++ b/drivers/net/bnx2x_main.c
@@ -1582,7 +1582,7 @@ static int bnx2x_rx_int(struct bnx2x_fastpath *fp, int budget)
1582 struct sw_rx_bd *rx_buf = NULL; 1582 struct sw_rx_bd *rx_buf = NULL;
1583 struct sk_buff *skb; 1583 struct sk_buff *skb;
1584 union eth_rx_cqe *cqe; 1584 union eth_rx_cqe *cqe;
1585 u8 cqe_fp_flags; 1585 u8 cqe_fp_flags, cqe_fp_status_flags;
1586 u16 len, pad; 1586 u16 len, pad;
1587 1587
1588 comp_ring_cons = RCQ_BD(sw_comp_cons); 1588 comp_ring_cons = RCQ_BD(sw_comp_cons);
@@ -1598,6 +1598,7 @@ static int bnx2x_rx_int(struct bnx2x_fastpath *fp, int budget)
1598 1598
1599 cqe = &fp->rx_comp_ring[comp_ring_cons]; 1599 cqe = &fp->rx_comp_ring[comp_ring_cons];
1600 cqe_fp_flags = cqe->fast_path_cqe.type_error_flags; 1600 cqe_fp_flags = cqe->fast_path_cqe.type_error_flags;
1601 cqe_fp_status_flags = cqe->fast_path_cqe.status_flags;
1601 1602
1602 DP(NETIF_MSG_RX_STATUS, "CQE type %x err %x status %x" 1603 DP(NETIF_MSG_RX_STATUS, "CQE type %x err %x status %x"
1603 " queue %x vlan %x len %u\n", CQE_TYPE(cqe_fp_flags), 1604 " queue %x vlan %x len %u\n", CQE_TYPE(cqe_fp_flags),
@@ -1727,6 +1728,12 @@ reuse_rx:
1727 1728
1728 skb->protocol = eth_type_trans(skb, bp->dev); 1729 skb->protocol = eth_type_trans(skb, bp->dev);
1729 1730
1731 if ((bp->dev->features & ETH_FLAG_RXHASH) &&
1732 (cqe_fp_status_flags &
1733 ETH_FAST_PATH_RX_CQE_RSS_HASH_FLG))
1734 skb->rxhash = le32_to_cpu(
1735 cqe->fast_path_cqe.rss_hash_result);
1736
1730 skb->ip_summed = CHECKSUM_NONE; 1737 skb->ip_summed = CHECKSUM_NONE;
1731 if (bp->rx_csum) { 1738 if (bp->rx_csum) {
1732 if (likely(BNX2X_RX_CSUM_OK(cqe))) 1739 if (likely(BNX2X_RX_CSUM_OK(cqe)))
@@ -5750,10 +5757,10 @@ static void bnx2x_init_internal_func(struct bnx2x *bp)
5750 u32 offset; 5757 u32 offset;
5751 u16 max_agg_size; 5758 u16 max_agg_size;
5752 5759
5753 if (is_multi(bp)) { 5760 tstorm_config.config_flags = RSS_FLAGS(bp);
5754 tstorm_config.config_flags = MULTI_FLAGS(bp); 5761
5762 if (is_multi(bp))
5755 tstorm_config.rss_result_mask = MULTI_MASK; 5763 tstorm_config.rss_result_mask = MULTI_MASK;
5756 }
5757 5764
5758 /* Enable TPA if needed */ 5765 /* Enable TPA if needed */
5759 if (bp->flags & TPA_ENABLE_FLAG) 5766 if (bp->flags & TPA_ENABLE_FLAG)
@@ -6629,10 +6636,8 @@ static int bnx2x_init_common(struct bnx2x *bp)
6629 bnx2x_init_block(bp, PBF_BLOCK, COMMON_STAGE); 6636 bnx2x_init_block(bp, PBF_BLOCK, COMMON_STAGE);
6630 6637
6631 REG_WR(bp, SRC_REG_SOFT_RST, 1); 6638 REG_WR(bp, SRC_REG_SOFT_RST, 1);
6632 for (i = SRC_REG_KEYRSS0_0; i <= SRC_REG_KEYRSS1_9; i += 4) { 6639 for (i = SRC_REG_KEYRSS0_0; i <= SRC_REG_KEYRSS1_9; i += 4)
6633 REG_WR(bp, i, 0xc0cac01a); 6640 REG_WR(bp, i, random32());
6634 /* TODO: replace with something meaningful */
6635 }
6636 bnx2x_init_block(bp, SRCH_BLOCK, COMMON_STAGE); 6641 bnx2x_init_block(bp, SRCH_BLOCK, COMMON_STAGE);
6637#ifdef BCM_CNIC 6642#ifdef BCM_CNIC
6638 REG_WR(bp, SRC_REG_KEYSEARCH_0, 0x63285672); 6643 REG_WR(bp, SRC_REG_KEYSEARCH_0, 0x63285672);
@@ -11001,6 +11006,11 @@ static int bnx2x_set_flags(struct net_device *dev, u32 data)
11001 changed = 1; 11006 changed = 1;
11002 } 11007 }
11003 11008
11009 if (data & ETH_FLAG_RXHASH)
11010 dev->features |= NETIF_F_RXHASH;
11011 else
11012 dev->features &= ~NETIF_F_RXHASH;
11013
11004 if (changed && netif_running(dev)) { 11014 if (changed && netif_running(dev)) {
11005 bnx2x_nic_unload(bp, UNLOAD_NORMAL); 11015 bnx2x_nic_unload(bp, UNLOAD_NORMAL);
11006 rc = bnx2x_nic_load(bp, LOAD_NORMAL); 11016 rc = bnx2x_nic_load(bp, LOAD_NORMAL);