Skip to content

Commit 867e801

Browse files
XinIZengherbertx
authored andcommitted
crypto: qat - move PFVF compat checker to a function
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 <[email protected]> Reviewed-by: Giovanni Cabiddu <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent 1f8d6a1 commit 867e801

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

drivers/crypto/intel/qat/qat_common/adf_pfvf_pf_proto.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -242,13 +242,7 @@ static int adf_handle_vf2pf_msg(struct adf_accel_dev *accel_dev, u8 vf_nr,
242242
"VersionRequest received from VF%d (vers %d) to PF (vers %d)\n",
243243
vf_nr, vf_compat_ver, ADF_PFVF_COMPAT_THIS_VERSION);
244244

245-
if (vf_compat_ver == 0)
246-
compat = ADF_PF2VF_VF_INCOMPATIBLE;
247-
else if (vf_compat_ver <= ADF_PFVF_COMPAT_THIS_VERSION)
248-
compat = ADF_PF2VF_VF_COMPATIBLE;
249-
else
250-
compat = ADF_PF2VF_VF_COMPAT_UNKNOWN;
251-
245+
compat = adf_vf_compat_checker(vf_compat_ver);
252246
vf_info->vf_compat_ver = vf_compat_ver;
253247

254248
resp->type = ADF_PF2VF_MSGTYPE_VERSION_RESP;

drivers/crypto/intel/qat/qat_common/adf_pfvf_utils.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,15 @@ u32 adf_pfvf_csr_msg_of(struct adf_accel_dev *accel_dev, struct pfvf_message msg
2828
struct pfvf_message adf_pfvf_message_of(struct adf_accel_dev *accel_dev, u32 raw_msg,
2929
const struct pfvf_csr_format *fmt);
3030

31+
static inline u8 adf_vf_compat_checker(u8 vf_compat_ver)
32+
{
33+
if (vf_compat_ver == 0)
34+
return ADF_PF2VF_VF_INCOMPATIBLE;
35+
36+
if (vf_compat_ver <= ADF_PFVF_COMPAT_THIS_VERSION)
37+
return ADF_PF2VF_VF_COMPATIBLE;
38+
39+
return ADF_PF2VF_VF_COMPAT_UNKNOWN;
40+
}
41+
3142
#endif /* ADF_PFVF_UTILS_H */

0 commit comments

Comments
 (0)