diff options
Diffstat (limited to 'drivers/net/ethernet/tehuti/tehuti.c')
-rw-r--r-- | drivers/net/ethernet/tehuti/tehuti.c | 70 |
1 files changed, 37 insertions, 33 deletions
diff --git a/drivers/net/ethernet/tehuti/tehuti.c b/drivers/net/ethernet/tehuti/tehuti.c index e28727297563..b8f4f419173f 100644 --- a/drivers/net/ethernet/tehuti/tehuti.c +++ b/drivers/net/ethernet/tehuti/tehuti.c @@ -138,7 +138,10 @@ static void print_eth_id(struct net_device *ndev) * @priv: NIC private structure * @f: fifo to initialize * @fsz_type: fifo size type: 0-4KB, 1-8KB, 2-16KB, 3-32KB - * @reg_XXX: offsets of registers relative to base address + * @reg_CFG0: offsets of registers relative to base address + * @reg_CFG1: offsets of registers relative to base address + * @reg_RPTR: offsets of registers relative to base address + * @reg_WPTR: offsets of registers relative to base address * * 1K extra space is allocated at the end of the fifo to simplify * processing of descriptors that wraps around fifo's end @@ -153,11 +156,11 @@ bdx_fifo_init(struct bdx_priv *priv, struct fifo *f, int fsz_type, u16 memsz = FIFO_SIZE * (1 << fsz_type); memset(f, 0, sizeof(struct fifo)); - /* pci_alloc_consistent gives us 4k-aligned memory */ - f->va = pci_alloc_consistent(priv->pdev, - memsz + FIFO_EXTRA_SPACE, &f->da); + /* dma_alloc_coherent gives us 4k-aligned memory */ + f->va = dma_alloc_coherent(&priv->pdev->dev, memsz + FIFO_EXTRA_SPACE, + &f->da, GFP_ATOMIC); if (!f->va) { - pr_err("pci_alloc_consistent failed\n"); + pr_err("dma_alloc_coherent failed\n"); RET(-ENOMEM); } f->reg_CFG0 = reg_CFG0; @@ -183,8 +186,8 @@ static void bdx_fifo_free(struct bdx_priv *priv, struct fifo *f) { ENTER; if (f->va) { - pci_free_consistent(priv->pdev, - f->memsz + FIFO_EXTRA_SPACE, f->va, f->da); + dma_free_coherent(&priv->pdev->dev, + f->memsz + FIFO_EXTRA_SPACE, f->va, f->da); f->va = NULL; } RET(); @@ -558,7 +561,7 @@ static int bdx_reset(struct bdx_priv *priv) /** * bdx_close - Disables a network interface - * @netdev: network interface device structure + * @ndev: network interface device structure * * Returns 0, this is not allowed to fail * @@ -585,7 +588,7 @@ static int bdx_close(struct net_device *ndev) /** * bdx_open - Called when a network interface is made active - * @netdev: network interface device structure + * @ndev: network interface device structure * * Returns 0 on success, negative value on failure * @@ -698,7 +701,7 @@ static int bdx_ioctl(struct net_device *ndev, struct ifreq *ifr, int cmd) * __bdx_vlan_rx_vid - private helper for adding/killing VLAN vid * @ndev: network device * @vid: VLAN vid - * @op: add or kill operation + * @enable: enable or disable vlan * * Passes VLAN filter table to hardware */ @@ -729,6 +732,7 @@ static void __bdx_vlan_rx_vid(struct net_device *ndev, uint16_t vid, int enable) /** * bdx_vlan_rx_add_vid - kernel hook for adding VLAN vid to hw filtering table * @ndev: network device + * @proto: unused * @vid: VLAN vid to add */ static int bdx_vlan_rx_add_vid(struct net_device *ndev, __be16 proto, u16 vid) @@ -740,6 +744,7 @@ static int bdx_vlan_rx_add_vid(struct net_device *ndev, __be16 proto, u16 vid) /** * bdx_vlan_rx_kill_vid - kernel hook for killing VLAN vid in hw filtering table * @ndev: network device + * @proto: unused * @vid: VLAN vid to kill */ static int bdx_vlan_rx_kill_vid(struct net_device *ndev, __be16 proto, u16 vid) @@ -750,7 +755,7 @@ static int bdx_vlan_rx_kill_vid(struct net_device *ndev, __be16 proto, u16 vid) /** * bdx_change_mtu - Change the Maximum Transfer Unit - * @netdev: network interface device structure + * @ndev: network interface device structure * @new_mtu: new value for maximum frame size * * Returns 0 on success, negative on failure @@ -1033,9 +1038,8 @@ static void bdx_rx_free_skbs(struct bdx_priv *priv, struct rxf_fifo *f) for (i = 0; i < db->nelem; i++) { dm = bdx_rxdb_addr_elem(db, i); if (dm->dma) { - pci_unmap_single(priv->pdev, - dm->dma, f->m.pktsz, - PCI_DMA_FROMDEVICE); + dma_unmap_single(&priv->pdev->dev, dm->dma, + f->m.pktsz, DMA_FROM_DEVICE); dev_kfree_skb(dm->skb); } } @@ -1097,9 +1101,8 @@ static void bdx_rx_alloc_skbs(struct bdx_priv *priv, struct rxf_fifo *f) idx = bdx_rxdb_alloc_elem(db); dm = bdx_rxdb_addr_elem(db, idx); - dm->dma = pci_map_single(priv->pdev, - skb->data, f->m.pktsz, - PCI_DMA_FROMDEVICE); + dm->dma = dma_map_single(&priv->pdev->dev, skb->data, + f->m.pktsz, DMA_FROM_DEVICE); dm->skb = skb; rxfd = (struct rxf_desc *)(f->m.va + f->m.wptr); rxfd->info = CPU_CHIP_SWAP32(0x10003); /* INFO=1 BC=3 */ @@ -1259,16 +1262,15 @@ static int bdx_rx_receive(struct bdx_priv *priv, struct rxd_fifo *f, int budget) (skb2 = netdev_alloc_skb(priv->ndev, len + NET_IP_ALIGN))) { skb_reserve(skb2, NET_IP_ALIGN); /*skb_put(skb2, len); */ - pci_dma_sync_single_for_cpu(priv->pdev, - dm->dma, rxf_fifo->m.pktsz, - PCI_DMA_FROMDEVICE); + dma_sync_single_for_cpu(&priv->pdev->dev, dm->dma, + rxf_fifo->m.pktsz, + DMA_FROM_DEVICE); memcpy(skb2->data, skb->data, len); bdx_recycle_skb(priv, rxdd); skb = skb2; } else { - pci_unmap_single(priv->pdev, - dm->dma, rxf_fifo->m.pktsz, - PCI_DMA_FROMDEVICE); + dma_unmap_single(&priv->pdev->dev, dm->dma, + rxf_fifo->m.pktsz, DMA_FROM_DEVICE); bdx_rxdb_free_elem(db, rxdd->va_lo); } @@ -1478,8 +1480,8 @@ bdx_tx_map_skb(struct bdx_priv *priv, struct sk_buff *skb, int i; db->wptr->len = skb_headlen(skb); - db->wptr->addr.dma = pci_map_single(priv->pdev, skb->data, - db->wptr->len, PCI_DMA_TODEVICE); + db->wptr->addr.dma = dma_map_single(&priv->pdev->dev, skb->data, + db->wptr->len, DMA_TO_DEVICE); pbl->len = CPU_CHIP_SWAP32(db->wptr->len); pbl->pa_lo = CPU_CHIP_SWAP32(L32_64(db->wptr->addr.dma)); pbl->pa_hi = CPU_CHIP_SWAP32(H32_64(db->wptr->addr.dma)); @@ -1716,8 +1718,8 @@ static void bdx_tx_cleanup(struct bdx_priv *priv) BDX_ASSERT(db->rptr->len == 0); do { BDX_ASSERT(db->rptr->addr.dma == 0); - pci_unmap_page(priv->pdev, db->rptr->addr.dma, - db->rptr->len, PCI_DMA_TODEVICE); + dma_unmap_page(&priv->pdev->dev, db->rptr->addr.dma, + db->rptr->len, DMA_TO_DEVICE); bdx_tx_db_inc_rptr(db); } while (db->rptr->len > 0); tx_level -= db->rptr->len; /* '-' koz len is negative */ @@ -1756,6 +1758,8 @@ static void bdx_tx_cleanup(struct bdx_priv *priv) /** * bdx_tx_free_skbs - frees all skbs from TXD fifo. + * @priv: NIC private structure + * * It gets called when OS stops this dev, eg upon "ifconfig down" or rmmod */ static void bdx_tx_free_skbs(struct bdx_priv *priv) @@ -1765,8 +1769,8 @@ static void bdx_tx_free_skbs(struct bdx_priv *priv) ENTER; while (db->rptr != db->wptr) { if (likely(db->rptr->len)) - pci_unmap_page(priv->pdev, db->rptr->addr.dma, - db->rptr->len, PCI_DMA_TODEVICE); + dma_unmap_page(&priv->pdev->dev, db->rptr->addr.dma, + db->rptr->len, DMA_TO_DEVICE); else dev_kfree_skb(db->rptr->addr.skb); bdx_tx_db_inc_rptr(db); @@ -1902,12 +1906,12 @@ bdx_probe(struct pci_dev *pdev, const struct pci_device_id *ent) if (err) /* it triggers interrupt, dunno why. */ goto err_pci; /* it's not a problem though */ - if (!(err = pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) && - !(err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)))) { + if (!(err = dma_set_mask(&pdev->dev, DMA_BIT_MASK(64))) && + !(err = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(64)))) { pci_using_dac = 1; } else { - if ((err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) || - (err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)))) { + if ((err = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32))) || + (err = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)))) { pr_err("No usable DMA configuration, aborting\n"); goto err_dma; } |