diff options
author | Marco Chiappero <marco.chiappero@intel.com> | 2021-12-16 09:13:18 +0000 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2021-12-24 14:18:24 +1100 |
commit | 028042856802c4731c6afebe15d95fed4d39a614 (patch) | |
tree | d89ea0592c79d4782efb144042c3a5f7f57c21c1 /drivers/crypto/qat/qat_common/adf_pfvf_vf_proto.c | |
parent | crypto: qat - make PFVF message construction direction agnostic (diff) | |
download | linux-dev-028042856802c4731c6afebe15d95fed4d39a614.tar.xz linux-dev-028042856802c4731c6afebe15d95fed4d39a614.zip |
crypto: qat - make PFVF send and receive direction agnostic
Currently PF and VF share the same send and receive logic for the PFVF
protocol. However, the inner behaviour still depends on the specific
direction, requiring a test to determine the if the sender is a PF or a
VF. Moreover the vf_nr parameter is only required for PF2VF messages and
ignored for the opposite direction.
Make the GEN2 send and recv completely direction agnostic, by calculating
and determining any direction specific input in the caller instead, and
feeding the send and the receive functions with the same arguments for
both PF and VF. In order to accommodate for this change, the API of the
pfvf_ops send and recv has been modified to remove any reference to vf_nr.
Signed-off-by: Marco Chiappero <marco.chiappero@intel.com>
Reviewed-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Reviewed-by: Fiona Trahe <fiona.trahe@intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to '')
-rw-r--r-- | drivers/crypto/qat/qat_common/adf_pfvf_vf_proto.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/crypto/qat/qat_common/adf_pfvf_vf_proto.c b/drivers/crypto/qat/qat_common/adf_pfvf_vf_proto.c index f8d1c7d0ec4e..56e8185a9630 100644 --- a/drivers/crypto/qat/qat_common/adf_pfvf_vf_proto.c +++ b/drivers/crypto/qat/qat_common/adf_pfvf_vf_proto.c @@ -27,7 +27,11 @@ */ int adf_send_vf2pf_msg(struct adf_accel_dev *accel_dev, u32 msg) { - return GET_PFVF_OPS(accel_dev)->send_msg(accel_dev, msg, 0); + struct adf_pfvf_ops *pfvf_ops = GET_PFVF_OPS(accel_dev); + u32 pfvf_offset = pfvf_ops->get_vf2pf_offset(0); + + return pfvf_ops->send_msg(accel_dev, msg, pfvf_offset, + &accel_dev->vf.vf2pf_lock); } /** @@ -40,7 +44,10 @@ int adf_send_vf2pf_msg(struct adf_accel_dev *accel_dev, u32 msg) */ static u32 adf_recv_pf2vf_msg(struct adf_accel_dev *accel_dev) { - return GET_PFVF_OPS(accel_dev)->recv_msg(accel_dev, 0); + struct adf_pfvf_ops *pfvf_ops = GET_PFVF_OPS(accel_dev); + u32 pfvf_offset = pfvf_ops->get_pf2vf_offset(0); + + return pfvf_ops->recv_msg(accel_dev, pfvf_offset); } /** |