[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1389898650.11912.65.camel@bwh-desktop.uk.level5networks.com>
Date: Thu, 16 Jan 2014 18:57:30 +0000
From: Ben Hutchings <bhutchings@...arflare.com>
To: Michael Dalton <mwdalton@...gle.com>
CC: "David S. Miller" <davem@...emloft.net>, <netdev@...r.kernel.org>,
"Eric Dumazet" <edumazet@...gle.com>,
Rusty Russell <rusty@...tcorp.com.au>,
"Michael S. Tsirkin" <mst@...hat.com>,
Jason Wang <jasowang@...hat.com>,
<virtualization@...ts.linux-foundation.org>
Subject: Re: [PATCH net-next v3 4/5] net-sysfs: add support for
device-specific rx queue sysfs attributes
On Thu, 2014-01-16 at 01:38 -0800, Michael Dalton wrote:
[...]
> --- a/include/linux/netdevice.h
> +++ b/include/linux/netdevice.h
[...]
> @@ -2401,6 +2416,23 @@ static inline int netif_copy_real_num_queues(struct net_device *to_dev,
> #endif
> }
>
> +#ifdef CONFIG_SYSFS
> +static inline unsigned int get_netdev_rx_queue_index(
> + struct netdev_rx_queue *queue)
> +{
> + struct net_device *dev = queue->dev;
> + int i;
> +
> + for (i = 0; i < dev->num_rx_queues; i++)
> + if (queue == &dev->_rx[i])
> + break;
Why write a loop when you can do:
i = queue - dev->_rx;
Ben.
> + BUG_ON(i >= dev->num_rx_queues);
> +
> + return i;
> +}
> +#endif
--
Ben Hutchings, Staff 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.
--
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