Lines Matching +full:mac +full:- +full:s

1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (C) 2006-2007 PA Semi, Inc
17 #include <asm/dma-mapping.h>
40 * - Multicast support
41 * - Large MTU support
42 * - Multiqueue RX/TX
63 static int debug = -1; /* -1 == use DEFAULT_MSG_ENABLE as value */
65 MODULE_PARM_DESC(debug, "PA Semi MAC bitmapped debugging message enable value");
83 static unsigned int read_mac_reg(const struct pasemi_mac *mac, unsigned int reg) in read_mac_reg() argument
85 return pasemi_read_mac_reg(mac->dma_if, reg); in read_mac_reg()
88 static void write_mac_reg(const struct pasemi_mac *mac, unsigned int reg, in write_mac_reg() argument
91 pasemi_write_mac_reg(mac->dma_if, reg, val); in write_mac_reg()
104 static struct pasemi_mac_rxring *rx_ring(const struct pasemi_mac *mac) in rx_ring() argument
106 return mac->rx; in rx_ring()
109 static struct pasemi_mac_txring *tx_ring(const struct pasemi_mac *mac) in tx_ring() argument
111 return mac->tx; in tx_ring()
124 static int mac_to_intf(struct pasemi_mac *mac) in mac_to_intf() argument
126 struct pci_dev *pdev = mac->pdev; in mac_to_intf()
129 int devfn = pdev->devfn; in mac_to_intf()
136 * DMA interface-to-MAC-pci-id mappings, and NIN contains number in mac_to_intf()
138 * Just do a linear search until we find the devfn of the MAC in mac_to_intf()
149 return -1; in mac_to_intf()
152 static void pasemi_mac_intf_disable(struct pasemi_mac *mac) in pasemi_mac_intf_disable() argument
156 flags = read_mac_reg(mac, PAS_MAC_CFG_PCFG); in pasemi_mac_intf_disable()
158 write_mac_reg(mac, PAS_MAC_CFG_PCFG, flags); in pasemi_mac_intf_disable()
161 static void pasemi_mac_intf_enable(struct pasemi_mac *mac) in pasemi_mac_intf_enable() argument
165 flags = read_mac_reg(mac, PAS_MAC_CFG_PCFG); in pasemi_mac_intf_enable()
167 write_mac_reg(mac, PAS_MAC_CFG_PCFG, flags); in pasemi_mac_intf_enable()
170 static int pasemi_get_mac_addr(struct pasemi_mac *mac) in pasemi_get_mac_addr() argument
172 struct pci_dev *pdev = mac->pdev; in pasemi_get_mac_addr()
179 dev_dbg(&pdev->dev, in pasemi_get_mac_addr()
180 "No device node for mac, not configuring\n"); in pasemi_get_mac_addr()
181 return -ENOENT; in pasemi_get_mac_addr()
184 maddr = of_get_property(dn, "local-mac-address", &len); in pasemi_get_mac_addr()
187 memcpy(mac->mac_addr, maddr, ETH_ALEN); in pasemi_get_mac_addr()
191 /* Some old versions of firmware mistakenly uses mac-address in pasemi_get_mac_addr()
192 * (and as a string) instead of a byte array in local-mac-address. in pasemi_get_mac_addr()
196 maddr = of_get_property(dn, "mac-address", NULL); in pasemi_get_mac_addr()
199 dev_warn(&pdev->dev, in pasemi_get_mac_addr()
200 "no mac address in device tree, not configuring\n"); in pasemi_get_mac_addr()
201 return -ENOENT; in pasemi_get_mac_addr()
205 dev_warn(&pdev->dev, in pasemi_get_mac_addr()
206 "can't parse mac address, not configuring\n"); in pasemi_get_mac_addr()
207 return -EINVAL; in pasemi_get_mac_addr()
210 memcpy(mac->mac_addr, addr, ETH_ALEN); in pasemi_get_mac_addr()
217 struct pasemi_mac *mac = netdev_priv(dev); in pasemi_mac_set_mac_addr() local
221 if (!is_valid_ether_addr(addr->sa_data)) in pasemi_mac_set_mac_addr()
222 return -EADDRNOTAVAIL; in pasemi_mac_set_mac_addr()
224 eth_hw_addr_set(dev, addr->sa_data); in pasemi_mac_set_mac_addr()
226 adr0 = dev->dev_addr[2] << 24 | in pasemi_mac_set_mac_addr()
227 dev->dev_addr[3] << 16 | in pasemi_mac_set_mac_addr()
228 dev->dev_addr[4] << 8 | in pasemi_mac_set_mac_addr()
229 dev->dev_addr[5]; in pasemi_mac_set_mac_addr()
230 adr1 = read_mac_reg(mac, PAS_MAC_CFG_ADR1); in pasemi_mac_set_mac_addr()
232 adr1 |= dev->dev_addr[0] << 8 | dev->dev_addr[1]; in pasemi_mac_set_mac_addr()
234 pasemi_mac_intf_disable(mac); in pasemi_mac_set_mac_addr()
235 write_mac_reg(mac, PAS_MAC_CFG_ADR0, adr0); in pasemi_mac_set_mac_addr()
236 write_mac_reg(mac, PAS_MAC_CFG_ADR1, adr1); in pasemi_mac_set_mac_addr()
237 pasemi_mac_intf_enable(mac); in pasemi_mac_set_mac_addr()
242 static int pasemi_mac_unmap_tx_skb(struct pasemi_mac *mac, in pasemi_mac_unmap_tx_skb() argument
248 struct pci_dev *pdev = mac->dma_pdev; in pasemi_mac_unmap_tx_skb()
250 dma_unmap_single(&pdev->dev, dmas[0], skb_headlen(skb), DMA_TO_DEVICE); in pasemi_mac_unmap_tx_skb()
253 const skb_frag_t *frag = &skb_shinfo(skb)->frags[f]; in pasemi_mac_unmap_tx_skb()
255 dma_unmap_page(&pdev->dev, dmas[f + 1], skb_frag_size(frag), in pasemi_mac_unmap_tx_skb()
266 static struct pasemi_mac_csring *pasemi_mac_setup_csring(struct pasemi_mac *mac) in pasemi_mac_setup_csring() argument
277 dev_err(&mac->pdev->dev, "Can't allocate checksum channel\n"); in pasemi_mac_setup_csring()
281 chno = ring->chan.chno; in pasemi_mac_setup_csring()
283 ring->size = CS_RING_SIZE; in pasemi_mac_setup_csring()
284 ring->next_to_fill = 0; in pasemi_mac_setup_csring()
287 if (pasemi_dma_alloc_ring(&ring->chan, CS_RING_SIZE)) in pasemi_mac_setup_csring()
291 PAS_DMA_TXCHAN_BASEL_BRBL(ring->chan.ring_dma)); in pasemi_mac_setup_csring()
292 val = PAS_DMA_TXCHAN_BASEU_BRBH(ring->chan.ring_dma >> 32); in pasemi_mac_setup_csring()
297 ring->events[0] = pasemi_dma_alloc_flag(); in pasemi_mac_setup_csring()
298 ring->events[1] = pasemi_dma_alloc_flag(); in pasemi_mac_setup_csring()
299 if (ring->events[0] < 0 || ring->events[1] < 0) in pasemi_mac_setup_csring()
302 pasemi_dma_clear_flag(ring->events[0]); in pasemi_mac_setup_csring()
303 pasemi_dma_clear_flag(ring->events[1]); in pasemi_mac_setup_csring()
305 ring->fun = pasemi_dma_alloc_fun(); in pasemi_mac_setup_csring()
306 if (ring->fun < 0) in pasemi_mac_setup_csring()
310 PAS_DMA_TXCHAN_CFG_TATTR(ring->fun) | in pasemi_mac_setup_csring()
319 pasemi_dma_start_chan(&ring->chan, PAS_DMA_TXCHAN_TCMDSTA_SZ | in pasemi_mac_setup_csring()
328 if (ring->events[0] >= 0) in pasemi_mac_setup_csring()
329 pasemi_dma_free_flag(ring->events[0]); in pasemi_mac_setup_csring()
330 if (ring->events[1] >= 0) in pasemi_mac_setup_csring()
331 pasemi_dma_free_flag(ring->events[1]); in pasemi_mac_setup_csring()
332 pasemi_dma_free_ring(&ring->chan); in pasemi_mac_setup_csring()
334 pasemi_dma_free_chan(&ring->chan); in pasemi_mac_setup_csring()
340 static void pasemi_mac_setup_csrings(struct pasemi_mac *mac) in pasemi_mac_setup_csrings() argument
343 mac->cs[0] = pasemi_mac_setup_csring(mac); in pasemi_mac_setup_csrings()
344 if (mac->type == MAC_TYPE_XAUI) in pasemi_mac_setup_csrings()
345 mac->cs[1] = pasemi_mac_setup_csring(mac); in pasemi_mac_setup_csrings()
347 mac->cs[1] = 0; in pasemi_mac_setup_csrings()
350 if (mac->cs[i]) in pasemi_mac_setup_csrings()
351 mac->num_cs++; in pasemi_mac_setup_csrings()
356 pasemi_dma_stop_chan(&csring->chan); in pasemi_mac_free_csring()
357 pasemi_dma_free_flag(csring->events[0]); in pasemi_mac_free_csring()
358 pasemi_dma_free_flag(csring->events[1]); in pasemi_mac_free_csring()
359 pasemi_dma_free_ring(&csring->chan); in pasemi_mac_free_csring()
360 pasemi_dma_free_chan(&csring->chan); in pasemi_mac_free_csring()
361 pasemi_dma_free_fun(csring->fun); in pasemi_mac_free_csring()
367 struct pasemi_mac *mac = netdev_priv(dev); in pasemi_mac_setup_rx_resources() local
375 dev_err(&mac->pdev->dev, "Can't allocate RX channel\n"); in pasemi_mac_setup_rx_resources()
378 chno = ring->chan.chno; in pasemi_mac_setup_rx_resources()
380 spin_lock_init(&ring->lock); in pasemi_mac_setup_rx_resources()
382 ring->size = RX_RING_SIZE; in pasemi_mac_setup_rx_resources()
383 ring->ring_info = kcalloc(RX_RING_SIZE, in pasemi_mac_setup_rx_resources()
387 if (!ring->ring_info) in pasemi_mac_setup_rx_resources()
391 if (pasemi_dma_alloc_ring(&ring->chan, RX_RING_SIZE)) in pasemi_mac_setup_rx_resources()
394 ring->buffers = dma_alloc_coherent(&mac->dma_pdev->dev, in pasemi_mac_setup_rx_resources()
396 &ring->buf_dma, GFP_KERNEL); in pasemi_mac_setup_rx_resources()
397 if (!ring->buffers) in pasemi_mac_setup_rx_resources()
401 PAS_DMA_RXCHAN_BASEL_BRBL(ring->chan.ring_dma)); in pasemi_mac_setup_rx_resources()
404 PAS_DMA_RXCHAN_BASEU_BRBH(ring->chan.ring_dma >> 32) | in pasemi_mac_setup_rx_resources()
414 write_dma_reg(PAS_DMA_RXINT_BASEL(mac->dma_if), in pasemi_mac_setup_rx_resources()
415 PAS_DMA_RXINT_BASEL_BRBL(ring->buf_dma)); in pasemi_mac_setup_rx_resources()
417 write_dma_reg(PAS_DMA_RXINT_BASEU(mac->dma_if), in pasemi_mac_setup_rx_resources()
418 PAS_DMA_RXINT_BASEU_BRBH(ring->buf_dma >> 32) | in pasemi_mac_setup_rx_resources()
428 write_dma_reg(PAS_DMA_RXINT_CFG(mac->dma_if), cfg); in pasemi_mac_setup_rx_resources()
430 ring->next_to_fill = 0; in pasemi_mac_setup_rx_resources()
431 ring->next_to_clean = 0; in pasemi_mac_setup_rx_resources()
432 ring->mac = mac; in pasemi_mac_setup_rx_resources()
433 mac->rx = ring; in pasemi_mac_setup_rx_resources()
438 kfree(ring->ring_info); in pasemi_mac_setup_rx_resources()
440 pasemi_dma_free_chan(&ring->chan); in pasemi_mac_setup_rx_resources()
442 return -ENOMEM; in pasemi_mac_setup_rx_resources()
448 struct pasemi_mac *mac = netdev_priv(dev); in pasemi_mac_setup_tx_resources() local
458 dev_err(&mac->pdev->dev, "Can't allocate TX channel\n"); in pasemi_mac_setup_tx_resources()
462 chno = ring->chan.chno; in pasemi_mac_setup_tx_resources()
464 spin_lock_init(&ring->lock); in pasemi_mac_setup_tx_resources()
466 ring->size = TX_RING_SIZE; in pasemi_mac_setup_tx_resources()
467 ring->ring_info = kcalloc(TX_RING_SIZE, in pasemi_mac_setup_tx_resources()
470 if (!ring->ring_info) in pasemi_mac_setup_tx_resources()
474 if (pasemi_dma_alloc_ring(&ring->chan, TX_RING_SIZE)) in pasemi_mac_setup_tx_resources()
478 PAS_DMA_TXCHAN_BASEL_BRBL(ring->chan.ring_dma)); in pasemi_mac_setup_tx_resources()
479 val = PAS_DMA_TXCHAN_BASEU_BRBH(ring->chan.ring_dma >> 32); in pasemi_mac_setup_tx_resources()
485 PAS_DMA_TXCHAN_CFG_TATTR(mac->dma_if) | in pasemi_mac_setup_tx_resources()
494 ring->next_to_fill = 0; in pasemi_mac_setup_tx_resources()
495 ring->next_to_clean = 0; in pasemi_mac_setup_tx_resources()
496 ring->mac = mac; in pasemi_mac_setup_tx_resources()
501 kfree(ring->ring_info); in pasemi_mac_setup_tx_resources()
503 pasemi_dma_free_chan(&ring->chan); in pasemi_mac_setup_tx_resources()
508 static void pasemi_mac_free_tx_resources(struct pasemi_mac *mac) in pasemi_mac_free_tx_resources() argument
510 struct pasemi_mac_txring *txring = tx_ring(mac); in pasemi_mac_free_tx_resources()
517 start = txring->next_to_clean; in pasemi_mac_free_tx_resources()
518 limit = txring->next_to_fill; in pasemi_mac_free_tx_resources()
525 info = &txring->ring_info[(i+1) & (TX_RING_SIZE-1)]; in pasemi_mac_free_tx_resources()
526 if (info->dma && info->skb) { in pasemi_mac_free_tx_resources()
527 nfrags = skb_shinfo(info->skb)->nr_frags; in pasemi_mac_free_tx_resources()
529 dmas[j] = txring->ring_info[(i+1+j) & in pasemi_mac_free_tx_resources()
530 (TX_RING_SIZE-1)].dma; in pasemi_mac_free_tx_resources()
531 freed = pasemi_mac_unmap_tx_skb(mac, nfrags, in pasemi_mac_free_tx_resources()
532 info->skb, dmas); in pasemi_mac_free_tx_resources()
538 kfree(txring->ring_info); in pasemi_mac_free_tx_resources()
539 pasemi_dma_free_chan(&txring->chan); in pasemi_mac_free_tx_resources()
543 static void pasemi_mac_free_rx_buffers(struct pasemi_mac *mac) in pasemi_mac_free_rx_buffers() argument
545 struct pasemi_mac_rxring *rx = rx_ring(mac); in pasemi_mac_free_rx_buffers()
551 if (info->skb && info->dma) { in pasemi_mac_free_rx_buffers()
552 dma_unmap_single(&mac->dma_pdev->dev, info->dma, in pasemi_mac_free_rx_buffers()
553 info->skb->len, DMA_FROM_DEVICE); in pasemi_mac_free_rx_buffers()
554 dev_kfree_skb_any(info->skb); in pasemi_mac_free_rx_buffers()
556 info->dma = 0; in pasemi_mac_free_rx_buffers()
557 info->skb = NULL; in pasemi_mac_free_rx_buffers()
564 static void pasemi_mac_free_rx_resources(struct pasemi_mac *mac) in pasemi_mac_free_rx_resources() argument
566 pasemi_mac_free_rx_buffers(mac); in pasemi_mac_free_rx_resources()
568 dma_free_coherent(&mac->dma_pdev->dev, RX_RING_SIZE * sizeof(u64), in pasemi_mac_free_rx_resources()
569 rx_ring(mac)->buffers, rx_ring(mac)->buf_dma); in pasemi_mac_free_rx_resources()
571 kfree(rx_ring(mac)->ring_info); in pasemi_mac_free_rx_resources()
572 pasemi_dma_free_chan(&rx_ring(mac)->chan); in pasemi_mac_free_rx_resources()
573 mac->rx = NULL; in pasemi_mac_free_rx_resources()
579 const struct pasemi_mac *mac = netdev_priv(dev); in pasemi_mac_replenish_rx_ring() local
580 struct pasemi_mac_rxring *rx = rx_ring(mac); in pasemi_mac_replenish_rx_ring()
586 fill = rx_ring(mac)->next_to_fill; in pasemi_mac_replenish_rx_ring()
596 skb = netdev_alloc_skb(dev, mac->bufsz); in pasemi_mac_replenish_rx_ring()
602 dma = dma_map_single(&mac->dma_pdev->dev, skb->data, in pasemi_mac_replenish_rx_ring()
603 mac->bufsz - LOCAL_SKB_ALIGN, in pasemi_mac_replenish_rx_ring()
606 if (dma_mapping_error(&mac->dma_pdev->dev, dma)) { in pasemi_mac_replenish_rx_ring()
607 dev_kfree_skb_irq(info->skb); in pasemi_mac_replenish_rx_ring()
611 info->skb = skb; in pasemi_mac_replenish_rx_ring()
612 info->dma = dma; in pasemi_mac_replenish_rx_ring()
613 *buff = XCT_RXB_LEN(mac->bufsz) | XCT_RXB_ADDR(dma); in pasemi_mac_replenish_rx_ring()
619 write_dma_reg(PAS_DMA_RXINT_INCR(mac->dma_if), count); in pasemi_mac_replenish_rx_ring()
621 rx_ring(mac)->next_to_fill = (rx_ring(mac)->next_to_fill + count) & in pasemi_mac_replenish_rx_ring()
622 (RX_RING_SIZE - 1); in pasemi_mac_replenish_rx_ring()
625 static void pasemi_mac_restart_rx_intr(const struct pasemi_mac *mac) in pasemi_mac_restart_rx_intr() argument
627 struct pasemi_mac_rxring *rx = rx_ring(mac); in pasemi_mac_restart_rx_intr()
629 /* Re-enable packet count interrupts: finally in pasemi_mac_restart_rx_intr()
633 pcnt = *rx->chan.status & PAS_STATUS_PCNT_M; in pasemi_mac_restart_rx_intr()
637 if (*rx->chan.status & PAS_STATUS_TIMER) in pasemi_mac_restart_rx_intr()
640 write_iob_reg(PAS_IOB_DMA_RXCH_RESET(mac->rx->chan.chno), reg); in pasemi_mac_restart_rx_intr()
643 static void pasemi_mac_restart_tx_intr(const struct pasemi_mac *mac) in pasemi_mac_restart_tx_intr() argument
647 /* Re-enable packet count interrupts */ in pasemi_mac_restart_tx_intr()
648 pcnt = *tx_ring(mac)->chan.status & PAS_STATUS_PCNT_M; in pasemi_mac_restart_tx_intr()
652 write_iob_reg(PAS_IOB_DMA_TXCH_RESET(tx_ring(mac)->chan.chno), reg); in pasemi_mac_restart_tx_intr()
656 static inline void pasemi_mac_rx_error(const struct pasemi_mac *mac, in pasemi_mac_rx_error() argument
660 struct pasemi_dmachan *chan = &rx_ring(mac)->chan; in pasemi_mac_rx_error()
662 if (!netif_msg_rx_err(mac)) in pasemi_mac_rx_error()
665 rcmdsta = read_dma_reg(PAS_DMA_RXINT_RCMDSTA(mac->dma_if)); in pasemi_mac_rx_error()
666 ccmdsta = read_dma_reg(PAS_DMA_RXCHAN_CCMDSTA(chan->chno)); in pasemi_mac_rx_error()
669 macrx, *chan->status); in pasemi_mac_rx_error()
675 static inline void pasemi_mac_tx_error(const struct pasemi_mac *mac, in pasemi_mac_tx_error() argument
679 struct pasemi_dmachan *chan = &tx_ring(mac)->chan; in pasemi_mac_tx_error()
681 if (!netif_msg_tx_err(mac)) in pasemi_mac_tx_error()
684 cmdsta = read_dma_reg(PAS_DMA_TXCHAN_TCMDSTA(chan->chno)); in pasemi_mac_tx_error()
687 "tx status 0x%016llx\n", mactx, *chan->status); in pasemi_mac_tx_error()
695 const struct pasemi_dmachan *chan = &rx->chan; in pasemi_mac_clean_rx()
696 struct pasemi_mac *mac = rx->mac; in pasemi_mac_clean_rx() local
697 struct pci_dev *pdev = mac->dma_pdev; in pasemi_mac_clean_rx()
709 spin_lock(&rx->lock); in pasemi_mac_clean_rx()
711 n = rx->next_to_clean; in pasemi_mac_clean_rx()
720 (*chan->status & PAS_STATUS_ERROR)) in pasemi_mac_clean_rx()
721 pasemi_mac_rx_error(mac, macrx); in pasemi_mac_clean_rx()
732 buf_index = eval-1; in pasemi_mac_clean_rx()
737 skb = info->skb; in pasemi_mac_clean_rx()
743 dma_unmap_single(&pdev->dev, dma, in pasemi_mac_clean_rx()
744 mac->bufsz - LOCAL_SKB_ALIGN, in pasemi_mac_clean_rx()
749 mac->netdev->stats.rx_errors++; in pasemi_mac_clean_rx()
750 mac->netdev->stats.rx_crc_errors++; in pasemi_mac_clean_rx()
755 info->skb = NULL; in pasemi_mac_clean_rx()
756 info->dma = 0; in pasemi_mac_clean_rx()
759 skb->ip_summed = CHECKSUM_UNNECESSARY; in pasemi_mac_clean_rx()
760 skb->csum = (macrx & XCT_MACRX_CSUM_M) >> in pasemi_mac_clean_rx()
770 skb_put(skb, len-4); in pasemi_mac_clean_rx()
772 skb->protocol = eth_type_trans(skb, mac->netdev); in pasemi_mac_clean_rx()
773 napi_gro_receive(&mac->napi, skb); in pasemi_mac_clean_rx()
780 * replenish loop uses it to tell when it's done. in pasemi_mac_clean_rx()
790 n &= (RX_RING_SIZE-1); in pasemi_mac_clean_rx()
793 rx_ring(mac)->next_to_clean = n; in pasemi_mac_clean_rx()
795 /* Increase is in number of 16-byte entries, and since each descriptor in pasemi_mac_clean_rx()
799 write_dma_reg(PAS_DMA_RXCHAN_INCR(mac->rx->chan.chno), count << 1); in pasemi_mac_clean_rx()
801 pasemi_mac_replenish_rx_ring(mac->netdev, count); in pasemi_mac_clean_rx()
803 mac->netdev->stats.rx_bytes += tot_bytes; in pasemi_mac_clean_rx()
804 mac->netdev->stats.rx_packets += packets; in pasemi_mac_clean_rx()
806 spin_unlock(&rx_ring(mac)->lock); in pasemi_mac_clean_rx()
816 struct pasemi_dmachan *chan = &txring->chan; in pasemi_mac_clean_tx()
817 struct pasemi_mac *mac = txring->mac; in pasemi_mac_clean_tx() local
831 spin_lock_irqsave(&txring->lock, flags); in pasemi_mac_clean_tx()
833 start = txring->next_to_clean; in pasemi_mac_clean_tx()
834 ring_limit = txring->next_to_fill; in pasemi_mac_clean_tx()
852 (*chan->status & PAS_STATUS_ERROR)) in pasemi_mac_clean_tx()
853 pasemi_mac_tx_error(mac, mactx); in pasemi_mac_clean_tx()
888 txring->next_to_clean = i & (TX_RING_SIZE-1); in pasemi_mac_clean_tx()
890 spin_unlock_irqrestore(&txring->lock, flags); in pasemi_mac_clean_tx()
891 netif_wake_queue(mac->netdev); in pasemi_mac_clean_tx()
894 pasemi_mac_unmap_tx_skb(mac, nf[i], skbs[i], dmas[i]); in pasemi_mac_clean_tx()
909 struct pasemi_mac *mac = rxring->mac; in pasemi_mac_rx_intr() local
910 const struct pasemi_dmachan *chan = &rxring->chan; in pasemi_mac_rx_intr()
913 if (!(*chan->status & PAS_STATUS_CAUSE_M)) in pasemi_mac_rx_intr()
921 if (*chan->status & PAS_STATUS_SOFT) in pasemi_mac_rx_intr()
923 if (*chan->status & PAS_STATUS_ERROR) in pasemi_mac_rx_intr()
926 napi_schedule(&mac->napi); in pasemi_mac_rx_intr()
928 write_iob_reg(PAS_IOB_DMA_RXCH_RESET(chan->chno), reg); in pasemi_mac_rx_intr()
938 struct pasemi_mac *mac = txring->mac; in pasemi_mac_tx_timer() local
942 mod_timer(&txring->clean_timer, jiffies + TX_CLEAN_INTERVAL); in pasemi_mac_tx_timer()
944 pasemi_mac_restart_tx_intr(mac); in pasemi_mac_tx_timer()
950 const struct pasemi_dmachan *chan = &txring->chan; in pasemi_mac_tx_intr()
951 struct pasemi_mac *mac = txring->mac; in pasemi_mac_tx_intr() local
954 if (!(*chan->status & PAS_STATUS_CAUSE_M)) in pasemi_mac_tx_intr()
959 if (*chan->status & PAS_STATUS_SOFT) in pasemi_mac_tx_intr()
961 if (*chan->status & PAS_STATUS_ERROR) in pasemi_mac_tx_intr()
964 mod_timer(&txring->clean_timer, jiffies + (TX_CLEAN_INTERVAL)*2); in pasemi_mac_tx_intr()
966 napi_schedule(&mac->napi); in pasemi_mac_tx_intr()
969 write_iob_reg(PAS_IOB_DMA_TXCH_RESET(chan->chno), reg); in pasemi_mac_tx_intr()
976 struct pasemi_mac *mac = netdev_priv(dev); in pasemi_adjust_link() local
981 if (!dev->phydev->link) { in pasemi_adjust_link()
982 /* If no link, MAC speed settings don't matter. Just report in pasemi_adjust_link()
985 if (mac->link && netif_msg_link(mac)) in pasemi_adjust_link()
986 printk(KERN_INFO "%s: Link is down.\n", dev->name); in pasemi_adjust_link()
989 pasemi_mac_intf_disable(mac); in pasemi_adjust_link()
990 mac->link = 0; in pasemi_adjust_link()
994 pasemi_mac_intf_enable(mac); in pasemi_adjust_link()
998 flags = read_mac_reg(mac, PAS_MAC_CFG_PCFG); in pasemi_adjust_link()
1002 if (!dev->phydev->duplex) in pasemi_adjust_link()
1005 switch (dev->phydev->speed) { in pasemi_adjust_link()
1019 printk("Unsupported speed %d\n", dev->phydev->speed); in pasemi_adjust_link()
1023 msg = mac->link != dev->phydev->link || flags != new_flags; in pasemi_adjust_link()
1025 mac->duplex = dev->phydev->duplex; in pasemi_adjust_link()
1026 mac->speed = dev->phydev->speed; in pasemi_adjust_link()
1027 mac->link = dev->phydev->link; in pasemi_adjust_link()
1030 write_mac_reg(mac, PAS_MAC_CFG_PCFG, new_flags); in pasemi_adjust_link()
1032 if (msg && netif_msg_link(mac)) in pasemi_adjust_link()
1033 printk(KERN_INFO "%s: Link is up at %d Mbps, %s duplex.\n", in pasemi_adjust_link()
1034 dev->name, mac->speed, mac->duplex ? "full" : "half"); in pasemi_adjust_link()
1039 struct pasemi_mac *mac = netdev_priv(dev); in pasemi_mac_phy_init() local
1043 dn = pci_device_to_OF_node(mac->pdev); in pasemi_mac_phy_init()
1044 phy_dn = of_parse_phandle(dn, "phy-handle", 0); in pasemi_mac_phy_init()
1046 mac->link = 0; in pasemi_mac_phy_init()
1047 mac->speed = 0; in pasemi_mac_phy_init()
1048 mac->duplex = -1; in pasemi_mac_phy_init()
1055 printk(KERN_ERR "%s: Could not attach to phy\n", dev->name); in pasemi_mac_phy_init()
1056 return -ENODEV; in pasemi_mac_phy_init()
1065 struct pasemi_mac *mac = netdev_priv(dev); in pasemi_mac_open() local
1073 write_mac_reg(mac, PAS_MAC_CFG_TXP, flags); in pasemi_mac_open()
1079 mac->tx = pasemi_mac_setup_tx_resources(dev); in pasemi_mac_open()
1081 if (!mac->tx) { in pasemi_mac_open()
1082 ret = -ENOMEM; in pasemi_mac_open()
1089 if (dev->mtu > 1500 && !mac->num_cs) { in pasemi_mac_open()
1090 pasemi_mac_setup_csrings(mac); in pasemi_mac_open()
1091 if (!mac->num_cs) { in pasemi_mac_open()
1092 ret = -ENOMEM; in pasemi_mac_open()
1099 write_mac_reg(mac, PAS_MAC_RMON(i), 0); in pasemi_mac_open()
1105 write_iob_reg(PAS_IOB_DMA_RXCH_CFG(mac->rx->chan.chno), in pasemi_mac_open()
1108 write_iob_reg(PAS_IOB_DMA_TXCH_CFG(mac->tx->chan.chno), in pasemi_mac_open()
1111 write_mac_reg(mac, PAS_MAC_IPC_CHNL, in pasemi_mac_open()
1112 PAS_MAC_IPC_CHNL_DCHNO(mac->rx->chan.chno) | in pasemi_mac_open()
1113 PAS_MAC_IPC_CHNL_BCH(mac->rx->chan.chno)); in pasemi_mac_open()
1116 write_dma_reg(PAS_DMA_RXINT_RCMDSTA(mac->dma_if), in pasemi_mac_open()
1124 pasemi_dma_start_chan(&rx_ring(mac)->chan, PAS_DMA_RXCHAN_CCMDSTA_DU | in pasemi_mac_open()
1130 pasemi_dma_start_chan(&tx_ring(mac)->chan, PAS_DMA_TXCHAN_TCMDSTA_SZ | in pasemi_mac_open()
1137 write_dma_reg(PAS_DMA_RXCHAN_INCR(rx_ring(mac)->chan.chno), in pasemi_mac_open()
1141 pasemi_mac_restart_rx_intr(mac); in pasemi_mac_open()
1142 pasemi_mac_restart_tx_intr(mac); in pasemi_mac_open()
1146 if (mac->type == MAC_TYPE_GMAC) in pasemi_mac_open()
1151 /* Enable interface in MAC */ in pasemi_mac_open()
1152 write_mac_reg(mac, PAS_MAC_CFG_PCFG, flags); in pasemi_mac_open()
1157 pasemi_mac_intf_enable(mac); in pasemi_mac_open()
1158 if (mac->type == MAC_TYPE_GMAC) { in pasemi_mac_open()
1160 dev_warn(&mac->pdev->dev, in pasemi_mac_open()
1162 dev_warn(&mac->pdev->dev, in pasemi_mac_open()
1168 napi_enable(&mac->napi); in pasemi_mac_open()
1170 snprintf(mac->tx_irq_name, sizeof(mac->tx_irq_name), "%s tx", in pasemi_mac_open()
1171 dev->name); in pasemi_mac_open()
1173 ret = request_irq(mac->tx->chan.irq, pasemi_mac_tx_intr, 0, in pasemi_mac_open()
1174 mac->tx_irq_name, mac->tx); in pasemi_mac_open()
1176 dev_err(&mac->pdev->dev, "request_irq of irq %d failed: %d\n", in pasemi_mac_open()
1177 mac->tx->chan.irq, ret); in pasemi_mac_open()
1181 snprintf(mac->rx_irq_name, sizeof(mac->rx_irq_name), "%s rx", in pasemi_mac_open()
1182 dev->name); in pasemi_mac_open()
1184 ret = request_irq(mac->rx->chan.irq, pasemi_mac_rx_intr, 0, in pasemi_mac_open()
1185 mac->rx_irq_name, mac->rx); in pasemi_mac_open()
1187 dev_err(&mac->pdev->dev, "request_irq of irq %d failed: %d\n", in pasemi_mac_open()
1188 mac->rx->chan.irq, ret); in pasemi_mac_open()
1192 if (dev->phydev) in pasemi_mac_open()
1193 phy_start(dev->phydev); in pasemi_mac_open()
1195 timer_setup(&mac->tx->clean_timer, pasemi_mac_tx_timer, 0); in pasemi_mac_open()
1196 mod_timer(&mac->tx->clean_timer, jiffies + HZ); in pasemi_mac_open()
1201 free_irq(mac->tx->chan.irq, mac->tx); in pasemi_mac_open()
1203 napi_disable(&mac->napi); in pasemi_mac_open()
1206 if (mac->tx) in pasemi_mac_open()
1207 pasemi_mac_free_tx_resources(mac); in pasemi_mac_open()
1208 pasemi_mac_free_rx_resources(mac); in pasemi_mac_open()
1216 static void pasemi_mac_pause_txchan(struct pasemi_mac *mac) in pasemi_mac_pause_txchan() argument
1219 int txch = tx_ring(mac)->chan.chno; in pasemi_mac_pause_txchan()
1232 dev_err(&mac->dma_pdev->dev, in pasemi_mac_pause_txchan()
1238 static void pasemi_mac_pause_rxchan(struct pasemi_mac *mac) in pasemi_mac_pause_rxchan() argument
1241 int rxch = rx_ring(mac)->chan.chno; in pasemi_mac_pause_rxchan()
1253 dev_err(&mac->dma_pdev->dev, in pasemi_mac_pause_rxchan()
1258 static void pasemi_mac_pause_rxint(struct pasemi_mac *mac) in pasemi_mac_pause_rxint() argument
1262 write_dma_reg(PAS_DMA_RXINT_RCMDSTA(mac->dma_if), in pasemi_mac_pause_rxint()
1265 sta = read_dma_reg(PAS_DMA_RXINT_RCMDSTA(mac->dma_if)); in pasemi_mac_pause_rxint()
1272 dev_err(&mac->dma_pdev->dev, in pasemi_mac_pause_rxint()
1274 write_dma_reg(PAS_DMA_RXINT_RCMDSTA(mac->dma_if), 0); in pasemi_mac_pause_rxint()
1279 struct pasemi_mac *mac = netdev_priv(dev); in pasemi_mac_close() local
1283 rxch = rx_ring(mac)->chan.chno; in pasemi_mac_close()
1284 txch = tx_ring(mac)->chan.chno; in pasemi_mac_close()
1286 if (dev->phydev) { in pasemi_mac_close()
1287 phy_stop(dev->phydev); in pasemi_mac_close()
1288 phy_disconnect(dev->phydev); in pasemi_mac_close()
1291 del_timer_sync(&mac->tx->clean_timer); in pasemi_mac_close()
1294 napi_disable(&mac->napi); in pasemi_mac_close()
1296 sta = read_dma_reg(PAS_DMA_RXINT_RCMDSTA(mac->dma_if)); in pasemi_mac_close()
1315 pasemi_mac_clean_tx(tx_ring(mac)); in pasemi_mac_close()
1316 pasemi_mac_clean_rx(rx_ring(mac), RX_RING_SIZE); in pasemi_mac_close()
1318 pasemi_mac_pause_txchan(mac); in pasemi_mac_close()
1319 pasemi_mac_pause_rxint(mac); in pasemi_mac_close()
1320 pasemi_mac_pause_rxchan(mac); in pasemi_mac_close()
1321 pasemi_mac_intf_disable(mac); in pasemi_mac_close()
1323 free_irq(mac->tx->chan.irq, mac->tx); in pasemi_mac_close()
1324 free_irq(mac->rx->chan.irq, mac->rx); in pasemi_mac_close()
1326 for (i = 0; i < mac->num_cs; i++) { in pasemi_mac_close()
1327 pasemi_mac_free_csring(mac->cs[i]); in pasemi_mac_close()
1328 mac->cs[i] = NULL; in pasemi_mac_close()
1331 mac->num_cs = 0; in pasemi_mac_close()
1334 pasemi_mac_free_rx_resources(mac); in pasemi_mac_close()
1335 pasemi_mac_free_tx_resources(mac); in pasemi_mac_close()
1350 const int nfrags = skb_shinfo(skb)->nr_frags; in pasemi_mac_queue_csdesc()
1355 XCT_FUN_O | XCT_FUN_FUN(csring->fun) | in pasemi_mac_queue_csdesc()
1356 XCT_FUN_CRM_SIG | XCT_FUN_LLEN(skb->len - nh_off) | in pasemi_mac_queue_csdesc()
1359 switch (ip_hdr(skb)->protocol) { in pasemi_mac_queue_csdesc()
1375 fill = csring->next_to_fill; in pasemi_mac_queue_csdesc()
1380 csdma = csring->chan.ring_dma + (fill & (CS_RING_SIZE-1)) * 8 + 2; in pasemi_mac_queue_csdesc()
1383 CS_DESC(csring, fill) = XCT_PTR_LEN(map_size[0]-nh_off) | XCT_PTR_ADDR(map[0]+nh_off); in pasemi_mac_queue_csdesc()
1392 CS_DESC(csring, fill++) = XCT_FUN_O | XCT_FUN_FUN(csring->fun) | in pasemi_mac_queue_csdesc()
1398 evt = !csring->last_event; in pasemi_mac_queue_csdesc()
1399 csring->last_event = evt; in pasemi_mac_queue_csdesc()
1401 /* Event handshaking with MAC TX */ in pasemi_mac_queue_csdesc()
1403 CTRL_CMD_ETYPE_SET | CTRL_CMD_REG(csring->events[evt]); in pasemi_mac_queue_csdesc()
1406 CTRL_CMD_ETYPE_WCLR | CTRL_CMD_REG(csring->events[!evt]); in pasemi_mac_queue_csdesc()
1408 csring->next_to_fill = fill & (CS_RING_SIZE-1); in pasemi_mac_queue_csdesc()
1410 cs_size = fill - hdr; in pasemi_mac_queue_csdesc()
1411 write_dma_reg(PAS_DMA_TXCHAN_INCR(csring->chan.chno), (cs_size) >> 1); in pasemi_mac_queue_csdesc()
1413 /* TX-side event handshaking */ in pasemi_mac_queue_csdesc()
1414 fill = txring->next_to_fill; in pasemi_mac_queue_csdesc()
1416 CTRL_CMD_ETYPE_WSET | CTRL_CMD_REG(csring->events[evt]); in pasemi_mac_queue_csdesc()
1419 CTRL_CMD_ETYPE_CLR | CTRL_CMD_REG(csring->events[!evt]); in pasemi_mac_queue_csdesc()
1421 txring->next_to_fill = fill; in pasemi_mac_queue_csdesc()
1423 write_dma_reg(PAS_DMA_TXCHAN_INCR(txring->chan.chno), 2); in pasemi_mac_queue_csdesc()
1428 struct pasemi_mac * const mac = netdev_priv(dev); in pasemi_mac_start_tx() local
1429 struct pasemi_mac_txring * const txring = tx_ring(mac); in pasemi_mac_start_tx()
1441 prefetch(&txring->ring_info); in pasemi_mac_start_tx()
1445 nfrags = skb_shinfo(skb)->nr_frags; in pasemi_mac_start_tx()
1447 map[0] = dma_map_single(&mac->dma_pdev->dev, skb->data, in pasemi_mac_start_tx()
1450 if (dma_mapping_error(&mac->dma_pdev->dev, map[0])) in pasemi_mac_start_tx()
1454 skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; in pasemi_mac_start_tx()
1456 map[i + 1] = skb_frag_dma_map(&mac->dma_pdev->dev, frag, 0, in pasemi_mac_start_tx()
1459 if (dma_mapping_error(&mac->dma_pdev->dev, map[i + 1])) { in pasemi_mac_start_tx()
1465 if (skb->ip_summed == CHECKSUM_PARTIAL && skb->len <= 1540) { in pasemi_mac_start_tx()
1466 switch (ip_hdr(skb)->protocol) { in pasemi_mac_start_tx()
1482 mactx = dflags | XCT_MACTX_LLEN(skb->len); in pasemi_mac_start_tx()
1484 spin_lock_irqsave(&txring->lock, flags); in pasemi_mac_start_tx()
1491 /* no room -- stop the queue and wait for tx intr */ in pasemi_mac_start_tx()
1497 if (mac->num_cs && skb->ip_summed == CHECKSUM_PARTIAL && skb->len > 1540) { in pasemi_mac_start_tx()
1498 csring = mac->cs[mac->last_cs]; in pasemi_mac_start_tx()
1499 mac->last_cs = (mac->last_cs + 1) % mac->num_cs; in pasemi_mac_start_tx()
1504 fill = txring->next_to_fill; in pasemi_mac_start_tx()
1515 /* We have to add an even number of 8-byte entries to the ring in pasemi_mac_start_tx()
1522 txring->next_to_fill = (fill + nfrags + 1) & (TX_RING_SIZE-1); in pasemi_mac_start_tx()
1524 dev->stats.tx_packets++; in pasemi_mac_start_tx()
1525 dev->stats.tx_bytes += skb->len; in pasemi_mac_start_tx()
1527 spin_unlock_irqrestore(&txring->lock, flags); in pasemi_mac_start_tx()
1529 write_dma_reg(PAS_DMA_TXCHAN_INCR(txring->chan.chno), (nfrags+2) >> 1); in pasemi_mac_start_tx()
1534 spin_unlock_irqrestore(&txring->lock, flags); in pasemi_mac_start_tx()
1536 while (nfrags--) in pasemi_mac_start_tx()
1537 dma_unmap_single(&mac->dma_pdev->dev, map[nfrags], in pasemi_mac_start_tx()
1545 const struct pasemi_mac *mac = netdev_priv(dev); in pasemi_mac_set_rx_mode() local
1548 flags = read_mac_reg(mac, PAS_MAC_CFG_PCFG); in pasemi_mac_set_rx_mode()
1551 if (dev->flags & IFF_PROMISC) in pasemi_mac_set_rx_mode()
1556 write_mac_reg(mac, PAS_MAC_CFG_PCFG, flags); in pasemi_mac_set_rx_mode()
1562 struct pasemi_mac *mac = container_of(napi, struct pasemi_mac, napi); in pasemi_mac_poll() local
1565 pasemi_mac_clean_tx(tx_ring(mac)); in pasemi_mac_poll()
1566 pkts = pasemi_mac_clean_rx(rx_ring(mac), budget); in pasemi_mac_poll()
1571 pasemi_mac_restart_rx_intr(mac); in pasemi_mac_poll()
1572 pasemi_mac_restart_tx_intr(mac); in pasemi_mac_poll()
1579 * Polling 'interrupt' - used by things like netconsole to send skbs
1580 * without having to re-enable interrupts. It's not called while
1585 const struct pasemi_mac *mac = netdev_priv(dev); in pasemi_mac_netpoll() local
1587 disable_irq(mac->tx->chan.irq); in pasemi_mac_netpoll()
1588 pasemi_mac_tx_intr(mac->tx->chan.irq, mac->tx); in pasemi_mac_netpoll()
1589 enable_irq(mac->tx->chan.irq); in pasemi_mac_netpoll()
1591 disable_irq(mac->rx->chan.irq); in pasemi_mac_netpoll()
1592 pasemi_mac_rx_intr(mac->rx->chan.irq, mac->rx); in pasemi_mac_netpoll()
1593 enable_irq(mac->rx->chan.irq); in pasemi_mac_netpoll()
1599 struct pasemi_mac *mac = netdev_priv(dev); in pasemi_mac_change_mtu() local
1610 * interface ring, then finally re-fill the rx ring with in pasemi_mac_change_mtu()
1611 * the new-size buffers and restart. in pasemi_mac_change_mtu()
1614 napi_disable(&mac->napi); in pasemi_mac_change_mtu()
1616 pasemi_mac_intf_disable(mac); in pasemi_mac_change_mtu()
1618 rcmdsta = read_dma_reg(PAS_DMA_RXINT_RCMDSTA(mac->dma_if)); in pasemi_mac_change_mtu()
1619 pasemi_mac_pause_rxint(mac); in pasemi_mac_change_mtu()
1620 pasemi_mac_clean_rx(rx_ring(mac), RX_RING_SIZE); in pasemi_mac_change_mtu()
1621 pasemi_mac_free_rx_buffers(mac); in pasemi_mac_change_mtu()
1626 if (new_mtu > PE_DEF_MTU && !mac->num_cs) { in pasemi_mac_change_mtu()
1627 pasemi_mac_setup_csrings(mac); in pasemi_mac_change_mtu()
1628 if (!mac->num_cs) { in pasemi_mac_change_mtu()
1629 ret = -ENOMEM; in pasemi_mac_change_mtu()
1637 reg = read_mac_reg(mac, PAS_MAC_CFG_MACCFG); in pasemi_mac_change_mtu()
1640 write_mac_reg(mac, PAS_MAC_CFG_MACCFG, reg); in pasemi_mac_change_mtu()
1642 WRITE_ONCE(dev->mtu, new_mtu); in pasemi_mac_change_mtu()
1644 mac->bufsz = new_mtu + ETH_HLEN + ETH_FCS_LEN + LOCAL_SKB_ALIGN + 128; in pasemi_mac_change_mtu()
1648 write_dma_reg(PAS_DMA_RXINT_RCMDSTA(mac->dma_if), in pasemi_mac_change_mtu()
1651 rx_ring(mac)->next_to_fill = 0; in pasemi_mac_change_mtu()
1652 pasemi_mac_replenish_rx_ring(dev, RX_RING_SIZE-1); in pasemi_mac_change_mtu()
1654 napi_enable(&mac->napi); in pasemi_mac_change_mtu()
1656 pasemi_mac_intf_enable(mac); in pasemi_mac_change_mtu()
1679 struct pasemi_mac *mac; in pasemi_mac_probe() local
1688 err = -ENOMEM; in pasemi_mac_probe()
1693 SET_NETDEV_DEV(dev, &pdev->dev); in pasemi_mac_probe()
1695 mac = netdev_priv(dev); in pasemi_mac_probe()
1697 mac->pdev = pdev; in pasemi_mac_probe()
1698 mac->netdev = dev; in pasemi_mac_probe()
1700 netif_napi_add(dev, &mac->napi, pasemi_mac_poll); in pasemi_mac_probe()
1702 dev->features = NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_HIGHDMA | in pasemi_mac_probe()
1704 dev->lltx = true; in pasemi_mac_probe()
1706 mac->dma_pdev = pci_get_device(PCI_VENDOR_ID_PASEMI, 0xa007, NULL); in pasemi_mac_probe()
1707 if (!mac->dma_pdev) { in pasemi_mac_probe()
1708 dev_err(&mac->pdev->dev, "Can't find DMA Controller\n"); in pasemi_mac_probe()
1709 err = -ENODEV; in pasemi_mac_probe()
1712 dma_set_mask(&mac->dma_pdev->dev, DMA_BIT_MASK(64)); in pasemi_mac_probe()
1714 mac->iob_pdev = pci_get_device(PCI_VENDOR_ID_PASEMI, 0xa001, NULL); in pasemi_mac_probe()
1715 if (!mac->iob_pdev) { in pasemi_mac_probe()
1716 dev_err(&mac->pdev->dev, "Can't find I/O Bridge\n"); in pasemi_mac_probe()
1717 err = -ENODEV; in pasemi_mac_probe()
1721 /* get mac addr from device tree */ in pasemi_mac_probe()
1722 if (pasemi_get_mac_addr(mac) || !is_valid_ether_addr(mac->mac_addr)) { in pasemi_mac_probe()
1723 err = -ENODEV; in pasemi_mac_probe()
1726 eth_hw_addr_set(dev, mac->mac_addr); in pasemi_mac_probe()
1728 ret = mac_to_intf(mac); in pasemi_mac_probe()
1730 dev_err(&mac->pdev->dev, "Can't map DMA interface\n"); in pasemi_mac_probe()
1731 err = -ENODEV; in pasemi_mac_probe()
1734 mac->dma_if = ret; in pasemi_mac_probe()
1736 switch (pdev->device) { in pasemi_mac_probe()
1738 mac->type = MAC_TYPE_GMAC; in pasemi_mac_probe()
1741 mac->type = MAC_TYPE_XAUI; in pasemi_mac_probe()
1744 err = -ENODEV; in pasemi_mac_probe()
1748 dev->netdev_ops = &pasemi_netdev_ops; in pasemi_mac_probe()
1749 dev->mtu = PE_DEF_MTU; in pasemi_mac_probe()
1751 /* MTU range: 64 - 9000 */ in pasemi_mac_probe()
1752 dev->min_mtu = PE_MIN_MTU; in pasemi_mac_probe()
1753 dev->max_mtu = PE_MAX_MTU; in pasemi_mac_probe()
1756 mac->bufsz = dev->mtu + ETH_HLEN + ETH_FCS_LEN + LOCAL_SKB_ALIGN + 128; in pasemi_mac_probe()
1758 dev->ethtool_ops = &pasemi_mac_ethtool_ops; in pasemi_mac_probe()
1763 mac->msg_enable = netif_msg_init(debug, DEFAULT_MSG_ENABLE); in pasemi_mac_probe()
1766 mac->msg_enable = (NETIF_MSG_IFUP << 1 ) - 1; in pasemi_mac_probe()
1771 dev_err(&mac->pdev->dev, "register_netdev failed with error %d\n", in pasemi_mac_probe()
1774 } else if (netif_msg_probe(mac)) { in pasemi_mac_probe()
1775 printk(KERN_INFO "%s: PA Semi %s: intf %d, hw addr %pM\n", in pasemi_mac_probe()
1776 dev->name, mac->type == MAC_TYPE_GMAC ? "GMAC" : "XAUI", in pasemi_mac_probe()
1777 mac->dma_if, dev->dev_addr); in pasemi_mac_probe()
1783 pci_dev_put(mac->iob_pdev); in pasemi_mac_probe()
1784 pci_dev_put(mac->dma_pdev); in pasemi_mac_probe()
1796 struct pasemi_mac *mac; in pasemi_mac_remove() local
1801 mac = netdev_priv(netdev); in pasemi_mac_remove()
1806 pci_dev_put(mac->dma_pdev); in pasemi_mac_remove()
1807 pci_dev_put(mac->iob_pdev); in pasemi_mac_remove()
1809 pasemi_dma_free_chan(&mac->tx->chan); in pasemi_mac_remove()
1810 pasemi_dma_free_chan(&mac->rx->chan); in pasemi_mac_remove()