From patchwork Sat Sep 15 05:20:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Nikolaev X-Patchwork-Id: 146751 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp1445928ljw; Fri, 14 Sep 2018 22:20:33 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZ7O50cim4mbn4LC0laZLQHk5vZm6loRCHo2I5WDH4Ww2rcSeMOAWn5aceg69ObLQwZW62u X-Received: by 2002:a1c:ef0f:: with SMTP id n15-v6mr4274602wmh.116.1536988833762; Fri, 14 Sep 2018 22:20:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536988833; cv=none; d=google.com; s=arc-20160816; b=jjrzWQoi/9euYC4mJeqRShul9Gjf4Fnx0glY27eygi335+KpwcxCyodI+/ksUBV+7+ ccqx52EKjfg5jALLJjvXT710zFFrvXVdeoiKlfKJbh0bi0+ZvQ1EtNUMRM3IsZEIgoDF 6rdSaHBep8anbf/dSevnm7cBwmyQW8qkPpOUykhku1aq+0QrAkvgYauT1Hn5mujqHWEa RKKUGzyR0TPt3xqunkW7ifO9csXEWVrneKfPUN/GuP0K/jj+VTu7hNlBUgAVBcLNQSz7 X4ff3zXHxMVYzz8e6fF4lPLEcuAcCa5fX1i5qVNqUtN9f+r7kr1Mpx2obYW9Knkyj9Kc dLsA== 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=8taa9XgI5YYGxpKLquS4UvJx3nBqTBYDZP5xcINngKE=; b=JPL7EfmSA5FF1LpxJwIDivBaLjOxFf/aNGpiLft1Zhb3prkXhl6ggd31NHlu0C9KYs 1EooaBKp6ZruYN3BECvubt7z8ObVdX38UlczyTNFf2z7U8RVxClWy5fp2QWGw55LLLzm MydRRgQHPyIvKW/XALOQPBSLKMPXt1a/cah6OXgfbqJGunseHn2u7W77b5BhEm/y185C OsOB9YuXt25BIcuY9SDaSg5B/M/CRuHKH+BIFzg39OcXxSe5AJg1TbcQP2A2cLHd5XJR VvGvnRX4zseLLHBiQ5zW++DTfRaE6oVpb4uQ7Jho/FZc8Ajd2BjsP1UcN6vwapTtxBl5 KEQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=pufiPCIp; 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 y84-v6si903498wmc.76.2018.09.14.22.20.33; Fri, 14 Sep 2018 22:20:33 -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=pufiPCIp; 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 EAF024C94; Sat, 15 Sep 2018 07:20:30 +0200 (CEST) Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) by dpdk.org (Postfix) with ESMTP id 7CB1F2BD5 for ; Sat, 15 Sep 2018 07:20:29 +0200 (CEST) Received: by mail-wm1-f65.google.com with SMTP id n11-v6so3940820wmc.2 for ; Fri, 14 Sep 2018 22:20:29 -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=8taa9XgI5YYGxpKLquS4UvJx3nBqTBYDZP5xcINngKE=; b=pufiPCIpTBazefzzOv6RfY9REzjo0cXa9GAQeI2kjnvRNJV6PHYXA8XL3bfTqcVFfM TsSsoaDeSaREZAQGxmLoj/Ch/Rbq5ZbjWArQTDXEfqSFAKUvlRVaMjm6I7210KGKNWBf iQ6uk+AZYfsU59TmPOMFxiIP+70uj1cHk7NRne1YD3Hf6xEanCEgTxC3yBQus55YQ0tF r/UDEiVbfVxBukWtKIc7hO3j65EFgMjwSdAW3D9GqeSzNPXMmOd0m+qNlx+9aq7LEr0j ggXpxea4qRYjBorK+oYBI3km2khrAVnLUDEdPg6Ztqo7O6jRf2mF/GXOmwOr+PIC1Z55 JiQQ== 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=8taa9XgI5YYGxpKLquS4UvJx3nBqTBYDZP5xcINngKE=; b=i1qvYrJbRnLk2EDWyKwnycpInMllMMROLccqBj8+AowbOObPiC7cLocBoUzldqUohY akDqmlhhkzYa65eELL7NCY+8IcFvgDmP7qxM8cDqE9ys8WdLHEltN7pX5iykujjGB3zX nEQd89W2RYmt1Dq2VdRF6JTO9DGx6QfRBcuP0B6RG0zOFY9ltbvZ0d5ichsQoot7Qps8 aXzjxbkExZ8b67ZuhnH4dw+2/VwostoZDOCvjJdwgpQpDPqXPd2pADffyUHAKFw8vbs1 jPm4Y9KPf43LbmfCHrTemjyAX5enGV/02O0hhR6k8s/f9DqP5S04DauJH7GknEF7fhHO C55Q== X-Gm-Message-State: APzg51C/DHLPuNMWh1mWPOS297PCSzg8WaqJLJoIBY+J8vR9X8pj4YKD zX/5pMqLNU7Fzddh5STXjvBOkoDGKPG/cg== X-Received: by 2002:a1c:578a:: with SMTP id l132-v6mr4455588wmb.16.1536988828892; Fri, 14 Sep 2018 22:20:28 -0700 (PDT) Received: from [127.0.1.1] ([82.146.27.14]) by smtp.gmail.com with ESMTPSA id f6-v6sm6323398wrr.68.2018.09.14.22.20.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Sep 2018 22:20:28 -0700 (PDT) From: Nikolay Nikolaev To: maxime.coquelin@redhat.com, tiwei.bie@intel.com, zhihong.wang@intel.com Cc: dev@dpdk.org Date: Sat, 15 Sep 2018 08:20:26 +0300 Message-ID: <153698882681.23049.10483393218056672951.stgit@T460> In-Reply-To: <153698873346.23049.10966616323159180622.stgit@T460> References: <153698873346.23049.10966616323159180622.stgit@T460> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v3 1/5] vhost: unify 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" Use the typedef version of struct VhostUserMsg. Also unify the related parameter name. Signed-off-by: Nikolay Nikolaev --- lib/librte_vhost/vhost_user.c | 50 +++++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c index 63d145b2d..b05b57670 100644 --- a/lib/librte_vhost/vhost_user.c +++ b/lib/librte_vhost/vhost_user.c @@ -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, 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, 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, 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); @@ -1153,7 +1153,7 @@ vhost_user_set_vring_enable(struct virtio_net *dev, static void vhost_user_get_protocol_features(struct virtio_net *dev, - struct VhostUserMsg *msg) + VhostUserMsg *msg) { uint64_t features, protocol_features; @@ -1189,7 +1189,7 @@ vhost_user_set_protocol_features(struct virtio_net *dev, } static int -vhost_user_set_log_base(struct virtio_net *dev, struct VhostUserMsg *msg) +vhost_user_set_log_base(struct virtio_net *dev, VhostUserMsg *msg) { int fd = msg->fds[0]; uint64_t size, off; @@ -1256,7 +1256,7 @@ vhost_user_set_log_base(struct virtio_net *dev, struct VhostUserMsg *msg) * a flag 'broadcast_rarp' to let rte_vhost_dequeue_burst() inject it. */ static int -vhost_user_send_rarp(struct virtio_net *dev, struct VhostUserMsg *msg) +vhost_user_send_rarp(struct virtio_net *dev, VhostUserMsg *msg) { uint8_t *mac = (uint8_t *)&msg->payload.u64; struct rte_vdpa_device *vdpa_dev; @@ -1285,7 +1285,7 @@ vhost_user_send_rarp(struct virtio_net *dev, struct VhostUserMsg *msg) } static int -vhost_user_net_set_mtu(struct virtio_net *dev, struct VhostUserMsg *msg) +vhost_user_net_set_mtu(struct virtio_net *dev, VhostUserMsg *msg) { if (msg->payload.u64 < VIRTIO_MIN_MTU || msg->payload.u64 > VIRTIO_MAX_MTU) { @@ -1301,7 +1301,7 @@ vhost_user_net_set_mtu(struct virtio_net *dev, struct VhostUserMsg *msg) } static int -vhost_user_set_req_fd(struct virtio_net *dev, struct VhostUserMsg *msg) +vhost_user_set_req_fd(struct virtio_net *dev, VhostUserMsg *msg) { int fd = msg->fds[0]; @@ -1367,7 +1367,7 @@ is_vring_iotlb_invalidate(struct vhost_virtqueue *vq, } static int -vhost_user_iotlb_msg(struct virtio_net **pdev, struct VhostUserMsg *msg) +vhost_user_iotlb_msg(struct virtio_net **pdev, VhostUserMsg *msg) { struct virtio_net *dev = *pdev; struct vhost_iotlb_msg *imsg = &msg->payload.iotlb; @@ -1413,7 +1413,7 @@ vhost_user_iotlb_msg(struct virtio_net **pdev, struct VhostUserMsg *msg) /* return bytes# of read on success or negative val on failure. */ static int -read_vhost_message(int sockfd, struct VhostUserMsg *msg) +read_vhost_message(int sockfd, VhostUserMsg *msg) { int ret; @@ -1442,7 +1442,7 @@ read_vhost_message(int sockfd, struct VhostUserMsg *msg) } static int -send_vhost_message(int sockfd, struct VhostUserMsg *msg, int *fds, int fd_num) +send_vhost_message(int sockfd, VhostUserMsg *msg, int *fds, int fd_num) { if (!msg) return 0; @@ -1452,7 +1452,7 @@ send_vhost_message(int sockfd, struct VhostUserMsg *msg, int *fds, int fd_num) } static int -send_vhost_reply(int sockfd, struct VhostUserMsg *msg) +send_vhost_reply(int sockfd, VhostUserMsg *msg) { if (!msg) return 0; @@ -1466,7 +1466,7 @@ send_vhost_reply(int sockfd, struct VhostUserMsg *msg) } static int -send_vhost_slave_message(struct virtio_net *dev, struct VhostUserMsg *msg, +send_vhost_slave_message(struct virtio_net *dev, VhostUserMsg *msg, int *fds, int fd_num) { int ret; @@ -1557,7 +1557,7 @@ int vhost_user_msg_handler(int vid, int fd) { struct virtio_net *dev; - struct VhostUserMsg msg; + VhostUserMsg msg; struct rte_vdpa_device *vdpa_dev; int did = -1; int ret; @@ -1850,7 +1850,7 @@ int vhost_user_iotlb_miss(struct virtio_net *dev, uint64_t iova, uint8_t perm) { int ret; - struct VhostUserMsg msg = { + VhostUserMsg msg = { .request.slave = VHOST_USER_SLAVE_IOTLB_MSG, .flags = VHOST_USER_VERSION, .size = sizeof(msg.payload.iotlb), @@ -1880,7 +1880,7 @@ static int vhost_user_slave_set_vring_host_notifier(struct virtio_net *dev, int *fdp = NULL; size_t fd_num = 0; int ret; - struct VhostUserMsg msg = { + VhostUserMsg msg = { .request.slave = VHOST_USER_SLAVE_VRING_HOST_NOTIFIER_MSG, .flags = VHOST_USER_VERSION | VHOST_USER_NEED_REPLY, .size = sizeof(msg.payload.area),