From patchwork Mon Sep 24 15:21:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Nikolaev X-Patchwork-Id: 147372 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp849975lji; Mon, 24 Sep 2018 08:21:23 -0700 (PDT) X-Google-Smtp-Source: ANB0Vda/wy5j5z8tSMLwZj1vEYbSF2im/VPfmb+uK2IAGZLEtQ029tTXTtN6gG05SN8Et6UYz+QD X-Received: by 2002:a1c:c444:: with SMTP id u65-v6mr6407497wmf.10.1537802483099; Mon, 24 Sep 2018 08:21:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537802483; cv=none; d=google.com; s=arc-20160816; b=u77GgiakHjazDZkH5FUtKmM0TAxCRc5TPvClU+tub7fLtZ6YHl3xseUunRbpNmVCX+ 7fdwQ0/YQFwQs0SaPWxEHxVuG78zA6Tgail11+lBP0AIwk8Z4qMvHFdMdYGw4MzieBlK oAhlp4lJ/aLZFAeielTCTib6A2ZFBIAd5CJb1vLPc5CczmGOYCYt+BUP2YIgWT7W+RcE KezleAkx+WRHegiyefwWrECmNZrxeA2epO95nQzm7T7MnRtgdVBLQc8pMK/c3gmUOd9z uSfjcJCPDEaTk1cMf52gWdz2T44eDTlvHhP1BDeaIWIdICJBruO0XaFUh0dQZavtqmZn zRmw== 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=GagucRbq6oyWmL9eR2HZ2GMAWiZkxR/2TqRPS7LVps4q2FY9IcRIJFdaVAZ5AJo7g5 4vfPctXIe7lBYRpFTCXesyAFYmK7xr/IrzyWMiCSqj/axCk7laOW/e+Os313tFT2B1d3 GJEOXYA8EXEJXxZPhlTmqtOYQE2CXDfRFElbXWlV1DzfcWWB1d51nGFt7ryhN0pX70a7 63J4SE8eOR3+vKzvFWNj/6NbHHoVfKC9PESG2B8nr0+5yIpTpbWiOelGKC4lKx9nFLpP A1/iYI4NjMfA8fTG6UkQReh3z4KjZTC90aNyCEAz8nYCFcX4zSKAsjZ0jswPcWlMQJxD lH+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=TDZvPgk5; 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 o199-v6si14377132wmd.170.2018.09.24.08.21.22; Mon, 24 Sep 2018 08:21:23 -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=TDZvPgk5; 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 6D5455B1C; Mon, 24 Sep 2018 17:21:21 +0200 (CEST) Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) by dpdk.org (Postfix) with ESMTP id 65C615B1C for ; Mon, 24 Sep 2018 17:21:20 +0200 (CEST) Received: by mail-wr1-f68.google.com with SMTP id e1-v6so20120139wrt.3 for ; Mon, 24 Sep 2018 08:21:20 -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=TDZvPgk57ZCsnTo8SlwuVcyX2eDfXeu9FMn8UaXawc35sPEJL/qEd3C5kp6zrLgTLd I+4Z++dxCkoOCDpzTpYOpX8Sn41KLYRYcge1uoA+C9lU8s2QLkTvOfrOSg4PTRxISIQh clkT4eihoPSZOwv/UyknwOPOl2N2n+A6T+FnyEyZU/R63++8Aj5jdVuwNY0aQHTVcd7x dsAzMw3yQUzvE/5m6VsNpZABipxc/TyJbBIFL5wyVXj2FHaJ2hL3GUyzDeUxemccAdnl 39e3I+2RKgBvFjZIdbe5WVuV+fRmK0rI6diU56GFWcMGcasduG0fJTTsI5r7UMpNaijs Fusw== 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=V9yf04nWtdFgkYt/OgE8u9jviZSeiNyiwQ4s6Tn7p0SrXS8Wi1IQ/L0nrJ6ooIMAcW Svq5wIWJAzrtfo4JjK6jUHj6ydnfmGh0e6G4n4BosowXWqnRIJ+E8bXNxFZ3PWUSv258 TdAl9lB+1apLku7h6Z1i8ZYlV7fz58cikUHyteFGldnK2aYqi80jOzmndJqIVau5gPa6 MnFlo5mgchaUJmiSXPKmhuGhU6Muk44adY/OTPxGWIOxBK/oVqQgBOh7O5RhFnwf7bGo 2EE+Z7XrO2FL95e0+3sGd6hahF6Xw8orxSmT0VsLr1svk5VenUZkKIQJAAW/Mggr7LAN oqww== X-Gm-Message-State: ABuFfojFVUcdUN13nCC2YhxoglL/kEM7fC6gbfZkasPBnfmlW8v1uhJ7 3fqkmdRN7gkWTlPOO04+WtOJd1lG8EeqHw== X-Received: by 2002:adf:b643:: with SMTP id i3-v6mr1432949wre.14.1537802479827; Mon, 24 Sep 2018 08:21:19 -0700 (PDT) Received: from [127.0.1.1] ([82.146.27.14]) by smtp.gmail.com with ESMTPSA id k63-v6sm34175917wmd.46.2018.09.24.08.21.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 24 Sep 2018 08:21:19 -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 18:21:18 +0300 Message-ID: <153780247799.17494.1497329604412264404.stgit@T460> In-Reply-To: <153780242838.17494.4512397995243433980.stgit@T460> References: <153780242838.17494.4512397995243433980.stgit@T460> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v5 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)