mt76: remove rx_page_lock
authorStanislaw Gruszka <sgruszka@redhat.com>
Thu, 21 Mar 2019 15:25:27 +0000 (16:25 +0100)
committerFelix Fietkau <nbd@nbd.name>
Wed, 1 May 2019 11:03:57 +0000 (13:03 +0200)
We can not run mt76u_alloc_buf() concurently, rx_tasklet is stooped
when mt76u_submit_rx_buffers(). We can remove rx_page_lock.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mt76.h
drivers/net/wireless/mediatek/mt76/usb.c

index 069d687eb3c4e2f2c925993deb7f08ea4be14c78..0018131de20c8a0a46c180850a30c2ea3955da18 100644 (file)
@@ -138,7 +138,6 @@ struct mt76_queue {
        dma_addr_t desc_dma;
        struct sk_buff *rx_head;
        struct page_frag_cache rx_page;
-       spinlock_t rx_page_lock;
 };
 
 struct mt76_sw_queue {
index ac4608f1422d798f97d67d0a9c8fff649406c44b..3f21599d52dead3607c594b0c69338518a60be8d 100644 (file)
@@ -292,7 +292,6 @@ mt76u_fill_rx_sg(struct mt76_dev *dev, struct mt76u_buf *buf,
        struct urb *urb = buf->urb;
        int i;
 
-       spin_lock_bh(&q->rx_page_lock);
        for (i = 0; i < nsgs; i++) {
                struct page *page;
                void *data;
@@ -306,7 +305,6 @@ mt76u_fill_rx_sg(struct mt76_dev *dev, struct mt76u_buf *buf,
                offset = data - page_address(page);
                sg_set_page(&urb->sg[i], page, sglen, offset);
        }
-       spin_unlock_bh(&q->rx_page_lock);
 
        if (i < nsgs) {
                int j;
@@ -569,7 +567,6 @@ static int mt76u_alloc_rx(struct mt76_dev *dev)
        if (!usb->mcu.data)
                return -ENOMEM;
 
-       spin_lock_init(&q->rx_page_lock);
        spin_lock_init(&q->lock);
        q->entry = devm_kcalloc(dev->dev,
                                MT_NUM_RX_ENTRIES, sizeof(*q->entry),
@@ -597,15 +594,12 @@ static void mt76u_free_rx(struct mt76_dev *dev)
        for (i = 0; i < q->ndesc; i++)
                mt76u_buf_free(&q->entry[i].ubuf);
 
-       spin_lock_bh(&q->rx_page_lock);
        if (!q->rx_page.va)
-               goto out;
+               return;
 
        page = virt_to_page(q->rx_page.va);
        __page_frag_cache_drain(page, q->rx_page.pagecnt_bias);
        memset(&q->rx_page, 0, sizeof(q->rx_page));
-out:
-       spin_unlock_bh(&q->rx_page_lock);
 }
 
 static void mt76u_stop_rx(struct mt76_dev *dev)