Lines Matching refs:netdev

99 static int pch_gbe_mdio_read(struct net_device *netdev, int addr, int reg);
100 static void pch_gbe_mdio_write(struct net_device *netdev, int addr, int reg,
102 static void pch_gbe_set_multi(struct net_device *netdev);
201 static int hwtstamp_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) in hwtstamp_ioctl() argument
204 struct pch_gbe_adapter *adapter = netdev_priv(netdev); in hwtstamp_ioctl()
279 netdev_dbg(adapter->netdev, "hw->mac.addr : %pM\n", hw->mac.addr); in pch_gbe_mac_read_mac_addr()
308 netdev_dbg(adapter->netdev, "index : 0x%x\n", index); in pch_gbe_mac_mar_set()
398 netdev_dbg(adapter->netdev, "mac->fc = %u\n", mac->fc); in pch_gbe_mac_force_mac_fc()
420 netdev_err(adapter->netdev, in pch_gbe_mac_force_mac_fc()
427 netdev_dbg(adapter->netdev, in pch_gbe_mac_force_mac_fc()
443 netdev_dbg(adapter->netdev, "wu_evt : 0x%08x ADDR_MASK reg : 0x%08x\n", in pch_gbe_mac_set_wol_event()
484 netdev_err(adapter->netdev, "pch-gbe.miim won't go Ready\n"); in pch_gbe_mac_ctrl_miim()
495 netdev_dbg(adapter->netdev, "PHY %s: reg=%d, data=0x%04X\n", in pch_gbe_mac_ctrl_miim()
529 netdev_dbg(adapter->netdev, in pch_gbe_mac_set_pause_packet()
581 struct net_device *netdev = adapter->netdev; in pch_gbe_init_phy() local
588 bmcr = pch_gbe_mdio_read(netdev, adapter->mii.phy_id, MII_BMCR); in pch_gbe_init_phy()
589 stat = pch_gbe_mdio_read(netdev, adapter->mii.phy_id, MII_BMSR); in pch_gbe_init_phy()
590 stat = pch_gbe_mdio_read(netdev, adapter->mii.phy_id, MII_BMSR); in pch_gbe_init_phy()
595 netdev_dbg(netdev, "phy_addr = %d\n", adapter->mii.phy_id); in pch_gbe_init_phy()
601 pch_gbe_mdio_write(netdev, addr, MII_BMCR, in pch_gbe_init_phy()
604 bmcr = pch_gbe_mdio_read(netdev, addr, MII_BMCR); in pch_gbe_init_phy()
605 pch_gbe_mdio_write(netdev, addr, MII_BMCR, in pch_gbe_init_phy()
613 adapter->mii.dev = adapter->netdev; in pch_gbe_init_phy()
629 static int pch_gbe_mdio_read(struct net_device *netdev, int addr, int reg) in pch_gbe_mdio_read() argument
631 struct pch_gbe_adapter *adapter = netdev_priv(netdev); in pch_gbe_mdio_read()
645 static void pch_gbe_mdio_write(struct net_device *netdev, in pch_gbe_mdio_write() argument
648 struct pch_gbe_adapter *adapter = netdev_priv(netdev); in pch_gbe_mdio_write()
684 struct net_device *netdev = adapter->netdev; in pch_gbe_reset() local
690 pch_gbe_set_multi(netdev); in pch_gbe_reset()
696 netdev_err(adapter->netdev, "pch_gbe_phy_get_id error\n"); in pch_gbe_reset()
710 struct net_device *netdev = adapter->netdev; in pch_gbe_free_irq() local
712 free_irq(adapter->irq, netdev); in pch_gbe_free_irq()
729 netdev_dbg(adapter->netdev, "INT_EN reg : 0x%08x\n", in pch_gbe_irq_disable()
744 netdev_dbg(adapter->netdev, "INT_EN reg : 0x%08x\n", in pch_gbe_irq_enable()
782 netdev_dbg(adapter->netdev, "dma addr = 0x%08llx size = 0x%08x\n", in pch_gbe_configure_tx()
830 netdev_dbg(adapter->netdev, "dma adr = 0x%08llx size = 0x%08x\n", in pch_gbe_configure_rx()
843 netdev_dbg(adapter->netdev, in pch_gbe_configure_rx()
914 netdev_dbg(adapter->netdev, in pch_gbe_clean_tx_ring()
947 netdev_dbg(adapter->netdev, in pch_gbe_clean_rx_ring()
986 struct net_device *netdev = adapter->netdev; in pch_gbe_set_mode() local
994 netdev->tx_queue_len = 10; in pch_gbe_set_mode()
998 netdev->tx_queue_len = 100; in pch_gbe_set_mode()
1019 struct net_device *netdev = adapter->netdev; in pch_gbe_watchdog() local
1022 netdev_dbg(netdev, "right now = %ld\n", jiffies); in pch_gbe_watchdog()
1025 if ((mii_link_ok(&adapter->mii)) && (!netif_carrier_ok(netdev))) { in pch_gbe_watchdog()
1027 netdev->tx_queue_len = adapter->tx_queue_len; in pch_gbe_watchdog()
1038 netdev_dbg(netdev, in pch_gbe_watchdog()
1042 netif_carrier_on(netdev); in pch_gbe_watchdog()
1043 netif_wake_queue(netdev); in pch_gbe_watchdog()
1045 (netif_carrier_ok(netdev))) { in pch_gbe_watchdog()
1046 netdev_dbg(netdev, "NIC Link is Down\n"); in pch_gbe_watchdog()
1049 netif_carrier_off(netdev); in pch_gbe_watchdog()
1050 netif_stop_queue(netdev); in pch_gbe_watchdog()
1142 netdev_err(adapter->netdev, "TX DMA map failed\n"); in pch_gbe_tx_queue()
1179 struct net_device *netdev = adapter->netdev; in pch_gbe_update_stats() local
1200 netdev->stats.rx_packets = stats->rx_packets; in pch_gbe_update_stats()
1201 netdev->stats.rx_bytes = stats->rx_bytes; in pch_gbe_update_stats()
1202 netdev->stats.rx_dropped = stats->rx_dropped; in pch_gbe_update_stats()
1203 netdev->stats.tx_packets = stats->tx_packets; in pch_gbe_update_stats()
1204 netdev->stats.tx_bytes = stats->tx_bytes; in pch_gbe_update_stats()
1205 netdev->stats.tx_dropped = stats->tx_dropped; in pch_gbe_update_stats()
1207 netdev->stats.multicast = stats->multicast; in pch_gbe_update_stats()
1208 netdev->stats.collisions = stats->collisions; in pch_gbe_update_stats()
1210 netdev->stats.rx_errors = stats->rx_errors; in pch_gbe_update_stats()
1211 netdev->stats.rx_crc_errors = stats->rx_crc_errors; in pch_gbe_update_stats()
1212 netdev->stats.rx_frame_errors = stats->rx_frame_errors; in pch_gbe_update_stats()
1214 netdev->stats.tx_errors = stats->tx_errors; in pch_gbe_update_stats()
1215 netdev->stats.tx_aborted_errors = stats->tx_aborted_errors; in pch_gbe_update_stats()
1216 netdev->stats.tx_carrier_errors = stats->tx_carrier_errors; in pch_gbe_update_stats()
1251 struct net_device *netdev = data; in pch_gbe_intr() local
1252 struct pch_gbe_adapter *adapter = netdev_priv(netdev); in pch_gbe_intr()
1263 netdev_dbg(netdev, "%s occur int_st = 0x%08x\n", __func__, int_st); in pch_gbe_intr()
1269 netdev_dbg(netdev, "Rx fifo over run\n"); in pch_gbe_intr()
1289 netdev_dbg(netdev, "Rx descriptor is empty\n"); in pch_gbe_intr()
1312 netdev_dbg(netdev, "return = 0x%08x INT_EN reg = 0x%08x\n", in pch_gbe_intr()
1327 struct net_device *netdev = adapter->netdev; in pch_gbe_alloc_rx_buffers() local
1341 skb = netdev_alloc_skb(netdev, bufsz); in pch_gbe_alloc_rx_buffers()
1367 netdev_dbg(netdev, in pch_gbe_alloc_rx_buffers()
1433 skb = netdev_alloc_skb(adapter->netdev, bufsz); in pch_gbe_alloc_tx_buffers()
1462 netdev_dbg(adapter->netdev, "next_to_clean : %d\n", in pch_gbe_clean_tx()
1467 netdev_dbg(adapter->netdev, "gbec_status:0x%04x dma_status:0x%04x\n", in pch_gbe_clean_tx()
1476 netdev_dbg(adapter->netdev, in pch_gbe_clean_tx()
1491 netdev_dbg(adapter->netdev, in pch_gbe_clean_tx()
1500 netdev_dbg(adapter->netdev, "gbec_status:0x%04x\n", in pch_gbe_clean_tx()
1508 netdev_err(adapter->netdev, "Transfer Abort Error\n"); in pch_gbe_clean_tx()
1512 netdev_err(adapter->netdev, in pch_gbe_clean_tx()
1517 netdev_err(adapter->netdev, in pch_gbe_clean_tx()
1525 netdev_dbg(adapter->netdev, "Transfer Collision\n"); in pch_gbe_clean_tx()
1532 netdev_dbg(adapter->netdev, in pch_gbe_clean_tx()
1539 netdev_dbg(adapter->netdev, in pch_gbe_clean_tx()
1554 netdev_dbg(adapter->netdev, in pch_gbe_clean_tx()
1559 netif_tx_lock(adapter->netdev); in pch_gbe_clean_tx()
1560 if (unlikely(cleaned && (netif_queue_stopped(adapter->netdev)))) in pch_gbe_clean_tx()
1562 netif_wake_queue(adapter->netdev); in pch_gbe_clean_tx()
1564 netdev_dbg(adapter->netdev, "Tx wake queue\n"); in pch_gbe_clean_tx()
1569 netdev_dbg(adapter->netdev, "next_to_clean : %d\n", in pch_gbe_clean_tx()
1571 netif_tx_unlock(adapter->netdev); in pch_gbe_clean_tx()
1591 struct net_device *netdev = adapter->netdev; in pch_gbe_clean_rx() local
1627 netdev_dbg(netdev, in pch_gbe_clean_rx()
1634 netdev_err(netdev, "Receive Not Octal Error\n"); in pch_gbe_clean_rx()
1638 netdev_err(netdev, "Receive Nibble Error\n"); in pch_gbe_clean_rx()
1642 netdev_err(netdev, "Receive CRC Error\n"); in pch_gbe_clean_rx()
1665 skb->protocol = eth_type_trans(skb, netdev); in pch_gbe_clean_rx()
1673 netdev_dbg(netdev, in pch_gbe_clean_rx()
1729 netdev_dbg(adapter->netdev, in pch_gbe_setup_tx_resources()
1770 netdev_dbg(adapter->netdev, in pch_gbe_setup_rx_resources()
1822 struct net_device *netdev = adapter->netdev; in pch_gbe_request_irq() local
1832 netdev->name, netdev); in pch_gbe_request_irq()
1834 netdev_err(netdev, "Unable to allocate interrupt Error: %d\n", in pch_gbe_request_irq()
1836 netdev_dbg(netdev, "have_msi : %d return : 0x%04x\n", in pch_gbe_request_irq()
1850 struct net_device *netdev = adapter->netdev; in pch_gbe_up() local
1857 netdev_err(netdev, "Error: Invalid MAC address\n"); in pch_gbe_up()
1862 pch_gbe_set_multi(netdev); in pch_gbe_up()
1871 netdev_err(netdev, in pch_gbe_up()
1877 netdev_err(netdev, in pch_gbe_up()
1883 adapter->tx_queue_len = netdev->tx_queue_len; in pch_gbe_up()
1891 netif_start_queue(adapter->netdev); in pch_gbe_up()
1907 struct net_device *netdev = adapter->netdev; in pch_gbe_down() local
1921 netdev->tx_queue_len = adapter->tx_queue_len; in pch_gbe_down()
1922 netif_carrier_off(netdev); in pch_gbe_down()
1923 netif_stop_queue(netdev); in pch_gbe_down()
1947 struct net_device *netdev = adapter->netdev; in pch_gbe_sw_init() local
1950 hw->mac.max_frame_size = netdev->mtu + ETH_HLEN + ETH_FCS_LEN; in pch_gbe_sw_init()
1955 netdev_err(netdev, "Unable to allocate memory for queues\n"); in pch_gbe_sw_init()
1966 netdev_dbg(netdev, in pch_gbe_sw_init()
1980 static int pch_gbe_open(struct net_device *netdev) in pch_gbe_open() argument
1982 struct pch_gbe_adapter *adapter = netdev_priv(netdev); in pch_gbe_open()
1998 netdev_dbg(netdev, "Success End\n"); in pch_gbe_open()
2009 netdev_err(netdev, "Error End\n"); in pch_gbe_open()
2019 static int pch_gbe_stop(struct net_device *netdev) in pch_gbe_stop() argument
2021 struct pch_gbe_adapter *adapter = netdev_priv(netdev); in pch_gbe_stop()
2040 static netdev_tx_t pch_gbe_xmit_frame(struct sk_buff *skb, struct net_device *netdev) in pch_gbe_xmit_frame() argument
2042 struct pch_gbe_adapter *adapter = netdev_priv(netdev); in pch_gbe_xmit_frame()
2046 netif_stop_queue(netdev); in pch_gbe_xmit_frame()
2047 netdev_dbg(netdev, in pch_gbe_xmit_frame()
2062 static void pch_gbe_set_multi(struct net_device *netdev) in pch_gbe_set_multi() argument
2064 struct pch_gbe_adapter *adapter = netdev_priv(netdev); in pch_gbe_set_multi()
2070 netdev_dbg(netdev, "netdev->flags : 0x%08x\n", netdev->flags); in pch_gbe_set_multi()
2077 if (netdev->flags & IFF_PROMISC) in pch_gbe_set_multi()
2083 mc_count = netdev_mc_count(netdev); in pch_gbe_set_multi()
2084 if ((netdev->flags & IFF_ALLMULTI) || mc_count >= PCH_GBE_MAR_ENTRIES) in pch_gbe_set_multi()
2099 netdev_for_each_mc_addr(ha, netdev) in pch_gbe_set_multi()
2114 netdev_dbg(netdev, in pch_gbe_set_multi()
2127 static int pch_gbe_set_mac(struct net_device *netdev, void *addr) in pch_gbe_set_mac() argument
2129 struct pch_gbe_adapter *adapter = netdev_priv(netdev); in pch_gbe_set_mac()
2136 eth_hw_addr_set(netdev, skaddr->sa_data); in pch_gbe_set_mac()
2137 memcpy(adapter->hw.mac.addr, skaddr->sa_data, netdev->addr_len); in pch_gbe_set_mac()
2141 netdev_dbg(netdev, "ret_val : 0x%08x\n", ret_val); in pch_gbe_set_mac()
2142 netdev_dbg(netdev, "dev_addr : %pM\n", netdev->dev_addr); in pch_gbe_set_mac()
2143 netdev_dbg(netdev, "mac_addr : %pM\n", adapter->hw.mac.addr); in pch_gbe_set_mac()
2144 netdev_dbg(netdev, "MAC_ADR1AB reg : 0x%08x 0x%08x\n", in pch_gbe_set_mac()
2158 static int pch_gbe_change_mtu(struct net_device *netdev, int new_mtu) in pch_gbe_change_mtu() argument
2160 struct pch_gbe_adapter *adapter = netdev_priv(netdev); in pch_gbe_change_mtu()
2174 if (netif_running(netdev)) { in pch_gbe_change_mtu()
2182 netdev->mtu = new_mtu; in pch_gbe_change_mtu()
2187 WRITE_ONCE(netdev->mtu, new_mtu); in pch_gbe_change_mtu()
2191 netdev_dbg(netdev, in pch_gbe_change_mtu()
2193 max_frame, (u32) adapter->rx_buffer_len, netdev->mtu, in pch_gbe_change_mtu()
2205 static int pch_gbe_set_features(struct net_device *netdev, in pch_gbe_set_features() argument
2208 struct pch_gbe_adapter *adapter = netdev_priv(netdev); in pch_gbe_set_features()
2209 netdev_features_t changed = features ^ netdev->features; in pch_gbe_set_features()
2214 if (netif_running(netdev)) in pch_gbe_set_features()
2231 static int pch_gbe_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) in pch_gbe_ioctl() argument
2233 struct pch_gbe_adapter *adapter = netdev_priv(netdev); in pch_gbe_ioctl()
2235 netdev_dbg(netdev, "cmd : 0x%04x\n", cmd); in pch_gbe_ioctl()
2238 return hwtstamp_ioctl(netdev, ifr, cmd); in pch_gbe_ioctl()
2248 static void pch_gbe_tx_timeout(struct net_device *netdev, unsigned int txqueue) in pch_gbe_tx_timeout() argument
2250 struct pch_gbe_adapter *adapter = netdev_priv(netdev); in pch_gbe_tx_timeout()
2273 netdev_dbg(adapter->netdev, "budget : %d\n", budget); in pch_gbe_napi_poll()
2296 netdev_dbg(adapter->netdev, in pch_gbe_napi_poll()
2308 static void pch_gbe_netpoll(struct net_device *netdev) in pch_gbe_netpoll() argument
2310 struct pch_gbe_adapter *adapter = netdev_priv(netdev); in pch_gbe_netpoll()
2313 pch_gbe_intr(adapter->irq, netdev); in pch_gbe_netpoll()
2336 struct net_device *netdev = pci_get_drvdata(pdev); in pch_gbe_io_error_detected() local
2337 struct pch_gbe_adapter *adapter = netdev_priv(netdev); in pch_gbe_io_error_detected()
2339 netif_device_detach(netdev); in pch_gbe_io_error_detected()
2340 if (netif_running(netdev)) in pch_gbe_io_error_detected()
2349 struct net_device *netdev = pci_get_drvdata(pdev); in pch_gbe_io_slot_reset() local
2350 struct pch_gbe_adapter *adapter = netdev_priv(netdev); in pch_gbe_io_slot_reset()
2354 netdev_err(netdev, "Cannot re-enable PCI device after reset\n"); in pch_gbe_io_slot_reset()
2369 struct net_device *netdev = pci_get_drvdata(pdev); in pch_gbe_io_resume() local
2370 struct pch_gbe_adapter *adapter = netdev_priv(netdev); in pch_gbe_io_resume()
2372 if (netif_running(netdev)) { in pch_gbe_io_resume()
2374 netdev_dbg(netdev, in pch_gbe_io_resume()
2379 netif_device_attach(netdev); in pch_gbe_io_resume()
2384 struct net_device *netdev = pci_get_drvdata(pdev); in __pch_gbe_suspend() local
2385 struct pch_gbe_adapter *adapter = netdev_priv(netdev); in __pch_gbe_suspend()
2389 netif_device_detach(netdev); in __pch_gbe_suspend()
2390 if (netif_running(netdev)) in __pch_gbe_suspend()
2393 pch_gbe_set_multi(netdev); in __pch_gbe_suspend()
2421 struct net_device *netdev = pci_get_drvdata(pdev); in pch_gbe_resume() local
2422 struct pch_gbe_adapter *adapter = netdev_priv(netdev); in pch_gbe_resume()
2428 netdev_err(netdev, "Cannot enable PCI device from suspend\n"); in pch_gbe_resume()
2437 if (netif_running(netdev)) in pch_gbe_resume()
2439 netif_device_attach(netdev); in pch_gbe_resume()
2456 struct net_device *netdev = pci_get_drvdata(pdev); in pch_gbe_remove() local
2457 struct pch_gbe_adapter *adapter = netdev_priv(netdev); in pch_gbe_remove()
2460 unregister_netdev(netdev); in pch_gbe_remove()
2465 free_netdev(netdev); in pch_gbe_remove()
2471 struct net_device *netdev; in pch_gbe_probe() local
2495 netdev = alloc_etherdev((int)sizeof(struct pch_gbe_adapter)); in pch_gbe_probe()
2496 if (!netdev) in pch_gbe_probe()
2498 SET_NETDEV_DEV(netdev, &pdev->dev); in pch_gbe_probe()
2500 pci_set_drvdata(pdev, netdev); in pch_gbe_probe()
2501 adapter = netdev_priv(netdev); in pch_gbe_probe()
2502 adapter->netdev = netdev; in pch_gbe_probe()
2519 netdev->netdev_ops = &pch_gbe_netdev_ops; in pch_gbe_probe()
2520 netdev->watchdog_timeo = PCH_GBE_WATCHDOG_PERIOD; in pch_gbe_probe()
2521 netif_napi_add(netdev, &adapter->napi, pch_gbe_napi_poll); in pch_gbe_probe()
2522 netdev->hw_features = NETIF_F_RXCSUM | in pch_gbe_probe()
2524 netdev->features = netdev->hw_features; in pch_gbe_probe()
2525 pch_gbe_set_ethtool_ops(netdev); in pch_gbe_probe()
2528 netdev->min_mtu = ETH_ZLEN - ETH_HLEN; in pch_gbe_probe()
2529 netdev->max_mtu = PCH_GBE_MAX_JUMBO_FRAME_SIZE - in pch_gbe_probe()
2554 eth_hw_addr_set(netdev, adapter->hw.mac.addr); in pch_gbe_probe()
2555 if (!is_valid_ether_addr(netdev->dev_addr)) { in pch_gbe_probe()
2573 dev_info(&pdev->dev, "MAC address : %pM\n", netdev->dev_addr); in pch_gbe_probe()
2578 ret = register_netdev(netdev); in pch_gbe_probe()
2582 netif_carrier_off(netdev); in pch_gbe_probe()
2583 netif_stop_queue(netdev); in pch_gbe_probe()
2599 free_netdev(netdev); in pch_gbe_probe()