From patchwork Thu Jul 19 19:13:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Nikolaev X-Patchwork-Id: 142377 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2093413ljj; Thu, 19 Jul 2018 12:13:34 -0700 (PDT) X-Google-Smtp-Source: AAOMgpd+NmutXVl94tSYjt0FGYdXRFncArXlrIgLZVUWTFUu32OzTq2U078zQWgbNLo+6YFGr01z X-Received: by 2002:a1c:b80c:: with SMTP id i12-v6mr4846879wmf.30.1532027614375; Thu, 19 Jul 2018 12:13:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532027614; cv=none; d=google.com; s=arc-20160816; b=QUOYMtpZuLObDwBfV+ChE2sXvDRLddS+ViTH5VcCnASFzV+r2sxW55E5rLhjUHuDVN IcVDdq5MjLdDd6gucQvkMRTKIdohX2RjheOBZPU1V7MSCb2J9YNyMyZP7djFEH7SlPJC kDm9XejKunjT9yrVwqy5g77DCqoPkXLKqT79hM2D6ZoNGKokn1248/MKORUfgtXhORFK m7k3fgNwv3ZSltFk0kLFZQrIysSXMZmKZqwjDhmObh+RLRMROsqlzbQ9PfnXxoiX1gwY EFa7PrPKBRHLo7F5ah1Vqw3rRLsns3wbo5amFh5ZaKmK7xoOn3LAEl12tT4sXLX/CIdC BqUA== 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 :arc-authentication-results; bh=LlwHzfaxIoFmiP+qbtyHxok2KSAD9DezgDgcQ0/NNkQ=; b=z/htqdr43gjud7tpaGdse2EqxShsZmjgofzNgSHoSoLtNTWRtgcRoB57YepmJw5l/D lpgo89a+lNTGCv0lRfeEVbKDwT/josJEqSgPlIBLiaFQapd2l6qjY+05KfPTgiiSD/oY 0uvEb8BI6YVNj8+Eqm3cgiYEWAFuU06vjoF31SWxQSuEF5wgGWMQpuktBRPm6pKx1nCj xCELY7glj4rmHUkgZEj7OLDL0CY2Oqnf+6ItkRmtWO/NkaUZGUvSi6wTfMDBo4bK37XK n+vlNtqZPFYAhm6C2wAIRgSER8NwWshV99NMDz7Htywgd801Oh/ddtWooNDQmUNVFcIA CrRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=RaYcZ0Qt; 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 x3-v6si5724884wrb.173.2018.07.19.12.13.34; Thu, 19 Jul 2018 12:13:34 -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=RaYcZ0Qt; 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 834AA5B20; Thu, 19 Jul 2018 21:13:30 +0200 (CEST) Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com [74.125.82.68]) by dpdk.org (Postfix) with ESMTP id 9D10D5B1C for ; Thu, 19 Jul 2018 21:13:29 +0200 (CEST) Received: by mail-wm0-f68.google.com with SMTP id z13-v6so7465194wma.5 for ; Thu, 19 Jul 2018 12:13: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=LlwHzfaxIoFmiP+qbtyHxok2KSAD9DezgDgcQ0/NNkQ=; b=RaYcZ0QtcdoZOdJsB+7ZvReEW//faJzn1ACwQnzUUrvzRSd3vcU5XchBJ5ja14cdZA e6cHI4z9M2liSAyeVGT2uUd6WXN+tYXq0gMzKkXCkx1wQ80f7Sp8jZUyJlPtRWOMtZ3l oKQj0eYioL0is77FJnJH4QgfR468nTJBG6PKm96W889pQTKjOq3uswaSv0+KavLUD1qK eNbp9PmMKjomodOsZfyyy5NwcNpNpH86XMttFSq7wG74rktu7+xuk8NPhzEXA/b+4R9s D918LaQFn7vu+SIY1t8JhZIFtgD+CDUNTycmsYPuS0oWwwjeSo+sz3xhmWBL+3+woftS 6hVA== 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=LlwHzfaxIoFmiP+qbtyHxok2KSAD9DezgDgcQ0/NNkQ=; b=L0vNfTCv3Cfd5UQeqx9D6KKPddEB+NMLHQLjYfWTA5Gn5Eseo43jGJVh5qKRQbe998 b8W+8XqWcF1ZMJEcvVgax2Jtw56dpxvS/8edhNe4bKMRFCSVzA6IK6bLw3JYlLXkP2ux oOfu1GEp+OGmI+85d3fBl60lywwGhqiKQVOlwSU2aY8qORONapn4aE0oXQQX0h/CbdQu aHP29jnQCunso/X56hIGu5dPIJqeZLylyomNu1FgjeSkOeqVd7GkTTahBAjKLgyxsCZ4 nxEo69aWHzZYtSiBGgmQd6GuRfmlVyLx0yQ6qxfkajkntCWJRIuz3IchEeFsbT4MURmf inrw== X-Gm-Message-State: AOUpUlGSLEITRMuWDrLkRRE7pIIkBNor5J7iATXGrMP0bApktqhBAzhD GRBfPOfsvqptU2tZK8JEs6chpijt6FE= X-Received: by 2002:a1c:cbc1:: with SMTP id b184-v6mr5319418wmg.149.1532027609070; Thu, 19 Jul 2018 12:13:29 -0700 (PDT) Received: from [127.0.1.1] ([82.146.27.14]) by smtp.gmail.com with ESMTPSA id r8-v6sm148056wmh.37.2018.07.19.12.13.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Jul 2018 12:13:28 -0700 (PDT) From: Nikolay Nikolaev To: maxime.coquelin@redhat.com, tiwei.bie@intel.com, zhihong.wang@intel.com Cc: dev@dpdk.org Date: Thu, 19 Jul 2018 22:13:27 +0300 Message-ID: <153202760738.21481.2953475302358332226.stgit@T460> In-Reply-To: <153202755842.21481.1772155561595981441.stgit@T460> References: <153202755842.21481.1772155561595981441.stgit@T460> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v2 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(-) Reviewed-by: Maxime Coquelin diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c index dc53ff712..d51616695 100644 --- a/lib/librte_vhost/vhost_user.c +++ b/lib/librte_vhost/vhost_user.c @@ -778,10 +778,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; @@ -802,7 +802,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; } @@ -838,7 +838,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; @@ -987,16 +987,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); @@ -1008,17 +1008,17 @@ vhost_user_set_vring_call(struct virtio_net *dev, struct VhostUserMsg *pmsg) } static void -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); @@ -1145,7 +1145,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; @@ -1176,7 +1176,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; @@ -1243,7 +1243,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; @@ -1272,7 +1272,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) { @@ -1288,7 +1288,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]; @@ -1354,7 +1354,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; @@ -1400,7 +1400,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; @@ -1429,7 +1429,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; @@ -1439,7 +1439,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; @@ -1453,7 +1453,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; @@ -1544,7 +1544,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; @@ -1832,7 +1832,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), @@ -1862,7 +1862,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),