diff options
author | Sathya Perla <sathyap@serverengines.com> | 2010-03-22 16:41:34 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-03-23 16:22:40 -0400 |
commit | ec43b1a64a132303a6800c781bc17c683aedc55b (patch) | |
tree | e9eec6144264de7b07e6fe1039ee8b0f3d61b86e /drivers/net/benet | |
parent | 7101e111217581a36e2eeae7c4a3815d60673cbc (diff) |
be2net: fix unmap_single/page() called incorrectly in Tx compl processing
The first wrb seen by tx compl processing does not have a dma handle in it.
Currently, pci_unmap_single() is attempted on this wrb and pci_unmap_page() on the
rest. So, pci_unmap_page() gets incorrectly called on the dma hdl of skb->data (that
was mapped using map_single()). This patch fixes this issue.
Signed-off-by: Sathya Perla <sathyap@serverengines.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/benet')
-rw-r--r-- | drivers/net/benet/be_main.c | 33 |
1 files changed, 12 insertions, 21 deletions
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c index 0800c6363908..174e5f899609 100644 --- a/drivers/net/benet/be_main.c +++ b/drivers/net/benet/be_main.c | |||
@@ -1047,35 +1047,26 @@ static void be_tx_compl_process(struct be_adapter *adapter, u16 last_index) | |||
1047 | struct be_eth_wrb *wrb; | 1047 | struct be_eth_wrb *wrb; |
1048 | struct sk_buff **sent_skbs = adapter->tx_obj.sent_skb_list; | 1048 | struct sk_buff **sent_skbs = adapter->tx_obj.sent_skb_list; |
1049 | struct sk_buff *sent_skb; | 1049 | struct sk_buff *sent_skb; |
1050 | u64 busaddr; | 1050 | u16 cur_index, num_wrbs = 1; /* account for hdr wrb */ |
1051 | u16 cur_index, num_wrbs = 0; | 1051 | bool unmap_skb_hdr = true; |
1052 | 1052 | ||
1053 | cur_index = txq->tail; | 1053 | sent_skb = sent_skbs[txq->tail]; |
1054 | sent_skb = sent_skbs[cur_index]; | ||
1055 | BUG_ON(!sent_skb); | 1054 | BUG_ON(!sent_skb); |
1056 | sent_skbs[cur_index] = NULL; | 1055 | sent_skbs[txq->tail] = NULL; |
1057 | wrb = queue_tail_node(txq); | 1056 | |
1058 | be_dws_le_to_cpu(wrb, sizeof(*wrb)); | 1057 | /* skip header wrb */ |
1059 | busaddr = ((u64)wrb->frag_pa_hi << 32) | (u64)wrb->frag_pa_lo; | ||
1060 | if (busaddr != 0) { | ||
1061 | pci_unmap_single(adapter->pdev, busaddr, | ||
1062 | wrb->frag_len, PCI_DMA_TODEVICE); | ||
1063 | } | ||
1064 | num_wrbs++; | ||
1065 | queue_tail_inc(txq); | 1058 | queue_tail_inc(txq); |
1066 | 1059 | ||
1067 | while (cur_index != last_index) { | 1060 | do { |
1068 | cur_index = txq->tail; | 1061 | cur_index = txq->tail; |
1069 | wrb = queue_tail_node(txq); | 1062 | wrb = queue_tail_node(txq); |
1070 | be_dws_le_to_cpu(wrb, sizeof(*wrb)); | 1063 | unmap_tx_frag(adapter->pdev, wrb, (unmap_skb_hdr && |
1071 | busaddr = ((u64)wrb->frag_pa_hi << 32) | (u64)wrb->frag_pa_lo; | 1064 | sent_skb->len > sent_skb->data_len)); |
1072 | if (busaddr != 0) { | 1065 | unmap_skb_hdr = false; |
1073 | pci_unmap_page(adapter->pdev, busaddr, | 1066 | |
1074 | wrb->frag_len, PCI_DMA_TODEVICE); | ||
1075 | } | ||
1076 | num_wrbs++; | 1067 | num_wrbs++; |
1077 | queue_tail_inc(txq); | 1068 | queue_tail_inc(txq); |
1078 | } | 1069 | } while (cur_index != last_index); |
1079 | 1070 | ||
1080 | atomic_sub(num_wrbs, &txq->used); | 1071 | atomic_sub(num_wrbs, &txq->used); |
1081 | 1072 | ||