Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/26121/?format=api
https://patches.dpdk.org/api/patches/26121/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/20170630165140.59594-10-ferruh.yigit@intel.com/", "project": { "id": 1, "url": "https://patches.dpdk.org/api/projects/1/?format=api", "name": "DPDK", "link_name": "dpdk", "list_id": "dev.dpdk.org", "list_email": "dev@dpdk.org", "web_url": "http://core.dpdk.org", "scm_url": "git://dpdk.org/dpdk", "webscm_url": "http://git.dpdk.org/dpdk", "list_archive_url": "https://inbox.dpdk.org/dev", "list_archive_url_format": "https://inbox.dpdk.org/dev/{}", "commit_url_format": "" }, "msgid": "<20170630165140.59594-10-ferruh.yigit@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20170630165140.59594-10-ferruh.yigit@intel.com", "date": "2017-06-30T16:51:29", "name": "[dpdk-dev,v9,09/20] unci: add rtnl newlink", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "a0883350578d9851465ff4817ce3524b66071775", "submitter": { "id": 324, "url": "https://patches.dpdk.org/api/people/324/?format=api", "name": "Ferruh Yigit", "email": "ferruh.yigit@intel.com" }, "delegate": null, "mbox": "https://patches.dpdk.org/project/dpdk/patch/20170630165140.59594-10-ferruh.yigit@intel.com/mbox/", "series": [], "comments": "https://patches.dpdk.org/api/patches/26121/comments/", "check": "success", "checks": "https://patches.dpdk.org/api/patches/26121/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@dpdk.org", "Delivered-To": "patchwork@dpdk.org", "Received": [ "from [92.243.14.124] (localhost [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id E90517CBE;\n\tFri, 30 Jun 2017 18:52:28 +0200 (CEST)", "from mga02.intel.com (mga02.intel.com [134.134.136.20])\n\tby dpdk.org (Postfix) with ESMTP id 31E615699\n\tfor <dev@dpdk.org>; Fri, 30 Jun 2017 18:52:04 +0200 (CEST)", "from orsmga004.jf.intel.com ([10.7.209.38])\n\tby orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t30 Jun 2017 09:51:59 -0700", "from silpixa00372839.ir.intel.com (HELO\n\tsilpixa00372839.ger.corp.intel.com) ([10.237.222.154])\n\tby orsmga004.jf.intel.com with ESMTP; 30 Jun 2017 09:51:56 -0700" ], "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.40,287,1496127600\"; d=\"scan'208\";a=\"103233221\"", "From": "Ferruh Yigit <ferruh.yigit@intel.com>", "To": "dev@dpdk.org", "Cc": "Ferruh Yigit <ferruh.yigit@intel.com>,\n\tStephen Hemminger <stephen@networkplumber.org>,\n\tBruce Richardson <bruce.richardson@intel.com>,\n\tAnatoly Burakov <anatoly.burakov@intel.com>", "Date": "Fri, 30 Jun 2017 17:51:29 +0100", "Message-Id": "<20170630165140.59594-10-ferruh.yigit@intel.com>", "X-Mailer": "git-send-email 2.13.0", "In-Reply-To": "<20170630165140.59594-1-ferruh.yigit@intel.com>", "References": "<20170621110651.75299-1-ferruh.yigit@intel.com>\n\t<20170630165140.59594-1-ferruh.yigit@intel.com>", "Subject": "[dpdk-dev] [PATCH v9 09/20] unci: add rtnl newlink", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "Precedence": "list", "List-Id": "DPDK patches and discussions <dev.dpdk.org>", "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://dpdk.org/ml/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "Use rtnl to create a new interface. Interface is not setup yet.\n\nPid and port_id should be provided by userspace application that does\nthe call for interface creation.\n\nSigned-off-by: Ferruh Yigit <ferruh.yigit@intel.com>\n---\n lib/librte_eal/linuxapp/eal/Makefile | 1 +\n .../eal/include/exec-env/rte_unci_common.h | 72 ++++++++++++++++++++++\n lib/librte_eal/linuxapp/unci/unci_dev.h | 5 ++\n lib/librte_eal/linuxapp/unci/unci_net.c | 38 +++++++++++-\n 4 files changed, 115 insertions(+), 1 deletion(-)\n create mode 100644 lib/librte_eal/linuxapp/eal/include/exec-env/rte_unci_common.h", "diff": "diff --git a/lib/librte_eal/linuxapp/eal/Makefile b/lib/librte_eal/linuxapp/eal/Makefile\nindex 640afd088..401160bc9 100644\n--- a/lib/librte_eal/linuxapp/eal/Makefile\n+++ b/lib/librte_eal/linuxapp/eal/Makefile\n@@ -127,6 +127,7 @@ CFLAGS_eal_thread.o += -Wno-return-type\n endif\n \n INC := rte_interrupts.h rte_kni_common.h rte_dom0_common.h\n+INC += rte_unci_common.h\n \n SYMLINK-$(CONFIG_RTE_EXEC_ENV_LINUXAPP)-include/exec-env := \\\n \t$(addprefix include/exec-env/,$(INC))\ndiff --git a/lib/librte_eal/linuxapp/eal/include/exec-env/rte_unci_common.h b/lib/librte_eal/linuxapp/eal/include/exec-env/rte_unci_common.h\nnew file mode 100644\nindex 000000000..d90423a07\n--- /dev/null\n+++ b/lib/librte_eal/linuxapp/eal/include/exec-env/rte_unci_common.h\n@@ -0,0 +1,72 @@\n+/*-\n+ * This file is provided under a dual BSD/LGPLv2 license. When using or\n+ * redistributing this file, you may do so under either license.\n+ *\n+ * GNU LESSER GENERAL PUBLIC LICENSE\n+ *\n+ * Copyright(c) 2017 Intel Corporation. All rights reserved.\n+ *\n+ * This program is free software; you can redistribute it and/or modify\n+ * it under the terms of version 2.1 of the GNU Lesser General Public License\n+ * as published by the Free Software Foundation.\n+ *\n+ * This program is distributed in the hope that it will be useful, but\n+ * WITHOUT ANY WARRANTY; without even the implied warranty of\n+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n+ * Lesser General Public License for more details.\n+ *\n+ * You should have received a copy of the GNU Lesser General Public License\n+ * along with this program;\n+ *\n+ * Contact Information:\n+ * Intel Corporation\n+ *\n+ *\n+ * BSD LICENSE\n+ *\n+ * Copyright(c) 2017 Intel Corporation. All rights reserved.\n+ * All rights reserved.\n+ *\n+ * Redistribution and use in source and binary forms, with or without\n+ * modification, are permitted provided that the following conditions\n+ * are met:\n+ *\n+ * * Redistributions of source code must retain the above copyright\n+ * notice, this list of conditions and the following disclaimer.\n+ * * Redistributions in binary form must reproduce the above copyright\n+ * notice, this list of conditions and the following disclaimer in\n+ * the documentation and/or other materials provided with the\n+ * distribution.\n+ * * Neither the name of Intel Corporation nor the names of its\n+ * contributors may be used to endorse or promote products derived\n+ * from this software without specific prior written permission.\n+ *\n+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n+ * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n+ *\n+ */\n+\n+#ifndef _RTE_UNCI_COMMON_H_\n+#define _RTE_UNCI_COMMON_H_\n+\n+#define UNCI_DEVICE \"unci\"\n+\n+enum {\n+\tIFLA_UNCI_UNSPEC,\n+\tIFLA_UNCI_PORTID,\n+\tIFLA_UNCI_PID,\n+\t__IFLA_UNCI_MAX,\n+};\n+\n+#define IFLA_UNCI_MAX (__IFLA_UNCI_MAX - 1)\n+\n+#endif /* _RTE_UNCI_COMMON_H_ */\ndiff --git a/lib/librte_eal/linuxapp/unci/unci_dev.h b/lib/librte_eal/linuxapp/unci/unci_dev.h\nindex 0337fa82b..b0a215f1b 100644\n--- a/lib/librte_eal/linuxapp/unci/unci_dev.h\n+++ b/lib/librte_eal/linuxapp/unci/unci_dev.h\n@@ -26,11 +26,16 @@\n #define _UNCI_DEV_H_\n \n #include <linux/netdevice.h>\n+#include <exec-env/rte_unci_common.h>\n \n #ifdef pr_fmt\n #undef pr_fmt\n #endif\n #define pr_fmt(fmt) KBUILD_MODNAME \": \" fmt\n \n+struct unci_dev {\n+\tu8 port_id;\n+\tu32 pid;\n+};\n \n #endif /* _UNCI_DEV_H_ */\ndiff --git a/lib/librte_eal/linuxapp/unci/unci_net.c b/lib/librte_eal/linuxapp/unci/unci_net.c\nindex b8ef409d3..ee23b0e4d 100644\n--- a/lib/librte_eal/linuxapp/unci/unci_net.c\n+++ b/lib/librte_eal/linuxapp/unci/unci_net.c\n@@ -23,17 +23,53 @@\n */\n \n #include <linux/module.h>\n+#include <net/rtnetlink.h>\n \n #include \"unci_dev.h\"\n \n+static const struct net_device_ops unci_net_netdev_ops = { 0 };\n+\n+static void unci_net_setup(struct net_device *dev)\n+{\n+\tether_setup(dev);\n+\tdev->netdev_ops = &unci_net_netdev_ops;\n+}\n+\n+static int unci_net_newlink(struct net *net, struct net_device *dev,\n+\t\tstruct nlattr *tb[], struct nlattr *data[])\n+{\n+\tstruct unci_dev *unci = netdev_priv(dev);\n+\n+\tif (data && data[IFLA_UNCI_PORTID])\n+\t\tunci->port_id = nla_get_u8(data[IFLA_UNCI_PORTID]);\n+\telse\n+\t\tunci->port_id = 0;\n+\n+\tif (data && data[IFLA_UNCI_PID])\n+\t\tunci->pid = nla_get_u32(data[IFLA_UNCI_PID]);\n+\telse\n+\t\tunci->pid = 0;\n+\n+\treturn register_netdevice(dev);\n+}\n+\n+static struct rtnl_link_ops unci_link_ops __read_mostly = {\n+\t.kind = UNCI_DEVICE,\n+\t.priv_size = sizeof(struct unci_dev),\n+\t.setup = unci_net_setup,\n+\t.maxtype = IFLA_UNCI_MAX,\n+\t.newlink = unci_net_newlink,\n+};\n+\n static int __init unci_init(void)\n {\n-\treturn 0;\n+\treturn rtnl_link_register(&unci_link_ops);\n }\n module_init(unci_init);\n \n static void __exit unci_exit(void)\n {\n+\trtnl_link_unregister(&unci_link_ops);\n }\n module_exit(unci_exit);\n \n", "prefixes": [ "dpdk-dev", "v9", "09/20" ] }{ "id": 26121, "url": "