@@ -84,14 +84,10 @@ enum write_fallback _execute_ioctl_fallback(struct ibv_context *ctx,
struct ibv_command_buffer *cmdb,
int *ret)
{
- uint64_t cmd_val = 1ULL << cmd_bit;
-
- BUILD_ASSERT(sizeof(struct verbs_context_ops) / sizeof(void *) < 64);
-
struct verbs_ex_private *priv =
container_of(ctx, struct verbs_context, context)->priv;
- if (priv->unsupported_ioctls & cmd_val)
+ if (bitmap_test_bit(priv->unsupported_ioctls, cmd_bit))
return _check_legacy(cmdb, ret);
*ret = execute_ioctl(ctx, cmdb);
@@ -101,7 +97,7 @@ enum write_fallback _execute_ioctl_fallback(struct ibv_context *ctx,
if (*ret == ENOTTY) {
/* ENOTTY means the ioctl framework is entirely absent */
- priv->unsupported_ioctls = UINT64_MAX;
+ bitmap_fill(priv->unsupported_ioctls, VERBS_OPS_NUM);
return _check_legacy(cmdb, ret);
}
@@ -110,7 +106,7 @@ enum write_fallback _execute_ioctl_fallback(struct ibv_context *ctx,
* EPROTONOSUPPORT means we have the ioctl framework but this
* specific method is not supported
*/
- priv->unsupported_ioctls |= cmd_val;
+ bitmap_set_bit(priv->unsupported_ioctls, cmd_bit);
return _check_legacy(cmdb, ret);
}
@@ -40,9 +40,12 @@
#include <valgrind/memcheck.h>
+#include <ccan/bitmap.h>
+
#define INIT __attribute__((constructor))
#define PFX "libibverbs: "
+#define VERBS_OPS_NUM (sizeof(struct verbs_context_ops) / sizeof(void *))
struct ibv_abi_compat_v2 {
struct ibv_comp_channel channel;
@@ -61,7 +64,7 @@ struct verbs_ex_private {
struct ibv_cq_ex *(*create_cq_ex)(struct ibv_context *context,
struct ibv_cq_init_attr_ex *init_attr);
- uint64_t unsupported_ioctls;
+ BITMAP_DECLARE(unsupported_ioctls, VERBS_OPS_NUM);
uint32_t driver_id;
};