Ignore:
Timestamp:
Apr 16, 2017, 3:07:01 PM (3 months ago)
Author:
brainslayer
Message:

update

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/linux/universal/linux-3.18/drivers/net/ethernet/mellanox/mlx4/cq.c

    r25370 r31869  
    5757        struct mlx4_cq *cq;
    5858
     59        rcu_read_lock();
    5960        cq = radix_tree_lookup(&mlx4_priv(dev)->cq_table.tree,
    6061                               cqn & (dev->caps.num_cqs - 1));
     62        rcu_read_unlock();
     63
    6164        if (!cq) {
    6265                mlx4_dbg(dev, "Completion event for bogus CQ %08x\n", cqn);
     
    6467        }
    6568
     69        /* Acessing the CQ outside of rcu_read_lock is safe, because
     70         * the CQ is freed only after interrupt handling is completed.
     71         */
    6672        ++cq->arm_sn;
    6773
     
    7480        struct mlx4_cq *cq;
    7581
    76         spin_lock(&cq_table->lock);
    77 
     82        rcu_read_lock();
    7883        cq = radix_tree_lookup(&cq_table->tree, cqn & (dev->caps.num_cqs - 1));
    79         if (cq)
    80                 atomic_inc(&cq->refcount);
    81 
    82         spin_unlock(&cq_table->lock);
     84        rcu_read_unlock();
    8385
    8486        if (!cq) {
    85                 mlx4_warn(dev, "Async event for bogus CQ %08x\n", cqn);
     87                mlx4_dbg(dev, "Async event for bogus CQ %08x\n", cqn);
    8688                return;
    8789        }
    8890
     91        /* Acessing the CQ outside of rcu_read_lock is safe, because
     92         * the CQ is freed only after interrupt handling is completed.
     93         */
    8994        cq->event(cq, event_type);
    90 
    91         if (atomic_dec_and_test(&cq->refcount))
    92                 complete(&cq->free);
    9395}
    9496
     
    257259                return err;
    258260
    259         spin_lock_irq(&cq_table->lock);
     261        spin_lock(&cq_table->lock);
    260262        err = radix_tree_insert(&cq_table->tree, cq->cqn, cq);
    261         spin_unlock_irq(&cq_table->lock);
     263        spin_unlock(&cq_table->lock);
    262264        if (err)
    263265                goto err_icm;
     
    298300
    299301err_radix:
    300         spin_lock_irq(&cq_table->lock);
     302        spin_lock(&cq_table->lock);
    301303        radix_tree_delete(&cq_table->tree, cq->cqn);
    302         spin_unlock_irq(&cq_table->lock);
     304        spin_unlock(&cq_table->lock);
    303305
    304306err_icm:
     
    315317        int err;
    316318
     319        spin_lock(&cq_table->lock);
     320        radix_tree_delete(&cq_table->tree, cq->cqn);
     321        spin_unlock(&cq_table->lock);
     322
    317323        err = mlx4_HW2SW_CQ(dev, NULL, cq->cqn);
    318324        if (err)
     
    320326
    321327        synchronize_irq(priv->eq_table.eq[cq->vector].irq);
    322 
    323         spin_lock_irq(&cq_table->lock);
    324         radix_tree_delete(&cq_table->tree, cq->cqn);
    325         spin_unlock_irq(&cq_table->lock);
    326328
    327329        if (atomic_dec_and_test(&cq->refcount))
Note: See TracChangeset for help on using the changeset viewer.