• Home
  • Raw
  • Download

Lines Matching full:nc

37 	struct ncsi_channel *nc;  in ncsi_channel_is_last()  local
40 NCSI_FOR_EACH_CHANNEL(np, nc) { in ncsi_channel_is_last()
41 if (nc == channel) in ncsi_channel_is_last()
43 if (nc->state == NCSI_CHANNEL_ACTIVE && in ncsi_channel_is_last()
44 ncsi_channel_has_link(nc)) in ncsi_channel_is_last()
55 struct ncsi_channel *nc; in ncsi_report_link() local
66 NCSI_FOR_EACH_CHANNEL(np, nc) { in ncsi_report_link()
67 spin_lock_irqsave(&nc->lock, flags); in ncsi_report_link()
69 if (!list_empty(&nc->link) || in ncsi_report_link()
70 nc->state != NCSI_CHANNEL_ACTIVE) { in ncsi_report_link()
71 spin_unlock_irqrestore(&nc->lock, flags); in ncsi_report_link()
75 if (ncsi_channel_has_link(nc)) { in ncsi_report_link()
76 spin_unlock_irqrestore(&nc->lock, flags); in ncsi_report_link()
81 spin_unlock_irqrestore(&nc->lock, flags); in ncsi_report_link()
91 struct ncsi_channel *nc = from_timer(nc, t, monitor.timer); in ncsi_channel_monitor() local
92 struct ncsi_package *np = nc->package; in ncsi_channel_monitor()
101 spin_lock_irqsave(&nc->lock, flags); in ncsi_channel_monitor()
102 state = nc->state; in ncsi_channel_monitor()
103 chained = !list_empty(&nc->link); in ncsi_channel_monitor()
104 enabled = nc->monitor.enabled; in ncsi_channel_monitor()
105 monitor_state = nc->monitor.state; in ncsi_channel_monitor()
106 spin_unlock_irqrestore(&nc->lock, flags); in ncsi_channel_monitor()
118 nc->id, state, chained ? "on" : "off"); in ncsi_channel_monitor()
119 spin_lock_irqsave(&nc->lock, flags); in ncsi_channel_monitor()
120 nc->monitor.enabled = false; in ncsi_channel_monitor()
121 spin_unlock_irqrestore(&nc->lock, flags); in ncsi_channel_monitor()
130 nca.channel = nc->id; in ncsi_channel_monitor()
142 nc->id); in ncsi_channel_monitor()
146 ncm = &nc->modes[NCSI_MODE_LINK]; in ncsi_channel_monitor()
147 spin_lock_irqsave(&nc->lock, flags); in ncsi_channel_monitor()
148 nc->monitor.enabled = false; in ncsi_channel_monitor()
149 nc->state = NCSI_CHANNEL_INVISIBLE; in ncsi_channel_monitor()
151 spin_unlock_irqrestore(&nc->lock, flags); in ncsi_channel_monitor()
154 nc->state = NCSI_CHANNEL_ACTIVE; in ncsi_channel_monitor()
155 list_add_tail_rcu(&nc->link, &ndp->channel_queue); in ncsi_channel_monitor()
161 spin_lock_irqsave(&nc->lock, flags); in ncsi_channel_monitor()
162 nc->monitor.state++; in ncsi_channel_monitor()
163 spin_unlock_irqrestore(&nc->lock, flags); in ncsi_channel_monitor()
164 mod_timer(&nc->monitor.timer, jiffies + HZ); in ncsi_channel_monitor()
167 void ncsi_start_channel_monitor(struct ncsi_channel *nc) in ncsi_start_channel_monitor() argument
171 spin_lock_irqsave(&nc->lock, flags); in ncsi_start_channel_monitor()
172 WARN_ON_ONCE(nc->monitor.enabled); in ncsi_start_channel_monitor()
173 nc->monitor.enabled = true; in ncsi_start_channel_monitor()
174 nc->monitor.state = NCSI_CHANNEL_MONITOR_START; in ncsi_start_channel_monitor()
175 spin_unlock_irqrestore(&nc->lock, flags); in ncsi_start_channel_monitor()
177 mod_timer(&nc->monitor.timer, jiffies + HZ); in ncsi_start_channel_monitor()
180 void ncsi_stop_channel_monitor(struct ncsi_channel *nc) in ncsi_stop_channel_monitor() argument
184 spin_lock_irqsave(&nc->lock, flags); in ncsi_stop_channel_monitor()
185 if (!nc->monitor.enabled) { in ncsi_stop_channel_monitor()
186 spin_unlock_irqrestore(&nc->lock, flags); in ncsi_stop_channel_monitor()
189 nc->monitor.enabled = false; in ncsi_stop_channel_monitor()
190 spin_unlock_irqrestore(&nc->lock, flags); in ncsi_stop_channel_monitor()
192 del_timer_sync(&nc->monitor.timer); in ncsi_stop_channel_monitor()
198 struct ncsi_channel *nc; in ncsi_find_channel() local
200 NCSI_FOR_EACH_CHANNEL(np, nc) { in ncsi_find_channel()
201 if (nc->id == id) in ncsi_find_channel()
202 return nc; in ncsi_find_channel()
210 struct ncsi_channel *nc, *tmp; in ncsi_add_channel() local
214 nc = kzalloc(sizeof(*nc), GFP_ATOMIC); in ncsi_add_channel()
215 if (!nc) in ncsi_add_channel()
218 nc->id = id; in ncsi_add_channel()
219 nc->package = np; in ncsi_add_channel()
220 nc->state = NCSI_CHANNEL_INACTIVE; in ncsi_add_channel()
221 nc->monitor.enabled = false; in ncsi_add_channel()
222 timer_setup(&nc->monitor.timer, ncsi_channel_monitor, 0); in ncsi_add_channel()
223 spin_lock_init(&nc->lock); in ncsi_add_channel()
224 INIT_LIST_HEAD(&nc->link); in ncsi_add_channel()
226 nc->caps[index].index = index; in ncsi_add_channel()
228 nc->modes[index].index = index; in ncsi_add_channel()
234 kfree(nc); in ncsi_add_channel()
238 list_add_tail_rcu(&nc->node, &np->channels); in ncsi_add_channel()
242 return nc; in ncsi_add_channel()
245 static void ncsi_remove_channel(struct ncsi_channel *nc) in ncsi_remove_channel() argument
247 struct ncsi_package *np = nc->package; in ncsi_remove_channel()
250 spin_lock_irqsave(&nc->lock, flags); in ncsi_remove_channel()
253 kfree(nc->mac_filter.addrs); in ncsi_remove_channel()
254 kfree(nc->vlan_filter.vids); in ncsi_remove_channel()
256 nc->state = NCSI_CHANNEL_INACTIVE; in ncsi_remove_channel()
257 spin_unlock_irqrestore(&nc->lock, flags); in ncsi_remove_channel()
258 ncsi_stop_channel_monitor(nc); in ncsi_remove_channel()
262 list_del_rcu(&nc->node); in ncsi_remove_channel()
266 kfree(nc); in ncsi_remove_channel()
316 struct ncsi_channel *nc, *tmp; in ncsi_remove_package() local
320 list_for_each_entry_safe(nc, tmp, &np->channels, node) in ncsi_remove_package()
321 ncsi_remove_channel(nc); in ncsi_remove_package()
335 struct ncsi_channel **nc) in ncsi_find_package_and_channel() argument
345 if (nc) in ncsi_find_package_and_channel()
346 *nc = c; in ncsi_find_package_and_channel()
437 struct ncsi_channel *nc; in ncsi_request_timeout() local
458 &np, &nc); in ncsi_request_timeout()
459 ncsi_send_netlink_timeout(nr, np, nc); in ncsi_request_timeout()
471 struct ncsi_channel *nc, *tmp; in ncsi_suspend_channel() local
477 nc = ndp->active_channel; in ncsi_suspend_channel()
519 NCSI_FOR_EACH_CHANNEL(np, nc) { in ncsi_suspend_channel()
520 nca.channel = nc->id; in ncsi_suspend_channel()
532 nca.channel = nc->id; in ncsi_suspend_channel()
545 nca.channel = nc->id; in ncsi_suspend_channel()
557 if (tmp != nc && tmp->state == NCSI_CHANNEL_ACTIVE) { in ncsi_suspend_channel()
577 spin_lock_irqsave(&nc->lock, flags); in ncsi_suspend_channel()
578 nc->state = NCSI_CHANNEL_INACTIVE; in ncsi_suspend_channel()
579 spin_unlock_irqrestore(&nc->lock, flags); in ncsi_suspend_channel()
598 static int clear_one_vid(struct ncsi_dev_priv *ndp, struct ncsi_channel *nc, in clear_one_vid() argument
607 ncf = &nc->vlan_filter; in clear_one_vid()
610 spin_lock_irqsave(&nc->lock, flags); in clear_one_vid()
613 spin_unlock_irqrestore(&nc->lock, flags); in clear_one_vid()
620 spin_unlock_irqrestore(&nc->lock, flags); in clear_one_vid()
633 static int set_one_vid(struct ncsi_dev_priv *ndp, struct ncsi_channel *nc, in set_one_vid() argument
646 ncf = &nc->vlan_filter; in set_one_vid()
649 spin_lock_irqsave(&nc->lock, flags); in set_one_vid()
666 spin_unlock_irqrestore(&nc->lock, flags); in set_one_vid()
674 nc->id); in set_one_vid()
675 spin_unlock_irqrestore(&nc->lock, flags); in set_one_vid()
681 spin_unlock_irqrestore(&nc->lock, flags); in set_one_vid()
811 struct ncsi_channel *nc) in ncsi_channel_is_tx() argument
821 if (!ndp->multi_package && np != nc->package) in ncsi_channel_is_tx()
835 return np->preferred_channel == nc; in ncsi_channel_is_tx()
840 if (ncsi_channel_has_link(nc)) in ncsi_channel_is_tx()
858 struct ncsi_channel *nc; in ncsi_update_tx_channel() local
875 NCSI_FOR_EACH_CHANNEL(np, nc) in ncsi_update_tx_channel()
876 if (nc->modes[NCSI_MODE_TX_ENABLE].enable) { in ncsi_update_tx_channel()
877 disable = nc; in ncsi_update_tx_channel()
897 NCSI_FOR_EACH_CHANNEL(np, nc) { in ncsi_update_tx_channel()
898 if (!(np->channel_whitelist & 0x1 << nc->id)) in ncsi_update_tx_channel()
900 if (nc->state != NCSI_CHANNEL_ACTIVE) in ncsi_update_tx_channel()
902 if (ncsi_channel_has_link(nc)) { in ncsi_update_tx_channel()
903 enable = nc; in ncsi_update_tx_channel()
943 struct ncsi_channel *nc = ndp->active_channel; in ncsi_configure_channel() local
982 nca.channel = nc->id; in ncsi_configure_channel()
999 nca.channel = nc->id; in ncsi_configure_channel()
1001 ret = ncsi_gma_handler(&nca, nc->version.mf_id); in ncsi_configure_channel()
1021 nca.channel = nc->id; in ncsi_configure_channel()
1025 ret = clear_one_vid(ndp, nc, &nca); in ncsi_configure_channel()
1035 ret = set_one_vid(ndp, nc, &nca); in ncsi_configure_channel()
1065 nca.dwords[0] = nc->caps[NCSI_CAP_BC].cap; in ncsi_configure_channel()
1070 if (nc->caps[NCSI_CAP_GENERIC].cap & in ncsi_configure_channel()
1073 else if (ncsi_channel_is_tx(ndp, nc)) in ncsi_configure_channel()
1079 if (ncsi_channel_is_tx(ndp, nc)) in ncsi_configure_channel()
1085 nc != np->preferred_channel) in ncsi_configure_channel()
1088 nc->id); in ncsi_configure_channel()
1095 if (!(nc->caps[NCSI_CAP_AEN].cap & NCSI_CAP_AEN_MASK)) in ncsi_configure_channel()
1100 nca.dwords[1] = nc->caps[NCSI_CAP_AEN].cap; in ncsi_configure_channel()
1117 nc->id); in ncsi_configure_channel()
1118 spin_lock_irqsave(&nc->lock, flags); in ncsi_configure_channel()
1119 nc->state = NCSI_CHANNEL_ACTIVE; in ncsi_configure_channel()
1123 nc->reconfigure_needed = false; in ncsi_configure_channel()
1124 spin_unlock_irqrestore(&nc->lock, flags); in ncsi_configure_channel()
1129 if (nc->reconfigure_needed) { in ncsi_configure_channel()
1134 nc->reconfigure_needed = false; in ncsi_configure_channel()
1135 nc->state = NCSI_CHANNEL_INACTIVE; in ncsi_configure_channel()
1136 spin_unlock_irqrestore(&nc->lock, flags); in ncsi_configure_channel()
1139 list_add_tail_rcu(&nc->link, &ndp->channel_queue); in ncsi_configure_channel()
1147 if (nc->modes[NCSI_MODE_LINK].data[2] & 0x1) { in ncsi_configure_channel()
1148 hot_nc = nc; in ncsi_configure_channel()
1153 nc->id); in ncsi_configure_channel()
1155 spin_unlock_irqrestore(&nc->lock, flags); in ncsi_configure_channel()
1162 ncsi_start_channel_monitor(nc); in ncsi_configure_channel()
1178 struct ncsi_channel *nc, *found, *hot_nc; in ncsi_choose_active_channel() local
1198 NCSI_FOR_EACH_CHANNEL(np, nc) { in ncsi_choose_active_channel()
1199 if (!(np->channel_whitelist & (0x1 << nc->id))) in ncsi_choose_active_channel()
1202 spin_lock_irqsave(&nc->lock, cflags); in ncsi_choose_active_channel()
1204 if (!list_empty(&nc->link) || in ncsi_choose_active_channel()
1205 nc->state != NCSI_CHANNEL_INACTIVE) { in ncsi_choose_active_channel()
1206 spin_unlock_irqrestore(&nc->lock, cflags); in ncsi_choose_active_channel()
1211 found = nc; in ncsi_choose_active_channel()
1213 if (nc == hot_nc) in ncsi_choose_active_channel()
1214 found = nc; in ncsi_choose_active_channel()
1216 ncm = &nc->modes[NCSI_MODE_LINK]; in ncsi_choose_active_channel()
1218 found = nc; in ncsi_choose_active_channel()
1228 list_add_tail_rcu(&nc->link, in ncsi_choose_active_channel()
1234 nc->id, in ncsi_choose_active_channel()
1238 spin_unlock_irqrestore(&nc->lock, cflags); in ncsi_choose_active_channel()
1267 struct ncsi_channel *nc; in ncsi_check_hwa() local
1275 NCSI_FOR_EACH_CHANNEL(np, nc) { in ncsi_check_hwa()
1278 cap = nc->caps[NCSI_CAP_GENERIC].cap; in ncsi_check_hwa()
1301 struct ncsi_channel *nc; in ncsi_probe_channel() local
1411 NCSI_FOR_EACH_CHANNEL(np, nc) { in ncsi_probe_channel()
1412 nca.channel = nc->id; in ncsi_probe_channel()
1489 struct ncsi_channel *nc; in ncsi_process_next_channel() local
1494 nc = list_first_or_null_rcu(&ndp->channel_queue, in ncsi_process_next_channel()
1496 if (!nc) { in ncsi_process_next_channel()
1501 list_del_init(&nc->link); in ncsi_process_next_channel()
1504 spin_lock_irqsave(&nc->lock, flags); in ncsi_process_next_channel()
1505 old_state = nc->state; in ncsi_process_next_channel()
1506 nc->state = NCSI_CHANNEL_INVISIBLE; in ncsi_process_next_channel()
1507 spin_unlock_irqrestore(&nc->lock, flags); in ncsi_process_next_channel()
1509 ndp->active_channel = nc; in ncsi_process_next_channel()
1510 ndp->active_package = nc->package; in ncsi_process_next_channel()
1516 nc->id); in ncsi_process_next_channel()
1522 nc->id); in ncsi_process_next_channel()
1527 old_state, nc->package->id, nc->id); in ncsi_process_next_channel()
1549 struct ncsi_channel *nc; in ncsi_kick_channels() local
1555 NCSI_FOR_EACH_CHANNEL(np, nc) { in ncsi_kick_channels()
1556 spin_lock_irqsave(&nc->lock, flags); in ncsi_kick_channels()
1564 if (nc->state != NCSI_CHANNEL_ACTIVE) { in ncsi_kick_channels()
1567 !list_empty(&nc->link)) { in ncsi_kick_channels()
1570 nc); in ncsi_kick_channels()
1571 nc->reconfigure_needed = true; in ncsi_kick_channels()
1573 spin_unlock_irqrestore(&nc->lock, flags); in ncsi_kick_channels()
1577 spin_unlock_irqrestore(&nc->lock, flags); in ncsi_kick_channels()
1579 ncsi_stop_channel_monitor(nc); in ncsi_kick_channels()
1580 spin_lock_irqsave(&nc->lock, flags); in ncsi_kick_channels()
1581 nc->state = NCSI_CHANNEL_INACTIVE; in ncsi_kick_channels()
1582 spin_unlock_irqrestore(&nc->lock, flags); in ncsi_kick_channels()
1585 list_add_tail_rcu(&nc->link, &ndp->channel_queue); in ncsi_kick_channels()
1588 netdev_dbg(nd->dev, "NCSI: kicked channel %p\n", nc); in ncsi_kick_channels()
1769 struct ncsi_channel *nc; in ncsi_stop_dev() local
1779 NCSI_FOR_EACH_CHANNEL(np, nc) { in ncsi_stop_dev()
1780 ncsi_stop_channel_monitor(nc); in ncsi_stop_dev()
1782 spin_lock_irqsave(&nc->lock, flags); in ncsi_stop_dev()
1783 chained = !list_empty(&nc->link); in ncsi_stop_dev()
1784 old_state = nc->state; in ncsi_stop_dev()
1785 spin_unlock_irqrestore(&nc->lock, flags); in ncsi_stop_dev()
1800 struct ncsi_channel *nc, *active, *tmp; in ncsi_reset_dev() local
1840 list_for_each_entry_safe(nc, tmp, &ndp->channel_queue, link) in ncsi_reset_dev()
1841 list_del_init(&nc->link); in ncsi_reset_dev()
1847 NCSI_FOR_EACH_CHANNEL(np, nc) { in ncsi_reset_dev()
1848 spin_lock_irqsave(&nc->lock, flags); in ncsi_reset_dev()
1850 if (nc->state == NCSI_CHANNEL_ACTIVE) { in ncsi_reset_dev()
1851 active = nc; in ncsi_reset_dev()
1852 nc->state = NCSI_CHANNEL_INVISIBLE; in ncsi_reset_dev()
1853 spin_unlock_irqrestore(&nc->lock, flags); in ncsi_reset_dev()
1854 ncsi_stop_channel_monitor(nc); in ncsi_reset_dev()
1858 spin_unlock_irqrestore(&nc->lock, flags); in ncsi_reset_dev()