On 2019/06/17 09:44, Manish Chopra wrote: [...] > > --- a/drivers/net/ethernet/qlogic/qlge/qlge_main.c > > +++ b/drivers/net/ethernet/qlogic/qlge/qlge_main.c > > @@ -1110,9 +1110,6 @@ static void ql_update_lbq(struct ql_adapter *qdev, > > struct rx_ring *rx_ring) > > dma_unmap_addr_set(lbq_desc, mapaddr, map); > > *lbq_desc->addr = cpu_to_le64(map); > > > > - pci_dma_sync_single_for_device(qdev->pdev, map, > > - qdev->lbq_buf_size, > > - PCI_DMA_FROMDEVICE); > > clean_idx++; > > if (clean_idx == rx_ring->lbq_len) > > clean_idx = 0; > > @@ -1598,10 +1595,6 @@ static void ql_process_mac_rx_skb(struct > > ql_adapter *qdev, > > > > skb_put_data(new_skb, skb->data, length); > > > > - pci_dma_sync_single_for_device(qdev->pdev, > > - dma_unmap_addr(sbq_desc, mapaddr), > > - SMALL_BUF_MAP_SIZE, > > - PCI_DMA_FROMDEVICE); > > This was introduced in commit 2c9a266afefe ("qlge: Fix receive packets drop"). > So hoping that it is fine, the buffer shouldn't be synced for the device back > after the synced for CPU call in context of any ownership etc. ?
No, dma_sync_*_for_cpu() and dma_sync_*_for_device() calls don't have to be paired; they are not like lock acquire and release calls. In the cases the current patch is concerned with, the cpu does not write any data for the device in the rx buffers. Therefore, there is no need for those pci_dma_sync_single_for_device() calls.