From patchwork Tue Jun 12 14:12:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniele Palmas X-Patchwork-Id: 928336 X-Patchwork-Delegate: shemminger@vyatta.com Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="u6V47aG9"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 414sLH4MxVz9ryk for ; Wed, 13 Jun 2018 00:13:27 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933867AbeFLONY (ORCPT ); Tue, 12 Jun 2018 10:13:24 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:36601 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933295AbeFLONW (ORCPT ); Tue, 12 Jun 2018 10:13:22 -0400 Received: by mail-wm0-f66.google.com with SMTP id v131-v6so23656213wma.1 for ; Tue, 12 Jun 2018 07:13:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=EC0vM9yCMojy4iZVtwH1Vudoow2rX22aHc3wYmLn+rs=; b=u6V47aG9jnfrEk63Si4d6dFolckbujNZ0HHxTr8RHpTTfT8zUawLISNexBzoSV7/cm AJVsXyzqSto4R0Y+eeA7nqYnSYQm9D0eFXx15i1dmTLiHGK6n+Jeuq+dhsUm58Fgqedm v1zOB8hZY9lxAbZWdmnyZQ0nERTXXr8xbJQHy7TDNeRoHA0/hXEAkh0WrCJ+uc7t0JSi wNVR2VPxz05wgZrve0OFojyTjAzV/X0im1qGNTuUC1ohqpCAzbg7IJ/69ZPJzZIR1gI2 Rgq2MNEWpHowsjEeVyUWHSyJxEC6a4fX7by31DDv0RRMIfItimIXPuWQ0DqUnT8b6Igb wyTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=EC0vM9yCMojy4iZVtwH1Vudoow2rX22aHc3wYmLn+rs=; b=KRxWmjFpmdcmKPf1YhVwS5bz9XWtCtep6l3RWmbAEoRqVvnZrrr83kFnULPGgdS7ZD mn0889OBhNm3B89UBKgNhUQFDXSF5zWv5IbrqmF2IvI9JrK/uH+bxjl6f9e9Kh04eLPW ygE8x7IMf4gfAEVCHx3VK1EuM9mfMi1Mr7xDjgG0JYsILHKkrHMOSCboRWJ0lh+Hy8Kv 6foJaS+vtNt8Drtylm3FCM/Pqexvsnzq4XVHBaQ2STqtMQEyUEb9Xz76ppHvVUI6waVv czIW2l48e1xFB4/dCjSqWiIZKHiWZNiJsNgcX6wAeC6RK10HqMnqQYMA6w6cBKx7q63Z h90Q== X-Gm-Message-State: APt69E3dbCl75EBsxyMxgNlgpAf8e1fnUZfgD73fhF2+UxBns/E8ehIU MtA+OnWnoktiX41x3MO8V8axrDTx X-Google-Smtp-Source: ADUXVKIbTuHFyQY8foYqpvkcsyNC0KV9HJbQ8/9zXvIVa9JGMf29PqCwoGuHzy3KcwQyELccdKli1g== X-Received: by 2002:a1c:9f06:: with SMTP id i6-v6mr348595wme.73.1528812801187; Tue, 12 Jun 2018 07:13:21 -0700 (PDT) Received: from localhost.localdomain ([151.56.69.13]) by smtp.gmail.com with ESMTPSA id v138-v6sm800743wmd.47.2018.06.12.07.13.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 12 Jun 2018 07:13:20 -0700 (PDT) From: Daniele Palmas To: netdev@vger.kernel.org, Stephen Hemminger Cc: Subash Abhinov Kasiviswanathan , Daniele Palmas Subject: [PATCH 1/1] ip: add rmnet initial support Date: Tue, 12 Jun 2018 16:12:57 +0200 Message-Id: <1528812777-7512-1-git-send-email-dnlplm@gmail.com> X-Mailer: git-send-email 2.7.4 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This patch adds basic support for Qualcomm rmnet devices. Signed-off-by: Daniele Palmas --- 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 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 e4d4da9..f0f8fb8 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..2367754 --- /dev/null +++ b/ip/iplink_rmnet.c @@ -0,0 +1,70 @@ +/* + * 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 + */ + +#include +#include +#include + +#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) +{ + __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++; + } + + 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, +};