Print this page
8381 Convert ipsec_alg_lock from mutex to rwlock

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/inet/sadb.h
          +++ new/usr/src/uts/common/inet/sadb.h
↓ open down ↓ 13 lines elided ↑ open up ↑
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  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   * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  23   23   * Use is subject to license terms.
       24 + * Copyright (c) 2012 Nexenta Systems, Inc. All rights reserved.
  24   25   */
  25   26  
  26   27  #ifndef _INET_SADB_H
  27   28  #define _INET_SADB_H
  28   29  
  29   30  #ifdef  __cplusplus
  30   31  extern "C" {
  31   32  #endif
  32   33  
  33   34  #include <inet/ipsec_info.h>
↓ open down ↓ 874 lines elided ↑ open up ↑
 908  909   */
 909  910  
 910  911  #define IPSEC_CTX_TMPL_ALLOC ((crypto_ctx_template_t)-1)
 911  912  #define IPSEC_CTX_TMPL(_sa, _which, _type, _tmpl) {                     \
 912  913          if ((_tmpl = (_sa)->_which) == IPSEC_CTX_TMPL_ALLOC) {          \
 913  914                  mutex_enter(&assoc->ipsa_lock);                         \
 914  915                  if ((_sa)->_which == IPSEC_CTX_TMPL_ALLOC) {            \
 915  916                          ipsec_stack_t *ipss;                            \
 916  917                                                                          \
 917  918                          ipss = assoc->ipsa_netstack->netstack_ipsec;    \
 918      -                        mutex_enter(&ipss->ipsec_alg_lock);             \
      919 +                        rw_enter(&ipss->ipsec_alg_lock, RW_READER);     \
 919  920                          (void) ipsec_create_ctx_tmpl(_sa, _type);       \
 920      -                        mutex_exit(&ipss->ipsec_alg_lock);              \
      921 +                        rw_exit(&ipss->ipsec_alg_lock);                 \
 921  922                  }                                                       \
 922  923                  mutex_exit(&assoc->ipsa_lock);                          \
 923  924                  if ((_tmpl = (_sa)->_which) == IPSEC_CTX_TMPL_ALLOC)    \
 924  925                          _tmpl = NULL;                                   \
 925  926          }                                                               \
 926  927  }
 927  928  
 928  929  extern int ipsec_create_ctx_tmpl(ipsa_t *, ipsec_algtype_t);
 929  930  extern void ipsec_destroy_ctx_tmpl(ipsa_t *, ipsec_algtype_t);
 930  931  
↓ open down ↓ 51 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX