From patchwork Sat Sep 22 21:16:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Nikolaev X-Patchwork-Id: 147323 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp1157087ljw; Sat, 22 Sep 2018 14:16:39 -0700 (PDT) X-Google-Smtp-Source: ACcGV60LqDbgCBmFOp9hqtZJRmkKw1sbUgpA8kGyJ49+TRQuXNGKg4bkfsSolVlDzihn0Gnd5c+n X-Received: by 2002:adf:c78e:: with SMTP id l14-v6mr2992426wrg.230.1537650999522; Sat, 22 Sep 2018 14:16:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537650999; cv=none; d=google.com; s=arc-20160816; b=iPddGWsZ5RXmpczd414rFS9O7k48f9pZKc1x+8+D2u21vezgf/jAC1IUXhlQR6Ntd+ 3SMN6ByZ/SOggUXO8lw/TsTPBZg0lXKmPD3XZz9fzY55xuNVfz4TN3qKNvX24YYKB7/v 8tdRGNUVZI1dBL2K/A8spQ/JAES/RZzBZOzhCG9yVL2AMg1bSDf6HvyxzJ1om9ay6QvP udeMw5DMXpOs8/cmxtWdB04PEv4X7bbrtS0BaE6TUJ2xtv/aE+0299IAQW6VtoJiYWyJ eDwwOOZIqQPljt0+xOnspSzfFd8s3SdAH8g62VY7HOqiTLBhURc8sb4BVo905hzQyfNA N4zA== 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=N5Ywvysvp0IOjbU7snCWTEgui6q8YSi7lFlnTtv8hzHDl9XWphW/XrBuHpgD4gi8rG PsrLgdst+1lmLaDF5Ukjy0qtX1b4FT5dPFgJhfG5c26njIK1VxBxCMwgBEp2kT2BYd33 vC+tx95WPfs6l4Ka6/1nQ9tbFZWWJfu0AaaoNeLGQvy86YsRBzU9iOuTaSH06KrbZZlA Aw9Vukh6De1acLr9j2co4kXoTxK3JdUhAS6s7LklOQZJnL1gVajOnNmJj+G/XmZycIBD +n4gR/SbnigmZjXqfzOrNgg33HZGfwV+2rgnjA3ZXy1oNMeiAOHzsQRqfPg1nilYrVKE JDcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=LY2MiE1a; 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 ([92.243.14.124]) by mx.google.com with ESMTP id w12-v6si1808894wrl.27.2018.09.22.14.16.39; Sat, 22 Sep 2018 14:16:39 -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=LY2MiE1a; 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 727CF4C74; Sat, 22 Sep 2018 23:16:33 +0200 (CEST) Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by dpdk.org (Postfix) with ESMTP id 82D1E2B92 for ; Sat, 22 Sep 2018 23:16:32 +0200 (CEST) Received: by mail-wr1-f66.google.com with SMTP id v16-v6so16020190wro.11 for ; Sat, 22 Sep 2018 14:16:32 -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=LY2MiE1ai04mlUhiFwqZolBK+ENqzL4phF3oEwadsrKhfA2kGFn6XXekGWPjD1d8eE obn2dKo4+GmFcJGog1D4KY8MQlw9QN7r8gO+NY9w65PBRl13lxNrVbq2lg9N4r7jo5O6 RIcMJSsdoLeJiMd4exj3+z1Z4xImdf+Y7NXI6RwVgu81QFLtQmlAtxAK9je3ukKuMJP/ QTtu1GMe4ifJdDRmY+BpR/TRsXIyIcMdAjLOUeoWyamhy7kzl3827gnlWD7qcAn6AIWU JR/+zaAgkRyhj9l00Lg0YquUkgRMKZ0bfh2+N9t9k+izkk2utp0F+OszkR1sh7QdozO0 liAg== 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=ofrk/iD9/j8H2MrTSnf2resV/01xmO7giEuDHrR+UNok8Sq4IIGdYpDjsN8+zYmMOp bJspSOC/FC5C3kR+Y5s+K+Wfl1IZ3ESI2jbycMsEiV17ZXZjHwwJVkJ6O5hkbFUf7h// WoZ/CUmMspQnDdqA5HRr5CG8+aLJdPZxXaSNjTY5+k9YLWXTPY/zxCD020D3KGTGBDHT TO6Jq+PRWinaUUXsRZjHc1gVdxZf2Z7prjd8km1lg+4/xJ80gPIWWg7udArJgzWkqv3o LU0/xoU7GUcLRD8acSSskK25hizoU+WeWtrng7VYOQUnZ0w7KAq521sm/rFEOoikLyu/ oAeQ== X-Gm-Message-State: ABuFfoikFVZYva/QV3vlMqgtFzK7Ik+/KeH8+z9xw3wDc6UFVKbr3ZG8 gf5XXOwfuGBHUx2nOF5oY30fHP9+TfvbLQ== X-Received: by 2002:a5d:610b:: with SMTP id v11-v6mr3088888wrt.265.1537650991746; Sat, 22 Sep 2018 14:16:31 -0700 (PDT) Received: from [127.0.1.1] ([82.146.27.14]) by smtp.gmail.com with ESMTPSA id j66-v6sm44025909wrj.28.2018.09.22.14.16.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 22 Sep 2018 14:16:31 -0700 (PDT) From: Nikolay Nikolaev To: maxime.coquelin@redhat.com, tiwei.bie@intel.com, zhihong.wang@intel.com Cc: dev@dpdk.org Date: Sun, 23 Sep 2018 00:16:30 +0300 Message-ID: <153765099015.29126.15895676194056985126.stgit@T460> In-Reply-To: <153765091094.29126.1031571146095035538.stgit@T460> References: <153765091094.29126.1031571146095035538.stgit@T460> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v4 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(-) 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)