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

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/io/ib/adapters/hermon/hermon_qpmod.c
          +++ new/usr/src/uts/common/io/ib/adapters/hermon/hermon_qpmod.c
↓ open down ↓ 25 lines elided ↑ open up ↑
  26   26  /*
  27   27   * hermon_qpmod.c
  28   28   *    Hermon Queue Pair Modify Routines
  29   29   *
  30   30   *    This contains all the routines necessary to implement the
  31   31   *    ModifyQP() verb.  This includes all the code for legal
  32   32   *    transitions to and from Reset, Init, RTR, RTS, SQD, SQErr,
  33   33   *    and Error.
  34   34   */
  35   35  
       36 +#include <sys/sysmacros.h>
  36   37  #include <sys/types.h>
  37   38  #include <sys/conf.h>
  38   39  #include <sys/ddi.h>
  39   40  #include <sys/sunddi.h>
  40   41  #include <sys/modctl.h>
  41   42  #include <sys/bitmap.h>
  42   43  
  43   44  #include <sys/ib/adapters/hermon/hermon.h>
  44   45  #include <sys/ib/ib_pkt_hdrs.h>
  45   46  
↓ open down ↓ 3322 lines elided ↑ open up ↑
3368 3369                  return (IBT_INVALID_PARAM);
3369 3370          }
3370 3371  
3371 3372          /*
3372 3373           * If the number of responder resources is too small, round it up.
3373 3374           * Then find the next highest power-of-2
3374 3375           */
3375 3376          if (rdma_ra_in == 0) {
3376 3377                  rdma_ra_in = 1;
3377 3378          }
3378      -        if ((rdma_ra_in & (rdma_ra_in - 1)) == 0) {
     3379 +        if (ISP2(rdma_ra_in)) {
3379 3380                  *rra_max = highbit(rdma_ra_in) - 1;
3380 3381          } else {
3381 3382                  *rra_max = highbit(rdma_ra_in);
3382 3383          }
3383 3384          return (DDI_SUCCESS);
3384 3385  }
3385 3386  
3386 3387  
3387 3388  /*
3388 3389   * hermon_qp_validate_init_depth()
↓ open down ↓ 15 lines elided ↑ open up ↑
3404 3405                  return (IBT_INVALID_PARAM);
3405 3406          }
3406 3407  
3407 3408          /*
3408 3409           * If the requested initiator depth is too small, round it up.
3409 3410           * Then find the next highest power-of-2
3410 3411           */
3411 3412          if (rdma_ra_out == 0) {
3412 3413                  rdma_ra_out = 1;
3413 3414          }
3414      -        if ((rdma_ra_out & (rdma_ra_out - 1)) == 0) {
     3415 +        if (ISP2(rdma_ra_out)) {
3415 3416                  *sra_max = highbit(rdma_ra_out) - 1;
3416 3417          } else {
3417 3418                  *sra_max = highbit(rdma_ra_out);
3418 3419          }
3419 3420          return (DDI_SUCCESS);
3420 3421  }
3421 3422  
3422 3423  
3423 3424  /*
3424 3425   * hermon_qp_validate_mtu()
↓ open down ↓ 14 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX