Re: [PATCH V3 for-next] RDMA/hns: reset function when removing module

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2019-06-14 at 22:56 +0800, Lijun Ou wrote:
> From: Lang Cheng <chenglang@xxxxxxxxxx>
> 
> During removing the driver, we needs to notify the roce engine to
> stop working immediately,and symmetrically recycle the hardware
> resources requested during initialization.
> 
> The hardware provides a command called function clear that can package
> these operations,so that the driver can only focus on releasing
> resources that applied from the operating system.
> This patch implements the call of this command.
> 
> Signed-off-by: Lang Cheng <chenglang@xxxxxxxxxx>
> Signed-off-by: Lijun Ou <oulijun@xxxxxxxxxx>
> ---
> V2->V3:
> 1. Remove other reset state operations that are not related to
>    function clear



> +	msleep(HNS_ROCE_V2_READ_FUNC_CLEAR_FLAG_INTERVAL);
> +	end = HNS_ROCE_V2_FUNC_CLEAR_TIMEOUT_MSECS;
> +	while (end) {
> +		msleep(HNS_ROCE_V2_READ_FUNC_CLEAR_FLAG_FAIL_WAIT);
> +		end -= HNS_ROCE_V2_READ_FUNC_CLEAR_FLAG_FAIL_WAIT;



> +#define HNS_ROCE_V2_FUNC_CLEAR_TIMEOUT_MSECS	(249 * 2 * 100)
> +#define HNS_ROCE_V2_READ_FUNC_CLEAR_FLAG_INTERVAL	40
> +#define HNS_ROCE_V2_READ_FUNC_CLEAR_FLAG_FAIL_WAIT	20

I absolutely despise code that does a possible *50* second blocking
delay using msleep.  However, because I suspect that this is something
that should *rarely* ever happen, and instead the common case is that
the reset will proceed much faster, and because this is in the
teardown/shutdown path of the device where it is a little more
acceptable to have a blocking delay, I've taken this to for-next.

-- 
Doug Ledford <dledford@xxxxxxxxxx>
    GPG KeyID: B826A3330E572FDD
    Fingerprint = AE6B 1BDA 122B 23B4 265B  1274 B826 A333 0E57 2FDD

Attachment: signature.asc
Description: This is a digitally signed message part


[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux