Lines Matching +full:cmd +full:- +full:cnt +full:- +full:name
1 // SPDX-License-Identifier: GPL-2.0+
85 return -ENOMEM; in lcs_register_debug_facility()
100 int cnt; in lcs_alloc_channel() local
103 for (cnt = 0; cnt < LCS_NUM_BUFFS; cnt++) { in lcs_alloc_channel()
105 channel->iob[cnt].data = in lcs_alloc_channel()
107 if (channel->iob[cnt].data == NULL) in lcs_alloc_channel()
109 channel->iob[cnt].state = LCS_BUF_STATE_EMPTY; in lcs_alloc_channel()
111 if (cnt < LCS_NUM_BUFFS) { in lcs_alloc_channel()
114 while (cnt-- > 0) in lcs_alloc_channel()
115 kfree(channel->iob[cnt].data); in lcs_alloc_channel()
116 return -ENOMEM; in lcs_alloc_channel()
127 int cnt; in lcs_free_channel() local
130 for (cnt = 0; cnt < LCS_NUM_BUFFS; cnt++) { in lcs_free_channel()
131 kfree(channel->iob[cnt].data); in lcs_free_channel()
132 channel->iob[cnt].data = NULL; in lcs_free_channel()
144 tasklet_kill(&channel->irq_tasklet); in lcs_cleanup_channel()
174 card->lan_type = LCS_FRAME_TYPE_AUTO; in lcs_alloc_card()
175 card->pkt_seq = 0; in lcs_alloc_card()
176 card->lancmd_timeout = LCS_LANCMD_TIMEOUT_DEFAULT; in lcs_alloc_card()
178 rc = lcs_alloc_channel(&card->read); in lcs_alloc_card()
185 rc = lcs_alloc_channel(&card->write); in lcs_alloc_card()
188 lcs_cleanup_channel(&card->read); in lcs_alloc_card()
194 INIT_LIST_HEAD(&card->ipm_list); in lcs_alloc_card()
206 int cnt; in lcs_setup_read_ccws() local
210 memset(card->read.ccws, 0, sizeof (struct ccw1) * (LCS_NUM_BUFFS + 1)); in lcs_setup_read_ccws()
211 for (cnt = 0; cnt < LCS_NUM_BUFFS; cnt++) { in lcs_setup_read_ccws()
212 card->read.ccws[cnt].cmd_code = LCS_CCW_READ; in lcs_setup_read_ccws()
213 card->read.ccws[cnt].count = LCS_IOBUFFERSIZE; in lcs_setup_read_ccws()
214 card->read.ccws[cnt].flags = in lcs_setup_read_ccws()
220 card->read.ccws[cnt].cda = in lcs_setup_read_ccws()
221 virt_to_dma32(card->read.iob[cnt].data); in lcs_setup_read_ccws()
223 card->read.iob[cnt].data)->offset = LCS_ILLEGAL_OFFSET; in lcs_setup_read_ccws()
224 card->read.iob[cnt].callback = lcs_get_frames_cb; in lcs_setup_read_ccws()
225 card->read.iob[cnt].state = LCS_BUF_STATE_READY; in lcs_setup_read_ccws()
226 card->read.iob[cnt].count = LCS_IOBUFFERSIZE; in lcs_setup_read_ccws()
228 card->read.ccws[0].flags &= ~CCW_FLAG_PCI; in lcs_setup_read_ccws()
229 card->read.ccws[LCS_NUM_BUFFS - 1].flags &= ~CCW_FLAG_PCI; in lcs_setup_read_ccws()
230 card->read.ccws[LCS_NUM_BUFFS - 1].flags |= CCW_FLAG_SUSPEND; in lcs_setup_read_ccws()
232 card->read.ccws[LCS_NUM_BUFFS].cmd_code = LCS_CCW_TRANSFER; in lcs_setup_read_ccws()
233 card->read.ccws[LCS_NUM_BUFFS].cda = virt_to_dma32(card->read.ccws); in lcs_setup_read_ccws()
235 card->read.state = LCS_CH_STATE_INIT; in lcs_setup_read_ccws()
237 card->read.io_idx = 0; in lcs_setup_read_ccws()
238 card->read.buf_idx = 0; in lcs_setup_read_ccws()
248 card->read.irq_tasklet.data = (unsigned long) &card->read; in lcs_setup_read()
249 card->read.irq_tasklet.func = lcs_tasklet; in lcs_setup_read()
251 init_waitqueue_head(&card->read.wait_q); in lcs_setup_read()
260 int cnt; in lcs_setup_write_ccws() local
264 memset(card->write.ccws, 0, sizeof(struct ccw1) * (LCS_NUM_BUFFS + 1)); in lcs_setup_write_ccws()
265 for (cnt = 0; cnt < LCS_NUM_BUFFS; cnt++) { in lcs_setup_write_ccws()
266 card->write.ccws[cnt].cmd_code = LCS_CCW_WRITE; in lcs_setup_write_ccws()
267 card->write.ccws[cnt].count = 0; in lcs_setup_write_ccws()
268 card->write.ccws[cnt].flags = in lcs_setup_write_ccws()
274 card->write.ccws[cnt].cda = in lcs_setup_write_ccws()
275 virt_to_dma32(card->write.iob[cnt].data); in lcs_setup_write_ccws()
278 card->write.ccws[LCS_NUM_BUFFS].cmd_code = LCS_CCW_TRANSFER; in lcs_setup_write_ccws()
279 card->write.ccws[LCS_NUM_BUFFS].cda = virt_to_dma32(card->write.ccws); in lcs_setup_write_ccws()
281 card->read.state = LCS_CH_STATE_INIT; in lcs_setup_write_ccws()
283 card->write.io_idx = 0; in lcs_setup_write_ccws()
284 card->write.buf_idx = 0; in lcs_setup_write_ccws()
294 card->write.irq_tasklet.data = (unsigned long) &card->write; in lcs_setup_write()
295 card->write.irq_tasklet.func = lcs_tasklet; in lcs_setup_write()
297 init_waitqueue_head(&card->write.wait_q); in lcs_setup_write()
305 spin_lock_irqsave(&card->mask_lock, flags); in lcs_set_allowed_threads()
306 card->thread_allowed_mask = threads; in lcs_set_allowed_threads()
307 spin_unlock_irqrestore(&card->mask_lock, flags); in lcs_set_allowed_threads()
308 wake_up(&card->wait_q); in lcs_set_allowed_threads()
315 spin_lock_irqsave(&card->mask_lock, flags); in lcs_threads_running()
316 rc = (card->thread_running_mask & threads); in lcs_threads_running()
317 spin_unlock_irqrestore(&card->mask_lock, flags); in lcs_threads_running()
324 return wait_event_interruptible(card->wait_q, in lcs_wait_for_threads()
332 spin_lock_irqsave(&card->mask_lock, flags); in lcs_set_thread_start_bit()
333 if ( !(card->thread_allowed_mask & thread) || in lcs_set_thread_start_bit()
334 (card->thread_start_mask & thread) ) { in lcs_set_thread_start_bit()
335 spin_unlock_irqrestore(&card->mask_lock, flags); in lcs_set_thread_start_bit()
336 return -EPERM; in lcs_set_thread_start_bit()
338 card->thread_start_mask |= thread; in lcs_set_thread_start_bit()
339 spin_unlock_irqrestore(&card->mask_lock, flags); in lcs_set_thread_start_bit()
348 spin_lock_irqsave(&card->mask_lock, flags); in lcs_clear_thread_running_bit()
349 card->thread_running_mask &= ~thread; in lcs_clear_thread_running_bit()
350 spin_unlock_irqrestore(&card->mask_lock, flags); in lcs_clear_thread_running_bit()
351 wake_up(&card->wait_q); in lcs_clear_thread_running_bit()
359 spin_lock_irqsave(&card->mask_lock, flags); in __lcs_do_run_thread()
360 if (card->thread_start_mask & thread){ in __lcs_do_run_thread()
361 if ((card->thread_allowed_mask & thread) && in __lcs_do_run_thread()
362 !(card->thread_running_mask & thread)){ in __lcs_do_run_thread()
364 card->thread_start_mask &= ~thread; in __lcs_do_run_thread()
365 card->thread_running_mask |= thread; in __lcs_do_run_thread()
367 rc = -EPERM; in __lcs_do_run_thread()
369 spin_unlock_irqrestore(&card->mask_lock, flags); in __lcs_do_run_thread()
377 wait_event(card->wait_q, in lcs_do_run_thread()
388 spin_lock_irqsave(&card->mask_lock, flags); in lcs_do_start_thread()
390 (u8) card->thread_start_mask, in lcs_do_start_thread()
391 (u8) card->thread_allowed_mask, in lcs_do_start_thread()
392 (u8) card->thread_running_mask); in lcs_do_start_thread()
393 rc = (card->thread_start_mask & thread); in lcs_do_start_thread()
394 spin_unlock_irqrestore(&card->mask_lock, flags); in lcs_do_start_thread()
410 card->state = DEV_STATE_DOWN; in lcs_setup_card()
411 card->tx_buffer = NULL; in lcs_setup_card()
412 card->tx_emitted = 0; in lcs_setup_card()
414 init_waitqueue_head(&card->wait_q); in lcs_setup_card()
415 spin_lock_init(&card->lock); in lcs_setup_card()
416 spin_lock_init(&card->ipm_lock); in lcs_setup_card()
417 spin_lock_init(&card->mask_lock); in lcs_setup_card()
419 INIT_LIST_HEAD(&card->ipm_list); in lcs_setup_card()
421 INIT_LIST_HEAD(&card->lancmd_waiters); in lcs_setup_card()
432 spin_lock_irqsave(&card->ipm_lock, flags); in lcs_clear_multicast_list()
433 while (!list_empty(&card->ipm_list)){ in lcs_clear_multicast_list()
434 ipm = list_entry(card->ipm_list.next, in lcs_clear_multicast_list()
436 list_del(&ipm->list); in lcs_clear_multicast_list()
437 if (ipm->ipm_state != LCS_IPM_STATE_SET_REQUIRED){ in lcs_clear_multicast_list()
438 spin_unlock_irqrestore(&card->ipm_lock, flags); in lcs_clear_multicast_list()
440 spin_lock_irqsave(&card->ipm_lock, flags); in lcs_clear_multicast_list()
444 spin_unlock_irqrestore(&card->ipm_lock, flags); in lcs_clear_multicast_list()
458 if (card->dev != NULL) in lcs_cleanup_card()
459 free_netdev(card->dev); in lcs_cleanup_card()
461 lcs_cleanup_channel(&card->write); in lcs_cleanup_card()
462 lcs_cleanup_channel(&card->read); in lcs_cleanup_card()
474 LCS_DBF_TEXT_(4, trace,"ssch%s", dev_name(&channel->ccwdev->dev)); in lcs_start_channel()
475 spin_lock_irqsave(get_ccwdev_lock(channel->ccwdev), flags); in lcs_start_channel()
476 rc = ccw_device_start(channel->ccwdev, in lcs_start_channel()
477 channel->ccws + channel->io_idx, 0, 0, in lcs_start_channel()
480 channel->state = LCS_CH_STATE_RUNNING; in lcs_start_channel()
481 spin_unlock_irqrestore(get_ccwdev_lock(channel->ccwdev), flags); in lcs_start_channel()
484 dev_name(&channel->ccwdev->dev)); in lcs_start_channel()
485 dev_err(&channel->ccwdev->dev, in lcs_start_channel()
499 LCS_DBF_TEXT_(4, trace, "%s", dev_name(&channel->ccwdev->dev)); in lcs_clear_channel()
500 spin_lock_irqsave(get_ccwdev_lock(channel->ccwdev), flags); in lcs_clear_channel()
501 rc = ccw_device_clear(channel->ccwdev, 0); in lcs_clear_channel()
502 spin_unlock_irqrestore(get_ccwdev_lock(channel->ccwdev), flags); in lcs_clear_channel()
505 dev_name(&channel->ccwdev->dev)); in lcs_clear_channel()
508 wait_event(channel->wait_q, (channel->state == LCS_CH_STATE_CLEARED)); in lcs_clear_channel()
509 channel->state = LCS_CH_STATE_STOPPED; in lcs_clear_channel()
523 if (channel->state == LCS_CH_STATE_STOPPED) in lcs_stop_channel()
526 LCS_DBF_TEXT_(4, trace, "%s", dev_name(&channel->ccwdev->dev)); in lcs_stop_channel()
527 channel->state = LCS_CH_STATE_INIT; in lcs_stop_channel()
528 spin_lock_irqsave(get_ccwdev_lock(channel->ccwdev), flags); in lcs_stop_channel()
529 rc = ccw_device_halt(channel->ccwdev, 0); in lcs_stop_channel()
530 spin_unlock_irqrestore(get_ccwdev_lock(channel->ccwdev), flags); in lcs_stop_channel()
533 dev_name(&channel->ccwdev->dev)); in lcs_stop_channel()
537 wait_event(channel->wait_q, (channel->state == LCS_CH_STATE_HALTED)); in lcs_stop_channel()
552 rc = lcs_start_channel(&card->read); in lcs_start_channels()
556 rc = lcs_start_channel(&card->write); in lcs_start_channels()
558 lcs_stop_channel(&card->read); in lcs_start_channels()
569 lcs_stop_channel(&card->read); in lcs_stop_channels()
570 lcs_stop_channel(&card->write); in lcs_stop_channels()
583 index = channel->io_idx; in __lcs_get_buffer()
585 if (channel->iob[index].state == LCS_BUF_STATE_EMPTY) { in __lcs_get_buffer()
586 channel->iob[index].state = LCS_BUF_STATE_LOCKED; in __lcs_get_buffer()
587 return channel->iob + index; in __lcs_get_buffer()
589 index = (index + 1) & (LCS_NUM_BUFFS - 1); in __lcs_get_buffer()
590 } while (index != channel->io_idx); in __lcs_get_buffer()
601 spin_lock_irqsave(get_ccwdev_lock(channel->ccwdev), flags); in lcs_get_buffer()
603 spin_unlock_irqrestore(get_ccwdev_lock(channel->ccwdev), flags); in lcs_get_buffer()
615 if (channel->state != LCS_CH_STATE_SUSPENDED) in __lcs_resume_channel()
617 if (channel->ccws[channel->io_idx].flags & CCW_FLAG_SUSPEND) in __lcs_resume_channel()
619 LCS_DBF_TEXT_(5, trace, "rsch%s", dev_name(&channel->ccwdev->dev)); in __lcs_resume_channel()
620 rc = ccw_device_resume(channel->ccwdev); in __lcs_resume_channel()
623 dev_name(&channel->ccwdev->dev)); in __lcs_resume_channel()
624 dev_err(&channel->ccwdev->dev, in __lcs_resume_channel()
628 channel->state = LCS_CH_STATE_RUNNING; in __lcs_resume_channel()
641 prev = (index - 1) & (LCS_NUM_BUFFS - 1); in __lcs_ready_buffer_bits()
642 next = (index + 1) & (LCS_NUM_BUFFS - 1); in __lcs_ready_buffer_bits()
644 if (channel->ccws[next].flags & CCW_FLAG_SUSPEND) { in __lcs_ready_buffer_bits()
646 if (!(channel->ccws[prev].flags & CCW_FLAG_SUSPEND)) in __lcs_ready_buffer_bits()
648 channel->ccws[index].flags |= CCW_FLAG_PCI; in __lcs_ready_buffer_bits()
650 channel->ccws[index].flags &= ~CCW_FLAG_SUSPEND; in __lcs_ready_buffer_bits()
661 BUG_ON(buffer->state != LCS_BUF_STATE_LOCKED && in lcs_ready_buffer()
662 buffer->state != LCS_BUF_STATE_PROCESSED); in lcs_ready_buffer()
663 spin_lock_irqsave(get_ccwdev_lock(channel->ccwdev), flags); in lcs_ready_buffer()
664 buffer->state = LCS_BUF_STATE_READY; in lcs_ready_buffer()
665 index = buffer - channel->iob; in lcs_ready_buffer()
667 channel->ccws[index].count = buffer->count; in lcs_ready_buffer()
671 spin_unlock_irqrestore(get_ccwdev_lock(channel->ccwdev), flags); in lcs_ready_buffer()
686 BUG_ON(buffer->state != LCS_BUF_STATE_READY); in __lcs_processed_buffer()
687 buffer->state = LCS_BUF_STATE_PROCESSED; in __lcs_processed_buffer()
688 index = buffer - channel->iob; in __lcs_processed_buffer()
689 prev = (index - 1) & (LCS_NUM_BUFFS - 1); in __lcs_processed_buffer()
690 next = (index + 1) & (LCS_NUM_BUFFS - 1); in __lcs_processed_buffer()
692 channel->ccws[index].flags |= CCW_FLAG_SUSPEND; in __lcs_processed_buffer()
693 channel->ccws[index].flags &= ~CCW_FLAG_PCI; in __lcs_processed_buffer()
695 if (channel->iob[prev].state == LCS_BUF_STATE_READY) { in __lcs_processed_buffer()
705 channel->ccws[next].flags &= ~CCW_FLAG_PCI; in __lcs_processed_buffer()
718 BUG_ON(buffer->state != LCS_BUF_STATE_LOCKED && in lcs_release_buffer()
719 buffer->state != LCS_BUF_STATE_PROCESSED); in lcs_release_buffer()
720 spin_lock_irqsave(get_ccwdev_lock(channel->ccwdev), flags); in lcs_release_buffer()
721 buffer->state = LCS_BUF_STATE_EMPTY; in lcs_release_buffer()
722 spin_unlock_irqrestore(get_ccwdev_lock(channel->ccwdev), flags); in lcs_release_buffer()
732 struct lcs_cmd *cmd; in lcs_get_lancmd() local
736 wait_event(card->write.wait_q, in lcs_get_lancmd()
737 ((buffer = lcs_get_buffer(&card->write)) != NULL)); in lcs_get_lancmd()
739 *(__u16 *)(buffer->data + count) = 0; in lcs_get_lancmd()
740 buffer->count = count + sizeof(__u16); in lcs_get_lancmd()
741 buffer->callback = lcs_release_buffer; in lcs_get_lancmd()
742 cmd = (struct lcs_cmd *) buffer->data; in lcs_get_lancmd()
743 cmd->offset = count; in lcs_get_lancmd()
744 cmd->type = LCS_FRAME_TYPE_CONTROL; in lcs_get_lancmd()
745 cmd->slot = 0; in lcs_get_lancmd()
753 refcount_inc(&reply->refcnt); in lcs_get_reply()
759 if (refcount_dec_and_test(&reply->refcnt)) in lcs_put_reply()
764 lcs_alloc_reply(struct lcs_cmd *cmd) in lcs_alloc_reply() argument
773 refcount_set(&reply->refcnt, 1); in lcs_alloc_reply()
774 reply->sequence_no = cmd->sequence_no; in lcs_alloc_reply()
775 reply->received = 0; in lcs_alloc_reply()
776 reply->rc = 0; in lcs_alloc_reply()
777 init_waitqueue_head(&reply->wait_q); in lcs_alloc_reply()
786 lcs_notify_lancmd_waiters(struct lcs_card *card, struct lcs_cmd *cmd) in lcs_notify_lancmd_waiters() argument
792 spin_lock(&card->lock); in lcs_notify_lancmd_waiters()
793 list_for_each_safe(l, n, &card->lancmd_waiters) { in lcs_notify_lancmd_waiters()
795 if (reply->sequence_no == cmd->sequence_no) { in lcs_notify_lancmd_waiters()
797 list_del_init(&reply->list); in lcs_notify_lancmd_waiters()
798 if (reply->callback != NULL) in lcs_notify_lancmd_waiters()
799 reply->callback(card, cmd); in lcs_notify_lancmd_waiters()
800 reply->received = 1; in lcs_notify_lancmd_waiters()
801 reply->rc = cmd->return_code; in lcs_notify_lancmd_waiters()
802 wake_up(&reply->wait_q); in lcs_notify_lancmd_waiters()
807 spin_unlock(&card->lock); in lcs_notify_lancmd_waiters()
821 spin_lock_irqsave(&reply->card->lock, flags); in lcs_lancmd_timeout()
823 &reply->card->lancmd_waiters,list) { in lcs_lancmd_timeout()
826 list_del_init(&reply->list); in lcs_lancmd_timeout()
827 spin_unlock_irqrestore(&reply->card->lock, flags); in lcs_lancmd_timeout()
828 reply->received = 1; in lcs_lancmd_timeout()
829 reply->rc = -ETIME; in lcs_lancmd_timeout()
830 wake_up(&reply->wait_q); in lcs_lancmd_timeout()
835 spin_unlock_irqrestore(&reply->card->lock, flags); in lcs_lancmd_timeout()
843 struct lcs_cmd *cmd; in lcs_send_lancmd() local
848 cmd = (struct lcs_cmd *) buffer->data; in lcs_send_lancmd()
849 cmd->return_code = 0; in lcs_send_lancmd()
850 cmd->sequence_no = card->sequence_no++; in lcs_send_lancmd()
851 reply = lcs_alloc_reply(cmd); in lcs_send_lancmd()
853 return -ENOMEM; in lcs_send_lancmd()
854 reply->callback = reply_callback; in lcs_send_lancmd()
855 reply->card = card; in lcs_send_lancmd()
856 spin_lock_irqsave(&card->lock, flags); in lcs_send_lancmd()
857 list_add_tail(&reply->list, &card->lancmd_waiters); in lcs_send_lancmd()
858 spin_unlock_irqrestore(&card->lock, flags); in lcs_send_lancmd()
860 buffer->callback = lcs_release_buffer; in lcs_send_lancmd()
861 rc = lcs_ready_buffer(&card->write, buffer); in lcs_send_lancmd()
864 timer_setup(&reply->timer, lcs_lancmd_timeout, 0); in lcs_send_lancmd()
865 mod_timer(&reply->timer, jiffies + HZ * card->lancmd_timeout); in lcs_send_lancmd()
866 wait_event(reply->wait_q, reply->received); in lcs_send_lancmd()
867 del_timer_sync(&reply->timer); in lcs_send_lancmd()
868 LCS_DBF_TEXT_(4, trace, "rc:%d",reply->rc); in lcs_send_lancmd()
869 rc = reply->rc; in lcs_send_lancmd()
871 return rc ? -EIO : 0; in lcs_send_lancmd()
881 struct lcs_cmd *cmd; in lcs_send_startup() local
885 cmd = (struct lcs_cmd *) buffer->data; in lcs_send_startup()
886 cmd->cmd_code = LCS_CMD_STARTUP; in lcs_send_startup()
887 cmd->initiator = initiator; in lcs_send_startup()
888 cmd->cmd.lcs_startup.buff_size = LCS_IOBUFFERSIZE; in lcs_send_startup()
899 struct lcs_cmd *cmd; in lcs_send_shutdown() local
903 cmd = (struct lcs_cmd *) buffer->data; in lcs_send_shutdown()
904 cmd->cmd_code = LCS_CMD_SHUTDOWN; in lcs_send_shutdown()
905 cmd->initiator = LCS_INITIATOR_TCPIP; in lcs_send_shutdown()
913 __lcs_lanstat_cb(struct lcs_card *card, struct lcs_cmd *cmd) in __lcs_lanstat_cb() argument
916 memcpy(card->mac, cmd->cmd.lcs_lanstat_cmd.mac_addr, LCS_MAC_LENGTH); in __lcs_lanstat_cb()
923 struct lcs_cmd *cmd; in lcs_send_lanstat() local
927 cmd = (struct lcs_cmd *) buffer->data; in lcs_send_lanstat()
929 cmd->cmd_code = LCS_CMD_LANSTAT; in lcs_send_lanstat()
930 cmd->initiator = LCS_INITIATOR_TCPIP; in lcs_send_lanstat()
931 cmd->cmd.lcs_std_cmd.lan_type = card->lan_type; in lcs_send_lanstat()
932 cmd->cmd.lcs_std_cmd.portno = card->portno; in lcs_send_lanstat()
943 struct lcs_cmd *cmd; in lcs_send_stoplan() local
947 cmd = (struct lcs_cmd *) buffer->data; in lcs_send_stoplan()
948 cmd->cmd_code = LCS_CMD_STOPLAN; in lcs_send_stoplan()
949 cmd->initiator = initiator; in lcs_send_stoplan()
950 cmd->cmd.lcs_std_cmd.lan_type = card->lan_type; in lcs_send_stoplan()
951 cmd->cmd.lcs_std_cmd.portno = card->portno; in lcs_send_stoplan()
959 __lcs_send_startlan_cb(struct lcs_card *card, struct lcs_cmd *cmd) in __lcs_send_startlan_cb() argument
962 card->lan_type = cmd->cmd.lcs_std_cmd.lan_type; in __lcs_send_startlan_cb()
963 card->portno = cmd->cmd.lcs_std_cmd.portno; in __lcs_send_startlan_cb()
970 struct lcs_cmd *cmd; in lcs_send_startlan() local
974 cmd = (struct lcs_cmd *) buffer->data; in lcs_send_startlan()
975 cmd->cmd_code = LCS_CMD_STARTLAN; in lcs_send_startlan()
976 cmd->initiator = initiator; in lcs_send_startlan()
977 cmd->cmd.lcs_std_cmd.lan_type = card->lan_type; in lcs_send_startlan()
978 cmd->cmd.lcs_std_cmd.portno = card->portno; in lcs_send_startlan()
990 struct lcs_cmd *cmd; in lcs_send_setipm() local
994 cmd = (struct lcs_cmd *) buffer->data; in lcs_send_setipm()
995 cmd->cmd_code = LCS_CMD_SETIPM; in lcs_send_setipm()
996 cmd->initiator = LCS_INITIATOR_TCPIP; in lcs_send_setipm()
997 cmd->cmd.lcs_qipassist.lan_type = card->lan_type; in lcs_send_setipm()
998 cmd->cmd.lcs_qipassist.portno = card->portno; in lcs_send_setipm()
999 cmd->cmd.lcs_qipassist.version = 4; in lcs_send_setipm()
1000 cmd->cmd.lcs_qipassist.num_ip_pairs = 1; in lcs_send_setipm()
1001 memcpy(cmd->cmd.lcs_qipassist.lcs_ipass_ctlmsg.ip_mac_pair, in lcs_send_setipm()
1002 &ipm_list->ipm, sizeof (struct lcs_ip_mac_pair)); in lcs_send_setipm()
1003 LCS_DBF_TEXT_(2, trace, "%x",ipm_list->ipm.ip_addr); in lcs_send_setipm()
1014 struct lcs_cmd *cmd; in lcs_send_delipm() local
1018 cmd = (struct lcs_cmd *) buffer->data; in lcs_send_delipm()
1019 cmd->cmd_code = LCS_CMD_DELIPM; in lcs_send_delipm()
1020 cmd->initiator = LCS_INITIATOR_TCPIP; in lcs_send_delipm()
1021 cmd->cmd.lcs_qipassist.lan_type = card->lan_type; in lcs_send_delipm()
1022 cmd->cmd.lcs_qipassist.portno = card->portno; in lcs_send_delipm()
1023 cmd->cmd.lcs_qipassist.version = 4; in lcs_send_delipm()
1024 cmd->cmd.lcs_qipassist.num_ip_pairs = 1; in lcs_send_delipm()
1025 memcpy(cmd->cmd.lcs_qipassist.lcs_ipass_ctlmsg.ip_mac_pair, in lcs_send_delipm()
1026 &ipm_list->ipm, sizeof (struct lcs_ip_mac_pair)); in lcs_send_delipm()
1027 LCS_DBF_TEXT_(2, trace, "%x",ipm_list->ipm.ip_addr); in lcs_send_delipm()
1035 __lcs_check_multicast_cb(struct lcs_card *card, struct lcs_cmd *cmd) in __lcs_check_multicast_cb() argument
1038 card->ip_assists_supported = in __lcs_check_multicast_cb()
1039 cmd->cmd.lcs_qipassist.ip_assists_supported; in __lcs_check_multicast_cb()
1040 card->ip_assists_enabled = in __lcs_check_multicast_cb()
1041 cmd->cmd.lcs_qipassist.ip_assists_enabled; in __lcs_check_multicast_cb()
1048 struct lcs_cmd *cmd; in lcs_check_multicast_support() local
1054 cmd = (struct lcs_cmd *) buffer->data; in lcs_check_multicast_support()
1055 cmd->cmd_code = LCS_CMD_QIPASSIST; in lcs_check_multicast_support()
1056 cmd->initiator = LCS_INITIATOR_TCPIP; in lcs_check_multicast_support()
1057 cmd->cmd.lcs_qipassist.lan_type = card->lan_type; in lcs_check_multicast_support()
1058 cmd->cmd.lcs_qipassist.portno = card->portno; in lcs_check_multicast_support()
1059 cmd->cmd.lcs_qipassist.version = 4; in lcs_check_multicast_support()
1060 cmd->cmd.lcs_qipassist.num_ip_pairs = 1; in lcs_check_multicast_support()
1064 return -EOPNOTSUPP; in lcs_check_multicast_support()
1066 if (card->ip_assists_supported & LCS_IPASS_MULTICAST_SUPPORT) in lcs_check_multicast_support()
1068 return -EOPNOTSUPP; in lcs_check_multicast_support()
1084 spin_lock_irqsave(&card->ipm_lock, flags); in lcs_fix_multicast_list()
1086 list_for_each_entry_safe(ipm, tmp, &card->ipm_list, list){ in lcs_fix_multicast_list()
1087 switch (ipm->ipm_state) { in lcs_fix_multicast_list()
1091 list_del_init(&ipm->list); in lcs_fix_multicast_list()
1092 spin_unlock_irqrestore(&card->ipm_lock, flags); in lcs_fix_multicast_list()
1094 spin_lock_irqsave(&card->ipm_lock, flags); in lcs_fix_multicast_list()
1098 /* store ipm in failed list -> will be added in lcs_fix_multicast_list()
1101 list_add_tail(&ipm->list, &failed_list); in lcs_fix_multicast_list()
1103 ipm->ipm_state = LCS_IPM_STATE_ON_CARD; in lcs_fix_multicast_list()
1104 /* re-insert into ipm_list */ in lcs_fix_multicast_list()
1105 list_add_tail(&ipm->list, &card->ipm_list); in lcs_fix_multicast_list()
1109 list_del(&ipm->list); in lcs_fix_multicast_list()
1110 spin_unlock_irqrestore(&card->ipm_lock, flags); in lcs_fix_multicast_list()
1112 spin_lock_irqsave(&card->ipm_lock, flags); in lcs_fix_multicast_list()
1119 /* re-insert all entries from the failed_list into ipm_list */ in lcs_fix_multicast_list()
1121 list_move_tail(&ipm->list, &card->ipm_list); in lcs_fix_multicast_list()
1123 spin_unlock_irqrestore(&card->ipm_lock, flags); in lcs_fix_multicast_list()
1149 spin_lock_irqsave(&card->ipm_lock, flags); in lcs_remove_mc_addresses()
1150 list_for_each(l, &card->ipm_list) { in lcs_remove_mc_addresses()
1152 for (im4 = rcu_dereference(in4_dev->mc_list); in lcs_remove_mc_addresses()
1153 im4 != NULL; im4 = rcu_dereference(im4->next_rcu)) { in lcs_remove_mc_addresses()
1154 lcs_get_mac_for_ipm(im4->multiaddr, buf, card->dev); in lcs_remove_mc_addresses()
1155 if ( (ipm->ipm.ip_addr == im4->multiaddr) && in lcs_remove_mc_addresses()
1156 (memcmp(buf, &ipm->ipm.mac_addr, in lcs_remove_mc_addresses()
1161 ipm->ipm_state = LCS_IPM_STATE_DEL_REQUIRED; in lcs_remove_mc_addresses()
1163 spin_unlock_irqrestore(&card->ipm_lock, flags); in lcs_remove_mc_addresses()
1175 spin_lock_irqsave(&card->ipm_lock, flags); in lcs_check_addr_entry()
1176 list_for_each(l, &card->ipm_list) { in lcs_check_addr_entry()
1178 if ( (tmp->ipm.ip_addr == im4->multiaddr) && in lcs_check_addr_entry()
1179 (memcmp(buf, &tmp->ipm.mac_addr, in lcs_check_addr_entry()
1185 spin_unlock_irqrestore(&card->ipm_lock, flags); in lcs_check_addr_entry()
1199 for (im4 = rcu_dereference(in4_dev->mc_list); im4 != NULL; in lcs_set_mc_addresses()
1200 im4 = rcu_dereference(im4->next_rcu)) { in lcs_set_mc_addresses()
1201 lcs_get_mac_for_ipm(im4->multiaddr, buf, card->dev); in lcs_set_mc_addresses()
1211 memcpy(&ipm->ipm.mac_addr, buf, LCS_MAC_LENGTH); in lcs_set_mc_addresses()
1212 ipm->ipm.ip_addr = im4->multiaddr; in lcs_set_mc_addresses()
1213 ipm->ipm_state = LCS_IPM_STATE_SET_REQUIRED; in lcs_set_mc_addresses()
1214 spin_lock_irqsave(&card->ipm_lock, flags); in lcs_set_mc_addresses()
1215 LCS_DBF_HEX(2,trace,&ipm->ipm.ip_addr,4); in lcs_set_mc_addresses()
1216 list_add(&ipm->list, &card->ipm_list); in lcs_set_mc_addresses()
1217 spin_unlock_irqrestore(&card->ipm_lock, flags); in lcs_set_mc_addresses()
1233 in4_dev = in_dev_get(card->dev); in lcs_register_mc_addresses()
1242 netif_carrier_off(card->dev); in lcs_register_mc_addresses()
1243 netif_tx_disable(card->dev); in lcs_register_mc_addresses()
1244 wait_event(card->write.wait_q, in lcs_register_mc_addresses()
1245 (card->write.state != LCS_CH_STATE_RUNNING)); in lcs_register_mc_addresses()
1247 if (card->state == DEV_STATE_UP) { in lcs_register_mc_addresses()
1248 netif_carrier_on(card->dev); in lcs_register_mc_addresses()
1249 netif_wake_queue(card->dev); in lcs_register_mc_addresses()
1268 card = (struct lcs_card *) dev->ml_priv; in lcs_set_multicast_list()
1271 schedule_work(&card->kernel_thread_starter); in lcs_set_multicast_list()
1282 case -EIO: in lcs_check_irb_error()
1283 dev_warn(&cdev->dev, in lcs_check_irb_error()
1284 "An I/O-error occurred on the LCS device\n"); in lcs_check_irb_error()
1286 LCS_DBF_TEXT_(2, trace, " rc%d", -EIO); in lcs_check_irb_error()
1288 case -ETIMEDOUT: in lcs_check_irb_error()
1289 dev_warn(&cdev->dev, in lcs_check_irb_error()
1292 LCS_DBF_TEXT_(2, trace, " rc%d", -ETIMEDOUT); in lcs_check_irb_error()
1295 dev_warn(&cdev->dev, in lcs_check_irb_error()
1310 sense = (char *) irb->ecw; in lcs_get_problem()
1311 cstat = irb->scsw.cmd.cstat; in lcs_get_problem()
1312 dstat = irb->scsw.cmd.dstat; in lcs_get_problem()
1349 schedule_work(&card->kernel_thread_starter); in lcs_schedule_recovery()
1367 if (card->read.ccwdev == cdev) in lcs_irq()
1368 channel = &card->read; in lcs_irq()
1370 channel = &card->write; in lcs_irq()
1372 cstat = irb->scsw.cmd.cstat; in lcs_irq()
1373 dstat = irb->scsw.cmd.dstat; in lcs_irq()
1374 LCS_DBF_TEXT_(5, trace, "Rint%s", dev_name(&cdev->dev)); in lcs_irq()
1375 LCS_DBF_TEXT_(5, trace, "%4x%4x", irb->scsw.cmd.cstat, in lcs_irq()
1376 irb->scsw.cmd.dstat); in lcs_irq()
1377 LCS_DBF_TEXT_(5, trace, "%4x%4x", irb->scsw.cmd.fctl, in lcs_irq()
1378 irb->scsw.cmd.actl); in lcs_irq()
1383 dev_warn(&cdev->dev, in lcs_irq()
1388 channel->state = LCS_CH_STATE_ERROR; in lcs_irq()
1391 if (channel->state == LCS_CH_STATE_ERROR) { in lcs_irq()
1393 wake_up(&card->wait_q); in lcs_irq()
1397 if ((channel->state != LCS_CH_STATE_INIT) && in lcs_irq()
1398 (irb->scsw.cmd.fctl & SCSW_FCTL_START_FUNC) && in lcs_irq()
1399 (irb->scsw.cmd.cpa != 0)) { in lcs_irq()
1400 index = (struct ccw1 *)dma32_to_virt(irb->scsw.cmd.cpa) in lcs_irq()
1401 - channel->ccws; in lcs_irq()
1402 if ((irb->scsw.cmd.actl & SCSW_ACTL_SUSPENDED) || in lcs_irq()
1403 (irb->scsw.cmd.cstat & SCHN_STAT_PCI)) in lcs_irq()
1405 index = (index - 1) & (LCS_NUM_BUFFS - 1); in lcs_irq()
1406 while (channel->io_idx != index) { in lcs_irq()
1408 channel->iob + channel->io_idx); in lcs_irq()
1409 channel->io_idx = in lcs_irq()
1410 (channel->io_idx + 1) & (LCS_NUM_BUFFS - 1); in lcs_irq()
1414 if ((irb->scsw.cmd.dstat & DEV_STAT_DEV_END) || in lcs_irq()
1415 (irb->scsw.cmd.dstat & DEV_STAT_CHN_END) || in lcs_irq()
1416 (irb->scsw.cmd.dstat & DEV_STAT_UNIT_CHECK)) in lcs_irq()
1418 channel->state = LCS_CH_STATE_STOPPED; in lcs_irq()
1419 else if (irb->scsw.cmd.actl & SCSW_ACTL_SUSPENDED) in lcs_irq()
1421 channel->state = LCS_CH_STATE_SUSPENDED; in lcs_irq()
1422 if (irb->scsw.cmd.fctl & SCSW_FCTL_HALT_FUNC) { in lcs_irq()
1423 if (irb->scsw.cmd.cc != 0) { in lcs_irq()
1424 ccw_device_halt(channel->ccwdev, 0); in lcs_irq()
1428 channel->state = LCS_CH_STATE_HALTED; in lcs_irq()
1430 if (irb->scsw.cmd.fctl & SCSW_FCTL_CLEAR_FUNC) in lcs_irq()
1431 channel->state = LCS_CH_STATE_CLEARED; in lcs_irq()
1433 tasklet_schedule(&channel->irq_tasklet); in lcs_irq()
1448 LCS_DBF_TEXT_(5, trace, "tlet%s", dev_name(&channel->ccwdev->dev)); in lcs_tasklet()
1451 iob = channel->iob; in lcs_tasklet()
1452 buf_idx = channel->buf_idx; in lcs_tasklet()
1457 buf_idx = (buf_idx + 1) & (LCS_NUM_BUFFS - 1); in lcs_tasklet()
1459 channel->buf_idx = buf_idx; in lcs_tasklet()
1461 if (channel->state == LCS_CH_STATE_STOPPED) in lcs_tasklet()
1463 spin_lock_irqsave(get_ccwdev_lock(channel->ccwdev), flags); in lcs_tasklet()
1464 if (channel->state == LCS_CH_STATE_SUSPENDED && in lcs_tasklet()
1465 channel->iob[channel->io_idx].state == LCS_BUF_STATE_READY) in lcs_tasklet()
1467 spin_unlock_irqrestore(get_ccwdev_lock(channel->ccwdev), flags); in lcs_tasklet()
1470 wake_up(&channel->wait_q); in lcs_tasklet()
1480 *(__u16 *)(card->tx_buffer->data + card->tx_buffer->count) = 0; in __lcs_emit_txbuffer()
1481 card->tx_buffer->count += 2; in __lcs_emit_txbuffer()
1482 lcs_ready_buffer(&card->write, card->tx_buffer); in __lcs_emit_txbuffer()
1483 card->tx_buffer = NULL; in __lcs_emit_txbuffer()
1484 card->tx_emitted++; in __lcs_emit_txbuffer()
1499 if (netif_queue_stopped(card->dev) && netif_carrier_ok(card->dev)) in lcs_txbuffer_cb()
1500 netif_wake_queue(card->dev); in lcs_txbuffer_cb()
1501 spin_lock(&card->lock); in lcs_txbuffer_cb()
1502 card->tx_emitted--; in lcs_txbuffer_cb()
1503 if (card->tx_emitted <= 0 && card->tx_buffer != NULL) in lcs_txbuffer_cb()
1509 spin_unlock(&card->lock); in lcs_txbuffer_cb()
1523 card->stats.tx_dropped++; in __lcs_start_xmit()
1524 card->stats.tx_errors++; in __lcs_start_xmit()
1527 if (card->state != DEV_STATE_UP) { in __lcs_start_xmit()
1529 card->stats.tx_dropped++; in __lcs_start_xmit()
1530 card->stats.tx_errors++; in __lcs_start_xmit()
1531 card->stats.tx_carrier_errors++; in __lcs_start_xmit()
1534 if (skb->protocol == htons(ETH_P_IPV6)) { in __lcs_start_xmit()
1538 netif_stop_queue(card->dev); in __lcs_start_xmit()
1539 spin_lock(&card->lock); in __lcs_start_xmit()
1540 if (card->tx_buffer != NULL && in __lcs_start_xmit()
1541 card->tx_buffer->count + sizeof(struct lcs_header) + in __lcs_start_xmit()
1542 skb->len + sizeof(u16) > LCS_IOBUFFERSIZE) in __lcs_start_xmit()
1545 if (card->tx_buffer == NULL) { in __lcs_start_xmit()
1547 card->tx_buffer = lcs_get_buffer(&card->write); in __lcs_start_xmit()
1548 if (card->tx_buffer == NULL) { in __lcs_start_xmit()
1549 card->stats.tx_dropped++; in __lcs_start_xmit()
1553 card->tx_buffer->callback = lcs_txbuffer_cb; in __lcs_start_xmit()
1554 card->tx_buffer->count = 0; in __lcs_start_xmit()
1557 (card->tx_buffer->data + card->tx_buffer->count); in __lcs_start_xmit()
1558 card->tx_buffer->count += skb->len + sizeof(struct lcs_header); in __lcs_start_xmit()
1559 header->offset = card->tx_buffer->count; in __lcs_start_xmit()
1560 header->type = card->lan_type; in __lcs_start_xmit()
1561 header->slot = card->portno; in __lcs_start_xmit()
1562 skb_copy_from_linear_data(skb, header + 1, skb->len); in __lcs_start_xmit()
1563 spin_unlock(&card->lock); in __lcs_start_xmit()
1564 card->stats.tx_bytes += skb->len; in __lcs_start_xmit()
1565 card->stats.tx_packets++; in __lcs_start_xmit()
1567 netif_wake_queue(card->dev); in __lcs_start_xmit()
1568 spin_lock(&card->lock); in __lcs_start_xmit()
1569 if (card->tx_emitted <= 0 && card->tx_buffer != NULL) in __lcs_start_xmit()
1573 spin_unlock(&card->lock); in __lcs_start_xmit()
1583 card = (struct lcs_card *) dev->ml_priv; in lcs_start_xmit()
1597 card->lan_type = LCS_FRAME_TYPE_ENET; in lcs_startlan_auto()
1602 return -EIO; in lcs_startlan_auto()
1612 if (card->portno != LCS_INVALID_PORT_NO) { in lcs_startlan()
1613 if (card->lan_type == LCS_FRAME_TYPE_AUTO) in lcs_startlan()
1619 card->portno = i; in lcs_startlan()
1620 if (card->lan_type != LCS_FRAME_TYPE_AUTO) in lcs_startlan()
1646 if (card->dev) in lcs_detect()
1647 netif_stop_queue(card->dev); in lcs_detect()
1658 card->state = DEV_STATE_UP; in lcs_detect()
1660 card->state = DEV_STATE_DOWN; in lcs_detect()
1661 card->write.state = LCS_CH_STATE_INIT; in lcs_detect()
1662 card->read.state = LCS_CH_STATE_INIT; in lcs_detect()
1677 if (card->read.state != LCS_CH_STATE_STOPPED && in lcs_stopcard()
1678 card->write.state != LCS_CH_STATE_STOPPED && in lcs_stopcard()
1679 card->read.state != LCS_CH_STATE_ERROR && in lcs_stopcard()
1680 card->write.state != LCS_CH_STATE_ERROR && in lcs_stopcard()
1681 card->state == DEV_STATE_UP) { in lcs_stopcard()
1687 card->state = DEV_STATE_DOWN; in lcs_stopcard()
1712 lcs_get_control(struct lcs_card *card, struct lcs_cmd *cmd) in lcs_get_control() argument
1715 if (cmd->initiator == LCS_INITIATOR_LGW) { in lcs_get_control()
1716 switch(cmd->cmd_code) { in lcs_get_control()
1722 if (card->dev) { in lcs_get_control()
1724 card->dev->name); in lcs_get_control()
1725 netif_carrier_off(card->dev); in lcs_get_control()
1733 lcs_notify_lancmd_waiters(card, cmd); in lcs_get_control()
1745 if (card->dev == NULL || in lcs_get_skb()
1746 card->state != DEV_STATE_UP) in lcs_get_skb()
1752 dev_err(&card->dev->dev, in lcs_get_skb()
1754 card->dev->name); in lcs_get_skb()
1755 card->stats.rx_dropped++; in lcs_get_skb()
1759 skb->protocol = card->lan_type_trans(skb, card->dev); in lcs_get_skb()
1760 card->stats.rx_bytes += skb_len; in lcs_get_skb()
1761 card->stats.rx_packets++; in lcs_get_skb()
1762 if (skb->protocol == htons(ETH_P_802_2)) in lcs_get_skb()
1763 *((__u32 *)skb->cb) = ++card->pkt_seq; in lcs_get_skb()
1778 lcs_hdr = (struct lcs_header *) buffer->data; in lcs_get_frames_cb()
1779 if (lcs_hdr->offset == LCS_ILLEGAL_OFFSET) { in lcs_get_frames_cb()
1780 LCS_DBF_TEXT(4, trace, "-eiogpkt"); in lcs_get_frames_cb()
1785 while (lcs_hdr->offset != 0) { in lcs_get_frames_cb()
1786 if (lcs_hdr->offset <= 0 || in lcs_get_frames_cb()
1787 lcs_hdr->offset > LCS_IOBUFFERSIZE || in lcs_get_frames_cb()
1788 lcs_hdr->offset < offset) { in lcs_get_frames_cb()
1790 card->stats.rx_length_errors++; in lcs_get_frames_cb()
1791 card->stats.rx_errors++; in lcs_get_frames_cb()
1794 if (lcs_hdr->type == LCS_FRAME_TYPE_CONTROL) in lcs_get_frames_cb()
1796 else if (lcs_hdr->type == LCS_FRAME_TYPE_ENET) in lcs_get_frames_cb()
1798 lcs_hdr->offset - offset - in lcs_get_frames_cb()
1801 dev_info_once(&card->dev->dev, in lcs_get_frames_cb()
1803 lcs_hdr->type); in lcs_get_frames_cb()
1804 offset = lcs_hdr->offset; in lcs_get_frames_cb()
1805 lcs_hdr->offset = LCS_ILLEGAL_OFFSET; in lcs_get_frames_cb()
1806 lcs_hdr = (struct lcs_header *) (buffer->data + offset); in lcs_get_frames_cb()
1809 lcs_ready_buffer(&card->read, buffer); in lcs_get_frames_cb()
1821 card = (struct lcs_card *) dev->ml_priv; in lcs_getstats()
1822 return &card->stats; in lcs_getstats()
1836 card = (struct lcs_card *) dev->ml_priv; in lcs_stop_device()
1839 dev->flags &= ~IFF_UP; in lcs_stop_device()
1840 wait_event(card->write.wait_q, in lcs_stop_device()
1841 (card->write.state != LCS_CH_STATE_RUNNING)); in lcs_stop_device()
1844 dev_err(&card->dev->dev, in lcs_stop_device()
1860 card = (struct lcs_card *) dev->ml_priv; in lcs_open_device()
1867 dev->flags |= IFF_UP; in lcs_open_device()
1870 card->state = DEV_STATE_UP; in lcs_open_device()
1888 return sysfs_emit(buf, "%d\n", card->portno); in lcs_portno_show()
1908 return -EINVAL; in lcs_portno_store()
1910 card->portno = value; in lcs_portno_store()
1911 if (card->dev) in lcs_portno_store()
1912 card->dev->dev_port = card->portno; in lcs_portno_store()
1936 return -ENODEV; in lcs_type_show()
1939 lcs_type[cgdev->cdev[0]->id.driver_info]); in lcs_type_show()
1951 return card ? sysfs_emit(buf, "%u\n", card->lancmd_timeout) : 0; in lcs_timeout_show()
1968 return -EINVAL; in lcs_timeout_store()
1970 card->lancmd_timeout = value; in lcs_timeout_store()
1987 return -EINVAL; in lcs_dev_recover_store()
1988 if (card->state != DEV_STATE_UP) in lcs_dev_recover_store()
1989 return -EPERM; in lcs_dev_recover_store()
2013 .name = "lcs",
2025 if (!get_device(&ccwgdev->dev)) in lcs_probe_device()
2026 return -ENODEV; in lcs_probe_device()
2031 LCS_DBF_TEXT_(2, setup, " rc%d", -ENOMEM); in lcs_probe_device()
2032 put_device(&ccwgdev->dev); in lcs_probe_device()
2033 return -ENOMEM; in lcs_probe_device()
2035 dev_set_drvdata(&ccwgdev->dev, card); in lcs_probe_device()
2036 ccwgdev->cdev[0]->handler = lcs_irq; in lcs_probe_device()
2037 ccwgdev->cdev[1]->handler = lcs_irq; in lcs_probe_device()
2038 card->gdev = ccwgdev; in lcs_probe_device()
2039 INIT_WORK(&card->kernel_thread_starter, lcs_start_kernel_thread); in lcs_probe_device()
2040 card->thread_start_mask = 0; in lcs_probe_device()
2041 card->thread_allowed_mask = 0; in lcs_probe_device()
2042 card->thread_running_mask = 0; in lcs_probe_device()
2043 ccwgdev->dev.type = &lcs_devtype; in lcs_probe_device()
2054 card = dev_get_drvdata(&ccwgdev->dev); in lcs_register_netdev()
2055 if (card->dev->reg_state != NETREG_UNINITIALIZED) in lcs_register_netdev()
2057 SET_NETDEV_DEV(card->dev, &ccwgdev->dev); in lcs_register_netdev()
2058 return register_netdev(card->dev); in lcs_register_netdev()
2087 card = dev_get_drvdata(&ccwgdev->dev); in lcs_new_device()
2089 return -ENODEV; in lcs_new_device()
2093 card->read.ccwdev = ccwgdev->cdev[0]; in lcs_new_device()
2094 card->write.ccwdev = ccwgdev->cdev[1]; in lcs_new_device()
2096 recover_state = card->state; in lcs_new_device()
2097 rc = ccw_device_set_online(card->read.ccwdev); in lcs_new_device()
2100 rc = ccw_device_set_online(card->write.ccwdev); in lcs_new_device()
2110 dev_err(&ccwgdev->dev, in lcs_new_device()
2116 if (card->dev) { in lcs_new_device()
2121 switch (card->lan_type) { in lcs_new_device()
2123 card->lan_type_trans = eth_type_trans; in lcs_new_device()
2133 card->dev = dev; in lcs_new_device()
2134 card->dev->ml_priv = card; in lcs_new_device()
2135 card->dev->netdev_ops = &lcs_netdev_ops; in lcs_new_device()
2136 card->dev->dev_port = card->portno; in lcs_new_device()
2137 eth_hw_addr_set(card->dev, card->mac); in lcs_new_device()
2140 card->dev->netdev_ops = &lcs_mc_netdev_ops; in lcs_new_device()
2145 lcs_set_multicast_list(card->dev); in lcs_new_device()
2146 card->dev->flags |= IFF_UP; in lcs_new_device()
2147 netif_carrier_on(card->dev); in lcs_new_device()
2148 netif_wake_queue(card->dev); in lcs_new_device()
2149 card->state = DEV_STATE_UP; in lcs_new_device()
2158 pr_info("LCS device %s %s IPv6 support\n", card->dev->name, in lcs_new_device()
2159 (card->ip_assists_supported & LCS_IPASS_IPV6_SUPPORT) ? in lcs_new_device()
2162 pr_info("LCS device %s %s Multicast support\n", card->dev->name, in lcs_new_device()
2163 (card->ip_assists_supported & LCS_IPASS_MULTICAST_SUPPORT) ? in lcs_new_device()
2168 ccw_device_set_offline(card->write.ccwdev); in lcs_new_device()
2170 ccw_device_set_offline(card->read.ccwdev); in lcs_new_device()
2172 return -ENODEV; in lcs_new_device()
2186 card = dev_get_drvdata(&ccwgdev->dev); in __lcs_shutdown_device()
2188 return -ENODEV; in __lcs_shutdown_device()
2192 return -ERESTARTSYS; in __lcs_shutdown_device()
2195 recover_state = card->state; in __lcs_shutdown_device()
2197 ret = lcs_stop_device(card->dev); in __lcs_shutdown_device()
2198 ret2 = ccw_device_set_offline(card->read.ccwdev); in __lcs_shutdown_device()
2199 ret3 = ccw_device_set_offline(card->write.ccwdev); in __lcs_shutdown_device()
2205 card->state = DEV_STATE_RECOVER; in __lcs_shutdown_device()
2232 gdev = card->gdev; in lcs_recovery()
2233 dev_warn(&gdev->dev, in lcs_recovery()
2239 card->dev->name); in lcs_recovery()
2242 card->dev->name); in lcs_recovery()
2255 card = dev_get_drvdata(&ccwgdev->dev); in lcs_remove_device()
2261 if (ccwgdev->state == CCWGROUP_ONLINE) { in lcs_remove_device()
2264 if (card->dev) in lcs_remove_device()
2265 unregister_netdev(card->dev); in lcs_remove_device()
2268 dev_set_drvdata(&ccwgdev->dev, NULL); in lcs_remove_device()
2269 put_device(&ccwgdev->dev); in lcs_remove_device()
2283 .name = "lcs",
2297 .name = "lcs",