Lines Matching refs:netdev
79 static int change_mac_addr(struct net_device *netdev, const u8 *addr);
146 struct net_device *netdev = nic_dev->netdev; in create_txqs() local
153 nic_dev->txqs = devm_kzalloc(&netdev->dev, txq_size, GFP_KERNEL); in create_txqs()
162 err = hinic_init_txq(&nic_dev->txqs[i], sq, netdev); in create_txqs()
164 netif_err(nic_dev, drv, netdev, in create_txqs()
171 netif_err(nic_dev, drv, netdev, in create_txqs()
190 devm_kfree(&netdev->dev, nic_dev->txqs); in create_txqs()
219 struct net_device *netdev = nic_dev->netdev; in free_txqs() local
231 devm_kfree(&netdev->dev, nic_dev->txqs); in free_txqs()
244 struct net_device *netdev = nic_dev->netdev; in create_rxqs() local
251 nic_dev->rxqs = devm_kzalloc(&netdev->dev, rxq_size, GFP_KERNEL); in create_rxqs()
260 err = hinic_init_rxq(&nic_dev->rxqs[i], rq, netdev); in create_rxqs()
262 netif_err(nic_dev, drv, netdev, in create_rxqs()
269 netif_err(nic_dev, drv, netdev, in create_rxqs()
287 devm_kfree(&netdev->dev, nic_dev->rxqs); in create_rxqs()
298 struct net_device *netdev = nic_dev->netdev; in free_rxqs() local
310 devm_kfree(&netdev->dev, nic_dev->rxqs); in free_rxqs()
386 struct net_device *netdev = nic_dev->netdev; in hinic_enable_rss() local
404 netif_err(nic_dev, drv, netdev, in hinic_enable_rss()
435 netif_err(nic_dev, drv, netdev, "Failed to init rss\n"); in hinic_enable_rss()
438 int hinic_open(struct net_device *netdev) in hinic_open() argument
440 struct hinic_dev *nic_dev = netdev_priv(netdev); in hinic_open()
448 netif_err(nic_dev, drv, netdev, in hinic_open()
456 netif_err(nic_dev, drv, netdev, in hinic_open()
465 netif_err(nic_dev, drv, netdev, in hinic_open()
474 netif_err(nic_dev, drv, nic_dev->netdev, in hinic_open()
479 netif_set_real_num_tx_queues(netdev, nic_dev->num_qps); in hinic_open()
480 netif_set_real_num_rx_queues(netdev, nic_dev->num_qps); in hinic_open()
484 netif_err(nic_dev, drv, netdev, in hinic_open()
491 netif_err(nic_dev, drv, netdev, in hinic_open()
500 netif_err(nic_dev, drv, netdev, "Failed to get link state\n"); in hinic_open()
517 netif_info(nic_dev, drv, netdev, "link + intf UP\n"); in hinic_open()
518 netif_carrier_on(netdev); in hinic_open()
519 netif_tx_wake_all_queues(netdev); in hinic_open()
524 netif_info(nic_dev, drv, netdev, "HINIC_INTF is UP\n"); in hinic_open()
531 netif_warn(nic_dev, drv, netdev, in hinic_open()
537 netif_warn(nic_dev, drv, netdev, in hinic_open()
556 int hinic_close(struct net_device *netdev) in hinic_close() argument
558 struct hinic_dev *nic_dev = netdev_priv(netdev); in hinic_close()
569 netif_carrier_off(netdev); in hinic_close()
570 netif_tx_disable(netdev); in hinic_close()
594 netif_info(nic_dev, drv, netdev, "HINIC_INTF is DOWN\n"); in hinic_close()
598 static int hinic_change_mtu(struct net_device *netdev, int new_mtu) in hinic_change_mtu() argument
600 struct hinic_dev *nic_dev = netdev_priv(netdev); in hinic_change_mtu()
603 netif_info(nic_dev, drv, netdev, "set_mtu = %d\n", new_mtu); in hinic_change_mtu()
607 netif_err(nic_dev, drv, netdev, "Failed to set port mtu\n"); in hinic_change_mtu()
609 netdev->mtu = new_mtu; in hinic_change_mtu()
621 static int change_mac_addr(struct net_device *netdev, const u8 *addr) in change_mac_addr() argument
623 struct hinic_dev *nic_dev = netdev_priv(netdev); in change_mac_addr()
630 netif_info(nic_dev, drv, netdev, "change mac addr = %02x %02x %02x %02x %02x %02x\n", in change_mac_addr()
636 err = hinic_port_del_mac(nic_dev, netdev->dev_addr, vid); in change_mac_addr()
638 netif_err(nic_dev, drv, netdev, in change_mac_addr()
645 netif_err(nic_dev, drv, netdev, "Failed to add mac\n"); in change_mac_addr()
656 static int hinic_set_mac_addr(struct net_device *netdev, void *addr) in hinic_set_mac_addr() argument
664 err = change_mac_addr(netdev, new_mac); in hinic_set_mac_addr()
666 memcpy(netdev->dev_addr, new_mac, ETH_ALEN); in hinic_set_mac_addr()
678 static int add_mac_addr(struct net_device *netdev, const u8 *addr) in add_mac_addr() argument
680 struct hinic_dev *nic_dev = netdev_priv(netdev); in add_mac_addr()
684 netif_info(nic_dev, drv, netdev, "set mac addr = %02x %02x %02x %02x %02x %02x\n", in add_mac_addr()
692 netif_err(nic_dev, drv, netdev, "Failed to add mac\n"); in add_mac_addr()
710 static int remove_mac_addr(struct net_device *netdev, const u8 *addr) in remove_mac_addr() argument
712 struct hinic_dev *nic_dev = netdev_priv(netdev); in remove_mac_addr()
719 netif_info(nic_dev, drv, netdev, "remove mac addr = %02x %02x %02x %02x %02x %02x\n", in remove_mac_addr()
727 netif_err(nic_dev, drv, netdev, in remove_mac_addr()
739 static int hinic_vlan_rx_add_vid(struct net_device *netdev, in hinic_vlan_rx_add_vid() argument
742 struct hinic_dev *nic_dev = netdev_priv(netdev); in hinic_vlan_rx_add_vid()
745 netif_info(nic_dev, drv, netdev, "add vid = %d\n", vid); in hinic_vlan_rx_add_vid()
751 netif_err(nic_dev, drv, netdev, "Failed to add vlan\n"); in hinic_vlan_rx_add_vid()
755 err = hinic_port_add_mac(nic_dev, netdev->dev_addr, vid); in hinic_vlan_rx_add_vid()
757 netif_err(nic_dev, drv, netdev, "Failed to set mac\n"); in hinic_vlan_rx_add_vid()
769 netif_err(nic_dev, drv, netdev, in hinic_vlan_rx_add_vid()
777 static int hinic_vlan_rx_kill_vid(struct net_device *netdev, in hinic_vlan_rx_kill_vid() argument
780 struct hinic_dev *nic_dev = netdev_priv(netdev); in hinic_vlan_rx_kill_vid()
783 netif_info(nic_dev, drv, netdev, "remove vid = %d\n", vid); in hinic_vlan_rx_kill_vid()
789 netif_err(nic_dev, drv, netdev, "Failed to delete vlan\n"); in hinic_vlan_rx_kill_vid()
810 __dev_uc_sync(nic_dev->netdev, add_mac_addr, remove_mac_addr); in set_rx_mode()
811 __dev_mc_sync(nic_dev->netdev, add_mac_addr, remove_mac_addr); in set_rx_mode()
814 static void hinic_set_rx_mode(struct net_device *netdev) in hinic_set_rx_mode() argument
816 struct hinic_dev *nic_dev = netdev_priv(netdev); in hinic_set_rx_mode()
826 if (netdev->flags & IFF_PROMISC) { in hinic_set_rx_mode()
829 } else if (netdev->flags & IFF_ALLMULTI) { in hinic_set_rx_mode()
838 static void hinic_tx_timeout(struct net_device *netdev, unsigned int txqueue) in hinic_tx_timeout() argument
840 struct hinic_dev *nic_dev = netdev_priv(netdev); in hinic_tx_timeout()
847 netif_err(nic_dev, drv, netdev, "Tx timeout\n"); in hinic_tx_timeout()
850 if (!netif_xmit_stopped(netdev_get_tx_queue(netdev, q_id))) in hinic_tx_timeout()
857 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()
863 static void hinic_get_stats64(struct net_device *netdev, in hinic_get_stats64() argument
866 struct hinic_dev *nic_dev = netdev_priv(netdev); in hinic_get_stats64()
889 static int hinic_set_features(struct net_device *netdev, in hinic_set_features() argument
892 struct hinic_dev *nic_dev = netdev_priv(netdev); in hinic_set_features()
894 return set_features(nic_dev, nic_dev->netdev->features, in hinic_set_features()
898 static netdev_features_t hinic_fix_features(struct net_device *netdev, in hinic_fix_features() argument
901 struct hinic_dev *nic_dev = netdev_priv(netdev); in hinic_fix_features()
905 netif_info(nic_dev, drv, netdev, "disabling LRO as RXCSUM is off\n"); in hinic_fix_features()
951 static void netdev_features_init(struct net_device *netdev) in netdev_features_init() argument
953 netdev->hw_features = NETIF_F_SG | NETIF_F_HIGHDMA | NETIF_F_IP_CSUM | in netdev_features_init()
959 netdev->vlan_features = netdev->hw_features; in netdev_features_init()
961 netdev->features = netdev->hw_features | NETIF_F_HW_VLAN_CTAG_FILTER; in netdev_features_init()
963 netdev->hw_enc_features = NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_SCTP_CRC | in netdev_features_init()
1015 netif_carrier_on(nic_dev->netdev); in link_status_event_handler()
1016 netif_tx_wake_all_queues(nic_dev->netdev); in link_status_event_handler()
1024 netif_info(nic_dev, drv, nic_dev->netdev, "HINIC_Link is UP\n"); in link_status_event_handler()
1030 netif_carrier_off(nic_dev->netdev); in link_status_event_handler()
1031 netif_tx_disable(nic_dev->netdev); in link_status_event_handler()
1035 netif_info(nic_dev, drv, nic_dev->netdev, "HINIC_Link is DOWN\n"); in link_status_event_handler()
1070 netif_info(nic_dev, link, nic_dev->netdev, in link_err_event()
1130 nic_dev->netdev->features = features ^ failed_features; in set_features()
1188 struct net_device *netdev; in nic_dev_init() local
1213 netdev = alloc_etherdev_mq(sizeof(*nic_dev), num_qps); in nic_dev_init()
1214 if (!netdev) { in nic_dev_init()
1221 netdev->netdev_ops = &hinic_netdev_ops; in nic_dev_init()
1223 netdev->netdev_ops = &hinicvf_netdev_ops; in nic_dev_init()
1225 netdev->max_mtu = ETH_MAX_MTU; in nic_dev_init()
1227 nic_dev = netdev_priv(netdev); in nic_dev_init()
1228 nic_dev->netdev = netdev; in nic_dev_init()
1243 hinic_set_ethtool_ops(netdev); in nic_dev_init()
1267 pci_set_drvdata(pdev, netdev); in nic_dev_init()
1269 err = hinic_port_get_mac(nic_dev, netdev->dev_addr); in nic_dev_init()
1275 if (!is_valid_ether_addr(netdev->dev_addr)) { in nic_dev_init()
1283 netdev->dev_addr); in nic_dev_init()
1284 eth_hw_addr_random(netdev); in nic_dev_init()
1287 err = hinic_port_add_mac(nic_dev, netdev->dev_addr, 0); in nic_dev_init()
1293 err = hinic_port_set_mtu(nic_dev, netdev->mtu); in nic_dev_init()
1302 netdev_features_init(netdev); in nic_dev_init()
1304 netif_carrier_off(netdev); in nic_dev_init()
1315 err = set_features(nic_dev, 0, nic_dev->netdev->features, true); in nic_dev_init()
1324 SET_NETDEV_DEV(netdev, &pdev->dev); in nic_dev_init()
1342 err = register_netdev(netdev); in nic_dev_init()
1368 hinic_port_del_mac(nic_dev, netdev->dev_addr, 0); in nic_dev_init()
1375 free_netdev(netdev); in nic_dev_init()
1465 struct net_device *netdev = pci_get_drvdata(pdev); in hinic_remove() local
1466 struct hinic_dev *nic_dev = netdev_priv(netdev); in hinic_remove()
1475 unregister_netdev(netdev); in hinic_remove()
1485 hinic_port_del_mac(nic_dev, netdev->dev_addr, 0); in hinic_remove()
1503 free_netdev(netdev); in hinic_remove()