public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 02/25 v2] mlx4_core: add support for arbitrary bitmap sizes
@ 2009-11-06  3:08 Yevgeny Petrilin
       [not found] ` <4AF39314.5020004-VPRAkNaXOzVS1MOuV/RT9w@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Yevgeny Petrilin @ 2009-11-06  3:08 UTC (permalink / raw)
  To: rdreier; +Cc: linux-rdma, netdev, liranl, tziporet, yevgenyp

From: Liran Liss <liranl@mellanox.co.il>

Signed-off-by: Liran Liss <liranl@mellanox.co.il>
Signed-off-by: Yevgeny Petrilin <yevgenyp@mellanox.co.il>
---
 drivers/net/mlx4/alloc.c |   10 ++++++++++
 drivers/net/mlx4/mlx4.h  |    2 ++
 2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/drivers/net/mlx4/alloc.c b/drivers/net/mlx4/alloc.c
index ad95d5f..bc68cc3 100644
--- a/drivers/net/mlx4/alloc.c
+++ b/drivers/net/mlx4/alloc.c
@@ -177,6 +177,16 @@ int mlx4_bitmap_init(struct mlx4_bitmap *bitmap, u32 num, u32 mask,
 	return 0;
 }
 
+/* Like bitmap_init, but doesn't require 'num' to be a power of 2 or
+ * a non-trivial mask */
+int mlx4_bitmap_init_no_mask(struct mlx4_bitmap *bitmap, u32 num,
+			     u32 reserved_bot, u32 reserved_top)
+{
+	u32 num_rounded = roundup_pow_of_two(num);
+	return mlx4_bitmap_init(bitmap, num_rounded, num_rounded - 1,
+				reserved_bot, num_rounded - num + reserved_top);
+}
+
 void mlx4_bitmap_cleanup(struct mlx4_bitmap *bitmap)
 {
 	kfree(bitmap->table);
diff --git a/drivers/net/mlx4/mlx4.h b/drivers/net/mlx4/mlx4.h
index bc72d6e..5836c94 100644
--- a/drivers/net/mlx4/mlx4.h
+++ b/drivers/net/mlx4/mlx4.h
@@ -330,6 +330,8 @@ u32 mlx4_bitmap_alloc_range(struct mlx4_bitmap *bitmap, int cnt, int align);
 void mlx4_bitmap_free_range(struct mlx4_bitmap *bitmap, u32 obj, int cnt);
 int mlx4_bitmap_init(struct mlx4_bitmap *bitmap, u32 num, u32 mask,
 		     u32 reserved_bot, u32 resetrved_top);
+int mlx4_bitmap_init_no_mask(struct mlx4_bitmap *bitmap, u32 num,
+			     u32 reserved_bot, u32 reserved_top);
 void mlx4_bitmap_cleanup(struct mlx4_bitmap *bitmap);
 
 int mlx4_reset(struct mlx4_dev *dev);
-- 
1.5.3.7





^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 02/25 v2] mlx4_core: add support for arbitrary bitmap sizes
       [not found] ` <4AF39314.5020004-VPRAkNaXOzVS1MOuV/RT9w@public.gmane.org>
@ 2010-02-03 22:25   ` Roland Dreier
       [not found]     ` <adaaavqgdn8.fsf-BjVyx320WGW9gfZ95n9DRSW4+XlvGpQz@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Roland Dreier @ 2010-02-03 22:25 UTC (permalink / raw)
  To: Yevgeny Petrilin
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA,
	liranl-VPRAkNaXOzVS1MOuV/RT9w, tziporet-VPRAkNaXOzVS1MOuV/RT9w

 > +int mlx4_bitmap_init_no_mask(struct mlx4_bitmap *bitmap, u32 num,
 > +			     u32 reserved_bot, u32 reserved_top)
 > +{
 > +	u32 num_rounded = roundup_pow_of_two(num);
 > +	return mlx4_bitmap_init(bitmap, num_rounded, num_rounded - 1,
 > +				reserved_bot, num_rounded - num + reserved_top);
 > +}

I think I would really prefer things if we got rid of this wrapper.  The
mlx4_bitmap stuff is really there to handle the case where we want to
have a mask and have the non-used bits cycle to avoid reusing QPN etc.
If we have a bitmap with no mask that's no a power of 2 in size, there's
really no value in the mlx4 wrapper -- we might as well just allocate a
bitmap directly.

And since this is only used in one place (for the EQ tables) I think it
makes sense to just open-code everything in the EQ code.

 - R.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH 02/25 v2] mlx4_core: add support for arbitrary bitmap sizes
       [not found]     ` <adaaavqgdn8.fsf-BjVyx320WGW9gfZ95n9DRSW4+XlvGpQz@public.gmane.org>
@ 2010-02-04 14:15       ` Yevgeny Petrilin
  0 siblings, 0 replies; 3+ messages in thread
From: Yevgeny Petrilin @ 2010-02-04 14:15 UTC (permalink / raw)
  To: Roland Dreier
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Liran Liss,
	Tziporet Koren

>> +int mlx4_bitmap_init_no_mask(struct mlx4_bitmap *bitmap, u32 num,
>> +			     u32 reserved_bot, u32 reserved_top)
>> +{
>> +	u32 num_rounded = roundup_pow_of_two(num);
>> +	return mlx4_bitmap_init(bitmap, num_rounded, num_rounded - 1,
>> +				reserved_bot, num_rounded - num + reserved_top);
>> +}
>
> I think I would really prefer things if we got rid of this wrapper.  The mlx4_bitmap stuff is really there to handle the case where we want to have a 
> mask and have the non-used bits cycle to avoid reusing QPN etc.
> If we have a bitmap with no mask that's no a power of 2 in size, there's really no value in the mlx4 wrapper -- we might as well just allocate a bitmap > directly.
>
> And since this is only used in one place (for the EQ tables) I think it makes sense to just open-code everything in the EQ code.

I am preparing a new set of patches for SRIOV support, this change will be included--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-02-04 14:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-06  3:08 [PATCH 02/25 v2] mlx4_core: add support for arbitrary bitmap sizes Yevgeny Petrilin
     [not found] ` <4AF39314.5020004-VPRAkNaXOzVS1MOuV/RT9w@public.gmane.org>
2010-02-03 22:25   ` Roland Dreier
     [not found]     ` <adaaavqgdn8.fsf-BjVyx320WGW9gfZ95n9DRSW4+XlvGpQz@public.gmane.org>
2010-02-04 14:15       ` Yevgeny Petrilin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox