Print this page
5045 use atomic_{inc,dec}_* instead of atomic_add_*
*** 98,115 ****
* Release a reference on ip_xmit_attr.
* The reference is acquired by conn_get_ixa()
*/
#define IXA_REFRELE(ixa) \
{ \
! if (atomic_add_32_nv(&(ixa)->ixa_refcnt, -1) == 0) \
ixa_inactive(ixa); \
}
#define IXA_REFHOLD(ixa) \
{ \
ASSERT((ixa)->ixa_refcnt != 0); \
! atomic_add_32(&(ixa)->ixa_refcnt, 1); \
}
/*
* When we need to handle a transmit side asynchronous operation, then we need
* to save sufficient information so that we can call the fragment and postfrag
--- 98,115 ----
* Release a reference on ip_xmit_attr.
* The reference is acquired by conn_get_ixa()
*/
#define IXA_REFRELE(ixa) \
{ \
! if (atomic_dec_32_nv(&(ixa)->ixa_refcnt) == 0) \
ixa_inactive(ixa); \
}
#define IXA_REFHOLD(ixa) \
{ \
ASSERT((ixa)->ixa_refcnt != 0); \
! atomic_inc_32(&(ixa)->ixa_refcnt); \
}
/*
* When we need to handle a transmit side asynchronous operation, then we need
* to save sufficient information so that we can call the fragment and postfrag
*** 752,762 ****
mutex_enter(&connp->conn_lock);
ixa = connp->conn_ixa;
/* At least one references for the conn_t */
ASSERT(ixa->ixa_refcnt >= 1);
! if (atomic_add_32_nv(&ixa->ixa_refcnt, 1) == 2) {
/* No other thread using conn_ixa */
mutex_exit(&connp->conn_lock);
return (ixa);
}
ixa = kmem_alloc(sizeof (*ixa), kmflag);
--- 752,762 ----
mutex_enter(&connp->conn_lock);
ixa = connp->conn_ixa;
/* At least one references for the conn_t */
ASSERT(ixa->ixa_refcnt >= 1);
! if (atomic_inc_32_nv(&ixa->ixa_refcnt) == 2) {
/* No other thread using conn_ixa */
mutex_exit(&connp->conn_lock);
return (ixa);
}
ixa = kmem_alloc(sizeof (*ixa), kmflag);
*** 854,864 ****
/* At least one references for the conn_t */
ASSERT(ixa->ixa_refcnt >= 1);
/* Make sure conn_ixa doesn't disappear while we copy it */
! atomic_add_32(&ixa->ixa_refcnt, 1);
ixa = kmem_alloc(sizeof (*ixa), KM_NOSLEEP);
if (ixa == NULL) {
mutex_exit(&connp->conn_lock);
ixa_refrele(connp->conn_ixa);
--- 854,864 ----
/* At least one references for the conn_t */
ASSERT(ixa->ixa_refcnt >= 1);
/* Make sure conn_ixa doesn't disappear while we copy it */
! atomic_inc_32(&ixa->ixa_refcnt);
ixa = kmem_alloc(sizeof (*ixa), KM_NOSLEEP);
if (ixa == NULL) {
mutex_exit(&connp->conn_lock);
ixa_refrele(connp->conn_ixa);