[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 11 Nov 2009 10:19:21 -0800
From: Stephen Hemminger <shemminger@...tta.com>
To: Tom Herbert <therbert@...gle.com>
Cc: David Miller <davem@...emloft.net>, netdev@...r.kernel.org
Subject: Re: [PATCH 2/2] rps: changes to bnx2x to get device hash
On Tue, 10 Nov 2009 22:53:36 -0800
Tom Herbert <therbert@...gle.com> wrote:
> +
> + if (get_hdrhash && (cqe_fp_status_flags &
> + ETH_FAST_PATH_RX_CQE_RSS_HASH_FLG)) {
> + u8 hash_type = cqe_fp_status_flags &
> + ETH_FAST_PATH_RX_CQE_RSS_HASH_TYPE;
> +
> + skb->rxhash = le32_to_cpu(
> + cqe->fast_path_cqe.rss_hash_result);
> + if (!skb->rxhash)
> + skb->rxhash = 1;
> +
> + /* unicast IPv4 packet? */
> + if (((hash_type == IPV4_HASH_TYPE) ||
> + (hash_type == TCP_IPV4_HASH_TYPE)) &&
> + (cqe_fp_pars_flags &
> + PARSING_FLAGS_ETHERNET_ADDRESS_TYPE)) {
> + skb->dev = bp->dev;
> + skb_reset_mac_header(skb);
> + skb_pull(skb, ETH_HLEN);
> + skb->protocol =
> + __constant_htons(ETH_P_IP);
> + } else
> + skb->protocol =
> + eth_type_trans(skb, bp->dev);
> + } else
> + skb->protocol = eth_type_trans(skb, bp->dev);
How about putting this all in an inline function:
static inline u16 bn2x_get_type(...) {
}
skb->protocol = bn2x_get_type(...);
Then you won't have two calls to eth_type_trans,
Also: __constant_htons() should not be used directly (except switch statements),
macro for htons() does it automatically if argument is constant.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists