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_qp.c
          +++ new/usr/src/uts/common/io/ib/adapters/tavor/tavor_qp.c
↓ open down ↓ 309 lines elided ↑ open up ↑
 310  310  
 311  311          /*
 312  312           * Calculate the appropriate size for the work queues.
 313  313           * Note:  All Tavor QP work queues must be a power-of-2 in size.  Also
 314  314           * they may not be any smaller than TAVOR_QP_MIN_SIZE.  This step is
 315  315           * to round the requested size up to the next highest power-of-2
 316  316           */
 317  317          attr_p->qp_sizes.cs_sq = max(attr_p->qp_sizes.cs_sq, TAVOR_QP_MIN_SIZE);
 318  318          attr_p->qp_sizes.cs_rq = max(attr_p->qp_sizes.cs_rq, TAVOR_QP_MIN_SIZE);
 319  319          log_qp_sq_size = highbit(attr_p->qp_sizes.cs_sq);
 320      -        if ((attr_p->qp_sizes.cs_sq & (attr_p->qp_sizes.cs_sq - 1)) == 0) {
      320 +        if (ISP2(attr_p->qp_sizes.cs_sq)) {
 321  321                  log_qp_sq_size = log_qp_sq_size - 1;
 322  322          }
 323  323          log_qp_rq_size = highbit(attr_p->qp_sizes.cs_rq);
 324      -        if ((attr_p->qp_sizes.cs_rq & (attr_p->qp_sizes.cs_rq - 1)) == 0) {
      324 +        if (ISP2(attr_p->qp_sizes.cs_rq)) {
 325  325                  log_qp_rq_size = log_qp_rq_size - 1;
 326  326          }
 327  327  
 328  328          /*
 329  329           * Next we verify that the rounded-up size is valid (i.e. consistent
 330  330           * with the device limits and/or software-configured limits).  If not,
 331  331           * then obviously we have a lot of cleanup to do before returning.
 332  332           */
 333  333          if ((log_qp_sq_size > state->ts_cfg_profile->cp_log_max_qp_sz) ||
 334  334              (!qp_srq_en && (log_qp_rq_size >
↓ open down ↓ 461 lines elided ↑ open up ↑
 796  796  
 797  797          /*
 798  798           * Calculate the appropriate size for the work queues.
 799  799           * Note:  All Tavor QP work queues must be a power-of-2 in size.  Also
 800  800           * they may not be any smaller than TAVOR_QP_MIN_SIZE.  This step is
 801  801           * to round the requested size up to the next highest power-of-2
 802  802           */
 803  803          attr_p->qp_sizes.cs_sq = max(attr_p->qp_sizes.cs_sq, TAVOR_QP_MIN_SIZE);
 804  804          attr_p->qp_sizes.cs_rq = max(attr_p->qp_sizes.cs_rq, TAVOR_QP_MIN_SIZE);
 805  805          log_qp_sq_size = highbit(attr_p->qp_sizes.cs_sq);
 806      -        if ((attr_p->qp_sizes.cs_sq & (attr_p->qp_sizes.cs_sq - 1)) == 0) {
      806 +        if (ISP2(attr_p->qp_sizes.cs_sq)) {
 807  807                  log_qp_sq_size = log_qp_sq_size - 1;
 808  808          }
 809  809          log_qp_rq_size = highbit(attr_p->qp_sizes.cs_rq);
 810      -        if ((attr_p->qp_sizes.cs_rq & (attr_p->qp_sizes.cs_rq - 1)) == 0) {
      810 +        if (ISP2(attr_p->qp_sizes.cs_rq)) {
 811  811                  log_qp_rq_size = log_qp_rq_size - 1;
 812  812          }
 813  813  
 814  814          /*
 815  815           * Next we verify that the rounded-up size is valid (i.e. consistent
 816  816           * with the device limits and/or software-configured limits).  If not,
 817  817           * then obviously we have a bit of cleanup to do before returning.
 818  818           */
 819  819          if ((log_qp_sq_size > state->ts_cfg_profile->cp_log_max_qp_sz) ||
 820  820              (log_qp_rq_size > state->ts_cfg_profile->cp_log_max_qp_sz)) {
↓ open down ↓ 1163 lines elided ↑ open up ↑
1984 1984  
1985 1985          switch (wq_type) {
1986 1986          case TAVOR_QP_WQ_TYPE_SENDQ:
1987 1987                  /*
1988 1988                   * Use requested maximum SGL to calculate max descriptor size
1989 1989                   * (while guaranteeing that the descriptor size is a
1990 1990                   * power-of-2 cachelines).
1991 1991                   */
1992 1992                  max_size = (TAVOR_QP_WQE_MLX_SND_HDRS + (num_sgl << 4));
1993 1993                  log2 = highbit(max_size);
1994      -                if ((max_size & (max_size - 1)) == 0) {
     1994 +                if (ISP2(max_size)) {
1995 1995                          log2 = log2 - 1;
1996 1996                  }
1997 1997  
1998 1998                  /* Make sure descriptor is at least the minimum size */
1999 1999                  log2 = max(log2, TAVOR_QP_WQE_LOG_MINIMUM);
2000 2000  
2001 2001                  /* Calculate actual number of SGL (given WQE size) */
2002 2002                  actual_sgl = ((1 << log2) - TAVOR_QP_WQE_MLX_SND_HDRS) >> 4;
2003 2003                  break;
2004 2004  
2005 2005          case TAVOR_QP_WQ_TYPE_RECVQ:
2006 2006                  /*
2007 2007                   * Same as above (except for Recv WQEs)
2008 2008                   */
2009 2009                  max_size = (TAVOR_QP_WQE_MLX_RCV_HDRS + (num_sgl << 4));
2010 2010                  log2 = highbit(max_size);
2011      -                if ((max_size & (max_size - 1)) == 0) {
     2011 +                if (ISP2(max_size)) {
2012 2012                          log2 = log2 - 1;
2013 2013                  }
2014 2014  
2015 2015                  /* Make sure descriptor is at least the minimum size */
2016 2016                  log2 = max(log2, TAVOR_QP_WQE_LOG_MINIMUM);
2017 2017  
2018 2018                  /* Calculate actual number of SGL (given WQE size) */
2019 2019                  actual_sgl = ((1 << log2) - TAVOR_QP_WQE_MLX_RCV_HDRS) >> 4;
2020 2020                  break;
2021 2021  
2022 2022          case TAVOR_QP_WQ_TYPE_SENDMLX_QP0:
2023 2023                  /*
2024 2024                   * Same as above (except for MLX transport WQEs).  For these
2025 2025                   * WQEs we have to account for the space consumed by the
2026 2026                   * "inline" packet headers.  (This is smaller than for QP1
2027 2027                   * below because QP0 is not allowed to send packets with a GRH.
2028 2028                   */
2029 2029                  max_size = (TAVOR_QP_WQE_MLX_QP0_HDRS + (num_sgl << 4));
2030 2030                  log2 = highbit(max_size);
2031      -                if ((max_size & (max_size - 1)) == 0) {
     2031 +                if (ISP2(max_size)) {
2032 2032                          log2 = log2 - 1;
2033 2033                  }
2034 2034  
2035 2035                  /* Make sure descriptor is at least the minimum size */
2036 2036                  log2 = max(log2, TAVOR_QP_WQE_LOG_MINIMUM);
2037 2037  
2038 2038                  /* Calculate actual number of SGL (given WQE size) */
2039 2039                  actual_sgl = ((1 << log2) - TAVOR_QP_WQE_MLX_QP0_HDRS) >> 4;
2040 2040                  break;
2041 2041  
↓ open down ↓ 1 lines elided ↑ open up ↑
2043 2043                  /*
2044 2044                   * Same as above.  For these WQEs we again have to account for
2045 2045                   * the space consumed by the "inline" packet headers.  (This
2046 2046                   * is larger than for QP0 above because we have to account for
2047 2047                   * the possibility of a GRH in each packet - and this
2048 2048                   * introduces an alignment issue that causes us to consume
2049 2049                   * an additional 8 bytes).
2050 2050                   */
2051 2051                  max_size = (TAVOR_QP_WQE_MLX_QP1_HDRS + (num_sgl << 4));
2052 2052                  log2 = highbit(max_size);
2053      -                if ((max_size & (max_size - 1)) == 0) {
     2053 +                if (ISP2(max_size)) {
2054 2054                          log2 = log2 - 1;
2055 2055                  }
2056 2056  
2057 2057                  /* Make sure descriptor is at least the minimum size */
2058 2058                  log2 = max(log2, TAVOR_QP_WQE_LOG_MINIMUM);
2059 2059  
2060 2060                  /* Calculate actual number of SGL (given WQE size) */
2061 2061                  actual_sgl = ((1 << log2) - TAVOR_QP_WQE_MLX_QP1_HDRS) >> 4;
2062 2062                  break;
2063 2063  
↓ open down ↓ 13 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX