diff options
author | Malcolm Priestley <tvboxspy@gmail.com> | 2015-02-09 14:11:33 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-03-09 03:12:40 -0400 |
commit | c312530589ed9524fc7cc921105dc9b67ea32d6a (patch) | |
tree | 03fcac1e57adfedccccb8114086908932c0d0508 | |
parent | 9eccca0843205f87c00404b663188b88eb248051 (diff) |
staging: vt6655: vnt_tx_packet fix dma_idx selection.
There is still a problem that dma_idx is causing packets to
go onto the wrong tx path.
Protect dma_idx fully with the present first lock and
use pTDInfo->byFlags TD_FLAGS_NETIF_SKB to set MACvTransmit.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/staging/vt6655/device_main.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c index 4324282afe49..f5c5872b587e 100644 --- a/drivers/staging/vt6655/device_main.c +++ b/drivers/staging/vt6655/device_main.c | |||
@@ -1187,12 +1187,14 @@ static int vnt_tx_packet(struct vnt_private *priv, struct sk_buff *skb) | |||
1187 | { | 1187 | { |
1188 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | 1188 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; |
1189 | PSTxDesc head_td; | 1189 | PSTxDesc head_td; |
1190 | u32 dma_idx = TYPE_AC0DMA; | 1190 | u32 dma_idx; |
1191 | unsigned long flags; | 1191 | unsigned long flags; |
1192 | 1192 | ||
1193 | spin_lock_irqsave(&priv->lock, flags); | 1193 | spin_lock_irqsave(&priv->lock, flags); |
1194 | 1194 | ||
1195 | if (!ieee80211_is_data(hdr->frame_control)) | 1195 | if (ieee80211_is_data(hdr->frame_control)) |
1196 | dma_idx = TYPE_AC0DMA; | ||
1197 | else | ||
1196 | dma_idx = TYPE_TXDMA0; | 1198 | dma_idx = TYPE_TXDMA0; |
1197 | 1199 | ||
1198 | if (AVAIL_TD(priv, dma_idx) < 1) { | 1200 | if (AVAIL_TD(priv, dma_idx) < 1) { |
@@ -1206,6 +1208,9 @@ static int vnt_tx_packet(struct vnt_private *priv, struct sk_buff *skb) | |||
1206 | 1208 | ||
1207 | head_td->pTDInfo->skb = skb; | 1209 | head_td->pTDInfo->skb = skb; |
1208 | 1210 | ||
1211 | if (dma_idx == TYPE_AC0DMA) | ||
1212 | head_td->pTDInfo->byFlags = TD_FLAGS_NETIF_SKB; | ||
1213 | |||
1209 | priv->iTDUsed[dma_idx]++; | 1214 | priv->iTDUsed[dma_idx]++; |
1210 | 1215 | ||
1211 | /* Take ownership */ | 1216 | /* Take ownership */ |
@@ -1234,13 +1239,10 @@ static int vnt_tx_packet(struct vnt_private *priv, struct sk_buff *skb) | |||
1234 | 1239 | ||
1235 | head_td->buff_addr = cpu_to_le32(head_td->pTDInfo->skb_dma); | 1240 | head_td->buff_addr = cpu_to_le32(head_td->pTDInfo->skb_dma); |
1236 | 1241 | ||
1237 | if (dma_idx == TYPE_AC0DMA) { | 1242 | if (head_td->pTDInfo->byFlags & TD_FLAGS_NETIF_SKB) |
1238 | head_td->pTDInfo->byFlags = TD_FLAGS_NETIF_SKB; | ||
1239 | |||
1240 | MACvTransmitAC0(priv->PortOffset); | 1243 | MACvTransmitAC0(priv->PortOffset); |
1241 | } else { | 1244 | else |
1242 | MACvTransmit0(priv->PortOffset); | 1245 | MACvTransmit0(priv->PortOffset); |
1243 | } | ||
1244 | 1246 | ||
1245 | spin_unlock_irqrestore(&priv->lock, flags); | 1247 | spin_unlock_irqrestore(&priv->lock, flags); |
1246 | 1248 | ||