netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Roi Dayan <roid@mellanox.com>
To: netdev@vger.kernel.org
Cc: David Ahern <dsahern@gmail.com>,
	Stephen Hemminger <stephen@networkplumber.org>,
	Jiri Pirko <jiri@mellanox.com>,
	Eli Britstein <elibr@mellanox.com>, Roi Dayan <roid@mellanox.com>
Subject: [PATCH iproute2-next 7/8] tc_util: add functions for big endian masked numbers
Date: Tue, 12 Nov 2019 16:51:53 +0200	[thread overview]
Message-ID: <20191112145154.145289-8-roid@mellanox.com> (raw)
In-Reply-To: <20191112145154.145289-1-roid@mellanox.com>

From: Eli Britstein <elibr@mellanox.com>

Add functions for big endian masked numbers as a pre-step towards masked
port numbers.

Signed-off-by: Eli Britstein <elibr@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
---
 tc/tc_util.c | 12 ++++++++++++
 tc/tc_util.h |  2 ++
 2 files changed, 14 insertions(+)

diff --git a/tc/tc_util.c b/tc/tc_util.c
index 13834234665f..b58e6cb8b32c 100644
--- a/tc/tc_util.c
+++ b/tc/tc_util.c
@@ -982,3 +982,15 @@ void print_masked_u8(const char *name, struct rtattr *attr,
 	print_masked_type(UINT8_MAX,  __rta_getattr_u8_u32, name, attr,
 			  mask_attr, newline);
 }
+
+static __u32 __rta_getattr_be16_u32(const struct rtattr *attr)
+{
+	return rta_getattr_be16(attr);
+}
+
+void print_masked_be16(const char *name, struct rtattr *attr,
+		       struct rtattr *mask_attr, bool newline)
+{
+	print_masked_type(UINT16_MAX, __rta_getattr_be16_u32, name, attr,
+			  mask_attr, newline);
+}
diff --git a/tc/tc_util.h b/tc/tc_util.h
index 9adf2ab42138..edc3913889b9 100644
--- a/tc/tc_util.h
+++ b/tc/tc_util.h
@@ -133,4 +133,6 @@ void print_masked_u16(const char *name, struct rtattr *attr,
 		      struct rtattr *mask_attr, bool newline);
 void print_masked_u8(const char *name, struct rtattr *attr,
 		     struct rtattr *mask_attr, bool newline);
+void print_masked_be16(const char *name, struct rtattr *attr,
+		       struct rtattr *mask_attr, bool newline);
 #endif
-- 
2.8.4


  parent reply	other threads:[~2019-11-12 14:52 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-12 14:51 [PATCH iproute2-next 0/8] flower match support for masked ports Roi Dayan
2019-11-12 14:51 ` [PATCH iproute2-next 1/8] tc_util: introduce a function to print JSON/non-JSON masked numbers Roi Dayan
2019-11-12 14:51 ` [PATCH iproute2-next 2/8] tc_util: add an option to print masked numbers with/without a newline Roi Dayan
2019-11-12 14:51 ` [PATCH iproute2-next 3/8] tc: flower: fix newline prints for ct-mark and ct-zone Roi Dayan
2019-11-12 14:51 ` [PATCH iproute2-next 4/8] tc_util: fix JSON " Roi Dayan
2019-11-12 14:51 ` [PATCH iproute2-next 5/8] tc: flower: fix output for ip tos and ttl Roi Dayan
2019-11-12 14:51 ` [PATCH iproute2-next 6/8] tc: flower: add u16 big endian parse option Roi Dayan
2019-11-12 14:51 ` Roi Dayan [this message]
2019-11-12 14:51 ` [PATCH iproute2-next 8/8] tc: flower: support masked port destination and source match Roi Dayan
2019-11-12 19:55 ` [PATCH iproute2-next 0/8] flower match support for masked ports David Ahern
2019-11-13 10:12   ` Roi Dayan

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=20191112145154.145289-8-roid@mellanox.com \
    --to=roid@mellanox.com \
    --cc=dsahern@gmail.com \
    --cc=elibr@mellanox.com \
    --cc=jiri@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.org \
    /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).