Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/34876/?format=api
http://patches.dpdk.org/api/patches/34876/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/1517614137-62926-6-git-send-email-zhihong.wang@intel.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": "<1517614137-62926-6-git-send-email-zhihong.wang@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1517614137-62926-6-git-send-email-zhihong.wang@intel.com", "date": "2018-02-02T23:28:55", "name": "[dpdk-dev,5/7] vhost: adapt vhost lib for selective datapath", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "d3dda479bae67d593ac77600af0f69a4017e253f", "submitter": { "id": 156, "url": "http://patches.dpdk.org/api/people/156/?format=api", "name": "Zhihong Wang", "email": "zhihong.wang@intel.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/1517614137-62926-6-git-send-email-zhihong.wang@intel.com/mbox/", "series": [], "comments": "http://patches.dpdk.org/api/patches/34876/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/34876/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 8817C1B1A5;\n\tFri, 2 Feb 2018 12:33:53 +0100 (CET)", "from mga17.intel.com (mga17.intel.com [192.55.52.151])\n\tby dpdk.org (Postfix) with ESMTP id 9E9E0A84F\n\tfor <dev@dpdk.org>; Fri, 2 Feb 2018 12:33:51 +0100 (CET)", "from orsmga004.jf.intel.com ([10.7.209.38])\n\tby fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t02 Feb 2018 03:33:51 -0800", "from unknown (HELO dpdk98.sh.intel.com) ([10.67.111.140])\n\tby orsmga004.jf.intel.com with ESMTP; 02 Feb 2018 03:33:49 -0800" ], "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.46,448,1511856000\"; d=\"scan'208\";a=\"171132748\"", "From": "Zhihong Wang <zhihong.wang@intel.com>", "To": "dev@dpdk.org", "Cc": "jianfeng.tan@intel.com, tiwei.bie@intel.com, maxime.coquelin@redhat.com, \n\tyliu@fridaylinux.org, cunming.liang@intel.com, xiao.w.wang@intel.com,\n\tdan.daly@intel.com, Zhihong Wang <zhihong.wang@intel.com>", "Date": "Fri, 2 Feb 2018 18:28:55 -0500", "Message-Id": "<1517614137-62926-6-git-send-email-zhihong.wang@intel.com>", "X-Mailer": "git-send-email 2.7.5", "In-Reply-To": "<1517614137-62926-1-git-send-email-zhihong.wang@intel.com>", "References": "<1517614137-62926-1-git-send-email-zhihong.wang@intel.com>", "Subject": "[dpdk-dev] [PATCH 5/7] vhost: adapt vhost lib for selective datapath", "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": "This patch adapts vhost lib for selective datapath by calling device ops\nat the corresponding stage.\n\nSigned-off-by: Zhihong Wang <zhihong.wang@intel.com>\n---\n lib/librte_vhost/socket.c | 3 +++\n lib/librte_vhost/vhost.c | 5 +++++\n lib/librte_vhost/vhost_user.c | 48 +++++++++++++++++++++++++++++++++++++++----\n 3 files changed, 52 insertions(+), 4 deletions(-)", "diff": "diff --git a/lib/librte_vhost/socket.c b/lib/librte_vhost/socket.c\nindex c4f90af..8296e4b 100644\n--- a/lib/librte_vhost/socket.c\n+++ b/lib/librte_vhost/socket.c\n@@ -205,6 +205,9 @@ vhost_user_add_connection(int fd, struct vhost_user_socket *vsocket)\n \tsize = strnlen(vsocket->path, PATH_MAX);\n \tvhost_set_ifname(vid, vsocket->path, size);\n \n+\tvhost_set_vdpa_eid(vid, vsocket->eid);\n+\tvhost_set_vdpa_did(vid, vsocket->did);\n+\n \tif (vsocket->dequeue_zero_copy)\n \t\tvhost_enable_dequeue_zero_copy(vid);\n \ndiff --git a/lib/librte_vhost/vhost.c b/lib/librte_vhost/vhost.c\nindex 2dff199..1a3ddd5 100644\n--- a/lib/librte_vhost/vhost.c\n+++ b/lib/librte_vhost/vhost.c\n@@ -302,11 +302,16 @@ void\n vhost_destroy_device(int vid)\n {\n \tstruct virtio_net *dev = get_device(vid);\n+\tint eid = dev->eid;\n \n \tif (dev == NULL)\n \t\treturn;\n \n \tif (dev->flags & VIRTIO_DEV_RUNNING) {\n+\t\tif (eid >= 0 && vdpa_engines[eid] &&\n+\t\t\t\tvdpa_engines[eid]->eng_drv &&\n+\t\t\t\tvdpa_engines[eid]->eng_drv->dev_ops.dev_close)\n+\t\t\tvdpa_engines[eid]->eng_drv->dev_ops.dev_close(dev->vid);\n \t\tdev->flags &= ~VIRTIO_DEV_RUNNING;\n \t\tdev->notify_ops->destroy_device(vid);\n \t}\ndiff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c\nindex b1762e6..05b53fa 100644\n--- a/lib/librte_vhost/vhost_user.c\n+++ b/lib/librte_vhost/vhost_user.c\n@@ -116,7 +116,13 @@ vhost_user_set_owner(void)\n static int\n vhost_user_reset_owner(struct virtio_net *dev)\n {\n+\tint eid = dev->eid;\n+\n \tif (dev->flags & VIRTIO_DEV_RUNNING) {\n+\t\tif (eid >= 0 && vdpa_engines[eid] &&\n+\t\t\t\tvdpa_engines[eid]->eng_drv &&\n+\t\t\t\tvdpa_engines[eid]->eng_drv->dev_ops.dev_close)\n+\t\t\tvdpa_engines[eid]->eng_drv->dev_ops.dev_close(dev->vid);\n \t\tdev->flags &= ~VIRTIO_DEV_RUNNING;\n \t\tdev->notify_ops->destroy_device(dev->vid);\n \t}\n@@ -157,6 +163,7 @@ static int\n vhost_user_set_features(struct virtio_net *dev, uint64_t features)\n {\n \tuint64_t vhost_features = 0;\n+\tint eid = dev->eid;\n \n \trte_vhost_driver_get_features(dev->ifname, &vhost_features);\n \tif (features & ~vhost_features) {\n@@ -186,6 +193,11 @@ vhost_user_set_features(struct virtio_net *dev, uint64_t features)\n \t\t\tdev->notify_ops->features_changed(dev->vid, features);\n \t}\n \n+\tif (eid >= 0 && vdpa_engines[eid] &&\n+\t\t\tvdpa_engines[eid]->eng_drv &&\n+\t\t\tvdpa_engines[eid]->eng_drv->dev_ops.feature_set)\n+\t\tvdpa_engines[eid]->eng_drv->dev_ops.feature_set(dev->vid);\n+\n \tdev->features = features;\n \tif (dev->features &\n \t\t((1 << VIRTIO_NET_F_MRG_RXBUF) | (1ULL << VIRTIO_F_VERSION_1))) {\n@@ -883,9 +895,14 @@ vhost_user_get_vring_base(struct virtio_net *dev,\n \t\t\t VhostUserMsg *msg)\n {\n \tstruct vhost_virtqueue *vq = dev->virtqueue[msg->payload.state.index];\n+\tint eid = dev->eid;\n \n \t/* We have to stop the queue (virtio) if it is running. */\n \tif (dev->flags & VIRTIO_DEV_RUNNING) {\n+\t\tif (eid >= 0 && vdpa_engines[eid] &&\n+\t\t\t\tvdpa_engines[eid]->eng_drv &&\n+\t\t\t\tvdpa_engines[eid]->eng_drv->dev_ops.dev_close)\n+\t\t\tvdpa_engines[eid]->eng_drv->dev_ops.dev_close(dev->vid);\n \t\tdev->flags &= ~VIRTIO_DEV_RUNNING;\n \t\tdev->notify_ops->destroy_device(dev->vid);\n \t}\n@@ -928,16 +945,24 @@ vhost_user_set_vring_enable(struct virtio_net *dev,\n \t\t\t VhostUserMsg *msg)\n {\n \tint enable = (int)msg->payload.state.num;\n+\tint index = (int)msg->payload.state.index;\n+\tint eid = dev->eid;\n \n \tRTE_LOG(INFO, VHOST_CONFIG,\n \t\t\"set queue enable: %d to qp idx: %d\\n\",\n-\t\tenable, msg->payload.state.index);\n+\t\tenable, index);\n+\n+\tif (eid >= 0 && vdpa_engines[eid] &&\n+\t\t\tvdpa_engines[eid]->eng_drv &&\n+\t\t\tvdpa_engines[eid]->eng_drv->dev_ops.vring_state_set)\n+\t\tvdpa_engines[eid]->eng_drv->dev_ops.vring_state_set(dev->vid,\n+\t\t\t\tindex, enable);\n \n \tif (dev->notify_ops->vring_state_changed)\n \t\tdev->notify_ops->vring_state_changed(dev->vid,\n-\t\t\t\tmsg->payload.state.index, enable);\n+\t\t\t\tindex, enable);\n \n-\tdev->virtqueue[msg->payload.state.index]->enabled = enable;\n+\tdev->virtqueue[index]->enabled = enable;\n \n \treturn 0;\n }\n@@ -1049,6 +1074,7 @@ static int\n vhost_user_send_rarp(struct virtio_net *dev, struct VhostUserMsg *msg)\n {\n \tuint8_t *mac = (uint8_t *)&msg->payload.u64;\n+\tint eid = dev->eid;\n \n \tRTE_LOG(DEBUG, VHOST_CONFIG,\n \t\t\":: mac: %02x:%02x:%02x:%02x:%02x:%02x\\n\",\n@@ -1064,6 +1090,10 @@ vhost_user_send_rarp(struct virtio_net *dev, struct VhostUserMsg *msg)\n \t */\n \trte_smp_wmb();\n \trte_atomic16_set(&dev->broadcast_rarp, 1);\n+\tif (eid >= 0 && vdpa_engines[eid] &&\n+\t\t\tvdpa_engines[eid]->eng_drv &&\n+\t\t\tvdpa_engines[eid]->eng_drv->dev_ops.migration_done)\n+\t\tvdpa_engines[eid]->eng_drv->dev_ops.migration_done(dev->vid);\n \n \treturn 0;\n }\n@@ -1526,8 +1556,18 @@ vhost_user_msg_handler(int vid, int fd)\n \t\t\t\t\t\t\"dequeue zero copy is enabled\\n\");\n \t\t\t}\n \n-\t\t\tif (dev->notify_ops->new_device(dev->vid) == 0)\n+\t\t\tif (dev->notify_ops->new_device(vid) == 0)\n \t\t\t\tdev->flags |= VIRTIO_DEV_RUNNING;\n+\n+\t\t\tstruct rte_vdpa_engine *eng;\n+\t\t\tint eid = dev->eid;\n+\n+\t\t\tif (eid >= 0) {\n+\t\t\t\teng = vdpa_engines[eid];\n+\t\t\t\tif (eng && eng->eng_drv &&\n+\t\t\t\t\t\teng->eng_drv->dev_ops.dev_conf)\n+\t\t\t\t\teng->eng_drv->dev_ops.dev_conf(vid);\n+\t\t\t}\n \t\t}\n \t}\n \n", "prefixes": [ "dpdk-dev", "5/7" ] }{ "id": 34876, "url": "