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

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/io/chxge/pe.c
          +++ new/usr/src/uts/common/io/chxge/pe.c
↓ open down ↓ 27 lines elided ↑ open up ↑
  28   28   * This file is part of the Chelsio T1 Ethernet driver.
  29   29   *
  30   30   * Copyright (C) 2003-2005 Chelsio Communications.  All rights reserved.
  31   31   */
  32   32  
  33   33  /*
  34   34   * Solaris Multithreaded STREAMS Chelsio PCI Ethernet Driver.
  35   35   * Interface code
  36   36   */
  37   37  
  38      -#pragma ident   "%Z%%M% %I%     %E% SMI"
  39      -
  40   38  #include <sys/types.h>
  41   39  #include <sys/systm.h>
  42   40  #include <sys/cmn_err.h>
  43   41  #include <sys/ddi.h>
  44   42  #include <sys/sunddi.h>
  45   43  #include <sys/byteorder.h>
  46   44  #include <sys/atomic.h>
  47   45  #include <sys/ethernet.h>
  48   46  #if PE_PROFILING_ENABLED
  49   47  #include <sys/time.h>
↓ open down ↓ 1333 lines elided ↑ open up ↑
1383 1381                  /*
1384 1382                   * free descripter buffer
1385 1383                   */
1386 1384                  kmem_free(rbp, sizeof (ch_esb_t));
1387 1385  
1388 1386                  /*
1389 1387                   * decrement count of receive buffers freed by callback
1390 1388                   * We decrement here so anyone trying to do fini will
1391 1389                   * only remove the driver once the counts go to 0.
1392 1390                   */
1393      -                atomic_add_32(&buffers_in_use[i], -1);
     1391 +                atomic_dec_32(&buffers_in_use[i]);
1394 1392  
1395 1393                  return;
1396 1394          }
1397 1395  
1398 1396          mutex_enter(&sa->ch_small_esbl);
1399 1397          rbp->cs_next = sa->ch_small_esb_free;
1400 1398          sa->ch_small_esb_free = rbp;
1401 1399          mutex_exit(&sa->ch_small_esbl);
1402 1400  
1403 1401          /*
1404 1402           * decrement count of receive buffers freed by callback
1405 1403           */
1406      -        atomic_add_32(&buffers_in_use[rbp->cs_index], -1);
     1404 +        atomic_dec_32(&buffers_in_use[rbp->cs_index]);
1407 1405  }
1408 1406  
1409 1407  /*
1410 1408   * callback function from freeb() when esballoced mblk freed.
1411 1409   */
1412 1410  void
1413 1411  ch_big_rbuf_recycle(ch_esb_t *rbp)
1414 1412  {
1415 1413          ch_t *sa = rbp->cs_sa;
1416 1414  
↓ open down ↓ 9 lines elided ↑ open up ↑
1426 1424                  /*
1427 1425                   * free descripter buffer
1428 1426                   */
1429 1427                  kmem_free(rbp, sizeof (ch_esb_t));
1430 1428  
1431 1429                  /*
1432 1430                   * decrement count of receive buffers freed by callback
1433 1431                   * We decrement here so anyone trying to do fini will
1434 1432                   * only remove the driver once the counts go to 0.
1435 1433                   */
1436      -                atomic_add_32(&buffers_in_use[i], -1);
     1434 +                atomic_dec_32(&buffers_in_use[i]);
1437 1435  
1438 1436                  return;
1439 1437          }
1440 1438  
1441 1439          mutex_enter(&sa->ch_big_esbl);
1442 1440          rbp->cs_next = sa->ch_big_esb_free;
1443 1441          sa->ch_big_esb_free = rbp;
1444 1442          mutex_exit(&sa->ch_big_esbl);
1445 1443  
1446 1444          /*
1447 1445           * decrement count of receive buffers freed by callback
1448 1446           */
1449      -        atomic_add_32(&buffers_in_use[rbp->cs_index], -1);
     1447 +        atomic_dec_32(&buffers_in_use[rbp->cs_index]);
1450 1448  }
1451 1449  
1452 1450  /*
1453 1451   * get a pre-allocated, pre-mapped receive buffer from free list.
1454 1452   * (used sge.c)
1455 1453   */
1456 1454  ch_esb_t *
1457 1455  ch_get_small_rbuf(ch_t *sa)
1458 1456  {
1459 1457          ch_esb_t *rbp;
↓ open down ↓ 271 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX