Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 87E61C282DE for ; Wed, 10 Apr 2019 00:33:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 605A520857 for ; Wed, 10 Apr 2019 00:33:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727002AbfDJAdk (ORCPT ); Tue, 9 Apr 2019 20:33:40 -0400 Received: from mga04.intel.com ([192.55.52.120]:12108 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726805AbfDJAdi (ORCPT ); Tue, 9 Apr 2019 20:33:38 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Apr 2019 17:33:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,331,1549958400"; d="scan'208";a="222052670" Received: from ellie.jf.intel.com ([10.54.70.67]) by orsmga001.jf.intel.com with ESMTP; 09 Apr 2019 17:33:34 -0700 From: Vinicius Costa Gomes To: netdev@vger.kernel.org Cc: Vinicius Costa Gomes , jhs@mojatatu.com, xiyou.wangcong@gmail.com, jiri@resnulli.us, olteanv@gmail.com, timo.koskiahde@tttech.com, m-karicheri2@ti.com Subject: [RFC net-next v1 5/6] taprio: Add support for frame-preemption Date: Tue, 9 Apr 2019 17:33:04 -0700 Message-Id: <20190410003305.24646-6-vinicius.gomes@intel.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190410003305.24646-1-vinicius.gomes@intel.com> References: <20190410003305.24646-1-vinicius.gomes@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Frame preemption can be used to further reduce the latency of network communications, so some kinds of traffic can be preempted by higher priorities ones. This is a hardware only feature. Frame-preemption is in relation to transmission queues, if the nth bit of the frame-preemption mask is enabled, it means that traffic going through the nth TX queue can be preempted by higher priorities queues. This only has any effect when offloading is enabled. Signed-off-by: Vinicius Costa Gomes --- include/uapi/linux/pkt_sched.h | 1 + net/sched/sch_taprio.c | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/include/uapi/linux/pkt_sched.h b/include/uapi/linux/pkt_sched.h index 8b2f993cbb77..a04df9a76864 100644 --- a/include/uapi/linux/pkt_sched.h +++ b/include/uapi/linux/pkt_sched.h @@ -1169,6 +1169,7 @@ enum { TCA_TAPRIO_ATTR_ADMIN_SCHED, /* The admin sched, only used in dump */ TCA_TAPRIO_ATTR_SCHED_CYCLE_TIME, /* s64 */ TCA_TAPRIO_ATTR_SCHED_CYCLE_TIME_EXTENSION, /* s64 */ + TCA_TAPRIO_ATTR_FRAME_PREEMPTION, /* u32 */ __TCA_TAPRIO_ATTR_MAX, }; diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c index 3807aacde26b..0a815700c9cc 100644 --- a/net/sched/sch_taprio.c +++ b/net/sched/sch_taprio.c @@ -46,6 +46,7 @@ struct sched_gate_list { s64 cycle_time; s64 cycle_time_extension; s64 base_time; + u32 frame_preemption; }; struct taprio_sched { @@ -387,6 +388,7 @@ static const struct nla_policy taprio_policy[TCA_TAPRIO_ATTR_MAX + 1] = { [TCA_TAPRIO_ATTR_SCHED_CLOCKID] = { .type = NLA_S32 }, [TCA_TAPRIO_ATTR_SCHED_CYCLE_TIME] = { .type = NLA_S64 }, [TCA_TAPRIO_ATTR_SCHED_CYCLE_TIME_EXTENSION] = { .type = NLA_S64 }, + [TCA_TAPRIO_ATTR_FRAME_PREEMPTION] = { .type = NLA_U32 }, }; static int fill_sched_entry(struct nlattr **tb, struct sched_entry *entry, @@ -494,6 +496,9 @@ static int parse_taprio_schedule(struct nlattr **tb, if (tb[TCA_TAPRIO_ATTR_SCHED_CYCLE_TIME]) new->cycle_time = nla_get_s64(tb[TCA_TAPRIO_ATTR_SCHED_CYCLE_TIME]); + if (tb[TCA_TAPRIO_ATTR_FRAME_PREEMPTION]) + new->frame_preemption = nla_get_u32(tb[TCA_TAPRIO_ATTR_FRAME_PREEMPTION]); + if (tb[TCA_TAPRIO_ATTR_SCHED_ENTRY_LIST]) err = parse_sched_list( tb[TCA_TAPRIO_ATTR_SCHED_ENTRY_LIST], new, extack); @@ -971,6 +976,10 @@ static int dump_schedule(struct sk_buff *msg, root->cycle_time_extension, TCA_TAPRIO_PAD)) return -1; + if (nla_put_u32(msg, TCA_TAPRIO_ATTR_FRAME_PREEMPTION, + root->frame_preemption)) + return -1; + entry_list = nla_nest_start(msg, TCA_TAPRIO_ATTR_SCHED_ENTRY_LIST); if (!entry_list) goto error_nest; -- 2.21.0