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

@@ -315,15 +315,15 @@
          * to round the requested size up to the next highest power-of-2
          */
         attr_p->qp_sizes.cs_sq = max(attr_p->qp_sizes.cs_sq, TAVOR_QP_MIN_SIZE);
         attr_p->qp_sizes.cs_rq = max(attr_p->qp_sizes.cs_rq, TAVOR_QP_MIN_SIZE);
         log_qp_sq_size = highbit(attr_p->qp_sizes.cs_sq);
-        if ((attr_p->qp_sizes.cs_sq & (attr_p->qp_sizes.cs_sq - 1)) == 0) {
+        if (ISP2(attr_p->qp_sizes.cs_sq)) {
                 log_qp_sq_size = log_qp_sq_size - 1;
         }
         log_qp_rq_size = highbit(attr_p->qp_sizes.cs_rq);
-        if ((attr_p->qp_sizes.cs_rq & (attr_p->qp_sizes.cs_rq - 1)) == 0) {
+        if (ISP2(attr_p->qp_sizes.cs_rq)) {
                 log_qp_rq_size = log_qp_rq_size - 1;
         }
 
         /*
          * Next we verify that the rounded-up size is valid (i.e. consistent

@@ -801,15 +801,15 @@
          * to round the requested size up to the next highest power-of-2
          */
         attr_p->qp_sizes.cs_sq = max(attr_p->qp_sizes.cs_sq, TAVOR_QP_MIN_SIZE);
         attr_p->qp_sizes.cs_rq = max(attr_p->qp_sizes.cs_rq, TAVOR_QP_MIN_SIZE);
         log_qp_sq_size = highbit(attr_p->qp_sizes.cs_sq);
-        if ((attr_p->qp_sizes.cs_sq & (attr_p->qp_sizes.cs_sq - 1)) == 0) {
+        if (ISP2(attr_p->qp_sizes.cs_sq)) {
                 log_qp_sq_size = log_qp_sq_size - 1;
         }
         log_qp_rq_size = highbit(attr_p->qp_sizes.cs_rq);
-        if ((attr_p->qp_sizes.cs_rq & (attr_p->qp_sizes.cs_rq - 1)) == 0) {
+        if (ISP2(attr_p->qp_sizes.cs_rq)) {
                 log_qp_rq_size = log_qp_rq_size - 1;
         }
 
         /*
          * Next we verify that the rounded-up size is valid (i.e. consistent

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

@@ -2006,11 +2006,11 @@
                 /*
                  * Same as above (except for Recv WQEs)
                  */
                 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);

@@ -2026,11 +2026,11 @@
                  * "inline" packet headers.  (This is smaller than for QP1
                  * below because QP0 is not allowed to send packets with a GRH.
                  */
                 max_size = (TAVOR_QP_WQE_MLX_QP0_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);

@@ -2048,11 +2048,11 @@
                  * introduces an alignment issue that causes us to consume
                  * an additional 8 bytes).
                  */
                 max_size = (TAVOR_QP_WQE_MLX_QP1_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);