From patchwork Sat Sep 22 21:16:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Nikolaev X-Patchwork-Id: 45173 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5ED5DA49; Sat, 22 Sep 2018 23:16:27 +0200 (CEST) Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) by dpdk.org (Postfix) with ESMTP id CB26C27D for ; Sat, 22 Sep 2018 23:16:25 +0200 (CEST) Received: by mail-wm1-f68.google.com with SMTP id s12-v6so6190483wmc.0 for ; Sat, 22 Sep 2018 14:16:25 -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=L7rYA2p8/9BmKjxihNZnheO6sjfq1i2Fef2zDE5bv0Y=; b=flcMq/MDQYAN4HmPMTivlzR2P3zcIhLySdIGVcLpoGWyARDTahGTiytpP1JpCHHogf aAHT0J6X42mwEnUhUMOBCsvheqfX1mmrgVRKFHZQMnIxH8dseyUKtbIvaEyJyI7FnJ8I Fx5qS9WgOaNCOEuFsR0TASa6zKKaLiCfiWOIsvYcSkquEamUkedNBU2/0QbZILXCI2UZ 5hMliWFFHr0Z+kWJTURJ6e8bocgkfGLi4dhxvNc3ts2wPehPRYJuC+O4QAAbHsxmlYf6 11d9cBkSr/IYleKy+9v4g5EUr8Xpy5zaZxrn/P9ZC8lqskvZlyBMQ/jtnkiS6EEvRMDC rnfQ== 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=L7rYA2p8/9BmKjxihNZnheO6sjfq1i2Fef2zDE5bv0Y=; b=QdFtuAU9FTkJLhu2qbU+xt8OqTR9XrWtfeUKdu6pLcdZ+zTCPG3sb9HNvTygky0a1F H/KrRPA8pbXGHcf53wBWUziCsTJX2fqMW1bei6mVDdkenC6l9ykSjDqCsmcaIdxQjBBT ECGMWh1Wvp3jJfna3rfuAqm+g+GD/J30B/laQy6otGHUm68H7hgZfsxHCppKzuigJPgf xVWyZ90bvpXa2qo4T37fg8YTExFMwLRO0RyL4RxJ4Mjlju3IDK7asvzZMXaXgGIXGYk8 NuZjV6XdwsKJFZC0J7cBFP/bpWjdPoEs46qUjOstngF3l12vtCSeA3n2ka0guACYfEK/ lgow== X-Gm-Message-State: ABuFfojLot7cdm1UYhH175zvIyxYygldD6GgaHOnkbz2YPx/g73ysmy8 0x9ZWeZg93J5o7dELSfy3Hgee5RA5Lic0w== X-Google-Smtp-Source: ANB0VdYZt7XBB4B4sHRWI63sMdLSx7fQ9eDMo1HsSU4n1l+7f+7nwdg660SPVmskwvXrsjIz1ASxVQ== X-Received: by 2002:a1c:c3:: with SMTP id 186-v6mr2566196wma.126.1537650985090; Sat, 22 Sep 2018 14:16:25 -0700 (PDT) Received: from [127.0.1.1] ([82.146.27.14]) by smtp.gmail.com with ESMTPSA id t2-v6sm19528527wre.96.2018.09.22.14.16.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 22 Sep 2018 14:16:24 -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:23 +0300 Message-ID: <153765091094.29126.1031571146095035538.stgit@T460> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v4 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. 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 | 393 ++++++++++++++++++++++------------------- 1 file changed, 208 insertions(+), 185 deletions(-) -- Signature