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


  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
  24  */
  25 
  26 /*
  27  * hermon_cfg.c
  28  *    Hermon Configuration Profile Routines
  29  *
  30  *    Implements the routines necessary for initializing and (later) tearing
  31  *    down the list of Hermon configuration information.
  32  */
  33 

  34 #include <sys/types.h>
  35 #include <sys/conf.h>
  36 #include <sys/ddi.h>
  37 #include <sys/sunddi.h>
  38 #include <sys/modctl.h>
  39 #include <sys/bitmap.h>
  40 
  41 #include <sys/ib/adapters/hermon/hermon.h>
  42 
  43 /*
  44  * Below are the elements that make up the Hermon configuration profile.
  45  * For advanced users who wish to alter these values, this can be done via
  46  * the /etc/system file. By default, values are assigned to the number of
  47  * supported resources, either from the HCA's reported capacities or by
  48  * a by-design limit in the driver.
  49  */
  50 
  51 /* Number of supported QPs, CQs and SRQs */
  52 uint32_t hermon_log_num_qp              = HERMON_NUM_QP_SHIFT;
  53 uint32_t hermon_log_num_cq              = HERMON_NUM_CQ_SHIFT;


 420 {
 421         uint_t  max_size, log2;
 422         uint_t  max_sgl, real_max_sgl;
 423 
 424         /*
 425          * Get the requested maximum number SGL per WQE from the Hermon
 426          * patchable variable
 427          */
 428         max_sgl = hermon_wqe_max_sgl;
 429 
 430         /*
 431          * Use requested maximum number of SGL to calculate the max descriptor
 432          * size (while guaranteeing that the descriptor size is a power-of-2
 433          * cachelines).  We have to use the calculation for QP1 MLX transport
 434          * because the possibility that we might need to inline a GRH, along
 435          * with all the other headers and alignment restrictions, sets the
 436          * maximum for the number of SGLs that we can advertise support for.
 437          */
 438         max_size = (HERMON_QP_WQE_MLX_QP1_HDRS + (max_sgl << 4));
 439         log2 = highbit(max_size);
 440         if ((max_size & (max_size - 1)) == 0) {
 441                 log2 = log2 - 1;
 442         }
 443         max_size = (1 << log2);
 444 
 445         max_size = min(max_size, state->hs_devlim.max_desc_sz_sq);
 446 
 447         /*
 448          * Then use the calculated max descriptor size to determine the "real"
 449          * maximum SGL (the number beyond which we would roll over to the next
 450          * power-of-2).
 451          */
 452         real_max_sgl = (max_size - HERMON_QP_WQE_MLX_QP1_HDRS) >> 4;
 453 
 454         /* Then save away this configuration information */
 455         cp->cp_wqe_max_sgl   = max_sgl;
 456         cp->cp_wqe_real_max_sgl = real_max_sgl;
 457 
 458         /* SRQ SGL gets set to it's own patchable variable value */
 459         cp->cp_srq_max_sgl           = hermon_srq_max_sgl;
 460 }




  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
  24  */
  25 
  26 /*
  27  * hermon_cfg.c
  28  *    Hermon Configuration Profile Routines
  29  *
  30  *    Implements the routines necessary for initializing and (later) tearing
  31  *    down the list of Hermon configuration information.
  32  */
  33 
  34 #include <sys/sysmacros.h>
  35 #include <sys/types.h>
  36 #include <sys/conf.h>
  37 #include <sys/ddi.h>
  38 #include <sys/sunddi.h>
  39 #include <sys/modctl.h>
  40 #include <sys/bitmap.h>
  41 
  42 #include <sys/ib/adapters/hermon/hermon.h>
  43 
  44 /*
  45  * Below are the elements that make up the Hermon configuration profile.
  46  * For advanced users who wish to alter these values, this can be done via
  47  * the /etc/system file. By default, values are assigned to the number of
  48  * supported resources, either from the HCA's reported capacities or by
  49  * a by-design limit in the driver.
  50  */
  51 
  52 /* Number of supported QPs, CQs and SRQs */
  53 uint32_t hermon_log_num_qp              = HERMON_NUM_QP_SHIFT;
  54 uint32_t hermon_log_num_cq              = HERMON_NUM_CQ_SHIFT;


 421 {
 422         uint_t  max_size, log2;
 423         uint_t  max_sgl, real_max_sgl;
 424 
 425         /*
 426          * Get the requested maximum number SGL per WQE from the Hermon
 427          * patchable variable
 428          */
 429         max_sgl = hermon_wqe_max_sgl;
 430 
 431         /*
 432          * Use requested maximum number of SGL to calculate the max descriptor
 433          * size (while guaranteeing that the descriptor size is a power-of-2
 434          * cachelines).  We have to use the calculation for QP1 MLX transport
 435          * because the possibility that we might need to inline a GRH, along
 436          * with all the other headers and alignment restrictions, sets the
 437          * maximum for the number of SGLs that we can advertise support for.
 438          */
 439         max_size = (HERMON_QP_WQE_MLX_QP1_HDRS + (max_sgl << 4));
 440         log2 = highbit(max_size);
 441         if (ISP2(max_size)) {
 442                 log2 = log2 - 1;
 443         }
 444         max_size = (1 << log2);
 445 
 446         max_size = min(max_size, state->hs_devlim.max_desc_sz_sq);
 447 
 448         /*
 449          * Then use the calculated max descriptor size to determine the "real"
 450          * maximum SGL (the number beyond which we would roll over to the next
 451          * power-of-2).
 452          */
 453         real_max_sgl = (max_size - HERMON_QP_WQE_MLX_QP1_HDRS) >> 4;
 454 
 455         /* Then save away this configuration information */
 456         cp->cp_wqe_max_sgl   = max_sgl;
 457         cp->cp_wqe_real_max_sgl = real_max_sgl;
 458 
 459         /* SRQ SGL gets set to it's own patchable variable value */
 460         cp->cp_srq_max_sgl           = hermon_srq_max_sgl;
 461 }