Skip to content

Commit 80f0fe0

Browse files
tlfalcondavem330
authored andcommitted
ibmvnic: Unmap DMA address of TX descriptor buffers after use
There's no need to wait until a completion is received to unmap TX descriptor buffers that have been passed to the hypervisor. Instead unmap it when the hypervisor call has completed. This patch avoids the possibility that a buffer will not be unmapped because a TX completion is lost or mishandled. Reported-by: Abdul Haleem <[email protected]> Tested-by: Devesh K. Singh <[email protected]> Signed-off-by: Thomas Falcon <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 37b0a73 commit 80f0fe0

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

drivers/net/ethernet/ibm/ibmvnic.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1568,6 +1568,8 @@ static netdev_tx_t ibmvnic_xmit(struct sk_buff *skb, struct net_device *netdev)
15681568
lpar_rc = send_subcrq_indirect(adapter, handle_array[queue_num],
15691569
(u64)tx_buff->indir_dma,
15701570
(u64)num_entries);
1571+
dma_unmap_single(dev, tx_buff->indir_dma,
1572+
sizeof(tx_buff->indir_arr), DMA_TO_DEVICE);
15711573
} else {
15721574
tx_buff->num_entries = num_entries;
15731575
lpar_rc = send_subcrq(adapter, handle_array[queue_num],
@@ -2788,7 +2790,6 @@ static int ibmvnic_complete_tx(struct ibmvnic_adapter *adapter,
27882790
union sub_crq *next;
27892791
int index;
27902792
int i, j;
2791-
u8 *first;
27922793

27932794
restart_loop:
27942795
while (pending_scrq(adapter, scrq)) {
@@ -2818,14 +2819,6 @@ static int ibmvnic_complete_tx(struct ibmvnic_adapter *adapter,
28182819

28192820
txbuff->data_dma[j] = 0;
28202821
}
2821-
/* if sub_crq was sent indirectly */
2822-
first = &txbuff->indir_arr[0].generic.first;
2823-
if (*first == IBMVNIC_CRQ_CMD) {
2824-
dma_unmap_single(dev, txbuff->indir_dma,
2825-
sizeof(txbuff->indir_arr),
2826-
DMA_TO_DEVICE);
2827-
*first = 0;
2828-
}
28292822

28302823
if (txbuff->last_frag) {
28312824
dev_kfree_skb_any(txbuff->skb);

0 commit comments

Comments
 (0)