From patchwork Thu Oct 12 00:54:46 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: 824636 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3yCCGv102Lz9s9Y for ; Thu, 12 Oct 2017 12:01:43 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754530AbdJLBB1 (ORCPT ); Wed, 11 Oct 2017 21:01:27 -0400 Received: from mga11.intel.com ([192.55.52.93]:36598 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752801AbdJLA6a (ORCPT ); Wed, 11 Oct 2017 20:58:30 -0400 Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Oct 2017 17:58:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.43,363,1503385200"; d="scan'208";a="161680414" Received: from ellie.jf.intel.com (HELO localhost.localdomain) ([10.24.13.72]) by fmsmga005.fm.intel.com with ESMTP; 11 Oct 2017 17:58:28 -0700 From: Vinicius Costa Gomes To: netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org Cc: Jesus Sanchez-Palencia , jhs@mojatatu.com, xiyou.wangcong@gmail.com, jiri@resnulli.us, andre.guedes@intel.com, ivan.briano@intel.com, boon.leong.ong@intel.com, richardcochran@gmail.com, henrik@austad.us, levipearson@gmail.com, rodney.cummings@ni.com Subject: [next-queue PATCH v6 2/5] mqprio: Implement select_queue class_ops Date: Wed, 11 Oct 2017 17:54:46 -0700 Message-Id: <20171012005449.26533-3-vinicius.gomes@intel.com> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171012005449.26533-1-vinicius.gomes@intel.com> References: <20171012005449.26533-1-vinicius.gomes@intel.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 = {