Re: [EXTERNAL] [PATCH 07/10] crypto: qat - add bank save and restore flows

Kamlesh Gurudasani
2024-02-04T07:50:01Z

Xin Zeng <xin.zeng@intel.com> writes:

> This message was sent from outside of Texas Instruments.
> Do not click links or open attachments unless you recognize the source of this email and know the content is safe.
>
> From: Siming Wan <siming.wan@intel.com>
>
> Add logic to save, restore, quiesce and drain a ring bank for QAT GEN4
> devices.
> This allows to save and restore the state of a Virtual Function (VF) and
> will be used to implement VM live migration.
>
> Signed-off-by: Siming Wan <siming.wan@intel.com>
> Reviewed-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
> Reviewed-by: Xin Zeng <xin.zeng@intel.com>
> Signed-off-by: Xin Zeng <xin.zeng@intel.com>
...
> +#define CHECK_STAT(op, expect_val, name, args...) \
> +({ \
> + u32 __expect_val = (expect_val); \
> + u32 actual_val = op(args); \
> + if (__expect_val != actual_val) \
> + pr_err("QAT: Fail to restore %s register. Expected 0x%x, but actual is 0x%x\n", \
> + name, __expect_val, actual_val); \
> + (__expect_val == actual_val) ? 0 : -EINVAL; \
I was wondering if this can be done like following, saves repeat comparison.

(__expect_val == actual_val) ? 0 : (pr_err("QAT: Fail to restore %s \
register. Expected 0x%x, \
but actual is 0x%x\n", \
name, __expect_val, \
actual_val), -EINVAL); \
Regards,
Kamlesh

> +})
...