diff options
author | Tom Herbert <therbert@google.com> | 2013-12-19 11:59:08 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-12-19 19:16:22 -0500 |
commit | 5495ab75097558e650109c701f82325af5c4ee4f (patch) | |
tree | 187199178b6c0496f267e864b40121a0d21c9d0f | |
parent | 4742e7808ab4bfdb386526c1a2b3ae09372236c3 (diff) |
bnx2x: cleanup skb_set_hash
Save pkt_hash_types in tpa structure.
Signed-off-by: Tom Herbert <therbert@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/broadcom/bnx2x/bnx2x.h | 2 | ||||
-rw-r--r-- | drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 23 |
2 files changed, 12 insertions, 13 deletions
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h index a1f66e2c9a86..a6d840684731 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h | |||
@@ -472,7 +472,7 @@ struct bnx2x_agg_info { | |||
472 | u16 vlan_tag; | 472 | u16 vlan_tag; |
473 | u16 len_on_bd; | 473 | u16 len_on_bd; |
474 | u32 rxhash; | 474 | u32 rxhash; |
475 | bool l4_rxhash; | 475 | enum pkt_hash_types rxhash_type; |
476 | u16 gro_size; | 476 | u16 gro_size; |
477 | u16 full_page; | 477 | u16 full_page; |
478 | }; | 478 | }; |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c index 787fef6c6618..37b203b7a5b3 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | |||
@@ -354,7 +354,7 @@ static inline void bnx2x_update_sge_prod(struct bnx2x_fastpath *fp, | |||
354 | */ | 354 | */ |
355 | static u32 bnx2x_get_rxhash(const struct bnx2x *bp, | 355 | static u32 bnx2x_get_rxhash(const struct bnx2x *bp, |
356 | const struct eth_fast_path_rx_cqe *cqe, | 356 | const struct eth_fast_path_rx_cqe *cqe, |
357 | bool *l4_rxhash) | 357 | enum pkt_hash_types *rxhash_type) |
358 | { | 358 | { |
359 | /* Get Toeplitz hash from CQE */ | 359 | /* Get Toeplitz hash from CQE */ |
360 | if ((bp->dev->features & NETIF_F_RXHASH) && | 360 | if ((bp->dev->features & NETIF_F_RXHASH) && |
@@ -362,11 +362,13 @@ static u32 bnx2x_get_rxhash(const struct bnx2x *bp, | |||
362 | enum eth_rss_hash_type htype; | 362 | enum eth_rss_hash_type htype; |
363 | 363 | ||
364 | htype = cqe->status_flags & ETH_FAST_PATH_RX_CQE_RSS_HASH_TYPE; | 364 | htype = cqe->status_flags & ETH_FAST_PATH_RX_CQE_RSS_HASH_TYPE; |
365 | *l4_rxhash = (htype == TCP_IPV4_HASH_TYPE) || | 365 | *rxhash_type = ((htype == TCP_IPV4_HASH_TYPE) || |
366 | (htype == TCP_IPV6_HASH_TYPE); | 366 | (htype == TCP_IPV6_HASH_TYPE)) ? |
367 | PKT_HASH_TYPE_L4 : PKT_HASH_TYPE_L3; | ||
368 | |||
367 | return le32_to_cpu(cqe->rss_hash_result); | 369 | return le32_to_cpu(cqe->rss_hash_result); |
368 | } | 370 | } |
369 | *l4_rxhash = false; | 371 | *rxhash_type = PKT_HASH_TYPE_NONE; |
370 | return 0; | 372 | return 0; |
371 | } | 373 | } |
372 | 374 | ||
@@ -420,7 +422,7 @@ static void bnx2x_tpa_start(struct bnx2x_fastpath *fp, u16 queue, | |||
420 | tpa_info->tpa_state = BNX2X_TPA_START; | 422 | tpa_info->tpa_state = BNX2X_TPA_START; |
421 | tpa_info->len_on_bd = le16_to_cpu(cqe->len_on_bd); | 423 | tpa_info->len_on_bd = le16_to_cpu(cqe->len_on_bd); |
422 | tpa_info->placement_offset = cqe->placement_offset; | 424 | tpa_info->placement_offset = cqe->placement_offset; |
423 | tpa_info->rxhash = bnx2x_get_rxhash(bp, cqe, &tpa_info->l4_rxhash); | 425 | tpa_info->rxhash = bnx2x_get_rxhash(bp, cqe, &tpa_info->rxhash_type); |
424 | if (fp->mode == TPA_MODE_GRO) { | 426 | if (fp->mode == TPA_MODE_GRO) { |
425 | u16 gro_size = le16_to_cpu(cqe->pkt_len_or_gro_seg_len); | 427 | u16 gro_size = le16_to_cpu(cqe->pkt_len_or_gro_seg_len); |
426 | tpa_info->full_page = SGE_PAGES / gro_size * gro_size; | 428 | tpa_info->full_page = SGE_PAGES / gro_size * gro_size; |
@@ -728,9 +730,7 @@ static void bnx2x_tpa_stop(struct bnx2x *bp, struct bnx2x_fastpath *fp, | |||
728 | 730 | ||
729 | skb_reserve(skb, pad + NET_SKB_PAD); | 731 | skb_reserve(skb, pad + NET_SKB_PAD); |
730 | skb_put(skb, len); | 732 | skb_put(skb, len); |
731 | skb_set_hash(skb, tpa_info->rxhash, | 733 | skb_set_hash(skb, tpa_info->rxhash, tpa_info->rxhash_type); |
732 | tpa_info->l4_rxhash ? | ||
733 | PKT_HASH_TYPE_L4 : PKT_HASH_TYPE_L3); | ||
734 | 734 | ||
735 | skb->protocol = eth_type_trans(skb, bp->dev); | 735 | skb->protocol = eth_type_trans(skb, bp->dev); |
736 | skb->ip_summed = CHECKSUM_UNNECESSARY; | 736 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
@@ -848,7 +848,7 @@ int bnx2x_rx_int(struct bnx2x_fastpath *fp, int budget) | |||
848 | u16 len, pad, queue; | 848 | u16 len, pad, queue; |
849 | u8 *data; | 849 | u8 *data; |
850 | u32 rxhash; | 850 | u32 rxhash; |
851 | bool l4_rxhash; | 851 | enum pkt_hash_types rxhash_type; |
852 | 852 | ||
853 | #ifdef BNX2X_STOP_ON_ERROR | 853 | #ifdef BNX2X_STOP_ON_ERROR |
854 | if (unlikely(bp->panic)) | 854 | if (unlikely(bp->panic)) |
@@ -989,9 +989,8 @@ reuse_rx: | |||
989 | skb->protocol = eth_type_trans(skb, bp->dev); | 989 | skb->protocol = eth_type_trans(skb, bp->dev); |
990 | 990 | ||
991 | /* Set Toeplitz hash for a none-LRO skb */ | 991 | /* Set Toeplitz hash for a none-LRO skb */ |
992 | rxhash = bnx2x_get_rxhash(bp, cqe_fp, &l4_rxhash); | 992 | rxhash = bnx2x_get_rxhash(bp, cqe_fp, &rxhash_type); |
993 | skb_set_hash(skb, rxhash, | 993 | skb_set_hash(skb, rxhash, rxhash_type); |
994 | l4_rxhash ? PKT_HASH_TYPE_L4 : PKT_HASH_TYPE_L3); | ||
995 | 994 | ||
996 | skb_checksum_none_assert(skb); | 995 | skb_checksum_none_assert(skb); |
997 | 996 | ||