Commit 5495ab75 authored by Tom Herbert's avatar Tom Herbert Committed by David S. Miller

bnx2x: cleanup skb_set_hash

Save pkt_hash_types in tpa structure.
Signed-off-by: default avatarTom Herbert <therbert@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4742e780
...@@ -472,7 +472,7 @@ struct bnx2x_agg_info { ...@@ -472,7 +472,7 @@ struct bnx2x_agg_info {
u16 vlan_tag; u16 vlan_tag;
u16 len_on_bd; u16 len_on_bd;
u32 rxhash; u32 rxhash;
bool l4_rxhash; enum pkt_hash_types rxhash_type;
u16 gro_size; u16 gro_size;
u16 full_page; u16 full_page;
}; };
......
...@@ -354,7 +354,7 @@ static inline void bnx2x_update_sge_prod(struct bnx2x_fastpath *fp, ...@@ -354,7 +354,7 @@ static inline void bnx2x_update_sge_prod(struct bnx2x_fastpath *fp,
*/ */
static u32 bnx2x_get_rxhash(const struct bnx2x *bp, static u32 bnx2x_get_rxhash(const struct bnx2x *bp,
const struct eth_fast_path_rx_cqe *cqe, const struct eth_fast_path_rx_cqe *cqe,
bool *l4_rxhash) enum pkt_hash_types *rxhash_type)
{ {
/* Get Toeplitz hash from CQE */ /* Get Toeplitz hash from CQE */
if ((bp->dev->features & NETIF_F_RXHASH) && if ((bp->dev->features & NETIF_F_RXHASH) &&
...@@ -362,11 +362,13 @@ static u32 bnx2x_get_rxhash(const struct bnx2x *bp, ...@@ -362,11 +362,13 @@ static u32 bnx2x_get_rxhash(const struct bnx2x *bp,
enum eth_rss_hash_type htype; enum eth_rss_hash_type htype;
htype = cqe->status_flags & ETH_FAST_PATH_RX_CQE_RSS_HASH_TYPE; htype = cqe->status_flags & ETH_FAST_PATH_RX_CQE_RSS_HASH_TYPE;
*l4_rxhash = (htype == TCP_IPV4_HASH_TYPE) || *rxhash_type = ((htype == TCP_IPV4_HASH_TYPE) ||
(htype == TCP_IPV6_HASH_TYPE); (htype == TCP_IPV6_HASH_TYPE)) ?
PKT_HASH_TYPE_L4 : PKT_HASH_TYPE_L3;
return le32_to_cpu(cqe->rss_hash_result); return le32_to_cpu(cqe->rss_hash_result);
} }
*l4_rxhash = false; *rxhash_type = PKT_HASH_TYPE_NONE;
return 0; return 0;
} }
...@@ -420,7 +422,7 @@ static void bnx2x_tpa_start(struct bnx2x_fastpath *fp, u16 queue, ...@@ -420,7 +422,7 @@ static void bnx2x_tpa_start(struct bnx2x_fastpath *fp, u16 queue,
tpa_info->tpa_state = BNX2X_TPA_START; tpa_info->tpa_state = BNX2X_TPA_START;
tpa_info->len_on_bd = le16_to_cpu(cqe->len_on_bd); tpa_info->len_on_bd = le16_to_cpu(cqe->len_on_bd);
tpa_info->placement_offset = cqe->placement_offset; tpa_info->placement_offset = cqe->placement_offset;
tpa_info->rxhash = bnx2x_get_rxhash(bp, cqe, &tpa_info->l4_rxhash); tpa_info->rxhash = bnx2x_get_rxhash(bp, cqe, &tpa_info->rxhash_type);
if (fp->mode == TPA_MODE_GRO) { if (fp->mode == TPA_MODE_GRO) {
u16 gro_size = le16_to_cpu(cqe->pkt_len_or_gro_seg_len); u16 gro_size = le16_to_cpu(cqe->pkt_len_or_gro_seg_len);
tpa_info->full_page = SGE_PAGES / gro_size * gro_size; 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,9 +730,7 @@ static void bnx2x_tpa_stop(struct bnx2x *bp, struct bnx2x_fastpath *fp,
skb_reserve(skb, pad + NET_SKB_PAD); skb_reserve(skb, pad + NET_SKB_PAD);
skb_put(skb, len); skb_put(skb, len);
skb_set_hash(skb, tpa_info->rxhash, skb_set_hash(skb, tpa_info->rxhash, tpa_info->rxhash_type);
tpa_info->l4_rxhash ?
PKT_HASH_TYPE_L4 : PKT_HASH_TYPE_L3);
skb->protocol = eth_type_trans(skb, bp->dev); skb->protocol = eth_type_trans(skb, bp->dev);
skb->ip_summed = CHECKSUM_UNNECESSARY; skb->ip_summed = CHECKSUM_UNNECESSARY;
...@@ -848,7 +848,7 @@ int bnx2x_rx_int(struct bnx2x_fastpath *fp, int budget) ...@@ -848,7 +848,7 @@ int bnx2x_rx_int(struct bnx2x_fastpath *fp, int budget)
u16 len, pad, queue; u16 len, pad, queue;
u8 *data; u8 *data;
u32 rxhash; u32 rxhash;
bool l4_rxhash; enum pkt_hash_types rxhash_type;
#ifdef BNX2X_STOP_ON_ERROR #ifdef BNX2X_STOP_ON_ERROR
if (unlikely(bp->panic)) if (unlikely(bp->panic))
...@@ -989,9 +989,8 @@ int bnx2x_rx_int(struct bnx2x_fastpath *fp, int budget) ...@@ -989,9 +989,8 @@ int bnx2x_rx_int(struct bnx2x_fastpath *fp, int budget)
skb->protocol = eth_type_trans(skb, bp->dev); skb->protocol = eth_type_trans(skb, bp->dev);
/* Set Toeplitz hash for a none-LRO skb */ /* Set Toeplitz hash for a none-LRO skb */
rxhash = bnx2x_get_rxhash(bp, cqe_fp, &l4_rxhash); rxhash = bnx2x_get_rxhash(bp, cqe_fp, &rxhash_type);
skb_set_hash(skb, rxhash, skb_set_hash(skb, rxhash, rxhash_type);
l4_rxhash ? PKT_HASH_TYPE_L4 : PKT_HASH_TYPE_L3);
skb_checksum_none_assert(skb); skb_checksum_none_assert(skb);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment