From: Yevgeny Petrilin <yevgenyp@mellanox.co.il>
To: rdreier@cisco.com
Cc: linux-rdma@vger.kernel.org, netdev@vger.kernel.org,
liranl@mellanox.co.il, tziporet@mellanox.co.il,
yevgenyp@mellanox.co.il
Subject: [PATCH 02/25 v2] mlx4_core: add support for arbitrary bitmap sizes
Date: Fri, 06 Nov 2009 05:08:04 +0200 [thread overview]
Message-ID: <4AF39314.5020004@mellanox.co.il> (raw)
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
next reply other threads:[~2009-11-06 0:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-06 3:08 Yevgeny Petrilin [this message]
[not found] ` <4AF39314.5020004-VPRAkNaXOzVS1MOuV/RT9w@public.gmane.org>
2010-02-03 22:25 ` [PATCH 02/25 v2] mlx4_core: add support for arbitrary bitmap sizes Roland Dreier
[not found] ` <adaaavqgdn8.fsf-BjVyx320WGW9gfZ95n9DRSW4+XlvGpQz@public.gmane.org>
2010-02-04 14:15 ` Yevgeny Petrilin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4AF39314.5020004@mellanox.co.il \
--to=yevgenyp@mellanox.co.il \
--cc=linux-rdma@vger.kernel.org \
--cc=liranl@mellanox.co.il \
--cc=netdev@vger.kernel.org \
--cc=rdreier@cisco.com \
--cc=tziporet@mellanox.co.il \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).