Hi Dan and Subash, 2018-06-05 19:38 GMT+02:00 Subash Abhinov Kasiviswanathan <subas...@codeaurora.org>: > On 2018-06-05 08:54, Dan Williams wrote: >> >> On Tue, 2018-06-05 at 11:38 +0200, Daniele Palmas wrote: >>> >>> Hi, >>> >>> 2018-02-21 20:47 GMT+01:00 Subash Abhinov Kasiviswanathan >>> <subas...@codeaurora.org>: >>> > On 2018-02-21 04:38, Daniele Palmas wrote: >>> > > >>> > > Hello, >>> > > >>> > > in rmnet kernel documentation I read: >>> > > >>> > > "This driver can be used to register onto any physical network >>> > > device in >>> > > IP mode. Physical transports include USB, HSIC, PCIe and IP >>> > > accelerator." >>> > > >>> > > Does this mean that it can be used in association with the >>> > > qmi_wwan >>> > > driver? >>> > > >>> > > If yes, can someone give me an hint on the steps to follow? >>> > > >>> > > If not, does anyone know if it is possible to modify qmi_wwan in >>> > > order >>> > > to take advantage of the features provided by the rmnet driver? >>> > > >>> > > In this case hint on the changes for modifying qmi_wwan are >>> > > welcome. >>> > > >>> > > Thanks in advance, >>> > > Daniele >>> > >>> > >>> > Hi >>> > >>> > I havent used qmi_wwan so the following comment is based on code >>> > inspection. >>> > qmimux_register_device() is creating qmimux devices with usb net >>> > device as >>> > real_dev. The Multiplexing and aggregation header (qmimux_hdr) is >>> > stripped >>> > off >>> > in qmimux_rx_fixup() and the packet is passed on to stack. >>> > >>> > You could instead create rmnet devices with the usb netdevice as >>> > real dev. >>> > The packets from the usb net driver can be queued to network stack >>> > directly >>> > as rmnet driver will setup a RX handler. rmnet driver will process >>> > the >>> > packets >>> > further and then queue to network stack. >>> > >>> >>> in kernel documentation I read that rmnet user space configuration is >>> done through librmnetctl available at >>> >>> https://source.codeaurora.org/quic/la/platform/vendor/qcom-opensource >>> /dataservices/tree/rmnetctl >>> >>> However it seems to me that this is a bit outdated (e.g. it does not >>> properly build since it is looking for kernel header >>> linux/rmnet_data.h that, as far as I understand, is no more present). >>> >>> Is there available a more recent version of the tool? > > > Hi Daniele > > The attached patch should have an updated version of the tool. > Usage - > > rmnetcli -n newlink wwan0 rmnet0 1 1 > where wwan0 is the physical device > rmnet0 is the virtual device to be created > 1 is the mux id > the other 1 is the flag to configure DL de-aggregation by default > > To delete a device - > > ip link delete rmnet0 > >> >> I'd expect that somebody (Subash?) would add support for the >> rmnet/qmimux options to iproute2 via 'ip link' like exists for most >> other device types. > > > Hi Dan > > Yes, I can do that and update the documentation to point to using iproute2. >
I followed Dan's advice and prepared a very basic test patch (attached) for testing it through ip link. Basically things seem to be properly working with qmicli, but I needed to modify a bit qmi_wwan, so I'm adding Bjørn that maybe can help. Bjørn, I'm trying to add support to rmnet in qmi_wwan: I had to modify the code as in the attached test patch, but I'm not sure it is the right way. This is done under the assumption that the rmnet device would be the only one to register an rx handler to qmi_wwan, but it is probably wrong. Basically I'm wondering if there is a more correct way to understand if an rmnet device is linked to the real qmi_wwan device. Thanks, Daniele > > -- > Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, > a Linux Foundation Collaborative Project
From 9c1777d4d93238703172c5e88aaeb9d8b3e372eb Mon Sep 17 00:00:00 2001 From: Daniele Palmas <dnl...@gmail.com> Date: Fri, 8 Jun 2018 12:02:49 +0200 Subject: [PATCH 1/1] usb: net: qmi_wwan: add support for rmnet device This patch allows to use rmnet with qmi_wwan create network interfaces. Signed-off-by: Daniele Palmas <dnl...@gmail.com> --- drivers/net/usb/qmi_wwan.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c index 0946808..dd5f278 100644 --- a/drivers/net/usb/qmi_wwan.c +++ b/drivers/net/usb/qmi_wwan.c @@ -479,6 +479,11 @@ static int qmi_wwan_rx_fixup(struct usbnet *dev, struct sk_buff *skb) if (info->flags & QMI_WWAN_FLAG_MUX) return qmimux_rx_fixup(dev, skb); + if (rcu_access_pointer(dev->net->rx_handler)) { + skb->protocol = htons(ETH_P_MAP); + return 1; + } + switch (skb->data[0] & 0xf0) { case 0x40: proto = htons(ETH_P_IP); -- 2.7.4
From 88bdb27b6d535600c10ef446391a51fc56691350 Mon Sep 17 00:00:00 2001 From: Daniele Palmas <dnl...@gmail.com> Date: Fri, 8 Jun 2018 11:43:49 +0200 Subject: [PATCH 1/1] ip: add rmnet initial support This patch adds basic support for rmnet devices. Currently the only possible actions are creating a new link with a specific mux id and removing a link. Signed-off-by: Daniele Palmas <dnl...@gmail.com> --- ip/Makefile | 2 +- ip/iplink.c | 2 +- ip/iplink_rmnet.c | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 76 insertions(+), 2 deletions(-) create mode 100644 ip/iplink_rmnet.c diff --git a/ip/Makefile b/ip/Makefile index 77fadee..a88f936 100644 --- a/ip/Makefile +++ b/ip/Makefile @@ -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 diff --git a/ip/iplink.c b/ip/iplink.c index 9ff5f69..d678301 100644 --- a/ip/iplink.c +++ b/ip/iplink.c @@ -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); } diff --git a/ip/iplink_rmnet.c b/ip/iplink_rmnet.c new file mode 100644 index 0000000..d3b0672 --- /dev/null +++ b/ip/iplink_rmnet.c @@ -0,0 +1,74 @@ +/* + * iplink_rmnet.c RMNET device support + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + * + * Authors: Daniele Palmas <dnl...@gmail.com> + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include "rt_names.h" +#include "utils.h" +#include "ip_common.h" + +static void print_explain(FILE *f) +{ + fprintf(f, + "Usage: ... rmnet mux_id MUXID\n" + "\n" + "MUXID := 1-127\n" + ); +} + +static void explain(void) +{ + print_explain(stderr); +} + +static int rmnet_parse_opt(struct link_util *lu, int argc, char **argv, + struct nlmsghdr *n) +{ + struct ifla_rmnet_flags flags = { 0 }; + __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); + } else if (matches(*argv, "help") == 0) { + explain(); + return -1; + } else { + fprintf(stderr, "rmnet: unknown command \"%s\"?\n", *argv); + explain(); + return -1; + } + argc--, argv++; + } + + if (flags.mask) + addattr_l(n, 1024, IFLA_RMNET_FLAGS, &flags, sizeof(flags)); + + return 0; +} + +static void rmnet_print_help(struct link_util *lu, int argc, char **argv, + FILE *f) +{ + print_explain(f); +} + +struct link_util rmnet_link_util = { + .id = "rmnet", + .maxattr = IFLA_RMNET_MAX, + .parse_opt = rmnet_parse_opt, + .print_help = rmnet_print_help, +}; -- 2.7.4