Print this page
5255 uts shouldn't open-code ISP2

@@ -30,10 +30,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>

@@ -170,11 +171,11 @@
          * they may not be any smaller than TAVOR_SRQ_MIN_SIZE.  This step
          * is to round the requested size up to the next highest power-of-2
          */
         sizes->srq_wr_sz = max(sizes->srq_wr_sz, TAVOR_SRQ_MIN_SIZE);
         log_srq_size = highbit(sizes->srq_wr_sz);
-        if ((sizes->srq_wr_sz & (sizes->srq_wr_sz - 1)) == 0) {
+        if (ISP2(sizes->srq_wr_sz)) {
                 log_srq_size = log_srq_size - 1;
         }
 
         /*
          * Next we verify that the rounded-up size is valid (i.e. consistent

@@ -684,11 +685,11 @@
          * they may not be any smaller than TAVOR_SRQ_MIN_SIZE.  This step
          * is to round the requested size up to the next highest power-of-2
          */
         size = max(size, TAVOR_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

@@ -1097,11 +1098,11 @@
                  * (while guaranteeing that the descriptor size is a
                  * power-of-2 cachelines).
                  */
                 max_size = (TAVOR_QP_WQE_MLX_RCV_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, TAVOR_QP_WQE_LOG_MINIMUM);