mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-29 07:34:06 +08:00
iwl3945: fix length of dma buffers
commit bdb084b22d
Author: Stanislaw Gruszka <sgruszka@redhat.com>
Date: Wed Feb 13 15:49:08 2013 +0100
iwlegacy: more checks for dma mapping errors
broke il3945_tx_skb() dma buffer length settings, what results on
firmware errors like showed below and make 3945 device non usable.
iwl3945 0000:02:00.0: Microcode SW error detected. Restarting 0x82000008.
iwl3945 0000:02:00.0: Loaded firmware version: 15.32.2.9
iwl3945 0000:02:00.0: Start IWL Error Log Dump:
iwl3945 0000:02:00.0: Status: 0x000202E4, count: 1
iwl3945 0000:02:00.0: Desc Time asrtPC blink2 ilink1 nmiPC Line
iwl3945 0000:02:00.0: SYSASSERT (0x5) 0000208934 0x008B6 0x0035E 0x00320 0x00000 267
iwl3945 0000:02:00.0: Error Reply type 0x00000001 cmd
Reported-by: Zdenek Kabelac <zkabelac@redhat.com>
Reported-by: Krzysztof Kolasa <kkolasa@winsoft.pl>
Reported-by: Pedro Francisco <pedrogfrancisco@gmail.com>
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
parent
8fa48cbdfb
commit
7f42ace311
@ -475,6 +475,7 @@ il3945_tx_skb(struct il_priv *il,
|
||||
dma_addr_t txcmd_phys;
|
||||
int txq_id = skb_get_queue_mapping(skb);
|
||||
u16 len, idx, hdr_len;
|
||||
u16 firstlen, secondlen;
|
||||
u8 id;
|
||||
u8 unicast;
|
||||
u8 sta_id;
|
||||
@ -589,21 +590,22 @@ il3945_tx_skb(struct il_priv *il,
|
||||
len =
|
||||
sizeof(struct il3945_tx_cmd) + sizeof(struct il_cmd_header) +
|
||||
hdr_len;
|
||||
len = (len + 3) & ~3;
|
||||
firstlen = (len + 3) & ~3;
|
||||
|
||||
/* Physical address of this Tx command's header (not MAC header!),
|
||||
* within command buffer array. */
|
||||
txcmd_phys =
|
||||
pci_map_single(il->pci_dev, &out_cmd->hdr, len, PCI_DMA_TODEVICE);
|
||||
pci_map_single(il->pci_dev, &out_cmd->hdr, firstlen,
|
||||
PCI_DMA_TODEVICE);
|
||||
if (unlikely(pci_dma_mapping_error(il->pci_dev, txcmd_phys)))
|
||||
goto drop_unlock;
|
||||
|
||||
/* Set up TFD's 2nd entry to point directly to remainder of skb,
|
||||
* if any (802.11 null frames have no payload). */
|
||||
len = skb->len - hdr_len;
|
||||
if (len) {
|
||||
secondlen = skb->len - hdr_len;
|
||||
if (secondlen > 0) {
|
||||
phys_addr =
|
||||
pci_map_single(il->pci_dev, skb->data + hdr_len, len,
|
||||
pci_map_single(il->pci_dev, skb->data + hdr_len, secondlen,
|
||||
PCI_DMA_TODEVICE);
|
||||
if (unlikely(pci_dma_mapping_error(il->pci_dev, phys_addr)))
|
||||
goto drop_unlock;
|
||||
@ -611,12 +613,12 @@ il3945_tx_skb(struct il_priv *il,
|
||||
|
||||
/* Add buffer containing Tx command and MAC(!) header to TFD's
|
||||
* first entry */
|
||||
il->ops->txq_attach_buf_to_tfd(il, txq, txcmd_phys, len, 1, 0);
|
||||
il->ops->txq_attach_buf_to_tfd(il, txq, txcmd_phys, firstlen, 1, 0);
|
||||
dma_unmap_addr_set(out_meta, mapping, txcmd_phys);
|
||||
dma_unmap_len_set(out_meta, len, len);
|
||||
if (len)
|
||||
il->ops->txq_attach_buf_to_tfd(il, txq, phys_addr, len, 0,
|
||||
U32_PAD(len));
|
||||
dma_unmap_len_set(out_meta, len, firstlen);
|
||||
if (secondlen > 0)
|
||||
il->ops->txq_attach_buf_to_tfd(il, txq, phys_addr, secondlen, 0,
|
||||
U32_PAD(secondlen));
|
||||
|
||||
if (!ieee80211_has_morefrags(hdr->frame_control)) {
|
||||
txq->need_update = 1;
|
||||
|
Loading…
Reference in New Issue
Block a user