Print this page
5045 use atomic_{inc,dec}_* instead of atomic_add_*


  47 #include <sys/ib/clients/rdsv3/rdma.h>
  48 #include <sys/ib/clients/rdsv3/rdsv3_debug.h>
  49 
  50 void
  51 rdsv3_inc_init(struct rdsv3_incoming *inc, struct rdsv3_connection *conn,
  52     uint32_be_t saddr)
  53 {
  54         RDSV3_DPRINTF5("rdsv3_inc_init", "Enter(inc: %p, conn: %p)", inc, conn);
  55         inc->i_refcount = 1;
  56         list_link_init(&inc->i_item);
  57         inc->i_conn = conn;
  58         inc->i_saddr = saddr;
  59         inc->i_rdma_cookie = 0;
  60 }
  61 
  62 void
  63 rdsv3_inc_addref(struct rdsv3_incoming *inc)
  64 {
  65         RDSV3_DPRINTF4("rdsv3_inc_addref",
  66             "addref inc %p ref %d", inc, atomic_get(&inc->i_refcount));
  67         atomic_add_32(&inc->i_refcount, 1);
  68 }
  69 
  70 void
  71 rdsv3_inc_put(struct rdsv3_incoming *inc)
  72 {
  73         RDSV3_DPRINTF4("rdsv3_inc_put", "put inc %p ref %d",
  74             inc, atomic_get(&inc->i_refcount));
  75         if (atomic_dec_and_test(&inc->i_refcount)) {
  76                 ASSERT(!list_link_active(&inc->i_item));
  77 
  78                 inc->i_conn->c_trans->inc_free(inc);
  79         }
  80 }
  81 
  82 /*ARGSUSED*/
  83 static void
  84 rdsv3_recv_rcvbuf_delta(struct rdsv3_sock *rs, struct rsock *sk,
  85     struct rdsv3_cong_map *map,
  86     int delta, uint16_be_t port)
  87 {




  47 #include <sys/ib/clients/rdsv3/rdma.h>
  48 #include <sys/ib/clients/rdsv3/rdsv3_debug.h>
  49 
  50 void
  51 rdsv3_inc_init(struct rdsv3_incoming *inc, struct rdsv3_connection *conn,
  52     uint32_be_t saddr)
  53 {
  54         RDSV3_DPRINTF5("rdsv3_inc_init", "Enter(inc: %p, conn: %p)", inc, conn);
  55         inc->i_refcount = 1;
  56         list_link_init(&inc->i_item);
  57         inc->i_conn = conn;
  58         inc->i_saddr = saddr;
  59         inc->i_rdma_cookie = 0;
  60 }
  61 
  62 void
  63 rdsv3_inc_addref(struct rdsv3_incoming *inc)
  64 {
  65         RDSV3_DPRINTF4("rdsv3_inc_addref",
  66             "addref inc %p ref %d", inc, atomic_get(&inc->i_refcount));
  67         atomic_inc_32(&inc->i_refcount);
  68 }
  69 
  70 void
  71 rdsv3_inc_put(struct rdsv3_incoming *inc)
  72 {
  73         RDSV3_DPRINTF4("rdsv3_inc_put", "put inc %p ref %d",
  74             inc, atomic_get(&inc->i_refcount));
  75         if (atomic_dec_and_test(&inc->i_refcount)) {
  76                 ASSERT(!list_link_active(&inc->i_item));
  77 
  78                 inc->i_conn->c_trans->inc_free(inc);
  79         }
  80 }
  81 
  82 /*ARGSUSED*/
  83 static void
  84 rdsv3_recv_rcvbuf_delta(struct rdsv3_sock *rs, struct rsock *sk,
  85     struct rdsv3_cong_map *map,
  86     int delta, uint16_be_t port)
  87 {