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


 405  * incarnation.
 406  */
 407 static void
 408 t4_l2e_free(struct l2t_entry *e)
 409 {
 410         struct l2t_data *d;
 411 
 412         mutex_enter(&e->lock);
 413         /* LINTED: E_NOP_IF_STMT */
 414         if (atomic_read(&e->refcnt) == 0) {  /* hasn't been recycled */
 415                 /*
 416                  * Don't need to worry about the arpq, an L2T entry can't be
 417                  * released if any packets are waiting for resolution as we
 418                  * need to be able to communicate with the device to close a
 419                  * connection.
 420                  */
 421         }
 422         mutex_exit(&e->lock);
 423 
 424         d = container_of(e, struct l2t_data, l2tab[e->idx]);
 425         atomic_add_int(&d->nfree, 1);
 426 
 427 }
 428 
 429 void
 430 t4_l2t_release(struct l2t_entry *e)
 431 {
 432         if (atomic_dec_uint_nv(&e->refcnt) == 0)
 433                 t4_l2e_free(e);
 434 }
 435 
 436 /* ARGSUSED */
 437 int
 438 do_l2t_write_rpl(struct sge_iq *iq, const struct rss_header *rss, mblk_t *m)
 439 {
 440         struct adapter *sc = iq->adapter;
 441         const struct cpl_l2t_write_rpl *rpl = (const void *)(rss + 1);
 442         unsigned int tid = GET_TID(rpl);
 443         unsigned int idx = tid & (L2T_SIZE - 1);
 444 
 445         if (likely(rpl->status != CPL_ERR_NONE)) {




 405  * incarnation.
 406  */
 407 static void
 408 t4_l2e_free(struct l2t_entry *e)
 409 {
 410         struct l2t_data *d;
 411 
 412         mutex_enter(&e->lock);
 413         /* LINTED: E_NOP_IF_STMT */
 414         if (atomic_read(&e->refcnt) == 0) {  /* hasn't been recycled */
 415                 /*
 416                  * Don't need to worry about the arpq, an L2T entry can't be
 417                  * released if any packets are waiting for resolution as we
 418                  * need to be able to communicate with the device to close a
 419                  * connection.
 420                  */
 421         }
 422         mutex_exit(&e->lock);
 423 
 424         d = container_of(e, struct l2t_data, l2tab[e->idx]);
 425         atomic_inc_uint(&d->nfree);
 426 
 427 }
 428 
 429 void
 430 t4_l2t_release(struct l2t_entry *e)
 431 {
 432         if (atomic_dec_uint_nv(&e->refcnt) == 0)
 433                 t4_l2e_free(e);
 434 }
 435 
 436 /* ARGSUSED */
 437 int
 438 do_l2t_write_rpl(struct sge_iq *iq, const struct rss_header *rss, mblk_t *m)
 439 {
 440         struct adapter *sc = iq->adapter;
 441         const struct cpl_l2t_write_rpl *rpl = (const void *)(rss + 1);
 442         unsigned int tid = GET_TID(rpl);
 443         unsigned int idx = tid & (L2T_SIZE - 1);
 444 
 445         if (likely(rpl->status != CPL_ERR_NONE)) {