From: Stephen Hemminger <shemminger@vyatta.com>
To: Tom Herbert <therbert@google.com>
Cc: David Miller <davem@davemloft.net>, netdev@vger.kernel.org
Subject: Re: [PATCH 2/2] rps: changes to bnx2x to get device hash
Date: Wed, 11 Nov 2009 10:19:21 -0800 [thread overview]
Message-ID: <20091111101921.448d5f05@s6510> (raw)
In-Reply-To: <65634d660911102253lbfc0927i4e4c0eba6d7d765d@mail.gmail.com>
On Tue, 10 Nov 2009 22:53:36 -0800
Tom Herbert <therbert@google.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.
next prev parent reply other threads:[~2009-11-11 18:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-11 6:53 [PATCH 2/2] rps: changes to bnx2x to get device hash Tom Herbert
2009-11-11 18:19 ` Stephen Hemminger [this message]
2009-11-11 23:21 ` Matt Carlson
2009-11-12 2:42 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20091111101921.448d5f05@s6510 \
--to=shemminger@vyatta.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=therbert@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).