Commit 31db45e3 authored by David S. Miller's avatar David S. Miller

Tigon3 net driver fixes:

- Make use of pci_unmap_xxx storage optimization.
- In tg3_get_invariants, fix cacheline_sz_reg shifts.
  On 5703 chips, if latency timer is less than 64, set
  it to 64.
- In tg3_test_dma, only run the actual test on 5700/5701
  chips.  Aparently 5702/5703 revs have some problems.
parent 852aaba8
...@@ -1509,7 +1509,8 @@ static void tg3_tx(struct tg3 *tp) ...@@ -1509,7 +1509,8 @@ static void tg3_tx(struct tg3 *tp)
if (unlikely(skb == NULL)) if (unlikely(skb == NULL))
BUG(); BUG();
pci_unmap_single(tp->pdev, ri->mapping, pci_unmap_single(tp->pdev,
pci_unmap_addr(ri, mapping),
(skb->len - skb->data_len), (skb->len - skb->data_len),
PCI_DMA_TODEVICE); PCI_DMA_TODEVICE);
...@@ -1526,7 +1527,7 @@ static void tg3_tx(struct tg3 *tp) ...@@ -1526,7 +1527,7 @@ static void tg3_tx(struct tg3 *tp)
BUG(); BUG();
pci_unmap_page(tp->pdev, pci_unmap_page(tp->pdev,
ri->mapping, pci_unmap_addr(ri, mapping),
skb_shinfo(skb)->frags[i].size, skb_shinfo(skb)->frags[i].size,
PCI_DMA_TODEVICE); PCI_DMA_TODEVICE);
...@@ -1614,7 +1615,7 @@ static int tg3_alloc_rx_skb(struct tg3 *tp, u32 opaque_key, ...@@ -1614,7 +1615,7 @@ static int tg3_alloc_rx_skb(struct tg3 *tp, u32 opaque_key,
PCI_DMA_FROMDEVICE); PCI_DMA_FROMDEVICE);
map->skb = skb; map->skb = skb;
map->mapping = mapping; pci_unmap_addr_set(map, mapping, mapping);
if (src_map != NULL) if (src_map != NULL)
src_map->skb = NULL; src_map->skb = NULL;
...@@ -1666,7 +1667,8 @@ static void tg3_recycle_rx(struct tg3 *tp, u32 opaque_key, ...@@ -1666,7 +1667,8 @@ static void tg3_recycle_rx(struct tg3 *tp, u32 opaque_key,
}; };
dest_map->skb = src_map->skb; dest_map->skb = src_map->skb;
dest_map->mapping = src_map->mapping; pci_unmap_addr_set(dest_map, mapping,
pci_unmap_addr(src_map, mapping));
dest_desc->addr_hi = src_desc->addr_hi; dest_desc->addr_hi = src_desc->addr_hi;
dest_desc->addr_lo = src_desc->addr_lo; dest_desc->addr_lo = src_desc->addr_lo;
...@@ -2497,7 +2499,8 @@ static void tg3_free_rings(struct tg3 *tp) ...@@ -2497,7 +2499,8 @@ static void tg3_free_rings(struct tg3 *tp)
if (rxp->skb == NULL) if (rxp->skb == NULL)
continue; continue;
pci_unmap_single(tp->pdev, rxp->mapping, pci_unmap_single(tp->pdev,
pci_unmap_addr(rxp, mapping),
RX_PKT_BUF_SZ - tp->rx_offset, RX_PKT_BUF_SZ - tp->rx_offset,
PCI_DMA_FROMDEVICE); PCI_DMA_FROMDEVICE);
dev_kfree_skb(rxp->skb); dev_kfree_skb(rxp->skb);
...@@ -2509,7 +2512,8 @@ static void tg3_free_rings(struct tg3 *tp) ...@@ -2509,7 +2512,8 @@ static void tg3_free_rings(struct tg3 *tp)
if (rxp->skb == NULL) if (rxp->skb == NULL)
continue; continue;
pci_unmap_single(tp->pdev, rxp->mapping, pci_unmap_single(tp->pdev,
pci_unmap_addr(rxp, mapping),
RX_MINI_PKT_BUF_SZ - tp->rx_offset, RX_MINI_PKT_BUF_SZ - tp->rx_offset,
PCI_DMA_FROMDEVICE); PCI_DMA_FROMDEVICE);
dev_kfree_skb(rxp->skb); dev_kfree_skb(rxp->skb);
...@@ -2521,7 +2525,8 @@ static void tg3_free_rings(struct tg3 *tp) ...@@ -2521,7 +2525,8 @@ static void tg3_free_rings(struct tg3 *tp)
if (rxp->skb == NULL) if (rxp->skb == NULL)
continue; continue;
pci_unmap_single(tp->pdev, rxp->mapping, pci_unmap_single(tp->pdev,
pci_unmap_addr(rxp, mapping),
RX_JUMBO_PKT_BUF_SZ - tp->rx_offset, RX_JUMBO_PKT_BUF_SZ - tp->rx_offset,
PCI_DMA_FROMDEVICE); PCI_DMA_FROMDEVICE);
dev_kfree_skb(rxp->skb); dev_kfree_skb(rxp->skb);
...@@ -2541,7 +2546,8 @@ static void tg3_free_rings(struct tg3 *tp) ...@@ -2541,7 +2546,8 @@ static void tg3_free_rings(struct tg3 *tp)
continue; continue;
} }
pci_unmap_single(tp->pdev, txp->mapping, pci_unmap_single(tp->pdev,
pci_unmap_addr(txp, mapping),
(skb->len - skb->data_len), (skb->len - skb->data_len),
PCI_DMA_TODEVICE); PCI_DMA_TODEVICE);
txp->skb = NULL; txp->skb = NULL;
...@@ -2550,7 +2556,8 @@ static void tg3_free_rings(struct tg3 *tp) ...@@ -2550,7 +2556,8 @@ static void tg3_free_rings(struct tg3 *tp)
for (j = 0; j < skb_shinfo(skb)->nr_frags; j++) { for (j = 0; j < skb_shinfo(skb)->nr_frags; j++) {
txp = &tp->tx_buffers[i & (TG3_TX_RING_SIZE - 1)]; txp = &tp->tx_buffers[i & (TG3_TX_RING_SIZE - 1)];
pci_unmap_page(tp->pdev, txp->mapping, pci_unmap_page(tp->pdev,
pci_unmap_addr(txp, mapping),
skb_shinfo(skb)->frags[j].size, skb_shinfo(skb)->frags[j].size,
PCI_DMA_TODEVICE); PCI_DMA_TODEVICE);
i++; i++;
...@@ -5441,10 +5448,23 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) ...@@ -5441,10 +5448,23 @@ static int __devinit tg3_get_invariants(struct tg3 *tp)
pci_read_config_dword(tp->pdev, TG3PCI_CACHELINESZ, pci_read_config_dword(tp->pdev, TG3PCI_CACHELINESZ,
&cacheline_sz_reg); &cacheline_sz_reg);
tp->pci_cacheline_sz = (cacheline_sz_reg >> 24) & 0xff; tp->pci_cacheline_sz = (cacheline_sz_reg >> 0) & 0xff;
tp->pci_lat_timer = (cacheline_sz_reg >> 16) & 0xff; tp->pci_lat_timer = (cacheline_sz_reg >> 8) & 0xff;
tp->pci_hdr_type = (cacheline_sz_reg >> 8) & 0xff; tp->pci_hdr_type = (cacheline_sz_reg >> 16) & 0xff;
tp->pci_bist = (cacheline_sz_reg >> 0) & 0xff; tp->pci_bist = (cacheline_sz_reg >> 24) & 0xff;
if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703 &&
tp->pci_lat_timer < 64) {
tp->pci_lat_timer = 64;
cacheline_sz_reg = ((tp->pci_cacheline_sz & 0xff) << 0);
cacheline_sz_reg |= ((tp->pci_lat_timer & 0xff) << 8);
cacheline_sz_reg |= ((tp->pci_hdr_type & 0xff) << 16);
cacheline_sz_reg |= ((tp->pci_bist & 0xff) << 24);
pci_write_config_dword(tp->pdev, TG3PCI_CACHELINESZ,
cacheline_sz_reg);
}
pci_read_config_dword(tp->pdev, TG3PCI_PCISTATE, pci_read_config_dword(tp->pdev, TG3PCI_PCISTATE,
&pci_state_reg); &pci_state_reg);
...@@ -5924,6 +5944,10 @@ static int __devinit tg3_test_dma(struct tg3 *tp) ...@@ -5924,6 +5944,10 @@ static int __devinit tg3_test_dma(struct tg3 *tp)
tw32(TG3PCI_DMA_RW_CTRL, tp->dma_rwctrl); tw32(TG3PCI_DMA_RW_CTRL, tp->dma_rwctrl);
if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5700 &&
GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5701)
return 0;
ret = 0; ret = 0;
while (1) { while (1) {
u32 *p, i; u32 *p, i;
......
...@@ -1654,7 +1654,7 @@ enum phy_led_mode { ...@@ -1654,7 +1654,7 @@ enum phy_led_mode {
*/ */
struct ring_info { struct ring_info {
struct sk_buff *skb; struct sk_buff *skb;
dma_addr_t mapping; DECLARE_PCI_UNMAP_ADDR(mapping)
}; };
struct tg3_config_info { struct tg3_config_info {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment