Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp2599093rbb; Wed, 28 Feb 2024 06:59:13 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUhFAg1lOzssIPV9M8/0YNat5mJz0OIkcHRyMSaekjnKJaIyrhXiZyqsv0hnoXbnVNwcneHEiVzXtGKEm+jSNEoYerJTTSl7mSRa0Wc8w== X-Google-Smtp-Source: AGHT+IHpH8YQJDtPTE4FIGjXfFWzrq3Ix6t3wHh3bxv6+GOXA08cJt4nOvN6SMNYQkUFvZBHKr4O X-Received: by 2002:a17:90a:b306:b0:299:3f5d:b5e0 with SMTP id d6-20020a17090ab30600b002993f5db5e0mr9629267pjr.49.1709132353711; Wed, 28 Feb 2024 06:59:13 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709132353; cv=pass; d=google.com; s=arc-20160816; b=lshCFZzn5uwGjWKMV1xao0kVDaViL1TPI6+orj3T157BOS29el3Nr5YI0ZwWjfLgTg jLdEOGmFHP4doj2GssRlJO7ZL2I67z+CIsOsQjnAoBovSUZHOkSLmL1qQ8Hc94RlIkUi ICfiPVnShPbedHBb963yrWR8Y/so+jlYRpPbYggoHOsAPgXJw2iKhuJIrZISOQoNC72R obc18xWkRh8Kf87jjDUr6Fu1PXyKQD2bShOoEM1hHKkrWM+WBt5goa1749X0b0vq42Zn oP1g4tgPtOGzfIWymnXnDExA+PmVmJ6M2QRbAxEIPqKXxGE5FHXsxB9x/GqPyc/f2D+S 9gGQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-id:precedence:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=5v1M8arUcb8UIevHwVP+riifc6o/a0Q5nFvlTjwKUB4=; fh=I3bDDdTAgeEj5YoWENtKM6j3clteKWahyTs0loeIgI4=; b=oYNFHIJOXKbfvvfpL2NbYCR6xaiiWeyI8VMRbjnV9ZmCgOl4orZD2jjtt47wYRiAeh YLvIhJvUTWWyiSws4Iw62RjYZ2mjp2+oelBR1D2MFQJYgqAMTC0FZk7ahHBGinryeNVG nBX6B8pTMbju87JzidQLN8X+B57QUBgayUsb5TNkD6QVPjsWv9O5OZyfVqHCiEiBj00P /Mb2LR4CbMv5NGWO6DjMxbhxwfz/LqBqA+qfUXonF2EX2akr71mo6xGOial2/AguISMK bpKXQAReHeN8gngcg8dq4peHZH2TbcDX5DnSNhxroD7wgfVbo6KAabHN0HgzJN+JmhFx SNqw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="Pq0/skVe"; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-crypto+bounces-2364-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-crypto+bounces-2364-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id 9-20020a17090a098900b0029a74d50d83si1414678pjo.190.2024.02.28.06.59.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 06:59:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto+bounces-2364-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="Pq0/skVe"; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-crypto+bounces-2364-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-crypto+bounces-2364-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 2B087B277B7 for ; Wed, 28 Feb 2024 14:43:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 36E8015B96D; Wed, 28 Feb 2024 14:42:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Pq0/skVe" X-Original-To: linux-crypto@vger.kernel.org Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6D68615B967; Wed, 28 Feb 2024 14:42:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.10 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709131376; cv=none; b=qkqSAD9r0YHdxyKF5Lu3GNUCukJDO8Mc6ZGMi1GXsxPIPu0URENwV3CSOusS4Pt9F89IS7V9JY2uiDHprvrW6RISNFDK+8wbND0jy89dR6o7Ui6oXEIYuxUsXvCrOfEjORDwA6bjpOlQQBKf+TVWIHdh6LiWq52taDkOfBu0Gf4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709131376; c=relaxed/simple; bh=Uzkx+1GFaKGG2VdEZSzqcW3PJpKBfT/EL0LZs2G+ETM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=c1qLt4FS/zcTCY3rKfpB87TzKY7G7FtCKxPnmrcdp9gBfiG99EZLq9aOuswUTTmmXijLxQ+crIJy1Rypa4Z9lIH6XVQekyP/RpGaGY+rOnQJkaBqUtipB/nD0BtnJznbvAqVNOnT5/EOZ2KDgBlknR8snHusksr40w7g4cC5wtk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=Pq0/skVe; arc=none smtp.client-ip=192.198.163.10 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1709131374; x=1740667374; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=Uzkx+1GFaKGG2VdEZSzqcW3PJpKBfT/EL0LZs2G+ETM=; b=Pq0/skVejUJZ66/CFDm3XnVaLHFmzQYB2dpLhdoJQNWwUVbkyZCqih2g BZl3Ipz7tfIFOQ1ePs9Z/I8Ia/N9Nmvm2a6b5C3vTCwjpp0zZQRU2ABfQ p4KSYabRPwTqLa1w4mVJfXncWLwNFCika9aJakNfLjdm6wRvI//3mpXdt yFt59Ivq3gS8f1GwauAf3ybxAJisx1seep8lmP3auk2lJy0T34P3O2f4D HGZCOKgU3JP8aqIpA+xb/9nqgO+od80IfUmsDZHxVXf6L27yGEA3m3vkI 9TOGJNiGYXBGL48O06a+RmFlP2r0WBRTIRWAVmPYXhlC8B+K7TMfisY5P Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10998"; a="14950970" X-IronPort-AV: E=Sophos;i="6.06,190,1705392000"; d="scan'208";a="14950970" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Feb 2024 06:42:54 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,190,1705392000"; d="scan'208";a="11994649" Received: from qat-server-archercity1.sh.intel.com ([10.67.111.115]) by fmviesa005.fm.intel.com with ESMTP; 28 Feb 2024 06:42:51 -0800 From: Xin Zeng To: herbert@gondor.apana.org.au, alex.williamson@redhat.com, jgg@nvidia.com, yishaih@nvidia.com, shameerali.kolothum.thodi@huawei.com, kevin.tian@intel.com Cc: linux-crypto@vger.kernel.org, kvm@vger.kernel.org, qat-linux@intel.com, Xin Zeng Subject: [PATCH v4 03/10] crypto: qat - move PFVF compat checker to a function Date: Wed, 28 Feb 2024 22:33:55 +0800 Message-Id: <20240228143402.89219-4-xin.zeng@intel.com> X-Mailer: git-send-email 2.18.2 In-Reply-To: <20240228143402.89219-1-xin.zeng@intel.com> References: <20240228143402.89219-1-xin.zeng@intel.com> Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Move the code that implements VF version compatibility on the PF side to a separate function so that it can be reused when doing VM live migration. This does not introduce any functional change. Signed-off-by: Xin Zeng Reviewed-by: Giovanni Cabiddu --- .../crypto/intel/qat/qat_common/adf_pfvf_pf_proto.c | 8 +------- drivers/crypto/intel/qat/qat_common/adf_pfvf_utils.h | 11 +++++++++++ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/drivers/crypto/intel/qat/qat_common/adf_pfvf_pf_proto.c b/drivers/crypto/intel/qat/qat_common/adf_pfvf_pf_proto.c index 9ab93fbfefde..b9b5e744a3f1 100644 --- a/drivers/crypto/intel/qat/qat_common/adf_pfvf_pf_proto.c +++ b/drivers/crypto/intel/qat/qat_common/adf_pfvf_pf_proto.c @@ -242,13 +242,7 @@ static int adf_handle_vf2pf_msg(struct adf_accel_dev *accel_dev, u8 vf_nr, "VersionRequest received from VF%d (vers %d) to PF (vers %d)\n", vf_nr, vf_compat_ver, ADF_PFVF_COMPAT_THIS_VERSION); - if (vf_compat_ver == 0) - compat = ADF_PF2VF_VF_INCOMPATIBLE; - else if (vf_compat_ver <= ADF_PFVF_COMPAT_THIS_VERSION) - compat = ADF_PF2VF_VF_COMPATIBLE; - else - compat = ADF_PF2VF_VF_COMPAT_UNKNOWN; - + compat = adf_vf_compat_checker(vf_compat_ver); vf_info->vf_compat_ver = vf_compat_ver; resp->type = ADF_PF2VF_MSGTYPE_VERSION_RESP; diff --git a/drivers/crypto/intel/qat/qat_common/adf_pfvf_utils.h b/drivers/crypto/intel/qat/qat_common/adf_pfvf_utils.h index 2be048e2287b..1a044297d873 100644 --- a/drivers/crypto/intel/qat/qat_common/adf_pfvf_utils.h +++ b/drivers/crypto/intel/qat/qat_common/adf_pfvf_utils.h @@ -28,4 +28,15 @@ u32 adf_pfvf_csr_msg_of(struct adf_accel_dev *accel_dev, struct pfvf_message msg struct pfvf_message adf_pfvf_message_of(struct adf_accel_dev *accel_dev, u32 raw_msg, const struct pfvf_csr_format *fmt); +static inline u8 adf_vf_compat_checker(u8 vf_compat_ver) +{ + if (vf_compat_ver == 0) + return ADF_PF2VF_VF_INCOMPATIBLE; + + if (vf_compat_ver <= ADF_PFVF_COMPAT_THIS_VERSION) + return ADF_PF2VF_VF_COMPATIBLE; + + return ADF_PF2VF_VF_COMPAT_UNKNOWN; +} + #endif /* ADF_PFVF_UTILS_H */ -- 2.18.2