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_cfg.c
          +++ new/usr/src/uts/common/io/ib/adapters/hermon/hermon_cfg.c
↓ open down ↓ 23 lines elided ↑ open up ↑
  24   24   */
  25   25  
  26   26  /*
  27   27   * hermon_cfg.c
  28   28   *    Hermon Configuration Profile Routines
  29   29   *
  30   30   *    Implements the routines necessary for initializing and (later) tearing
  31   31   *    down the list of Hermon configuration information.
  32   32   */
  33   33  
       34 +#include <sys/sysmacros.h>
  34   35  #include <sys/types.h>
  35   36  #include <sys/conf.h>
  36   37  #include <sys/ddi.h>
  37   38  #include <sys/sunddi.h>
  38   39  #include <sys/modctl.h>
  39   40  #include <sys/bitmap.h>
  40   41  
  41   42  #include <sys/ib/adapters/hermon/hermon.h>
  42   43  
  43   44  /*
↓ open down ↓ 386 lines elided ↑ open up ↑
 430  431          /*
 431  432           * Use requested maximum number of SGL to calculate the max descriptor
 432  433           * size (while guaranteeing that the descriptor size is a power-of-2
 433  434           * cachelines).  We have to use the calculation for QP1 MLX transport
 434  435           * because the possibility that we might need to inline a GRH, along
 435  436           * with all the other headers and alignment restrictions, sets the
 436  437           * maximum for the number of SGLs that we can advertise support for.
 437  438           */
 438  439          max_size = (HERMON_QP_WQE_MLX_QP1_HDRS + (max_sgl << 4));
 439  440          log2 = highbit(max_size);
 440      -        if ((max_size & (max_size - 1)) == 0) {
      441 +        if (ISP2(max_size)) {
 441  442                  log2 = log2 - 1;
 442  443          }
 443  444          max_size = (1 << log2);
 444  445  
 445  446          max_size = min(max_size, state->hs_devlim.max_desc_sz_sq);
 446  447  
 447  448          /*
 448  449           * Then use the calculated max descriptor size to determine the "real"
 449  450           * maximum SGL (the number beyond which we would roll over to the next
 450  451           * power-of-2).
↓ open down ↓ 83 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX