From patchwork Fri Oct 13 00:40:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinicius Costa Gomes X-Patchwork-Id: 825183 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=osuosl.org (client-ip=140.211.166.133; helo=hemlock.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=) Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yCpnQ1XRDz9sNw for ; Fri, 13 Oct 2017 11:41:46 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 8E5518879D; Fri, 13 Oct 2017 00:41:44 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id X0qnQmFs1h+x; Fri, 13 Oct 2017 00:41:41 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id 51E548795E; Fri, 13 Oct 2017 00:41:41 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 431461CEF06 for ; Fri, 13 Oct 2017 00:41:38 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 403E786F32 for ; Fri, 13 Oct 2017 00:41:38 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Y-zL2VVe5oVp for ; Fri, 13 Oct 2017 00:41:36 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by fraxinus.osuosl.org (Postfix) with ESMTPS id ADD5E86FEE for ; Fri, 13 Oct 2017 00:41:36 +0000 (UTC) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga104.jf.intel.com with ESMTP; 12 Oct 2017 17:41:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.43,368,1503385200"; d="scan'208"; a="1205300229" Received: from ellie.jf.intel.com (HELO localhost.localdomain) ([10.24.13.52]) by fmsmga001.fm.intel.com with ESMTP; 12 Oct 2017 17:41:35 -0700 From: Vinicius Costa Gomes To: netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org Date: Thu, 12 Oct 2017 17:40:02 -0700 Message-Id: <20171013004005.17416-4-vinicius.gomes@intel.com> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171013004005.17416-1-vinicius.gomes@intel.com> References: <20171013004005.17416-1-vinicius.gomes@intel.com> Cc: rodney.cummings@ni.com, andre.guedes@intel.com, jiri@resnulli.us, ivan.briano@intel.com, richardcochran@gmail.com, henrik@austad.us, jhs@mojatatu.com, levipearson@gmail.com, boon.leong.ong@intel.com, xiyou.wangcong@gmail.com, Jesus Sanchez-Palencia Subject: [Intel-wired-lan] [next-queue PATCH v7 3/6] net/sched: Add select_queue() class_ops for mqprio X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" From: Jesus Sanchez-Palencia When replacing a child qdisc from mqprio, tc_modify_qdisc() must fetch the netdev_queue pointer that the current child qdisc is associated with before creating the new qdisc. Currently, when using mqprio as root qdisc, the kernel will end up getting the queue #0 pointer from the mqprio (root qdisc), which leaves any new child qdisc with a possibly wrong netdev_queue pointer. Implementing the Qdisc_class_ops select_queue() on mqprio fixes this issue and avoid an inconsistent state when child qdiscs are replaced. Signed-off-by: Jesus Sanchez-Palencia --- net/sched/sch_mqprio.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/net/sched/sch_mqprio.c b/net/sched/sch_mqprio.c index 6bcdfe6e7b63..8c042ae323e3 100644 --- a/net/sched/sch_mqprio.c +++ b/net/sched/sch_mqprio.c @@ -396,6 +396,12 @@ static void mqprio_walk(struct Qdisc *sch, struct qdisc_walker *arg) } } +static struct netdev_queue *mqprio_select_queue(struct Qdisc *sch, + struct tcmsg *tcm) +{ + return mqprio_queue_get(sch, TC_H_MIN(tcm->tcm_parent)); +} + static const struct Qdisc_class_ops mqprio_class_ops = { .graft = mqprio_graft, .leaf = mqprio_leaf, @@ -403,6 +409,7 @@ static const struct Qdisc_class_ops mqprio_class_ops = { .walk = mqprio_walk, .dump = mqprio_dump_class, .dump_stats = mqprio_dump_class_stats, + .select_queue = mqprio_select_queue, }; static struct Qdisc_ops mqprio_qdisc_ops __read_mostly = {