Lines Matching refs:card

68 static void qeth_issue_next_read_cb(struct qeth_card *card,
72 static void qeth_free_qdio_queues(struct qeth_card *card);
74 static const char *qeth_get_cardname(struct qeth_card *card) in qeth_get_cardname() argument
76 if (IS_VM_NIC(card)) { in qeth_get_cardname()
77 switch (card->info.type) { in qeth_get_cardname()
90 switch (card->info.type) { in qeth_get_cardname()
107 const char *qeth_get_cardname_short(struct qeth_card *card) in qeth_get_cardname_short() argument
109 if (IS_VM_NIC(card)) { in qeth_get_cardname_short()
110 switch (card->info.type) { in qeth_get_cardname_short()
123 switch (card->info.type) { in qeth_get_cardname_short()
125 switch (card->info.link_type) { in qeth_get_cardname_short()
160 void qeth_set_allowed_threads(struct qeth_card *card, unsigned long threads, in qeth_set_allowed_threads() argument
165 spin_lock_irqsave(&card->thread_mask_lock, flags); in qeth_set_allowed_threads()
166 card->thread_allowed_mask = threads; in qeth_set_allowed_threads()
168 card->thread_start_mask &= threads; in qeth_set_allowed_threads()
169 spin_unlock_irqrestore(&card->thread_mask_lock, flags); in qeth_set_allowed_threads()
170 wake_up(&card->wait_q); in qeth_set_allowed_threads()
174 int qeth_threads_running(struct qeth_card *card, unsigned long threads) in qeth_threads_running() argument
179 spin_lock_irqsave(&card->thread_mask_lock, flags); in qeth_threads_running()
180 rc = (card->thread_running_mask & threads); in qeth_threads_running()
181 spin_unlock_irqrestore(&card->thread_mask_lock, flags); in qeth_threads_running()
186 static void qeth_clear_working_pool_list(struct qeth_card *card) in qeth_clear_working_pool_list() argument
189 struct qeth_qdio_q *queue = card->qdio.in_q; in qeth_clear_working_pool_list()
192 QETH_CARD_TEXT(card, 5, "clwrklst"); in qeth_clear_working_pool_list()
194 &card->qdio.in_buf_pool.entry_list, list) in qeth_clear_working_pool_list()
213 static void qeth_free_buffer_pool(struct qeth_card *card) in qeth_free_buffer_pool() argument
217 list_for_each_entry_safe(entry, tmp, &card->qdio.init_pool.entry_list, in qeth_free_buffer_pool()
245 static int qeth_alloc_buffer_pool(struct qeth_card *card) in qeth_alloc_buffer_pool() argument
247 unsigned int buf_elements = QETH_MAX_BUFFER_ELEMENTS(card); in qeth_alloc_buffer_pool()
250 QETH_CARD_TEXT(card, 5, "alocpool"); in qeth_alloc_buffer_pool()
251 for (i = 0; i < card->qdio.init_pool.buf_count; ++i) { in qeth_alloc_buffer_pool()
256 qeth_free_buffer_pool(card); in qeth_alloc_buffer_pool()
260 list_add(&entry->init_list, &card->qdio.init_pool.entry_list); in qeth_alloc_buffer_pool()
265 int qeth_resize_buffer_pool(struct qeth_card *card, unsigned int count) in qeth_resize_buffer_pool() argument
267 unsigned int buf_elements = QETH_MAX_BUFFER_ELEMENTS(card); in qeth_resize_buffer_pool()
268 struct qeth_qdio_buffer_pool *pool = &card->qdio.init_pool; in qeth_resize_buffer_pool()
273 QETH_CARD_TEXT(card, 2, "realcbp"); in qeth_resize_buffer_pool()
311 card->qdio.in_buf_pool.buf_count = count; in qeth_resize_buffer_pool()
346 static int qeth_cq_init(struct qeth_card *card) in qeth_cq_init() argument
350 if (card->options.cq == QETH_CQ_ENABLED) { in qeth_cq_init()
351 QETH_CARD_TEXT(card, 2, "cqinit"); in qeth_cq_init()
352 qdio_reset_buffers(card->qdio.c_q->qdio_bufs, in qeth_cq_init()
354 card->qdio.c_q->next_buf_to_init = 127; in qeth_cq_init()
356 rc = qdio_add_bufs_to_input_queue(CARD_DDEV(card), 1, 0, 127); in qeth_cq_init()
358 QETH_CARD_TEXT_(card, 2, "1err%d", rc); in qeth_cq_init()
367 static int qeth_alloc_cq(struct qeth_card *card) in qeth_alloc_cq() argument
369 if (card->options.cq == QETH_CQ_ENABLED) { in qeth_alloc_cq()
370 QETH_CARD_TEXT(card, 2, "cqon"); in qeth_alloc_cq()
371 card->qdio.c_q = qeth_alloc_qdio_queue(); in qeth_alloc_cq()
372 if (!card->qdio.c_q) { in qeth_alloc_cq()
373 dev_err(&card->gdev->dev, "Failed to create completion queue\n"); in qeth_alloc_cq()
377 QETH_CARD_TEXT(card, 2, "nocq"); in qeth_alloc_cq()
378 card->qdio.c_q = NULL; in qeth_alloc_cq()
383 static void qeth_free_cq(struct qeth_card *card) in qeth_free_cq() argument
385 if (card->qdio.c_q) { in qeth_free_cq()
386 qeth_free_qdio_queue(card->qdio.c_q); in qeth_free_cq()
387 card->qdio.c_q = NULL; in qeth_free_cq()
432 static int __qeth_issue_next_read(struct qeth_card *card) in __qeth_issue_next_read() argument
434 struct qeth_cmd_buffer *iob = card->read_cmd; in __qeth_issue_next_read()
439 QETH_CARD_TEXT(card, 5, "issnxrd"); in __qeth_issue_next_read()
449 QETH_CARD_TEXT(card, 6, "noirqpnd"); in __qeth_issue_next_read()
455 rc, CARD_DEVID(card)); in __qeth_issue_next_read()
456 qeth_unlock_channel(card, channel); in __qeth_issue_next_read()
458 card->read_or_write_problem = 1; in __qeth_issue_next_read()
459 qeth_schedule_recovery(card); in __qeth_issue_next_read()
464 static int qeth_issue_next_read(struct qeth_card *card) in qeth_issue_next_read() argument
468 spin_lock_irq(get_ccwdev_lock(CARD_RDEV(card))); in qeth_issue_next_read()
469 ret = __qeth_issue_next_read(card); in qeth_issue_next_read()
470 spin_unlock_irq(get_ccwdev_lock(CARD_RDEV(card))); in qeth_issue_next_read()
475 static void qeth_enqueue_cmd(struct qeth_card *card, in qeth_enqueue_cmd() argument
478 spin_lock_irq(&card->lock); in qeth_enqueue_cmd()
479 list_add_tail(&iob->list_entry, &card->cmd_waiter_list); in qeth_enqueue_cmd()
480 spin_unlock_irq(&card->lock); in qeth_enqueue_cmd()
483 static void qeth_dequeue_cmd(struct qeth_card *card, in qeth_dequeue_cmd() argument
486 spin_lock_irq(&card->lock); in qeth_dequeue_cmd()
488 spin_unlock_irq(&card->lock); in qeth_dequeue_cmd()
497 static void qeth_flush_local_addrs4(struct qeth_card *card) in qeth_flush_local_addrs4() argument
503 spin_lock_irq(&card->local_addrs4_lock); in qeth_flush_local_addrs4()
504 hash_for_each_safe(card->local_addrs4, i, tmp, addr, hnode) { in qeth_flush_local_addrs4()
508 spin_unlock_irq(&card->local_addrs4_lock); in qeth_flush_local_addrs4()
511 static void qeth_flush_local_addrs6(struct qeth_card *card) in qeth_flush_local_addrs6() argument
517 spin_lock_irq(&card->local_addrs6_lock); in qeth_flush_local_addrs6()
518 hash_for_each_safe(card->local_addrs6, i, tmp, addr, hnode) { in qeth_flush_local_addrs6()
522 spin_unlock_irq(&card->local_addrs6_lock); in qeth_flush_local_addrs6()
525 static void qeth_flush_local_addrs(struct qeth_card *card) in qeth_flush_local_addrs() argument
527 qeth_flush_local_addrs4(card); in qeth_flush_local_addrs()
528 qeth_flush_local_addrs6(card); in qeth_flush_local_addrs()
531 static void qeth_add_local_addrs4(struct qeth_card *card, in qeth_add_local_addrs4() argument
538 dev_err_ratelimited(&card->gdev->dev, in qeth_add_local_addrs4()
544 spin_lock(&card->local_addrs4_lock); in qeth_add_local_addrs4()
550 hash_for_each_possible(card->local_addrs4, addr, hnode, key) { in qeth_add_local_addrs4()
562 dev_err(&card->gdev->dev, in qeth_add_local_addrs4()
569 hash_add_rcu(card->local_addrs4, &addr->hnode, key); in qeth_add_local_addrs4()
571 spin_unlock(&card->local_addrs4_lock); in qeth_add_local_addrs4()
574 static void qeth_add_local_addrs6(struct qeth_card *card, in qeth_add_local_addrs6() argument
581 dev_err_ratelimited(&card->gdev->dev, in qeth_add_local_addrs6()
587 spin_lock(&card->local_addrs6_lock); in qeth_add_local_addrs6()
593 hash_for_each_possible(card->local_addrs6, addr, hnode, key) { in qeth_add_local_addrs6()
605 dev_err(&card->gdev->dev, in qeth_add_local_addrs6()
612 hash_add_rcu(card->local_addrs6, &addr->hnode, key); in qeth_add_local_addrs6()
614 spin_unlock(&card->local_addrs6_lock); in qeth_add_local_addrs6()
617 static void qeth_del_local_addrs4(struct qeth_card *card, in qeth_del_local_addrs4() argument
624 dev_err_ratelimited(&card->gdev->dev, in qeth_del_local_addrs4()
630 spin_lock(&card->local_addrs4_lock); in qeth_del_local_addrs4()
636 hash_for_each_possible(card->local_addrs4, tmp, hnode, key) { in qeth_del_local_addrs4()
644 spin_unlock(&card->local_addrs4_lock); in qeth_del_local_addrs4()
647 static void qeth_del_local_addrs6(struct qeth_card *card, in qeth_del_local_addrs6() argument
654 dev_err_ratelimited(&card->gdev->dev, in qeth_del_local_addrs6()
660 spin_lock(&card->local_addrs6_lock); in qeth_del_local_addrs6()
666 hash_for_each_possible(card->local_addrs6, tmp, hnode, key) { in qeth_del_local_addrs6()
674 spin_unlock(&card->local_addrs6_lock); in qeth_del_local_addrs6()
677 static bool qeth_next_hop_is_local_v4(struct qeth_card *card, in qeth_next_hop_is_local_v4() argument
685 if (hash_empty(card->local_addrs4)) in qeth_next_hop_is_local_v4()
693 hash_for_each_possible_rcu(card->local_addrs4, tmp, hnode, key) { in qeth_next_hop_is_local_v4()
704 static bool qeth_next_hop_is_local_v6(struct qeth_card *card, in qeth_next_hop_is_local_v6() argument
712 if (hash_empty(card->local_addrs6)) in qeth_next_hop_is_local_v6()
720 hash_for_each_possible_rcu(card->local_addrs6, tmp, hnode, key) { in qeth_next_hop_is_local_v6()
733 struct qeth_card *card = m->private; in qeth_debugfs_local_addr_show() local
738 hash_for_each_rcu(card->local_addrs4, i, tmp, hnode) in qeth_debugfs_local_addr_show()
740 hash_for_each_rcu(card->local_addrs6, i, tmp, hnode) in qeth_debugfs_local_addr_show()
750 struct qeth_card *card) in qeth_issue_ipa_msg() argument
759 ipa_name, com, CARD_DEVID(card), rc, in qeth_issue_ipa_msg()
763 ipa_name, com, CARD_DEVID(card)); in qeth_issue_ipa_msg()
766 static void qeth_default_link_info(struct qeth_card *card) in qeth_default_link_info() argument
768 struct qeth_link_info *link_info = &card->info.link_info; in qeth_default_link_info()
770 QETH_CARD_TEXT(card, 2, "dftlinfo"); in qeth_default_link_info()
773 if (IS_IQD(card) || IS_VM_NIC(card)) { in qeth_default_link_info()
778 switch (card->info.link_type) { in qeth_default_link_info()
798 dev_info(&card->gdev->dev, in qeth_default_link_info()
800 card->info.link_type); in qeth_default_link_info()
809 static struct qeth_ipa_cmd *qeth_check_ipa_data(struct qeth_card *card, in qeth_check_ipa_data() argument
812 QETH_CARD_TEXT(card, 5, "chkipad"); in qeth_check_ipa_data()
816 qeth_issue_ipa_msg(cmd, cmd->hdr.return_code, card); in qeth_check_ipa_data()
824 dev_err(&card->gdev->dev, in qeth_check_ipa_data()
826 netdev_name(card->dev)); in qeth_check_ipa_data()
828 qeth_schedule_recovery(card); in qeth_check_ipa_data()
831 dev_warn(&card->gdev->dev, in qeth_check_ipa_data()
833 netdev_name(card->dev), card->info.chpid); in qeth_check_ipa_data()
834 qeth_issue_ipa_msg(cmd, cmd->hdr.return_code, card); in qeth_check_ipa_data()
835 netif_carrier_off(card->dev); in qeth_check_ipa_data()
836 qeth_default_link_info(card); in qeth_check_ipa_data()
840 dev_info(&card->gdev->dev, in qeth_check_ipa_data()
842 netdev_name(card->dev), card->info.chpid); in qeth_check_ipa_data()
843 if (card->info.hwtrap) in qeth_check_ipa_data()
844 card->info.hwtrap = 2; in qeth_check_ipa_data()
845 qeth_schedule_recovery(card); in qeth_check_ipa_data()
850 if (card->discipline->control_event_handler(card, cmd)) in qeth_check_ipa_data()
855 qeth_add_local_addrs4(card, &cmd->data.local_addrs4); in qeth_check_ipa_data()
857 qeth_add_local_addrs6(card, &cmd->data.local_addrs6); in qeth_check_ipa_data()
859 QETH_CARD_TEXT(card, 3, "irla"); in qeth_check_ipa_data()
863 qeth_del_local_addrs4(card, &cmd->data.local_addrs4); in qeth_check_ipa_data()
865 qeth_del_local_addrs6(card, &cmd->data.local_addrs6); in qeth_check_ipa_data()
867 QETH_CARD_TEXT(card, 3, "urla"); in qeth_check_ipa_data()
875 static void qeth_clear_ipacmd_list(struct qeth_card *card) in qeth_clear_ipacmd_list() argument
880 QETH_CARD_TEXT(card, 4, "clipalst"); in qeth_clear_ipacmd_list()
882 spin_lock_irqsave(&card->lock, flags); in qeth_clear_ipacmd_list()
883 list_for_each_entry(iob, &card->cmd_waiter_list, list_entry) in qeth_clear_ipacmd_list()
885 spin_unlock_irqrestore(&card->lock, flags); in qeth_clear_ipacmd_list()
888 static int qeth_check_idx_response(struct qeth_card *card, in qeth_check_idx_response() argument
895 QETH_CARD_TEXT(card, 2, "ckidxres"); in qeth_check_idx_response()
896 QETH_CARD_TEXT(card, 2, " idxterm"); in qeth_check_idx_response()
897 QETH_CARD_TEXT_(card, 2, "rc%x", buffer[4]); in qeth_check_idx_response()
900 dev_err(&card->gdev->dev, in qeth_check_idx_response()
909 static void qeth_release_buffer_cb(struct qeth_card *card, in qeth_release_buffer_cb() argument
951 static void qeth_issue_next_read_cb(struct qeth_card *card, in qeth_issue_next_read_cb() argument
962 QETH_CARD_TEXT(card, 4, "sndctlcb"); in qeth_issue_next_read_cb()
963 rc = qeth_check_idx_response(card, iob->data); in qeth_issue_next_read_cb()
968 qeth_schedule_recovery(card); in qeth_issue_next_read_cb()
971 qeth_clear_ipacmd_list(card); in qeth_issue_next_read_cb()
977 cmd = qeth_check_ipa_data(card, cmd); in qeth_issue_next_read_cb()
983 spin_lock_irqsave(&card->lock, flags); in qeth_issue_next_read_cb()
984 list_for_each_entry(tmp, &card->cmd_waiter_list, list_entry) { in qeth_issue_next_read_cb()
992 spin_unlock_irqrestore(&card->lock, flags); in qeth_issue_next_read_cb()
1008 rc = reply->callback(card, reply, cmd ? (unsigned long)cmd : in qeth_issue_next_read_cb()
1017 memcpy(&card->seqno.pdu_hdr_ack, in qeth_issue_next_read_cb()
1020 __qeth_issue_next_read(card); in qeth_issue_next_read_cb()
1025 static int qeth_set_thread_start_bit(struct qeth_card *card, in qeth_set_thread_start_bit() argument
1031 spin_lock_irqsave(&card->thread_mask_lock, flags); in qeth_set_thread_start_bit()
1032 if (!(card->thread_allowed_mask & thread)) in qeth_set_thread_start_bit()
1034 else if (card->thread_start_mask & thread) in qeth_set_thread_start_bit()
1037 card->thread_start_mask |= thread; in qeth_set_thread_start_bit()
1038 spin_unlock_irqrestore(&card->thread_mask_lock, flags); in qeth_set_thread_start_bit()
1043 static void qeth_clear_thread_start_bit(struct qeth_card *card, in qeth_clear_thread_start_bit() argument
1048 spin_lock_irqsave(&card->thread_mask_lock, flags); in qeth_clear_thread_start_bit()
1049 card->thread_start_mask &= ~thread; in qeth_clear_thread_start_bit()
1050 spin_unlock_irqrestore(&card->thread_mask_lock, flags); in qeth_clear_thread_start_bit()
1051 wake_up(&card->wait_q); in qeth_clear_thread_start_bit()
1054 static void qeth_clear_thread_running_bit(struct qeth_card *card, in qeth_clear_thread_running_bit() argument
1059 spin_lock_irqsave(&card->thread_mask_lock, flags); in qeth_clear_thread_running_bit()
1060 card->thread_running_mask &= ~thread; in qeth_clear_thread_running_bit()
1061 spin_unlock_irqrestore(&card->thread_mask_lock, flags); in qeth_clear_thread_running_bit()
1062 wake_up_all(&card->wait_q); in qeth_clear_thread_running_bit()
1065 static int __qeth_do_run_thread(struct qeth_card *card, unsigned long thread) in __qeth_do_run_thread() argument
1070 spin_lock_irqsave(&card->thread_mask_lock, flags); in __qeth_do_run_thread()
1071 if (card->thread_start_mask & thread) { in __qeth_do_run_thread()
1072 if ((card->thread_allowed_mask & thread) && in __qeth_do_run_thread()
1073 !(card->thread_running_mask & thread)) { in __qeth_do_run_thread()
1075 card->thread_start_mask &= ~thread; in __qeth_do_run_thread()
1076 card->thread_running_mask |= thread; in __qeth_do_run_thread()
1080 spin_unlock_irqrestore(&card->thread_mask_lock, flags); in __qeth_do_run_thread()
1084 static int qeth_do_run_thread(struct qeth_card *card, unsigned long thread) in qeth_do_run_thread() argument
1088 wait_event(card->wait_q, in qeth_do_run_thread()
1089 (rc = __qeth_do_run_thread(card, thread)) >= 0); in qeth_do_run_thread()
1093 int qeth_schedule_recovery(struct qeth_card *card) in qeth_schedule_recovery() argument
1097 QETH_CARD_TEXT(card, 2, "startrec"); in qeth_schedule_recovery()
1099 rc = qeth_set_thread_start_bit(card, QETH_RECOVER_THREAD); in qeth_schedule_recovery()
1101 schedule_work(&card->kernel_thread_starter); in qeth_schedule_recovery()
1106 static int qeth_get_problem(struct qeth_card *card, struct ccw_device *cdev, in qeth_get_problem() argument
1119 QETH_CARD_TEXT(card, 2, "CGENCHK"); in qeth_get_problem()
1132 QETH_CARD_TEXT(card, 2, "REVIND"); in qeth_get_problem()
1137 QETH_CARD_TEXT(card, 2, "CMDREJi"); in qeth_get_problem()
1141 QETH_CARD_TEXT(card, 2, "AFFE"); in qeth_get_problem()
1145 QETH_CARD_TEXT(card, 2, "ZEROSEN"); in qeth_get_problem()
1148 QETH_CARD_TEXT(card, 2, "DGENCHK"); in qeth_get_problem()
1154 static int qeth_check_irb_error(struct qeth_card *card, struct ccw_device *cdev, in qeth_check_irb_error() argument
1164 QETH_CARD_TEXT(card, 2, "ckirberr"); in qeth_check_irb_error()
1165 QETH_CARD_TEXT_(card, 2, " rc%d", -EIO); in qeth_check_irb_error()
1170 QETH_CARD_TEXT(card, 2, "ckirberr"); in qeth_check_irb_error()
1171 QETH_CARD_TEXT_(card, 2, " rc%d", -ETIMEDOUT); in qeth_check_irb_error()
1176 QETH_CARD_TEXT(card, 2, "ckirberr"); in qeth_check_irb_error()
1177 QETH_CARD_TEXT(card, 2, " rc???"); in qeth_check_irb_error()
1190 struct qeth_card *card; in qeth_irq() local
1194 card = dev_get_drvdata(&gdev->dev); in qeth_irq()
1196 QETH_CARD_TEXT(card, 5, "irq"); in qeth_irq()
1198 if (card->read.ccwdev == cdev) { in qeth_irq()
1199 channel = &card->read; in qeth_irq()
1200 QETH_CARD_TEXT(card, 5, "read"); in qeth_irq()
1201 } else if (card->write.ccwdev == cdev) { in qeth_irq()
1202 channel = &card->write; in qeth_irq()
1203 QETH_CARD_TEXT(card, 5, "write"); in qeth_irq()
1205 channel = &card->data; in qeth_irq()
1206 QETH_CARD_TEXT(card, 5, "data"); in qeth_irq()
1210 QETH_CARD_TEXT(card, 5, "irqunsol"); in qeth_irq()
1212 QETH_CARD_TEXT(card, 5, "irqunexp"); in qeth_irq()
1223 qeth_unlock_channel(card, channel); in qeth_irq()
1225 rc = qeth_check_irb_error(card, cdev, irb); in qeth_irq()
1235 wake_up(&card->wait_q); in qeth_irq()
1240 wake_up(&card->wait_q); in qeth_irq()
1268 rc = qeth_get_problem(card, cdev, irb); in qeth_irq()
1270 card->read_or_write_problem = 1; in qeth_irq()
1273 qeth_clear_ipacmd_list(card); in qeth_irq()
1274 qeth_schedule_recovery(card); in qeth_irq()
1286 iob->callback(card, iob, in qeth_irq()
1300 QETH_CARD_TEXT_(q->card, 5, "skbn%d", notification); in qeth_notify_skbs()
1301 QETH_CARD_TEXT_(q->card, 5, "%lx", (long) skb); in qeth_notify_skbs()
1382 static void qeth_tx_complete_pending_bufs(struct qeth_card *card, in qeth_tx_complete_pending_bufs() argument
1396 QETH_CARD_TEXT(card, 5, "fp"); in qeth_tx_complete_pending_bufs()
1397 QETH_CARD_TEXT_(card, 5, "%lx", (long) buf); in qeth_tx_complete_pending_bufs()
1424 qeth_tx_complete_pending_bufs(q->card, q, true, 0); in qeth_drain_output_queue()
1438 static void qeth_drain_output_queues(struct qeth_card *card) in qeth_drain_output_queues() argument
1442 QETH_CARD_TEXT(card, 2, "clearqdbf"); in qeth_drain_output_queues()
1444 for (i = 0; i < card->qdio.no_out_queues; ++i) { in qeth_drain_output_queues()
1445 if (card->qdio.out_qs[i]) in qeth_drain_output_queues()
1446 qeth_drain_output_queue(card->qdio.out_qs[i], false); in qeth_drain_output_queues()
1450 static void qeth_osa_set_output_queues(struct qeth_card *card, bool single) in qeth_osa_set_output_queues() argument
1452 unsigned int max = single ? 1 : card->dev->num_tx_queues; in qeth_osa_set_output_queues()
1454 if (card->qdio.no_out_queues == max) in qeth_osa_set_output_queues()
1457 if (atomic_read(&card->qdio.state) != QETH_QDIO_UNINITIALIZED) in qeth_osa_set_output_queues()
1458 qeth_free_qdio_queues(card); in qeth_osa_set_output_queues()
1460 if (max == 1 && card->qdio.do_prio_queueing != QETH_PRIOQ_DEFAULT) in qeth_osa_set_output_queues()
1461 dev_info(&card->gdev->dev, "Priority Queueing not supported\n"); in qeth_osa_set_output_queues()
1463 card->qdio.no_out_queues = max; in qeth_osa_set_output_queues()
1466 static int qeth_update_from_chp_desc(struct qeth_card *card) in qeth_update_from_chp_desc() argument
1471 QETH_CARD_TEXT(card, 2, "chp_desc"); in qeth_update_from_chp_desc()
1473 ccwdev = card->data.ccwdev; in qeth_update_from_chp_desc()
1478 card->info.func_level = 0x4100 + chp_dsc->desc; in qeth_update_from_chp_desc()
1480 if (IS_OSD(card) || IS_OSX(card)) in qeth_update_from_chp_desc()
1482 qeth_osa_set_output_queues(card, chp_dsc->chpp & 0x02); in qeth_update_from_chp_desc()
1485 QETH_CARD_TEXT_(card, 2, "nr:%x", card->qdio.no_out_queues); in qeth_update_from_chp_desc()
1486 QETH_CARD_TEXT_(card, 2, "lvl:%02x", card->info.func_level); in qeth_update_from_chp_desc()
1490 static void qeth_init_qdio_info(struct qeth_card *card) in qeth_init_qdio_info() argument
1492 QETH_CARD_TEXT(card, 4, "intqdinf"); in qeth_init_qdio_info()
1493 atomic_set(&card->qdio.state, QETH_QDIO_UNINITIALIZED); in qeth_init_qdio_info()
1494 card->qdio.do_prio_queueing = QETH_PRIOQ_DEFAULT; in qeth_init_qdio_info()
1495 card->qdio.default_out_queue = QETH_DEFAULT_QUEUE; in qeth_init_qdio_info()
1498 card->qdio.in_buf_size = QETH_IN_BUF_SIZE_DEFAULT; in qeth_init_qdio_info()
1499 if (IS_IQD(card)) in qeth_init_qdio_info()
1500 card->qdio.init_pool.buf_count = QETH_IN_BUF_COUNT_HSDEFAULT; in qeth_init_qdio_info()
1502 card->qdio.init_pool.buf_count = QETH_IN_BUF_COUNT_DEFAULT; in qeth_init_qdio_info()
1503 card->qdio.in_buf_pool.buf_count = card->qdio.init_pool.buf_count; in qeth_init_qdio_info()
1504 INIT_LIST_HEAD(&card->qdio.in_buf_pool.entry_list); in qeth_init_qdio_info()
1505 INIT_LIST_HEAD(&card->qdio.init_pool.entry_list); in qeth_init_qdio_info()
1508 static void qeth_set_initial_options(struct qeth_card *card) in qeth_set_initial_options() argument
1510 card->options.route4.type = NO_ROUTER; in qeth_set_initial_options()
1511 card->options.route6.type = NO_ROUTER; in qeth_set_initial_options()
1512 card->options.isolation = ISOLATION_MODE_NONE; in qeth_set_initial_options()
1513 card->options.cq = QETH_CQ_DISABLED; in qeth_set_initial_options()
1514 card->options.layer = QETH_DISCIPLINE_UNDETERMINED; in qeth_set_initial_options()
1517 static int qeth_do_start_thread(struct qeth_card *card, unsigned long thread) in qeth_do_start_thread() argument
1522 spin_lock_irqsave(&card->thread_mask_lock, flags); in qeth_do_start_thread()
1523 QETH_CARD_TEXT_(card, 4, " %02x%02x%02x", in qeth_do_start_thread()
1524 (u8) card->thread_start_mask, in qeth_do_start_thread()
1525 (u8) card->thread_allowed_mask, in qeth_do_start_thread()
1526 (u8) card->thread_running_mask); in qeth_do_start_thread()
1527 rc = (card->thread_start_mask & thread); in qeth_do_start_thread()
1528 spin_unlock_irqrestore(&card->thread_mask_lock, flags); in qeth_do_start_thread()
1536 struct qeth_card *card = container_of(work, struct qeth_card, in qeth_start_kernel_thread() local
1538 QETH_CARD_TEXT(card, 2, "strthrd"); in qeth_start_kernel_thread()
1540 if (card->read.state != CH_STATE_UP && in qeth_start_kernel_thread()
1541 card->write.state != CH_STATE_UP) in qeth_start_kernel_thread()
1543 if (qeth_do_start_thread(card, QETH_RECOVER_THREAD)) { in qeth_start_kernel_thread()
1544 ts = kthread_run(qeth_do_reset, card, "qeth_recover"); in qeth_start_kernel_thread()
1546 qeth_clear_thread_start_bit(card, QETH_RECOVER_THREAD); in qeth_start_kernel_thread()
1547 qeth_clear_thread_running_bit(card, in qeth_start_kernel_thread()
1554 static void qeth_setup_card(struct qeth_card *card) in qeth_setup_card() argument
1556 QETH_CARD_TEXT(card, 2, "setupcrd"); in qeth_setup_card()
1558 card->info.type = CARD_RDEV(card)->id.driver_info; in qeth_setup_card()
1559 card->state = CARD_STATE_DOWN; in qeth_setup_card()
1560 spin_lock_init(&card->lock); in qeth_setup_card()
1561 spin_lock_init(&card->thread_mask_lock); in qeth_setup_card()
1562 mutex_init(&card->conf_mutex); in qeth_setup_card()
1563 mutex_init(&card->discipline_mutex); in qeth_setup_card()
1564 INIT_WORK(&card->kernel_thread_starter, qeth_start_kernel_thread); in qeth_setup_card()
1565 INIT_LIST_HEAD(&card->cmd_waiter_list); in qeth_setup_card()
1566 init_waitqueue_head(&card->wait_q); in qeth_setup_card()
1567 qeth_set_initial_options(card); in qeth_setup_card()
1569 INIT_LIST_HEAD(&card->ipato.entries); in qeth_setup_card()
1570 qeth_init_qdio_info(card); in qeth_setup_card()
1571 INIT_DELAYED_WORK(&card->buffer_reclaim_work, qeth_buffer_reclaim_work); in qeth_setup_card()
1572 hash_init(card->rx_mode_addrs); in qeth_setup_card()
1573 hash_init(card->local_addrs4); in qeth_setup_card()
1574 hash_init(card->local_addrs6); in qeth_setup_card()
1575 spin_lock_init(&card->local_addrs4_lock); in qeth_setup_card()
1576 spin_lock_init(&card->local_addrs6_lock); in qeth_setup_card()
1581 struct qeth_card *card = container_of(slr, struct qeth_card, in qeth_core_sl_print() local
1583 if (card->info.mcl_level[0]) in qeth_core_sl_print()
1585 CARD_BUS_ID(card), card->info.mcl_level); in qeth_core_sl_print()
1590 struct qeth_card *card; in qeth_alloc_card() local
1593 card = kzalloc(sizeof(*card), GFP_KERNEL); in qeth_alloc_card()
1594 if (!card) in qeth_alloc_card()
1596 QETH_DBF_HEX(SETUP, 2, &card, sizeof(void *)); in qeth_alloc_card()
1598 card->gdev = gdev; in qeth_alloc_card()
1599 dev_set_drvdata(&gdev->dev, card); in qeth_alloc_card()
1600 CARD_RDEV(card) = gdev->cdev[0]; in qeth_alloc_card()
1601 CARD_WDEV(card) = gdev->cdev[1]; in qeth_alloc_card()
1602 CARD_DDEV(card) = gdev->cdev[2]; in qeth_alloc_card()
1604 card->event_wq = alloc_ordered_workqueue("%s_event", 0, in qeth_alloc_card()
1606 if (!card->event_wq) in qeth_alloc_card()
1609 card->read_cmd = qeth_alloc_cmd(&card->read, QETH_BUFSIZE, 1, 0); in qeth_alloc_card()
1610 if (!card->read_cmd) in qeth_alloc_card()
1613 card->debugfs = debugfs_create_dir(dev_name(&gdev->dev), in qeth_alloc_card()
1615 debugfs_create_file("local_addrs", 0400, card->debugfs, card, in qeth_alloc_card()
1618 card->qeth_service_level.seq_print = qeth_core_sl_print; in qeth_alloc_card()
1619 register_service_level(&card->qeth_service_level); in qeth_alloc_card()
1620 return card; in qeth_alloc_card()
1623 destroy_workqueue(card->event_wq); in qeth_alloc_card()
1626 kfree(card); in qeth_alloc_card()
1631 static int qeth_clear_channel(struct qeth_card *card, in qeth_clear_channel() argument
1636 QETH_CARD_TEXT(card, 3, "clearch"); in qeth_clear_channel()
1643 rc = wait_event_interruptible_timeout(card->wait_q, in qeth_clear_channel()
1653 static int qeth_halt_channel(struct qeth_card *card, in qeth_halt_channel() argument
1658 QETH_CARD_TEXT(card, 3, "haltch"); in qeth_halt_channel()
1665 rc = wait_event_interruptible_timeout(card->wait_q, in qeth_halt_channel()
1717 static int qeth_halt_channels(struct qeth_card *card) in qeth_halt_channels() argument
1721 QETH_CARD_TEXT(card, 3, "haltchs"); in qeth_halt_channels()
1722 rc1 = qeth_halt_channel(card, &card->read); in qeth_halt_channels()
1723 rc2 = qeth_halt_channel(card, &card->write); in qeth_halt_channels()
1724 rc3 = qeth_halt_channel(card, &card->data); in qeth_halt_channels()
1732 static int qeth_clear_channels(struct qeth_card *card) in qeth_clear_channels() argument
1736 QETH_CARD_TEXT(card, 3, "clearchs"); in qeth_clear_channels()
1737 rc1 = qeth_clear_channel(card, &card->read); in qeth_clear_channels()
1738 rc2 = qeth_clear_channel(card, &card->write); in qeth_clear_channels()
1739 rc3 = qeth_clear_channel(card, &card->data); in qeth_clear_channels()
1747 static int qeth_clear_halt_card(struct qeth_card *card, int halt) in qeth_clear_halt_card() argument
1751 QETH_CARD_TEXT(card, 3, "clhacrd"); in qeth_clear_halt_card()
1754 rc = qeth_halt_channels(card); in qeth_clear_halt_card()
1757 return qeth_clear_channels(card); in qeth_clear_halt_card()
1760 static int qeth_qdio_clear_card(struct qeth_card *card, int use_halt) in qeth_qdio_clear_card() argument
1764 QETH_CARD_TEXT(card, 3, "qdioclr"); in qeth_qdio_clear_card()
1765 switch (atomic_cmpxchg(&card->qdio.state, QETH_QDIO_ESTABLISHED, in qeth_qdio_clear_card()
1768 if (IS_IQD(card)) in qeth_qdio_clear_card()
1769 rc = qdio_shutdown(CARD_DDEV(card), in qeth_qdio_clear_card()
1772 rc = qdio_shutdown(CARD_DDEV(card), in qeth_qdio_clear_card()
1775 QETH_CARD_TEXT_(card, 3, "1err%d", rc); in qeth_qdio_clear_card()
1776 atomic_set(&card->qdio.state, QETH_QDIO_ALLOCATED); in qeth_qdio_clear_card()
1783 rc = qeth_clear_halt_card(card, use_halt); in qeth_qdio_clear_card()
1785 QETH_CARD_TEXT_(card, 3, "2err%d", rc); in qeth_qdio_clear_card()
1789 static enum qeth_discipline_id qeth_vm_detect_layer(struct qeth_card *card) in qeth_vm_detect_layer() argument
1798 QETH_CARD_TEXT(card, 2, "vmlayer"); in qeth_vm_detect_layer()
1811 ccw_device_get_id(CARD_RDEV(card), &id); in qeth_vm_detect_layer()
1841 QETH_CARD_TEXT_(card, 2, "err%x", rc); in qeth_vm_detect_layer()
1846 static enum qeth_discipline_id qeth_enforce_discipline(struct qeth_card *card) in qeth_enforce_discipline() argument
1850 if (IS_OSM(card)) in qeth_enforce_discipline()
1852 else if (IS_VM_NIC(card)) in qeth_enforce_discipline()
1853 disc = IS_IQD(card) ? QETH_DISCIPLINE_LAYER3 : in qeth_enforce_discipline()
1854 qeth_vm_detect_layer(card); in qeth_enforce_discipline()
1858 QETH_CARD_TEXT(card, 3, "force l2"); in qeth_enforce_discipline()
1861 QETH_CARD_TEXT(card, 3, "force l3"); in qeth_enforce_discipline()
1864 QETH_CARD_TEXT(card, 3, "force no"); in qeth_enforce_discipline()
1870 static void qeth_set_blkt_defaults(struct qeth_card *card) in qeth_set_blkt_defaults() argument
1872 QETH_CARD_TEXT(card, 2, "cfgblkt"); in qeth_set_blkt_defaults()
1874 if (card->info.use_v1_blkt) { in qeth_set_blkt_defaults()
1875 card->info.blkt.time_total = 0; in qeth_set_blkt_defaults()
1876 card->info.blkt.inter_packet = 0; in qeth_set_blkt_defaults()
1877 card->info.blkt.inter_packet_jumbo = 0; in qeth_set_blkt_defaults()
1879 card->info.blkt.time_total = 250; in qeth_set_blkt_defaults()
1880 card->info.blkt.inter_packet = 5; in qeth_set_blkt_defaults()
1881 card->info.blkt.inter_packet_jumbo = 15; in qeth_set_blkt_defaults()
1885 static void qeth_idx_init(struct qeth_card *card) in qeth_idx_init() argument
1887 memset(&card->seqno, 0, sizeof(card->seqno)); in qeth_idx_init()
1889 card->token.issuer_rm_w = 0x00010103UL; in qeth_idx_init()
1890 card->token.cm_filter_w = 0x00010108UL; in qeth_idx_init()
1891 card->token.cm_connection_w = 0x0001010aUL; in qeth_idx_init()
1892 card->token.ulp_filter_w = 0x0001010bUL; in qeth_idx_init()
1893 card->token.ulp_connection_w = 0x0001010dUL; in qeth_idx_init()
1895 switch (card->info.type) { in qeth_idx_init()
1897 card->info.func_level = QETH_IDX_FUNC_LEVEL_IQD; in qeth_idx_init()
1900 card->info.func_level = QETH_IDX_FUNC_LEVEL_OSD; in qeth_idx_init()
1907 static void qeth_idx_finalize_cmd(struct qeth_card *card, in qeth_idx_finalize_cmd() argument
1910 memcpy(QETH_TRANSPORT_HEADER_SEQ_NO(iob->data), &card->seqno.trans_hdr, in qeth_idx_finalize_cmd()
1912 if (iob->channel == &card->write) in qeth_idx_finalize_cmd()
1913 card->seqno.trans_hdr++; in qeth_idx_finalize_cmd()
1925 static void qeth_mpc_finalize_cmd(struct qeth_card *card, in qeth_mpc_finalize_cmd() argument
1928 qeth_idx_finalize_cmd(card, iob); in qeth_mpc_finalize_cmd()
1931 &card->seqno.pdu_hdr, QETH_SEQ_NO_LENGTH); in qeth_mpc_finalize_cmd()
1932 card->seqno.pdu_hdr++; in qeth_mpc_finalize_cmd()
1934 &card->seqno.pdu_hdr_ack, QETH_SEQ_NO_LENGTH); in qeth_mpc_finalize_cmd()
1946 static struct qeth_cmd_buffer *qeth_mpc_alloc_cmd(struct qeth_card *card, in qeth_mpc_alloc_cmd() argument
1952 iob = qeth_alloc_cmd(&card->write, data_length, 1, QETH_TIMEOUT); in qeth_mpc_alloc_cmd()
1986 static int qeth_send_control_data(struct qeth_card *card, in qeth_send_control_data() argument
1998 QETH_CARD_TEXT(card, 2, "sendctl"); in qeth_send_control_data()
2003 timeout = wait_event_interruptible_timeout(card->wait_q, in qeth_send_control_data()
2012 iob->finalize(card, iob); in qeth_send_control_data()
2015 qeth_enqueue_cmd(card, iob); in qeth_send_control_data()
2020 QETH_CARD_TEXT(card, 6, "noirqpnd"); in qeth_send_control_data()
2027 CARD_DEVID(card), rc); in qeth_send_control_data()
2028 QETH_CARD_TEXT_(card, 2, " err%d", rc); in qeth_send_control_data()
2029 qeth_dequeue_cmd(card, iob); in qeth_send_control_data()
2031 qeth_unlock_channel(card, channel); in qeth_send_control_data()
2040 qeth_dequeue_cmd(card, iob); in qeth_send_control_data()
2065 static void qeth_read_conf_data_cb(struct qeth_card *card, in qeth_read_conf_data_cb() argument
2073 QETH_CARD_TEXT(card, 2, "cfgunit"); in qeth_read_conf_data_cb()
2080 card->info.is_vm_nic = nd->nd1.plant[0] == _ascebc['V'] && in qeth_read_conf_data_cb()
2083 card->info.chpid = tag[0]; in qeth_read_conf_data_cb()
2084 card->info.unit_addr2 = tag[1]; in qeth_read_conf_data_cb()
2087 card->info.cula = tag[1]; in qeth_read_conf_data_cb()
2089 card->info.use_v1_blkt = nd->nd3.model[0] == 0xF0 && in qeth_read_conf_data_cb()
2099 static int qeth_read_conf_data(struct qeth_card *card) in qeth_read_conf_data() argument
2101 struct qeth_channel *channel = &card->data; in qeth_read_conf_data()
2120 return qeth_send_control_data(card, iob, NULL, NULL); in qeth_read_conf_data()
2123 static int qeth_idx_check_activate_response(struct qeth_card *card, in qeth_idx_check_activate_response() argument
2129 rc = qeth_check_idx_response(card, iob->data); in qeth_idx_check_activate_response()
2137 QETH_CARD_TEXT_(card, 2, "idxneg%c", in qeth_idx_check_activate_response()
2157 static void qeth_idx_activate_read_channel_cb(struct qeth_card *card, in qeth_idx_activate_read_channel_cb() argument
2165 QETH_CARD_TEXT(card, 2, "idxrdcb"); in qeth_idx_activate_read_channel_cb()
2167 rc = qeth_idx_check_activate_response(card, channel, iob); in qeth_idx_activate_read_channel_cb()
2172 if (peer_level != qeth_peer_func_level(card->info.func_level)) { in qeth_idx_activate_read_channel_cb()
2175 card->info.func_level, peer_level); in qeth_idx_activate_read_channel_cb()
2180 memcpy(&card->token.issuer_rm_r, in qeth_idx_activate_read_channel_cb()
2183 memcpy(&card->info.mcl_level[0], in qeth_idx_activate_read_channel_cb()
2191 static void qeth_idx_activate_write_channel_cb(struct qeth_card *card, in qeth_idx_activate_write_channel_cb() argument
2199 QETH_CARD_TEXT(card, 2, "idxwrcb"); in qeth_idx_activate_write_channel_cb()
2201 rc = qeth_idx_check_activate_response(card, channel, iob); in qeth_idx_activate_write_channel_cb()
2207 qeth_peer_func_level(card->info.func_level)) { in qeth_idx_activate_write_channel_cb()
2210 card->info.func_level, peer_level); in qeth_idx_activate_write_channel_cb()
2219 static void qeth_idx_setup_activate_cmd(struct qeth_card *card, in qeth_idx_setup_activate_cmd() argument
2222 u16 addr = (card->info.cula << 8) + card->info.unit_addr2; in qeth_idx_setup_activate_cmd()
2223 u8 port = ((u8)card->dev->dev_port) | 0x80; in qeth_idx_setup_activate_cmd()
2234 &card->token.issuer_rm_w, QETH_MPC_TOKEN_LENGTH); in qeth_idx_setup_activate_cmd()
2236 &card->info.func_level, 2); in qeth_idx_setup_activate_cmd()
2237 memcpy(QETH_IDX_ACT_QDIO_DEV_CUA(iob->data), &card->info.ddev_devno, 2); in qeth_idx_setup_activate_cmd()
2241 static int qeth_idx_activate_read_channel(struct qeth_card *card) in qeth_idx_activate_read_channel() argument
2243 struct qeth_channel *channel = &card->read; in qeth_idx_activate_read_channel()
2247 QETH_CARD_TEXT(card, 2, "idxread"); in qeth_idx_activate_read_channel()
2254 qeth_idx_setup_activate_cmd(card, iob); in qeth_idx_activate_read_channel()
2257 rc = qeth_send_control_data(card, iob, NULL, NULL); in qeth_idx_activate_read_channel()
2265 static int qeth_idx_activate_write_channel(struct qeth_card *card) in qeth_idx_activate_write_channel() argument
2267 struct qeth_channel *channel = &card->write; in qeth_idx_activate_write_channel()
2271 QETH_CARD_TEXT(card, 2, "idxwrite"); in qeth_idx_activate_write_channel()
2278 qeth_idx_setup_activate_cmd(card, iob); in qeth_idx_activate_write_channel()
2281 rc = qeth_send_control_data(card, iob, NULL, NULL); in qeth_idx_activate_write_channel()
2289 static int qeth_cm_enable_cb(struct qeth_card *card, struct qeth_reply *reply, in qeth_cm_enable_cb() argument
2294 QETH_CARD_TEXT(card, 2, "cmenblcb"); in qeth_cm_enable_cb()
2297 memcpy(&card->token.cm_filter_r, in qeth_cm_enable_cb()
2303 static int qeth_cm_enable(struct qeth_card *card) in qeth_cm_enable() argument
2307 QETH_CARD_TEXT(card, 2, "cmenable"); in qeth_cm_enable()
2309 iob = qeth_mpc_alloc_cmd(card, CM_ENABLE, CM_ENABLE_SIZE); in qeth_cm_enable()
2314 &card->token.issuer_rm_r, QETH_MPC_TOKEN_LENGTH); in qeth_cm_enable()
2316 &card->token.cm_filter_w, QETH_MPC_TOKEN_LENGTH); in qeth_cm_enable()
2318 return qeth_send_control_data(card, iob, qeth_cm_enable_cb, NULL); in qeth_cm_enable()
2321 static int qeth_cm_setup_cb(struct qeth_card *card, struct qeth_reply *reply, in qeth_cm_setup_cb() argument
2326 QETH_CARD_TEXT(card, 2, "cmsetpcb"); in qeth_cm_setup_cb()
2329 memcpy(&card->token.cm_connection_r, in qeth_cm_setup_cb()
2335 static int qeth_cm_setup(struct qeth_card *card) in qeth_cm_setup() argument
2339 QETH_CARD_TEXT(card, 2, "cmsetup"); in qeth_cm_setup()
2341 iob = qeth_mpc_alloc_cmd(card, CM_SETUP, CM_SETUP_SIZE); in qeth_cm_setup()
2346 &card->token.issuer_rm_r, QETH_MPC_TOKEN_LENGTH); in qeth_cm_setup()
2348 &card->token.cm_connection_w, QETH_MPC_TOKEN_LENGTH); in qeth_cm_setup()
2350 &card->token.cm_filter_r, QETH_MPC_TOKEN_LENGTH); in qeth_cm_setup()
2351 return qeth_send_control_data(card, iob, qeth_cm_setup_cb, NULL); in qeth_cm_setup()
2354 static bool qeth_is_supported_link_type(struct qeth_card *card, u8 link_type) in qeth_is_supported_link_type() argument
2358 dev_err(&card->gdev->dev, "Unsupported Token Ring device\n"); in qeth_is_supported_link_type()
2365 static int qeth_update_max_mtu(struct qeth_card *card, unsigned int max_mtu) in qeth_update_max_mtu() argument
2367 struct net_device *dev = card->dev; in qeth_update_max_mtu()
2372 if (IS_IQD(card)) in qeth_update_max_mtu()
2379 if (IS_IQD(card)) { in qeth_update_max_mtu()
2384 card->qdio.in_buf_size = max_mtu + 2 * PAGE_SIZE; in qeth_update_max_mtu()
2386 qeth_free_qdio_queues(card); in qeth_update_max_mtu()
2391 else if (IS_LAYER2(card)) in qeth_update_max_mtu()
2419 static int qeth_ulp_enable_cb(struct qeth_card *card, struct qeth_reply *reply, in qeth_ulp_enable_cb() argument
2427 QETH_CARD_TEXT(card, 2, "ulpenacb"); in qeth_ulp_enable_cb()
2430 memcpy(&card->token.ulp_filter_r, in qeth_ulp_enable_cb()
2433 if (IS_IQD(card)) { in qeth_ulp_enable_cb()
2445 if (!qeth_is_supported_link_type(card, link_type)) in qeth_ulp_enable_cb()
2449 card->info.link_type = link_type; in qeth_ulp_enable_cb()
2450 QETH_CARD_TEXT_(card, 2, "link%d", card->info.link_type); in qeth_ulp_enable_cb()
2454 static u8 qeth_mpc_select_prot_type(struct qeth_card *card) in qeth_mpc_select_prot_type() argument
2456 return IS_LAYER2(card) ? QETH_MPC_PROT_L2 : QETH_MPC_PROT_L3; in qeth_mpc_select_prot_type()
2459 static int qeth_ulp_enable(struct qeth_card *card) in qeth_ulp_enable() argument
2461 u8 prot_type = qeth_mpc_select_prot_type(card); in qeth_ulp_enable()
2466 QETH_CARD_TEXT(card, 2, "ulpenabl"); in qeth_ulp_enable()
2468 iob = qeth_mpc_alloc_cmd(card, ULP_ENABLE, ULP_ENABLE_SIZE); in qeth_ulp_enable()
2472 *(QETH_ULP_ENABLE_LINKNUM(iob->data)) = (u8) card->dev->dev_port; in qeth_ulp_enable()
2475 &card->token.cm_connection_r, QETH_MPC_TOKEN_LENGTH); in qeth_ulp_enable()
2477 &card->token.ulp_filter_w, QETH_MPC_TOKEN_LENGTH); in qeth_ulp_enable()
2478 rc = qeth_send_control_data(card, iob, qeth_ulp_enable_cb, &max_mtu); in qeth_ulp_enable()
2481 return qeth_update_max_mtu(card, max_mtu); in qeth_ulp_enable()
2484 static int qeth_ulp_setup_cb(struct qeth_card *card, struct qeth_reply *reply, in qeth_ulp_setup_cb() argument
2489 QETH_CARD_TEXT(card, 2, "ulpstpcb"); in qeth_ulp_setup_cb()
2492 memcpy(&card->token.ulp_connection_r, in qeth_ulp_setup_cb()
2497 QETH_CARD_TEXT(card, 2, "olmlimit"); in qeth_ulp_setup_cb()
2498 dev_err(&card->gdev->dev, "A connection could not be " in qeth_ulp_setup_cb()
2505 static int qeth_ulp_setup(struct qeth_card *card) in qeth_ulp_setup() argument
2510 QETH_CARD_TEXT(card, 2, "ulpsetup"); in qeth_ulp_setup()
2512 iob = qeth_mpc_alloc_cmd(card, ULP_SETUP, ULP_SETUP_SIZE); in qeth_ulp_setup()
2517 &card->token.cm_connection_r, QETH_MPC_TOKEN_LENGTH); in qeth_ulp_setup()
2519 &card->token.ulp_connection_w, QETH_MPC_TOKEN_LENGTH); in qeth_ulp_setup()
2521 &card->token.ulp_filter_r, QETH_MPC_TOKEN_LENGTH); in qeth_ulp_setup()
2523 memcpy(QETH_ULP_SETUP_CUA(iob->data), &card->info.ddev_devno, 2); in qeth_ulp_setup()
2524 temp = (card->info.cula << 8) + card->info.unit_addr2; in qeth_ulp_setup()
2526 return qeth_send_control_data(card, iob, qeth_ulp_setup_cb, NULL); in qeth_ulp_setup()
2591 static int qeth_alloc_qdio_queues(struct qeth_card *card) in qeth_alloc_qdio_queues() argument
2595 QETH_CARD_TEXT(card, 2, "allcqdbf"); in qeth_alloc_qdio_queues()
2597 if (atomic_cmpxchg(&card->qdio.state, QETH_QDIO_UNINITIALIZED, in qeth_alloc_qdio_queues()
2602 if (qeth_alloc_buffer_pool(card)) in qeth_alloc_qdio_queues()
2606 for (i = 0; i < card->qdio.no_out_queues; ++i) { in qeth_alloc_qdio_queues()
2612 QETH_CARD_TEXT_(card, 2, "outq %i", i); in qeth_alloc_qdio_queues()
2613 QETH_CARD_HEX(card, 2, &queue, sizeof(void *)); in qeth_alloc_qdio_queues()
2614 card->qdio.out_qs[i] = queue; in qeth_alloc_qdio_queues()
2615 queue->card = card; in qeth_alloc_qdio_queues()
2620 if (IS_IQD(card)) { in qeth_alloc_qdio_queues()
2633 if (qeth_alloc_cq(card)) in qeth_alloc_qdio_queues()
2640 qeth_free_output_queue(card->qdio.out_qs[--i]); in qeth_alloc_qdio_queues()
2641 card->qdio.out_qs[i] = NULL; in qeth_alloc_qdio_queues()
2643 qeth_free_buffer_pool(card); in qeth_alloc_qdio_queues()
2645 atomic_set(&card->qdio.state, QETH_QDIO_UNINITIALIZED); in qeth_alloc_qdio_queues()
2649 static void qeth_free_qdio_queues(struct qeth_card *card) in qeth_free_qdio_queues() argument
2653 if (atomic_xchg(&card->qdio.state, QETH_QDIO_UNINITIALIZED) == in qeth_free_qdio_queues()
2657 qeth_free_cq(card); in qeth_free_qdio_queues()
2659 if (card->qdio.in_q->bufs[j].rx_skb) { in qeth_free_qdio_queues()
2660 consume_skb(card->qdio.in_q->bufs[j].rx_skb); in qeth_free_qdio_queues()
2661 card->qdio.in_q->bufs[j].rx_skb = NULL; in qeth_free_qdio_queues()
2666 qeth_free_buffer_pool(card); in qeth_free_qdio_queues()
2668 for (i = 0; i < card->qdio.no_out_queues; i++) { in qeth_free_qdio_queues()
2669 qeth_free_output_queue(card->qdio.out_qs[i]); in qeth_free_qdio_queues()
2670 card->qdio.out_qs[i] = NULL; in qeth_free_qdio_queues()
2674 static void qeth_fill_qib_parms(struct qeth_card *card, in qeth_fill_qib_parms() argument
2685 parms->pcit_a = QETH_PCI_THRESHOLD_A(card); in qeth_fill_qib_parms()
2686 parms->pcit_b = QETH_PCI_THRESHOLD_B(card); in qeth_fill_qib_parms()
2687 parms->pcit_c = QETH_PCI_TIMER_VALUE(card); in qeth_fill_qib_parms()
2694 parms->blkt_total = card->info.blkt.time_total; in qeth_fill_qib_parms()
2695 parms->blkt_inter_packet = card->info.blkt.inter_packet; in qeth_fill_qib_parms()
2696 parms->blkt_inter_packet_jumbo = card->info.blkt.inter_packet_jumbo; in qeth_fill_qib_parms()
2699 if (qeth_uses_tx_prio_queueing(card) || card->qdio.no_out_queues == 1) in qeth_fill_qib_parms()
2710 qeth_for_each_output_queue(card, queue, i) in qeth_fill_qib_parms()
2714 static int qeth_qdio_activate(struct qeth_card *card) in qeth_qdio_activate() argument
2716 QETH_CARD_TEXT(card, 3, "qdioact"); in qeth_qdio_activate()
2717 return qdio_activate(CARD_DDEV(card)); in qeth_qdio_activate()
2720 static int qeth_dm_act(struct qeth_card *card) in qeth_dm_act() argument
2724 QETH_CARD_TEXT(card, 2, "dmact"); in qeth_dm_act()
2726 iob = qeth_mpc_alloc_cmd(card, DM_ACT, DM_ACT_SIZE); in qeth_dm_act()
2731 &card->token.cm_connection_r, QETH_MPC_TOKEN_LENGTH); in qeth_dm_act()
2733 &card->token.ulp_connection_r, QETH_MPC_TOKEN_LENGTH); in qeth_dm_act()
2734 return qeth_send_control_data(card, iob, NULL, NULL); in qeth_dm_act()
2737 static int qeth_mpc_initialize(struct qeth_card *card) in qeth_mpc_initialize() argument
2741 QETH_CARD_TEXT(card, 2, "mpcinit"); in qeth_mpc_initialize()
2743 rc = qeth_issue_next_read(card); in qeth_mpc_initialize()
2745 QETH_CARD_TEXT_(card, 2, "1err%d", rc); in qeth_mpc_initialize()
2748 rc = qeth_cm_enable(card); in qeth_mpc_initialize()
2750 QETH_CARD_TEXT_(card, 2, "2err%d", rc); in qeth_mpc_initialize()
2753 rc = qeth_cm_setup(card); in qeth_mpc_initialize()
2755 QETH_CARD_TEXT_(card, 2, "3err%d", rc); in qeth_mpc_initialize()
2758 rc = qeth_ulp_enable(card); in qeth_mpc_initialize()
2760 QETH_CARD_TEXT_(card, 2, "4err%d", rc); in qeth_mpc_initialize()
2763 rc = qeth_ulp_setup(card); in qeth_mpc_initialize()
2765 QETH_CARD_TEXT_(card, 2, "5err%d", rc); in qeth_mpc_initialize()
2768 rc = qeth_alloc_qdio_queues(card); in qeth_mpc_initialize()
2770 QETH_CARD_TEXT_(card, 2, "5err%d", rc); in qeth_mpc_initialize()
2773 rc = qeth_qdio_establish(card); in qeth_mpc_initialize()
2775 QETH_CARD_TEXT_(card, 2, "6err%d", rc); in qeth_mpc_initialize()
2776 qeth_free_qdio_queues(card); in qeth_mpc_initialize()
2779 rc = qeth_qdio_activate(card); in qeth_mpc_initialize()
2781 QETH_CARD_TEXT_(card, 2, "7err%d", rc); in qeth_mpc_initialize()
2784 rc = qeth_dm_act(card); in qeth_mpc_initialize()
2786 QETH_CARD_TEXT_(card, 2, "8err%d", rc); in qeth_mpc_initialize()
2793 static void qeth_print_status_message(struct qeth_card *card) in qeth_print_status_message() argument
2795 switch (card->info.type) { in qeth_print_status_message()
2803 if (!card->info.mcl_level[0]) { in qeth_print_status_message()
2804 sprintf(card->info.mcl_level, "%02x%02x", in qeth_print_status_message()
2805 card->info.mcl_level[2], in qeth_print_status_message()
2806 card->info.mcl_level[3]); in qeth_print_status_message()
2811 if (IS_VM_NIC(card) || (card->info.mcl_level[0] & 0x80)) { in qeth_print_status_message()
2812 card->info.mcl_level[0] = (char) _ebcasc[(__u8) in qeth_print_status_message()
2813 card->info.mcl_level[0]]; in qeth_print_status_message()
2814 card->info.mcl_level[1] = (char) _ebcasc[(__u8) in qeth_print_status_message()
2815 card->info.mcl_level[1]]; in qeth_print_status_message()
2816 card->info.mcl_level[2] = (char) _ebcasc[(__u8) in qeth_print_status_message()
2817 card->info.mcl_level[2]]; in qeth_print_status_message()
2818 card->info.mcl_level[3] = (char) _ebcasc[(__u8) in qeth_print_status_message()
2819 card->info.mcl_level[3]]; in qeth_print_status_message()
2820 card->info.mcl_level[QETH_MCL_LENGTH] = 0; in qeth_print_status_message()
2824 memset(&card->info.mcl_level[0], 0, QETH_MCL_LENGTH + 1); in qeth_print_status_message()
2826 dev_info(&card->gdev->dev, in qeth_print_status_message()
2828 qeth_get_cardname(card), in qeth_print_status_message()
2829 (card->info.mcl_level[0]) ? " (level: " : "", in qeth_print_status_message()
2830 (card->info.mcl_level[0]) ? card->info.mcl_level : "", in qeth_print_status_message()
2831 (card->info.mcl_level[0]) ? ")" : "", in qeth_print_status_message()
2832 qeth_get_cardname_short(card)); in qeth_print_status_message()
2835 static void qeth_initialize_working_pool_list(struct qeth_card *card) in qeth_initialize_working_pool_list() argument
2839 QETH_CARD_TEXT(card, 5, "inwrklst"); in qeth_initialize_working_pool_list()
2842 &card->qdio.init_pool.entry_list, init_list) { in qeth_initialize_working_pool_list()
2843 qeth_put_buffer_pool_entry(card, entry); in qeth_initialize_working_pool_list()
2848 struct qeth_card *card) in qeth_find_free_buffer_pool_entry() argument
2853 if (list_empty(&card->qdio.in_buf_pool.entry_list)) in qeth_find_free_buffer_pool_entry()
2856 list_for_each_entry(entry, &card->qdio.in_buf_pool.entry_list, list) { in qeth_find_free_buffer_pool_entry()
2858 for (i = 0; i < QETH_MAX_BUFFER_ELEMENTS(card); ++i) { in qeth_find_free_buffer_pool_entry()
2871 entry = list_first_entry(&card->qdio.in_buf_pool.entry_list, in qeth_find_free_buffer_pool_entry()
2873 for (i = 0; i < QETH_MAX_BUFFER_ELEMENTS(card); ++i) { in qeth_find_free_buffer_pool_entry()
2882 QETH_CARD_STAT_INC(card, rx_sg_alloc_page); in qeth_find_free_buffer_pool_entry()
2889 static int qeth_init_input_buffer(struct qeth_card *card, in qeth_init_input_buffer() argument
2895 if ((card->options.cq == QETH_CQ_ENABLED) && (!buf->rx_skb)) { in qeth_init_input_buffer()
2896 buf->rx_skb = netdev_alloc_skb(card->dev, in qeth_init_input_buffer()
2904 pool_entry = qeth_find_free_buffer_pool_entry(card); in qeth_init_input_buffer()
2917 for (i = 0; i < QETH_MAX_BUFFER_ELEMENTS(card); ++i) { in qeth_init_input_buffer()
2921 if (i == QETH_MAX_BUFFER_ELEMENTS(card) - 1) in qeth_init_input_buffer()
2930 static unsigned int qeth_tx_select_bulk_max(struct qeth_card *card, in qeth_tx_select_bulk_max() argument
2933 if (!IS_IQD(card) || in qeth_tx_select_bulk_max()
2934 qeth_iqd_is_mcast_queue(card, queue) || in qeth_tx_select_bulk_max()
2935 card->options.cq == QETH_CQ_ENABLED || in qeth_tx_select_bulk_max()
2936 qdio_get_ssqd_desc(CARD_DDEV(card), &card->ssqd)) in qeth_tx_select_bulk_max()
2939 return card->ssqd.mmwc ? card->ssqd.mmwc : 1; in qeth_tx_select_bulk_max()
2942 static int qeth_init_qdio_queues(struct qeth_card *card) in qeth_init_qdio_queues() argument
2944 unsigned int rx_bufs = card->qdio.in_buf_pool.buf_count; in qeth_init_qdio_queues()
2948 QETH_CARD_TEXT(card, 2, "initqdqs"); in qeth_init_qdio_queues()
2951 qdio_reset_buffers(card->qdio.in_q->qdio_bufs, QDIO_MAX_BUFFERS_PER_Q); in qeth_init_qdio_queues()
2952 memset(&card->rx, 0, sizeof(struct qeth_rx)); in qeth_init_qdio_queues()
2954 qeth_initialize_working_pool_list(card); in qeth_init_qdio_queues()
2957 rc = qeth_init_input_buffer(card, &card->qdio.in_q->bufs[i]); in qeth_init_qdio_queues()
2962 card->qdio.in_q->next_buf_to_init = QDIO_BUFNR(rx_bufs); in qeth_init_qdio_queues()
2963 rc = qdio_add_bufs_to_input_queue(CARD_DDEV(card), 0, 0, rx_bufs); in qeth_init_qdio_queues()
2965 QETH_CARD_TEXT_(card, 2, "1err%d", rc); in qeth_init_qdio_queues()
2970 rc = qeth_cq_init(card); in qeth_init_qdio_queues()
2976 for (i = 0; i < card->qdio.no_out_queues; ++i) { in qeth_init_qdio_queues()
2977 struct qeth_qdio_out_q *queue = card->qdio.out_qs[i]; in qeth_init_qdio_queues()
2980 queue->max_elements = QETH_MAX_BUFFER_ELEMENTS(card); in qeth_init_qdio_queues()
2987 queue->bulk_max = qeth_tx_select_bulk_max(card, queue); in qeth_init_qdio_queues()
2990 netdev_tx_reset_queue(netdev_get_tx_queue(card->dev, i)); in qeth_init_qdio_queues()
2995 static void qeth_ipa_finalize_cmd(struct qeth_card *card, in qeth_ipa_finalize_cmd() argument
2998 qeth_mpc_finalize_cmd(card, iob); in qeth_ipa_finalize_cmd()
3001 __ipa_cmd(iob)->hdr.seqno = card->seqno.ipa++; in qeth_ipa_finalize_cmd()
3004 static void qeth_prepare_ipa_cmd(struct qeth_card *card, in qeth_prepare_ipa_cmd() argument
3007 u8 prot_type = qeth_mpc_select_prot_type(card); in qeth_prepare_ipa_cmd()
3020 &card->token.ulp_connection_r, QETH_MPC_TOKEN_LENGTH); in qeth_prepare_ipa_cmd()
3032 struct qeth_cmd_buffer *qeth_ipa_alloc_cmd(struct qeth_card *card, in qeth_ipa_alloc_cmd() argument
3041 iob = qeth_alloc_cmd(&card->write, IPA_PDU_HEADER_SIZE + data_length, 1, in qeth_ipa_alloc_cmd()
3046 qeth_prepare_ipa_cmd(card, iob, data_length); in qeth_ipa_alloc_cmd()
3054 hdr->rel_adapter_no = (u8) card->dev->dev_port; in qeth_ipa_alloc_cmd()
3055 hdr->prim_version_no = IS_LAYER2(card) ? 2 : 1; in qeth_ipa_alloc_cmd()
3062 static int qeth_send_ipa_cmd_cb(struct qeth_card *card, in qeth_send_ipa_cmd_cb() argument
3076 int qeth_send_ipa_cmd(struct qeth_card *card, struct qeth_cmd_buffer *iob, in qeth_send_ipa_cmd() argument
3083 QETH_CARD_TEXT(card, 4, "sendipa"); in qeth_send_ipa_cmd()
3085 if (card->read_or_write_problem) { in qeth_send_ipa_cmd()
3092 rc = qeth_send_control_data(card, iob, reply_cb, reply_param); in qeth_send_ipa_cmd()
3094 qeth_clear_ipacmd_list(card); in qeth_send_ipa_cmd()
3095 qeth_schedule_recovery(card); in qeth_send_ipa_cmd()
3101 static int qeth_send_startlan_cb(struct qeth_card *card, in qeth_send_startlan_cb() argument
3112 static int qeth_send_startlan(struct qeth_card *card) in qeth_send_startlan() argument
3116 QETH_CARD_TEXT(card, 2, "strtlan"); in qeth_send_startlan()
3118 iob = qeth_ipa_alloc_cmd(card, IPA_CMD_STARTLAN, QETH_PROT_NONE, 0); in qeth_send_startlan()
3121 return qeth_send_ipa_cmd(card, iob, qeth_send_startlan_cb, NULL); in qeth_send_startlan()
3132 static int qeth_query_setadapterparms_cb(struct qeth_card *card, in qeth_query_setadapterparms_cb() argument
3138 QETH_CARD_TEXT(card, 3, "quyadpcb"); in qeth_query_setadapterparms_cb()
3144 if (!qeth_is_supported_link_type(card, query_cmd->lan_type)) in qeth_query_setadapterparms_cb()
3147 card->info.link_type = query_cmd->lan_type; in qeth_query_setadapterparms_cb()
3148 QETH_CARD_TEXT_(card, 2, "lnk %d", card->info.link_type); in qeth_query_setadapterparms_cb()
3151 card->options.adp.supported = query_cmd->supported_cmds; in qeth_query_setadapterparms_cb()
3155 static struct qeth_cmd_buffer *qeth_get_adapter_cmd(struct qeth_card *card, in qeth_get_adapter_cmd() argument
3162 iob = qeth_ipa_alloc_cmd(card, IPA_CMD_SETADAPTERPARMS, QETH_PROT_IPV4, in qeth_get_adapter_cmd()
3177 static int qeth_query_setadapterparms(struct qeth_card *card) in qeth_query_setadapterparms() argument
3182 QETH_CARD_TEXT(card, 3, "queryadp"); in qeth_query_setadapterparms()
3183 iob = qeth_get_adapter_cmd(card, IPA_SETADP_QUERY_COMMANDS_SUPPORTED, in qeth_query_setadapterparms()
3187 rc = qeth_send_ipa_cmd(card, iob, qeth_query_setadapterparms_cb, NULL); in qeth_query_setadapterparms()
3191 static int qeth_query_ipassists_cb(struct qeth_card *card, in qeth_query_ipassists_cb() argument
3196 QETH_CARD_TEXT(card, 2, "qipasscb"); in qeth_query_ipassists_cb()
3205 QETH_CARD_TEXT(card, 2, "ipaunsup"); in qeth_query_ipassists_cb()
3206 card->options.ipa4.supported |= IPA_SETADAPTERPARMS; in qeth_query_ipassists_cb()
3207 card->options.ipa6.supported |= IPA_SETADAPTERPARMS; in qeth_query_ipassists_cb()
3211 CARD_DEVID(card), cmd->hdr.return_code); in qeth_query_ipassists_cb()
3216 card->options.ipa4 = cmd->hdr.assists; in qeth_query_ipassists_cb()
3218 card->options.ipa6 = cmd->hdr.assists; in qeth_query_ipassists_cb()
3221 CARD_DEVID(card)); in qeth_query_ipassists_cb()
3225 static int qeth_query_ipassists(struct qeth_card *card, in qeth_query_ipassists() argument
3231 QETH_CARD_TEXT_(card, 2, "qipassi%i", prot); in qeth_query_ipassists()
3232 iob = qeth_ipa_alloc_cmd(card, IPA_CMD_QIPASSIST, prot, 0); in qeth_query_ipassists()
3235 rc = qeth_send_ipa_cmd(card, iob, qeth_query_ipassists_cb, NULL); in qeth_query_ipassists()
3239 static int qeth_query_switch_attributes_cb(struct qeth_card *card, in qeth_query_switch_attributes_cb() argument
3246 QETH_CARD_TEXT(card, 2, "qswiatcb"); in qeth_query_switch_attributes_cb()
3254 QETH_CARD_TEXT_(card, 2, "%04x%04x", sw_info->capabilities, in qeth_query_switch_attributes_cb()
3259 int qeth_query_switch_attributes(struct qeth_card *card, in qeth_query_switch_attributes() argument
3264 QETH_CARD_TEXT(card, 2, "qswiattr"); in qeth_query_switch_attributes()
3265 if (!qeth_adp_supported(card, IPA_SETADP_QUERY_SWITCH_ATTRIBUTES)) in qeth_query_switch_attributes()
3267 if (!netif_carrier_ok(card->dev)) in qeth_query_switch_attributes()
3269 iob = qeth_get_adapter_cmd(card, IPA_SETADP_QUERY_SWITCH_ATTRIBUTES, 0); in qeth_query_switch_attributes()
3272 return qeth_send_ipa_cmd(card, iob, in qeth_query_switch_attributes()
3276 struct qeth_cmd_buffer *qeth_get_diag_cmd(struct qeth_card *card, in qeth_get_diag_cmd() argument
3283 iob = qeth_ipa_alloc_cmd(card, IPA_CMD_SET_DIAG_ASS, QETH_PROT_NONE, in qeth_get_diag_cmd()
3295 static int qeth_query_setdiagass_cb(struct qeth_card *card, in qeth_query_setdiagass_cb() argument
3302 QETH_CARD_TEXT_(card, 2, "diagq:%x", rc); in qeth_query_setdiagass_cb()
3306 card->info.diagass_support = cmd->data.diagass.ext; in qeth_query_setdiagass_cb()
3310 static int qeth_query_setdiagass(struct qeth_card *card) in qeth_query_setdiagass() argument
3314 QETH_CARD_TEXT(card, 2, "qdiagass"); in qeth_query_setdiagass()
3315 iob = qeth_get_diag_cmd(card, QETH_DIAGS_CMD_QUERY, 0); in qeth_query_setdiagass()
3318 return qeth_send_ipa_cmd(card, iob, qeth_query_setdiagass_cb, NULL); in qeth_query_setdiagass()
3321 static void qeth_get_trap_id(struct qeth_card *card, struct qeth_trap_id *tid) in qeth_get_trap_id() argument
3329 tid->chpid = card->info.chpid; in qeth_get_trap_id()
3330 ccw_device_get_id(CARD_RDEV(card), &ccwid); in qeth_get_trap_id()
3345 static int qeth_hw_trap_cb(struct qeth_card *card, in qeth_hw_trap_cb() argument
3352 QETH_CARD_TEXT_(card, 2, "trapc:%x", rc); in qeth_hw_trap_cb()
3358 int qeth_hw_trap(struct qeth_card *card, enum qeth_diags_trap_action action) in qeth_hw_trap() argument
3363 QETH_CARD_TEXT(card, 2, "diagtrap"); in qeth_hw_trap()
3364 iob = qeth_get_diag_cmd(card, QETH_DIAGS_CMD_TRAP, 64); in qeth_hw_trap()
3375 qeth_get_trap_id(card, in qeth_hw_trap()
3384 return qeth_send_ipa_cmd(card, iob, qeth_hw_trap_cb, NULL); in qeth_hw_trap()
3387 static int qeth_check_qdio_errors(struct qeth_card *card, in qeth_check_qdio_errors() argument
3393 QETH_CARD_TEXT(card, 2, dbftext); in qeth_check_qdio_errors()
3394 QETH_CARD_TEXT_(card, 2, " F15=%02X", in qeth_check_qdio_errors()
3396 QETH_CARD_TEXT_(card, 2, " F14=%02X", in qeth_check_qdio_errors()
3398 QETH_CARD_TEXT_(card, 2, " qerr=%X", qdio_error); in qeth_check_qdio_errors()
3400 QETH_CARD_STAT_INC(card, rx_fifo_errors); in qeth_check_qdio_errors()
3408 static unsigned int qeth_rx_refill_queue(struct qeth_card *card, in qeth_rx_refill_queue() argument
3411 struct qeth_qdio_q *queue = card->qdio.in_q; in qeth_rx_refill_queue()
3418 if (count >= QETH_IN_BUF_REQUEUE_THRESHOLD(card)) { in qeth_rx_refill_queue()
3421 if (qeth_init_input_buffer(card, in qeth_rx_refill_queue()
3432 atomic_set(&card->force_alloc_skb, 3); in qeth_rx_refill_queue()
3435 atomic_add_unless(&card->force_alloc_skb, -1, 0); in qeth_rx_refill_queue()
3440 list_for_each(lh, &card->qdio.in_buf_pool.entry_list) in qeth_rx_refill_queue()
3442 if (i == card->qdio.in_buf_pool.buf_count) { in qeth_rx_refill_queue()
3443 QETH_CARD_TEXT(card, 2, "qsarbw"); in qeth_rx_refill_queue()
3445 &card->buffer_reclaim_work, in qeth_rx_refill_queue()
3451 rc = qdio_add_bufs_to_input_queue(CARD_DDEV(card), 0, in qeth_rx_refill_queue()
3455 QETH_CARD_TEXT(card, 2, "qinberr"); in qeth_rx_refill_queue()
3467 struct qeth_card *card = container_of(to_delayed_work(work), in qeth_buffer_reclaim_work() local
3472 napi_schedule(&card->napi); in qeth_buffer_reclaim_work()
3477 static void qeth_handle_send_error(struct qeth_card *card, in qeth_handle_send_error() argument
3482 QETH_CARD_TEXT(card, 6, "hdsnderr"); in qeth_handle_send_error()
3483 qeth_check_qdio_errors(card, buffer->buffer, qdio_err, "qouterr"); in qeth_handle_send_error()
3491 QETH_CARD_TEXT(card, 1, "lnkfail"); in qeth_handle_send_error()
3492 QETH_CARD_TEXT_(card, 1, "%04x %02x", in qeth_handle_send_error()
3528 QETH_CARD_TEXT(queue->card, 6, "np->pack"); in qeth_switch_to_packing_if_needed()
3547 QETH_CARD_TEXT(queue->card, 6, "pack->np"); in qeth_switch_to_nonpacking_if_needed()
3560 struct qeth_card *card = queue->card; in qeth_flush_buffers() local
3575 if (IS_IQD(card)) { in qeth_flush_buffers()
3581 if (IS_IQD(card)) { in qeth_flush_buffers()
3582 if (card->options.cq == QETH_CQ_ENABLED && in qeth_flush_buffers()
3583 !qeth_iqd_is_mcast_queue(card, queue) && in qeth_flush_buffers()
3625 rc = qdio_add_bufs_to_output_queue(CARD_DDEV(card), queue->queue_no, in qeth_flush_buffers()
3641 } else if (qeth_use_tx_irqs(card) && in qeth_flush_buffers()
3652 QETH_CARD_TEXT(queue->card, 2, "flushbuf"); in qeth_flush_buffers()
3653 QETH_CARD_TEXT_(queue->card, 2, " q%d", queue->queue_no); in qeth_flush_buffers()
3654 QETH_CARD_TEXT_(queue->card, 2, " idx%d", index); in qeth_flush_buffers()
3655 QETH_CARD_TEXT_(queue->card, 2, " c%d", count); in qeth_flush_buffers()
3656 QETH_CARD_TEXT_(queue->card, 2, " err%d", rc); in qeth_flush_buffers()
3660 qeth_schedule_recovery(queue->card); in qeth_flush_buffers()
3702 struct qeth_card *card = (struct qeth_card *)card_ptr; in qeth_qdio_poll() local
3704 napi_schedule_irqoff(&card->napi); in qeth_qdio_poll()
3707 int qeth_configure_cq(struct qeth_card *card, enum qeth_cq cq) in qeth_configure_cq() argument
3711 if (card->options.cq == QETH_CQ_NOTAVAILABLE) { in qeth_configure_cq()
3715 if (card->options.cq == cq) { in qeth_configure_cq()
3720 qeth_free_qdio_queues(card); in qeth_configure_cq()
3721 card->options.cq = cq; in qeth_configure_cq()
3730 static void qeth_qdio_handle_aob(struct qeth_card *card, struct qaob *aob) in qeth_qdio_handle_aob() argument
3738 queue_no < card->qdio.no_out_queues) in qeth_qdio_handle_aob()
3739 napi_schedule(&card->qdio.out_qs[queue_no]->napi); in qeth_qdio_handle_aob()
3742 static void qeth_qdio_cq_handler(struct qeth_card *card, unsigned int qdio_err, in qeth_qdio_cq_handler() argument
3746 struct qeth_qdio_q *cq = card->qdio.c_q; in qeth_qdio_cq_handler()
3750 QETH_CARD_TEXT_(card, 5, "qcqhe%d", first_element); in qeth_qdio_cq_handler()
3751 QETH_CARD_TEXT_(card, 5, "qcqhc%d", count); in qeth_qdio_cq_handler()
3752 QETH_CARD_TEXT_(card, 5, "qcqherr%d", qdio_err); in qeth_qdio_cq_handler()
3755 netif_tx_stop_all_queues(card->dev); in qeth_qdio_cq_handler()
3756 qeth_schedule_recovery(card); in qeth_qdio_cq_handler()
3768 qeth_qdio_handle_aob(card, phys_to_virt(phys_aob_addr)); in qeth_qdio_cq_handler()
3773 rc = qdio_add_bufs_to_input_queue(CARD_DDEV(card), queue, in qeth_qdio_cq_handler()
3776 dev_warn(&card->gdev->dev, in qeth_qdio_cq_handler()
3778 QETH_CARD_TEXT(card, 2, "qcqherr"); in qeth_qdio_cq_handler()
3789 struct qeth_card *card = (struct qeth_card *)card_ptr; in qeth_qdio_input_handler() local
3791 QETH_CARD_TEXT_(card, 2, "qihq%d", queue); in qeth_qdio_input_handler()
3792 QETH_CARD_TEXT_(card, 2, "qiec%d", qdio_err); in qeth_qdio_input_handler()
3795 qeth_schedule_recovery(card); in qeth_qdio_input_handler()
3803 struct qeth_card *card = (struct qeth_card *) card_ptr; in qeth_qdio_output_handler() local
3805 QETH_CARD_TEXT(card, 2, "achkcond"); in qeth_qdio_output_handler()
3806 netif_tx_stop_all_queues(card->dev); in qeth_qdio_output_handler()
3807 qeth_schedule_recovery(card); in qeth_qdio_output_handler()
3813 static int qeth_get_priority_queue(struct qeth_card *card, struct sk_buff *skb) in qeth_get_priority_queue() argument
3818 switch (card->qdio.do_prio_queueing) { in qeth_get_priority_queue()
3829 return card->qdio.default_out_queue; in qeth_get_priority_queue()
3831 if (card->qdio.do_prio_queueing == QETH_PRIO_Q_ING_PREC) in qeth_get_priority_queue()
3852 return card->qdio.default_out_queue; in qeth_get_priority_queue()
3856 return card->qdio.default_out_queue; in qeth_get_priority_queue()
4111 static int __qeth_xmit(struct qeth_card *card, struct qeth_qdio_out_q *queue, in __qeth_xmit() argument
4124 txq = netdev_get_tx_queue(card->dev, skb_get_queue_mapping(skb)); in __qeth_xmit()
4189 static int qeth_do_send_packet(struct qeth_card *card, in qeth_do_send_packet() argument
4212 txq = netdev_get_tx_queue(card->dev, skb_get_queue_mapping(skb)); in qeth_do_send_packet()
4290 int qeth_xmit(struct qeth_card *card, struct sk_buff *skb, in qeth_xmit() argument
4310 proto_len = (IS_IQD(card) && IS_LAYER2(card)) ? ETH_HLEN : 0; in qeth_xmit()
4332 if (IS_IQD(card)) { in qeth_xmit()
4333 rc = __qeth_xmit(card, queue, skb, elements, hdr, data_offset, in qeth_xmit()
4339 rc = qeth_do_send_packet(card, queue, skb, hdr, data_offset, in qeth_xmit()
4351 static int qeth_setadp_promisc_mode_cb(struct qeth_card *card, in qeth_setadp_promisc_mode_cb() argument
4357 QETH_CARD_TEXT(card, 4, "prmadpcb"); in qeth_setadp_promisc_mode_cb()
4361 QETH_CARD_TEXT_(card, 4, "prmrc%x", cmd->hdr.return_code); in qeth_setadp_promisc_mode_cb()
4364 card->info.promisc_mode = setparms->data.mode; in qeth_setadp_promisc_mode_cb()
4368 void qeth_setadp_promisc_mode(struct qeth_card *card, bool enable) in qeth_setadp_promisc_mode() argument
4375 QETH_CARD_TEXT(card, 4, "setprom"); in qeth_setadp_promisc_mode()
4376 QETH_CARD_TEXT_(card, 4, "mode:%x", mode); in qeth_setadp_promisc_mode()
4378 iob = qeth_get_adapter_cmd(card, IPA_SETADP_SET_PROMISC_MODE, in qeth_setadp_promisc_mode()
4384 qeth_send_ipa_cmd(card, iob, qeth_setadp_promisc_mode_cb, NULL); in qeth_setadp_promisc_mode()
4388 static int qeth_setadpparms_change_macaddr_cb(struct qeth_card *card, in qeth_setadpparms_change_macaddr_cb() argument
4394 QETH_CARD_TEXT(card, 4, "chgmaccb"); in qeth_setadpparms_change_macaddr_cb()
4402 if (IS_LAYER2(card) && IS_OSD(card) && !IS_VM_NIC(card) && in qeth_setadpparms_change_macaddr_cb()
4406 eth_hw_addr_set(card->dev, adp_cmd->data.change_addr.addr); in qeth_setadpparms_change_macaddr_cb()
4410 int qeth_setadpparms_change_macaddr(struct qeth_card *card) in qeth_setadpparms_change_macaddr() argument
4416 QETH_CARD_TEXT(card, 4, "chgmac"); in qeth_setadpparms_change_macaddr()
4418 iob = qeth_get_adapter_cmd(card, IPA_SETADP_ALTER_MAC_ADDRESS, in qeth_setadpparms_change_macaddr()
4426 card->dev->dev_addr); in qeth_setadpparms_change_macaddr()
4427 rc = qeth_send_ipa_cmd(card, iob, qeth_setadpparms_change_macaddr_cb, in qeth_setadpparms_change_macaddr()
4433 static int qeth_setadpparms_set_access_ctrl_cb(struct qeth_card *card, in qeth_setadpparms_set_access_ctrl_cb() argument
4439 QETH_CARD_TEXT(card, 4, "setaccb"); in qeth_setadpparms_set_access_ctrl_cb()
4442 QETH_CARD_TEXT_(card, 2, "rc=%d", in qeth_setadpparms_set_access_ctrl_cb()
4447 access_ctrl_req->subcmd_code, CARD_DEVID(card), in qeth_setadpparms_set_access_ctrl_cb()
4452 dev_info(&card->gdev->dev, in qeth_setadpparms_set_access_ctrl_cb()
4455 dev_info(&card->gdev->dev, in qeth_setadpparms_set_access_ctrl_cb()
4460 CARD_DEVID(card)); in qeth_setadpparms_set_access_ctrl_cb()
4464 CARD_DEVID(card)); in qeth_setadpparms_set_access_ctrl_cb()
4467 dev_err(&card->gdev->dev, "Adapter does not " in qeth_setadpparms_set_access_ctrl_cb()
4471 dev_err(&card->gdev->dev, in qeth_setadpparms_set_access_ctrl_cb()
4476 dev_err(&card->gdev->dev, in qeth_setadpparms_set_access_ctrl_cb()
4480 dev_err(&card->gdev->dev, "The adjacent switch port does not " in qeth_setadpparms_set_access_ctrl_cb()
4484 dev_err(&card->gdev->dev, "The reflective relay mode cannot be " in qeth_setadpparms_set_access_ctrl_cb()
4488 dev_warn(&card->gdev->dev, "Turning off reflective relay mode " in qeth_setadpparms_set_access_ctrl_cb()
4497 int qeth_setadpparms_set_access_ctrl(struct qeth_card *card, in qeth_setadpparms_set_access_ctrl() argument
4505 QETH_CARD_TEXT(card, 4, "setacctl"); in qeth_setadpparms_set_access_ctrl()
4507 if (!qeth_adp_supported(card, IPA_SETADP_SET_ACCESS_CONTROL)) { in qeth_setadpparms_set_access_ctrl()
4508 dev_err(&card->gdev->dev, in qeth_setadpparms_set_access_ctrl()
4513 iob = qeth_get_adapter_cmd(card, IPA_SETADP_SET_ACCESS_CONTROL, in qeth_setadpparms_set_access_ctrl()
4521 rc = qeth_send_ipa_cmd(card, iob, qeth_setadpparms_set_access_ctrl_cb, in qeth_setadpparms_set_access_ctrl()
4524 QETH_CARD_TEXT_(card, 2, "rc=%d", rc); in qeth_setadpparms_set_access_ctrl()
4526 rc, CARD_DEVID(card)); in qeth_setadpparms_set_access_ctrl()
4534 struct qeth_card *card; in qeth_tx_timeout() local
4536 card = dev->ml_priv; in qeth_tx_timeout()
4537 QETH_CARD_TEXT(card, 4, "txtimeo"); in qeth_tx_timeout()
4538 qeth_schedule_recovery(card); in qeth_tx_timeout()
4544 struct qeth_card *card = dev->ml_priv; in qeth_mdio_read() local
4550 if ((card->info.link_type != QETH_LINK_TYPE_GBIT_ETH) && in qeth_mdio_read()
4551 (card->info.link_type != QETH_LINK_TYPE_10GBIT_ETH) && in qeth_mdio_read()
4552 (card->info.link_type != QETH_LINK_TYPE_25GBIT_ETH)) in qeth_mdio_read()
4584 rc = card->stats.rx_length_errors + in qeth_mdio_read()
4585 card->stats.rx_frame_errors + in qeth_mdio_read()
4586 card->stats.rx_fifo_errors; in qeth_mdio_read()
4608 static int qeth_snmp_command_cb(struct qeth_card *card, in qeth_snmp_command_cb() argument
4617 QETH_CARD_TEXT(card, 3, "snpcmdcb"); in qeth_snmp_command_cb()
4620 QETH_CARD_TEXT_(card, 4, "scer1%x", cmd->hdr.return_code); in qeth_snmp_command_cb()
4626 QETH_CARD_TEXT_(card, 4, "scer2%x", cmd->hdr.return_code); in qeth_snmp_command_cb()
4641 QETH_CARD_TEXT_(card, 4, "scer3%i", -ENOSPC); in qeth_snmp_command_cb()
4644 QETH_CARD_TEXT_(card, 4, "snore%i", in qeth_snmp_command_cb()
4646 QETH_CARD_TEXT_(card, 4, "sseqn%i", in qeth_snmp_command_cb()
4658 static int qeth_snmp_command(struct qeth_card *card, char __user *udata) in qeth_snmp_command() argument
4666 QETH_CARD_TEXT(card, 3, "snmpcmd"); in qeth_snmp_command()
4668 if (IS_VM_NIC(card)) in qeth_snmp_command()
4671 if ((!qeth_adp_supported(card, IPA_SETADP_SET_SNMP_CONTROL)) && in qeth_snmp_command()
4672 IS_LAYER3(card)) in qeth_snmp_command()
4684 iob = qeth_get_adapter_cmd(card, IPA_SETADP_SET_SNMP_CONTROL, req_len); in qeth_snmp_command()
4701 rc = qeth_send_ipa_cmd(card, iob, qeth_snmp_command_cb, &qinfo); in qeth_snmp_command()
4704 CARD_DEVID(card), rc); in qeth_snmp_command()
4714 static int qeth_setadpparms_query_oat_cb(struct qeth_card *card, in qeth_setadpparms_query_oat_cb() argument
4722 QETH_CARD_TEXT(card, 3, "qoatcb"); in qeth_setadpparms_query_oat_cb()
4741 static int qeth_query_oat_command(struct qeth_card *card, char __user *udata) in qeth_query_oat_command() argument
4751 QETH_CARD_TEXT(card, 3, "qoatcmd"); in qeth_query_oat_command()
4753 if (!qeth_adp_supported(card, IPA_SETADP_QUERY_OAT)) in qeth_query_oat_command()
4765 iob = qeth_get_adapter_cmd(card, IPA_SETADP_QUERY_OAT, in qeth_query_oat_command()
4775 rc = qeth_send_ipa_cmd(card, iob, qeth_setadpparms_query_oat_cb, &priv); in qeth_query_oat_command()
4791 static int qeth_init_link_info_oat_cb(struct qeth_card *card, in qeth_init_link_info_oat_cb() argument
4800 QETH_CARD_TEXT(card, 2, "qoatincb"); in qeth_init_link_info_oat_cb()
4878 static void qeth_init_link_info(struct qeth_card *card) in qeth_init_link_info() argument
4880 qeth_default_link_info(card); in qeth_init_link_info()
4883 if (qeth_adp_supported(card, IPA_SETADP_QUERY_OAT)) { in qeth_init_link_info()
4887 iob = qeth_get_adapter_cmd(card, IPA_SETADP_QUERY_OAT, in qeth_init_link_info()
4896 if (!qeth_send_ipa_cmd(card, iob, in qeth_init_link_info()
4900 card->info.link_info.speed = link_info.speed; in qeth_init_link_info()
4902 card->info.link_info.duplex = link_info.duplex; in qeth_init_link_info()
4904 card->info.link_info.port = link_info.port; in qeth_init_link_info()
4906 card->info.link_info.link_mode = link_info.link_mode; in qeth_init_link_info()
4920 int qeth_vm_request_mac(struct qeth_card *card) in qeth_vm_request_mac() argument
4926 QETH_CARD_TEXT(card, 2, "vmreqmac"); in qeth_vm_request_mac()
4938 request->devno = card->info.ddev_devno; in qeth_vm_request_mac()
4950 QETH_CARD_TEXT(card, 2, "badresp"); in qeth_vm_request_mac()
4951 QETH_CARD_HEX(card, 2, &request->resp_buf_len, in qeth_vm_request_mac()
4955 QETH_CARD_TEXT(card, 2, "badmac"); in qeth_vm_request_mac()
4956 QETH_CARD_HEX(card, 2, response->mac, ETH_ALEN); in qeth_vm_request_mac()
4958 eth_hw_addr_set(card->dev, response->mac); in qeth_vm_request_mac()
4968 static void qeth_determine_capabilities(struct qeth_card *card) in qeth_determine_capabilities() argument
4970 struct qeth_channel *channel = &card->data; in qeth_determine_capabilities()
4975 QETH_CARD_TEXT(card, 2, "detcapab"); in qeth_determine_capabilities()
4980 QETH_CARD_TEXT_(card, 2, "3err%d", rc); in qeth_determine_capabilities()
4985 rc = qeth_read_conf_data(card); in qeth_determine_capabilities()
4988 CARD_DEVID(card), rc); in qeth_determine_capabilities()
4989 QETH_CARD_TEXT_(card, 2, "5err%d", rc); in qeth_determine_capabilities()
4993 rc = qdio_get_ssqd_desc(ddev, &card->ssqd); in qeth_determine_capabilities()
4995 QETH_CARD_TEXT_(card, 2, "6err%d", rc); in qeth_determine_capabilities()
4997 QETH_CARD_TEXT_(card, 2, "qfmt%d", card->ssqd.qfmt); in qeth_determine_capabilities()
4998 QETH_CARD_TEXT_(card, 2, "ac1:%02x", card->ssqd.qdioac1); in qeth_determine_capabilities()
4999 QETH_CARD_TEXT_(card, 2, "ac2:%04x", card->ssqd.qdioac2); in qeth_determine_capabilities()
5000 QETH_CARD_TEXT_(card, 2, "ac3:%04x", card->ssqd.qdioac3); in qeth_determine_capabilities()
5001 QETH_CARD_TEXT_(card, 2, "icnt%d", card->ssqd.icnt); in qeth_determine_capabilities()
5002 if (!((card->ssqd.qfmt != QDIO_IQDIO_QFMT) || in qeth_determine_capabilities()
5003 ((card->ssqd.qdioac1 & CHSC_AC1_INITIATE_INPUTQ) == 0) || in qeth_determine_capabilities()
5004 ((card->ssqd.qdioac3 & CHSC_AC3_FORMAT2_CQ_AVAILABLE) == 0))) { in qeth_determine_capabilities()
5005 dev_info(&card->gdev->dev, in qeth_determine_capabilities()
5008 card->options.cq = QETH_CQ_NOTAVAILABLE; in qeth_determine_capabilities()
5018 static void qeth_read_ccw_conf_data(struct qeth_card *card) in qeth_read_ccw_conf_data() argument
5020 struct qeth_card_info *info = &card->info; in qeth_read_ccw_conf_data()
5021 struct ccw_device *cdev = CARD_DDEV(card); in qeth_read_ccw_conf_data()
5024 QETH_CARD_TEXT(card, 2, "ccwconfd"); in qeth_read_ccw_conf_data()
5033 dev_info(&card->gdev->dev, "CHID: %x CHPID: %x\n", in qeth_read_ccw_conf_data()
5036 QETH_CARD_TEXT_(card, 3, "devn%x", info->ddev_devno); in qeth_read_ccw_conf_data()
5037 QETH_CARD_TEXT_(card, 3, "cssid:%x", info->cssid); in qeth_read_ccw_conf_data()
5038 QETH_CARD_TEXT_(card, 3, "iid:%x", info->iid); in qeth_read_ccw_conf_data()
5039 QETH_CARD_TEXT_(card, 3, "ssid:%x", info->ssid); in qeth_read_ccw_conf_data()
5040 QETH_CARD_TEXT_(card, 3, "chpid:%x", info->chpid); in qeth_read_ccw_conf_data()
5041 QETH_CARD_TEXT_(card, 3, "chid:%x", info->chid); in qeth_read_ccw_conf_data()
5042 QETH_CARD_TEXT_(card, 3, "idval%x", info->ids_valid); in qeth_read_ccw_conf_data()
5045 static int qeth_qdio_establish(struct qeth_card *card) in qeth_qdio_establish() argument
5055 QETH_CARD_TEXT(card, 2, "qdioest"); in qeth_qdio_establish()
5057 if (!IS_IQD(card) && !IS_VM_NIC(card)) { in qeth_qdio_establish()
5062 qeth_fill_qib_parms(card, qib_parms); in qeth_qdio_establish()
5065 in_sbal_ptrs[0] = card->qdio.in_q->qdio_bufs; in qeth_qdio_establish()
5066 if (card->options.cq == QETH_CQ_ENABLED) { in qeth_qdio_establish()
5067 in_sbal_ptrs[1] = card->qdio.c_q->qdio_bufs; in qeth_qdio_establish()
5071 for (i = 0; i < card->qdio.no_out_queues; i++) in qeth_qdio_establish()
5072 out_sbal_ptrs[i] = card->qdio.out_qs[i]->qdio_bufs; in qeth_qdio_establish()
5075 init_data.q_format = IS_IQD(card) ? QDIO_IQDIO_QFMT : in qeth_qdio_establish()
5080 init_data.no_output_qs = card->qdio.no_out_queues; in qeth_qdio_establish()
5084 init_data.int_parm = (unsigned long) card; in qeth_qdio_establish()
5088 if (atomic_cmpxchg(&card->qdio.state, QETH_QDIO_ALLOCATED, in qeth_qdio_establish()
5090 rc = qdio_allocate(CARD_DDEV(card), init_data.no_input_qs, in qeth_qdio_establish()
5093 atomic_set(&card->qdio.state, QETH_QDIO_ALLOCATED); in qeth_qdio_establish()
5096 rc = qdio_establish(CARD_DDEV(card), &init_data); in qeth_qdio_establish()
5098 atomic_set(&card->qdio.state, QETH_QDIO_ALLOCATED); in qeth_qdio_establish()
5099 qdio_free(CARD_DDEV(card)); in qeth_qdio_establish()
5103 switch (card->options.cq) { in qeth_qdio_establish()
5105 dev_info(&card->gdev->dev, "Completion Queue support enabled"); in qeth_qdio_establish()
5108 dev_info(&card->gdev->dev, "Completion Queue support disabled"); in qeth_qdio_establish()
5119 static void qeth_core_free_card(struct qeth_card *card) in qeth_core_free_card() argument
5121 QETH_CARD_TEXT(card, 2, "freecrd"); in qeth_core_free_card()
5123 unregister_service_level(&card->qeth_service_level); in qeth_core_free_card()
5124 debugfs_remove_recursive(card->debugfs); in qeth_core_free_card()
5125 qeth_put_cmd(card->read_cmd); in qeth_core_free_card()
5126 destroy_workqueue(card->event_wq); in qeth_core_free_card()
5127 dev_set_drvdata(&card->gdev->dev, NULL); in qeth_core_free_card()
5128 kfree(card); in qeth_core_free_card()
5131 static void qeth_trace_features(struct qeth_card *card) in qeth_trace_features() argument
5133 QETH_CARD_TEXT(card, 2, "features"); in qeth_trace_features()
5134 QETH_CARD_HEX(card, 2, &card->options.ipa4, sizeof(card->options.ipa4)); in qeth_trace_features()
5135 QETH_CARD_HEX(card, 2, &card->options.ipa6, sizeof(card->options.ipa6)); in qeth_trace_features()
5136 QETH_CARD_HEX(card, 2, &card->options.adp, sizeof(card->options.adp)); in qeth_trace_features()
5137 QETH_CARD_HEX(card, 2, &card->info.diagass_support, in qeth_trace_features()
5138 sizeof(card->info.diagass_support)); in qeth_trace_features()
5166 static int qeth_hardsetup_card(struct qeth_card *card, bool *carrier_ok) in qeth_hardsetup_card() argument
5171 QETH_CARD_TEXT(card, 2, "hrdsetup"); in qeth_hardsetup_card()
5172 atomic_set(&card->force_alloc_skb, 0); in qeth_hardsetup_card()
5173 rc = qeth_update_from_chp_desc(card); in qeth_hardsetup_card()
5179 CARD_DEVID(card)); in qeth_hardsetup_card()
5180 rc = qeth_qdio_clear_card(card, !IS_IQD(card)); in qeth_hardsetup_card()
5181 qeth_stop_channel(&card->data); in qeth_hardsetup_card()
5182 qeth_stop_channel(&card->write); in qeth_hardsetup_card()
5183 qeth_stop_channel(&card->read); in qeth_hardsetup_card()
5184 qdio_free(CARD_DDEV(card)); in qeth_hardsetup_card()
5186 rc = qeth_start_channel(&card->read); in qeth_hardsetup_card()
5189 rc = qeth_start_channel(&card->write); in qeth_hardsetup_card()
5192 rc = qeth_start_channel(&card->data); in qeth_hardsetup_card()
5197 QETH_CARD_TEXT(card, 2, "break1"); in qeth_hardsetup_card()
5200 QETH_CARD_TEXT_(card, 2, "1err%d", rc); in qeth_hardsetup_card()
5207 qeth_determine_capabilities(card); in qeth_hardsetup_card()
5208 qeth_read_ccw_conf_data(card); in qeth_hardsetup_card()
5209 qeth_idx_init(card); in qeth_hardsetup_card()
5211 rc = qeth_idx_activate_read_channel(card); in qeth_hardsetup_card()
5213 QETH_CARD_TEXT(card, 2, "break2"); in qeth_hardsetup_card()
5216 QETH_CARD_TEXT_(card, 2, "3err%d", rc); in qeth_hardsetup_card()
5223 rc = qeth_idx_activate_write_channel(card); in qeth_hardsetup_card()
5225 QETH_CARD_TEXT(card, 2, "break3"); in qeth_hardsetup_card()
5228 QETH_CARD_TEXT_(card, 2, "4err%d", rc); in qeth_hardsetup_card()
5234 card->read_or_write_problem = 0; in qeth_hardsetup_card()
5235 rc = qeth_mpc_initialize(card); in qeth_hardsetup_card()
5237 QETH_CARD_TEXT_(card, 2, "5err%d", rc); in qeth_hardsetup_card()
5241 rc = qeth_send_startlan(card); in qeth_hardsetup_card()
5243 QETH_CARD_TEXT_(card, 2, "6err%d", rc); in qeth_hardsetup_card()
5245 dev_warn(&card->gdev->dev, "The LAN is offline\n"); in qeth_hardsetup_card()
5254 card->options.ipa4.supported = 0; in qeth_hardsetup_card()
5255 card->options.ipa6.supported = 0; in qeth_hardsetup_card()
5256 card->options.adp.supported = 0; in qeth_hardsetup_card()
5257 card->options.sbp.supported_funcs = 0; in qeth_hardsetup_card()
5258 card->info.diagass_support = 0; in qeth_hardsetup_card()
5259 rc = qeth_query_ipassists(card, QETH_PROT_IPV4); in qeth_hardsetup_card()
5262 if (qeth_is_supported(card, IPA_IPV6)) { in qeth_hardsetup_card()
5263 rc = qeth_query_ipassists(card, QETH_PROT_IPV6); in qeth_hardsetup_card()
5267 if (qeth_is_supported(card, IPA_SETADAPTERPARMS)) { in qeth_hardsetup_card()
5268 rc = qeth_query_setadapterparms(card); in qeth_hardsetup_card()
5270 QETH_CARD_TEXT_(card, 2, "7err%d", rc); in qeth_hardsetup_card()
5274 if (qeth_adp_supported(card, IPA_SETADP_SET_DIAG_ASSIST)) { in qeth_hardsetup_card()
5275 rc = qeth_query_setdiagass(card); in qeth_hardsetup_card()
5277 QETH_CARD_TEXT_(card, 2, "8err%d", rc); in qeth_hardsetup_card()
5280 qeth_trace_features(card); in qeth_hardsetup_card()
5282 if (!qeth_is_diagass_supported(card, QETH_DIAGS_CMD_TRAP) || in qeth_hardsetup_card()
5283 (card->info.hwtrap && qeth_hw_trap(card, QETH_DIAGS_TRAP_ARM))) in qeth_hardsetup_card()
5284 card->info.hwtrap = 0; in qeth_hardsetup_card()
5286 if (card->options.isolation != ISOLATION_MODE_NONE) { in qeth_hardsetup_card()
5287 rc = qeth_setadpparms_set_access_ctrl(card, in qeth_hardsetup_card()
5288 card->options.isolation); in qeth_hardsetup_card()
5293 qeth_init_link_info(card); in qeth_hardsetup_card()
5295 rc = qeth_init_qdio_queues(card); in qeth_hardsetup_card()
5297 QETH_CARD_TEXT_(card, 2, "9err%d", rc); in qeth_hardsetup_card()
5303 dev_warn(&card->gdev->dev, "The qeth device driver failed to recover " in qeth_hardsetup_card()
5306 CARD_DEVID(card), rc); in qeth_hardsetup_card()
5310 static int qeth_set_online(struct qeth_card *card, in qeth_set_online() argument
5316 mutex_lock(&card->conf_mutex); in qeth_set_online()
5317 QETH_CARD_TEXT(card, 2, "setonlin"); in qeth_set_online()
5319 rc = qeth_hardsetup_card(card, &carrier_ok); in qeth_set_online()
5321 QETH_CARD_TEXT_(card, 2, "2err%04x", rc); in qeth_set_online()
5326 qeth_print_status_message(card); in qeth_set_online()
5328 if (card->dev->reg_state != NETREG_REGISTERED) in qeth_set_online()
5330 qeth_set_real_num_tx_queues(card, qeth_tx_actual_queues(card)); in qeth_set_online()
5332 rc = disc->set_online(card, carrier_ok); in qeth_set_online()
5337 kobject_uevent(&card->gdev->dev.kobj, KOBJ_CHANGE); in qeth_set_online()
5339 mutex_unlock(&card->conf_mutex); in qeth_set_online()
5344 qeth_qdio_clear_card(card, 0); in qeth_set_online()
5345 qeth_clear_working_pool_list(card); in qeth_set_online()
5346 qeth_flush_local_addrs(card); in qeth_set_online()
5348 qeth_stop_channel(&card->data); in qeth_set_online()
5349 qeth_stop_channel(&card->write); in qeth_set_online()
5350 qeth_stop_channel(&card->read); in qeth_set_online()
5351 qdio_free(CARD_DDEV(card)); in qeth_set_online()
5353 mutex_unlock(&card->conf_mutex); in qeth_set_online()
5357 int qeth_set_offline(struct qeth_card *card, const struct qeth_discipline *disc, in qeth_set_offline() argument
5362 mutex_lock(&card->conf_mutex); in qeth_set_offline()
5363 QETH_CARD_TEXT(card, 3, "setoffl"); in qeth_set_offline()
5365 if ((!resetting && card->info.hwtrap) || card->info.hwtrap == 2) { in qeth_set_offline()
5366 qeth_hw_trap(card, QETH_DIAGS_TRAP_DISARM); in qeth_set_offline()
5367 card->info.hwtrap = 1; in qeth_set_offline()
5371 qeth_clear_ipacmd_list(card); in qeth_set_offline()
5374 card->info.open_when_online = card->dev->flags & IFF_UP; in qeth_set_offline()
5375 dev_close(card->dev); in qeth_set_offline()
5376 netif_device_detach(card->dev); in qeth_set_offline()
5377 netif_carrier_off(card->dev); in qeth_set_offline()
5380 cancel_work_sync(&card->rx_mode_work); in qeth_set_offline()
5382 disc->set_offline(card); in qeth_set_offline()
5384 qeth_qdio_clear_card(card, 0); in qeth_set_offline()
5385 qeth_drain_output_queues(card); in qeth_set_offline()
5386 qeth_clear_working_pool_list(card); in qeth_set_offline()
5387 qeth_flush_local_addrs(card); in qeth_set_offline()
5388 card->info.promisc_mode = 0; in qeth_set_offline()
5389 qeth_default_link_info(card); in qeth_set_offline()
5391 rc = qeth_stop_channel(&card->data); in qeth_set_offline()
5392 rc2 = qeth_stop_channel(&card->write); in qeth_set_offline()
5393 rc3 = qeth_stop_channel(&card->read); in qeth_set_offline()
5397 QETH_CARD_TEXT_(card, 2, "1err%d", rc); in qeth_set_offline()
5398 qdio_free(CARD_DDEV(card)); in qeth_set_offline()
5401 kobject_uevent(&card->gdev->dev.kobj, KOBJ_CHANGE); in qeth_set_offline()
5403 mutex_unlock(&card->conf_mutex); in qeth_set_offline()
5411 struct qeth_card *card = data; in qeth_do_reset() local
5415 disc = card->discipline; in qeth_do_reset()
5417 QETH_CARD_TEXT(card, 2, "recover1"); in qeth_do_reset()
5418 if (!qeth_do_run_thread(card, QETH_RECOVER_THREAD)) in qeth_do_reset()
5420 QETH_CARD_TEXT(card, 2, "recover2"); in qeth_do_reset()
5421 dev_warn(&card->gdev->dev, in qeth_do_reset()
5424 qeth_set_offline(card, disc, true); in qeth_do_reset()
5425 rc = qeth_set_online(card, disc); in qeth_do_reset()
5427 dev_info(&card->gdev->dev, in qeth_do_reset()
5430 qeth_set_offline(card, disc, true); in qeth_do_reset()
5431 ccwgroup_set_offline(card->gdev, false); in qeth_do_reset()
5432 dev_warn(&card->gdev->dev, in qeth_do_reset()
5435 qeth_clear_thread_start_bit(card, QETH_RECOVER_THREAD); in qeth_do_reset()
5436 qeth_clear_thread_running_bit(card, QETH_RECOVER_THREAD); in qeth_do_reset()
5441 static void qeth_l3_rebuild_skb(struct qeth_card *card, struct sk_buff *skb, in qeth_l3_rebuild_skb() argument
5448 if (IS_IQD(card) && iucv->magic == ETH_P_AF_IUCV) { in qeth_l3_rebuild_skb()
5466 QETH_CARD_STAT_INC(card, rx_multicast); in qeth_l3_rebuild_skb()
5470 QETH_CARD_STAT_INC(card, rx_multicast); in qeth_l3_rebuild_skb()
5473 if (card->options.sniffer) in qeth_l3_rebuild_skb()
5487 if (!card->options.sniffer && in qeth_l3_rebuild_skb()
5499 static void qeth_receive_skb(struct qeth_card *card, struct sk_buff *skb, in qeth_receive_skb() argument
5502 struct napi_struct *napi = &card->napi; in qeth_receive_skb()
5504 if (is_cso && (card->dev->features & NETIF_F_RXCSUM)) { in qeth_receive_skb()
5506 QETH_CARD_STAT_INC(card, rx_skb_csum); in qeth_receive_skb()
5511 QETH_CARD_STAT_ADD(card, rx_bytes, skb->len); in qeth_receive_skb()
5512 QETH_CARD_STAT_INC(card, rx_packets); in qeth_receive_skb()
5514 QETH_CARD_STAT_INC(card, rx_sg_skbs); in qeth_receive_skb()
5515 QETH_CARD_STAT_ADD(card, rx_sg_frags, in qeth_receive_skb()
5543 static int qeth_extract_skb(struct qeth_card *card, in qeth_extract_skb() argument
5547 struct qeth_priv *priv = netdev_priv(card->dev); in qeth_extract_skb()
5549 struct napi_struct *napi = &card->napi; in qeth_extract_skb()
5588 if (!IS_LAYER3(card)) { in qeth_extract_skb()
5589 QETH_CARD_STAT_INC(card, rx_dropped_notsupp); in qeth_extract_skb()
5607 QETH_CARD_STAT_INC(card, rx_frame_errors); in qeth_extract_skb()
5609 QETH_CARD_STAT_INC(card, rx_dropped_notsupp); in qeth_extract_skb()
5616 QETH_CARD_STAT_INC(card, rx_dropped_runt); in qeth_extract_skb()
5620 use_rx_sg = (card->options.cq == QETH_CQ_ENABLED) || in qeth_extract_skb()
5622 !atomic_read(&card->force_alloc_skb)); in qeth_extract_skb()
5636 QETH_CARD_STAT_INC(card, rx_dropped_nomem); in qeth_extract_skb()
5645 netdev_info_once(card->dev, in qeth_extract_skb()
5654 QETH_CARD_STAT_INC(card, rx_dropped_nomem); in qeth_extract_skb()
5690 QETH_CARD_TEXT(card, 4, "unexeob"); in qeth_extract_skb()
5691 QETH_CARD_HEX(card, 2, buffer, sizeof(void *)); in qeth_extract_skb()
5697 QETH_CARD_STAT_INC(card, in qeth_extract_skb()
5716 qeth_l3_rebuild_skb(card, skb, hdr); in qeth_extract_skb()
5719 qeth_receive_skb(card, skb, uses_frags, is_cso); in qeth_extract_skb()
5723 static unsigned int qeth_extract_skbs(struct qeth_card *card, int budget, in qeth_extract_skbs() argument
5729 if (qeth_extract_skb(card, buf, &card->rx.buf_element, in qeth_extract_skbs()
5730 &card->rx.e_offset)) { in qeth_extract_skbs()
5742 static unsigned int qeth_rx_poll(struct qeth_card *card, int budget) in qeth_rx_poll() argument
5744 struct qeth_rx *ctx = &card->rx; in qeth_rx_poll()
5753 if (!card->rx.b_count) { in qeth_rx_poll()
5754 card->rx.qdio_err = 0; in qeth_rx_poll()
5755 card->rx.b_count = in qeth_rx_poll()
5756 qdio_inspect_input_queue(CARD_DDEV(card), 0, in qeth_rx_poll()
5757 &card->rx.b_index, in qeth_rx_poll()
5758 &card->rx.qdio_err); in qeth_rx_poll()
5759 if (card->rx.b_count <= 0) { in qeth_rx_poll()
5760 card->rx.b_count = 0; in qeth_rx_poll()
5766 buffer = &card->qdio.in_q->bufs[card->rx.b_index]; in qeth_rx_poll()
5767 if (!(card->rx.qdio_err && in qeth_rx_poll()
5768 qeth_check_qdio_errors(card, buffer->buffer, in qeth_rx_poll()
5769 card->rx.qdio_err, "qinerr"))) in qeth_rx_poll()
5770 skbs_done = qeth_extract_skbs(card, budget, buffer, in qeth_rx_poll()
5779 QETH_CARD_STAT_INC(card, rx_bufs); in qeth_rx_poll()
5780 qeth_put_buffer_pool_entry(card, buffer->pool_entry); in qeth_rx_poll()
5782 card->rx.b_count--; in qeth_rx_poll()
5784 ctx->bufs_refill -= qeth_rx_refill_queue(card, in qeth_rx_poll()
5788 card->rx.b_index = QDIO_BUFNR(card->rx.b_index + 1); in qeth_rx_poll()
5789 card->rx.buf_element = 0; in qeth_rx_poll()
5790 card->rx.e_offset = 0; in qeth_rx_poll()
5797 static void qeth_cq_poll(struct qeth_card *card) in qeth_cq_poll() argument
5805 completed = qdio_inspect_input_queue(CARD_DDEV(card), 1, &start, in qeth_cq_poll()
5810 qeth_qdio_cq_handler(card, error, 1, start, completed); in qeth_cq_poll()
5817 struct qeth_card *card = container_of(napi, struct qeth_card, napi); in qeth_poll() local
5820 work_done = qeth_rx_poll(card, budget); in qeth_poll()
5822 if (qeth_use_tx_irqs(card)) { in qeth_poll()
5826 qeth_for_each_output_queue(card, queue, i) { in qeth_poll()
5832 if (card->options.cq == QETH_CQ_ENABLED) in qeth_poll()
5833 qeth_cq_poll(card); in qeth_poll()
5836 struct qeth_rx *ctx = &card->rx; in qeth_poll()
5839 ctx->bufs_refill -= qeth_rx_refill_queue(card, ctx->bufs_refill); in qeth_poll()
5847 qdio_start_irq(CARD_DDEV(card))) in qeth_poll()
5860 struct qeth_card *card = queue->card; in qeth_iqd_tx_complete() local
5869 netdev_WARN_ONCE(card->dev, in qeth_iqd_tx_complete()
5872 qeth_schedule_recovery(card); in qeth_iqd_tx_complete()
5876 QETH_CARD_TEXT_(card, 5, "pel%u", bidx); in qeth_iqd_tx_complete()
5886 QETH_CARD_TEXT(card, 2, "outofbuf"); in qeth_iqd_tx_complete()
5887 qeth_schedule_recovery(card); in qeth_iqd_tx_complete()
5900 } else if (card->options.cq == QETH_CQ_ENABLED) { in qeth_iqd_tx_complete()
5912 struct qeth_card *card = queue->card; in qeth_tx_poll() local
5913 struct net_device *dev = card->dev; in qeth_tx_poll()
5917 if (IS_IQD(card)) in qeth_tx_poll()
5928 qeth_tx_complete_pending_bufs(card, queue, false, budget); in qeth_tx_poll()
5943 completed = qdio_inspect_output_queue(CARD_DDEV(card), queue_no, in qeth_tx_poll()
5961 qeth_handle_send_error(card, buffer, error); in qeth_tx_poll()
5962 if (IS_IQD(card)) in qeth_tx_poll()
5971 if (IS_IQD(card)) in qeth_tx_poll()
5994 static int qeth_setassparms_get_caps_cb(struct qeth_card *card, in qeth_setassparms_get_caps_cb() argument
6009 int qeth_setassparms_cb(struct qeth_card *card, in qeth_setassparms_cb() argument
6014 QETH_CARD_TEXT(card, 4, "defadpcb"); in qeth_setassparms_cb()
6021 card->options.ipa4.enabled = cmd->hdr.assists.enabled; in qeth_setassparms_cb()
6023 card->options.ipa6.enabled = cmd->hdr.assists.enabled; in qeth_setassparms_cb()
6028 struct qeth_cmd_buffer *qeth_get_setassparms_cmd(struct qeth_card *card, in qeth_get_setassparms_cmd() argument
6038 QETH_CARD_TEXT(card, 4, "getasscm"); in qeth_get_setassparms_cmd()
6039 iob = qeth_ipa_alloc_cmd(card, IPA_CMD_SETASSPARMS, prot, in qeth_get_setassparms_cmd()
6056 int qeth_send_simple_setassparms_prot(struct qeth_card *card, in qeth_send_simple_setassparms_prot() argument
6064 QETH_CARD_TEXT_(card, 4, "simassp%i", prot); in qeth_send_simple_setassparms_prot()
6065 iob = qeth_get_setassparms_cmd(card, ipa_func, cmd_code, length, prot); in qeth_send_simple_setassparms_prot()
6071 return qeth_send_ipa_cmd(card, iob, qeth_setassparms_cb, NULL); in qeth_send_simple_setassparms_prot()
6131 int qeth_setup_discipline(struct qeth_card *card, in qeth_setup_discipline() argument
6139 card->discipline = try_then_request_module( in qeth_setup_discipline()
6143 card->discipline = try_then_request_module( in qeth_setup_discipline()
6151 if (!card->discipline) { in qeth_setup_discipline()
6152 dev_err(&card->gdev->dev, "There is no kernel module to " in qeth_setup_discipline()
6157 rc = card->discipline->setup(card->gdev); in qeth_setup_discipline()
6163 card->discipline = NULL; in qeth_setup_discipline()
6168 card->options.layer = discipline; in qeth_setup_discipline()
6172 void qeth_remove_discipline(struct qeth_card *card) in qeth_remove_discipline() argument
6174 card->discipline->remove(card->gdev); in qeth_remove_discipline()
6176 if (IS_LAYER2(card)) in qeth_remove_discipline()
6180 card->options.layer = QETH_DISCIPLINE_UNDETERMINED; in qeth_remove_discipline()
6181 card->discipline = NULL; in qeth_remove_discipline()
6215 static int qeth_add_dbf_entry(struct qeth_card *card, char *name) in qeth_add_dbf_entry() argument
6219 card->debug = debug_register(name, 2, 1, 8); in qeth_add_dbf_entry()
6220 if (!card->debug) { in qeth_add_dbf_entry()
6224 if (debug_register_view(card->debug, &debug_hex_ascii_view)) in qeth_add_dbf_entry()
6230 new_entry->dbf_info = card->debug; in qeth_add_dbf_entry()
6238 debug_unregister(card->debug); in qeth_add_dbf_entry()
6256 static struct net_device *qeth_alloc_netdev(struct qeth_card *card) in qeth_alloc_netdev() argument
6261 switch (card->info.type) { in qeth_alloc_netdev()
6278 priv->tx_wanted_queues = IS_IQD(card) ? QETH_IQD_MIN_TXQ : 1; in qeth_alloc_netdev()
6280 dev->ml_priv = card; in qeth_alloc_netdev()
6286 SET_NETDEV_DEV(dev, &card->gdev->dev); in qeth_alloc_netdev()
6293 if (IS_IQD(card)) in qeth_alloc_netdev()
6312 struct qeth_card *card; in qeth_core_probe_device() local
6326 card = qeth_alloc_card(gdev); in qeth_core_probe_device()
6327 if (!card) { in qeth_core_probe_device()
6335 card->debug = qeth_get_dbf_entry(dbf_name); in qeth_core_probe_device()
6336 if (!card->debug) { in qeth_core_probe_device()
6337 rc = qeth_add_dbf_entry(card, dbf_name); in qeth_core_probe_device()
6342 qeth_setup_card(card); in qeth_core_probe_device()
6343 card->dev = qeth_alloc_netdev(card); in qeth_core_probe_device()
6344 if (!card->dev) { in qeth_core_probe_device()
6349 qeth_determine_capabilities(card); in qeth_core_probe_device()
6350 qeth_set_blkt_defaults(card); in qeth_core_probe_device()
6352 card->qdio.in_q = qeth_alloc_qdio_queue(); in qeth_core_probe_device()
6353 if (!card->qdio.in_q) { in qeth_core_probe_device()
6358 card->qdio.no_out_queues = card->dev->num_tx_queues; in qeth_core_probe_device()
6359 rc = qeth_update_from_chp_desc(card); in qeth_core_probe_device()
6365 enforced_disc = qeth_enforce_discipline(card); in qeth_core_probe_device()
6371 card->info.layer_enforced = true; in qeth_core_probe_device()
6373 rc = qeth_setup_discipline(card, enforced_disc); in qeth_core_probe_device()
6384 qeth_free_qdio_queue(card->qdio.in_q); in qeth_core_probe_device()
6386 free_netdev(card->dev); in qeth_core_probe_device()
6388 qeth_core_free_card(card); in qeth_core_probe_device()
6396 struct qeth_card *card = dev_get_drvdata(&gdev->dev); in qeth_core_remove_device() local
6398 QETH_CARD_TEXT(card, 2, "removedv"); in qeth_core_remove_device()
6400 mutex_lock(&card->discipline_mutex); in qeth_core_remove_device()
6401 if (card->discipline) in qeth_core_remove_device()
6402 qeth_remove_discipline(card); in qeth_core_remove_device()
6403 mutex_unlock(&card->discipline_mutex); in qeth_core_remove_device()
6405 qeth_free_qdio_queues(card); in qeth_core_remove_device()
6407 qeth_free_qdio_queue(card->qdio.in_q); in qeth_core_remove_device()
6408 free_netdev(card->dev); in qeth_core_remove_device()
6409 qeth_core_free_card(card); in qeth_core_remove_device()
6415 struct qeth_card *card = dev_get_drvdata(&gdev->dev); in qeth_core_set_online() local
6419 mutex_lock(&card->discipline_mutex); in qeth_core_set_online()
6420 if (!card->discipline) { in qeth_core_set_online()
6421 def_discipline = IS_IQD(card) ? QETH_DISCIPLINE_LAYER3 : in qeth_core_set_online()
6423 rc = qeth_setup_discipline(card, def_discipline); in qeth_core_set_online()
6428 rc = qeth_set_online(card, card->discipline); in qeth_core_set_online()
6431 mutex_unlock(&card->discipline_mutex); in qeth_core_set_online()
6437 struct qeth_card *card = dev_get_drvdata(&gdev->dev); in qeth_core_set_offline() local
6440 mutex_lock(&card->discipline_mutex); in qeth_core_set_offline()
6441 rc = qeth_set_offline(card, card->discipline, false); in qeth_core_set_offline()
6442 mutex_unlock(&card->discipline_mutex); in qeth_core_set_offline()
6449 struct qeth_card *card = dev_get_drvdata(&gdev->dev); in qeth_core_shutdown() local
6451 qeth_set_allowed_threads(card, 0, 1); in qeth_core_shutdown()
6452 if ((gdev->state == CCWGROUP_ONLINE) && card->info.hwtrap) in qeth_core_shutdown()
6453 qeth_hw_trap(card, QETH_DIAGS_TRAP_DISARM); in qeth_core_shutdown()
6454 qeth_qdio_clear_card(card, 0); in qeth_core_shutdown()
6455 qeth_drain_output_queues(card); in qeth_core_shutdown()
6456 qdio_free(CARD_DDEV(card)); in qeth_core_shutdown()
6499 struct qeth_card *card = dev->ml_priv; in qeth_siocdevprivate() local
6504 rc = qeth_snmp_command(card, data); in qeth_siocdevprivate()
6507 if ((IS_OSD(card) || IS_OSM(card) || IS_OSX(card)) && in qeth_siocdevprivate()
6508 !IS_VM_NIC(card)) in qeth_siocdevprivate()
6512 rc = qeth_query_oat_command(card, data); in qeth_siocdevprivate()
6518 QETH_CARD_TEXT_(card, 2, "ioce%x", rc); in qeth_siocdevprivate()
6525 struct qeth_card *card = dev->ml_priv; in qeth_do_ioctl() local
6546 QETH_CARD_TEXT_(card, 2, "ioce%x", rc); in qeth_do_ioctl()
6551 static int qeth_start_csum_cb(struct qeth_card *card, struct qeth_reply *reply, in qeth_start_csum_cb() argument
6564 static int qeth_set_csum_off(struct qeth_card *card, enum qeth_ipa_funcs cstype, in qeth_set_csum_off() argument
6567 return qeth_send_simple_setassparms_prot(card, cstype, IPA_CMD_ASS_STOP, in qeth_set_csum_off()
6571 static int qeth_set_csum_on(struct qeth_card *card, enum qeth_ipa_funcs cstype, in qeth_set_csum_on() argument
6581 if (IS_LAYER3(card) && prot == QETH_PROT_IPV4 && in qeth_set_csum_on()
6585 iob = qeth_get_setassparms_cmd(card, cstype, IPA_CMD_ASS_START, 0, in qeth_set_csum_on()
6590 rc = qeth_send_ipa_cmd(card, iob, qeth_start_csum_cb, &features); in qeth_set_csum_on()
6595 qeth_set_csum_off(card, cstype, prot); in qeth_set_csum_on()
6599 iob = qeth_get_setassparms_cmd(card, cstype, IPA_CMD_ASS_ENABLE, in qeth_set_csum_on()
6603 qeth_set_csum_off(card, cstype, prot); in qeth_set_csum_on()
6610 rc = qeth_send_ipa_cmd(card, iob, qeth_setassparms_get_caps_cb, &caps); in qeth_set_csum_on()
6612 qeth_set_csum_off(card, cstype, prot); in qeth_set_csum_on()
6618 qeth_set_csum_off(card, cstype, prot); in qeth_set_csum_on()
6622 dev_info(&card->gdev->dev, "HW Checksumming (%sbound IPv%d) enabled\n", in qeth_set_csum_on()
6631 static int qeth_set_ipa_csum(struct qeth_card *card, bool on, int cstype, in qeth_set_ipa_csum() argument
6634 return on ? qeth_set_csum_on(card, cstype, prot, lp2lp) : in qeth_set_ipa_csum()
6635 qeth_set_csum_off(card, cstype, prot); in qeth_set_ipa_csum()
6638 static int qeth_start_tso_cb(struct qeth_card *card, struct qeth_reply *reply, in qeth_start_tso_cb() argument
6652 static int qeth_set_tso_off(struct qeth_card *card, in qeth_set_tso_off() argument
6655 return qeth_send_simple_setassparms_prot(card, IPA_OUTBOUND_TSO, in qeth_set_tso_off()
6659 static int qeth_set_tso_on(struct qeth_card *card, in qeth_set_tso_on() argument
6667 iob = qeth_get_setassparms_cmd(card, IPA_OUTBOUND_TSO, in qeth_set_tso_on()
6672 rc = qeth_send_ipa_cmd(card, iob, qeth_start_tso_cb, &tso_data); in qeth_set_tso_on()
6677 qeth_set_tso_off(card, prot); in qeth_set_tso_on()
6681 iob = qeth_get_setassparms_cmd(card, IPA_OUTBOUND_TSO, in qeth_set_tso_on()
6685 qeth_set_tso_off(card, prot); in qeth_set_tso_on()
6692 rc = qeth_send_ipa_cmd(card, iob, qeth_setassparms_get_caps_cb, &caps); in qeth_set_tso_on()
6694 qeth_set_tso_off(card, prot); in qeth_set_tso_on()
6700 qeth_set_tso_off(card, prot); in qeth_set_tso_on()
6704 dev_info(&card->gdev->dev, "TSOv%u enabled (MSS: %u)\n", prot, in qeth_set_tso_on()
6709 static int qeth_set_ipa_tso(struct qeth_card *card, bool on, in qeth_set_ipa_tso() argument
6712 return on ? qeth_set_tso_on(card, prot) : qeth_set_tso_off(card, prot); in qeth_set_ipa_tso()
6715 static int qeth_set_ipa_rx_csum(struct qeth_card *card, bool on) in qeth_set_ipa_rx_csum() argument
6720 if (qeth_is_supported(card, IPA_INBOUND_CHECKSUM)) in qeth_set_ipa_rx_csum()
6721 rc_ipv4 = qeth_set_ipa_csum(card, on, IPA_INBOUND_CHECKSUM, in qeth_set_ipa_rx_csum()
6723 if (!qeth_is_supported6(card, IPA_INBOUND_CHECKSUM_V6)) in qeth_set_ipa_rx_csum()
6727 rc_ipv6 = qeth_set_ipa_csum(card, on, IPA_INBOUND_CHECKSUM, in qeth_set_ipa_rx_csum()
6744 struct qeth_card *card = dev->ml_priv; in qeth_enable_hw_features() local
6753 if (IS_LAYER2(card) && IS_VM_NIC(card)) { in qeth_enable_hw_features()
6759 dev_warn(&card->gdev->dev, in qeth_enable_hw_features()
6764 static void qeth_check_restricted_features(struct qeth_card *card, in qeth_check_restricted_features() argument
6771 if (!card->info.has_lp2lp_cso_v6) in qeth_check_restricted_features()
6773 if (!card->info.has_lp2lp_cso_v4) in qeth_check_restricted_features()
6777 qeth_flush_local_addrs6(card); in qeth_check_restricted_features()
6779 qeth_flush_local_addrs4(card); in qeth_check_restricted_features()
6784 struct qeth_card *card = dev->ml_priv; in qeth_set_features() local
6788 QETH_CARD_TEXT(card, 2, "setfeat"); in qeth_set_features()
6789 QETH_CARD_HEX(card, 2, &features, sizeof(features)); in qeth_set_features()
6792 rc = qeth_set_ipa_csum(card, features & NETIF_F_IP_CSUM, in qeth_set_features()
6794 &card->info.has_lp2lp_cso_v4); in qeth_set_features()
6799 rc = qeth_set_ipa_csum(card, features & NETIF_F_IPV6_CSUM, in qeth_set_features()
6801 &card->info.has_lp2lp_cso_v6); in qeth_set_features()
6806 rc = qeth_set_ipa_rx_csum(card, features & NETIF_F_RXCSUM); in qeth_set_features()
6811 rc = qeth_set_ipa_tso(card, features & NETIF_F_TSO, in qeth_set_features()
6817 rc = qeth_set_ipa_tso(card, features & NETIF_F_TSO6, in qeth_set_features()
6823 qeth_check_restricted_features(card, dev->features ^ features, in qeth_set_features()
6838 struct qeth_card *card = dev->ml_priv; in qeth_fix_features() local
6840 QETH_CARD_TEXT(card, 2, "fixfeat"); in qeth_fix_features()
6841 if (!qeth_is_supported(card, IPA_OUTBOUND_CHECKSUM)) in qeth_fix_features()
6843 if (!qeth_is_supported6(card, IPA_OUTBOUND_CHECKSUM_V6)) in qeth_fix_features()
6845 if (!qeth_is_supported(card, IPA_INBOUND_CHECKSUM) && in qeth_fix_features()
6846 !qeth_is_supported6(card, IPA_INBOUND_CHECKSUM_V6)) in qeth_fix_features()
6848 if (!qeth_is_supported(card, IPA_OUTBOUND_TSO)) in qeth_fix_features()
6850 if (!qeth_is_supported6(card, IPA_OUTBOUND_TSO)) in qeth_fix_features()
6853 QETH_CARD_HEX(card, 2, &features, sizeof(features)); in qeth_fix_features()
6862 struct qeth_card *card = dev->ml_priv; in qeth_features_check() local
6866 READ_ONCE(card->options.isolation) != ISOLATION_MODE_FWD) { in qeth_features_check()
6874 if (!card->info.has_lp2lp_cso_v4) in qeth_features_check()
6877 if (restricted && qeth_next_hop_is_local_v4(card, skb)) in qeth_features_check()
6881 if (!card->info.has_lp2lp_cso_v6) in qeth_features_check()
6884 if (restricted && qeth_next_hop_is_local_v6(card, skb)) in qeth_features_check()
6916 struct qeth_card *card = dev->ml_priv; in qeth_get_stats64() local
6920 QETH_CARD_TEXT(card, 5, "getstat"); in qeth_get_stats64()
6922 stats->rx_packets = card->stats.rx_packets; in qeth_get_stats64()
6923 stats->rx_bytes = card->stats.rx_bytes; in qeth_get_stats64()
6924 stats->rx_errors = card->stats.rx_length_errors + in qeth_get_stats64()
6925 card->stats.rx_frame_errors + in qeth_get_stats64()
6926 card->stats.rx_fifo_errors; in qeth_get_stats64()
6927 stats->rx_dropped = card->stats.rx_dropped_nomem + in qeth_get_stats64()
6928 card->stats.rx_dropped_notsupp + in qeth_get_stats64()
6929 card->stats.rx_dropped_runt; in qeth_get_stats64()
6930 stats->multicast = card->stats.rx_multicast; in qeth_get_stats64()
6931 stats->rx_length_errors = card->stats.rx_length_errors; in qeth_get_stats64()
6932 stats->rx_frame_errors = card->stats.rx_frame_errors; in qeth_get_stats64()
6933 stats->rx_fifo_errors = card->stats.rx_fifo_errors; in qeth_get_stats64()
6935 for (i = 0; i < card->qdio.no_out_queues; i++) { in qeth_get_stats64()
6936 queue = card->qdio.out_qs[i]; in qeth_get_stats64()
6970 int qeth_set_real_num_tx_queues(struct qeth_card *card, unsigned int count) in qeth_set_real_num_tx_queues() argument
6972 struct net_device *dev = card->dev; in qeth_set_real_num_tx_queues()
6976 if (IS_IQD(card)) in qeth_set_real_num_tx_queues()
6981 if (rc && IS_IQD(card)) in qeth_set_real_num_tx_queues()
7006 struct qeth_card *card = dev->ml_priv; in qeth_osa_select_queue() local
7008 if (qeth_uses_tx_prio_queueing(card)) in qeth_osa_select_queue()
7009 return qeth_get_priority_queue(card, skb); in qeth_osa_select_queue()
7017 struct qeth_card *card = dev->ml_priv; in qeth_open() local
7021 QETH_CARD_TEXT(card, 4, "qethopen"); in qeth_open()
7023 card->data.state = CH_STATE_UP; in qeth_open()
7027 qeth_for_each_output_queue(card, queue, i) { in qeth_open()
7033 napi_enable(&card->napi); in qeth_open()
7034 napi_schedule(&card->napi); in qeth_open()
7044 struct qeth_card *card = dev->ml_priv; in qeth_stop() local
7048 QETH_CARD_TEXT(card, 4, "qethstop"); in qeth_stop()
7050 napi_disable(&card->napi); in qeth_stop()
7051 cancel_delayed_work_sync(&card->buffer_reclaim_work); in qeth_stop()
7052 qdio_stop_irq(CARD_DDEV(card)); in qeth_stop()
7055 qeth_for_each_output_queue(card, queue, i) in qeth_stop()
7061 qeth_for_each_output_queue(card, queue, i) { in qeth_stop()