Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp255542rdb; Thu, 1 Feb 2024 07:42:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IE94/eJhxlrY2JgebifaC2/HhOU3oS+a3CDgisB/xxurhbQNvFh0fb10jZtEYHb6ild9NmV X-Received: by 2002:ac8:7f4f:0:b0:42a:aa02:a05f with SMTP id g15-20020ac87f4f000000b0042aaa02a05fmr6796367qtk.21.1706802151229; Thu, 01 Feb 2024 07:42:31 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706802151; cv=pass; d=google.com; s=arc-20160816; b=ajXolIBMD0zpVPWi7UHBixRQaevvMYtztmKEgVNdjTB0TUAUQiGpTUZWTrXaI2h6RY ZiUGQ716tN5hNBkrQKngK2MaC2DSo5bF1ArGExZhNNj9qD9nHlpnMwKDVQgVZDFFHZcV 16xXm5UJz7wojuGDuL5SDSyY2TcNtGPUW/t+peOo0pUMWMjcR9OW/qfrBIwGVGx7tRXC fCVCW0rXxFPAePryYSU2kJvIwR8VsL09GY0QRCBm9BPdFdYKGEKtE7lldOJksJg2pV1i DYMt/oOYiFR+ec2DlVqYKWSo6SMDB/F/UmzhyNg0MEs8f7/prCnf6DU1doI015cd8gh5 6ymw== 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=c1HWHGKBIBOBKS2YISLqIMflfh18uc5HoAW01jWneao=; fh=0etm4xrBlJ+QK8LYYgw5af4rGK5tuU7X4jessbOf5a4=; b=muZv4xQYpf9JolYqR9d2hNYP8UX34B+qJp173QvUTLL+fctvAeJH6GBXJ3VvNUA+QW 3ujbSYzeFuOWbWcq5mFuCftOkR4fy9s4pGtbyfTMW2EnyDVblH5usgEEMWbbP2EtsbWA F071/wA0fv6G3yRaRvnmkf154yOVMplNs0gaG87JKkM+olgOk+ZpdHl/CYF97D65Rrit 68WUJcRAWPFbDXf4JRC6aBRwc6ul4K8PVLbWkgKayZHfZ/aoW2uCVWQtqzo5yN4Ro8O0 U70xGCe1IP2LPmHGo/um6kNVI2ua6wo4Ah3OhUDhjTZqBafJhcPxdayS7VJJivuz+J/h hPlA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=HBREZIHm; 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-1781-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-crypto+bounces-1781-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=1; AJvYcCXLslrKWmbU2e6KAjhMDkttnnwp+zuzSyQFoxPYOOdI43zHvfuFHfjxkWPTXNqpc+Bs8QyrdeC2IzYOx3rNP0XolsYV4xX48ijYXlSNbA== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id s18-20020a05622a019200b0042bf1aab553si1877782qtw.232.2024.02.01.07.42.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 07:42:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto+bounces-1781-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=HBREZIHm; 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-1781-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-crypto+bounces-1781-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 008521C23AE4 for ; Thu, 1 Feb 2024 15:42:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E0190626D4; Thu, 1 Feb 2024 15:42:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="HBREZIHm" X-Original-To: linux-crypto@vger.kernel.org Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.93]) (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 300D8626B1; Thu, 1 Feb 2024 15:42:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.55.52.93 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706802123; cv=none; b=V6g6tf7Mp+OQ1mPzCxCRP2JTroF5sJi+5mA0CHcAe2mMjEcUwTr/zmkuBe7fRKt0fZUWCcmnXHWBwRvzHX2vi+pukK7EeB26TuBnZEXgGRkBXOcBG1m2kVmRQqdBISKZgdktlBjOggC5WWUdjZ223WOJgsNZXuyTke08ltnxYbY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706802123; c=relaxed/simple; bh=Md0x3vmxW2CGQH9ZER2xfVXG+OX36BetMc7bOm7qZHg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=XwPvqUgXHw2ssy5l3vbWi1I2wpUDWp8xrlP+37NZf2j5P46JYaxksmSKEDARNJV83VKGseupPy6JZ7CQ4pt5mkuYEGIKyzzNcAOuYMm7lcxwGRAZRGaeHkcx5Td0LX2TV7lJq8QpUVGstVYfXilgBBm1maAd/+y5v1QhaoRqw/I= 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=HBREZIHm; arc=none smtp.client-ip=192.55.52.93 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=1706802122; x=1738338122; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=Md0x3vmxW2CGQH9ZER2xfVXG+OX36BetMc7bOm7qZHg=; b=HBREZIHm6JEDoJcC+y5i1kulPOwW39sev834DIzNr8c4EtyLqzYKvUrj aqrBdiJyR5KFpxXM0YGJSPMi+Q84pLPT28SbqDzFz3+zFk7xqkah9FCBo C3O7p22ombEm+GB0ljlbcSJcHYdnH4VawVh5FHVbrMaqinT5S9EcwAmTU ERMDWd9ujoyPcV80nF75LWpI6+JJYZu0hOwHdhgY9jJGjkIsRKJ7NrCuo 6v7KHHMEE6bQt8kuwOxRKkhEe4PjGou42XP4NLAB/IOyB+U29fyEAnHQc z/U0F3S5wLxpgvV8FHDUjCZcE8TY9L6EURAb2JQeyxda5F+xYDXmIrtr0 g==; X-IronPort-AV: E=McAfee;i="6600,9927,10969"; a="401052897" X-IronPort-AV: E=Sophos;i="6.05,234,1701158400"; d="scan'208";a="401052897" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Feb 2024 07:42:01 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,234,1701158400"; d="scan'208";a="133300" Received: from qat-server-archercity1.sh.intel.com ([10.67.111.115]) by orviesa007.jf.intel.com with ESMTP; 01 Feb 2024 07:41:59 -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 03/10] crypto: qat - move PFVF compat checker to a function Date: Thu, 1 Feb 2024 23:33:30 +0800 Message-Id: <20240201153337.4033490-4-xin.zeng@intel.com> X-Mailer: git-send-email 2.18.2 In-Reply-To: <20240201153337.4033490-1-xin.zeng@intel.com> References: <20240201153337.4033490-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 388e58bcbcaf..d737d07937c7 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