From patchwork Mon Sep 24 20:16:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Nikolaev X-Patchwork-Id: 147381 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp1129420lji; Mon, 24 Sep 2018 13:17:02 -0700 (PDT) X-Google-Smtp-Source: ACcGV60w+82LOCZS3io/yXHnPl58VWp5M/NOI4V8qVik69m2UeHElBb4OonwoRLzEL3AoT+b5RFi X-Received: by 2002:adf:a39d:: with SMTP id l29-v6mr317721wrb.1.1537820222449; Mon, 24 Sep 2018 13:17:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537820222; cv=none; d=google.com; s=arc-20160816; b=lmMX1d2dTBnVU5HwjfKPUZpKdLuQKhloa7V42vCNV1zJkhJR4XYR0Sk7iGjniSU98a n047xT2fYh9x7qCQXFvl4t1ClP1TJjXBxCJm06wIoFW6IpmTgqvesSYcCCE742N5WyrP IHJD3yMdT7K3V8ihdYkS4idbRDI0Se+v8VHI1yNcK/e9pz8TX1bMyBn7loxVqJyyWvWp BZNC6wQ0awN5UJ1xGwV+C763W5MESQhErYZt96CzYdm+6YSGy2kwOhCFDQ/xfehEkO9/ sDKyAzn2ZRqlRPzQ/Yj1+ldDEt7bF0VLo7UkwwQQFcVtZWNxXkMA7t22wEXHixJmIRn1 RzsA== 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:message-id:date :cc:to:from:dkim-signature; bh=pOYbJNVyEZnF4AEUoEMq9/ScJh89TgIahrC+PWZ58BE=; b=rwsyu7zZVn6HFdXFusZZ1C9PA0O0xOfXvBqq3Z0XWW4EVhTIjMRVQCujsDpyKE4Try MLDrNybzLIMw7U1EQooAa6Rr6eZVa2aM4NWJTK1ENTDsElB3ZaEcXaPcujuBajbZ+8Ef L4yK9J3iRXa7F4g4+W9Flx/oFFN6OCOYjHW4XQjioSQM74ZG02JSJfbNkT37eqrfkL0+ Z/KSqJEpmR3zXJ66Rs7nJ3O9RGu3E6w//xZUQDUmdVzwNu3TzLfQdO66P09/kecKzSGR 0vAbN8y3SfmdO5pQWDqpXwys9WJcrThs86rljFybqux+lVcS7APTtV6xQqMPVUP85Ag6 uTaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=pndQqIU4; 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 v70-v6si24161wmd.151.2018.09.24.13.17.01; Mon, 24 Sep 2018 13:17:02 -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=pndQqIU4; 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 C48481B171; Mon, 24 Sep 2018 22:17:00 +0200 (CEST) Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) by dpdk.org (Postfix) with ESMTP id 273891B170 for ; Mon, 24 Sep 2018 22:17:00 +0200 (CEST) Received: by mail-wm1-f67.google.com with SMTP id y25-v6so3613208wmi.1 for ; Mon, 24 Sep 2018 13:17:00 -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:user-agent:mime-version :content-transfer-encoding; bh=pOYbJNVyEZnF4AEUoEMq9/ScJh89TgIahrC+PWZ58BE=; b=pndQqIU4KQOMwYU+XQieCBBfVCOCCmumPgbuWXWx8U1WhIXEyRygsyychuTdNazzr/ gkZZh20XzyoQxzomMM4Pju9YZGLaHjJHvwkkg7DHS2OH6dgPDSul+dHuCjSrYJ9QsNOR lMY696q7lbED+Y6VOeeT3HO+y4lxY2I11Uq7/FuKwgDuYXKmG5/MFw4h4WgKjzOao/zi 0ka9/tDRBGyyF1zprBdnXKLEUEFXqXJ/617InN79K5HPAQlqQOpHqlMYDbADJmSPKMdd wIgzXOZFZ2pxSV+3x0TpIJvyiWF9gSVM5N/EIF2a5y/PT/PpSxaFPv8fuT3jp7ioS+lg kEDA== 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:user-agent :mime-version:content-transfer-encoding; bh=pOYbJNVyEZnF4AEUoEMq9/ScJh89TgIahrC+PWZ58BE=; b=b2SSlKEa4BZDVBjv1GRMPdI/W4Ehs5QTlO/EIg2gJqPKeyw55/P7DGlRbVHzlo+KVE OK0jKPH5MF9mmHdKYGZ2pq3QEpKX3EK7EsdEVsMU5JzNzKzUHz0+5fhoPcZdBz3F9l2l uXCINVykX3hKtnvqmIiMvMC3e9wCcyz9ZLk8OB38GqdViikQBrTrm3kf0OpsW4VN9XkH MjralNBWzdiw0JoAHtVt8QDuMpVqn+sK2u/9Rs3SMtAvjXoLD8oERL2u6DYpcVL5lgrJ 0zXK+QUCtNrOOAy66gw8CJTPnpeKTXwRQs9APsVtlzJyI7h300MJBwaJXXSpqPqdfdlZ kedw== X-Gm-Message-State: ABuFfoiCgjZqc2xR/MeRhWJUel6vYeWIXHE5zBQCqEPJE9QQZWUGKfPE LB07hF7Byqg3TrPmIAzYiNp+piTnqVLV+A== X-Received: by 2002:a1c:545d:: with SMTP id p29-v6mr41776wmi.94.1537820219449; Mon, 24 Sep 2018 13:16:59 -0700 (PDT) Received: from [127.0.1.1] ([82.146.27.14]) by smtp.gmail.com with ESMTPSA id s2-v6sm351444wrn.83.2018.09.24.13.16.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 24 Sep 2018 13:16:58 -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 23:16:55 +0300 Message-ID: <153782013094.27450.17651924330876922486.stgit@T460> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v6 0/5] vhost: vhost_user.c code cleanup 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" vhost: vhost_user.c code cleanup This patchesries introduce a set of code redesigns in vhost_user.c. The goal is to unify and simplify vhost-user message handling. The patches do not intend to introduce any functional changes. v6 changes: - Even more fixes to the usage of struct VhostUserMsg in the patches (Anatoly Burakov) v5 changes: - fixed the usage of struct VhostUserMsg in all patches (Anatoly Burakov) v4 changes: - use struct VhostUserMsg as the coding style guide suggests (Anatoly Burakov) - VH_RESULT_FATAL is removed as not needed anymore (Maxime Coquelin) v3 changes: - rebased on top of git://dpdk.org/next/dpdk-next-virtio dead0602 - introduce VH_RESULT_FATAL (Maxime Coquelin) - vhost_user_set_features return VH_RESULT_FATAL on failure. This allows keeping the propagate error logic (Ilya Maximets) - fixed vhost_user_set_vring_kick and vhost_user_set_protocol_features return VH_RESULT_ERR upon failure - fixed missing break in case VH_RESULT_ERR (Ilya Maximets) - fixed a type on the description of 2/5 patch (Maxime Coquelin) v2 changes: - Fix the comments by Tiwei Bie - Keep the old behavior - Fall through when the callback returns VH_RESULT_ERR - Fall through if the request is out of range --- Nikolay Nikolaev (5): vhost: unify struct VhostUserMsg usage vhost: make message handling functions prepare the reply vhost: handle unsupported message types in functions vhost: unify message handling function signature vhost: message handling implemented as a callback array lib/librte_vhost/vhost_user.c | 394 ++++++++++++++++++++++------------------- 1 file changed, 209 insertions(+), 185 deletions(-) -- Signature Reviewed-by: Maxime Coquelin