Print this page
5255 uts shouldn't open-code ISP2
@@ -402,17 +402,16 @@
* now, calculate the alloc size, taking into account
* the headroom for the sq
*/
log_qp_sq_size = highbit(attr_p->qp_sizes.cs_sq + qp->qp_sq_hdrmwqes);
/* if the total is a power of two, reduce it */
- if (((attr_p->qp_sizes.cs_sq + qp->qp_sq_hdrmwqes) &
- (attr_p->qp_sizes.cs_sq + qp->qp_sq_hdrmwqes - 1)) == 0) {
+ if (ISP2(attr_p->qp_sizes.cs_sq + qp->qp_sq_hdrmwqes)) {
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
@@ -919,15 +918,15 @@
attr_p->qp_sizes.cs_sq =
max(attr_p->qp_sizes.cs_sq, HERMON_QP_MIN_SIZE);
attr_p->qp_sizes.cs_rq =
max(attr_p->qp_sizes.cs_rq, HERMON_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
@@ -1519,17 +1518,16 @@
* now, calculate the alloc size, taking into account
* the headroom for the sq
*/
log_qp_sq_size = highbit(attr_p->qp_sizes.cs_sq + qp->qp_sq_hdrmwqes);
/* if the total is a power of two, reduce it */
- if (((attr_p->qp_sizes.cs_sq + qp->qp_sq_hdrmwqes) &
- (attr_p->qp_sizes.cs_sq + qp->qp_sq_hdrmwqes - 1)) == 0) {
+ if (ISP2(attr_p->qp_sizes.cs_sq + qp->qp_sq_hdrmwqes)) {
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
@@ -2829,11 +2827,11 @@
* (while guaranteeing that the descriptor size is a
* power-of-2 cachelines).
*/
max_size = (HERMON_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, HERMON_QP_WQE_LOG_MINIMUM);
@@ -2849,11 +2847,11 @@
* (while guaranteeing that the descriptor size is a
* power-of-2 cachelines).
*/
max_size = (HERMON_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, HERMON_QP_WQE_LOG_MINIMUM);
@@ -2866,11 +2864,11 @@
/*
* Same as above (except for Recv WQEs)
*/
max_size = (HERMON_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, HERMON_QP_WQE_LOG_MINIMUM);
@@ -2886,11 +2884,11 @@
* "inline" packet headers. (This is smaller than for QP1
* below because QP0 is not allowed to send packets with a GRH.
*/
max_size = (HERMON_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, HERMON_QP_WQE_LOG_MINIMUM);
@@ -2908,11 +2906,11 @@
* introduces an alignment issue that causes us to consume
* an additional 8 bytes).
*/
max_size = (HERMON_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, HERMON_QP_WQE_LOG_MINIMUM);