Skip to content

Commit ed1acc8

Browse files
edumazetdavem330
authored andcommitted
net-sysfs: get_netdev_queue_index() cleanup
Remove one inline keyword, and no need for a loop to find an index into a table. Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent a56cddd commit ed1acc8

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

net/core/net-sysfs.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -996,15 +996,12 @@ static struct attribute_group dql_group = {
996996
#endif /* CONFIG_BQL */
997997

998998
#ifdef CONFIG_XPS
999-
static inline unsigned int get_netdev_queue_index(struct netdev_queue *queue)
999+
static unsigned int get_netdev_queue_index(struct netdev_queue *queue)
10001000
{
10011001
struct net_device *dev = queue->dev;
1002-
int i;
1003-
1004-
for (i = 0; i < dev->num_tx_queues; i++)
1005-
if (queue == &dev->_tx[i])
1006-
break;
1002+
unsigned int i;
10071003

1004+
i = queue - dev->_tx;
10081005
BUG_ON(i >= dev->num_tx_queues);
10091006

10101007
return i;

0 commit comments

Comments
 (0)