aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Falcon <tlfalcon@linux.vnet.ibm.com>2018-04-06 19:37:02 -0400
committerDavid S. Miller <davem@davemloft.net>2018-04-08 12:39:47 -0400
commit37e40fa8f62ba33021cb0050e38f87d7519ee447 (patch)
treea2c7ca16975426bf96d6033a55bfb73045dfd9b2
parente41f0548473eb7b6499bd8482474e30ae6d31220 (diff)
ibmvnic: Fix DMA mapping mistakes
Fix some mistakes caught by the DMA debugger. The first change fixes a unnecessary unmap that should have been removed in an earlier update. The next hunk fixes another bad unmap by zeroing the bit checked to determine that an unmap is needed. The final change fixes some buffers that are unmapped with the wrong direction specified. Signed-off-by: Thomas Falcon <tlfalcon@linux.vnet.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/ibm/ibmvnic.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
index b492af6affc3..58e01432c2aa 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -320,9 +320,6 @@ failure:
320 dev_info(dev, "replenish pools failure\n"); 320 dev_info(dev, "replenish pools failure\n");
321 pool->free_map[pool->next_free] = index; 321 pool->free_map[pool->next_free] = index;
322 pool->rx_buff[index].skb = NULL; 322 pool->rx_buff[index].skb = NULL;
323 if (!dma_mapping_error(dev, dma_addr))
324 dma_unmap_single(dev, dma_addr, pool->buff_size,
325 DMA_FROM_DEVICE);
326 323
327 dev_kfree_skb_any(skb); 324 dev_kfree_skb_any(skb);
328 adapter->replenish_add_buff_failure++; 325 adapter->replenish_add_buff_failure++;
@@ -2574,7 +2571,7 @@ static int ibmvnic_complete_tx(struct ibmvnic_adapter *adapter,
2574 union sub_crq *next; 2571 union sub_crq *next;
2575 int index; 2572 int index;
2576 int i, j; 2573 int i, j;
2577 u8 first; 2574 u8 *first;
2578 2575
2579restart_loop: 2576restart_loop:
2580 while (pending_scrq(adapter, scrq)) { 2577 while (pending_scrq(adapter, scrq)) {
@@ -2605,11 +2602,12 @@ restart_loop:
2605 txbuff->data_dma[j] = 0; 2602 txbuff->data_dma[j] = 0;
2606 } 2603 }
2607 /* if sub_crq was sent indirectly */ 2604 /* if sub_crq was sent indirectly */
2608 first = txbuff->indir_arr[0].generic.first; 2605 first = &txbuff->indir_arr[0].generic.first;
2609 if (first == IBMVNIC_CRQ_CMD) { 2606 if (*first == IBMVNIC_CRQ_CMD) {
2610 dma_unmap_single(dev, txbuff->indir_dma, 2607 dma_unmap_single(dev, txbuff->indir_dma,
2611 sizeof(txbuff->indir_arr), 2608 sizeof(txbuff->indir_arr),
2612 DMA_TO_DEVICE); 2609 DMA_TO_DEVICE);
2610 *first = 0;
2613 } 2611 }
2614 2612
2615 if (txbuff->last_frag) { 2613 if (txbuff->last_frag) {
@@ -3882,9 +3880,9 @@ static int handle_login_rsp(union ibmvnic_crq *login_rsp_crq,
3882 int i; 3880 int i;
3883 3881
3884 dma_unmap_single(dev, adapter->login_buf_token, adapter->login_buf_sz, 3882 dma_unmap_single(dev, adapter->login_buf_token, adapter->login_buf_sz,
3885 DMA_BIDIRECTIONAL); 3883 DMA_TO_DEVICE);
3886 dma_unmap_single(dev, adapter->login_rsp_buf_token, 3884 dma_unmap_single(dev, adapter->login_rsp_buf_token,
3887 adapter->login_rsp_buf_sz, DMA_BIDIRECTIONAL); 3885 adapter->login_rsp_buf_sz, DMA_FROM_DEVICE);
3888 3886
3889 /* If the number of queues requested can't be allocated by the 3887 /* If the number of queues requested can't be allocated by the
3890 * server, the login response will return with code 1. We will need 3888 * server, the login response will return with code 1. We will need