Lines Matching refs:skge

94 static void skge_phy_reset(struct skge_port *skge);
98 static void genesis_get_stats(struct skge_port *skge, u64 *data);
99 static void yukon_get_stats(struct skge_port *skge, u64 *data);
102 static void genesis_link_up(struct skge_port *skge);
136 const struct skge_port *skge = netdev_priv(dev); in skge_get_regs() local
137 const void __iomem *io = skge->hw->regs; in skge_get_regs()
161 static void skge_wol_init(struct skge_port *skge) in skge_wol_init() argument
163 struct skge_hw *hw = skge->hw; in skge_wol_init()
164 int port = skge->port; in skge_wol_init()
213 skge->netdev->dev_addr, ETH_ALEN); in skge_wol_init()
218 if (skge->wol & WAKE_PHY) in skge_wol_init()
223 if (skge->wol & WAKE_MAGIC) in skge_wol_init()
237 struct skge_port *skge = netdev_priv(dev); in skge_get_wol() local
239 wol->supported = wol_supported(skge->hw); in skge_get_wol()
240 wol->wolopts = skge->wol; in skge_get_wol()
245 struct skge_port *skge = netdev_priv(dev); in skge_set_wol() local
246 struct skge_hw *hw = skge->hw; in skge_set_wol()
252 skge->wol = wol->wolopts; in skge_set_wol()
254 device_set_wakeup_enable(&hw->pdev->dev, skge->wol); in skge_set_wol()
296 struct skge_port *skge = netdev_priv(dev); in skge_get_link_ksettings() local
297 struct skge_hw *hw = skge->hw; in skge_get_link_ksettings()
308 advertising = skge->advertising; in skge_get_link_ksettings()
309 cmd->base.autoneg = skge->autoneg; in skge_get_link_ksettings()
310 cmd->base.speed = skge->speed; in skge_get_link_ksettings()
311 cmd->base.duplex = skge->duplex; in skge_get_link_ksettings()
324 struct skge_port *skge = netdev_priv(dev); in skge_set_link_ksettings() local
325 const struct skge_hw *hw = skge->hw; in skge_set_link_ksettings()
335 skge->duplex = -1; in skge_set_link_ksettings()
336 skge->speed = -1; in skge_set_link_ksettings()
374 skge->speed = speed; in skge_set_link_ksettings()
375 skge->duplex = cmd->base.duplex; in skge_set_link_ksettings()
378 skge->autoneg = cmd->base.autoneg; in skge_set_link_ksettings()
379 skge->advertising = advertising; in skge_set_link_ksettings()
396 struct skge_port *skge = netdev_priv(dev); in skge_get_drvinfo() local
400 strlcpy(info->bus_info, pci_name(skge->hw->pdev), in skge_get_drvinfo()
448 struct skge_port *skge = netdev_priv(dev); in skge_get_ethtool_stats() local
450 if (is_genesis(skge->hw)) in skge_get_ethtool_stats()
451 genesis_get_stats(skge, data); in skge_get_ethtool_stats()
453 yukon_get_stats(skge, data); in skge_get_ethtool_stats()
462 struct skge_port *skge = netdev_priv(dev); in skge_get_stats() local
465 if (is_genesis(skge->hw)) in skge_get_stats()
466 genesis_get_stats(skge, data); in skge_get_stats()
468 yukon_get_stats(skge, data); in skge_get_stats()
497 struct skge_port *skge = netdev_priv(dev); in skge_get_ring_param() local
502 p->rx_pending = skge->rx_ring.count; in skge_get_ring_param()
503 p->tx_pending = skge->tx_ring.count; in skge_get_ring_param()
509 struct skge_port *skge = netdev_priv(dev); in skge_set_ring_param() local
516 skge->rx_ring.count = p->rx_pending; in skge_set_ring_param()
517 skge->tx_ring.count = p->tx_pending; in skge_set_ring_param()
531 struct skge_port *skge = netdev_priv(netdev); in skge_get_msglevel() local
532 return skge->msg_enable; in skge_get_msglevel()
537 struct skge_port *skge = netdev_priv(netdev); in skge_set_msglevel() local
538 skge->msg_enable = value; in skge_set_msglevel()
543 struct skge_port *skge = netdev_priv(dev); in skge_nway_reset() local
545 if (skge->autoneg != AUTONEG_ENABLE || !netif_running(dev)) in skge_nway_reset()
548 skge_phy_reset(skge); in skge_nway_reset()
555 struct skge_port *skge = netdev_priv(dev); in skge_get_pauseparam() local
557 ecmd->rx_pause = ((skge->flow_control == FLOW_MODE_SYMMETRIC) || in skge_get_pauseparam()
558 (skge->flow_control == FLOW_MODE_SYM_OR_REM)); in skge_get_pauseparam()
560 (skge->flow_control == FLOW_MODE_LOC_SEND)); in skge_get_pauseparam()
568 struct skge_port *skge = netdev_priv(dev); in skge_set_pauseparam() local
575 skge->flow_control = ecmd->autoneg ? FLOW_MODE_NONE : FLOW_MODE_SYMMETRIC; in skge_set_pauseparam()
578 skge->flow_control = FLOW_MODE_SYMMETRIC; in skge_set_pauseparam()
580 skge->flow_control = FLOW_MODE_SYM_OR_REM; in skge_set_pauseparam()
582 skge->flow_control = FLOW_MODE_LOC_SEND; in skge_set_pauseparam()
584 skge->flow_control = FLOW_MODE_NONE; in skge_set_pauseparam()
620 struct skge_port *skge = netdev_priv(dev); in skge_get_coalesce() local
621 struct skge_hw *hw = skge->hw; in skge_get_coalesce()
622 int port = skge->port; in skge_get_coalesce()
644 struct skge_port *skge = netdev_priv(dev); in skge_set_coalesce() local
645 struct skge_hw *hw = skge->hw; in skge_set_coalesce()
646 int port = skge->port; in skge_set_coalesce()
681 static void skge_led(struct skge_port *skge, enum led_mode mode) in skge_led() argument
683 struct skge_hw *hw = skge->hw; in skge_led()
684 int port = skge->port; in skge_led()
744 (skge->speed == SPEED_100 ? in skge_led()
764 struct skge_port *skge = netdev_priv(dev); in skge_set_phys_id() local
771 skge_led(skge, LED_MODE_TST); in skge_set_phys_id()
775 skge_led(skge, LED_MODE_OFF); in skge_set_phys_id()
780 skge_led(skge, netif_running(dev) ? LED_MODE_ON : LED_MODE_OFF); in skge_set_phys_id()
788 struct skge_port *skge = netdev_priv(dev); in skge_get_eeprom_len() local
791 pci_read_config_dword(skge->hw->pdev, PCI_DEV_REG2, &reg2); in skge_get_eeprom_len()
823 struct skge_port *skge = netdev_priv(dev); in skge_get_eeprom() local
824 struct pci_dev *pdev = skge->hw->pdev; in skge_get_eeprom()
849 struct skge_port *skge = netdev_priv(dev); in skge_set_eeprom() local
850 struct pci_dev *pdev = skge->hw->pdev; in skge_set_eeprom()
936 static int skge_rx_setup(struct skge_port *skge, struct skge_element *e, in skge_rx_setup() argument
942 map = dma_map_single(&skge->hw->pdev->dev, skb->data, bufsize, in skge_rx_setup()
945 if (dma_mapping_error(&skge->hw->pdev->dev, map)) in skge_rx_setup()
982 static void skge_rx_clean(struct skge_port *skge) in skge_rx_clean() argument
984 struct skge_hw *hw = skge->hw; in skge_rx_clean()
985 struct skge_ring *ring = &skge->rx_ring; in skge_rx_clean()
1009 struct skge_port *skge = netdev_priv(dev); in skge_rx_fill() local
1010 struct skge_ring *ring = &skge->rx_ring; in skge_rx_fill()
1017 skb = __netdev_alloc_skb(dev, skge->rx_buf_size + NET_IP_ALIGN, in skge_rx_fill()
1023 if (skge_rx_setup(skge, e, skb, skge->rx_buf_size) < 0) { in skge_rx_fill()
1050 static void skge_link_up(struct skge_port *skge) in skge_link_up() argument
1052 skge_write8(skge->hw, SK_REG(skge->port, LNK_LED_REG), in skge_link_up()
1055 netif_carrier_on(skge->netdev); in skge_link_up()
1056 netif_wake_queue(skge->netdev); in skge_link_up()
1058 netif_info(skge, link, skge->netdev, in skge_link_up()
1060 skge->speed, in skge_link_up()
1061 skge->duplex == DUPLEX_FULL ? "full" : "half", in skge_link_up()
1062 skge_pause(skge->flow_status)); in skge_link_up()
1065 static void skge_link_down(struct skge_port *skge) in skge_link_down() argument
1067 skge_write8(skge->hw, SK_REG(skge->port, LNK_LED_REG), LED_REG_OFF); in skge_link_down()
1068 netif_carrier_off(skge->netdev); in skge_link_down()
1069 netif_stop_queue(skge->netdev); in skge_link_down()
1071 netif_info(skge, link, skge->netdev, "Link is down\n"); in skge_link_down()
1077 struct skge_port *skge = netdev_priv(dev); in xm_link_down() local
1082 skge_link_down(skge); in xm_link_down()
1213 struct skge_port *skge = netdev_priv(dev); in bcom_check_link() local
1225 if (skge->autoneg == AUTONEG_ENABLE) { in bcom_check_link()
1242 skge->duplex = DUPLEX_FULL; in bcom_check_link()
1245 skge->duplex = DUPLEX_HALF; in bcom_check_link()
1255 skge->flow_status = FLOW_STAT_SYMMETRIC; in bcom_check_link()
1258 skge->flow_status = FLOW_STAT_REM_SEND; in bcom_check_link()
1261 skge->flow_status = FLOW_STAT_LOC_SEND; in bcom_check_link()
1264 skge->flow_status = FLOW_STAT_NONE; in bcom_check_link()
1266 skge->speed = SPEED_1000; in bcom_check_link()
1270 genesis_link_up(skge); in bcom_check_link()
1276 static void bcom_phy_init(struct skge_port *skge) in bcom_phy_init() argument
1278 struct skge_hw *hw = skge->hw; in bcom_phy_init()
1279 int port = skge->port; in bcom_phy_init()
1341 if (skge->autoneg == AUTONEG_ENABLE) { in bcom_phy_init()
1348 if (skge->advertising & ADVERTISED_1000baseT_Half) in bcom_phy_init()
1350 if (skge->advertising & ADVERTISED_1000baseT_Full) in bcom_phy_init()
1356 if (skge->duplex == DUPLEX_FULL) in bcom_phy_init()
1364 phy_pause_map[skge->flow_control] | PHY_AN_CSMA); in bcom_phy_init()
1382 static void xm_phy_init(struct skge_port *skge) in xm_phy_init() argument
1384 struct skge_hw *hw = skge->hw; in xm_phy_init()
1385 int port = skge->port; in xm_phy_init()
1388 if (skge->autoneg == AUTONEG_ENABLE) { in xm_phy_init()
1389 if (skge->advertising & ADVERTISED_1000baseT_Half) in xm_phy_init()
1391 if (skge->advertising & ADVERTISED_1000baseT_Full) in xm_phy_init()
1394 ctrl |= fiber_pause_map[skge->flow_control]; in xm_phy_init()
1402 if (skge->duplex == DUPLEX_FULL) in xm_phy_init()
1413 mod_timer(&skge->link_timer, jiffies + LINK_HZ); in xm_phy_init()
1418 struct skge_port *skge = netdev_priv(dev); in xm_check_link() local
1419 struct skge_hw *hw = skge->hw; in xm_check_link()
1420 int port = skge->port; in xm_check_link()
1432 if (skge->autoneg == AUTONEG_ENABLE) { in xm_check_link()
1449 skge->duplex = DUPLEX_FULL; in xm_check_link()
1452 skge->duplex = DUPLEX_HALF; in xm_check_link()
1460 if ((skge->flow_control == FLOW_MODE_SYMMETRIC || in xm_check_link()
1461 skge->flow_control == FLOW_MODE_SYM_OR_REM) && in xm_check_link()
1463 skge->flow_status = FLOW_STAT_SYMMETRIC; in xm_check_link()
1464 else if (skge->flow_control == FLOW_MODE_SYM_OR_REM && in xm_check_link()
1467 skge->flow_status = FLOW_STAT_REM_SEND; in xm_check_link()
1468 else if (skge->flow_control == FLOW_MODE_LOC_SEND && in xm_check_link()
1471 skge->flow_status = FLOW_STAT_LOC_SEND; in xm_check_link()
1473 skge->flow_status = FLOW_STAT_NONE; in xm_check_link()
1475 skge->speed = SPEED_1000; in xm_check_link()
1479 genesis_link_up(skge); in xm_check_link()
1491 struct skge_port *skge = from_timer(skge, t, link_timer); in xm_link_timer() local
1492 struct net_device *dev = skge->netdev; in xm_link_timer()
1493 struct skge_hw *hw = skge->hw; in xm_link_timer()
1494 int port = skge->port; in xm_link_timer()
1520 mod_timer(&skge->link_timer, in xm_link_timer()
1529 struct skge_port *skge = netdev_priv(dev); in genesis_mac_init() local
1571 xm_phy_init(skge); in genesis_mac_init()
1574 bcom_phy_init(skge); in genesis_mac_init()
1600 if (skge->duplex == DUPLEX_HALF) { in genesis_mac_init()
1684 static void genesis_stop(struct skge_port *skge) in genesis_stop() argument
1686 struct skge_hw *hw = skge->hw; in genesis_stop()
1687 int port = skge->port; in genesis_stop()
1732 static void genesis_get_stats(struct skge_port *skge, u64 *data) in genesis_get_stats() argument
1734 struct skge_hw *hw = skge->hw; in genesis_get_stats()
1735 int port = skge->port; in genesis_get_stats()
1763 struct skge_port *skge = netdev_priv(dev); in genesis_mac_intr() local
1766 netif_printk(skge, intr, KERN_DEBUG, skge->netdev, in genesis_mac_intr()
1771 mod_timer(&skge->link_timer, jiffies + 1); in genesis_mac_intr()
1780 static void genesis_link_up(struct skge_port *skge) in genesis_link_up() argument
1782 struct skge_hw *hw = skge->hw; in genesis_link_up()
1783 int port = skge->port; in genesis_link_up()
1793 if (skge->flow_status == FLOW_STAT_NONE || in genesis_link_up()
1794 skge->flow_status == FLOW_STAT_LOC_SEND) in genesis_link_up()
1804 if (skge->flow_status == FLOW_STAT_SYMMETRIC || in genesis_link_up()
1805 skge->flow_status == FLOW_STAT_LOC_SEND) { in genesis_link_up()
1843 if (hw->phy_type != SK_PHY_XMAC && skge->duplex == DUPLEX_FULL) in genesis_link_up()
1860 skge_link_up(skge); in genesis_link_up()
1864 static inline void bcom_phy_intr(struct skge_port *skge) in bcom_phy_intr() argument
1866 struct skge_hw *hw = skge->hw; in bcom_phy_intr()
1867 int port = skge->port; in bcom_phy_intr()
1871 netif_printk(skge, intr, KERN_DEBUG, skge->netdev, in bcom_phy_intr()
1943 struct skge_port *skge = netdev_priv(hw->dev[port]); in yukon_init() local
1946 if (skge->autoneg == AUTONEG_ENABLE) { in yukon_init()
1959 if (skge->autoneg == AUTONEG_DISABLE) in yukon_init()
1969 if (skge->autoneg == AUTONEG_ENABLE) { in yukon_init()
1971 if (skge->advertising & ADVERTISED_1000baseT_Full) in yukon_init()
1973 if (skge->advertising & ADVERTISED_1000baseT_Half) in yukon_init()
1975 if (skge->advertising & ADVERTISED_100baseT_Full) in yukon_init()
1977 if (skge->advertising & ADVERTISED_100baseT_Half) in yukon_init()
1979 if (skge->advertising & ADVERTISED_10baseT_Full) in yukon_init()
1981 if (skge->advertising & ADVERTISED_10baseT_Half) in yukon_init()
1985 adv |= phy_pause_map[skge->flow_control]; in yukon_init()
1987 if (skge->advertising & ADVERTISED_1000baseT_Full) in yukon_init()
1989 if (skge->advertising & ADVERTISED_1000baseT_Half) in yukon_init()
1992 adv |= fiber_pause_map[skge->flow_control]; in yukon_init()
2001 if (skge->duplex == DUPLEX_FULL) in yukon_init()
2004 switch (skge->speed) { in yukon_init()
2022 if (skge->autoneg == AUTONEG_ENABLE) in yukon_init()
2059 struct skge_port *skge = netdev_priv(hw->dev[port]); in yukon_mac_init() local
2095 if (skge->autoneg == AUTONEG_DISABLE) { in yukon_mac_init()
2100 switch (skge->speed) { in yukon_mac_init()
2114 if (skge->duplex == DUPLEX_FULL) in yukon_mac_init()
2119 switch (skge->flow_control) { in yukon_mac_init()
2226 static void yukon_stop(struct skge_port *skge) in yukon_stop() argument
2228 struct skge_hw *hw = skge->hw; in yukon_stop()
2229 int port = skge->port; in yukon_stop()
2246 static void yukon_get_stats(struct skge_port *skge, u64 *data) in yukon_get_stats() argument
2248 struct skge_hw *hw = skge->hw; in yukon_get_stats()
2249 int port = skge->port; in yukon_get_stats()
2265 struct skge_port *skge = netdev_priv(dev); in yukon_mac_intr() local
2268 netif_printk(skge, intr, KERN_DEBUG, skge->netdev, in yukon_mac_intr()
2295 static void yukon_link_up(struct skge_port *skge) in yukon_link_up() argument
2297 struct skge_hw *hw = skge->hw; in yukon_link_up()
2298 int port = skge->port; in yukon_link_up()
2305 if (skge->duplex == DUPLEX_FULL || skge->autoneg == AUTONEG_ENABLE) in yukon_link_up()
2313 skge_link_up(skge); in yukon_link_up()
2316 static void yukon_link_down(struct skge_port *skge) in yukon_link_down() argument
2318 struct skge_hw *hw = skge->hw; in yukon_link_down()
2319 int port = skge->port; in yukon_link_down()
2326 if (skge->flow_status == FLOW_STAT_REM_SEND) { in yukon_link_down()
2333 skge_link_down(skge); in yukon_link_down()
2338 static void yukon_phy_intr(struct skge_port *skge) in yukon_phy_intr() argument
2340 struct skge_hw *hw = skge->hw; in yukon_phy_intr()
2341 int port = skge->port; in yukon_phy_intr()
2348 netif_printk(skge, intr, KERN_DEBUG, skge->netdev, in yukon_phy_intr()
2368 skge->duplex = (phystat & PHY_M_PS_FULL_DUP) in yukon_phy_intr()
2370 skge->speed = yukon_speed(hw, phystat); in yukon_phy_intr()
2375 skge->flow_status = FLOW_STAT_SYMMETRIC; in yukon_phy_intr()
2378 skge->flow_status = FLOW_STAT_REM_SEND; in yukon_phy_intr()
2381 skge->flow_status = FLOW_STAT_LOC_SEND; in yukon_phy_intr()
2384 skge->flow_status = FLOW_STAT_NONE; in yukon_phy_intr()
2387 if (skge->flow_status == FLOW_STAT_NONE || in yukon_phy_intr()
2388 (skge->speed < SPEED_1000 && skge->duplex == DUPLEX_HALF)) in yukon_phy_intr()
2392 yukon_link_up(skge); in yukon_phy_intr()
2397 skge->speed = yukon_speed(hw, phystat); in yukon_phy_intr()
2400 skge->duplex = (phystat & PHY_M_PS_FULL_DUP) ? DUPLEX_FULL : DUPLEX_HALF; in yukon_phy_intr()
2403 yukon_link_up(skge); in yukon_phy_intr()
2405 yukon_link_down(skge); in yukon_phy_intr()
2409 pr_err("%s: autonegotiation failed (%s)\n", skge->netdev->name, reason); in yukon_phy_intr()
2414 static void skge_phy_reset(struct skge_port *skge) in skge_phy_reset() argument
2416 struct skge_hw *hw = skge->hw; in skge_phy_reset()
2417 int port = skge->port; in skge_phy_reset()
2420 netif_stop_queue(skge->netdev); in skge_phy_reset()
2421 netif_carrier_off(skge->netdev); in skge_phy_reset()
2440 struct skge_port *skge = netdev_priv(dev); in skge_ioctl() local
2441 struct skge_hw *hw = skge->hw; in skge_ioctl()
2457 err = __xm_phy_read(hw, skge->port, data->reg_num & 0x1f, &val); in skge_ioctl()
2459 err = __gm_phy_read(hw, skge->port, data->reg_num & 0x1f, &val); in skge_ioctl()
2468 err = xm_phy_write(hw, skge->port, data->reg_num & 0x1f, in skge_ioctl()
2471 err = gm_phy_write(hw, skge->port, data->reg_num & 0x1f, in skge_ioctl()
2510 static void skge_qset(struct skge_port *skge, u16 q, in skge_qset() argument
2513 struct skge_hw *hw = skge->hw; in skge_qset()
2515 u64 base = skge->dma + (e->desc - skge->mem); in skge_qset()
2529 struct skge_port *skge = netdev_priv(dev); in skge_up() local
2530 struct skge_hw *hw = skge->hw; in skge_up()
2531 int port = skge->port; in skge_up()
2539 netif_info(skge, ifup, skge->netdev, "enabling interface\n"); in skge_up()
2542 skge->rx_buf_size = dev->mtu + ETH_HLEN; in skge_up()
2544 skge->rx_buf_size = RX_BUF_SIZE; in skge_up()
2547 rx_size = skge->rx_ring.count * sizeof(struct skge_rx_desc); in skge_up()
2548 tx_size = skge->tx_ring.count * sizeof(struct skge_tx_desc); in skge_up()
2549 skge->mem_size = tx_size + rx_size; in skge_up()
2550 skge->mem = dma_alloc_coherent(&hw->pdev->dev, skge->mem_size, in skge_up()
2551 &skge->dma, GFP_KERNEL); in skge_up()
2552 if (!skge->mem) in skge_up()
2555 BUG_ON(skge->dma & 7); in skge_up()
2557 if (upper_32_bits(skge->dma) != upper_32_bits(skge->dma + skge->mem_size)) { in skge_up()
2563 err = skge_ring_alloc(&skge->rx_ring, skge->mem, skge->dma); in skge_up()
2571 err = skge_ring_alloc(&skge->tx_ring, skge->mem + rx_size, in skge_up()
2572 skge->dma + rx_size); in skge_up()
2600 skge_qset(skge, rxqaddr[port], skge->rx_ring.to_clean); in skge_up()
2602 BUG_ON(skge->tx_ring.to_use != skge->tx_ring.to_clean); in skge_up()
2604 skge_qset(skge, txqaddr[port], skge->tx_ring.to_use); in skge_up()
2609 skge_led(skge, LED_MODE_ON); in skge_up()
2617 napi_enable(&skge->napi); in skge_up()
2624 kfree(skge->tx_ring.start); in skge_up()
2626 skge_rx_clean(skge); in skge_up()
2627 kfree(skge->rx_ring.start); in skge_up()
2629 dma_free_coherent(&hw->pdev->dev, skge->mem_size, skge->mem, in skge_up()
2630 skge->dma); in skge_up()
2631 skge->mem = NULL; in skge_up()
2647 struct skge_port *skge = netdev_priv(dev); in skge_down() local
2648 struct skge_hw *hw = skge->hw; in skge_down()
2649 int port = skge->port; in skge_down()
2651 if (!skge->mem) in skge_down()
2654 netif_info(skge, ifdown, skge->netdev, "disabling interface\n"); in skge_down()
2659 del_timer_sync(&skge->link_timer); in skge_down()
2661 napi_disable(&skge->napi); in skge_down()
2673 skge_write8(skge->hw, SK_REG(skge->port, LNK_LED_REG), LED_REG_OFF); in skge_down()
2675 genesis_stop(skge); in skge_down()
2677 yukon_stop(skge); in skge_down()
2710 skge_led(skge, LED_MODE_OFF); in skge_down()
2716 skge_rx_clean(skge); in skge_down()
2718 kfree(skge->rx_ring.start); in skge_down()
2719 kfree(skge->tx_ring.start); in skge_down()
2720 dma_free_coherent(&hw->pdev->dev, skge->mem_size, skge->mem, in skge_down()
2721 skge->dma); in skge_down()
2722 skge->mem = NULL; in skge_down()
2736 struct skge_port *skge = netdev_priv(dev); in skge_xmit_frame() local
2737 struct skge_hw *hw = skge->hw; in skge_xmit_frame()
2747 if (unlikely(skge_avail(&skge->tx_ring) < skb_shinfo(skb)->nr_frags + 1)) in skge_xmit_frame()
2750 e = skge->tx_ring.to_use; in skge_xmit_frame()
2818 skge_write8(hw, Q_ADDR(txqaddr[skge->port], Q_CSR), CSR_START); in skge_xmit_frame()
2820 netif_printk(skge, tx_queued, KERN_DEBUG, skge->netdev, in skge_xmit_frame()
2822 e - skge->tx_ring.start, skb->len); in skge_xmit_frame()
2824 skge->tx_ring.to_use = e->next; in skge_xmit_frame()
2827 if (skge_avail(&skge->tx_ring) <= TX_LOW_WATER) { in skge_xmit_frame()
2835 e = skge->tx_ring.to_use; in skge_xmit_frame()
2868 struct skge_port *skge = netdev_priv(dev); in skge_tx_clean() local
2871 for (e = skge->tx_ring.to_clean; e != skge->tx_ring.to_use; e = e->next) { in skge_tx_clean()
2874 skge_tx_unmap(skge->hw->pdev, e, td->control); in skge_tx_clean()
2882 skge->tx_ring.to_clean = e; in skge_tx_clean()
2887 struct skge_port *skge = netdev_priv(dev); in skge_tx_timeout() local
2889 netif_printk(skge, timer, KERN_DEBUG, skge->netdev, "tx timeout\n"); in skge_tx_timeout()
2891 skge_write8(skge->hw, Q_ADDR(txqaddr[skge->port], Q_CSR), CSR_STOP); in skge_tx_timeout()
2929 struct skge_port *skge = netdev_priv(dev); in genesis_set_multicast() local
2930 struct skge_hw *hw = skge->hw; in genesis_set_multicast()
2931 int port = skge->port; in genesis_set_multicast()
2948 if (skge->flow_status == FLOW_STAT_REM_SEND || in genesis_set_multicast()
2949 skge->flow_status == FLOW_STAT_SYMMETRIC) in genesis_set_multicast()
2968 struct skge_port *skge = netdev_priv(dev); in yukon_set_multicast() local
2969 struct skge_hw *hw = skge->hw; in yukon_set_multicast()
2970 int port = skge->port; in yukon_set_multicast()
2972 int rx_pause = (skge->flow_status == FLOW_STAT_REM_SEND || in yukon_set_multicast()
2973 skge->flow_status == FLOW_STAT_SYMMETRIC); in yukon_set_multicast()
3030 struct skge_port *skge = netdev_priv(dev); in skge_set_multicast() local
3032 if (is_genesis(skge->hw)) in skge_set_multicast()
3047 struct skge_port *skge = netdev_priv(dev); in skge_rx_get() local
3051 netif_printk(skge, rx_status, KERN_DEBUG, skge->netdev, in skge_rx_get()
3053 e - skge->rx_ring.start, status, len); in skge_rx_get()
3055 if (len > skge->rx_buf_size) in skge_rx_get()
3061 if (bad_phy_status(skge->hw, status)) in skge_rx_get()
3064 if (phy_length(skge->hw, status) != len) in skge_rx_get()
3072 dma_sync_single_for_cpu(&skge->hw->pdev->dev, in skge_rx_get()
3077 dma_sync_single_for_device(&skge->hw->pdev->dev, in skge_rx_get()
3081 skge_rx_reuse(e, skge->rx_buf_size); in skge_rx_get()
3086 nskb = netdev_alloc_skb_ip_align(dev, skge->rx_buf_size); in skge_rx_get()
3095 if (skge_rx_setup(skge, e, nskb, skge->rx_buf_size) < 0) { in skge_rx_get()
3100 dma_unmap_single(&skge->hw->pdev->dev, in skge_rx_get()
3117 netif_printk(skge, rx_err, KERN_DEBUG, skge->netdev, in skge_rx_get()
3119 e - skge->rx_ring.start, control, status); in skge_rx_get()
3121 if (is_genesis(skge->hw)) { in skge_rx_get()
3138 skge_rx_reuse(e, skge->rx_buf_size); in skge_rx_get()
3145 struct skge_port *skge = netdev_priv(dev); in skge_tx_done() local
3146 struct skge_ring *ring = &skge->tx_ring; in skge_tx_done()
3150 skge_write8(skge->hw, Q_ADDR(txqaddr[skge->port], Q_CSR), CSR_IRQ_CL_F); in skge_tx_done()
3158 skge_tx_unmap(skge->hw->pdev, e, control); in skge_tx_done()
3161 netif_printk(skge, tx_done, KERN_DEBUG, skge->netdev, in skge_tx_done()
3163 e - skge->tx_ring.start); in skge_tx_done()
3172 skge->tx_ring.to_clean = e; in skge_tx_done()
3178 skge_avail(&skge->tx_ring) > TX_LOW_WATER)) { in skge_tx_done()
3181 skge_avail(&skge->tx_ring) > TX_LOW_WATER)) { in skge_tx_done()
3191 struct skge_port *skge = container_of(napi, struct skge_port, napi); in skge_poll() local
3192 struct net_device *dev = skge->netdev; in skge_poll()
3193 struct skge_hw *hw = skge->hw; in skge_poll()
3194 struct skge_ring *ring = &skge->rx_ring; in skge_poll()
3200 skge_write8(hw, Q_ADDR(rxqaddr[skge->port], Q_CSR), CSR_IRQ_CL_F); in skge_poll()
3222 skge_write8(hw, Q_ADDR(rxqaddr[skge->port], Q_CSR), CSR_START); in skge_poll()
3228 hw->intr_mask |= napimask[skge->port]; in skge_poll()
3350 struct skge_port *skge = netdev_priv(dev); in skge_extirq() local
3354 yukon_phy_intr(skge); in skge_extirq()
3356 bcom_phy_intr(skge); in skge_extirq()
3388 struct skge_port *skge = netdev_priv(hw->dev[0]); in skge_intr() local
3390 napi_schedule(&skge->napi); in skge_intr()
3406 struct skge_port *skge = netdev_priv(hw->dev[1]); in skge_intr() local
3410 napi_schedule(&skge->napi); in skge_intr()
3438 struct skge_port *skge = netdev_priv(dev); in skge_netpoll() local
3441 skge_intr(dev->irq, skge->hw); in skge_netpoll()
3448 struct skge_port *skge = netdev_priv(dev); in skge_set_mac_address() local
3449 struct skge_hw *hw = skge->hw; in skge_set_mac_address()
3450 unsigned port = skge->port; in skge_set_mac_address()
3688 const struct skge_port *skge = netdev_priv(dev); in skge_debug_show() local
3689 const struct skge_hw *hw = skge->hw; in skge_debug_show()
3698 seq_printf(seq, "Tx Ring: (%d)\n", skge_avail(&skge->tx_ring)); in skge_debug_show()
3699 for (e = skge->tx_ring.to_clean; e != skge->tx_ring.to_use; e = e->next) { in skge_debug_show()
3707 for (e = skge->rx_ring.to_clean; ; e = e->next) { in skge_debug_show()
3730 struct skge_port *skge; in skge_device_event() local
3735 skge = netdev_priv(dev); in skge_device_event()
3738 if (skge->debugfs) in skge_device_event()
3739 skge->debugfs = debugfs_rename(skge_debug, in skge_device_event()
3740 skge->debugfs, in skge_device_event()
3745 debugfs_remove(skge->debugfs); in skge_device_event()
3746 skge->debugfs = NULL; in skge_device_event()
3750 skge->debugfs = debugfs_create_file(dev->name, 0444, skge_debug, in skge_device_event()
3806 struct skge_port *skge; in skge_devinit() local
3807 struct net_device *dev = alloc_etherdev(sizeof(*skge)); in skge_devinit()
3825 skge = netdev_priv(dev); in skge_devinit()
3826 netif_napi_add(dev, &skge->napi, skge_poll, NAPI_WEIGHT); in skge_devinit()
3827 skge->netdev = dev; in skge_devinit()
3828 skge->hw = hw; in skge_devinit()
3829 skge->msg_enable = netif_msg_init(debug, default_msg); in skge_devinit()
3831 skge->tx_ring.count = DEFAULT_TX_RING_SIZE; in skge_devinit()
3832 skge->rx_ring.count = DEFAULT_RX_RING_SIZE; in skge_devinit()
3835 skge->autoneg = AUTONEG_ENABLE; in skge_devinit()
3836 skge->flow_control = FLOW_MODE_SYM_OR_REM; in skge_devinit()
3837 skge->duplex = -1; in skge_devinit()
3838 skge->speed = -1; in skge_devinit()
3839 skge->advertising = skge_supported_modes(hw); in skge_devinit()
3842 skge->wol = wol_supported(hw) & WAKE_MAGIC; in skge_devinit()
3843 device_set_wakeup_enable(&hw->pdev->dev, skge->wol); in skge_devinit()
3848 skge->port = port; in skge_devinit()
3852 timer_setup(&skge->link_timer, xm_link_timer, 0); in skge_devinit()
3867 const struct skge_port *skge = netdev_priv(dev); in skge_show_addr() local
3869 netif_info(skge, probe, skge->netdev, "addr %pM\n", dev->dev_addr); in skge_show_addr()
4065 struct skge_port *skge = netdev_priv(dev); in skge_suspend() local
4070 if (skge->wol) in skge_suspend()
4071 skge_wol_init(skge); in skge_suspend()
4126 struct skge_port *skge = netdev_priv(dev); in skge_shutdown() local
4128 if (skge->wol) in skge_shutdown()
4129 skge_wol_init(skge); in skge_shutdown()