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

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/inet/sctp/sctp_hash.c
          +++ new/usr/src/uts/common/inet/sctp/sctp_hash.c
↓ open down ↓ 15 lines elided ↑ open up ↑
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
  24   24   */
  25   25  
       26 +#include <sys/sysmacros.h>
  26   27  #include <sys/socket.h>
  27   28  #include <sys/ddi.h>
  28   29  #include <sys/sunddi.h>
  29   30  #include <sys/tsol/tndb.h>
  30   31  #include <sys/tsol/tnet.h>
  31   32  
  32   33  #include <netinet/in.h>
  33   34  #include <netinet/ip6.h>
  34   35  
  35   36  #include <inet/common.h>
↓ open down ↓ 23 lines elided ↑ open up ↑
  59   60      void *), void *arg, boolean_t cansleep, sctp_stack_t *sctps);
  60   61  
  61   62  void
  62   63  sctp_hash_init(sctp_stack_t *sctps)
  63   64  {
  64   65          int i;
  65   66  
  66   67          /* Start with /etc/system value */
  67   68          sctps->sctps_conn_hash_size = sctp_conn_hash_size;
  68   69  
  69      -        if (sctps->sctps_conn_hash_size & (sctps->sctps_conn_hash_size - 1)) {
       70 +        if (!ISP2(sctps->sctps_conn_hash_size)) {
  70   71                  /* Not a power of two. Round up to nearest power of two */
  71   72                  for (i = 0; i < 31; i++) {
  72   73                          if (sctps->sctps_conn_hash_size < (1 << i))
  73   74                                  break;
  74   75                  }
  75   76                  sctps->sctps_conn_hash_size = 1 << i;
  76   77          }
  77   78          if (sctps->sctps_conn_hash_size < SCTP_CONN_HASH_SIZE) {
  78   79                  sctps->sctps_conn_hash_size = SCTP_CONN_HASH_SIZE;
  79   80                  cmn_err(CE_CONT, "using sctp_conn_hash_size = %u\n",
↓ open down ↓ 820 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX