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

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/io/ib/adapters/tavor/tavor_qpmod.c
          +++ new/usr/src/uts/common/io/ib/adapters/tavor/tavor_qpmod.c
↓ open down ↓ 25 lines elided ↑ open up ↑
  26   26  
  27   27  /*
  28   28   * tavor_qpmod.c
  29   29   *    Tavor Queue Pair Modify Routines
  30   30   *
  31   31   *    This contains all the routines necessary to implement the Tavor
  32   32   *    ModifyQP() verb.  This includes all the code for legal transitions to
  33   33   *    and from Reset, Init, RTR, RTS, SQD, SQErr, 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/tavor/tavor.h>
  44   45  #include <sys/ib/ib_pkt_hdrs.h>
  45   46  
↓ open down ↓ 3385 lines elided ↑ open up ↑
3431 3432                  return (IBT_INVALID_PARAM);
3432 3433          }
3433 3434  
3434 3435          /*
3435 3436           * If the number of responder resources is too small, round it up.
3436 3437           * Then find the next highest power-of-2
3437 3438           */
3438 3439          if (rdma_ra_in == 0) {
3439 3440                  rdma_ra_in = 1;
3440 3441          }
3441      -        if ((rdma_ra_in & (rdma_ra_in - 1)) == 0) {
     3442 +        if (ISP2(rdma_ra_in)) {
3442 3443                  *rra_max = highbit(rdma_ra_in) - 1;
3443 3444          } else {
3444 3445                  *rra_max = highbit(rdma_ra_in);
3445 3446          }
3446 3447          return (DDI_SUCCESS);
3447 3448  }
3448 3449  
3449 3450  
3450 3451  /*
3451 3452   * tavor_qp_validate_init_depth()
↓ open down ↓ 15 lines elided ↑ open up ↑
3467 3468                  return (IBT_INVALID_PARAM);
3468 3469          }
3469 3470  
3470 3471          /*
3471 3472           * If the requested initiator depth is too small, round it up.
3472 3473           * Then find the next highest power-of-2
3473 3474           */
3474 3475          if (rdma_ra_out == 0) {
3475 3476                  rdma_ra_out = 1;
3476 3477          }
3477      -        if ((rdma_ra_out & (rdma_ra_out - 1)) == 0) {
     3478 +        if (ISP2(rdma_ra_out)) {
3478 3479                  *sra_max = highbit(rdma_ra_out) - 1;
3479 3480          } else {
3480 3481                  *sra_max = highbit(rdma_ra_out);
3481 3482          }
3482 3483          return (DDI_SUCCESS);
3483 3484  }
3484 3485  
3485 3486  
3486 3487  /*
3487 3488   * tavor_qp_validate_mtu()
↓ open down ↓ 14 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX