Lines Matching refs:ndp

33 bool ncsi_channel_is_last(struct ncsi_dev_priv *ndp,  in ncsi_channel_is_last()  argument
39 NCSI_FOR_EACH_PACKAGE(ndp, np) in ncsi_channel_is_last()
51 static void ncsi_report_link(struct ncsi_dev_priv *ndp, bool force_down) in ncsi_report_link() argument
53 struct ncsi_dev *nd = &ndp->ndev; in ncsi_report_link()
65 NCSI_FOR_EACH_PACKAGE(ndp, np) { in ncsi_report_link()
93 struct ncsi_dev_priv *ndp = np->ndp; in ncsi_channel_monitor() local
116 netdev_warn(ndp->ndev.dev, in ncsi_channel_monitor()
128 nca.ndp = ndp; in ncsi_channel_monitor()
135 netdev_err(ndp->ndev.dev, "Error %d sending GLS\n", in ncsi_channel_monitor()
141 netdev_err(ndp->ndev.dev, "NCSI Channel %d timed out!\n", in ncsi_channel_monitor()
143 ncsi_report_link(ndp, true); in ncsi_channel_monitor()
144 ndp->flags |= NCSI_DEV_RESHUFFLE; in ncsi_channel_monitor()
153 spin_lock_irqsave(&ndp->lock, flags); in ncsi_channel_monitor()
155 list_add_tail_rcu(&nc->link, &ndp->channel_queue); in ncsi_channel_monitor()
156 spin_unlock_irqrestore(&ndp->lock, flags); in ncsi_channel_monitor()
157 ncsi_process_next_channel(ndp); in ncsi_channel_monitor()
269 struct ncsi_package *ncsi_find_package(struct ncsi_dev_priv *ndp, in ncsi_find_package() argument
274 NCSI_FOR_EACH_PACKAGE(ndp, np) { in ncsi_find_package()
282 struct ncsi_package *ncsi_add_package(struct ncsi_dev_priv *ndp, in ncsi_add_package() argument
293 np->ndp = ndp; in ncsi_add_package()
298 spin_lock_irqsave(&ndp->lock, flags); in ncsi_add_package()
299 tmp = ncsi_find_package(ndp, id); in ncsi_add_package()
301 spin_unlock_irqrestore(&ndp->lock, flags); in ncsi_add_package()
306 list_add_tail_rcu(&np->node, &ndp->packages); in ncsi_add_package()
307 ndp->package_num++; in ncsi_add_package()
308 spin_unlock_irqrestore(&ndp->lock, flags); in ncsi_add_package()
315 struct ncsi_dev_priv *ndp = np->ndp; in ncsi_remove_package() local
324 spin_lock_irqsave(&ndp->lock, flags); in ncsi_remove_package()
326 ndp->package_num--; in ncsi_remove_package()
327 spin_unlock_irqrestore(&ndp->lock, flags); in ncsi_remove_package()
332 void ncsi_find_package_and_channel(struct ncsi_dev_priv *ndp, in ncsi_find_package_and_channel() argument
340 p = ncsi_find_package(ndp, NCSI_PACKAGE_INDEX(id)); in ncsi_find_package_and_channel()
353 struct ncsi_request *ncsi_alloc_request(struct ncsi_dev_priv *ndp, in ncsi_alloc_request() argument
357 int i, limit = ARRAY_SIZE(ndp->requests); in ncsi_alloc_request()
361 spin_lock_irqsave(&ndp->lock, flags); in ncsi_alloc_request()
362 for (i = ndp->request_id; i < limit; i++) { in ncsi_alloc_request()
363 if (ndp->requests[i].used) in ncsi_alloc_request()
366 nr = &ndp->requests[i]; in ncsi_alloc_request()
369 ndp->request_id = i + 1; in ncsi_alloc_request()
374 for (i = NCSI_REQ_START_IDX; i < ndp->request_id; i++) { in ncsi_alloc_request()
375 if (ndp->requests[i].used) in ncsi_alloc_request()
378 nr = &ndp->requests[i]; in ncsi_alloc_request()
381 ndp->request_id = i + 1; in ncsi_alloc_request()
386 spin_unlock_irqrestore(&ndp->lock, flags); in ncsi_alloc_request()
392 struct ncsi_dev_priv *ndp = nr->ndp; in ncsi_free_request() local
402 spin_lock_irqsave(&ndp->lock, flags); in ncsi_free_request()
409 spin_unlock_irqrestore(&ndp->lock, flags); in ncsi_free_request()
411 if (driven && cmd && --ndp->pending_req_num == 0) in ncsi_free_request()
412 schedule_work(&ndp->work); in ncsi_free_request()
421 struct ncsi_dev_priv *ndp; in ncsi_find_dev() local
423 NCSI_FOR_EACH_DEV(ndp) { in ncsi_find_dev()
424 if (ndp->ndev.dev == dev) in ncsi_find_dev()
425 return &ndp->ndev; in ncsi_find_dev()
434 struct ncsi_dev_priv *ndp = nr->ndp; in ncsi_request_timeout() local
443 spin_lock_irqsave(&ndp->lock, flags); in ncsi_request_timeout()
446 spin_unlock_irqrestore(&ndp->lock, flags); in ncsi_request_timeout()
449 spin_unlock_irqrestore(&ndp->lock, flags); in ncsi_request_timeout()
456 ncsi_find_package_and_channel(ndp, in ncsi_request_timeout()
467 static void ncsi_suspend_channel(struct ncsi_dev_priv *ndp) in ncsi_suspend_channel() argument
469 struct ncsi_dev *nd = &ndp->ndev; in ncsi_suspend_channel()
476 np = ndp->active_package; in ncsi_suspend_channel()
477 nc = ndp->active_channel; in ncsi_suspend_channel()
478 nca.ndp = ndp; in ncsi_suspend_channel()
485 ndp->pending_req_num = 1; in ncsi_suspend_channel()
490 if (ndp->flags & NCSI_DEV_HWA) in ncsi_suspend_channel()
503 if (ndp->flags & NCSI_DEV_RESHUFFLE) in ncsi_suspend_channel()
513 ndp->pending_req_num = 1; in ncsi_suspend_channel()
517 nca.channel = ndp->channel_probe_id; in ncsi_suspend_channel()
521 ndp->channel_probe_id++; in ncsi_suspend_channel()
523 if (ndp->channel_probe_id == ndp->channel_count) { in ncsi_suspend_channel()
524 ndp->channel_probe_id = 0; in ncsi_suspend_channel()
530 ndp->pending_req_num = 1; in ncsi_suspend_channel()
543 ndp->pending_req_num = 1; in ncsi_suspend_channel()
566 ndp->pending_req_num = 1; in ncsi_suspend_channel()
582 if (ndp->flags & NCSI_DEV_RESET) in ncsi_suspend_channel()
585 ncsi_process_next_channel(ndp); in ncsi_suspend_channel()
600 static int clear_one_vid(struct ncsi_dev_priv *ndp, struct ncsi_channel *nc, in clear_one_vid() argument
635 static int set_one_vid(struct ncsi_dev_priv *ndp, struct ncsi_channel *nc, in set_one_vid() argument
645 if (list_empty(&ndp->vlan_vids)) in set_one_vid()
654 list_for_each_entry_rcu(vlan, &ndp->vlan_vids, list) { in set_one_vid()
674 netdev_err(ndp->ndev.dev, in set_one_vid()
713 netdev_err(nca->ndp->ndev.dev, in ncsi_oem_keep_phy_intel()
735 netdev_err(nca->ndp->ndev.dev, in ncsi_oem_gma_handler_bcm()
760 netdev_err(nca->ndp->ndev.dev, in ncsi_oem_gma_handler_mlx()
779 nca->ndp->ndev.dev->dev_addr, ETH_ALEN); in ncsi_oem_smaf_mlx()
788 netdev_err(nca->ndp->ndev.dev, in ncsi_oem_smaf_mlx()
809 netdev_err(nca->ndp->ndev.dev, in ncsi_oem_gma_handler_intel()
832 if (nca->ndp->gma_flag == 1) in ncsi_gma_handler()
845 netdev_err(nca->ndp->ndev.dev, in ncsi_gma_handler()
856 static bool ncsi_channel_is_tx(struct ncsi_dev_priv *ndp, in ncsi_channel_is_tx() argument
866 NCSI_FOR_EACH_PACKAGE(ndp, np) { in ncsi_channel_is_tx()
867 if (!ndp->multi_package && np != nc->package) in ncsi_channel_is_tx()
877 list_for_each_entry_rcu(channel, &ndp->channel_queue, link) { in ncsi_channel_is_tx()
889 list_for_each_entry_rcu(channel, &ndp->channel_queue, link) in ncsi_channel_is_tx()
898 int ncsi_update_tx_channel(struct ncsi_dev_priv *ndp, in ncsi_update_tx_channel() argument
908 if (!package->multi_channel && !ndp->multi_package) in ncsi_update_tx_channel()
909 netdev_warn(ndp->ndev.dev, in ncsi_update_tx_channel()
911 nca.ndp = ndp; in ncsi_update_tx_channel()
915 NCSI_FOR_EACH_PACKAGE(ndp, np) { in ncsi_update_tx_channel()
918 if (!ndp->multi_package && np != package) in ncsi_update_tx_channel()
929 NCSI_FOR_EACH_PACKAGE(ndp, np) { in ncsi_update_tx_channel()
932 if (!ndp->multi_package && np != package) in ncsi_update_tx_channel()
934 if (!(ndp->package_whitelist & (0x1 << np->id))) in ncsi_update_tx_channel()
967 netdev_err(ndp->ndev.dev, in ncsi_update_tx_channel()
972 netdev_info(ndp->ndev.dev, "NCSI: channel %u enables Tx\n", enable->id); in ncsi_update_tx_channel()
979 netdev_err(ndp->ndev.dev, in ncsi_update_tx_channel()
986 static void ncsi_configure_channel(struct ncsi_dev_priv *ndp) in ncsi_configure_channel() argument
988 struct ncsi_package *np = ndp->active_package; in ncsi_configure_channel()
989 struct ncsi_channel *nc = ndp->active_channel; in ncsi_configure_channel()
991 struct ncsi_dev *nd = &ndp->ndev; in ncsi_configure_channel()
998 nca.ndp = ndp; in ncsi_configure_channel()
1003 ndp->pending_req_num = 1; in ncsi_configure_channel()
1007 if (ndp->flags & NCSI_DEV_HWA) in ncsi_configure_channel()
1015 netdev_err(ndp->ndev.dev, in ncsi_configure_channel()
1023 ndp->pending_req_num = 1; in ncsi_configure_channel()
1031 netdev_err(ndp->ndev.dev, in ncsi_configure_channel()
1045 ndp->pending_req_num = 1; in ncsi_configure_channel()
1054 schedule_work(&ndp->work); in ncsi_configure_channel()
1067 ndp->pending_req_num = 1; in ncsi_configure_channel()
1074 ret = clear_one_vid(ndp, nc, &nca); in ncsi_configure_channel()
1077 schedule_work(&ndp->work); in ncsi_configure_channel()
1084 ret = set_one_vid(ndp, nc, &nca); in ncsi_configure_channel()
1087 schedule_work(&ndp->work); in ncsi_configure_channel()
1094 if (list_empty(&ndp->vlan_vids)) { in ncsi_configure_channel()
1122 else if (ncsi_channel_is_tx(ndp, nc)) in ncsi_configure_channel()
1128 if (ncsi_channel_is_tx(ndp, nc)) in ncsi_configure_channel()
1135 netdev_info(ndp->ndev.dev, in ncsi_configure_channel()
1158 netdev_err(ndp->ndev.dev, in ncsi_configure_channel()
1165 netdev_dbg(ndp->ndev.dev, "NCSI: channel %u config done\n", in ncsi_configure_channel()
1170 if (ndp->flags & NCSI_DEV_RESET) { in ncsi_configure_channel()
1187 spin_lock_irqsave(&ndp->lock, flags); in ncsi_configure_channel()
1188 list_add_tail_rcu(&nc->link, &ndp->channel_queue); in ncsi_configure_channel()
1189 spin_unlock_irqrestore(&ndp->lock, flags); in ncsi_configure_channel()
1192 ncsi_process_next_channel(ndp); in ncsi_configure_channel()
1200 netdev_dbg(ndp->ndev.dev, in ncsi_configure_channel()
1207 spin_lock_irqsave(&ndp->lock, flags); in ncsi_configure_channel()
1208 ndp->hot_channel = hot_nc; in ncsi_configure_channel()
1209 spin_unlock_irqrestore(&ndp->lock, flags); in ncsi_configure_channel()
1212 ncsi_process_next_channel(ndp); in ncsi_configure_channel()
1222 ncsi_report_link(ndp, true); in ncsi_configure_channel()
1225 static int ncsi_choose_active_channel(struct ncsi_dev_priv *ndp) in ncsi_choose_active_channel() argument
1233 spin_lock_irqsave(&ndp->lock, flags); in ncsi_choose_active_channel()
1234 hot_nc = ndp->hot_channel; in ncsi_choose_active_channel()
1235 spin_unlock_irqrestore(&ndp->lock, flags); in ncsi_choose_active_channel()
1244 NCSI_FOR_EACH_PACKAGE(ndp, np) { in ncsi_choose_active_channel()
1245 if (!(ndp->package_whitelist & (0x1 << np->id))) in ncsi_choose_active_channel()
1276 spin_lock_irqsave(&ndp->lock, flags); in ncsi_choose_active_channel()
1278 &ndp->channel_queue); in ncsi_choose_active_channel()
1279 spin_unlock_irqrestore(&ndp->lock, flags); in ncsi_choose_active_channel()
1281 netdev_dbg(ndp->ndev.dev, in ncsi_choose_active_channel()
1292 if (with_link && !ndp->multi_package) in ncsi_choose_active_channel()
1296 if (list_empty(&ndp->channel_queue) && found) { in ncsi_choose_active_channel()
1297 netdev_info(ndp->ndev.dev, in ncsi_choose_active_channel()
1300 spin_lock_irqsave(&ndp->lock, flags); in ncsi_choose_active_channel()
1301 list_add_tail_rcu(&found->link, &ndp->channel_queue); in ncsi_choose_active_channel()
1302 spin_unlock_irqrestore(&ndp->lock, flags); in ncsi_choose_active_channel()
1304 netdev_warn(ndp->ndev.dev, in ncsi_choose_active_channel()
1306 ncsi_report_link(ndp, true); in ncsi_choose_active_channel()
1310 return ncsi_process_next_channel(ndp); in ncsi_choose_active_channel()
1313 static bool ncsi_check_hwa(struct ncsi_dev_priv *ndp) in ncsi_check_hwa() argument
1323 NCSI_FOR_EACH_PACKAGE(ndp, np) { in ncsi_check_hwa()
1331 ndp->flags &= ~NCSI_DEV_HWA; in ncsi_check_hwa()
1338 ndp->flags |= NCSI_DEV_HWA; in ncsi_check_hwa()
1342 ndp->flags &= ~NCSI_DEV_HWA; in ncsi_check_hwa()
1346 static void ncsi_probe_channel(struct ncsi_dev_priv *ndp) in ncsi_probe_channel() argument
1348 struct ncsi_dev *nd = &ndp->ndev; in ncsi_probe_channel()
1354 nca.ndp = ndp; in ncsi_probe_channel()
1361 ndp->pending_req_num = 8; in ncsi_probe_channel()
1376 ndp->pending_req_num = 1; in ncsi_probe_channel()
1380 nca.package = ndp->package_probe_id; in ncsi_probe_channel()
1388 ndp->active_package = ncsi_find_package(ndp, in ncsi_probe_channel()
1389 ndp->package_probe_id); in ncsi_probe_channel()
1390 if (!ndp->active_package) { in ncsi_probe_channel()
1393 schedule_work(&ndp->work); in ncsi_probe_channel()
1398 ndp->mlx_multi_host) in ncsi_probe_channel()
1401 schedule_work(&ndp->work); in ncsi_probe_channel()
1404 ndp->pending_req_num = 1; in ncsi_probe_channel()
1407 nca.package = ndp->active_package->id; in ncsi_probe_channel()
1416 ndp->pending_req_num = 1; in ncsi_probe_channel()
1419 nca.package = ndp->active_package->id; in ncsi_probe_channel()
1428 ndp->pending_req_num = 1; in ncsi_probe_channel()
1431 nca.package = ndp->active_package->id; in ncsi_probe_channel()
1443 np = ndp->active_package; in ncsi_probe_channel()
1444 ndp->pending_req_num = 1; in ncsi_probe_channel()
1457 nca.channel = ndp->channel_probe_id; in ncsi_probe_channel()
1465 if (IS_ENABLED(CONFIG_NCSI_OEM_CMD_KEEP_PHY) && ndp->channel_probe_id == 0) in ncsi_probe_channel()
1473 ndp->channel_probe_id++; in ncsi_probe_channel()
1476 if (ndp->channel_probe_id == ndp->channel_count) { in ncsi_probe_channel()
1477 ndp->channel_probe_id = 0; in ncsi_probe_channel()
1482 ndp->pending_req_num = 1; in ncsi_probe_channel()
1486 nca.package = ndp->package_probe_id; in ncsi_probe_channel()
1493 ndp->package_probe_id++; in ncsi_probe_channel()
1494 if (ndp->package_probe_id >= 8) { in ncsi_probe_channel()
1496 ndp->flags |= NCSI_DEV_PROBED; in ncsi_probe_channel()
1500 ndp->active_package = NULL; in ncsi_probe_channel()
1507 if (ndp->flags & NCSI_DEV_PROBED) { in ncsi_probe_channel()
1509 ncsi_check_hwa(ndp); in ncsi_probe_channel()
1510 ncsi_choose_active_channel(ndp); in ncsi_probe_channel()
1515 netdev_err(ndp->ndev.dev, in ncsi_probe_channel()
1518 ncsi_report_link(ndp, true); in ncsi_probe_channel()
1523 struct ncsi_dev_priv *ndp = container_of(work, in ncsi_dev_work() local
1525 struct ncsi_dev *nd = &ndp->ndev; in ncsi_dev_work()
1529 ncsi_probe_channel(ndp); in ncsi_dev_work()
1532 ncsi_suspend_channel(ndp); in ncsi_dev_work()
1535 ncsi_configure_channel(ndp); in ncsi_dev_work()
1543 int ncsi_process_next_channel(struct ncsi_dev_priv *ndp) in ncsi_process_next_channel() argument
1549 spin_lock_irqsave(&ndp->lock, flags); in ncsi_process_next_channel()
1550 nc = list_first_or_null_rcu(&ndp->channel_queue, in ncsi_process_next_channel()
1553 spin_unlock_irqrestore(&ndp->lock, flags); in ncsi_process_next_channel()
1558 spin_unlock_irqrestore(&ndp->lock, flags); in ncsi_process_next_channel()
1565 ndp->active_channel = nc; in ncsi_process_next_channel()
1566 ndp->active_package = nc->package; in ncsi_process_next_channel()
1570 ndp->ndev.state = ncsi_dev_state_config; in ncsi_process_next_channel()
1571 netdev_dbg(ndp->ndev.dev, "NCSI: configuring channel %u\n", in ncsi_process_next_channel()
1573 ncsi_configure_channel(ndp); in ncsi_process_next_channel()
1576 ndp->ndev.state = ncsi_dev_state_suspend; in ncsi_process_next_channel()
1577 netdev_dbg(ndp->ndev.dev, "NCSI: suspending channel %u\n", in ncsi_process_next_channel()
1579 ncsi_suspend_channel(ndp); in ncsi_process_next_channel()
1582 netdev_err(ndp->ndev.dev, "Invalid state 0x%x on %d:%d\n", in ncsi_process_next_channel()
1584 ncsi_report_link(ndp, false); in ncsi_process_next_channel()
1591 ndp->active_channel = NULL; in ncsi_process_next_channel()
1592 ndp->active_package = NULL; in ncsi_process_next_channel()
1593 if (ndp->flags & NCSI_DEV_RESHUFFLE) { in ncsi_process_next_channel()
1594 ndp->flags &= ~NCSI_DEV_RESHUFFLE; in ncsi_process_next_channel()
1595 return ncsi_choose_active_channel(ndp); in ncsi_process_next_channel()
1598 ncsi_report_link(ndp, false); in ncsi_process_next_channel()
1602 static int ncsi_kick_channels(struct ncsi_dev_priv *ndp) in ncsi_kick_channels() argument
1604 struct ncsi_dev *nd = &ndp->ndev; in ncsi_kick_channels()
1610 NCSI_FOR_EACH_PACKAGE(ndp, np) { in ncsi_kick_channels()
1621 if ((ndp->ndev.state & 0xff00) == in ncsi_kick_channels()
1640 spin_lock_irqsave(&ndp->lock, flags); in ncsi_kick_channels()
1641 list_add_tail_rcu(&nc->link, &ndp->channel_queue); in ncsi_kick_channels()
1642 spin_unlock_irqrestore(&ndp->lock, flags); in ncsi_kick_channels()
1654 struct ncsi_dev_priv *ndp; in ncsi_vlan_rx_add_vid() local
1669 ndp = TO_NCSI_DEV_PRIV(nd); in ncsi_vlan_rx_add_vid()
1672 list_for_each_entry_rcu(vlan, &ndp->vlan_vids, list) { in ncsi_vlan_rx_add_vid()
1693 list_add_rcu(&vlan->list, &ndp->vlan_vids); in ncsi_vlan_rx_add_vid()
1697 found = ncsi_kick_channels(ndp) != 0; in ncsi_vlan_rx_add_vid()
1699 return found ? ncsi_process_next_channel(ndp) : 0; in ncsi_vlan_rx_add_vid()
1706 struct ncsi_dev_priv *ndp; in ncsi_vlan_rx_kill_vid() local
1719 ndp = TO_NCSI_DEV_PRIV(nd); in ncsi_vlan_rx_kill_vid()
1722 list_for_each_entry_safe(vlan, tmp, &ndp->vlan_vids, list) in ncsi_vlan_rx_kill_vid()
1735 found = ncsi_kick_channels(ndp) != 0; in ncsi_vlan_rx_kill_vid()
1737 return found ? ncsi_process_next_channel(ndp) : 0; in ncsi_vlan_rx_kill_vid()
1744 struct ncsi_dev_priv *ndp; in ncsi_register_dev() local
1757 ndp = kzalloc(sizeof(*ndp), GFP_ATOMIC); in ncsi_register_dev()
1758 if (!ndp) in ncsi_register_dev()
1761 nd = &ndp->ndev; in ncsi_register_dev()
1765 ndp->pending_req_num = 0; in ncsi_register_dev()
1766 INIT_LIST_HEAD(&ndp->channel_queue); in ncsi_register_dev()
1767 INIT_LIST_HEAD(&ndp->vlan_vids); in ncsi_register_dev()
1768 INIT_WORK(&ndp->work, ncsi_dev_work); in ncsi_register_dev()
1769 ndp->package_whitelist = UINT_MAX; in ncsi_register_dev()
1772 spin_lock_init(&ndp->lock); in ncsi_register_dev()
1773 INIT_LIST_HEAD(&ndp->packages); in ncsi_register_dev()
1774 ndp->request_id = NCSI_REQ_START_IDX; in ncsi_register_dev()
1775 for (i = 0; i < ARRAY_SIZE(ndp->requests); i++) { in ncsi_register_dev()
1776 ndp->requests[i].id = i; in ncsi_register_dev()
1777 ndp->requests[i].ndp = ndp; in ncsi_register_dev()
1778 timer_setup(&ndp->requests[i].timer, ncsi_request_timeout, 0); in ncsi_register_dev()
1780 ndp->channel_count = NCSI_RESERVED_CHANNEL; in ncsi_register_dev()
1783 list_add_tail_rcu(&ndp->node, &ncsi_dev_list); in ncsi_register_dev()
1787 ndp->ptype.type = cpu_to_be16(ETH_P_NCSI); in ncsi_register_dev()
1788 ndp->ptype.func = ncsi_rcv_rsp; in ncsi_register_dev()
1789 ndp->ptype.dev = dev; in ncsi_register_dev()
1790 dev_add_pack(&ndp->ptype); in ncsi_register_dev()
1797 ndp->mlx_multi_host = true; in ncsi_register_dev()
1806 struct ncsi_dev_priv *ndp = TO_NCSI_DEV_PRIV(nd); in ncsi_start_dev() local
1812 if (!(ndp->flags & NCSI_DEV_PROBED)) { in ncsi_start_dev()
1813 ndp->package_probe_id = 0; in ncsi_start_dev()
1814 ndp->channel_probe_id = 0; in ncsi_start_dev()
1816 schedule_work(&ndp->work); in ncsi_start_dev()
1826 struct ncsi_dev_priv *ndp = TO_NCSI_DEV_PRIV(nd); in ncsi_stop_dev() local
1837 NCSI_FOR_EACH_PACKAGE(ndp, np) { in ncsi_stop_dev()
1851 netdev_dbg(ndp->ndev.dev, "NCSI: Stopping device\n"); in ncsi_stop_dev()
1852 ncsi_report_link(ndp, true); in ncsi_stop_dev()
1858 struct ncsi_dev_priv *ndp = TO_NCSI_DEV_PRIV(nd); in ncsi_reset_dev() local
1863 spin_lock_irqsave(&ndp->lock, flags); in ncsi_reset_dev()
1865 if (!(ndp->flags & NCSI_DEV_RESET)) { in ncsi_reset_dev()
1871 spin_unlock_irqrestore(&ndp->lock, flags); in ncsi_reset_dev()
1879 ndp->flags |= NCSI_DEV_RESET; in ncsi_reset_dev()
1880 spin_unlock_irqrestore(&ndp->lock, flags); in ncsi_reset_dev()
1892 spin_unlock_irqrestore(&ndp->lock, flags); in ncsi_reset_dev()
1897 if (!list_empty(&ndp->channel_queue)) { in ncsi_reset_dev()
1899 list_for_each_entry_safe(nc, tmp, &ndp->channel_queue, link) in ncsi_reset_dev()
1902 spin_unlock_irqrestore(&ndp->lock, flags); in ncsi_reset_dev()
1905 NCSI_FOR_EACH_PACKAGE(ndp, np) { in ncsi_reset_dev()
1925 spin_lock_irqsave(&ndp->lock, flags); in ncsi_reset_dev()
1926 ndp->flags &= ~NCSI_DEV_RESET; in ncsi_reset_dev()
1927 spin_unlock_irqrestore(&ndp->lock, flags); in ncsi_reset_dev()
1928 return ncsi_choose_active_channel(ndp); in ncsi_reset_dev()
1931 spin_lock_irqsave(&ndp->lock, flags); in ncsi_reset_dev()
1932 ndp->flags |= NCSI_DEV_RESET; in ncsi_reset_dev()
1933 ndp->active_channel = active; in ncsi_reset_dev()
1934 ndp->active_package = active->package; in ncsi_reset_dev()
1935 spin_unlock_irqrestore(&ndp->lock, flags); in ncsi_reset_dev()
1938 schedule_work(&ndp->work); in ncsi_reset_dev()
1944 struct ncsi_dev_priv *ndp = TO_NCSI_DEV_PRIV(nd); in ncsi_unregister_dev() local
1948 dev_remove_pack(&ndp->ptype); in ncsi_unregister_dev()
1950 list_for_each_entry_safe(np, tmp, &ndp->packages, node) in ncsi_unregister_dev()
1954 list_del_rcu(&ndp->node); in ncsi_unregister_dev()
1957 disable_work_sync(&ndp->work); in ncsi_unregister_dev()
1959 kfree(ndp); in ncsi_unregister_dev()