From: Ben Hutchings <bhutchings@solarflare.com>
To: "Michał Mirosław" <mirq-linux@rere.qmqm.pl>
Cc: netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>
Subject: Re: [RFT PATCH 7/9] ethtool: prepare for larger netdev_features_t type
Date: Mon, 20 Jun 2011 22:16:58 +0100 [thread overview]
Message-ID: <1308604618.2701.189.camel@bwh-desktop> (raw)
In-Reply-To: <852a74b9068b3be7413a65023f6096f142dfd805.1308596963.git.mirq-linux@rere.qmqm.pl>
On Mon, 2011-06-20 at 21:14 +0200, Michał Mirosław wrote:
[...]
> @@ -125,19 +131,26 @@ static int ethtool_set_features(struct net_device *dev, void __user *useraddr)
> if (copy_from_user(features, useraddr, sizeof(features)))
> return -EFAULT;
>
> - if (features[0].valid & ~NETIF_F_ETHTOOL_BITS)
> + /* I wonder if the compiler will be smart enough to loop-unroll
> + * and optimize this... (no worries if not) --mq */
> + for (i = ETHTOOL_DEV_FEATURE_WORDS; i-- > 0; ) {
> + valid = (valid << 32)|features[i].valid;
> + wanted = (wanted << 32)|features[i].requested;
> + }
[...]
I don't know (or care) about optimisation of this, but I would expect
gcc to complain about shifting a 32-bit value by 32 bits. I suggest you
write this as:
for (i = 0; i < ETHTOOL_DEV_FEATURE_WORDS; ++i) {
valid |= (netdev_features_t)features[i].valid << 32 *i;
wanted |= (netdev_features_t)features[i].requested << 32 *i;
}
Ben.
--
Ben Hutchings, Senior Software Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
next prev parent reply other threads:[~2011-06-20 21:17 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-20 19:14 [RFT PATCH 0/9] Cleanup and extension of netdev features Michał Mirosław
2011-06-20 19:14 ` [RFT PATCH 4/9] net: introduce and use netdev_features_t for device features sets Michał Mirosław
2011-06-20 21:01 ` Ben Hutchings
2011-06-20 19:14 ` [RFT PATCH 2/9] net: remove legacy ethtool ops Michał Mirosław
2011-06-20 19:14 ` [RFT PATCH 3/9] net: ethtool: break association of ETH_FLAG_* with NETIF_F_* Michał Mirosław
2011-06-20 20:11 ` Ben Hutchings
2011-06-20 20:27 ` David Miller
2011-06-20 20:51 ` Stephen Hemminger
2011-06-20 20:52 ` David Miller
2011-06-20 21:30 ` Ben Hutchings
2011-06-20 19:14 ` [RFT PATCH 5/9] net: Define enum for net device features Michał Mirosław
2011-06-20 19:14 ` [RFT PATCH 7/9] ethtool: prepare for larger netdev_features_t type Michał Mirosław
2011-06-20 21:16 ` Ben Hutchings [this message]
2011-06-23 17:50 ` Mahesh Bandewar
2011-06-23 18:03 ` Ben Hutchings
2011-06-23 18:21 ` Mahesh Bandewar
2011-06-23 18:55 ` Ben Hutchings
2011-06-23 20:38 ` Mahesh Bandewar
2011-06-20 19:14 ` [RFT PATCH 8/9] net: extend netdev_features_t to 64 bits Michał Mirosław
2011-06-20 19:14 ` [RFT PATCH 9/9] net: move NOCACHE_COPY checks to netdev_fix_features() Michał Mirosław
2011-06-20 19:14 ` [RFT PATCH 6/9] net: ethtool: use C99 array initialization for feature-names table Michał Mirosław
2011-06-20 19:35 ` [RFT PATCH 0/9] Cleanup and extension of netdev features David Miller
2011-06-20 19:47 ` Michał Mirosław
2011-06-20 19:55 ` [IGNORE PATCH 1/9] Intel net drivers: convert to ndo_fix_features Michał Mirosław
2011-06-21 21:43 ` [RFT PATCH 0/9] Cleanup and extension of netdev features Ben Greear
2011-06-21 21:52 ` Ben Hutchings
2011-06-21 23:27 ` Jeff Kirsher
2011-06-23 17:42 ` Mahesh Bandewar
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=1308604618.2701.189.camel@bwh-desktop \
--to=bhutchings@solarflare.com \
--cc=davem@davemloft.net \
--cc=mirq-linux@rere.qmqm.pl \
--cc=netdev@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.