Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp2448396rdb; Wed, 21 Feb 2024 08:01:26 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVnvzlwQ54gHZRv9D1GE4IsQnvOZC8WSB0SKWTXuN/QIc5hdNdtUfxowqENeJ/jTLWkKAjoffcwjtvFQFimAG6GpaeFBhwYoTJQ/T3OAw== X-Google-Smtp-Source: AGHT+IHnGI4CtTDfPEZHR0jy8G1Y/Kh50o6V9mEZjmSmNVl6fAVo3lT96qVQcQfAWg3D/66nPuz6 X-Received: by 2002:a05:622a:86:b0:42c:7055:1fff with SMTP id o6-20020a05622a008600b0042c70551fffmr22826998qtw.66.1708531285948; Wed, 21 Feb 2024 08:01:25 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708531285; cv=pass; d=google.com; s=arc-20160816; b=Ksr39xBuPnAWD7lGmVHI/NI2yXadAgXg5V5vfS66i/qfP+jWTN9zan1EdoHau3ujXj Y8Bixo5CNE/q5HHt/KtpRBt/hQmiMZliksANHbleus7SmveWXlZGtzVrDfsF3u9d0KLP oig7qkysosQlAFCuqhWPPdEu1eBmHpEgXwCTlkbYKBNsoPSlN7qZNAMA4Dws00ZzssJD 3L6KCB3E9cOlVKJH25xVI9lR1KuFCV1v/3EW7bm1ppEk1QVL5xQj7BV98T1NIzJjyhoM Hz3otRcFu2cM1XLaZuSia5xH5XA8awwmaDonLn4MmfWcK3HIHwcCOzKMbiWIeg2HnrWc vDPQ== 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=qMZWSqAGZRmY5HefyJm5LF0xkWRK7qiyN7Y4OL2mAcjtkyGLpSl47gWQW+d3OZIUc3 sZqv9CJKhCzXYEhWFYkX8lz4N3JaSDDcMIo/EGcoA6HqA+/pqSRifWNhQq2zw2KPe2mv S0VrbxqaXvMTBlVmsfgLyQrjAZAlRTqCskfi3RdWb/ssjP3u1X+OWIREcjY3venkGU7i 33OmCTyXFcxul60kYCuFWL47t70mVrx4H4lBQRW5NvxLvg0PIpuC9jrbhSXDrT/GfekR fQFQ5I1kqd4sfI0TaluQBW5kTSpABFuLZeaJeRcYpICsmgO/zcOqy7nPe+PETbf4/+q9 gg/A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=N+LVUi2+; 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-2222-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-crypto+bounces-2222-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id s21-20020a05620a081500b007877ceb050bsi3203344qks.386.2024.02.21.08.01.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 08:01:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto+bounces-2222-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=N+LVUi2+; 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-2222-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-crypto+bounces-2222-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id B1C8D1C21C4F for ; Wed, 21 Feb 2024 16:01:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C073181AB6; Wed, 21 Feb 2024 15:59:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="N+LVUi2+" X-Original-To: linux-crypto@vger.kernel.org Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) (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 E40C681749; Wed, 21 Feb 2024 15:59:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.19 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708531162; cv=none; b=KrJb7m6rfH33DMl5fKonV6ZMiQM3cAPurzB7aMJXoFD3jCtDSaNrGn1GjfdjaZPVw9xn7xCJBealbDkJ6cySg23f81gYRrtjaEZ4J9gu81P/ckNVvdUVLdUO/lOgBcPTGVjfYgSUWLI0v8qlwvq4jPIBBkITkZ11jQ2a/kkOwIQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708531162; c=relaxed/simple; bh=Uzkx+1GFaKGG2VdEZSzqcW3PJpKBfT/EL0LZs2G+ETM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=G0AnTu/rrSyKkAFQylEVJjK9GGdYcaOkPWrYt8JWQ4n7Sjdub0nlOAWiKui2cyFFK6bAiQdI3ahKDJ1caDXINiIXWCRoReHoBjRfDwqDRnc/S+VY278lBxQMbPqMyvuX/4X4kmdidgUjTxsmM0FACPl2PQrPqEPX6BqPvW+Vo0I= 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=N+LVUi2+; arc=none smtp.client-ip=192.198.163.19 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=1708531161; x=1740067161; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=Uzkx+1GFaKGG2VdEZSzqcW3PJpKBfT/EL0LZs2G+ETM=; b=N+LVUi2+rSTR3HJNewHIk5PJJdTByLwxy1khds+v7xH3/9rfo96xA5F+ mz8gwjln+mYMrK6jlhz07Fl/Ml5NDXIQmsm3yFtnNHs/fvYMlb3mEYyyL /giFsyeVNUWsbvMKdQmYai+CR9HKWPxkkYyjozrLoMziliJL/0cugzBrO 8zRXZRU0IzBmNa0uDUzbmKjIZ/gkGcTWoyRA19319QCT4SB83jdr1hjvY oi0luubrTpiZwy7WFSReCeOZkgI53636JBPnaHNCqUWj0EH5xXJ6ftXGl gUxkAkPcxwrKOWLLTL3y25znkRqFk+p/OpV3poOGip3JeWaKwgMNRSaZq A==; X-IronPort-AV: E=McAfee;i="6600,9927,10991"; a="2568752" X-IronPort-AV: E=Sophos;i="6.06,175,1705392000"; d="scan'208";a="2568752" Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Feb 2024 07:58:52 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,175,1705392000"; d="scan'208";a="9760846" Received: from qat-server-archercity1.sh.intel.com ([10.67.111.115]) by fmviesa004.fm.intel.com with ESMTP; 21 Feb 2024 07:58:49 -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 v3 03/10] crypto: qat - move PFVF compat checker to a function Date: Wed, 21 Feb 2024 23:50:01 +0800 Message-Id: <20240221155008.960369-4-xin.zeng@intel.com> X-Mailer: git-send-email 2.18.2 In-Reply-To: <20240221155008.960369-1-xin.zeng@intel.com> References: <20240221155008.960369-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