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