static const char *dev_caps_to_str(uint32_t idx)
{
-#define RDMA_DEV_FLAGS(x) \
+#define RDMA_DEV_FLAGS_LOW(x) \
x(RESIZE_MAX_WR, 0) \
x(BAD_PKEY_CNTR, 1) \
x(BAD_QKEY_CNTR, 2) \
x(CROSS_CHANNEL, 27) \
x(MANAGED_FLOW_STEERING, 29) \
x(SIGNATURE_HANDOVER, 30) \
- x(ON_DEMAND_PAGING, 31) \
- x(SG_GAPS_REG, 32) \
- x(VIRTUAL_FUNCTION, 33) \
- x(RAW_SCATTER_FCS, 34) \
- x(RDMA_NETDEV_OPA_VNIC, 35) \
- x(PCI_WRITE_END_PADDING, 36)
-
- enum { RDMA_DEV_FLAGS(RDMA_BITMAP_ENUM) };
+ x(ON_DEMAND_PAGING, 31)
+
+#define RDMA_DEV_FLAGS_HIGH(x) \
+ x(SG_GAPS_REG, 0) \
+ x(VIRTUAL_FUNCTION, 1) \
+ x(RAW_SCATTER_FCS, 2) \
+ x(RDMA_NETDEV_OPA_VNIC, 3) \
+ x(PCI_WRITE_END_PADDING, 4)
+
+ /*
+ * Separation below is needed to allow compilation of rdmatool
+ * on 32bits systems. On such systems, C-enum is limited to be
+ * int and can't hold more than 32 bits.
+ */
+ enum { RDMA_DEV_FLAGS_LOW(RDMA_BITMAP_ENUM) };
+ enum { RDMA_DEV_FLAGS_HIGH(RDMA_BITMAP_ENUM) };
static const char * const
- rdma_dev_names[] = { RDMA_DEV_FLAGS(RDMA_BITMAP_NAMES) };
- #undef RDMA_DEV_FLAGS
+ rdma_dev_names_low[] = { RDMA_DEV_FLAGS_LOW(RDMA_BITMAP_NAMES) };
+ static const char * const
+ rdma_dev_names_high[] = { RDMA_DEV_FLAGS_HIGH(RDMA_BITMAP_NAMES) };
+ uint32_t high_idx;
+ #undef RDMA_DEV_FLAGS_LOW
+ #undef RDMA_DEV_FLAGS_HIGH
+
+ if (idx < ARRAY_SIZE(rdma_dev_names_low) && rdma_dev_names_low[idx])
+ return rdma_dev_names_low[idx];
+
+ high_idx = idx - ARRAY_SIZE(rdma_dev_names_low);
+ if (high_idx < ARRAY_SIZE(rdma_dev_names_high) &&
+ rdma_dev_names_high[high_idx])
+ return rdma_dev_names_high[high_idx];
- if (idx < ARRAY_SIZE(rdma_dev_names) && rdma_dev_names[idx])
- return rdma_dev_names[idx];
return "UNKNOWN";
}