Skip to content

Commit c4047f5

Browse files
Thadeu Lima de Souza Cascardodavem330
authored andcommitted
net-sysfs: get_netdev_queue_index() cleanup
Redo commit ed1acc8. Commit 822b3b2 ("net: Add max rate tx queue attribute") moved get_netdev_queue_index around, but kept the old version. Probably because of a reuse of the original patch from before Eric's change to that function. Remove one inline keyword, and no need for a loop to find an index into a table. Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@redhat.com> Fixes: 822b3b2 ("net: Add max rate tx queue attribute") Acked-by: Or Gerlitz <ogerlitz@mellanox.com> Acked-by: John Fastabend <john.r.fastabend@intel.com> Cc: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent d24c8f2 commit c4047f5

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
@@ -1004,15 +1004,12 @@ static ssize_t show_trans_timeout(struct netdev_queue *queue,
10041004
}
10051005

10061006
#ifdef CONFIG_XPS
1007-
static inline unsigned int get_netdev_queue_index(struct netdev_queue *queue)
1007+
static unsigned int get_netdev_queue_index(struct netdev_queue *queue)
10081008
{
10091009
struct net_device *dev = queue->dev;
1010-
int i;
1011-
1012-
for (i = 0; i < dev->num_tx_queues; i++)
1013-
if (queue == &dev->_tx[i])
1014-
break;
1010+
unsigned int i;
10151011

1012+
i = queue - dev->_tx;
10161013
BUG_ON(i >= dev->num_tx_queues);
10171014

10181015
return i;

0 commit comments

Comments
 (0)