From patchwork Mon Sep 24 20:17:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Nikolaev X-Patchwork-Id: 147382 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp1129510lji; Mon, 24 Sep 2018 13:17:08 -0700 (PDT) X-Google-Smtp-Source: ACcGV62RExZtl+t/GfPi35oMpg1BnlphwRSbeZaVhbksEmiqVzz4XATI7q0+/TAMioVEJbgUezTj X-Received: by 2002:a50:e40d:: with SMTP id d13-v6mr19736911edm.263.1537820228556; Mon, 24 Sep 2018 13:17:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537820228; cv=none; d=google.com; s=arc-20160816; b=U7b928iHf4jbQF6pESQQ+J7uLeDD4ONAQ0zDjqQq781WfsAScZAqRDuUBX9n+yfgDy jLxmtVxsgHi/WJFC3ppVzLOcQ9oB1u33+ZCzuXWwjF0To4kReumIv++20tFT5IlQorHi XSZ1+3wBLM16fkFdzMr+BCiWKvH58mymxYGfONN/TCbUUmbYP4lYMFKOu0I5becpNBrJ D29CZSmKk8NsnGC/2FaOtMrO2ySLm+uYP69k+T8y8Cse26CkOtAJSNdla4UhOby0F+CE wqUXLl7g1pdkdNo8ZnvJpK7OW/RZuxyCWZu/0hqDZ0KQNVGrtVsTm+7G3NqD9YBHoO08 18PQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:user-agent:references :in-reply-to:message-id:date:cc:to:from:dkim-signature; bh=pUfkQVMKM2Fv1RqwcmlLcUmN3XeXvKMFDpnlfeDA+38=; b=bNcUuByhgKHVemhiZt/pQtQarc16bEsakF5z87ubY+5AasPbZXPW/PAx7WBAq1mvoB F990QL/R36QkegN/Y4heY54woz+M1ZOCxxxBtcp1zdOtnJbtrM7oznqIZEgVF2ECiVlC 1kr/4xVmkeQ4lfvZpRUje5+l28i0STYSv4WmfEGy3pKTT1AGV5+zYSIQW4c35x/qw0jN gFfg5EWQs2Z15m+e7as/aQKipT9/AGGDPMUca/UsovcLFCxeZhZ/F81rDECL+ThHcsYU lARPA3EtrrsYqcYg8fv5VYQ0YqoXXovYSq5jLJXDILD7QZXtW+SEoaeiev2JkX/3AonY 8Sng== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=O4o55Sol; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from dpdk.org (dpdk.org. [92.243.14.124]) by mx.google.com with ESMTP id n6-v6si2898370edn.294.2018.09.24.13.17.08; Mon, 24 Sep 2018 13:17:08 -0700 (PDT) Received-SPF: pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) client-ip=92.243.14.124; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=O4o55Sol; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id CE2031B17F; Mon, 24 Sep 2018 22:17:07 +0200 (CEST) Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by dpdk.org (Postfix) with ESMTP id 08D751B170 for ; Mon, 24 Sep 2018 22:17:07 +0200 (CEST) Received: by mail-wr1-f67.google.com with SMTP id t15so13077749wrx.1 for ; Mon, 24 Sep 2018 13:17:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:from:to:cc:date:message-id:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=pUfkQVMKM2Fv1RqwcmlLcUmN3XeXvKMFDpnlfeDA+38=; b=O4o55Solmb9InpE1cl+vBX40UfjfelKHd3Sz12hnt9OHaZrLjCKA23/0MUKYKnKvKU W2b3e5G2D4NDQ9qylEXgLAapQNm0EWZsWXk/j1fXR4rFrA4j+3ssdSaqLJIWiJhXzKpB axjGIMJOPI8MKEGjwWwmfsbVyFX0uwa3ybZSFA5d9Xr8iN3RxWi1jpkMwL9y9qTYp0EN 7WhIl0TdUoNNZQKvC7ovySXD9nDwf55CVyGRiXIJpaHi04kas19ohoHQ3yUKWGT6fTBp pzoqPSrGqrAOvQ1trbD+ncTguBh/U9xGpzN5NXyZUzrwvDAfxcDCK5i9mEQIR1kyeWyh 6PuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:date:message-id:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=pUfkQVMKM2Fv1RqwcmlLcUmN3XeXvKMFDpnlfeDA+38=; b=GbgkguAkT3N4WtOsNDjTwr4Ykkp2Rm4ojZf9jgRM+9iz2OCyf15hRw7eXNvEid8nL5 F9h2gel6+4aT8nu+Ojg4WT7kbx66vb3AgMGy+15sjbkQvnHFephWikgsISLx+VDimYqx 0e4fojF0sIxNRvxIcVpY2f6FOyS2ESN0UqUlx1ITikkgQgHW1pd6gz2t2ThU4kL5mtLg tiRHtF71SOW1bb5c1QX7zHdianP9a2geSAbMQzOfKDPZbUYElD559h0kJC6gtdqWdXbV rdp7EzFKY7FwtGSz0VKsnZJvXpw0gRaxxRahPV8AediSTKxboWNGO7AkiCo5XBYWKwtD ffDA== X-Gm-Message-State: ABuFfogGlbJGt9eEZTZe7dd4MyqzcXzPcmoRhY7czmVWr2dq5ZcBMVYe MWpyaJy0YeV7+wP82aX65LGMyYxHOFUQsQ== X-Received: by 2002:a5d:6a46:: with SMTP id t6-v6mr333024wrw.192.1537820226410; Mon, 24 Sep 2018 13:17:06 -0700 (PDT) Received: from [127.0.1.1] ([82.146.27.14]) by smtp.gmail.com with ESMTPSA id e7-v6sm431977wrs.25.2018.09.24.13.17.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 24 Sep 2018 13:17:05 -0700 (PDT) From: Nikolay Nikolaev To: maxime.coquelin@redhat.com, anatoly.burakov@intel.com, tiwei.bie@intel.com, zhihong.wang@intel.com Cc: dev@dpdk.org Date: Mon, 24 Sep 2018 23:17:04 +0300 Message-ID: <153782022417.27450.3107419616649123360.stgit@T460> In-Reply-To: <153782013094.27450.17651924330876922486.stgit@T460> References: <153782013094.27450.17651924330876922486.stgit@T460> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v6 1/5] vhost: unify struct VhostUserMsg usage X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Do not use the typedef version of struct VhostUserMsg. Also unify the related parameter name. Signed-off-by: Nikolay Nikolaev --- lib/librte_vhost/vhost_user.c | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) Reviewed-by: Anatoly Burakov diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c index 63d145b2d..505db3bfc 100644 --- a/lib/librte_vhost/vhost_user.c +++ b/lib/librte_vhost/vhost_user.c @@ -250,7 +250,7 @@ vhost_user_set_features(struct virtio_net *dev, uint64_t features) */ static int vhost_user_set_vring_num(struct virtio_net *dev, - VhostUserMsg *msg) + struct VhostUserMsg *msg) { struct vhost_virtqueue *vq = dev->virtqueue[msg->payload.state.index]; @@ -611,7 +611,7 @@ translate_ring_addresses(struct virtio_net *dev, int vq_index) * This function then converts these to our address space. */ static int -vhost_user_set_vring_addr(struct virtio_net **pdev, VhostUserMsg *msg) +vhost_user_set_vring_addr(struct virtio_net **pdev, struct VhostUserMsg *msg) { struct vhost_virtqueue *vq; struct vhost_vring_addr *addr = &msg->payload.addr; @@ -648,7 +648,7 @@ vhost_user_set_vring_addr(struct virtio_net **pdev, VhostUserMsg *msg) */ static int vhost_user_set_vring_base(struct virtio_net *dev, - VhostUserMsg *msg) + struct VhostUserMsg *msg) { dev->virtqueue[msg->payload.state.index]->last_used_idx = msg->payload.state.num; @@ -780,10 +780,10 @@ vhost_memory_changed(struct VhostUserMemory *new, } static int -vhost_user_set_mem_table(struct virtio_net **pdev, struct VhostUserMsg *pmsg) +vhost_user_set_mem_table(struct virtio_net **pdev, struct VhostUserMsg *msg) { struct virtio_net *dev = *pdev; - struct VhostUserMemory memory = pmsg->payload.memory; + struct VhostUserMemory memory = msg->payload.memory; struct rte_vhost_mem_region *reg; void *mmap_addr; uint64_t mmap_size; @@ -804,7 +804,7 @@ vhost_user_set_mem_table(struct virtio_net **pdev, struct VhostUserMsg *pmsg) "(%d) memory regions not changed\n", dev->vid); for (i = 0; i < memory.nregions; i++) - close(pmsg->fds[i]); + close(msg->fds[i]); return 0; } @@ -845,7 +845,7 @@ vhost_user_set_mem_table(struct virtio_net **pdev, struct VhostUserMsg *pmsg) dev->mem->nregions = memory.nregions; for (i = 0; i < memory.nregions; i++) { - fd = pmsg->fds[i]; + fd = msg->fds[i]; reg = &dev->mem->regions[i]; reg->guest_phys_addr = memory.regions[i].guest_phys_addr; @@ -994,16 +994,16 @@ virtio_is_ready(struct virtio_net *dev) } static void -vhost_user_set_vring_call(struct virtio_net *dev, struct VhostUserMsg *pmsg) +vhost_user_set_vring_call(struct virtio_net *dev, struct VhostUserMsg *msg) { struct vhost_vring_file file; struct vhost_virtqueue *vq; - file.index = pmsg->payload.u64 & VHOST_USER_VRING_IDX_MASK; - if (pmsg->payload.u64 & VHOST_USER_VRING_NOFD_MASK) + file.index = msg->payload.u64 & VHOST_USER_VRING_IDX_MASK; + if (msg->payload.u64 & VHOST_USER_VRING_NOFD_MASK) file.fd = VIRTIO_INVALID_EVENTFD; else - file.fd = pmsg->fds[0]; + file.fd = msg->fds[0]; RTE_LOG(INFO, VHOST_CONFIG, "vring call idx:%d file:%d\n", file.index, file.fd); @@ -1015,17 +1015,17 @@ vhost_user_set_vring_call(struct virtio_net *dev, struct VhostUserMsg *pmsg) } static int -vhost_user_set_vring_kick(struct virtio_net **pdev, struct VhostUserMsg *pmsg) +vhost_user_set_vring_kick(struct virtio_net **pdev, struct VhostUserMsg *msg) { struct vhost_vring_file file; struct vhost_virtqueue *vq; struct virtio_net *dev = *pdev; - file.index = pmsg->payload.u64 & VHOST_USER_VRING_IDX_MASK; - if (pmsg->payload.u64 & VHOST_USER_VRING_NOFD_MASK) + file.index = msg->payload.u64 & VHOST_USER_VRING_IDX_MASK; + if (msg->payload.u64 & VHOST_USER_VRING_NOFD_MASK) file.fd = VIRTIO_INVALID_EVENTFD; else - file.fd = pmsg->fds[0]; + file.fd = msg->fds[0]; RTE_LOG(INFO, VHOST_CONFIG, "vring kick idx:%d file:%d\n", file.index, file.fd); @@ -1073,7 +1073,7 @@ free_zmbufs(struct vhost_virtqueue *vq) */ static int vhost_user_get_vring_base(struct virtio_net *dev, - VhostUserMsg *msg) + struct VhostUserMsg *msg) { struct vhost_virtqueue *vq = dev->virtqueue[msg->payload.state.index]; @@ -1126,7 +1126,7 @@ vhost_user_get_vring_base(struct virtio_net *dev, */ static int vhost_user_set_vring_enable(struct virtio_net *dev, - VhostUserMsg *msg) + struct VhostUserMsg *msg) { int enable = (int)msg->payload.state.num; int index = (int)msg->payload.state.index; @@ -1485,7 +1485,8 @@ send_vhost_slave_message(struct virtio_net *dev, struct VhostUserMsg *msg, * Allocate a queue pair if it hasn't been allocated yet */ static int -vhost_user_check_and_alloc_queue_pair(struct virtio_net *dev, VhostUserMsg *msg) +vhost_user_check_and_alloc_queue_pair(struct virtio_net *dev, + struct VhostUserMsg *msg) { uint16_t vring_idx; @@ -1818,9 +1819,9 @@ vhost_user_msg_handler(int vid, int fd) } static int process_slave_message_reply(struct virtio_net *dev, - const VhostUserMsg *msg) + const struct VhostUserMsg *msg) { - VhostUserMsg msg_reply; + struct VhostUserMsg msg_reply; int ret; if ((msg->flags & VHOST_USER_NEED_REPLY) == 0)