2022-02-11 03:52:05

by Yury Norov

[permalink] [raw]
Subject: [PATCH 11/49] qed: replace bitmap_weight with bitmap_empty in qed_roce_stop()

qed_roce_stop() calls bitmap_weight() to check if any bit of a given
bitmap is set. We can do it more efficiently with bitmap_empty() because
bitmap_empty() stops traversing the bitmap as soon as it finds first set
bit, while bitmap_weight() counts all bits unconditionally.

Signed-off-by: Yury Norov <[email protected]>
---
drivers/net/ethernet/qlogic/qed/qed_roce.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/qlogic/qed/qed_roce.c b/drivers/net/ethernet/qlogic/qed/qed_roce.c
index 071b4aeaddf2..134ecfca96a3 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_roce.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_roce.c
@@ -76,7 +76,7 @@ void qed_roce_stop(struct qed_hwfn *p_hwfn)
* We delay for a short while if an async destroy QP is still expected.
* Beyond the added delay we clear the bitmap anyway.
*/
- while (bitmap_weight(rcid_map->bitmap, rcid_map->max_count)) {
+ while (!bitmap_empty(rcid_map->bitmap, rcid_map->max_count)) {
/* If the HW device is during recovery, all resources are
* immediately reset without receiving a per-cid indication
* from HW. In this case we don't expect the cid bitmap to be
--
2.32.0



2022-02-15 08:10:58

by Prabhakar Kushwaha

[permalink] [raw]
Subject: RE: [PATCH 11/49] qed: replace bitmap_weight with bitmap_empty in qed_roce_stop()

Hi Yury,

> -----Original Message-----
> From: Prabhakar Kushwaha <[email protected]>
> Sent: Tuesday, February 15, 2022 10:41 AM
> To: Prabhakar Kushwaha <[email protected]>
> Subject: [PATCH 11/49] qed: replace bitmap_weight with
> bitmap_empty in qed_roce_stop()
>
> Subject: [PATCH 11/49] qed: replace bitmap_weight with bitmap_empty in
> qed_roce_stop()
> Date: Thu, 10 Feb 2022 14:48:55 -0800
> From: Yury Norov mailto:[email protected]
> To: Yury Norov mailto:[email protected], Andy Shevchenko
> mailto:[email protected], Rasmus Villemoes
> mailto:[email protected], Andrew Morton mailto:akpm@linux-
> foundation.org, Michał Mirosław mailto:[email protected], Greg Kroah-
> Hartman mailto:[email protected], Peter Zijlstra
> mailto:[email protected], David Laight mailto:[email protected],
> Joe Perches mailto:[email protected], Dennis Zhou mailto:[email protected],
> Emil Renner Berthing mailto:[email protected], Nicholas Piggin
> mailto:[email protected], Matti Vaittinen
> mailto:[email protected], Alexey Klimov
> mailto:[email protected], mailto:[email protected], Ariel Elior
> mailto:[email protected], Manish Chopra mailto:[email protected],
> David S. Miller mailto:[email protected], Jakub Kicinski
> mailto:[email protected], mailto:[email protected]
>
>
> qed_roce_stop() calls bitmap_weight() to check if any bit of a given
> bitmap is set. We can do it more efficiently with bitmap_empty() because
> bitmap_empty() stops traversing the bitmap as soon as it finds first set
> bit, while bitmap_weight() counts all bits unconditionally.
>
> Signed-off-by: Yury Norov mailto:[email protected]
> ---

Acked-by: Prabhakar Kushwaha <[email protected]>