Print this page
5255 uts shouldn't open-code ISP2
@@ -29,10 +29,11 @@
*
* Implements all the routines necessary for allocating, freeing, querying,
* modifying and posting shared receive queues.
*/
+#include <sys/sysmacros.h>
#include <sys/types.h>
#include <sys/conf.h>
#include <sys/ddi.h>
#include <sys/sunddi.h>
#include <sys/modctl.h>
@@ -172,11 +173,11 @@
* they may not be any smaller than HERMON_SRQ_MIN_SIZE. This step
* is to round the requested size up to the next highest power-of-2
*/
srq_wr_sz = max(sizes->srq_wr_sz + 1, HERMON_SRQ_MIN_SIZE);
log_srq_size = highbit(srq_wr_sz);
- if ((srq_wr_sz & (srq_wr_sz - 1)) == 0) {
+ if (ISP2(srq_wr_sz)) {
log_srq_size = log_srq_size - 1;
}
/*
* Next we verify that the rounded-up size is valid (i.e. consistent
@@ -621,11 +622,11 @@
* they may not be any smaller than HERMON_SRQ_MIN_SIZE. This step
* is to round the requested size up to the next highest power-of-2
*/
size = max(size, HERMON_SRQ_MIN_SIZE);
log_srq_size = highbit(size);
- if ((size & (size - 1)) == 0) {
+ if (ISP2(size)) {
log_srq_size = log_srq_size - 1;
}
/*
* Next we verify that the rounded-up size is valid (i.e. consistent
@@ -972,11 +973,11 @@
* (while guaranteeing that the descriptor size is a
* power-of-2 cachelines).
*/
max_size = (HERMON_QP_WQE_MLX_SRQ_HDRS + (num_sgl << 4));
log2 = highbit(max_size);
- if ((max_size & (max_size - 1)) == 0) {
+ if (ISP2(max_size)) {
log2 = log2 - 1;
}
/* Make sure descriptor is at least the minimum size */
log2 = max(log2, HERMON_QP_WQE_LOG_MINIMUM);