Print this page
MFV: illumos-gate@7ec6bfcf4280022b95218f03e28fb50217e4b6ff
9902 mac: mac_soft_ring_poll should use size_t
Reviewed by: Yuri Pankov <yuripv@yuripv.net>
Reviewed by: Andy Fiddaman <andy@omniosce.org>
Reviewed by: Dan McDonald <danmcd@joyent.com>
Reviewed by: Ryan Zezeski <ryan.zeseski@joyent.com>
Approved by: Dan McDonald <danmcd@joyent.com>
Author: Toomas Soome <tsoome@me.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/io/mac/mac_soft_ring.c
          +++ new/usr/src/uts/common/io/mac/mac_soft_ring.c
↓ open down ↓ 144 lines elided ↑ open up ↑
 145  145   *
 146  146   * Create a soft ring, do the necessary setup and bind the worker
 147  147   * thread to the assigned CPU.
 148  148   */
 149  149  mac_soft_ring_t *
 150  150  mac_soft_ring_create(int id, clock_t wait, uint16_t type,
 151  151      pri_t pri, mac_client_impl_t *mcip, mac_soft_ring_set_t *mac_srs,
 152  152      processorid_t cpuid, mac_direct_rx_t rx_func, void *x_arg1,
 153  153      mac_resource_handle_t x_arg2)
 154  154  {
 155      -        mac_soft_ring_t         *ringp;
 156      -        char                    name[S_RING_NAMELEN];
      155 +        mac_soft_ring_t         *ringp;
      156 +        char                    name[S_RING_NAMELEN];
 157  157  
 158  158          bzero(name, 64);
 159  159          ringp = kmem_cache_alloc(mac_soft_ring_cache, KM_SLEEP);
 160  160  
 161  161          if (type & ST_RING_TCP) {
 162  162                  (void) snprintf(name, sizeof (name),
 163  163                      "mac_tcp_soft_ring_%d_%p", id, (void *)mac_srs);
 164  164          } else if (type & ST_RING_UDP) {
 165  165                  (void) snprintf(name, sizeof (name),
 166  166                      "mac_udp_soft_ring_%d_%p", id, (void *)mac_srs);
↓ open down ↓ 180 lines elided ↑ open up ↑
 347  347   * packets are destined and s_ring_rx_arg1/s_ring_rx_arg2 are the
 348  348   * cookie meant for the client.
 349  349   */
 350  350  /* ARGSUSED */
 351  351  static void
 352  352  mac_rx_soft_ring_drain(mac_soft_ring_t *ringp)
 353  353  {
 354  354          mblk_t          *mp;
 355  355          void            *arg1;
 356  356          mac_resource_handle_t arg2;
 357      -        timeout_id_t    tid;
      357 +        timeout_id_t    tid;
 358  358          mac_direct_rx_t proc;
 359  359          size_t          sz;
 360  360          int             cnt;
 361  361          mac_soft_ring_set_t     *mac_srs = ringp->s_ring_set;
 362  362  
 363  363          ringp->s_ring_run = curthread;
 364  364          ASSERT(mutex_owned(&ringp->s_ring_lock));
 365  365          ASSERT(!(ringp->s_ring_state & S_RING_PROC));
 366  366  
 367  367          if ((tid = ringp->s_ring_tid) != NULL)
↓ open down ↓ 161 lines elided ↑ open up ↑
 529  529  
 530  530  /*
 531  531   * mac_soft_ring_poll
 532  532   *
 533  533   * This routine is called by the client to poll for packets from
 534  534   * the soft ring. The function name and cookie corresponding to
 535  535   * the soft ring is exchanged during capability negotiation during
 536  536   * setup.
 537  537   */
 538  538  mblk_t *
 539      -mac_soft_ring_poll(mac_soft_ring_t *ringp, int bytes_to_pickup)
      539 +mac_soft_ring_poll(mac_soft_ring_t *ringp, size_t bytes_to_pickup)
 540  540  {
 541  541          mblk_t  *head, *tail;
 542  542          mblk_t  *mp;
 543  543          size_t  sz = 0;
 544  544          int     cnt = 0;
 545  545          mac_soft_ring_set_t     *mac_srs = ringp->s_ring_set;
 546  546  
 547  547          ASSERT(mac_srs != NULL);
 548  548  
 549  549          mutex_enter(&ringp->s_ring_lock);
↓ open down ↓ 91 lines elided ↑ open up ↑
 641  641  
 642  642  /*
 643  643   * mac_tx_soft_ring_drain
 644  644   *
 645  645   * The transmit side drain routine in case the soft ring was being
 646  646   * used to transmit packets.
 647  647   */
 648  648  static void
 649  649  mac_tx_soft_ring_drain(mac_soft_ring_t *ringp)
 650  650  {
 651      -        mblk_t                  *mp;
 652      -        void                    *arg1;
 653      -        void                    *arg2;
 654      -        mblk_t                  *tail;
      651 +        mblk_t                  *mp;
      652 +        void                    *arg1;
      653 +        void                    *arg2;
      654 +        mblk_t                  *tail;
 655  655          uint_t                  saved_pkt_count, saved_size;
 656  656          mac_tx_stats_t          stats;
 657  657          mac_soft_ring_set_t     *mac_srs = ringp->s_ring_set;
 658  658  
 659  659          saved_pkt_count = saved_size = 0;
 660  660          ringp->s_ring_run = curthread;
 661  661          ASSERT(mutex_owned(&ringp->s_ring_lock));
 662  662          ASSERT(!(ringp->s_ring_state & S_RING_PROC));
 663  663  
 664  664          ringp->s_ring_state |= S_RING_PROC;
↓ open down ↓ 71 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX