Lines Matching refs: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()
203 struct net_device *netdev = nic_dev->netdev; in free_txqs() local
215 devm_kfree(&netdev->dev, nic_dev->txqs); in free_txqs()
228 struct net_device *netdev = nic_dev->netdev; in create_rxqs() local
233 nic_dev->rxqs = devm_kcalloc(&netdev->dev, num_rxqs, in create_rxqs()
243 err = hinic_init_rxq(&nic_dev->rxqs[i], rq, netdev); in create_rxqs()
245 netif_err(nic_dev, drv, netdev, in create_rxqs()
252 netif_err(nic_dev, drv, netdev, in create_rxqs()
270 devm_kfree(&netdev->dev, nic_dev->rxqs); in create_rxqs()
281 struct net_device *netdev = nic_dev->netdev; in free_rxqs() local
293 devm_kfree(&netdev->dev, nic_dev->rxqs); in free_rxqs()
363 struct net_device *netdev = nic_dev->netdev; in hinic_enable_rss() local
381 netif_err(nic_dev, drv, netdev, in hinic_enable_rss()
412 netif_err(nic_dev, drv, netdev, "Failed to init rss\n"); in hinic_enable_rss()
415 int hinic_open(struct net_device *netdev) in hinic_open() argument
417 struct hinic_dev *nic_dev = netdev_priv(netdev); in hinic_open()
425 netif_err(nic_dev, drv, netdev, in hinic_open()
433 netif_err(nic_dev, drv, netdev, in hinic_open()
442 netif_err(nic_dev, drv, netdev, in hinic_open()
451 netif_err(nic_dev, drv, nic_dev->netdev, in hinic_open()
456 netif_set_real_num_tx_queues(netdev, nic_dev->num_qps); in hinic_open()
457 netif_set_real_num_rx_queues(netdev, nic_dev->num_qps); in hinic_open()
461 netif_err(nic_dev, drv, netdev, in hinic_open()
468 netif_err(nic_dev, drv, netdev, in hinic_open()
477 netif_err(nic_dev, drv, netdev, "Failed to get link state\n"); in hinic_open()
494 netif_info(nic_dev, drv, netdev, "link + intf UP\n"); in hinic_open()
495 netif_carrier_on(netdev); in hinic_open()
496 netif_tx_wake_all_queues(netdev); in hinic_open()
501 netif_info(nic_dev, drv, netdev, "HINIC_INTF is UP\n"); in hinic_open()
508 netif_warn(nic_dev, drv, netdev, in hinic_open()
514 netif_warn(nic_dev, drv, netdev, in hinic_open()
533 int hinic_close(struct net_device *netdev) in hinic_close() argument
535 struct hinic_dev *nic_dev = netdev_priv(netdev); in hinic_close()
546 netif_carrier_off(netdev); in hinic_close()
547 netif_tx_disable(netdev); in hinic_close()
569 netif_info(nic_dev, drv, netdev, "HINIC_INTF is DOWN\n"); in hinic_close()
573 static int hinic_change_mtu(struct net_device *netdev, int new_mtu) in hinic_change_mtu() argument
575 struct hinic_dev *nic_dev = netdev_priv(netdev); in hinic_change_mtu()
578 netif_info(nic_dev, drv, netdev, "set_mtu = %d\n", new_mtu); in hinic_change_mtu()
582 netif_err(nic_dev, drv, netdev, "Failed to set port mtu\n"); in hinic_change_mtu()
584 netdev->mtu = new_mtu; in hinic_change_mtu()
596 static int change_mac_addr(struct net_device *netdev, const u8 *addr) in change_mac_addr() argument
598 struct hinic_dev *nic_dev = netdev_priv(netdev); in change_mac_addr()
605 netif_info(nic_dev, drv, netdev, "change mac addr = %02x %02x %02x %02x %02x %02x\n", in change_mac_addr()
611 err = hinic_port_del_mac(nic_dev, netdev->dev_addr, vid); in change_mac_addr()
613 netif_err(nic_dev, drv, netdev, in change_mac_addr()
620 netif_err(nic_dev, drv, netdev, "Failed to add mac\n"); in change_mac_addr()
631 static int hinic_set_mac_addr(struct net_device *netdev, void *addr) in hinic_set_mac_addr() argument
639 err = change_mac_addr(netdev, new_mac); in hinic_set_mac_addr()
641 eth_hw_addr_set(netdev, new_mac); in hinic_set_mac_addr()
653 static int add_mac_addr(struct net_device *netdev, const u8 *addr) in add_mac_addr() argument
655 struct hinic_dev *nic_dev = netdev_priv(netdev); in add_mac_addr()
659 netif_info(nic_dev, drv, netdev, "set mac addr = %02x %02x %02x %02x %02x %02x\n", in add_mac_addr()
667 netif_err(nic_dev, drv, netdev, "Failed to add mac\n"); in add_mac_addr()
685 static int remove_mac_addr(struct net_device *netdev, const u8 *addr) in remove_mac_addr() argument
687 struct hinic_dev *nic_dev = netdev_priv(netdev); in remove_mac_addr()
694 netif_info(nic_dev, drv, netdev, "remove mac addr = %02x %02x %02x %02x %02x %02x\n", in remove_mac_addr()
702 netif_err(nic_dev, drv, netdev, in remove_mac_addr()
714 static int hinic_vlan_rx_add_vid(struct net_device *netdev, in hinic_vlan_rx_add_vid() argument
717 struct hinic_dev *nic_dev = netdev_priv(netdev); in hinic_vlan_rx_add_vid()
720 netif_info(nic_dev, drv, netdev, "add vid = %d\n", vid); in hinic_vlan_rx_add_vid()
726 netif_err(nic_dev, drv, netdev, "Failed to add vlan\n"); in hinic_vlan_rx_add_vid()
730 err = hinic_port_add_mac(nic_dev, netdev->dev_addr, vid); in hinic_vlan_rx_add_vid()
732 netif_err(nic_dev, drv, netdev, "Failed to set mac\n"); in hinic_vlan_rx_add_vid()
744 netif_err(nic_dev, drv, netdev, in hinic_vlan_rx_add_vid()
752 static int hinic_vlan_rx_kill_vid(struct net_device *netdev, in hinic_vlan_rx_kill_vid() argument
755 struct hinic_dev *nic_dev = netdev_priv(netdev); in hinic_vlan_rx_kill_vid()
758 netif_info(nic_dev, drv, netdev, "remove vid = %d\n", vid); in hinic_vlan_rx_kill_vid()
764 netif_err(nic_dev, drv, netdev, "Failed to delete vlan\n"); in hinic_vlan_rx_kill_vid()
785 __dev_uc_sync(nic_dev->netdev, add_mac_addr, remove_mac_addr); in set_rx_mode()
786 __dev_mc_sync(nic_dev->netdev, add_mac_addr, remove_mac_addr); in set_rx_mode()
789 static void hinic_set_rx_mode(struct net_device *netdev) in hinic_set_rx_mode() argument
791 struct hinic_dev *nic_dev = netdev_priv(netdev); in hinic_set_rx_mode()
801 if (netdev->flags & IFF_PROMISC) { in hinic_set_rx_mode()
804 } else if (netdev->flags & IFF_ALLMULTI) { in hinic_set_rx_mode()
813 static void hinic_tx_timeout(struct net_device *netdev, unsigned int txqueue) in hinic_tx_timeout() argument
815 struct hinic_dev *nic_dev = netdev_priv(netdev); in hinic_tx_timeout()
822 netif_err(nic_dev, drv, netdev, "Tx timeout\n"); in hinic_tx_timeout()
825 if (!netif_xmit_stopped(netdev_get_tx_queue(netdev, q_id))) in hinic_tx_timeout()
832 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()
838 static void hinic_get_stats64(struct net_device *netdev, in hinic_get_stats64() argument
841 struct hinic_dev *nic_dev = netdev_priv(netdev); in hinic_get_stats64()
857 static int hinic_set_features(struct net_device *netdev, in hinic_set_features() argument
860 struct hinic_dev *nic_dev = netdev_priv(netdev); in hinic_set_features()
862 return set_features(nic_dev, nic_dev->netdev->features, in hinic_set_features()
866 static netdev_features_t hinic_fix_features(struct net_device *netdev, in hinic_fix_features() argument
869 struct hinic_dev *nic_dev = netdev_priv(netdev); in hinic_fix_features()
873 netif_info(nic_dev, drv, netdev, "disabling LRO as RXCSUM is off\n"); in hinic_fix_features()
919 static void netdev_features_init(struct net_device *netdev) in netdev_features_init() argument
921 netdev->hw_features = NETIF_F_SG | NETIF_F_HIGHDMA | NETIF_F_IP_CSUM | in netdev_features_init()
927 netdev->vlan_features = netdev->hw_features; in netdev_features_init()
929 netdev->features = netdev->hw_features | NETIF_F_HW_VLAN_CTAG_FILTER; in netdev_features_init()
931 netdev->hw_enc_features = NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_SCTP_CRC | in netdev_features_init()
981 netif_carrier_on(nic_dev->netdev); in link_status_event_handler()
982 netif_tx_wake_all_queues(nic_dev->netdev); in link_status_event_handler()
990 netif_info(nic_dev, drv, nic_dev->netdev, "HINIC_Link is UP\n"); in link_status_event_handler()
996 netif_carrier_off(nic_dev->netdev); in link_status_event_handler()
997 netif_tx_disable(nic_dev->netdev); in link_status_event_handler()
1001 netif_info(nic_dev, drv, nic_dev->netdev, "HINIC_Link is DOWN\n"); in link_status_event_handler()
1036 netif_info(nic_dev, link, nic_dev->netdev, in link_err_event()
1106 nic_dev->netdev->features = features ^ failed_features; in set_features()
1162 struct net_device *netdev; in nic_dev_init() local
1188 netdev = alloc_etherdev_mq(sizeof(*nic_dev), num_qps); in nic_dev_init()
1189 if (!netdev) { in nic_dev_init()
1196 netdev->netdev_ops = &hinic_netdev_ops; in nic_dev_init()
1198 netdev->netdev_ops = &hinicvf_netdev_ops; in nic_dev_init()
1200 netdev->max_mtu = HINIC_MAX_MTU_SIZE; in nic_dev_init()
1201 netdev->min_mtu = HINIC_MIN_MTU_SIZE; in nic_dev_init()
1203 nic_dev = netdev_priv(netdev); in nic_dev_init()
1204 nic_dev->netdev = netdev; in nic_dev_init()
1219 hinic_set_ethtool_ops(netdev); in nic_dev_init()
1236 pci_set_drvdata(pdev, netdev); in nic_dev_init()
1243 eth_hw_addr_set(netdev, addr); in nic_dev_init()
1245 if (!is_valid_ether_addr(netdev->dev_addr)) { in nic_dev_init()
1253 netdev->dev_addr); in nic_dev_init()
1254 eth_hw_addr_random(netdev); in nic_dev_init()
1257 err = hinic_port_add_mac(nic_dev, netdev->dev_addr, 0); in nic_dev_init()
1263 err = hinic_port_set_mtu(nic_dev, netdev->mtu); in nic_dev_init()
1272 netdev_features_init(netdev); in nic_dev_init()
1274 netif_carrier_off(netdev); in nic_dev_init()
1285 err = set_features(nic_dev, 0, nic_dev->netdev->features, true); in nic_dev_init()
1294 SET_NETDEV_DEV(netdev, &pdev->dev); in nic_dev_init()
1312 err = register_netdev(netdev); in nic_dev_init()
1338 hinic_port_del_mac(nic_dev, netdev->dev_addr, 0); in nic_dev_init()
1345 free_netdev(netdev); in nic_dev_init()
1414 struct net_device *netdev = pci_get_drvdata(pdev); in hinic_remove() local
1415 struct hinic_dev *nic_dev = netdev_priv(netdev); in hinic_remove()
1424 unregister_netdev(netdev); in hinic_remove()
1434 hinic_port_del_mac(nic_dev, netdev->dev_addr, 0); in hinic_remove()
1452 free_netdev(netdev); in hinic_remove()