From patchwork Tue Jun 26 16:19:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Nikolaev X-Patchwork-Id: 140005 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp5441109lji; Tue, 26 Jun 2018 09:19:13 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcOKsRtvj6mZU/NKSfOhAGsP46ihbxYyGAZVkRNz5EvVAkPk70i8e+0oTRBCVN2BHSnwQcn X-Received: by 2002:a1c:1983:: with SMTP id 125-v6mr1914811wmz.79.1530029953853; Tue, 26 Jun 2018 09:19:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530029953; cv=none; d=google.com; s=arc-20160816; b=C89OMWEd0LXa8kP2c0/FY3MFK+QHujgYYRr2ZyegwQiZ1MEpoKpdh6e9UDauH2NcLV nIZojF0c2SAXRoSMiYSXJktKytmbMZNTfwy2oh25yC8HfTDhyiQVDV3jJX3qJFVCNDJt AHtDc9I36JQfVy3KF+RkJx1itEXHH7s4ZhYMEgpeVpV8rojfhaVidmy3wJ6so5DnjVx3 nwHlEQFv17HdUOZYFBU2QsV26BMqS0so+/PoDK0wThZOdHUtzmCYDHLkeQdsoivUGy1b CPwkdyp4XqxB1qmB/V6Jlnqy/taFMjrHeZ7YUc7uHGAbcg1lTT479r/shlCnBeYmlTGE CHcQ== 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=S2hfINd+0OaSELPa37VybVZgVCvJixS7nuHCjLSxeu0=; b=PSXuw38UTj2Se+hFr0NTUmaA9clWYrfh9yQLIAKsbBXTIbM3Dg37YKg+z0QSDDEw5F 6PP0Q7tRgo7rpWM9MEsX1o4qjwzI4fNypSRUmjNGjXo164bmLfA0KaOWvre3lNGhuEK+ 8US1rlouBM62b6aI/lGzQG5ZYaba0zUCgA2DkRDJKTuyJSwthVrxiFB1n3qYjuz1u8oB JYg77Oy6gyQ96x8FLjtrc0Me3tk6U+KzL4QXjQ6DrOyUw1ySXZdW0S8HLWKvyulsGf8C YWeJ08EJFJlYeAbkhAKDwl+dW5MEEaTPoy1lO5iphVDaW4YFAlUWaDDaTGtGJ6EPhe7s gPGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=kLPAF0QH; 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 b6-v6si1750839wrm.331.2018.06.26.09.19.13; Tue, 26 Jun 2018 09:19:13 -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=kLPAF0QH; 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 3BEDF1BB09; Tue, 26 Jun 2018 18:19:13 +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 A92371B60B for ; Tue, 26 Jun 2018 18:19:12 +0200 (CEST) Received: by mail-wm0-f68.google.com with SMTP id z137-v6so2497608wmc.0 for ; Tue, 26 Jun 2018 09:19:12 -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=S2hfINd+0OaSELPa37VybVZgVCvJixS7nuHCjLSxeu0=; b=kLPAF0QHAl0hw1We6jRuoBoMUl2LlyrnsiF5EJOMvTP1kiZIZJdYKYQDR4C1eQutBY INd35IFERthUgB3G3i+oXHyc4F/RDEV7GjZDqkKRqSQxx7Sk1qbq2qaHvsy4vfg3mnSQ tmxDC5zUzzfR0LYV8ouA/I+Kr0fbybtpt6T95E1Mc3F2vA2jET21frAV3FiJAfo72hZt 1cZzCOyM+X6SWs7m+Yc2fprFo3pbAQqvX+laUpeYQP/i646IfqJ3Pfdu4p+3urnnqYpA W53EYg6fU++YTooa5Nl7TObUfv3MgHoKC6U2NpT7mzSq9aBFS6nqAl5SrE8+s0+whxmq y5TA== 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=S2hfINd+0OaSELPa37VybVZgVCvJixS7nuHCjLSxeu0=; b=UqVXN/Gs6+TuG+K4yO3rPJexx87Dml3hyjPEZmwHde18J4PVm2EkJQQwv3LbepzXQz uOLyeu1ekkE3+dDZTfZRjuqLkdywqztmbpC6XhIIHGlEz0ahCreyM555G5NmQmrFR58W lr3S2RVggIyk3tJebljtsYNesFpu6cVyl9Cvb0Z94oqS2jo2jLXf1yUa05tetLu09X/d gQ3fX4OiDBVtifC+Lk2CjdD/HnGUvbyBs2LDGdeYeKyhzEsVUn3MfxxJ58+yPJVA9ZZO zy5QyuDXFAVheygtt7xovY3b5t2g9mM49C7wG/jLGL95TyjdtkO+N4hhjIV7ipqnYU44 vdnw== X-Gm-Message-State: APt69E0zO8PTxHXOR44+ZfxH3osiLGUwmyUJ3ALHxx0ump1Ozc81T6t3 UOZ4fh+O7Q6eESM9RfVcE1oIy6cq X-Received: by 2002:a1c:8312:: with SMTP id f18-v6mr2231801wmd.127.1530029951942; Tue, 26 Jun 2018 09:19:11 -0700 (PDT) Received: from [127.0.1.1] ([82.146.27.14]) by smtp.gmail.com with ESMTPSA id x5-v6sm2617425wrr.3.2018.06.26.09.19.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Jun 2018 09:19:11 -0700 (PDT) From: Nikolay Nikolaev To: maxime.coquelin@redhat.com, tiwei.bie@intel.com, zhihong.wang@intel.com Cc: dev@dpdk.org Date: Tue, 26 Jun 2018 19:19:09 +0300 Message-ID: <153002994991.22089.16713275746085839135.stgit@T460> In-Reply-To: <153002988259.22089.8523468795459281187.stgit@T460> References: <153002988259.22089.8523468795459281187.stgit@T460> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v1 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 26cfebec0..9b5598871 100644 --- a/lib/librte_vhost/vhost_user.c +++ b/lib/librte_vhost/vhost_user.c @@ -706,10 +706,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; @@ -730,7 +730,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; } @@ -766,7 +766,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; @@ -905,16 +905,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); @@ -926,17 +926,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); @@ -1058,7 +1058,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; @@ -1089,7 +1089,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; @@ -1156,7 +1156,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; @@ -1185,7 +1185,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) { @@ -1201,7 +1201,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]; @@ -1267,7 +1267,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; @@ -1313,7 +1313,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; @@ -1342,7 +1342,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; @@ -1352,7 +1352,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; @@ -1366,7 +1366,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; @@ -1457,7 +1457,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; @@ -1745,7 +1745,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), @@ -1775,7 +1775,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),