Re: [PATCH 4.19 187/306] net: hns3: bugfix for is_valid_csq_clean_head()

From: Pavel Machek
Date: Wed Dec 04 2019 - 07:38:19 EST


Hi!

> From: Huazhong Tan <tanhuazhong@xxxxxxxxxx>
>
> [ Upstream commit 6d71ec6cbf74ac9c2823ef751b1baa5b889bb3ac ]
>
> The HEAD pointer of the hardware command queue maybe equal to the command
> queue's next_to_use in the driver, so that does not belong to the invalid
> HEAD pointer, since the hardware may not process the command in time,
> causing the HEAD pointer to be too late to update. The variables' name
> in this function is unreadable, so give them a more readable one.
>

> +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c
> @@ -24,15 +24,15 @@ static int hclge_ring_space(struct hclge_cmq_ring *ring)
> return ring->desc_num - used - 1;
> }
>
> -static int is_valid_csq_clean_head(struct hclge_cmq_ring *ring, int h)
> +static int is_valid_csq_clean_head(struct hclge_cmq_ring *ring, int head)
> {
...
> - if (unlikely(h >= ring->desc_num))
> - return 0;

This sanity check was removed, and it is not mentioned in the
changelog. Is it intended?

Best regards,
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

Attachment: signature.asc
Description: PGP signature