Skip to contentSkip to conversation

ip: add rmnet initial support

PATCH Superseded Daniele Palmas 3 participants 5 messages Jun 12, 2018 – Jun 13, 2018

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ip: add rmnet initial support

This patch adds basic support for Qualcomm rmnet devices.

---
 ip/Makefile       |  2 +-
 ip/iplink.c       |  2 +-
 ip/iplink_rmnet.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 72 insertions(+), 2 deletions(-)
 create mode 100644 ip/iplink_rmnet.c
ip/Makefile +1 -1
index 77fadee..a88f936 100644
@@ -10,7 +10,7 @@ IPOBJ=ip.o ipaddress.o ipaddrlabel.o iproute.o iprule.o ipnetns.o \
     link_iptnl.o link_gre6.o iplink_bond.o iplink_bond_slave.o iplink_hsr.o \
     iplink_bridge.o iplink_bridge_slave.o ipfou.o iplink_ipvlan.o \
     iplink_geneve.o iplink_vrf.o iproute_lwtunnel.o ipmacsec.o ipila.o \
-    ipvrf.o iplink_xstats.o ipseg6.o iplink_netdevsim.o
+    ipvrf.o iplink_xstats.o ipseg6.o iplink_netdevsim.o iplink_rmnet.o
 
 RTMONOBJ=rtmon.o
 
ip/iplink.c +1 -1
index e4d4da9..f0f8fb8 100644
@@ -121,7 +121,7 @@ void iplink_usage(void)
 			"          bridge | bond | team | ipoib | ip6tnl | ipip | sit | vxlan |\n"
 			"          gre | gretap | erspan | ip6gre | ip6gretap | ip6erspan |\n"
 			"          vti | nlmon | team_slave | bond_slave | ipvlan | geneve |\n"
-			"          bridge_slave | vrf | macsec | netdevsim }\n");
+			"          bridge_slave | vrf | macsec | netdevsim | rmnet}\n");
 	}
 	exit(-1);
 }
ip/iplink_rmnet.c new file +70 -0

70 lines not on this page · raw message

Signature · 1 line
2.7.4
#1 lore raw

ip/iplink_rmnet.c line 27

Quoted 9 lines
ip/iplink_rmnet.c new file +9 -0
+
+static void print_explain(FILE *f)
+{
+	fprintf(f,
+		"Usage: ... rmnet mux_id MUXID\n"
+		"\n"
+		"MUXID := 1-127\n"
+	);
+}

Hi Daniele

This range can be from 1-254.

Quoted 8 lines
ip/iplink_rmnet.c new file +7 -0
+
+static void explain(void)
+{
+	print_explain(stderr);
+}
+
+static int rmnet_parse_opt(struct link_util *lu, int argc, char 

**argv,

ip/iplink_rmnet.c line 44

Quoted 10 lines
ip/iplink_rmnet.c new file +10 -0
+			   struct nlmsghdr *n)
+{
+	__u16 mux_id;
+
+	while (argc > 0) {
+		if (matches(*argv, "mux_id") == 0) {
+			NEXT_ARG();
+			if (get_u16(&mux_id, *argv, 0))
+				invarg("mux_id is invalid", *argv);
+			addattr_l(n, 1024, IFLA_RMNET_MUX_ID, &mux_id, 2);

You could use addattr16() instead since it is __u16.

Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
#2 lore raw

2018-06-13 1:06 GMT+02:00 Subash Abhinov Kasiviswanathan <[email protected]>:

Quoted 27 lines

ip/iplink_rmnet.c line 27

Quoted 9 lines
ip/iplink_rmnet.c new file +9 -0
+
+static void print_explain(FILE *f)
+{
+       fprintf(f,
+               "Usage: ... rmnet mux_id MUXID\n"
+               "\n"
+               "MUXID := 1-127\n"
+       );
+}

Hi Daniele

This range can be from 1-254.

Quoted 12 lines
ip/iplink_rmnet.c new file +12 -0
+
+static void explain(void)
+{
+       print_explain(stderr);
+}
+
+static int rmnet_parse_opt(struct link_util *lu, int argc, char **argv,
+                          struct nlmsghdr *n)
+{
+       __u16 mux_id;
+
+       while (argc > 0) {
Quoted 9 lines

ip/iplink_rmnet.c line 44

Quoted 5 lines
ip/iplink_rmnet.c new file +5 -0
+               if (matches(*argv, "mux_id") == 0) {
+                       NEXT_ARG();
+                       if (get_u16(&mux_id, *argv, 0))
+                               invarg("mux_id is invalid", *argv);
+                       addattr_l(n, 1024, IFLA_RMNET_MUX_ID, &mux_id, 2);

You could use addattr16() instead since it is __u16.

Thanks Subash, I'll fix those in v2.

Regards,
Daniele

Quoted 3 lines

--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project

#3 lore raw
In reply to Daniele Palmas
Quoted 9 lines · On Tue, 12 Jun 2018 16:12:57 +0200 Daniele Palmas <[email protected]> wrote:

This patch adds basic support for Qualcomm rmnet devices.

---
 ip/Makefile       |  2 +-
 ip/iplink.c       |  2 +-
 ip/iplink_rmnet.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 72 insertions(+), 2 deletions(-)
 create mode 100644 ip/iplink_rmnet.c

};

I am glad to see integrated tool support, but this needs to be targeted at the iproute2-next since it is a new feature.

Some things that I would like to see changed:
1. All of iproute2 is now using SPDX license identifiers, you should not include GPL boilerplate
2. You should provide dump (print_opt) as well as parse routine. Output format should use the print_uint (json print) routines.
3. Please update manual page (man/man8/ip-link.8.in) to include the new option.

#4 lore raw

2018-06-13 2:22 GMT+02:00 Stephen Hemminger <[email protected]>:

Quoted 17 lines
Quoted 9 lines · On Tue, 12 Jun 2018 16:12:57 +0200 Daniele Palmas <[email protected]> wrote:

This patch adds basic support for Qualcomm rmnet devices.

---
 ip/Makefile       |  2 +-
 ip/iplink.c       |  2 +-
 ip/iplink_rmnet.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 72 insertions(+), 2 deletions(-)
 create mode 100644 ip/iplink_rmnet.c

};

I am glad to see integrated tool support, but this needs to be targeted at the iproute2-next since it is a new feature.

Quoted 8 lines

Some things that I would like to see changed:
1. All of iproute2 is now using SPDX license identifiers, you should not include GPL boilerplate
2. You should provide dump (print_opt) as well as parse routine. Output format should use the print_uint (json print) routines.
3. Please update manual page (man/man8/ip-link.8.in) to include the new option.

Thanks for the review Stephen, I'll submit a v2 for fixing those issues.

Regards,
Daniele