From patchwork Fri Sep 11 20:08:39 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thadeu Lima de Souza Cascardo X-Patchwork-Id: 517005 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id F1B5B1400CB for ; Sat, 12 Sep 2015 06:09:05 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753886AbbIKUJA (ORCPT ); Fri, 11 Sep 2015 16:09:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51386 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752004AbbIKUI7 (ORCPT ); Fri, 11 Sep 2015 16:08:59 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id 5937E46264; Fri, 11 Sep 2015 20:08:59 +0000 (UTC) Received: from indiana.gru.redhat.com ([10.3.113.18]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t8BK8uav000484; Fri, 11 Sep 2015 16:08:57 -0400 From: Thadeu Lima de Souza Cascardo To: netdev@vger.kernel.org Cc: Thadeu Lima de Souza Cascardo , Or Gerlitz , John Fastabend , Eric Dumazet Subject: [PATCH] net-sysfs: get_netdev_queue_index() cleanup Date: Fri, 11 Sep 2015 17:08:39 -0300 Message-Id: <1442002119-15823-1-git-send-email-cascardo@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Redo commit ed1acc8cd8c22efa919da8d300bab646e01c2dce. Commit 822b3b2ebfff8e9b3d006086c527738a7ca00cd0 ("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 Fixes: 822b3b2ebfff8e9b3d006086c527738a7ca00cd0 Cc: Or Gerlitz Cc: John Fastabend Cc: Eric Dumazet Acked-by: John Fastabend Acked-by: Or Gerlitz --- Not sure what is the best way to credit Eric Dumazet here. I assume he will add any appropriate tags. --- net/core/net-sysfs.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c index b279077..49b5990 100644 --- a/net/core/net-sysfs.c +++ b/net/core/net-sysfs.c @@ -1004,15 +1004,12 @@ static ssize_t show_trans_timeout(struct netdev_queue *queue, } #ifdef CONFIG_XPS -static inline unsigned int get_netdev_queue_index(struct netdev_queue *queue) +static unsigned int get_netdev_queue_index(struct netdev_queue *queue) { struct net_device *dev = queue->dev; - int i; - - for (i = 0; i < dev->num_tx_queues; i++) - if (queue == &dev->_tx[i]) - break; + unsigned int i; + i = queue - dev->_tx; BUG_ON(i >= dev->num_tx_queues); return i;