Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/826677/?format=api
{ "id": 826677, "url": "http://patchwork.ozlabs.org/api/patches/826677/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20171017010128.22141-6-vinicius.gomes@intel.com/", "project": { "id": 46, "url": "http://patchwork.ozlabs.org/api/projects/46/?format=api", "name": "Intel Wired Ethernet development", "link_name": "intel-wired-lan", "list_id": "intel-wired-lan.osuosl.org", "list_email": "intel-wired-lan@osuosl.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20171017010128.22141-6-vinicius.gomes@intel.com>", "list_archive_url": null, "date": "2017-10-17T01:01:27", "name": "[next-queue,v9,5/6] net/sched: Add support for HW offloading for CBS", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "6acafaca226d513d849c4a559fc810d7ee788fd4", "submitter": { "id": 72272, "url": "http://patchwork.ozlabs.org/api/people/72272/?format=api", "name": "Vinicius Costa Gomes", "email": "vinicius.gomes@intel.com" }, "delegate": { "id": 68, "url": "http://patchwork.ozlabs.org/api/users/68/?format=api", "username": "jtkirshe", "first_name": "Jeff", "last_name": "Kirsher", "email": "jeffrey.t.kirsher@intel.com" }, "mbox": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20171017010128.22141-6-vinicius.gomes@intel.com/mbox/", "series": [ { "id": 8543, "url": "http://patchwork.ozlabs.org/api/series/8543/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=8543", "date": "2017-10-17T01:01:23", "name": "TSN: Add qdisc based config interface for CBS", "version": 9, "mbox": "http://patchwork.ozlabs.org/series/8543/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/826677/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/826677/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<intel-wired-lan-bounces@osuosl.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "intel-wired-lan@lists.osuosl.org" ], "Delivered-To": [ "patchwork-incoming@bilbo.ozlabs.org", "intel-wired-lan@lists.osuosl.org" ], "Authentication-Results": "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=osuosl.org\n\t(client-ip=140.211.166.133; helo=hemlock.osuosl.org;\n\tenvelope-from=intel-wired-lan-bounces@osuosl.org;\n\treceiver=<UNKNOWN>)", "Received": [ "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3yGH2v6b4Wz9t2Q\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 17 Oct 2017 12:01:59 +1100 (AEDT)", "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 5E65786E28;\n\tTue, 17 Oct 2017 01:01:58 +0000 (UTC)", "from hemlock.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id N7MRd2IxoClp; Tue, 17 Oct 2017 01:01:54 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 95B7E86DA6;\n\tTue, 17 Oct 2017 01:01:54 +0000 (UTC)", "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\tby ash.osuosl.org (Postfix) with ESMTP id F41F41CEF32\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tTue, 17 Oct 2017 01:01:47 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id E832086C4B\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tTue, 17 Oct 2017 01:01:47 +0000 (UTC)", "from hemlock.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id hdFXihN5CdXA for <intel-wired-lan@lists.osuosl.org>;\n\tTue, 17 Oct 2017 01:01:45 +0000 (UTC)", "from mga03.intel.com (mga03.intel.com [134.134.136.65])\n\tby hemlock.osuosl.org (Postfix) with ESMTPS id D9F3186D9A\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tTue, 17 Oct 2017 01:01:45 +0000 (UTC)", "from fmsmga002.fm.intel.com ([10.253.24.26])\n\tby orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t16 Oct 2017 18:01:45 -0700", "from ellie.jf.intel.com (HELO localhost.localdomain)\n\t([10.24.13.70])\n\tby fmsmga002.fm.intel.com with ESMTP; 16 Oct 2017 18:01:44 -0700" ], "X-Virus-Scanned": [ "amavisd-new at osuosl.org", "amavisd-new at osuosl.org" ], "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos; i=\"5.43,389,1503385200\"; d=\"scan'208\";\n\ta=\"1231539045\"", "From": "Vinicius Costa Gomes <vinicius.gomes@intel.com>", "To": "netdev@vger.kernel.org,\n\tintel-wired-lan@lists.osuosl.org", "Date": "Mon, 16 Oct 2017 18:01:27 -0700", "Message-Id": "<20171017010128.22141-6-vinicius.gomes@intel.com>", "X-Mailer": "git-send-email 2.14.2", "In-Reply-To": "<20171017010128.22141-1-vinicius.gomes@intel.com>", "References": "<20171017010128.22141-1-vinicius.gomes@intel.com>", "Cc": "rodney.cummings@ni.com, andre.guedes@intel.com, jiri@resnulli.us,\n\tivan.briano@intel.com, richardcochran@gmail.com, henrik@austad.us,\n\tjhs@mojatatu.com, levipearson@gmail.com, boon.leong.ong@intel.com,\n\txiyou.wangcong@gmail.com, jesus.sanchez-palencia@intel.com", "Subject": "[Intel-wired-lan] [next-queue PATCH v9 5/6] net/sched: Add support\n\tfor HW offloading for CBS", "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\n\t<intel-wired-lan.osuosl.org>", "List-Unsubscribe": "<https://lists.osuosl.org/mailman/options/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@osuosl.org?subject=unsubscribe>", "List-Archive": "<http://lists.osuosl.org/pipermail/intel-wired-lan/>", "List-Post": "<mailto:intel-wired-lan@osuosl.org>", "List-Help": "<mailto:intel-wired-lan-request@osuosl.org?subject=help>", "List-Subscribe": "<https://lists.osuosl.org/mailman/listinfo/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@osuosl.org?subject=subscribe>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Errors-To": "intel-wired-lan-bounces@osuosl.org", "Sender": "\"Intel-wired-lan\" <intel-wired-lan-bounces@osuosl.org>" }, "content": "This adds support for offloading the CBS algorithm to the controller,\nif supported. Drivers wanting to support CBS offload must implement\nthe .ndo_setup_tc callback and handle the TC_SETUP_CBS (introduced\nhere) type.\n\nSigned-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>\n---\n include/linux/netdevice.h | 1 +\n include/net/pkt_sched.h | 9 ++++\n net/sched/sch_cbs.c | 104 ++++++++++++++++++++++++++++++++++++++++------\n 3 files changed, 102 insertions(+), 12 deletions(-)", "diff": "diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h\nindex 31bb3010c69b..1f6c44ef5b21 100644\n--- a/include/linux/netdevice.h\n+++ b/include/linux/netdevice.h\n@@ -775,6 +775,7 @@ enum tc_setup_type {\n \tTC_SETUP_CLSFLOWER,\n \tTC_SETUP_CLSMATCHALL,\n \tTC_SETUP_CLSBPF,\n+\tTC_SETUP_CBS,\n };\n \n /* These structures hold the attributes of xdp state that are being passed\ndiff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h\nindex 259bc191ba59..7c597b050b36 100644\n--- a/include/net/pkt_sched.h\n+++ b/include/net/pkt_sched.h\n@@ -146,4 +146,13 @@ static inline bool is_classid_clsact_egress(u32 classid)\n \t TC_H_MIN(classid) == TC_H_MIN(TC_H_MIN_EGRESS);\n }\n \n+struct tc_cbs_qopt_offload {\n+\tu8 enable;\n+\ts32 queue;\n+\ts32 hicredit;\n+\ts32 locredit;\n+\ts32 idleslope;\n+\ts32 sendslope;\n+};\n+\n #endif\ndiff --git a/net/sched/sch_cbs.c b/net/sched/sch_cbs.c\nindex c0102b589494..cae021c642e5 100644\n--- a/net/sched/sch_cbs.c\n+++ b/net/sched/sch_cbs.c\n@@ -68,6 +68,8 @@\n #define BYTES_PER_KBIT (1000LL / 8)\n \n struct cbs_sched_data {\n+\tbool offload;\n+\tint queue;\n \ts64 port_rate; /* in bytes/s */\n \ts64 last; /* timestamp in ns */\n \ts64 credits; /* in bytes */\n@@ -80,6 +82,11 @@ struct cbs_sched_data {\n \tstruct sk_buff *(*dequeue)(struct Qdisc *sch);\n };\n \n+static int cbs_enqueue_offload(struct sk_buff *skb, struct Qdisc *sch)\n+{\n+\treturn qdisc_enqueue_tail(skb, sch);\n+}\n+\n static int cbs_enqueue_soft(struct sk_buff *skb, struct Qdisc *sch)\n {\n \tstruct cbs_sched_data *q = qdisc_priv(sch);\n@@ -169,6 +176,11 @@ static struct sk_buff *cbs_dequeue_soft(struct Qdisc *sch)\n \treturn skb;\n }\n \n+static struct sk_buff *cbs_dequeue_offload(struct Qdisc *sch)\n+{\n+\treturn qdisc_dequeue_head(sch);\n+}\n+\n static struct sk_buff *cbs_dequeue(struct Qdisc *sch)\n {\n \tstruct cbs_sched_data *q = qdisc_priv(sch);\n@@ -180,14 +192,66 @@ static const struct nla_policy cbs_policy[TCA_CBS_MAX + 1] = {\n \t[TCA_CBS_PARMS]\t= { .len = sizeof(struct tc_cbs_qopt) },\n };\n \n+static void cbs_disable_offload(struct net_device *dev,\n+\t\t\t\tstruct cbs_sched_data *q)\n+{\n+\tstruct tc_cbs_qopt_offload cbs = { };\n+\tconst struct net_device_ops *ops;\n+\tint err;\n+\n+\tif (!q->offload)\n+\t\treturn;\n+\n+\tq->enqueue = cbs_enqueue_soft;\n+\tq->dequeue = cbs_dequeue_soft;\n+\n+\tops = dev->netdev_ops;\n+\tif (!ops->ndo_setup_tc)\n+\t\treturn;\n+\n+\tcbs.queue = q->queue;\n+\tcbs.enable = 0;\n+\n+\terr = ops->ndo_setup_tc(dev, TC_SETUP_CBS, &cbs);\n+\tif (err < 0)\n+\t\tpr_warn(\"Couldn't disable CBS offload for queue %d\\n\",\n+\t\t\tcbs.queue);\n+}\n+\n+static int cbs_enable_offload(struct net_device *dev, struct cbs_sched_data *q,\n+\t\t\t const struct tc_cbs_qopt *opt)\n+{\n+\tconst struct net_device_ops *ops = dev->netdev_ops;\n+\tstruct tc_cbs_qopt_offload cbs = { };\n+\tint err;\n+\n+\tif (!ops->ndo_setup_tc)\n+\t\treturn -EOPNOTSUPP;\n+\n+\tcbs.queue = q->queue;\n+\n+\tcbs.enable = 1;\n+\tcbs.hicredit = opt->hicredit;\n+\tcbs.locredit = opt->locredit;\n+\tcbs.idleslope = opt->idleslope;\n+\tcbs.sendslope = opt->sendslope;\n+\n+\terr = ops->ndo_setup_tc(dev, TC_SETUP_CBS, &cbs);\n+\tif (err < 0)\n+\t\treturn err;\n+\n+\tq->enqueue = cbs_enqueue_offload;\n+\tq->dequeue = cbs_dequeue_offload;\n+\n+\treturn 0;\n+}\n+\n static int cbs_change(struct Qdisc *sch, struct nlattr *opt)\n {\n \tstruct cbs_sched_data *q = qdisc_priv(sch);\n \tstruct net_device *dev = qdisc_dev(sch);\n \tstruct nlattr *tb[TCA_CBS_MAX + 1];\n-\tstruct ethtool_link_ksettings ecmd;\n \tstruct tc_cbs_qopt *qopt;\n-\ts64 link_speed;\n \tint err;\n \n \terr = nla_parse_nested(tb, TCA_CBS_MAX, opt, cbs_policy, NULL);\n@@ -199,23 +263,30 @@ static int cbs_change(struct Qdisc *sch, struct nlattr *opt)\n \n \tqopt = nla_data(tb[TCA_CBS_PARMS]);\n \n-\tif (qopt->offload)\n-\t\treturn -EOPNOTSUPP;\n+\tif (!qopt->offload) {\n+\t\tstruct ethtool_link_ksettings ecmd;\n+\t\ts64 link_speed;\n \n-\tif (!__ethtool_get_link_ksettings(dev, &ecmd))\n-\t\tlink_speed = ecmd.base.speed;\n-\telse\n-\t\tlink_speed = SPEED_1000;\n+\t\tif (!__ethtool_get_link_ksettings(dev, &ecmd))\n+\t\t\tlink_speed = ecmd.base.speed;\n+\t\telse\n+\t\t\tlink_speed = SPEED_1000;\n \n-\tq->port_rate = link_speed * 1000 * BYTES_PER_KBIT;\n+\t\tq->port_rate = link_speed * 1000 * BYTES_PER_KBIT;\n \n-\tq->enqueue = cbs_enqueue_soft;\n-\tq->dequeue = cbs_dequeue_soft;\n+\t\tcbs_disable_offload(dev, q);\n+\t} else {\n+\t\terr = cbs_enable_offload(dev, q, qopt);\n+\t\tif (err < 0)\n+\t\t\treturn err;\n+\t}\n \n+\t/* Everything went OK, save the parameters used. */\n \tq->hicredit = qopt->hicredit;\n \tq->locredit = qopt->locredit;\n \tq->idleslope = qopt->idleslope * BYTES_PER_KBIT;\n \tq->sendslope = qopt->sendslope * BYTES_PER_KBIT;\n+\tq->offload = qopt->offload;\n \n \treturn 0;\n }\n@@ -223,10 +294,16 @@ static int cbs_change(struct Qdisc *sch, struct nlattr *opt)\n static int cbs_init(struct Qdisc *sch, struct nlattr *opt)\n {\n \tstruct cbs_sched_data *q = qdisc_priv(sch);\n+\tstruct net_device *dev = qdisc_dev(sch);\n \n \tif (!opt)\n \t\treturn -EINVAL;\n \n+\tq->queue = sch->dev_queue - netdev_get_tx_queue(dev, 0);\n+\n+\tq->enqueue = cbs_enqueue_soft;\n+\tq->dequeue = cbs_dequeue_soft;\n+\n \tqdisc_watchdog_init(&q->watchdog, sch);\n \n \treturn cbs_change(sch, opt);\n@@ -235,8 +312,11 @@ static int cbs_init(struct Qdisc *sch, struct nlattr *opt)\n static void cbs_destroy(struct Qdisc *sch)\n {\n \tstruct cbs_sched_data *q = qdisc_priv(sch);\n+\tstruct net_device *dev = qdisc_dev(sch);\n \n \tqdisc_watchdog_cancel(&q->watchdog);\n+\n+\tcbs_disable_offload(dev, q);\n }\n \n static int cbs_dump(struct Qdisc *sch, struct sk_buff *skb)\n@@ -253,7 +333,7 @@ static int cbs_dump(struct Qdisc *sch, struct sk_buff *skb)\n \topt.locredit = q->locredit;\n \topt.sendslope = q->sendslope / BYTES_PER_KBIT;\n \topt.idleslope = q->idleslope / BYTES_PER_KBIT;\n-\topt.offload = 0;\n+\topt.offload = q->offload;\n \n \tif (nla_put(skb, TCA_CBS_PARMS, sizeof(opt), &opt))\n \t\tgoto nla_put_failure;\n", "prefixes": [ "next-queue", "v9", "5/6" ] }