Lines Matching full:netdev

77 static int change_mac_addr(struct net_device *netdev, const u8 *addr);
132 struct net_device *netdev = nic_dev->netdev; in create_txqs() local
137 nic_dev->txqs = devm_kcalloc(&netdev->dev, num_txqs, in create_txqs()
147 err = hinic_init_txq(&nic_dev->txqs[i], sq, netdev); in create_txqs()
149 netif_err(nic_dev, drv, netdev, in create_txqs()
156 netif_err(nic_dev, drv, netdev, in create_txqs()
174 devm_kfree(&netdev->dev, nic_dev->txqs); in create_txqs()
204 struct net_device *netdev = nic_dev->netdev; in free_txqs() local
216 devm_kfree(&netdev->dev, nic_dev->txqs); in free_txqs()
229 struct net_device *netdev = nic_dev->netdev; in create_rxqs() local
234 nic_dev->rxqs = devm_kcalloc(&netdev->dev, num_rxqs, in create_rxqs()
244 err = hinic_init_rxq(&nic_dev->rxqs[i], rq, netdev); in create_rxqs()
246 netif_err(nic_dev, drv, netdev, in create_rxqs()
253 netif_err(nic_dev, drv, netdev, in create_rxqs()
271 devm_kfree(&netdev->dev, nic_dev->rxqs); in create_rxqs()
283 struct net_device *netdev = nic_dev->netdev; in free_rxqs() local
295 devm_kfree(&netdev->dev, nic_dev->rxqs); in free_rxqs()
365 struct net_device *netdev = nic_dev->netdev; in hinic_enable_rss() local
383 netif_err(nic_dev, drv, netdev, in hinic_enable_rss()
414 netif_err(nic_dev, drv, netdev, "Failed to init rss\n"); in hinic_enable_rss()
417 int hinic_open(struct net_device *netdev) in hinic_open() argument
419 struct hinic_dev *nic_dev = netdev_priv(netdev); in hinic_open()
427 netif_err(nic_dev, drv, netdev, in hinic_open()
435 netif_err(nic_dev, drv, netdev, in hinic_open()
444 netif_err(nic_dev, drv, netdev, in hinic_open()
453 netif_err(nic_dev, drv, nic_dev->netdev, in hinic_open()
458 netif_set_real_num_tx_queues(netdev, nic_dev->num_qps); in hinic_open()
459 netif_set_real_num_rx_queues(netdev, nic_dev->num_qps); in hinic_open()
463 netif_err(nic_dev, drv, netdev, in hinic_open()
470 netif_err(nic_dev, drv, netdev, in hinic_open()
479 netif_err(nic_dev, drv, netdev, "Failed to get link state\n"); in hinic_open()
496 netif_info(nic_dev, drv, netdev, "link + intf UP\n"); in hinic_open()
497 netif_carrier_on(netdev); in hinic_open()
498 netif_tx_wake_all_queues(netdev); in hinic_open()
503 netif_info(nic_dev, drv, netdev, "HINIC_INTF is UP\n"); in hinic_open()
510 netif_warn(nic_dev, drv, netdev, in hinic_open()
516 netif_warn(nic_dev, drv, netdev, in hinic_open()
535 int hinic_close(struct net_device *netdev) in hinic_close() argument
537 struct hinic_dev *nic_dev = netdev_priv(netdev); in hinic_close()
548 netif_carrier_off(netdev); in hinic_close()
549 netif_tx_disable(netdev); in hinic_close()
571 netif_info(nic_dev, drv, netdev, "HINIC_INTF is DOWN\n"); in hinic_close()
575 static int hinic_change_mtu(struct net_device *netdev, int new_mtu) in hinic_change_mtu() argument
577 struct hinic_dev *nic_dev = netdev_priv(netdev); in hinic_change_mtu()
580 netif_info(nic_dev, drv, netdev, "set_mtu = %d\n", new_mtu); in hinic_change_mtu()
584 netif_err(nic_dev, drv, netdev, "Failed to set port mtu\n"); in hinic_change_mtu()
586 WRITE_ONCE(netdev->mtu, new_mtu); in hinic_change_mtu()
593 * @netdev: network device
598 static int change_mac_addr(struct net_device *netdev, const u8 *addr) in change_mac_addr() argument
600 struct hinic_dev *nic_dev = netdev_priv(netdev); in change_mac_addr()
607 netif_info(nic_dev, drv, netdev, "change mac addr = %02x %02x %02x %02x %02x %02x\n", in change_mac_addr()
613 err = hinic_port_del_mac(nic_dev, netdev->dev_addr, vid); in change_mac_addr()
615 netif_err(nic_dev, drv, netdev, in change_mac_addr()
622 netif_err(nic_dev, drv, netdev, "Failed to add mac\n"); in change_mac_addr()
633 static int hinic_set_mac_addr(struct net_device *netdev, void *addr) in hinic_set_mac_addr() argument
641 err = change_mac_addr(netdev, new_mac); in hinic_set_mac_addr()
643 eth_hw_addr_set(netdev, new_mac); in hinic_set_mac_addr()
650 * @netdev: network device
655 static int add_mac_addr(struct net_device *netdev, const u8 *addr) in add_mac_addr() argument
657 struct hinic_dev *nic_dev = netdev_priv(netdev); in add_mac_addr()
661 netif_info(nic_dev, drv, netdev, "set mac addr = %02x %02x %02x %02x %02x %02x\n", in add_mac_addr()
669 netif_err(nic_dev, drv, netdev, "Failed to add mac\n"); in add_mac_addr()
682 * @netdev: network device
687 static int remove_mac_addr(struct net_device *netdev, const u8 *addr) in remove_mac_addr() argument
689 struct hinic_dev *nic_dev = netdev_priv(netdev); in remove_mac_addr()
696 netif_info(nic_dev, drv, netdev, "remove mac addr = %02x %02x %02x %02x %02x %02x\n", in remove_mac_addr()
704 netif_err(nic_dev, drv, netdev, in remove_mac_addr()
716 static int hinic_vlan_rx_add_vid(struct net_device *netdev, in hinic_vlan_rx_add_vid() argument
719 struct hinic_dev *nic_dev = netdev_priv(netdev); in hinic_vlan_rx_add_vid()
722 netif_info(nic_dev, drv, netdev, "add vid = %d\n", vid); in hinic_vlan_rx_add_vid()
728 netif_err(nic_dev, drv, netdev, "Failed to add vlan\n"); in hinic_vlan_rx_add_vid()
732 err = hinic_port_add_mac(nic_dev, netdev->dev_addr, vid); in hinic_vlan_rx_add_vid()
734 netif_err(nic_dev, drv, netdev, "Failed to set mac\n"); in hinic_vlan_rx_add_vid()
746 netif_err(nic_dev, drv, netdev, in hinic_vlan_rx_add_vid()
754 static int hinic_vlan_rx_kill_vid(struct net_device *netdev, in hinic_vlan_rx_kill_vid() argument
757 struct hinic_dev *nic_dev = netdev_priv(netdev); in hinic_vlan_rx_kill_vid()
760 netif_info(nic_dev, drv, netdev, "remove vid = %d\n", vid); in hinic_vlan_rx_kill_vid()
766 netif_err(nic_dev, drv, netdev, "Failed to delete vlan\n"); in hinic_vlan_rx_kill_vid()
787 __dev_uc_sync(nic_dev->netdev, add_mac_addr, remove_mac_addr); in set_rx_mode()
788 __dev_mc_sync(nic_dev->netdev, add_mac_addr, remove_mac_addr); in set_rx_mode()
791 static void hinic_set_rx_mode(struct net_device *netdev) in hinic_set_rx_mode() argument
793 struct hinic_dev *nic_dev = netdev_priv(netdev); in hinic_set_rx_mode()
803 if (netdev->flags & IFF_PROMISC) { in hinic_set_rx_mode()
806 } else if (netdev->flags & IFF_ALLMULTI) { in hinic_set_rx_mode()
815 static void hinic_tx_timeout(struct net_device *netdev, unsigned int txqueue) in hinic_tx_timeout() argument
817 struct hinic_dev *nic_dev = netdev_priv(netdev); in hinic_tx_timeout()
824 netif_err(nic_dev, drv, netdev, "Tx timeout\n"); in hinic_tx_timeout()
827 if (!netif_xmit_stopped(netdev_get_tx_queue(netdev, q_id))) in hinic_tx_timeout()
834 netif_err(nic_dev, drv, netdev, "Txq%d: sw_pi: %d, hw_ci: %d, sw_ci: %d, napi->state: 0x%lx\n", in hinic_tx_timeout()
840 static void hinic_get_stats64(struct net_device *netdev, in hinic_get_stats64() argument
843 struct hinic_dev *nic_dev = netdev_priv(netdev); in hinic_get_stats64()
859 static int hinic_set_features(struct net_device *netdev, in hinic_set_features() argument
862 struct hinic_dev *nic_dev = netdev_priv(netdev); in hinic_set_features()
864 return set_features(nic_dev, nic_dev->netdev->features, in hinic_set_features()
868 static netdev_features_t hinic_fix_features(struct net_device *netdev, in hinic_fix_features() argument
871 struct hinic_dev *nic_dev = netdev_priv(netdev); in hinic_fix_features()
875 netif_info(nic_dev, drv, netdev, "disabling LRO as RXCSUM is off\n"); in hinic_fix_features()
921 static void netdev_features_init(struct net_device *netdev) in netdev_features_init() argument
923 netdev->hw_features = NETIF_F_SG | NETIF_F_HIGHDMA | NETIF_F_IP_CSUM | in netdev_features_init()
929 netdev->vlan_features = netdev->hw_features; in netdev_features_init()
931 netdev->features = netdev->hw_features | NETIF_F_HW_VLAN_CTAG_FILTER; in netdev_features_init()
933 netdev->hw_enc_features = NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_SCTP_CRC | in netdev_features_init()
983 netif_carrier_on(nic_dev->netdev); in link_status_event_handler()
984 netif_tx_wake_all_queues(nic_dev->netdev); in link_status_event_handler()
992 netif_info(nic_dev, drv, nic_dev->netdev, "HINIC_Link is UP\n"); in link_status_event_handler()
998 netif_carrier_off(nic_dev->netdev); in link_status_event_handler()
999 netif_tx_disable(nic_dev->netdev); in link_status_event_handler()
1003 netif_info(nic_dev, drv, nic_dev->netdev, "HINIC_Link is DOWN\n"); in link_status_event_handler()
1038 netif_info(nic_dev, link, nic_dev->netdev, in link_err_event()
1108 nic_dev->netdev->features = features ^ failed_features; in set_features()
1164 struct net_device *netdev; in nic_dev_init() local
1190 netdev = alloc_etherdev_mq(sizeof(*nic_dev), num_qps); in nic_dev_init()
1191 if (!netdev) { in nic_dev_init()
1198 netdev->netdev_ops = &hinic_netdev_ops; in nic_dev_init()
1200 netdev->netdev_ops = &hinicvf_netdev_ops; in nic_dev_init()
1202 netdev->max_mtu = HINIC_MAX_MTU_SIZE; in nic_dev_init()
1203 netdev->min_mtu = HINIC_MIN_MTU_SIZE; in nic_dev_init()
1205 nic_dev = netdev_priv(netdev); in nic_dev_init()
1206 nic_dev->netdev = netdev; in nic_dev_init()
1221 hinic_set_ethtool_ops(netdev); in nic_dev_init()
1238 pci_set_drvdata(pdev, netdev); in nic_dev_init()
1245 eth_hw_addr_set(netdev, addr); in nic_dev_init()
1247 if (!is_valid_ether_addr(netdev->dev_addr)) { in nic_dev_init()
1255 netdev->dev_addr); in nic_dev_init()
1256 eth_hw_addr_random(netdev); in nic_dev_init()
1259 err = hinic_port_add_mac(nic_dev, netdev->dev_addr, 0); in nic_dev_init()
1265 err = hinic_port_set_mtu(nic_dev, netdev->mtu); in nic_dev_init()
1274 netdev_features_init(netdev); in nic_dev_init()
1276 netif_carrier_off(netdev); in nic_dev_init()
1287 err = set_features(nic_dev, 0, nic_dev->netdev->features, true); in nic_dev_init()
1296 SET_NETDEV_DEV(netdev, &pdev->dev); in nic_dev_init()
1314 err = register_netdev(netdev); in nic_dev_init()
1316 dev_err(&pdev->dev, "Failed to register netdev\n"); in nic_dev_init()
1340 hinic_port_del_mac(nic_dev, netdev->dev_addr, 0); in nic_dev_init()
1347 free_netdev(netdev); in nic_dev_init()
1416 struct net_device *netdev = pci_get_drvdata(pdev); in hinic_remove() local
1417 struct hinic_dev *nic_dev = netdev_priv(netdev); in hinic_remove()
1426 unregister_netdev(netdev); in hinic_remove()
1436 hinic_port_del_mac(nic_dev, netdev->dev_addr, 0); in hinic_remove()
1454 free_netdev(netdev); in hinic_remove()