Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/32786/?format=api
http://patches.dpdk.org/api/patches/32786/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/1514518722-27302-1-git-send-email-muziding001@163.com/", "project": { "id": 1, "url": "http://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": "<1514518722-27302-1-git-send-email-muziding001@163.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1514518722-27302-1-git-send-email-muziding001@163.com", "date": "2017-12-29T03:38:42", "name": "[dpdk-dev] net/virtio-user: specify the MAC of the tap", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "bc4f15862a28b4d72ca60d2f2abc146a59f06269", "submitter": { "id": 927, "url": "http://patches.dpdk.org/api/people/927/?format=api", "name": "Ning Li", "email": "muziding001@163.com" }, "delegate": { "id": 2642, "url": "http://patches.dpdk.org/api/users/2642/?format=api", "username": "mcoquelin", "first_name": "Maxime", "last_name": "Coquelin", "email": "maxime.coquelin@redhat.com" }, "mbox": "http://patches.dpdk.org/project/dpdk/patch/1514518722-27302-1-git-send-email-muziding001@163.com/mbox/", "series": [], "comments": "http://patches.dpdk.org/api/patches/32786/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/32786/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 [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 153D32C39;\n\tFri, 29 Dec 2017 04:39:28 +0100 (CET)", "from m12-14.163.com (m12-14.163.com [220.181.12.14])\n\tby dpdk.org (Postfix) with ESMTP id EA9CD237\n\tfor <dev@dpdk.org>; Fri, 29 Dec 2017 04:39:24 +0100 (CET)", "from localhost.localdomain (unknown [221.226.39.82])\n\tby smtp10 (Coremail) with SMTP id DsCowAB3NXLiuEVa2msiAQ--.2781S3;\n\tFri, 29 Dec 2017 11:39:21 +0800 (CST)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com;\n\ts=s110527; h=From:Subject:Date:Message-Id; bh=NOHTWnuNpO3zl0FDsV\n\tc68ovbAr4y298fYzPSFT5tAZI=; b=o6035SoUmLw2fPtny21GZwqxUS3yO+L4j6\n\tprtZx52ZdgES6qwLPLK4Z0v0kWoGdyBiwTG/Z1co+9+Wrm/uKW+Uaarl/1VVa8Ov\n\tYDrHorYLX31D7eWlOqfBLcXC72Fyb7QH+B9PIVoH9mNChfIZXOrveHfhjbcuwLrW\n\tWQqzGTQLE=", "From": "Ning Li <muziding001@163.com>", "To": "Yuanhan Liu <yliu@fridaylinux.org>,\n\tMaxime Coquelin <maxime.coquelin@redhat.com>,\n\tTiwei Bie <tiwei.bie@intel.com>", "Cc": "dev@dpdk.org,\n\tNing Li <muziding001@163.com>", "Date": "Fri, 29 Dec 2017 11:38:42 +0800", "Message-Id": "<1514518722-27302-1-git-send-email-muziding001@163.com>", "X-Mailer": "git-send-email 1.8.3.1", "In-Reply-To": "<1513251494-9980-1-git-send-email-muziding001@163.com>", "References": "<1513251494-9980-1-git-send-email-muziding001@163.com>", "X-CM-TRANSID": "DsCowAB3NXLiuEVa2msiAQ--.2781S3", "X-Coremail-Antispam": "1Uf129KBjvJXoWxXr4DArW3tF1UuF4kur4Uurg_yoW5Ww1fpa\n\t1DArsxZr13Jr17Aa1rJF109ry5A3Z7Jr17Kr9xW3Wrurs2qF1UGrWUua4Ygr47JFWUGF4I\n\tyFy09asIg3s8Zw7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2\n\t9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x0zRhL0rUUUUU=", "X-Originating-IP": "[221.226.39.82]", "X-CM-SenderInfo": "ppx2xvhlqjiiqr6rljoofrz/xtbB0Aq90lUMCKmJ5wAAsj", "Subject": "[dpdk-dev] [PATCH] net/virtio-user: specify the MAC of the tap", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "Precedence": "list", "List-Id": "DPDK patches and discussions <dev.dpdk.org>", "List-Unsubscribe": "<https://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": "<https://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": "When using virtio-user with vhost-kernel to exchange\npacket with kernel networking stack, application can\nset the MAC of the tap interface via parameter.\n\nSigned-off-by: Ning Li <muziding001@163.com>\n---\n drivers/net/virtio/virtio_user/vhost_kernel.c | 3 ++-\n drivers/net/virtio/virtio_user/vhost_kernel_tap.c | 14 +++++++++++++-\n drivers/net/virtio/virtio_user/vhost_kernel_tap.h | 3 ++-\n 3 files changed, 17 insertions(+), 3 deletions(-)", "diff": "diff --git a/drivers/net/virtio/virtio_user/vhost_kernel.c b/drivers/net/virtio/virtio_user/vhost_kernel.c\nindex 68d28b1..dd24b6b 100644\n--- a/drivers/net/virtio/virtio_user/vhost_kernel.c\n+++ b/drivers/net/virtio/virtio_user/vhost_kernel.c\n@@ -380,7 +380,8 @@ struct vhost_memory_kernel {\n \telse\n \t\thdr_size = sizeof(struct virtio_net_hdr);\n \n-\ttapfd = vhost_kernel_open_tap(&dev->ifname, hdr_size, req_mq);\n+\ttapfd = vhost_kernel_open_tap(&dev->ifname, hdr_size, req_mq,\n+\t\t\t (char *)dev->mac_addr);\n \tif (tapfd < 0) {\n \t\tPMD_DRV_LOG(ERR, \"fail to open tap for vhost kernel\");\n \t\treturn -1;\ndiff --git a/drivers/net/virtio/virtio_user/vhost_kernel_tap.c b/drivers/net/virtio/virtio_user/vhost_kernel_tap.c\nindex 689a5cf..d036428 100644\n--- a/drivers/net/virtio/virtio_user/vhost_kernel_tap.c\n+++ b/drivers/net/virtio/virtio_user/vhost_kernel_tap.c\n@@ -36,15 +36,19 @@\n #include <sys/stat.h>\n #include <fcntl.h>\n #include <net/if.h>\n+#include <net/if_arp.h>\n #include <errno.h>\n #include <string.h>\n #include <limits.h>\n \n+#include <rte_ether.h>\n+\n #include \"vhost_kernel_tap.h\"\n #include \"../virtio_logs.h\"\n \n int\n-vhost_kernel_open_tap(char **p_ifname, int hdr_size, int req_mq)\n+vhost_kernel_open_tap(char **p_ifname, int hdr_size, int req_mq,\n+\t\t\t const char *mac)\n {\n \tunsigned int tap_features;\n \tint sndbuf = INT_MAX;\n@@ -123,6 +127,14 @@\n \t\tPMD_DRV_LOG(ERR, \"TUNSETOFFLOAD ioctl() failed: %s\",\n \t\t\t strerror(errno));\n \n+\tmemset(&ifr, 0, sizeof(ifr));\n+\tifr.ifr_hwaddr.sa_family = ARPHRD_ETHER;\n+\tmemcpy(ifr.ifr_hwaddr.sa_data, mac, ETHER_ADDR_LEN);\n+\tif (ioctl(tapfd, SIOCSIFHWADDR, (void *)&ifr) == -1) {\n+\t\tPMD_DRV_LOG(ERR, \"SIOCSIFHWADDR failed: %s\", strerror(errno));\n+\t\tgoto error;\n+\t}\n+\n \tif (!(*p_ifname))\n \t\t*p_ifname = strdup(ifr.ifr_name);\n \ndiff --git a/drivers/net/virtio/virtio_user/vhost_kernel_tap.h b/drivers/net/virtio/virtio_user/vhost_kernel_tap.h\nindex eae340c..402f964 100644\n--- a/drivers/net/virtio/virtio_user/vhost_kernel_tap.h\n+++ b/drivers/net/virtio/virtio_user/vhost_kernel_tap.h\n@@ -64,4 +64,5 @@\n /* Constants */\n #define PATH_NET_TUN\t\"/dev/net/tun\"\n \n-int vhost_kernel_open_tap(char **p_ifname, int hdr_size, int req_mq);\n+int vhost_kernel_open_tap(char **p_ifname, int hdr_size, int req_mq,\n+\t\t\t const char *mac);\n", "prefixes": [ "dpdk-dev" ] }{ "id": 32786, "url": "