netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vedang Patel <vedang.patel@intel.com>
To: netdev@vger.kernel.org
Cc: jhs@mojatatu.com, xiyou.wangcong@gmail.com, jiri@resnulli.us,
	stephen@networkplumber.org, vinicius.gomes@intel.com,
	leandro.maciel.dorileo@intel.com
Subject: [PATCH iproute2 net-next v1 3/6] taprio: Add support for enabling offload mode
Date: Tue, 28 May 2019 10:52:51 -0700	[thread overview]
Message-ID: <1559065974-28521-3-git-send-email-vedang.patel@intel.com> (raw)
In-Reply-To: <1559065974-28521-1-git-send-email-vedang.patel@intel.com>

From: Vinicius Costa Gomes <vinicius.gomes@intel.com>

This allows a new parameter to be passed to taprio, "offload",
accepting a hexadecimal number which selects the offloading flags
thats should be enabled.

Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
---
 tc/q_taprio.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/tc/q_taprio.c b/tc/q_taprio.c
index 62c8c591..69e52ff5 100644
--- a/tc/q_taprio.c
+++ b/tc/q_taprio.c
@@ -154,6 +154,7 @@ static struct sched_entry *create_entry(uint32_t gatemask, uint32_t interval, ui
 static int taprio_parse_opt(struct qdisc_util *qu, int argc,
 			    char **argv, struct nlmsghdr *n, const char *dev)
 {
+	__u32 offload_flags = UINT32_MAX;
 	__s32 clockid = CLOCKID_INVALID;
 	struct tc_mqprio_qopt opt = { };
 	__s64 cycle_time_extension = 0;
@@ -281,6 +282,17 @@ static int taprio_parse_opt(struct qdisc_util *qu, int argc,
 				explain_clockid(*argv);
 				return -1;
 			}
+		} else if (strcmp(*argv, "offload") == 0) {
+			NEXT_ARG();
+			if (offload_flags != UINT32_MAX) {
+				fprintf(stderr, "taprio: duplicate \"offload\" specification\n");
+				return -1;
+			}
+			if (get_u32(&offload_flags, *argv, 0)) {
+				PREV_ARG();
+				return -1;
+			}
+
 		} else if (strcmp(*argv, "help") == 0) {
 			explain();
 			return -1;
@@ -297,6 +309,9 @@ static int taprio_parse_opt(struct qdisc_util *qu, int argc,
 	if (clockid != CLOCKID_INVALID)
 		addattr_l(n, 1024, TCA_TAPRIO_ATTR_SCHED_CLOCKID, &clockid, sizeof(clockid));
 
+	if (offload_flags != UINT32_MAX)
+		addattr_l(n, 1024, TCA_TAPRIO_ATTR_OFFLOAD_FLAGS, &offload_flags, sizeof(offload_flags));
+
 	if (opt.num_tc > 0)
 		addattr_l(n, 1024, TCA_TAPRIO_ATTR_PRIOMAP, &opt, sizeof(opt));
 
@@ -405,6 +420,7 @@ static int taprio_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
 	struct rtattr *tb[TCA_TAPRIO_ATTR_MAX + 1];
 	struct tc_mqprio_qopt *qopt = 0;
 	__s32 clockid = CLOCKID_INVALID;
+	__u32 offload_flags = 0;
 	int i;
 
 	if (opt == NULL)
@@ -442,6 +458,11 @@ static int taprio_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
 
 	print_string(PRINT_ANY, "clockid", "clockid %s", get_clock_name(clockid));
 
+	if (tb[TCA_TAPRIO_ATTR_OFFLOAD_FLAGS])
+		offload_flags = rta_getattr_u32(tb[TCA_TAPRIO_ATTR_OFFLOAD_FLAGS]);
+
+	print_uint(PRINT_ANY, "offload", " offload %x", offload_flags);
+
 	print_schedule(f, tb);
 
 	if (tb[TCA_TAPRIO_ATTR_ADMIN_SCHED]) {
-- 
2.17.0


  parent reply	other threads:[~2019-05-28 17:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-28 17:52 [PATCH iproute2 net-next v1 1/6] Kernel header update for hardware offloading changes Vedang Patel
2019-05-28 17:52 ` [PATCH iproute2 net-next v1 2/6] etf: Add skip_sock_check Vedang Patel
2019-05-28 17:52 ` Vedang Patel [this message]
2019-05-28 17:52 ` [PATCH iproute2 net-next v1 4/6] taprio: add support for setting txtime_delay Vedang Patel
2019-05-28 17:52 ` [PATCH iproute2 net-next v1 5/6] tc: etf: Add documentation for skip-skb-check Vedang Patel
2019-05-28 17:52 ` [PATCH iproute2 net-next v1 6/6] tc: taprio: Update documentation Vedang Patel
2019-06-06 17:52 [PATCH iproute2 net-next v1 1/6] Kernel header update for hardware offloading changes Vedang Patel
2019-06-06 17:52 ` [PATCH iproute2 net-next v1 3/6] taprio: Add support for enabling offload mode Vedang Patel
2019-06-06 19:43   ` Stephen Hemminger
2019-06-06 21:13     ` Patel, Vedang
2019-06-06 21:46       ` Stephen Hemminger
2019-06-06 22:22         ` Patel, Vedang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1559065974-28521-3-git-send-email-vedang.patel@intel.com \
    --to=vedang.patel@intel.com \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --cc=leandro.maciel.dorileo@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.org \
    --cc=vinicius.gomes@intel.com \
    --cc=xiyou.wangcong@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).