Lines Matching full: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 void qeth_free_cq(struct qeth_card *card) in qeth_free_cq() argument
369 if (card->qdio.c_q) { in qeth_free_cq()
370 qeth_free_qdio_queue(card->qdio.c_q); in qeth_free_cq()
371 card->qdio.c_q = NULL; in qeth_free_cq()
375 static int qeth_alloc_cq(struct qeth_card *card) in qeth_alloc_cq() argument
377 if (card->options.cq == QETH_CQ_ENABLED) { in qeth_alloc_cq()
378 QETH_CARD_TEXT(card, 2, "cqon"); in qeth_alloc_cq()
379 if (!card->qdio.c_q) { in qeth_alloc_cq()
380 card->qdio.c_q = qeth_alloc_qdio_queue(); in qeth_alloc_cq()
381 if (!card->qdio.c_q) { in qeth_alloc_cq()
382 dev_err(&card->gdev->dev, in qeth_alloc_cq()
388 QETH_CARD_TEXT(card, 2, "nocq"); in qeth_alloc_cq()
389 qeth_free_cq(card); in qeth_alloc_cq()
435 static int __qeth_issue_next_read(struct qeth_card *card) in __qeth_issue_next_read() argument
437 struct qeth_cmd_buffer *iob = card->read_cmd; in __qeth_issue_next_read()
442 QETH_CARD_TEXT(card, 5, "issnxrd"); in __qeth_issue_next_read()
452 QETH_CARD_TEXT(card, 6, "noirqpnd"); in __qeth_issue_next_read()
458 rc, CARD_DEVID(card)); in __qeth_issue_next_read()
459 qeth_unlock_channel(card, channel); in __qeth_issue_next_read()
461 card->read_or_write_problem = 1; in __qeth_issue_next_read()
462 qeth_schedule_recovery(card); in __qeth_issue_next_read()
467 static int qeth_issue_next_read(struct qeth_card *card) in qeth_issue_next_read() argument
471 spin_lock_irq(get_ccwdev_lock(CARD_RDEV(card))); in qeth_issue_next_read()
472 ret = __qeth_issue_next_read(card); in qeth_issue_next_read()
473 spin_unlock_irq(get_ccwdev_lock(CARD_RDEV(card))); in qeth_issue_next_read()
478 static void qeth_enqueue_cmd(struct qeth_card *card, in qeth_enqueue_cmd() argument
481 spin_lock_irq(&card->lock); in qeth_enqueue_cmd()
482 list_add_tail(&iob->list_entry, &card->cmd_waiter_list); in qeth_enqueue_cmd()
483 spin_unlock_irq(&card->lock); in qeth_enqueue_cmd()
486 static void qeth_dequeue_cmd(struct qeth_card *card, in qeth_dequeue_cmd() argument
489 spin_lock_irq(&card->lock); in qeth_dequeue_cmd()
491 spin_unlock_irq(&card->lock); in qeth_dequeue_cmd()
500 static void qeth_flush_local_addrs4(struct qeth_card *card) in qeth_flush_local_addrs4() argument
506 spin_lock_irq(&card->local_addrs4_lock); in qeth_flush_local_addrs4()
507 hash_for_each_safe(card->local_addrs4, i, tmp, addr, hnode) { in qeth_flush_local_addrs4()
511 spin_unlock_irq(&card->local_addrs4_lock); in qeth_flush_local_addrs4()
514 static void qeth_flush_local_addrs6(struct qeth_card *card) in qeth_flush_local_addrs6() argument
520 spin_lock_irq(&card->local_addrs6_lock); in qeth_flush_local_addrs6()
521 hash_for_each_safe(card->local_addrs6, i, tmp, addr, hnode) { in qeth_flush_local_addrs6()
525 spin_unlock_irq(&card->local_addrs6_lock); in qeth_flush_local_addrs6()
528 static void qeth_flush_local_addrs(struct qeth_card *card) in qeth_flush_local_addrs() argument
530 qeth_flush_local_addrs4(card); in qeth_flush_local_addrs()
531 qeth_flush_local_addrs6(card); in qeth_flush_local_addrs()
534 static void qeth_add_local_addrs4(struct qeth_card *card, in qeth_add_local_addrs4() argument
541 dev_err_ratelimited(&card->gdev->dev, in qeth_add_local_addrs4()
547 spin_lock(&card->local_addrs4_lock); in qeth_add_local_addrs4()
553 hash_for_each_possible(card->local_addrs4, addr, hnode, key) { in qeth_add_local_addrs4()
565 dev_err(&card->gdev->dev, in qeth_add_local_addrs4()
572 hash_add_rcu(card->local_addrs4, &addr->hnode, key); in qeth_add_local_addrs4()
574 spin_unlock(&card->local_addrs4_lock); in qeth_add_local_addrs4()
577 static void qeth_add_local_addrs6(struct qeth_card *card, in qeth_add_local_addrs6() argument
584 dev_err_ratelimited(&card->gdev->dev, in qeth_add_local_addrs6()
590 spin_lock(&card->local_addrs6_lock); in qeth_add_local_addrs6()
596 hash_for_each_possible(card->local_addrs6, addr, hnode, key) { in qeth_add_local_addrs6()
608 dev_err(&card->gdev->dev, in qeth_add_local_addrs6()
615 hash_add_rcu(card->local_addrs6, &addr->hnode, key); in qeth_add_local_addrs6()
617 spin_unlock(&card->local_addrs6_lock); in qeth_add_local_addrs6()
620 static void qeth_del_local_addrs4(struct qeth_card *card, in qeth_del_local_addrs4() argument
627 dev_err_ratelimited(&card->gdev->dev, in qeth_del_local_addrs4()
633 spin_lock(&card->local_addrs4_lock); in qeth_del_local_addrs4()
639 hash_for_each_possible(card->local_addrs4, tmp, hnode, key) { in qeth_del_local_addrs4()
647 spin_unlock(&card->local_addrs4_lock); in qeth_del_local_addrs4()
650 static void qeth_del_local_addrs6(struct qeth_card *card, in qeth_del_local_addrs6() argument
657 dev_err_ratelimited(&card->gdev->dev, in qeth_del_local_addrs6()
663 spin_lock(&card->local_addrs6_lock); in qeth_del_local_addrs6()
669 hash_for_each_possible(card->local_addrs6, tmp, hnode, key) { in qeth_del_local_addrs6()
677 spin_unlock(&card->local_addrs6_lock); in qeth_del_local_addrs6()
680 static bool qeth_next_hop_is_local_v4(struct qeth_card *card, in qeth_next_hop_is_local_v4() argument
688 if (hash_empty(card->local_addrs4)) in qeth_next_hop_is_local_v4()
696 hash_for_each_possible_rcu(card->local_addrs4, tmp, hnode, key) { in qeth_next_hop_is_local_v4()
707 static bool qeth_next_hop_is_local_v6(struct qeth_card *card, in qeth_next_hop_is_local_v6() argument
715 if (hash_empty(card->local_addrs6)) in qeth_next_hop_is_local_v6()
723 hash_for_each_possible_rcu(card->local_addrs6, tmp, hnode, key) { in qeth_next_hop_is_local_v6()
736 struct qeth_card *card = m->private; in qeth_debugfs_local_addr_show() local
741 hash_for_each_rcu(card->local_addrs4, i, tmp, hnode) in qeth_debugfs_local_addr_show()
743 hash_for_each_rcu(card->local_addrs6, i, tmp, hnode) in qeth_debugfs_local_addr_show()
753 struct qeth_card *card) in qeth_issue_ipa_msg() argument
762 ipa_name, com, CARD_DEVID(card), rc, in qeth_issue_ipa_msg()
766 ipa_name, com, CARD_DEVID(card)); in qeth_issue_ipa_msg()
769 static void qeth_default_link_info(struct qeth_card *card) in qeth_default_link_info() argument
771 struct qeth_link_info *link_info = &card->info.link_info; in qeth_default_link_info()
773 QETH_CARD_TEXT(card, 2, "dftlinfo"); in qeth_default_link_info()
776 if (IS_IQD(card) || IS_VM_NIC(card)) { in qeth_default_link_info()
781 switch (card->info.link_type) { in qeth_default_link_info()
801 dev_info(&card->gdev->dev, in qeth_default_link_info()
803 card->info.link_type); in qeth_default_link_info()
812 static struct qeth_ipa_cmd *qeth_check_ipa_data(struct qeth_card *card, in qeth_check_ipa_data() argument
815 QETH_CARD_TEXT(card, 5, "chkipad"); in qeth_check_ipa_data()
819 qeth_issue_ipa_msg(cmd, cmd->hdr.return_code, card); in qeth_check_ipa_data()
827 dev_err(&card->gdev->dev, in qeth_check_ipa_data()
829 netdev_name(card->dev)); in qeth_check_ipa_data()
831 qeth_schedule_recovery(card); in qeth_check_ipa_data()
834 dev_warn(&card->gdev->dev, in qeth_check_ipa_data()
836 netdev_name(card->dev), card->info.chpid); in qeth_check_ipa_data()
837 qeth_issue_ipa_msg(cmd, cmd->hdr.return_code, card); in qeth_check_ipa_data()
838 netif_carrier_off(card->dev); in qeth_check_ipa_data()
839 qeth_default_link_info(card); in qeth_check_ipa_data()
843 dev_info(&card->gdev->dev, in qeth_check_ipa_data()
845 netdev_name(card->dev), card->info.chpid); in qeth_check_ipa_data()
846 if (card->info.hwtrap) in qeth_check_ipa_data()
847 card->info.hwtrap = 2; in qeth_check_ipa_data()
848 qeth_schedule_recovery(card); in qeth_check_ipa_data()
853 if (card->discipline->control_event_handler(card, cmd)) in qeth_check_ipa_data()
858 qeth_add_local_addrs4(card, &cmd->data.local_addrs4); in qeth_check_ipa_data()
860 qeth_add_local_addrs6(card, &cmd->data.local_addrs6); in qeth_check_ipa_data()
862 QETH_CARD_TEXT(card, 3, "irla"); in qeth_check_ipa_data()
866 qeth_del_local_addrs4(card, &cmd->data.local_addrs4); in qeth_check_ipa_data()
868 qeth_del_local_addrs6(card, &cmd->data.local_addrs6); in qeth_check_ipa_data()
870 QETH_CARD_TEXT(card, 3, "urla"); in qeth_check_ipa_data()
878 static void qeth_clear_ipacmd_list(struct qeth_card *card) in qeth_clear_ipacmd_list() argument
883 QETH_CARD_TEXT(card, 4, "clipalst"); in qeth_clear_ipacmd_list()
885 spin_lock_irqsave(&card->lock, flags); in qeth_clear_ipacmd_list()
886 list_for_each_entry(iob, &card->cmd_waiter_list, list_entry) in qeth_clear_ipacmd_list()
888 spin_unlock_irqrestore(&card->lock, flags); in qeth_clear_ipacmd_list()
891 static int qeth_check_idx_response(struct qeth_card *card, in qeth_check_idx_response() argument
898 QETH_CARD_TEXT(card, 2, "ckidxres"); in qeth_check_idx_response()
899 QETH_CARD_TEXT(card, 2, " idxterm"); in qeth_check_idx_response()
900 QETH_CARD_TEXT_(card, 2, "rc%x", buffer[4]); in qeth_check_idx_response()
903 dev_err(&card->gdev->dev, in qeth_check_idx_response()
912 static void qeth_release_buffer_cb(struct qeth_card *card, in qeth_release_buffer_cb() argument
954 static void qeth_issue_next_read_cb(struct qeth_card *card, in qeth_issue_next_read_cb() argument
965 QETH_CARD_TEXT(card, 4, "sndctlcb"); in qeth_issue_next_read_cb()
966 rc = qeth_check_idx_response(card, iob->data); in qeth_issue_next_read_cb()
971 qeth_schedule_recovery(card); in qeth_issue_next_read_cb()
974 qeth_clear_ipacmd_list(card); in qeth_issue_next_read_cb()
980 cmd = qeth_check_ipa_data(card, cmd); in qeth_issue_next_read_cb()
986 spin_lock_irqsave(&card->lock, flags); in qeth_issue_next_read_cb()
987 list_for_each_entry(tmp, &card->cmd_waiter_list, list_entry) { in qeth_issue_next_read_cb()
995 spin_unlock_irqrestore(&card->lock, flags); in qeth_issue_next_read_cb()
1011 rc = reply->callback(card, reply, cmd ? (unsigned long)cmd : in qeth_issue_next_read_cb()
1020 memcpy(&card->seqno.pdu_hdr_ack, in qeth_issue_next_read_cb()
1023 __qeth_issue_next_read(card); in qeth_issue_next_read_cb()
1028 static int qeth_set_thread_start_bit(struct qeth_card *card, in qeth_set_thread_start_bit() argument
1034 spin_lock_irqsave(&card->thread_mask_lock, flags); in qeth_set_thread_start_bit()
1035 if (!(card->thread_allowed_mask & thread)) in qeth_set_thread_start_bit()
1037 else if (card->thread_start_mask & thread) in qeth_set_thread_start_bit()
1040 card->thread_start_mask |= thread; in qeth_set_thread_start_bit()
1041 spin_unlock_irqrestore(&card->thread_mask_lock, flags); in qeth_set_thread_start_bit()
1046 static void qeth_clear_thread_start_bit(struct qeth_card *card, in qeth_clear_thread_start_bit() argument
1051 spin_lock_irqsave(&card->thread_mask_lock, flags); in qeth_clear_thread_start_bit()
1052 card->thread_start_mask &= ~thread; in qeth_clear_thread_start_bit()
1053 spin_unlock_irqrestore(&card->thread_mask_lock, flags); in qeth_clear_thread_start_bit()
1054 wake_up(&card->wait_q); in qeth_clear_thread_start_bit()
1057 static void qeth_clear_thread_running_bit(struct qeth_card *card, in qeth_clear_thread_running_bit() argument
1062 spin_lock_irqsave(&card->thread_mask_lock, flags); in qeth_clear_thread_running_bit()
1063 card->thread_running_mask &= ~thread; in qeth_clear_thread_running_bit()
1064 spin_unlock_irqrestore(&card->thread_mask_lock, flags); in qeth_clear_thread_running_bit()
1065 wake_up_all(&card->wait_q); in qeth_clear_thread_running_bit()
1068 static int __qeth_do_run_thread(struct qeth_card *card, unsigned long thread) in __qeth_do_run_thread() argument
1073 spin_lock_irqsave(&card->thread_mask_lock, flags); in __qeth_do_run_thread()
1074 if (card->thread_start_mask & thread) { in __qeth_do_run_thread()
1075 if ((card->thread_allowed_mask & thread) && in __qeth_do_run_thread()
1076 !(card->thread_running_mask & thread)) { in __qeth_do_run_thread()
1078 card->thread_start_mask &= ~thread; in __qeth_do_run_thread()
1079 card->thread_running_mask |= thread; in __qeth_do_run_thread()
1083 spin_unlock_irqrestore(&card->thread_mask_lock, flags); in __qeth_do_run_thread()
1087 static int qeth_do_run_thread(struct qeth_card *card, unsigned long thread) in qeth_do_run_thread() argument
1091 wait_event(card->wait_q, in qeth_do_run_thread()
1092 (rc = __qeth_do_run_thread(card, thread)) >= 0); in qeth_do_run_thread()
1096 int qeth_schedule_recovery(struct qeth_card *card) in qeth_schedule_recovery() argument
1100 QETH_CARD_TEXT(card, 2, "startrec"); in qeth_schedule_recovery()
1102 rc = qeth_set_thread_start_bit(card, QETH_RECOVER_THREAD); in qeth_schedule_recovery()
1104 schedule_work(&card->kernel_thread_starter); in qeth_schedule_recovery()
1109 static int qeth_get_problem(struct qeth_card *card, struct ccw_device *cdev, in qeth_get_problem() argument
1122 QETH_CARD_TEXT(card, 2, "CGENCHK"); in qeth_get_problem()
1135 QETH_CARD_TEXT(card, 2, "REVIND"); in qeth_get_problem()
1140 QETH_CARD_TEXT(card, 2, "CMDREJi"); in qeth_get_problem()
1144 QETH_CARD_TEXT(card, 2, "AFFE"); in qeth_get_problem()
1148 QETH_CARD_TEXT(card, 2, "ZEROSEN"); in qeth_get_problem()
1151 QETH_CARD_TEXT(card, 2, "DGENCHK"); in qeth_get_problem()
1157 static int qeth_check_irb_error(struct qeth_card *card, struct ccw_device *cdev, in qeth_check_irb_error() argument
1167 QETH_CARD_TEXT(card, 2, "ckirberr"); in qeth_check_irb_error()
1168 QETH_CARD_TEXT_(card, 2, " rc%d", -EIO); in qeth_check_irb_error()
1173 QETH_CARD_TEXT(card, 2, "ckirberr"); in qeth_check_irb_error()
1174 QETH_CARD_TEXT_(card, 2, " rc%d", -ETIMEDOUT); in qeth_check_irb_error()
1179 QETH_CARD_TEXT(card, 2, "ckirberr"); in qeth_check_irb_error()
1180 QETH_CARD_TEXT(card, 2, " rc???"); in qeth_check_irb_error()
1207 struct qeth_card *card; in qeth_irq() local
1211 card = dev_get_drvdata(&gdev->dev); in qeth_irq()
1213 QETH_CARD_TEXT(card, 5, "irq"); in qeth_irq()
1215 if (card->read.ccwdev == cdev) { in qeth_irq()
1216 channel = &card->read; in qeth_irq()
1217 QETH_CARD_TEXT(card, 5, "read"); in qeth_irq()
1218 } else if (card->write.ccwdev == cdev) { in qeth_irq()
1219 channel = &card->write; in qeth_irq()
1220 QETH_CARD_TEXT(card, 5, "write"); in qeth_irq()
1222 channel = &card->data; in qeth_irq()
1223 QETH_CARD_TEXT(card, 5, "data"); in qeth_irq()
1227 QETH_CARD_TEXT(card, 5, "irqunsol"); in qeth_irq()
1229 QETH_CARD_TEXT(card, 5, "irqunexp"); in qeth_irq()
1240 rc = qeth_check_irb_error(card, cdev, irb); in qeth_irq()
1243 qeth_unlock_channel(card, channel); in qeth_irq()
1251 wake_up(&card->wait_q); in qeth_irq()
1256 wake_up(&card->wait_q); in qeth_irq()
1284 rc = qeth_get_problem(card, cdev, irb); in qeth_irq()
1286 card->read_or_write_problem = 1; in qeth_irq()
1287 qeth_unlock_channel(card, channel); in qeth_irq()
1290 qeth_clear_ipacmd_list(card); in qeth_irq()
1291 qeth_schedule_recovery(card); in qeth_irq()
1300 QETH_CARD_TEXT(card, 2, "irqcc1"); in qeth_irq()
1306 CARD_DEVID(card), rc); in qeth_irq()
1307 QETH_CARD_TEXT_(card, 2, " err%d", rc); in qeth_irq()
1308 qeth_unlock_channel(card, channel); in qeth_irq()
1314 qeth_unlock_channel(card, channel); in qeth_irq()
1323 iob->callback(card, iob, in qeth_irq()
1337 QETH_CARD_TEXT_(q->card, 5, "skbn%d", notification); in qeth_notify_skbs()
1338 QETH_CARD_TEXT_(q->card, 5, "%lx", (long) skb); in qeth_notify_skbs()
1419 static void qeth_tx_complete_pending_bufs(struct qeth_card *card, in qeth_tx_complete_pending_bufs() argument
1433 QETH_CARD_TEXT(card, 5, "fp"); in qeth_tx_complete_pending_bufs()
1434 QETH_CARD_TEXT_(card, 5, "%lx", (long) buf); in qeth_tx_complete_pending_bufs()
1461 qeth_tx_complete_pending_bufs(q->card, q, true, 0); in qeth_drain_output_queue()
1475 static void qeth_drain_output_queues(struct qeth_card *card) in qeth_drain_output_queues() argument
1479 QETH_CARD_TEXT(card, 2, "clearqdbf"); in qeth_drain_output_queues()
1481 for (i = 0; i < card->qdio.no_out_queues; ++i) { in qeth_drain_output_queues()
1482 if (card->qdio.out_qs[i]) in qeth_drain_output_queues()
1483 qeth_drain_output_queue(card->qdio.out_qs[i], false); in qeth_drain_output_queues()
1487 static void qeth_osa_set_output_queues(struct qeth_card *card, bool single) in qeth_osa_set_output_queues() argument
1489 unsigned int max = single ? 1 : card->dev->num_tx_queues; in qeth_osa_set_output_queues()
1491 if (card->qdio.no_out_queues == max) in qeth_osa_set_output_queues()
1494 if (atomic_read(&card->qdio.state) != QETH_QDIO_UNINITIALIZED) in qeth_osa_set_output_queues()
1495 qeth_free_qdio_queues(card); in qeth_osa_set_output_queues()
1497 if (max == 1 && card->qdio.do_prio_queueing != QETH_PRIOQ_DEFAULT) in qeth_osa_set_output_queues()
1498 dev_info(&card->gdev->dev, "Priority Queueing not supported\n"); in qeth_osa_set_output_queues()
1500 card->qdio.no_out_queues = max; in qeth_osa_set_output_queues()
1503 static int qeth_update_from_chp_desc(struct qeth_card *card) in qeth_update_from_chp_desc() argument
1508 QETH_CARD_TEXT(card, 2, "chp_desc"); in qeth_update_from_chp_desc()
1510 ccwdev = card->data.ccwdev; in qeth_update_from_chp_desc()
1515 card->info.func_level = 0x4100 + chp_dsc->desc; in qeth_update_from_chp_desc()
1517 if (IS_OSD(card) || IS_OSX(card)) in qeth_update_from_chp_desc()
1519 qeth_osa_set_output_queues(card, chp_dsc->chpp & 0x02); in qeth_update_from_chp_desc()
1522 QETH_CARD_TEXT_(card, 2, "nr:%x", card->qdio.no_out_queues); in qeth_update_from_chp_desc()
1523 QETH_CARD_TEXT_(card, 2, "lvl:%02x", card->info.func_level); in qeth_update_from_chp_desc()
1527 static void qeth_init_qdio_info(struct qeth_card *card) in qeth_init_qdio_info() argument
1529 QETH_CARD_TEXT(card, 4, "intqdinf"); in qeth_init_qdio_info()
1530 atomic_set(&card->qdio.state, QETH_QDIO_UNINITIALIZED); in qeth_init_qdio_info()
1531 card->qdio.do_prio_queueing = QETH_PRIOQ_DEFAULT; in qeth_init_qdio_info()
1532 card->qdio.default_out_queue = QETH_DEFAULT_QUEUE; in qeth_init_qdio_info()
1535 card->qdio.in_buf_size = QETH_IN_BUF_SIZE_DEFAULT; in qeth_init_qdio_info()
1536 if (IS_IQD(card)) in qeth_init_qdio_info()
1537 card->qdio.init_pool.buf_count = QETH_IN_BUF_COUNT_HSDEFAULT; in qeth_init_qdio_info()
1539 card->qdio.init_pool.buf_count = QETH_IN_BUF_COUNT_DEFAULT; in qeth_init_qdio_info()
1540 card->qdio.in_buf_pool.buf_count = card->qdio.init_pool.buf_count; in qeth_init_qdio_info()
1541 INIT_LIST_HEAD(&card->qdio.in_buf_pool.entry_list); in qeth_init_qdio_info()
1542 INIT_LIST_HEAD(&card->qdio.init_pool.entry_list); in qeth_init_qdio_info()
1545 static void qeth_set_initial_options(struct qeth_card *card) in qeth_set_initial_options() argument
1547 card->options.route4.type = NO_ROUTER; in qeth_set_initial_options()
1548 card->options.route6.type = NO_ROUTER; in qeth_set_initial_options()
1549 card->options.isolation = ISOLATION_MODE_NONE; in qeth_set_initial_options()
1550 card->options.cq = QETH_CQ_DISABLED; in qeth_set_initial_options()
1551 card->options.layer = QETH_DISCIPLINE_UNDETERMINED; in qeth_set_initial_options()
1554 static int qeth_do_start_thread(struct qeth_card *card, unsigned long thread) in qeth_do_start_thread() argument
1559 spin_lock_irqsave(&card->thread_mask_lock, flags); in qeth_do_start_thread()
1560 QETH_CARD_TEXT_(card, 4, " %02x%02x%02x", in qeth_do_start_thread()
1561 (u8) card->thread_start_mask, in qeth_do_start_thread()
1562 (u8) card->thread_allowed_mask, in qeth_do_start_thread()
1563 (u8) card->thread_running_mask); in qeth_do_start_thread()
1564 rc = (card->thread_start_mask & thread); in qeth_do_start_thread()
1565 spin_unlock_irqrestore(&card->thread_mask_lock, flags); in qeth_do_start_thread()
1573 struct qeth_card *card = container_of(work, struct qeth_card, in qeth_start_kernel_thread() local
1575 QETH_CARD_TEXT(card, 2, "strthrd"); in qeth_start_kernel_thread()
1577 if (card->read.state != CH_STATE_UP && in qeth_start_kernel_thread()
1578 card->write.state != CH_STATE_UP) in qeth_start_kernel_thread()
1580 if (qeth_do_start_thread(card, QETH_RECOVER_THREAD)) { in qeth_start_kernel_thread()
1581 ts = kthread_run(qeth_do_reset, card, "qeth_recover"); in qeth_start_kernel_thread()
1583 qeth_clear_thread_start_bit(card, QETH_RECOVER_THREAD); in qeth_start_kernel_thread()
1584 qeth_clear_thread_running_bit(card, in qeth_start_kernel_thread()
1591 static void qeth_setup_card(struct qeth_card *card) in qeth_setup_card() argument
1593 QETH_CARD_TEXT(card, 2, "setupcrd"); in qeth_setup_card()
1595 card->info.type = CARD_RDEV(card)->id.driver_info; in qeth_setup_card()
1596 card->state = CARD_STATE_DOWN; in qeth_setup_card()
1597 spin_lock_init(&card->lock); in qeth_setup_card()
1598 spin_lock_init(&card->thread_mask_lock); in qeth_setup_card()
1599 mutex_init(&card->conf_mutex); in qeth_setup_card()
1600 mutex_init(&card->discipline_mutex); in qeth_setup_card()
1601 INIT_WORK(&card->kernel_thread_starter, qeth_start_kernel_thread); in qeth_setup_card()
1602 INIT_LIST_HEAD(&card->cmd_waiter_list); in qeth_setup_card()
1603 init_waitqueue_head(&card->wait_q); in qeth_setup_card()
1604 qeth_set_initial_options(card); in qeth_setup_card()
1606 INIT_LIST_HEAD(&card->ipato.entries); in qeth_setup_card()
1607 qeth_init_qdio_info(card); in qeth_setup_card()
1608 INIT_DELAYED_WORK(&card->buffer_reclaim_work, qeth_buffer_reclaim_work); in qeth_setup_card()
1609 hash_init(card->rx_mode_addrs); in qeth_setup_card()
1610 hash_init(card->local_addrs4); in qeth_setup_card()
1611 hash_init(card->local_addrs6); in qeth_setup_card()
1612 spin_lock_init(&card->local_addrs4_lock); in qeth_setup_card()
1613 spin_lock_init(&card->local_addrs6_lock); in qeth_setup_card()
1618 struct qeth_card *card = container_of(slr, struct qeth_card, in qeth_core_sl_print() local
1620 if (card->info.mcl_level[0]) in qeth_core_sl_print()
1622 CARD_BUS_ID(card), card->info.mcl_level); in qeth_core_sl_print()
1627 struct qeth_card *card; in qeth_alloc_card() local
1630 card = kzalloc(sizeof(*card), GFP_KERNEL); in qeth_alloc_card()
1631 if (!card) in qeth_alloc_card()
1633 QETH_DBF_HEX(SETUP, 2, &card, sizeof(void *)); in qeth_alloc_card()
1635 card->gdev = gdev; in qeth_alloc_card()
1636 dev_set_drvdata(&gdev->dev, card); in qeth_alloc_card()
1637 CARD_RDEV(card) = gdev->cdev[0]; in qeth_alloc_card()
1638 CARD_WDEV(card) = gdev->cdev[1]; in qeth_alloc_card()
1639 CARD_DDEV(card) = gdev->cdev[2]; in qeth_alloc_card()
1641 card->event_wq = alloc_ordered_workqueue("%s_event", 0, in qeth_alloc_card()
1643 if (!card->event_wq) in qeth_alloc_card()
1646 card->read_cmd = qeth_alloc_cmd(&card->read, QETH_BUFSIZE, 1, 0); in qeth_alloc_card()
1647 if (!card->read_cmd) in qeth_alloc_card()
1650 card->debugfs = debugfs_create_dir(dev_name(&gdev->dev), in qeth_alloc_card()
1652 debugfs_create_file("local_addrs", 0400, card->debugfs, card, in qeth_alloc_card()
1655 card->qeth_service_level.seq_print = qeth_core_sl_print; in qeth_alloc_card()
1656 register_service_level(&card->qeth_service_level); in qeth_alloc_card()
1657 return card; in qeth_alloc_card()
1660 destroy_workqueue(card->event_wq); in qeth_alloc_card()
1663 kfree(card); in qeth_alloc_card()
1668 static int qeth_clear_channel(struct qeth_card *card, in qeth_clear_channel() argument
1673 QETH_CARD_TEXT(card, 3, "clearch"); in qeth_clear_channel()
1680 rc = wait_event_interruptible_timeout(card->wait_q, in qeth_clear_channel()
1690 static int qeth_halt_channel(struct qeth_card *card, in qeth_halt_channel() argument
1695 QETH_CARD_TEXT(card, 3, "haltch"); in qeth_halt_channel()
1702 rc = wait_event_interruptible_timeout(card->wait_q, in qeth_halt_channel()
1754 static int qeth_halt_channels(struct qeth_card *card) in qeth_halt_channels() argument
1758 QETH_CARD_TEXT(card, 3, "haltchs"); in qeth_halt_channels()
1759 rc1 = qeth_halt_channel(card, &card->read); in qeth_halt_channels()
1760 rc2 = qeth_halt_channel(card, &card->write); in qeth_halt_channels()
1761 rc3 = qeth_halt_channel(card, &card->data); in qeth_halt_channels()
1769 static int qeth_clear_channels(struct qeth_card *card) in qeth_clear_channels() argument
1773 QETH_CARD_TEXT(card, 3, "clearchs"); in qeth_clear_channels()
1774 rc1 = qeth_clear_channel(card, &card->read); in qeth_clear_channels()
1775 rc2 = qeth_clear_channel(card, &card->write); in qeth_clear_channels()
1776 rc3 = qeth_clear_channel(card, &card->data); in qeth_clear_channels()
1784 static int qeth_clear_halt_card(struct qeth_card *card, int halt) in qeth_clear_halt_card() argument
1788 QETH_CARD_TEXT(card, 3, "clhacrd"); in qeth_clear_halt_card()
1791 rc = qeth_halt_channels(card); in qeth_clear_halt_card()
1794 return qeth_clear_channels(card); in qeth_clear_halt_card()
1797 static int qeth_qdio_clear_card(struct qeth_card *card, int use_halt) in qeth_qdio_clear_card() argument
1801 QETH_CARD_TEXT(card, 3, "qdioclr"); in qeth_qdio_clear_card()
1802 switch (atomic_cmpxchg(&card->qdio.state, QETH_QDIO_ESTABLISHED, in qeth_qdio_clear_card()
1805 if (IS_IQD(card)) in qeth_qdio_clear_card()
1806 rc = qdio_shutdown(CARD_DDEV(card), in qeth_qdio_clear_card()
1809 rc = qdio_shutdown(CARD_DDEV(card), in qeth_qdio_clear_card()
1812 QETH_CARD_TEXT_(card, 3, "1err%d", rc); in qeth_qdio_clear_card()
1813 atomic_set(&card->qdio.state, QETH_QDIO_ALLOCATED); in qeth_qdio_clear_card()
1820 rc = qeth_clear_halt_card(card, use_halt); in qeth_qdio_clear_card()
1822 QETH_CARD_TEXT_(card, 3, "2err%d", rc); in qeth_qdio_clear_card()
1826 static enum qeth_discipline_id qeth_vm_detect_layer(struct qeth_card *card) in qeth_vm_detect_layer() argument
1835 QETH_CARD_TEXT(card, 2, "vmlayer"); in qeth_vm_detect_layer()
1848 ccw_device_get_id(CARD_RDEV(card), &id); in qeth_vm_detect_layer()
1878 QETH_CARD_TEXT_(card, 2, "err%x", rc); in qeth_vm_detect_layer()
1883 static enum qeth_discipline_id qeth_enforce_discipline(struct qeth_card *card) in qeth_enforce_discipline() argument
1887 if (IS_OSM(card)) in qeth_enforce_discipline()
1889 else if (IS_VM_NIC(card)) in qeth_enforce_discipline()
1890 disc = IS_IQD(card) ? QETH_DISCIPLINE_LAYER3 : in qeth_enforce_discipline()
1891 qeth_vm_detect_layer(card); in qeth_enforce_discipline()
1895 QETH_CARD_TEXT(card, 3, "force l2"); in qeth_enforce_discipline()
1898 QETH_CARD_TEXT(card, 3, "force l3"); in qeth_enforce_discipline()
1901 QETH_CARD_TEXT(card, 3, "force no"); in qeth_enforce_discipline()
1907 static void qeth_set_blkt_defaults(struct qeth_card *card) in qeth_set_blkt_defaults() argument
1909 QETH_CARD_TEXT(card, 2, "cfgblkt"); in qeth_set_blkt_defaults()
1911 if (card->info.use_v1_blkt) { in qeth_set_blkt_defaults()
1912 card->info.blkt.time_total = 0; in qeth_set_blkt_defaults()
1913 card->info.blkt.inter_packet = 0; in qeth_set_blkt_defaults()
1914 card->info.blkt.inter_packet_jumbo = 0; in qeth_set_blkt_defaults()
1916 card->info.blkt.time_total = 250; in qeth_set_blkt_defaults()
1917 card->info.blkt.inter_packet = 5; in qeth_set_blkt_defaults()
1918 card->info.blkt.inter_packet_jumbo = 15; in qeth_set_blkt_defaults()
1922 static void qeth_idx_init(struct qeth_card *card) in qeth_idx_init() argument
1924 memset(&card->seqno, 0, sizeof(card->seqno)); in qeth_idx_init()
1926 card->token.issuer_rm_w = 0x00010103UL; in qeth_idx_init()
1927 card->token.cm_filter_w = 0x00010108UL; in qeth_idx_init()
1928 card->token.cm_connection_w = 0x0001010aUL; in qeth_idx_init()
1929 card->token.ulp_filter_w = 0x0001010bUL; in qeth_idx_init()
1930 card->token.ulp_connection_w = 0x0001010dUL; in qeth_idx_init()
1932 switch (card->info.type) { in qeth_idx_init()
1934 card->info.func_level = QETH_IDX_FUNC_LEVEL_IQD; in qeth_idx_init()
1937 card->info.func_level = QETH_IDX_FUNC_LEVEL_OSD; in qeth_idx_init()
1944 static void qeth_idx_finalize_cmd(struct qeth_card *card, in qeth_idx_finalize_cmd() argument
1947 memcpy(QETH_TRANSPORT_HEADER_SEQ_NO(iob->data), &card->seqno.trans_hdr, in qeth_idx_finalize_cmd()
1949 if (iob->channel == &card->write) in qeth_idx_finalize_cmd()
1950 card->seqno.trans_hdr++; in qeth_idx_finalize_cmd()
1962 static void qeth_mpc_finalize_cmd(struct qeth_card *card, in qeth_mpc_finalize_cmd() argument
1965 qeth_idx_finalize_cmd(card, iob); in qeth_mpc_finalize_cmd()
1968 &card->seqno.pdu_hdr, QETH_SEQ_NO_LENGTH); in qeth_mpc_finalize_cmd()
1969 card->seqno.pdu_hdr++; in qeth_mpc_finalize_cmd()
1971 &card->seqno.pdu_hdr_ack, QETH_SEQ_NO_LENGTH); in qeth_mpc_finalize_cmd()
1983 static struct qeth_cmd_buffer *qeth_mpc_alloc_cmd(struct qeth_card *card, in qeth_mpc_alloc_cmd() argument
1989 iob = qeth_alloc_cmd(&card->write, data_length, 1, QETH_TIMEOUT); in qeth_mpc_alloc_cmd()
2002 * qeth_send_control_data() - send control command to the card
2003 * @card: qeth_card structure pointer
2023 static int qeth_send_control_data(struct qeth_card *card, in qeth_send_control_data() argument
2035 QETH_CARD_TEXT(card, 2, "sendctl"); in qeth_send_control_data()
2040 timeout = wait_event_interruptible_timeout(card->wait_q, in qeth_send_control_data()
2049 iob->finalize(card, iob); in qeth_send_control_data()
2052 qeth_enqueue_cmd(card, iob); in qeth_send_control_data()
2057 QETH_CARD_TEXT(card, 6, "noirqpnd"); in qeth_send_control_data()
2064 CARD_DEVID(card), rc); in qeth_send_control_data()
2065 QETH_CARD_TEXT_(card, 2, " err%d", rc); in qeth_send_control_data()
2066 qeth_dequeue_cmd(card, iob); in qeth_send_control_data()
2068 qeth_unlock_channel(card, channel); in qeth_send_control_data()
2077 qeth_dequeue_cmd(card, iob); in qeth_send_control_data()
2102 static void qeth_read_conf_data_cb(struct qeth_card *card, in qeth_read_conf_data_cb() argument
2110 QETH_CARD_TEXT(card, 2, "cfgunit"); in qeth_read_conf_data_cb()
2117 card->info.is_vm_nic = nd->nd1.plant[0] == _ascebc['V'] && in qeth_read_conf_data_cb()
2120 card->info.chpid = tag[0]; in qeth_read_conf_data_cb()
2121 card->info.unit_addr2 = tag[1]; in qeth_read_conf_data_cb()
2124 card->info.cula = tag[1]; in qeth_read_conf_data_cb()
2126 card->info.use_v1_blkt = nd->nd3.model[0] == 0xF0 && in qeth_read_conf_data_cb()
2136 static int qeth_read_conf_data(struct qeth_card *card) in qeth_read_conf_data() argument
2138 struct qeth_channel *channel = &card->data; in qeth_read_conf_data()
2157 return qeth_send_control_data(card, iob, NULL, NULL); in qeth_read_conf_data()
2160 static int qeth_idx_check_activate_response(struct qeth_card *card, in qeth_idx_check_activate_response() argument
2166 rc = qeth_check_idx_response(card, iob->data); in qeth_idx_check_activate_response()
2174 QETH_CARD_TEXT_(card, 2, "idxneg%c", in qeth_idx_check_activate_response()
2194 static void qeth_idx_activate_read_channel_cb(struct qeth_card *card, in qeth_idx_activate_read_channel_cb() argument
2202 QETH_CARD_TEXT(card, 2, "idxrdcb"); in qeth_idx_activate_read_channel_cb()
2204 rc = qeth_idx_check_activate_response(card, channel, iob); in qeth_idx_activate_read_channel_cb()
2209 if (peer_level != qeth_peer_func_level(card->info.func_level)) { in qeth_idx_activate_read_channel_cb()
2212 card->info.func_level, peer_level); in qeth_idx_activate_read_channel_cb()
2217 memcpy(&card->token.issuer_rm_r, in qeth_idx_activate_read_channel_cb()
2220 memcpy(&card->info.mcl_level[0], in qeth_idx_activate_read_channel_cb()
2228 static void qeth_idx_activate_write_channel_cb(struct qeth_card *card, in qeth_idx_activate_write_channel_cb() argument
2236 QETH_CARD_TEXT(card, 2, "idxwrcb"); in qeth_idx_activate_write_channel_cb()
2238 rc = qeth_idx_check_activate_response(card, channel, iob); in qeth_idx_activate_write_channel_cb()
2244 qeth_peer_func_level(card->info.func_level)) { in qeth_idx_activate_write_channel_cb()
2247 card->info.func_level, peer_level); in qeth_idx_activate_write_channel_cb()
2256 static void qeth_idx_setup_activate_cmd(struct qeth_card *card, in qeth_idx_setup_activate_cmd() argument
2259 u16 addr = (card->info.cula << 8) + card->info.unit_addr2; in qeth_idx_setup_activate_cmd()
2260 u8 port = ((u8)card->dev->dev_port) | 0x80; in qeth_idx_setup_activate_cmd()
2271 &card->token.issuer_rm_w, QETH_MPC_TOKEN_LENGTH); in qeth_idx_setup_activate_cmd()
2273 &card->info.func_level, 2); in qeth_idx_setup_activate_cmd()
2274 memcpy(QETH_IDX_ACT_QDIO_DEV_CUA(iob->data), &card->info.ddev_devno, 2); in qeth_idx_setup_activate_cmd()
2278 static int qeth_idx_activate_read_channel(struct qeth_card *card) in qeth_idx_activate_read_channel() argument
2280 struct qeth_channel *channel = &card->read; in qeth_idx_activate_read_channel()
2284 QETH_CARD_TEXT(card, 2, "idxread"); in qeth_idx_activate_read_channel()
2291 qeth_idx_setup_activate_cmd(card, iob); in qeth_idx_activate_read_channel()
2294 rc = qeth_send_control_data(card, iob, NULL, NULL); in qeth_idx_activate_read_channel()
2302 static int qeth_idx_activate_write_channel(struct qeth_card *card) in qeth_idx_activate_write_channel() argument
2304 struct qeth_channel *channel = &card->write; in qeth_idx_activate_write_channel()
2308 QETH_CARD_TEXT(card, 2, "idxwrite"); in qeth_idx_activate_write_channel()
2315 qeth_idx_setup_activate_cmd(card, iob); in qeth_idx_activate_write_channel()
2318 rc = qeth_send_control_data(card, iob, NULL, NULL); in qeth_idx_activate_write_channel()
2326 static int qeth_cm_enable_cb(struct qeth_card *card, struct qeth_reply *reply, in qeth_cm_enable_cb() argument
2331 QETH_CARD_TEXT(card, 2, "cmenblcb"); in qeth_cm_enable_cb()
2334 memcpy(&card->token.cm_filter_r, in qeth_cm_enable_cb()
2340 static int qeth_cm_enable(struct qeth_card *card) in qeth_cm_enable() argument
2344 QETH_CARD_TEXT(card, 2, "cmenable"); in qeth_cm_enable()
2346 iob = qeth_mpc_alloc_cmd(card, CM_ENABLE, CM_ENABLE_SIZE); in qeth_cm_enable()
2351 &card->token.issuer_rm_r, QETH_MPC_TOKEN_LENGTH); in qeth_cm_enable()
2353 &card->token.cm_filter_w, QETH_MPC_TOKEN_LENGTH); in qeth_cm_enable()
2355 return qeth_send_control_data(card, iob, qeth_cm_enable_cb, NULL); in qeth_cm_enable()
2358 static int qeth_cm_setup_cb(struct qeth_card *card, struct qeth_reply *reply, in qeth_cm_setup_cb() argument
2363 QETH_CARD_TEXT(card, 2, "cmsetpcb"); in qeth_cm_setup_cb()
2366 memcpy(&card->token.cm_connection_r, in qeth_cm_setup_cb()
2372 static int qeth_cm_setup(struct qeth_card *card) in qeth_cm_setup() argument
2376 QETH_CARD_TEXT(card, 2, "cmsetup"); in qeth_cm_setup()
2378 iob = qeth_mpc_alloc_cmd(card, CM_SETUP, CM_SETUP_SIZE); in qeth_cm_setup()
2383 &card->token.issuer_rm_r, QETH_MPC_TOKEN_LENGTH); in qeth_cm_setup()
2385 &card->token.cm_connection_w, QETH_MPC_TOKEN_LENGTH); in qeth_cm_setup()
2387 &card->token.cm_filter_r, QETH_MPC_TOKEN_LENGTH); in qeth_cm_setup()
2388 return qeth_send_control_data(card, iob, qeth_cm_setup_cb, NULL); in qeth_cm_setup()
2391 static bool qeth_is_supported_link_type(struct qeth_card *card, u8 link_type) in qeth_is_supported_link_type() argument
2395 dev_err(&card->gdev->dev, "Unsupported Token Ring device\n"); in qeth_is_supported_link_type()
2402 static int qeth_update_max_mtu(struct qeth_card *card, unsigned int max_mtu) in qeth_update_max_mtu() argument
2404 struct net_device *dev = card->dev; in qeth_update_max_mtu()
2409 if (IS_IQD(card)) in qeth_update_max_mtu()
2416 if (IS_IQD(card)) { in qeth_update_max_mtu()
2421 card->qdio.in_buf_size = max_mtu + 2 * PAGE_SIZE; in qeth_update_max_mtu()
2423 qeth_free_qdio_queues(card); in qeth_update_max_mtu()
2428 else if (IS_LAYER2(card)) in qeth_update_max_mtu()
2456 static int qeth_ulp_enable_cb(struct qeth_card *card, struct qeth_reply *reply, in qeth_ulp_enable_cb() argument
2464 QETH_CARD_TEXT(card, 2, "ulpenacb"); in qeth_ulp_enable_cb()
2467 memcpy(&card->token.ulp_filter_r, in qeth_ulp_enable_cb()
2470 if (IS_IQD(card)) { in qeth_ulp_enable_cb()
2482 if (!qeth_is_supported_link_type(card, link_type)) in qeth_ulp_enable_cb()
2486 card->info.link_type = link_type; in qeth_ulp_enable_cb()
2487 QETH_CARD_TEXT_(card, 2, "link%d", card->info.link_type); in qeth_ulp_enable_cb()
2491 static u8 qeth_mpc_select_prot_type(struct qeth_card *card) in qeth_mpc_select_prot_type() argument
2493 return IS_LAYER2(card) ? QETH_MPC_PROT_L2 : QETH_MPC_PROT_L3; in qeth_mpc_select_prot_type()
2496 static int qeth_ulp_enable(struct qeth_card *card) in qeth_ulp_enable() argument
2498 u8 prot_type = qeth_mpc_select_prot_type(card); in qeth_ulp_enable()
2503 QETH_CARD_TEXT(card, 2, "ulpenabl"); in qeth_ulp_enable()
2505 iob = qeth_mpc_alloc_cmd(card, ULP_ENABLE, ULP_ENABLE_SIZE); in qeth_ulp_enable()
2509 *(QETH_ULP_ENABLE_LINKNUM(iob->data)) = (u8) card->dev->dev_port; in qeth_ulp_enable()
2512 &card->token.cm_connection_r, QETH_MPC_TOKEN_LENGTH); in qeth_ulp_enable()
2514 &card->token.ulp_filter_w, QETH_MPC_TOKEN_LENGTH); in qeth_ulp_enable()
2515 rc = qeth_send_control_data(card, iob, qeth_ulp_enable_cb, &max_mtu); in qeth_ulp_enable()
2518 return qeth_update_max_mtu(card, max_mtu); in qeth_ulp_enable()
2521 static int qeth_ulp_setup_cb(struct qeth_card *card, struct qeth_reply *reply, in qeth_ulp_setup_cb() argument
2526 QETH_CARD_TEXT(card, 2, "ulpstpcb"); in qeth_ulp_setup_cb()
2529 memcpy(&card->token.ulp_connection_r, in qeth_ulp_setup_cb()
2534 QETH_CARD_TEXT(card, 2, "olmlimit"); in qeth_ulp_setup_cb()
2535 dev_err(&card->gdev->dev, "A connection could not be " in qeth_ulp_setup_cb()
2542 static int qeth_ulp_setup(struct qeth_card *card) in qeth_ulp_setup() argument
2547 QETH_CARD_TEXT(card, 2, "ulpsetup"); in qeth_ulp_setup()
2549 iob = qeth_mpc_alloc_cmd(card, ULP_SETUP, ULP_SETUP_SIZE); in qeth_ulp_setup()
2554 &card->token.cm_connection_r, QETH_MPC_TOKEN_LENGTH); in qeth_ulp_setup()
2556 &card->token.ulp_connection_w, QETH_MPC_TOKEN_LENGTH); in qeth_ulp_setup()
2558 &card->token.ulp_filter_r, QETH_MPC_TOKEN_LENGTH); in qeth_ulp_setup()
2560 memcpy(QETH_ULP_SETUP_CUA(iob->data), &card->info.ddev_devno, 2); in qeth_ulp_setup()
2561 temp = (card->info.cula << 8) + card->info.unit_addr2; in qeth_ulp_setup()
2563 return qeth_send_control_data(card, iob, qeth_ulp_setup_cb, NULL); in qeth_ulp_setup()
2628 static int qeth_alloc_qdio_queues(struct qeth_card *card) in qeth_alloc_qdio_queues() argument
2632 QETH_CARD_TEXT(card, 2, "allcqdbf"); in qeth_alloc_qdio_queues()
2635 if (qeth_alloc_cq(card)) in qeth_alloc_qdio_queues()
2638 if (atomic_cmpxchg(&card->qdio.state, QETH_QDIO_UNINITIALIZED, in qeth_alloc_qdio_queues()
2643 if (qeth_alloc_buffer_pool(card)) in qeth_alloc_qdio_queues()
2647 for (i = 0; i < card->qdio.no_out_queues; ++i) { in qeth_alloc_qdio_queues()
2653 QETH_CARD_TEXT_(card, 2, "outq %i", i); in qeth_alloc_qdio_queues()
2654 QETH_CARD_HEX(card, 2, &queue, sizeof(void *)); in qeth_alloc_qdio_queues()
2655 card->qdio.out_qs[i] = queue; in qeth_alloc_qdio_queues()
2656 queue->card = card; in qeth_alloc_qdio_queues()
2661 if (IS_IQD(card)) { in qeth_alloc_qdio_queues()
2677 qeth_free_output_queue(card->qdio.out_qs[--i]); in qeth_alloc_qdio_queues()
2678 card->qdio.out_qs[i] = NULL; in qeth_alloc_qdio_queues()
2680 qeth_free_buffer_pool(card); in qeth_alloc_qdio_queues()
2682 atomic_set(&card->qdio.state, QETH_QDIO_UNINITIALIZED); in qeth_alloc_qdio_queues()
2683 qeth_free_cq(card); in qeth_alloc_qdio_queues()
2688 static void qeth_free_qdio_queues(struct qeth_card *card) in qeth_free_qdio_queues() argument
2692 qeth_free_cq(card); in qeth_free_qdio_queues()
2694 if (atomic_xchg(&card->qdio.state, QETH_QDIO_UNINITIALIZED) == in qeth_free_qdio_queues()
2699 if (card->qdio.in_q->bufs[j].rx_skb) { in qeth_free_qdio_queues()
2700 consume_skb(card->qdio.in_q->bufs[j].rx_skb); in qeth_free_qdio_queues()
2701 card->qdio.in_q->bufs[j].rx_skb = NULL; in qeth_free_qdio_queues()
2706 qeth_free_buffer_pool(card); in qeth_free_qdio_queues()
2708 for (i = 0; i < card->qdio.no_out_queues; i++) { in qeth_free_qdio_queues()
2709 qeth_free_output_queue(card->qdio.out_qs[i]); in qeth_free_qdio_queues()
2710 card->qdio.out_qs[i] = NULL; in qeth_free_qdio_queues()
2714 static void qeth_fill_qib_parms(struct qeth_card *card, in qeth_fill_qib_parms() argument
2725 parms->pcit_a = QETH_PCI_THRESHOLD_A(card); in qeth_fill_qib_parms()
2726 parms->pcit_b = QETH_PCI_THRESHOLD_B(card); in qeth_fill_qib_parms()
2727 parms->pcit_c = QETH_PCI_TIMER_VALUE(card); in qeth_fill_qib_parms()
2734 parms->blkt_total = card->info.blkt.time_total; in qeth_fill_qib_parms()
2735 parms->blkt_inter_packet = card->info.blkt.inter_packet; in qeth_fill_qib_parms()
2736 parms->blkt_inter_packet_jumbo = card->info.blkt.inter_packet_jumbo; in qeth_fill_qib_parms()
2739 if (qeth_uses_tx_prio_queueing(card) || card->qdio.no_out_queues == 1) in qeth_fill_qib_parms()
2750 qeth_for_each_output_queue(card, queue, i) in qeth_fill_qib_parms()
2754 static int qeth_qdio_activate(struct qeth_card *card) in qeth_qdio_activate() argument
2756 QETH_CARD_TEXT(card, 3, "qdioact"); in qeth_qdio_activate()
2757 return qdio_activate(CARD_DDEV(card)); in qeth_qdio_activate()
2760 static int qeth_dm_act(struct qeth_card *card) in qeth_dm_act() argument
2764 QETH_CARD_TEXT(card, 2, "dmact"); in qeth_dm_act()
2766 iob = qeth_mpc_alloc_cmd(card, DM_ACT, DM_ACT_SIZE); in qeth_dm_act()
2771 &card->token.cm_connection_r, QETH_MPC_TOKEN_LENGTH); in qeth_dm_act()
2773 &card->token.ulp_connection_r, QETH_MPC_TOKEN_LENGTH); in qeth_dm_act()
2774 return qeth_send_control_data(card, iob, NULL, NULL); in qeth_dm_act()
2777 static int qeth_mpc_initialize(struct qeth_card *card) in qeth_mpc_initialize() argument
2781 QETH_CARD_TEXT(card, 2, "mpcinit"); in qeth_mpc_initialize()
2783 rc = qeth_issue_next_read(card); in qeth_mpc_initialize()
2785 QETH_CARD_TEXT_(card, 2, "1err%d", rc); in qeth_mpc_initialize()
2788 rc = qeth_cm_enable(card); in qeth_mpc_initialize()
2790 QETH_CARD_TEXT_(card, 2, "2err%d", rc); in qeth_mpc_initialize()
2793 rc = qeth_cm_setup(card); in qeth_mpc_initialize()
2795 QETH_CARD_TEXT_(card, 2, "3err%d", rc); in qeth_mpc_initialize()
2798 rc = qeth_ulp_enable(card); in qeth_mpc_initialize()
2800 QETH_CARD_TEXT_(card, 2, "4err%d", rc); in qeth_mpc_initialize()
2803 rc = qeth_ulp_setup(card); in qeth_mpc_initialize()
2805 QETH_CARD_TEXT_(card, 2, "5err%d", rc); in qeth_mpc_initialize()
2808 rc = qeth_alloc_qdio_queues(card); in qeth_mpc_initialize()
2810 QETH_CARD_TEXT_(card, 2, "5err%d", rc); in qeth_mpc_initialize()
2813 rc = qeth_qdio_establish(card); in qeth_mpc_initialize()
2815 QETH_CARD_TEXT_(card, 2, "6err%d", rc); in qeth_mpc_initialize()
2816 qeth_free_qdio_queues(card); in qeth_mpc_initialize()
2819 rc = qeth_qdio_activate(card); in qeth_mpc_initialize()
2821 QETH_CARD_TEXT_(card, 2, "7err%d", rc); in qeth_mpc_initialize()
2824 rc = qeth_dm_act(card); in qeth_mpc_initialize()
2826 QETH_CARD_TEXT_(card, 2, "8err%d", rc); in qeth_mpc_initialize()
2833 static void qeth_print_status_message(struct qeth_card *card) in qeth_print_status_message() argument
2835 switch (card->info.type) { in qeth_print_status_message()
2843 if (!card->info.mcl_level[0]) { in qeth_print_status_message()
2844 scnprintf(card->info.mcl_level, in qeth_print_status_message()
2845 sizeof(card->info.mcl_level), in qeth_print_status_message()
2847 card->info.mcl_level[2], in qeth_print_status_message()
2848 card->info.mcl_level[3]); in qeth_print_status_message()
2853 if (IS_VM_NIC(card) || (card->info.mcl_level[0] & 0x80)) { in qeth_print_status_message()
2854 card->info.mcl_level[0] = (char) _ebcasc[(__u8) in qeth_print_status_message()
2855 card->info.mcl_level[0]]; in qeth_print_status_message()
2856 card->info.mcl_level[1] = (char) _ebcasc[(__u8) in qeth_print_status_message()
2857 card->info.mcl_level[1]]; in qeth_print_status_message()
2858 card->info.mcl_level[2] = (char) _ebcasc[(__u8) in qeth_print_status_message()
2859 card->info.mcl_level[2]]; in qeth_print_status_message()
2860 card->info.mcl_level[3] = (char) _ebcasc[(__u8) in qeth_print_status_message()
2861 card->info.mcl_level[3]]; in qeth_print_status_message()
2862 card->info.mcl_level[QETH_MCL_LENGTH] = 0; in qeth_print_status_message()
2866 memset(&card->info.mcl_level[0], 0, QETH_MCL_LENGTH + 1); in qeth_print_status_message()
2868 dev_info(&card->gdev->dev, in qeth_print_status_message()
2869 "Device is a%s card%s%s%s\nwith link type %s.\n", in qeth_print_status_message()
2870 qeth_get_cardname(card), in qeth_print_status_message()
2871 (card->info.mcl_level[0]) ? " (level: " : "", in qeth_print_status_message()
2872 (card->info.mcl_level[0]) ? card->info.mcl_level : "", in qeth_print_status_message()
2873 (card->info.mcl_level[0]) ? ")" : "", in qeth_print_status_message()
2874 qeth_get_cardname_short(card)); in qeth_print_status_message()
2877 static void qeth_initialize_working_pool_list(struct qeth_card *card) in qeth_initialize_working_pool_list() argument
2881 QETH_CARD_TEXT(card, 5, "inwrklst"); in qeth_initialize_working_pool_list()
2884 &card->qdio.init_pool.entry_list, init_list) { in qeth_initialize_working_pool_list()
2885 qeth_put_buffer_pool_entry(card, entry); in qeth_initialize_working_pool_list()
2890 struct qeth_card *card) in qeth_find_free_buffer_pool_entry() argument
2895 if (list_empty(&card->qdio.in_buf_pool.entry_list)) in qeth_find_free_buffer_pool_entry()
2898 list_for_each_entry(entry, &card->qdio.in_buf_pool.entry_list, list) { in qeth_find_free_buffer_pool_entry()
2900 for (i = 0; i < QETH_MAX_BUFFER_ELEMENTS(card); ++i) { in qeth_find_free_buffer_pool_entry()
2913 entry = list_first_entry(&card->qdio.in_buf_pool.entry_list, in qeth_find_free_buffer_pool_entry()
2915 for (i = 0; i < QETH_MAX_BUFFER_ELEMENTS(card); ++i) { in qeth_find_free_buffer_pool_entry()
2924 QETH_CARD_STAT_INC(card, rx_sg_alloc_page); in qeth_find_free_buffer_pool_entry()
2931 static int qeth_init_input_buffer(struct qeth_card *card, in qeth_init_input_buffer() argument
2937 if ((card->options.cq == QETH_CQ_ENABLED) && (!buf->rx_skb)) { in qeth_init_input_buffer()
2938 buf->rx_skb = netdev_alloc_skb(card->dev, in qeth_init_input_buffer()
2946 pool_entry = qeth_find_free_buffer_pool_entry(card); in qeth_init_input_buffer()
2959 for (i = 0; i < QETH_MAX_BUFFER_ELEMENTS(card); ++i) { in qeth_init_input_buffer()
2963 if (i == QETH_MAX_BUFFER_ELEMENTS(card) - 1) in qeth_init_input_buffer()
2972 static unsigned int qeth_tx_select_bulk_max(struct qeth_card *card, in qeth_tx_select_bulk_max() argument
2975 if (!IS_IQD(card) || in qeth_tx_select_bulk_max()
2976 qeth_iqd_is_mcast_queue(card, queue) || in qeth_tx_select_bulk_max()
2977 card->options.cq == QETH_CQ_ENABLED || in qeth_tx_select_bulk_max()
2978 qdio_get_ssqd_desc(CARD_DDEV(card), &card->ssqd)) in qeth_tx_select_bulk_max()
2981 return card->ssqd.mmwc ? card->ssqd.mmwc : 1; in qeth_tx_select_bulk_max()
2984 static int qeth_init_qdio_queues(struct qeth_card *card) in qeth_init_qdio_queues() argument
2986 unsigned int rx_bufs = card->qdio.in_buf_pool.buf_count; in qeth_init_qdio_queues()
2990 QETH_CARD_TEXT(card, 2, "initqdqs"); in qeth_init_qdio_queues()
2993 qdio_reset_buffers(card->qdio.in_q->qdio_bufs, QDIO_MAX_BUFFERS_PER_Q); in qeth_init_qdio_queues()
2994 memset(&card->rx, 0, sizeof(struct qeth_rx)); in qeth_init_qdio_queues()
2996 qeth_initialize_working_pool_list(card); in qeth_init_qdio_queues()
2999 rc = qeth_init_input_buffer(card, &card->qdio.in_q->bufs[i]); in qeth_init_qdio_queues()
3004 card->qdio.in_q->next_buf_to_init = QDIO_BUFNR(rx_bufs); in qeth_init_qdio_queues()
3005 rc = qdio_add_bufs_to_input_queue(CARD_DDEV(card), 0, 0, rx_bufs); in qeth_init_qdio_queues()
3007 QETH_CARD_TEXT_(card, 2, "1err%d", rc); in qeth_init_qdio_queues()
3012 rc = qeth_cq_init(card); in qeth_init_qdio_queues()
3018 for (i = 0; i < card->qdio.no_out_queues; ++i) { in qeth_init_qdio_queues()
3019 struct qeth_qdio_out_q *queue = card->qdio.out_qs[i]; in qeth_init_qdio_queues()
3022 queue->max_elements = QETH_MAX_BUFFER_ELEMENTS(card); in qeth_init_qdio_queues()
3029 queue->bulk_max = qeth_tx_select_bulk_max(card, queue); in qeth_init_qdio_queues()
3032 netdev_tx_reset_queue(netdev_get_tx_queue(card->dev, i)); in qeth_init_qdio_queues()
3037 static void qeth_ipa_finalize_cmd(struct qeth_card *card, in qeth_ipa_finalize_cmd() argument
3040 qeth_mpc_finalize_cmd(card, iob); in qeth_ipa_finalize_cmd()
3043 __ipa_cmd(iob)->hdr.seqno = card->seqno.ipa++; in qeth_ipa_finalize_cmd()
3046 static void qeth_prepare_ipa_cmd(struct qeth_card *card, in qeth_prepare_ipa_cmd() argument
3049 u8 prot_type = qeth_mpc_select_prot_type(card); in qeth_prepare_ipa_cmd()
3062 &card->token.ulp_connection_r, QETH_MPC_TOKEN_LENGTH); in qeth_prepare_ipa_cmd()
3074 struct qeth_cmd_buffer *qeth_ipa_alloc_cmd(struct qeth_card *card, in qeth_ipa_alloc_cmd() argument
3083 iob = qeth_alloc_cmd(&card->write, IPA_PDU_HEADER_SIZE + data_length, 1, in qeth_ipa_alloc_cmd()
3088 qeth_prepare_ipa_cmd(card, iob, data_length); in qeth_ipa_alloc_cmd()
3096 hdr->rel_adapter_no = (u8) card->dev->dev_port; in qeth_ipa_alloc_cmd()
3097 hdr->prim_version_no = IS_LAYER2(card) ? 2 : 1; in qeth_ipa_alloc_cmd()
3104 static int qeth_send_ipa_cmd_cb(struct qeth_card *card, in qeth_send_ipa_cmd_cb() argument
3118 int qeth_send_ipa_cmd(struct qeth_card *card, struct qeth_cmd_buffer *iob, in qeth_send_ipa_cmd() argument
3125 QETH_CARD_TEXT(card, 4, "sendipa"); in qeth_send_ipa_cmd()
3127 if (card->read_or_write_problem) { in qeth_send_ipa_cmd()
3134 rc = qeth_send_control_data(card, iob, reply_cb, reply_param); in qeth_send_ipa_cmd()
3136 qeth_clear_ipacmd_list(card); in qeth_send_ipa_cmd()
3137 qeth_schedule_recovery(card); in qeth_send_ipa_cmd()
3143 static int qeth_send_startlan_cb(struct qeth_card *card, in qeth_send_startlan_cb() argument
3154 static int qeth_send_startlan(struct qeth_card *card) in qeth_send_startlan() argument
3158 QETH_CARD_TEXT(card, 2, "strtlan"); in qeth_send_startlan()
3160 iob = qeth_ipa_alloc_cmd(card, IPA_CMD_STARTLAN, QETH_PROT_NONE, 0); in qeth_send_startlan()
3163 return qeth_send_ipa_cmd(card, iob, qeth_send_startlan_cb, NULL); in qeth_send_startlan()
3174 static int qeth_query_setadapterparms_cb(struct qeth_card *card, in qeth_query_setadapterparms_cb() argument
3180 QETH_CARD_TEXT(card, 3, "quyadpcb"); in qeth_query_setadapterparms_cb()
3186 if (!qeth_is_supported_link_type(card, query_cmd->lan_type)) in qeth_query_setadapterparms_cb()
3189 card->info.link_type = query_cmd->lan_type; in qeth_query_setadapterparms_cb()
3190 QETH_CARD_TEXT_(card, 2, "lnk %d", card->info.link_type); in qeth_query_setadapterparms_cb()
3193 card->options.adp.supported = query_cmd->supported_cmds; in qeth_query_setadapterparms_cb()
3197 static struct qeth_cmd_buffer *qeth_get_adapter_cmd(struct qeth_card *card, in qeth_get_adapter_cmd() argument
3204 iob = qeth_ipa_alloc_cmd(card, IPA_CMD_SETADAPTERPARMS, QETH_PROT_IPV4, in qeth_get_adapter_cmd()
3219 static int qeth_query_setadapterparms(struct qeth_card *card) in qeth_query_setadapterparms() argument
3224 QETH_CARD_TEXT(card, 3, "queryadp"); in qeth_query_setadapterparms()
3225 iob = qeth_get_adapter_cmd(card, IPA_SETADP_QUERY_COMMANDS_SUPPORTED, in qeth_query_setadapterparms()
3229 rc = qeth_send_ipa_cmd(card, iob, qeth_query_setadapterparms_cb, NULL); in qeth_query_setadapterparms()
3233 static int qeth_query_ipassists_cb(struct qeth_card *card, in qeth_query_ipassists_cb() argument
3238 QETH_CARD_TEXT(card, 2, "qipasscb"); in qeth_query_ipassists_cb()
3247 QETH_CARD_TEXT(card, 2, "ipaunsup"); in qeth_query_ipassists_cb()
3248 card->options.ipa4.supported |= IPA_SETADAPTERPARMS; in qeth_query_ipassists_cb()
3249 card->options.ipa6.supported |= IPA_SETADAPTERPARMS; in qeth_query_ipassists_cb()
3253 CARD_DEVID(card), cmd->hdr.return_code); in qeth_query_ipassists_cb()
3258 card->options.ipa4 = cmd->hdr.assists; in qeth_query_ipassists_cb()
3260 card->options.ipa6 = cmd->hdr.assists; in qeth_query_ipassists_cb()
3263 CARD_DEVID(card)); in qeth_query_ipassists_cb()
3267 static int qeth_query_ipassists(struct qeth_card *card, in qeth_query_ipassists() argument
3273 QETH_CARD_TEXT_(card, 2, "qipassi%i", prot); in qeth_query_ipassists()
3274 iob = qeth_ipa_alloc_cmd(card, IPA_CMD_QIPASSIST, prot, 0); in qeth_query_ipassists()
3277 rc = qeth_send_ipa_cmd(card, iob, qeth_query_ipassists_cb, NULL); in qeth_query_ipassists()
3281 static int qeth_query_switch_attributes_cb(struct qeth_card *card, in qeth_query_switch_attributes_cb() argument
3288 QETH_CARD_TEXT(card, 2, "qswiatcb"); in qeth_query_switch_attributes_cb()
3296 QETH_CARD_TEXT_(card, 2, "%04x%04x", sw_info->capabilities, in qeth_query_switch_attributes_cb()
3301 int qeth_query_switch_attributes(struct qeth_card *card, in qeth_query_switch_attributes() argument
3306 QETH_CARD_TEXT(card, 2, "qswiattr"); in qeth_query_switch_attributes()
3307 if (!qeth_adp_supported(card, IPA_SETADP_QUERY_SWITCH_ATTRIBUTES)) in qeth_query_switch_attributes()
3309 if (!netif_carrier_ok(card->dev)) in qeth_query_switch_attributes()
3311 iob = qeth_get_adapter_cmd(card, IPA_SETADP_QUERY_SWITCH_ATTRIBUTES, 0); in qeth_query_switch_attributes()
3314 return qeth_send_ipa_cmd(card, iob, in qeth_query_switch_attributes()
3318 struct qeth_cmd_buffer *qeth_get_diag_cmd(struct qeth_card *card, in qeth_get_diag_cmd() argument
3325 iob = qeth_ipa_alloc_cmd(card, IPA_CMD_SET_DIAG_ASS, QETH_PROT_NONE, in qeth_get_diag_cmd()
3337 static int qeth_query_setdiagass_cb(struct qeth_card *card, in qeth_query_setdiagass_cb() argument
3344 QETH_CARD_TEXT_(card, 2, "diagq:%x", rc); in qeth_query_setdiagass_cb()
3348 card->info.diagass_support = cmd->data.diagass.ext; in qeth_query_setdiagass_cb()
3352 static int qeth_query_setdiagass(struct qeth_card *card) in qeth_query_setdiagass() argument
3356 QETH_CARD_TEXT(card, 2, "qdiagass"); in qeth_query_setdiagass()
3357 iob = qeth_get_diag_cmd(card, QETH_DIAGS_CMD_QUERY, 0); in qeth_query_setdiagass()
3360 return qeth_send_ipa_cmd(card, iob, qeth_query_setdiagass_cb, NULL); in qeth_query_setdiagass()
3363 static void qeth_get_trap_id(struct qeth_card *card, struct qeth_trap_id *tid) in qeth_get_trap_id() argument
3371 tid->chpid = card->info.chpid; in qeth_get_trap_id()
3372 ccw_device_get_id(CARD_RDEV(card), &ccwid); in qeth_get_trap_id()
3387 static int qeth_hw_trap_cb(struct qeth_card *card, in qeth_hw_trap_cb() argument
3394 QETH_CARD_TEXT_(card, 2, "trapc:%x", rc); in qeth_hw_trap_cb()
3400 int qeth_hw_trap(struct qeth_card *card, enum qeth_diags_trap_action action) in qeth_hw_trap() argument
3405 QETH_CARD_TEXT(card, 2, "diagtrap"); in qeth_hw_trap()
3406 iob = qeth_get_diag_cmd(card, QETH_DIAGS_CMD_TRAP, 64); in qeth_hw_trap()
3417 qeth_get_trap_id(card, in qeth_hw_trap()
3426 return qeth_send_ipa_cmd(card, iob, qeth_hw_trap_cb, NULL); in qeth_hw_trap()
3429 static int qeth_check_qdio_errors(struct qeth_card *card, in qeth_check_qdio_errors() argument
3435 QETH_CARD_TEXT(card, 2, dbftext); in qeth_check_qdio_errors()
3436 QETH_CARD_TEXT_(card, 2, " F15=%02X", in qeth_check_qdio_errors()
3438 QETH_CARD_TEXT_(card, 2, " F14=%02X", in qeth_check_qdio_errors()
3440 QETH_CARD_TEXT_(card, 2, " qerr=%X", qdio_error); in qeth_check_qdio_errors()
3442 QETH_CARD_STAT_INC(card, rx_fifo_errors); in qeth_check_qdio_errors()
3450 static unsigned int qeth_rx_refill_queue(struct qeth_card *card, in qeth_rx_refill_queue() argument
3453 struct qeth_qdio_q *queue = card->qdio.in_q; in qeth_rx_refill_queue()
3460 if (count >= QETH_IN_BUF_REQUEUE_THRESHOLD(card)) { in qeth_rx_refill_queue()
3463 if (qeth_init_input_buffer(card, in qeth_rx_refill_queue()
3474 atomic_set(&card->force_alloc_skb, 3); in qeth_rx_refill_queue()
3477 atomic_add_unless(&card->force_alloc_skb, -1, 0); in qeth_rx_refill_queue()
3482 list_for_each(lh, &card->qdio.in_buf_pool.entry_list) in qeth_rx_refill_queue()
3484 if (i == card->qdio.in_buf_pool.buf_count) { in qeth_rx_refill_queue()
3485 QETH_CARD_TEXT(card, 2, "qsarbw"); in qeth_rx_refill_queue()
3487 &card->buffer_reclaim_work, in qeth_rx_refill_queue()
3493 rc = qdio_add_bufs_to_input_queue(CARD_DDEV(card), 0, in qeth_rx_refill_queue()
3497 QETH_CARD_TEXT(card, 2, "qinberr"); in qeth_rx_refill_queue()
3509 struct qeth_card *card = container_of(to_delayed_work(work), in qeth_buffer_reclaim_work() local
3514 napi_schedule(&card->napi); in qeth_buffer_reclaim_work()
3519 static void qeth_handle_send_error(struct qeth_card *card, in qeth_handle_send_error() argument
3524 QETH_CARD_TEXT(card, 6, "hdsnderr"); in qeth_handle_send_error()
3525 qeth_check_qdio_errors(card, buffer->buffer, qdio_err, "qouterr"); in qeth_handle_send_error()
3533 QETH_CARD_TEXT(card, 1, "lnkfail"); in qeth_handle_send_error()
3534 QETH_CARD_TEXT_(card, 1, "%04x %02x", in qeth_handle_send_error()
3570 QETH_CARD_TEXT(queue->card, 6, "np->pack"); in qeth_switch_to_packing_if_needed()
3589 QETH_CARD_TEXT(queue->card, 6, "pack->np"); in qeth_switch_to_nonpacking_if_needed()
3602 struct qeth_card *card = queue->card; in qeth_flush_buffers() local
3617 if (IS_IQD(card)) { in qeth_flush_buffers()
3623 if (IS_IQD(card)) { in qeth_flush_buffers()
3624 if (card->options.cq == QETH_CQ_ENABLED && in qeth_flush_buffers()
3625 !qeth_iqd_is_mcast_queue(card, queue) && in qeth_flush_buffers()
3667 rc = qdio_add_bufs_to_output_queue(CARD_DDEV(card), queue->queue_no, in qeth_flush_buffers()
3683 } else if (qeth_use_tx_irqs(card) && in qeth_flush_buffers()
3694 QETH_CARD_TEXT(queue->card, 2, "flushbuf"); in qeth_flush_buffers()
3695 QETH_CARD_TEXT_(queue->card, 2, " q%d", queue->queue_no); in qeth_flush_buffers()
3696 QETH_CARD_TEXT_(queue->card, 2, " idx%d", index); in qeth_flush_buffers()
3697 QETH_CARD_TEXT_(queue->card, 2, " c%d", count); in qeth_flush_buffers()
3698 QETH_CARD_TEXT_(queue->card, 2, " err%d", rc); in qeth_flush_buffers()
3702 qeth_schedule_recovery(queue->card); in qeth_flush_buffers()
3744 struct qeth_card *card = (struct qeth_card *)card_ptr; in qeth_qdio_poll() local
3746 napi_schedule_irqoff(&card->napi); in qeth_qdio_poll()
3749 int qeth_configure_cq(struct qeth_card *card, enum qeth_cq cq) in qeth_configure_cq() argument
3751 if (card->options.cq == QETH_CQ_NOTAVAILABLE) in qeth_configure_cq()
3754 card->options.cq = cq; in qeth_configure_cq()
3759 static void qeth_qdio_handle_aob(struct qeth_card *card, struct qaob *aob) in qeth_qdio_handle_aob() argument
3767 queue_no < card->qdio.no_out_queues) in qeth_qdio_handle_aob()
3768 napi_schedule(&card->qdio.out_qs[queue_no]->napi); in qeth_qdio_handle_aob()
3771 static void qeth_qdio_cq_handler(struct qeth_card *card, unsigned int qdio_err, in qeth_qdio_cq_handler() argument
3775 struct qeth_qdio_q *cq = card->qdio.c_q; in qeth_qdio_cq_handler()
3779 QETH_CARD_TEXT_(card, 5, "qcqhe%d", first_element); in qeth_qdio_cq_handler()
3780 QETH_CARD_TEXT_(card, 5, "qcqhc%d", count); in qeth_qdio_cq_handler()
3781 QETH_CARD_TEXT_(card, 5, "qcqherr%d", qdio_err); in qeth_qdio_cq_handler()
3784 netif_tx_stop_all_queues(card->dev); in qeth_qdio_cq_handler()
3785 qeth_schedule_recovery(card); in qeth_qdio_cq_handler()
3797 qeth_qdio_handle_aob(card, dma64_to_virt(phys_aob_addr)); in qeth_qdio_cq_handler()
3802 rc = qdio_add_bufs_to_input_queue(CARD_DDEV(card), queue, in qeth_qdio_cq_handler()
3805 dev_warn(&card->gdev->dev, in qeth_qdio_cq_handler()
3807 QETH_CARD_TEXT(card, 2, "qcqherr"); in qeth_qdio_cq_handler()
3818 struct qeth_card *card = (struct qeth_card *)card_ptr; in qeth_qdio_input_handler() local
3820 QETH_CARD_TEXT_(card, 2, "qihq%d", queue); in qeth_qdio_input_handler()
3821 QETH_CARD_TEXT_(card, 2, "qiec%d", qdio_err); in qeth_qdio_input_handler()
3824 qeth_schedule_recovery(card); in qeth_qdio_input_handler()
3832 struct qeth_card *card = (struct qeth_card *) card_ptr; in qeth_qdio_output_handler() local
3834 QETH_CARD_TEXT(card, 2, "achkcond"); in qeth_qdio_output_handler()
3835 netif_tx_stop_all_queues(card->dev); in qeth_qdio_output_handler()
3836 qeth_schedule_recovery(card); in qeth_qdio_output_handler()
3842 static int qeth_get_priority_queue(struct qeth_card *card, struct sk_buff *skb) in qeth_get_priority_queue() argument
3847 switch (card->qdio.do_prio_queueing) { in qeth_get_priority_queue()
3858 return card->qdio.default_out_queue; in qeth_get_priority_queue()
3860 if (card->qdio.do_prio_queueing == QETH_PRIO_Q_ING_PREC) in qeth_get_priority_queue()
3881 return card->qdio.default_out_queue; in qeth_get_priority_queue()
3885 return card->qdio.default_out_queue; in qeth_get_priority_queue()
4140 static int __qeth_xmit(struct qeth_card *card, struct qeth_qdio_out_q *queue, in __qeth_xmit() argument
4153 txq = netdev_get_tx_queue(card->dev, skb_get_queue_mapping(skb)); in __qeth_xmit()
4218 static int qeth_do_send_packet(struct qeth_card *card, in qeth_do_send_packet() argument
4241 txq = netdev_get_tx_queue(card->dev, skb_get_queue_mapping(skb)); in qeth_do_send_packet()
4319 int qeth_xmit(struct qeth_card *card, struct sk_buff *skb, in qeth_xmit() argument
4339 proto_len = (IS_IQD(card) && IS_LAYER2(card)) ? ETH_HLEN : 0; in qeth_xmit()
4361 if (IS_IQD(card)) { in qeth_xmit()
4362 rc = __qeth_xmit(card, queue, skb, elements, hdr, data_offset, in qeth_xmit()
4368 rc = qeth_do_send_packet(card, queue, skb, hdr, data_offset, in qeth_xmit()
4380 static int qeth_setadp_promisc_mode_cb(struct qeth_card *card, in qeth_setadp_promisc_mode_cb() argument
4386 QETH_CARD_TEXT(card, 4, "prmadpcb"); in qeth_setadp_promisc_mode_cb()
4390 QETH_CARD_TEXT_(card, 4, "prmrc%x", cmd->hdr.return_code); in qeth_setadp_promisc_mode_cb()
4393 card->info.promisc_mode = setparms->data.mode; in qeth_setadp_promisc_mode_cb()
4397 void qeth_setadp_promisc_mode(struct qeth_card *card, bool enable) in qeth_setadp_promisc_mode() argument
4404 QETH_CARD_TEXT(card, 4, "setprom"); in qeth_setadp_promisc_mode()
4405 QETH_CARD_TEXT_(card, 4, "mode:%x", mode); in qeth_setadp_promisc_mode()
4407 iob = qeth_get_adapter_cmd(card, IPA_SETADP_SET_PROMISC_MODE, in qeth_setadp_promisc_mode()
4413 qeth_send_ipa_cmd(card, iob, qeth_setadp_promisc_mode_cb, NULL); in qeth_setadp_promisc_mode()
4417 static int qeth_setadpparms_change_macaddr_cb(struct qeth_card *card, in qeth_setadpparms_change_macaddr_cb() argument
4423 QETH_CARD_TEXT(card, 4, "chgmaccb"); in qeth_setadpparms_change_macaddr_cb()
4431 if (IS_LAYER2(card) && IS_OSD(card) && !IS_VM_NIC(card) && in qeth_setadpparms_change_macaddr_cb()
4435 eth_hw_addr_set(card->dev, adp_cmd->data.change_addr.addr); in qeth_setadpparms_change_macaddr_cb()
4439 int qeth_setadpparms_change_macaddr(struct qeth_card *card) in qeth_setadpparms_change_macaddr() argument
4445 QETH_CARD_TEXT(card, 4, "chgmac"); in qeth_setadpparms_change_macaddr()
4447 iob = qeth_get_adapter_cmd(card, IPA_SETADP_ALTER_MAC_ADDRESS, in qeth_setadpparms_change_macaddr()
4455 card->dev->dev_addr); in qeth_setadpparms_change_macaddr()
4456 rc = qeth_send_ipa_cmd(card, iob, qeth_setadpparms_change_macaddr_cb, in qeth_setadpparms_change_macaddr()
4462 static int qeth_setadpparms_set_access_ctrl_cb(struct qeth_card *card, in qeth_setadpparms_set_access_ctrl_cb() argument
4468 QETH_CARD_TEXT(card, 4, "setaccb"); in qeth_setadpparms_set_access_ctrl_cb()
4471 QETH_CARD_TEXT_(card, 2, "rc=%d", in qeth_setadpparms_set_access_ctrl_cb()
4476 access_ctrl_req->subcmd_code, CARD_DEVID(card), in qeth_setadpparms_set_access_ctrl_cb()
4481 dev_info(&card->gdev->dev, in qeth_setadpparms_set_access_ctrl_cb()
4484 dev_info(&card->gdev->dev, in qeth_setadpparms_set_access_ctrl_cb()
4489 CARD_DEVID(card)); in qeth_setadpparms_set_access_ctrl_cb()
4493 CARD_DEVID(card)); in qeth_setadpparms_set_access_ctrl_cb()
4496 dev_err(&card->gdev->dev, "Adapter does not " in qeth_setadpparms_set_access_ctrl_cb()
4500 dev_err(&card->gdev->dev, in qeth_setadpparms_set_access_ctrl_cb()
4505 dev_err(&card->gdev->dev, in qeth_setadpparms_set_access_ctrl_cb()
4509 dev_err(&card->gdev->dev, "The adjacent switch port does not " in qeth_setadpparms_set_access_ctrl_cb()
4513 dev_err(&card->gdev->dev, "The reflective relay mode cannot be " in qeth_setadpparms_set_access_ctrl_cb()
4517 dev_warn(&card->gdev->dev, "Turning off reflective relay mode " in qeth_setadpparms_set_access_ctrl_cb()
4526 int qeth_setadpparms_set_access_ctrl(struct qeth_card *card, in qeth_setadpparms_set_access_ctrl() argument
4534 QETH_CARD_TEXT(card, 4, "setacctl"); in qeth_setadpparms_set_access_ctrl()
4536 if (!qeth_adp_supported(card, IPA_SETADP_SET_ACCESS_CONTROL)) { in qeth_setadpparms_set_access_ctrl()
4537 dev_err(&card->gdev->dev, in qeth_setadpparms_set_access_ctrl()
4542 iob = qeth_get_adapter_cmd(card, IPA_SETADP_SET_ACCESS_CONTROL, in qeth_setadpparms_set_access_ctrl()
4550 rc = qeth_send_ipa_cmd(card, iob, qeth_setadpparms_set_access_ctrl_cb, in qeth_setadpparms_set_access_ctrl()
4553 QETH_CARD_TEXT_(card, 2, "rc=%d", rc); in qeth_setadpparms_set_access_ctrl()
4555 rc, CARD_DEVID(card)); in qeth_setadpparms_set_access_ctrl()
4563 struct qeth_card *card; in qeth_tx_timeout() local
4565 card = dev->ml_priv; in qeth_tx_timeout()
4566 QETH_CARD_TEXT(card, 4, "txtimeo"); in qeth_tx_timeout()
4567 qeth_schedule_recovery(card); in qeth_tx_timeout()
4573 struct qeth_card *card = dev->ml_priv; in qeth_mdio_read() local
4579 if ((card->info.link_type != QETH_LINK_TYPE_GBIT_ETH) && in qeth_mdio_read()
4580 (card->info.link_type != QETH_LINK_TYPE_10GBIT_ETH) && in qeth_mdio_read()
4581 (card->info.link_type != QETH_LINK_TYPE_25GBIT_ETH)) in qeth_mdio_read()
4613 rc = card->stats.rx_length_errors + in qeth_mdio_read()
4614 card->stats.rx_frame_errors + in qeth_mdio_read()
4615 card->stats.rx_fifo_errors; in qeth_mdio_read()
4637 static int qeth_snmp_command_cb(struct qeth_card *card, in qeth_snmp_command_cb() argument
4646 QETH_CARD_TEXT(card, 3, "snpcmdcb"); in qeth_snmp_command_cb()
4649 QETH_CARD_TEXT_(card, 4, "scer1%x", cmd->hdr.return_code); in qeth_snmp_command_cb()
4655 QETH_CARD_TEXT_(card, 4, "scer2%x", cmd->hdr.return_code); in qeth_snmp_command_cb()
4670 QETH_CARD_TEXT_(card, 4, "scer3%i", -ENOSPC); in qeth_snmp_command_cb()
4673 QETH_CARD_TEXT_(card, 4, "snore%i", in qeth_snmp_command_cb()
4675 QETH_CARD_TEXT_(card, 4, "sseqn%i", in qeth_snmp_command_cb()
4687 static int qeth_snmp_command(struct qeth_card *card, char __user *udata) in qeth_snmp_command() argument
4695 QETH_CARD_TEXT(card, 3, "snmpcmd"); in qeth_snmp_command()
4697 if (IS_VM_NIC(card)) in qeth_snmp_command()
4700 if ((!qeth_adp_supported(card, IPA_SETADP_SET_SNMP_CONTROL)) && in qeth_snmp_command()
4701 IS_LAYER3(card)) in qeth_snmp_command()
4713 iob = qeth_get_adapter_cmd(card, IPA_SETADP_SET_SNMP_CONTROL, req_len); in qeth_snmp_command()
4730 rc = qeth_send_ipa_cmd(card, iob, qeth_snmp_command_cb, &qinfo); in qeth_snmp_command()
4733 CARD_DEVID(card), rc); in qeth_snmp_command()
4743 static int qeth_setadpparms_query_oat_cb(struct qeth_card *card, in qeth_setadpparms_query_oat_cb() argument
4751 QETH_CARD_TEXT(card, 3, "qoatcb"); in qeth_setadpparms_query_oat_cb()
4770 static int qeth_query_oat_command(struct qeth_card *card, char __user *udata) in qeth_query_oat_command() argument
4780 QETH_CARD_TEXT(card, 3, "qoatcmd"); in qeth_query_oat_command()
4782 if (!qeth_adp_supported(card, IPA_SETADP_QUERY_OAT)) in qeth_query_oat_command()
4794 iob = qeth_get_adapter_cmd(card, IPA_SETADP_QUERY_OAT, in qeth_query_oat_command()
4804 rc = qeth_send_ipa_cmd(card, iob, qeth_setadpparms_query_oat_cb, &priv); in qeth_query_oat_command()
4820 static int qeth_init_link_info_oat_cb(struct qeth_card *card, in qeth_init_link_info_oat_cb() argument
4829 QETH_CARD_TEXT(card, 2, "qoatincb"); in qeth_init_link_info_oat_cb()
4907 static void qeth_init_link_info(struct qeth_card *card) in qeth_init_link_info() argument
4909 qeth_default_link_info(card); in qeth_init_link_info()
4912 if (qeth_adp_supported(card, IPA_SETADP_QUERY_OAT)) { in qeth_init_link_info()
4916 iob = qeth_get_adapter_cmd(card, IPA_SETADP_QUERY_OAT, in qeth_init_link_info()
4925 if (!qeth_send_ipa_cmd(card, iob, in qeth_init_link_info()
4929 card->info.link_info.speed = link_info.speed; in qeth_init_link_info()
4931 card->info.link_info.duplex = link_info.duplex; in qeth_init_link_info()
4933 card->info.link_info.port = link_info.port; in qeth_init_link_info()
4935 card->info.link_info.link_mode = link_info.link_mode; in qeth_init_link_info()
4943 * @card: pointer to a qeth_card
4946 * 0, if a MAC address has been set for the card's netdevice
4949 int qeth_vm_request_mac(struct qeth_card *card) in qeth_vm_request_mac() argument
4955 QETH_CARD_TEXT(card, 2, "vmreqmac"); in qeth_vm_request_mac()
4967 request->devno = card->info.ddev_devno; in qeth_vm_request_mac()
4979 QETH_CARD_TEXT(card, 2, "badresp"); in qeth_vm_request_mac()
4980 QETH_CARD_HEX(card, 2, &request->resp_buf_len, in qeth_vm_request_mac()
4984 QETH_CARD_TEXT(card, 2, "badmac"); in qeth_vm_request_mac()
4985 QETH_CARD_HEX(card, 2, response->mac, ETH_ALEN); in qeth_vm_request_mac()
4987 eth_hw_addr_set(card->dev, response->mac); in qeth_vm_request_mac()
4997 static void qeth_determine_capabilities(struct qeth_card *card) in qeth_determine_capabilities() argument
4999 struct qeth_channel *channel = &card->data; in qeth_determine_capabilities()
5004 QETH_CARD_TEXT(card, 2, "detcapab"); in qeth_determine_capabilities()
5009 QETH_CARD_TEXT_(card, 2, "3err%d", rc); in qeth_determine_capabilities()
5014 rc = qeth_read_conf_data(card); in qeth_determine_capabilities()
5017 CARD_DEVID(card), rc); in qeth_determine_capabilities()
5018 QETH_CARD_TEXT_(card, 2, "5err%d", rc); in qeth_determine_capabilities()
5022 rc = qdio_get_ssqd_desc(ddev, &card->ssqd); in qeth_determine_capabilities()
5024 QETH_CARD_TEXT_(card, 2, "6err%d", rc); in qeth_determine_capabilities()
5026 QETH_CARD_TEXT_(card, 2, "qfmt%d", card->ssqd.qfmt); in qeth_determine_capabilities()
5027 QETH_CARD_TEXT_(card, 2, "ac1:%02x", card->ssqd.qdioac1); in qeth_determine_capabilities()
5028 QETH_CARD_TEXT_(card, 2, "ac2:%04x", card->ssqd.qdioac2); in qeth_determine_capabilities()
5029 QETH_CARD_TEXT_(card, 2, "ac3:%04x", card->ssqd.qdioac3); in qeth_determine_capabilities()
5030 QETH_CARD_TEXT_(card, 2, "icnt%d", card->ssqd.icnt); in qeth_determine_capabilities()
5031 if (!((card->ssqd.qfmt != QDIO_IQDIO_QFMT) || in qeth_determine_capabilities()
5032 ((card->ssqd.qdioac1 & CHSC_AC1_INITIATE_INPUTQ) == 0) || in qeth_determine_capabilities()
5033 ((card->ssqd.qdioac3 & CHSC_AC3_FORMAT2_CQ_AVAILABLE) == 0))) { in qeth_determine_capabilities()
5034 dev_info(&card->gdev->dev, in qeth_determine_capabilities()
5037 card->options.cq = QETH_CQ_NOTAVAILABLE; in qeth_determine_capabilities()
5047 static void qeth_read_ccw_conf_data(struct qeth_card *card) in qeth_read_ccw_conf_data() argument
5049 struct qeth_card_info *info = &card->info; in qeth_read_ccw_conf_data()
5050 struct ccw_device *cdev = CARD_DDEV(card); in qeth_read_ccw_conf_data()
5053 QETH_CARD_TEXT(card, 2, "ccwconfd"); in qeth_read_ccw_conf_data()
5062 dev_info(&card->gdev->dev, "CHID: %x CHPID: %x\n", in qeth_read_ccw_conf_data()
5065 QETH_CARD_TEXT_(card, 3, "devn%x", info->ddev_devno); in qeth_read_ccw_conf_data()
5066 QETH_CARD_TEXT_(card, 3, "cssid:%x", info->cssid); in qeth_read_ccw_conf_data()
5067 QETH_CARD_TEXT_(card, 3, "iid:%x", info->iid); in qeth_read_ccw_conf_data()
5068 QETH_CARD_TEXT_(card, 3, "ssid:%x", info->ssid); in qeth_read_ccw_conf_data()
5069 QETH_CARD_TEXT_(card, 3, "chpid:%x", info->chpid); in qeth_read_ccw_conf_data()
5070 QETH_CARD_TEXT_(card, 3, "chid:%x", info->chid); in qeth_read_ccw_conf_data()
5071 QETH_CARD_TEXT_(card, 3, "idval%x", info->ids_valid); in qeth_read_ccw_conf_data()
5074 static int qeth_qdio_establish(struct qeth_card *card) in qeth_qdio_establish() argument
5084 QETH_CARD_TEXT(card, 2, "qdioest"); in qeth_qdio_establish()
5086 if (!IS_IQD(card) && !IS_VM_NIC(card)) { in qeth_qdio_establish()
5091 qeth_fill_qib_parms(card, qib_parms); in qeth_qdio_establish()
5094 in_sbal_ptrs[0] = card->qdio.in_q->qdio_bufs; in qeth_qdio_establish()
5095 if (card->options.cq == QETH_CQ_ENABLED) { in qeth_qdio_establish()
5096 in_sbal_ptrs[1] = card->qdio.c_q->qdio_bufs; in qeth_qdio_establish()
5100 for (i = 0; i < card->qdio.no_out_queues; i++) in qeth_qdio_establish()
5101 out_sbal_ptrs[i] = card->qdio.out_qs[i]->qdio_bufs; in qeth_qdio_establish()
5104 init_data.q_format = IS_IQD(card) ? QDIO_IQDIO_QFMT : in qeth_qdio_establish()
5109 init_data.no_output_qs = card->qdio.no_out_queues; in qeth_qdio_establish()
5113 init_data.int_parm = (unsigned long) card; in qeth_qdio_establish()
5117 if (atomic_cmpxchg(&card->qdio.state, QETH_QDIO_ALLOCATED, in qeth_qdio_establish()
5119 rc = qdio_allocate(CARD_DDEV(card), init_data.no_input_qs, in qeth_qdio_establish()
5122 atomic_set(&card->qdio.state, QETH_QDIO_ALLOCATED); in qeth_qdio_establish()
5125 rc = qdio_establish(CARD_DDEV(card), &init_data); in qeth_qdio_establish()
5127 atomic_set(&card->qdio.state, QETH_QDIO_ALLOCATED); in qeth_qdio_establish()
5128 qdio_free(CARD_DDEV(card)); in qeth_qdio_establish()
5132 switch (card->options.cq) { in qeth_qdio_establish()
5134 dev_info(&card->gdev->dev, "Completion Queue support enabled"); in qeth_qdio_establish()
5137 dev_info(&card->gdev->dev, "Completion Queue support disabled"); in qeth_qdio_establish()
5148 static void qeth_core_free_card(struct qeth_card *card) in qeth_core_free_card() argument
5150 QETH_CARD_TEXT(card, 2, "freecrd"); in qeth_core_free_card()
5152 unregister_service_level(&card->qeth_service_level); in qeth_core_free_card()
5153 debugfs_remove_recursive(card->debugfs); in qeth_core_free_card()
5154 qeth_put_cmd(card->read_cmd); in qeth_core_free_card()
5155 destroy_workqueue(card->event_wq); in qeth_core_free_card()
5156 dev_set_drvdata(&card->gdev->dev, NULL); in qeth_core_free_card()
5157 kfree(card); in qeth_core_free_card()
5160 static void qeth_trace_features(struct qeth_card *card) in qeth_trace_features() argument
5162 QETH_CARD_TEXT(card, 2, "features"); in qeth_trace_features()
5163 QETH_CARD_HEX(card, 2, &card->options.ipa4, sizeof(card->options.ipa4)); in qeth_trace_features()
5164 QETH_CARD_HEX(card, 2, &card->options.ipa6, sizeof(card->options.ipa6)); in qeth_trace_features()
5165 QETH_CARD_HEX(card, 2, &card->options.adp, sizeof(card->options.adp)); in qeth_trace_features()
5166 QETH_CARD_HEX(card, 2, &card->info.diagass_support, in qeth_trace_features()
5167 sizeof(card->info.diagass_support)); in qeth_trace_features()
5195 static int qeth_hardsetup_card(struct qeth_card *card, bool *carrier_ok) in qeth_hardsetup_card() argument
5200 QETH_CARD_TEXT(card, 2, "hrdsetup"); in qeth_hardsetup_card()
5201 atomic_set(&card->force_alloc_skb, 0); in qeth_hardsetup_card()
5202 rc = qeth_update_from_chp_desc(card); in qeth_hardsetup_card()
5208 CARD_DEVID(card)); in qeth_hardsetup_card()
5209 rc = qeth_qdio_clear_card(card, !IS_IQD(card)); in qeth_hardsetup_card()
5210 qeth_stop_channel(&card->data); in qeth_hardsetup_card()
5211 qeth_stop_channel(&card->write); in qeth_hardsetup_card()
5212 qeth_stop_channel(&card->read); in qeth_hardsetup_card()
5213 qdio_free(CARD_DDEV(card)); in qeth_hardsetup_card()
5215 rc = qeth_start_channel(&card->read); in qeth_hardsetup_card()
5218 rc = qeth_start_channel(&card->write); in qeth_hardsetup_card()
5221 rc = qeth_start_channel(&card->data); in qeth_hardsetup_card()
5226 QETH_CARD_TEXT(card, 2, "break1"); in qeth_hardsetup_card()
5229 QETH_CARD_TEXT_(card, 2, "1err%d", rc); in qeth_hardsetup_card()
5236 qeth_determine_capabilities(card); in qeth_hardsetup_card()
5237 qeth_read_ccw_conf_data(card); in qeth_hardsetup_card()
5238 qeth_idx_init(card); in qeth_hardsetup_card()
5240 rc = qeth_idx_activate_read_channel(card); in qeth_hardsetup_card()
5242 QETH_CARD_TEXT(card, 2, "break2"); in qeth_hardsetup_card()
5245 QETH_CARD_TEXT_(card, 2, "3err%d", rc); in qeth_hardsetup_card()
5252 rc = qeth_idx_activate_write_channel(card); in qeth_hardsetup_card()
5254 QETH_CARD_TEXT(card, 2, "break3"); in qeth_hardsetup_card()
5257 QETH_CARD_TEXT_(card, 2, "4err%d", rc); in qeth_hardsetup_card()
5263 card->read_or_write_problem = 0; in qeth_hardsetup_card()
5264 rc = qeth_mpc_initialize(card); in qeth_hardsetup_card()
5266 QETH_CARD_TEXT_(card, 2, "5err%d", rc); in qeth_hardsetup_card()
5270 rc = qeth_send_startlan(card); in qeth_hardsetup_card()
5272 QETH_CARD_TEXT_(card, 2, "6err%d", rc); in qeth_hardsetup_card()
5274 dev_warn(&card->gdev->dev, "The LAN is offline\n"); in qeth_hardsetup_card()
5283 card->options.ipa4.supported = 0; in qeth_hardsetup_card()
5284 card->options.ipa6.supported = 0; in qeth_hardsetup_card()
5285 card->options.adp.supported = 0; in qeth_hardsetup_card()
5286 card->options.sbp.supported_funcs = 0; in qeth_hardsetup_card()
5287 card->info.diagass_support = 0; in qeth_hardsetup_card()
5288 rc = qeth_query_ipassists(card, QETH_PROT_IPV4); in qeth_hardsetup_card()
5291 if (qeth_is_supported(card, IPA_IPV6)) { in qeth_hardsetup_card()
5292 rc = qeth_query_ipassists(card, QETH_PROT_IPV6); in qeth_hardsetup_card()
5296 if (qeth_is_supported(card, IPA_SETADAPTERPARMS)) { in qeth_hardsetup_card()
5297 rc = qeth_query_setadapterparms(card); in qeth_hardsetup_card()
5299 QETH_CARD_TEXT_(card, 2, "7err%d", rc); in qeth_hardsetup_card()
5303 if (qeth_adp_supported(card, IPA_SETADP_SET_DIAG_ASSIST)) { in qeth_hardsetup_card()
5304 rc = qeth_query_setdiagass(card); in qeth_hardsetup_card()
5306 QETH_CARD_TEXT_(card, 2, "8err%d", rc); in qeth_hardsetup_card()
5309 qeth_trace_features(card); in qeth_hardsetup_card()
5311 if (!qeth_is_diagass_supported(card, QETH_DIAGS_CMD_TRAP) || in qeth_hardsetup_card()
5312 (card->info.hwtrap && qeth_hw_trap(card, QETH_DIAGS_TRAP_ARM))) in qeth_hardsetup_card()
5313 card->info.hwtrap = 0; in qeth_hardsetup_card()
5315 if (card->options.isolation != ISOLATION_MODE_NONE) { in qeth_hardsetup_card()
5316 rc = qeth_setadpparms_set_access_ctrl(card, in qeth_hardsetup_card()
5317 card->options.isolation); in qeth_hardsetup_card()
5322 qeth_init_link_info(card); in qeth_hardsetup_card()
5324 rc = qeth_init_qdio_queues(card); in qeth_hardsetup_card()
5326 QETH_CARD_TEXT_(card, 2, "9err%d", rc); in qeth_hardsetup_card()
5332 dev_warn(&card->gdev->dev, "The qeth device driver failed to recover " in qeth_hardsetup_card()
5335 CARD_DEVID(card), rc); in qeth_hardsetup_card()
5339 static int qeth_set_online(struct qeth_card *card, in qeth_set_online() argument
5345 mutex_lock(&card->conf_mutex); in qeth_set_online()
5346 QETH_CARD_TEXT(card, 2, "setonlin"); in qeth_set_online()
5348 rc = qeth_hardsetup_card(card, &carrier_ok); in qeth_set_online()
5350 QETH_CARD_TEXT_(card, 2, "2err%04x", rc); in qeth_set_online()
5355 qeth_print_status_message(card); in qeth_set_online()
5357 if (card->dev->reg_state != NETREG_REGISTERED) in qeth_set_online()
5359 qeth_set_real_num_tx_queues(card, qeth_tx_actual_queues(card)); in qeth_set_online()
5361 rc = disc->set_online(card, carrier_ok); in qeth_set_online()
5366 kobject_uevent(&card->gdev->dev.kobj, KOBJ_CHANGE); in qeth_set_online()
5368 mutex_unlock(&card->conf_mutex); in qeth_set_online()
5373 qeth_qdio_clear_card(card, 0); in qeth_set_online()
5374 qeth_clear_working_pool_list(card); in qeth_set_online()
5375 qeth_flush_local_addrs(card); in qeth_set_online()
5377 qeth_stop_channel(&card->data); in qeth_set_online()
5378 qeth_stop_channel(&card->write); in qeth_set_online()
5379 qeth_stop_channel(&card->read); in qeth_set_online()
5380 qdio_free(CARD_DDEV(card)); in qeth_set_online()
5382 mutex_unlock(&card->conf_mutex); in qeth_set_online()
5386 int qeth_set_offline(struct qeth_card *card, const struct qeth_discipline *disc, in qeth_set_offline() argument
5391 mutex_lock(&card->conf_mutex); in qeth_set_offline()
5392 QETH_CARD_TEXT(card, 3, "setoffl"); in qeth_set_offline()
5394 if ((!resetting && card->info.hwtrap) || card->info.hwtrap == 2) { in qeth_set_offline()
5395 qeth_hw_trap(card, QETH_DIAGS_TRAP_DISARM); in qeth_set_offline()
5396 card->info.hwtrap = 1; in qeth_set_offline()
5400 qeth_clear_ipacmd_list(card); in qeth_set_offline()
5403 netif_device_detach(card->dev); in qeth_set_offline()
5404 netif_carrier_off(card->dev); in qeth_set_offline()
5407 cancel_work_sync(&card->rx_mode_work); in qeth_set_offline()
5409 disc->set_offline(card); in qeth_set_offline()
5411 qeth_qdio_clear_card(card, 0); in qeth_set_offline()
5412 qeth_drain_output_queues(card); in qeth_set_offline()
5413 qeth_clear_working_pool_list(card); in qeth_set_offline()
5414 qeth_flush_local_addrs(card); in qeth_set_offline()
5415 card->info.promisc_mode = 0; in qeth_set_offline()
5416 qeth_default_link_info(card); in qeth_set_offline()
5418 rc = qeth_stop_channel(&card->data); in qeth_set_offline()
5419 rc2 = qeth_stop_channel(&card->write); in qeth_set_offline()
5420 rc3 = qeth_stop_channel(&card->read); in qeth_set_offline()
5424 QETH_CARD_TEXT_(card, 2, "1err%d", rc); in qeth_set_offline()
5425 qdio_free(CARD_DDEV(card)); in qeth_set_offline()
5428 kobject_uevent(&card->gdev->dev.kobj, KOBJ_CHANGE); in qeth_set_offline()
5430 mutex_unlock(&card->conf_mutex); in qeth_set_offline()
5438 struct qeth_card *card = data; in qeth_do_reset() local
5442 disc = card->discipline; in qeth_do_reset()
5444 QETH_CARD_TEXT(card, 2, "recover1"); in qeth_do_reset()
5445 if (!qeth_do_run_thread(card, QETH_RECOVER_THREAD)) in qeth_do_reset()
5447 QETH_CARD_TEXT(card, 2, "recover2"); in qeth_do_reset()
5448 dev_warn(&card->gdev->dev, in qeth_do_reset()
5451 qeth_set_offline(card, disc, true); in qeth_do_reset()
5452 rc = qeth_set_online(card, disc); in qeth_do_reset()
5454 dev_info(&card->gdev->dev, in qeth_do_reset()
5457 qeth_set_offline(card, disc, true); in qeth_do_reset()
5458 ccwgroup_set_offline(card->gdev, false); in qeth_do_reset()
5459 dev_warn(&card->gdev->dev, in qeth_do_reset()
5462 qeth_clear_thread_start_bit(card, QETH_RECOVER_THREAD); in qeth_do_reset()
5463 qeth_clear_thread_running_bit(card, QETH_RECOVER_THREAD); in qeth_do_reset()
5468 static void qeth_l3_rebuild_skb(struct qeth_card *card, struct sk_buff *skb, in qeth_l3_rebuild_skb() argument
5475 if (IS_IQD(card) && iucv->magic == ETH_P_AF_IUCV) { in qeth_l3_rebuild_skb()
5493 QETH_CARD_STAT_INC(card, rx_multicast); in qeth_l3_rebuild_skb()
5497 QETH_CARD_STAT_INC(card, rx_multicast); in qeth_l3_rebuild_skb()
5500 if (card->options.sniffer) in qeth_l3_rebuild_skb()
5514 if (!card->options.sniffer && in qeth_l3_rebuild_skb()
5526 static void qeth_receive_skb(struct qeth_card *card, struct sk_buff *skb, in qeth_receive_skb() argument
5529 struct napi_struct *napi = &card->napi; in qeth_receive_skb()
5531 if (is_cso && (card->dev->features & NETIF_F_RXCSUM)) { in qeth_receive_skb()
5533 QETH_CARD_STAT_INC(card, rx_skb_csum); in qeth_receive_skb()
5538 QETH_CARD_STAT_ADD(card, rx_bytes, skb->len); in qeth_receive_skb()
5539 QETH_CARD_STAT_INC(card, rx_packets); in qeth_receive_skb()
5541 QETH_CARD_STAT_INC(card, rx_sg_skbs); in qeth_receive_skb()
5542 QETH_CARD_STAT_ADD(card, rx_sg_frags, in qeth_receive_skb()
5570 static int qeth_extract_skb(struct qeth_card *card, in qeth_extract_skb() argument
5574 struct qeth_priv *priv = netdev_priv(card->dev); in qeth_extract_skb()
5576 struct napi_struct *napi = &card->napi; in qeth_extract_skb()
5615 if (!IS_LAYER3(card)) { in qeth_extract_skb()
5616 QETH_CARD_STAT_INC(card, rx_dropped_notsupp); in qeth_extract_skb()
5634 QETH_CARD_STAT_INC(card, rx_frame_errors); in qeth_extract_skb()
5636 QETH_CARD_STAT_INC(card, rx_dropped_notsupp); in qeth_extract_skb()
5643 QETH_CARD_STAT_INC(card, rx_dropped_runt); in qeth_extract_skb()
5647 use_rx_sg = (card->options.cq == QETH_CQ_ENABLED) || in qeth_extract_skb()
5649 !atomic_read(&card->force_alloc_skb)); in qeth_extract_skb()
5663 QETH_CARD_STAT_INC(card, rx_dropped_nomem); in qeth_extract_skb()
5672 netdev_info_once(card->dev, in qeth_extract_skb()
5681 QETH_CARD_STAT_INC(card, rx_dropped_nomem); in qeth_extract_skb()
5717 QETH_CARD_TEXT(card, 4, "unexeob"); in qeth_extract_skb()
5718 QETH_CARD_HEX(card, 2, buffer, sizeof(void *)); in qeth_extract_skb()
5724 QETH_CARD_STAT_INC(card, in qeth_extract_skb()
5743 qeth_l3_rebuild_skb(card, skb, hdr); in qeth_extract_skb()
5746 qeth_receive_skb(card, skb, uses_frags, is_cso); in qeth_extract_skb()
5750 static unsigned int qeth_extract_skbs(struct qeth_card *card, int budget, in qeth_extract_skbs() argument
5756 if (qeth_extract_skb(card, buf, &card->rx.buf_element, in qeth_extract_skbs()
5757 &card->rx.e_offset)) { in qeth_extract_skbs()
5769 static unsigned int qeth_rx_poll(struct qeth_card *card, int budget) in qeth_rx_poll() argument
5771 struct qeth_rx *ctx = &card->rx; in qeth_rx_poll()
5780 if (!card->rx.b_count) { in qeth_rx_poll()
5781 card->rx.qdio_err = 0; in qeth_rx_poll()
5782 card->rx.b_count = in qeth_rx_poll()
5783 qdio_inspect_input_queue(CARD_DDEV(card), 0, in qeth_rx_poll()
5784 &card->rx.b_index, in qeth_rx_poll()
5785 &card->rx.qdio_err); in qeth_rx_poll()
5786 if (card->rx.b_count <= 0) { in qeth_rx_poll()
5787 card->rx.b_count = 0; in qeth_rx_poll()
5793 buffer = &card->qdio.in_q->bufs[card->rx.b_index]; in qeth_rx_poll()
5794 if (!(card->rx.qdio_err && in qeth_rx_poll()
5795 qeth_check_qdio_errors(card, buffer->buffer, in qeth_rx_poll()
5796 card->rx.qdio_err, "qinerr"))) in qeth_rx_poll()
5797 skbs_done = qeth_extract_skbs(card, budget, buffer, in qeth_rx_poll()
5806 QETH_CARD_STAT_INC(card, rx_bufs); in qeth_rx_poll()
5807 qeth_put_buffer_pool_entry(card, buffer->pool_entry); in qeth_rx_poll()
5809 card->rx.b_count--; in qeth_rx_poll()
5811 ctx->bufs_refill -= qeth_rx_refill_queue(card, in qeth_rx_poll()
5815 card->rx.b_index = QDIO_BUFNR(card->rx.b_index + 1); in qeth_rx_poll()
5816 card->rx.buf_element = 0; in qeth_rx_poll()
5817 card->rx.e_offset = 0; in qeth_rx_poll()
5824 static void qeth_cq_poll(struct qeth_card *card) in qeth_cq_poll() argument
5832 completed = qdio_inspect_input_queue(CARD_DDEV(card), 1, &start, in qeth_cq_poll()
5837 qeth_qdio_cq_handler(card, error, 1, start, completed); in qeth_cq_poll()
5844 struct qeth_card *card = container_of(napi, struct qeth_card, napi); in qeth_poll() local
5847 work_done = qeth_rx_poll(card, budget); in qeth_poll()
5849 if (qeth_use_tx_irqs(card)) { in qeth_poll()
5853 qeth_for_each_output_queue(card, queue, i) { in qeth_poll()
5859 if (card->options.cq == QETH_CQ_ENABLED) in qeth_poll()
5860 qeth_cq_poll(card); in qeth_poll()
5863 struct qeth_rx *ctx = &card->rx; in qeth_poll()
5866 ctx->bufs_refill -= qeth_rx_refill_queue(card, ctx->bufs_refill); in qeth_poll()
5874 qdio_start_irq(CARD_DDEV(card))) in qeth_poll()
5887 struct qeth_card *card = queue->card; in qeth_iqd_tx_complete() local
5896 netdev_WARN_ONCE(card->dev, in qeth_iqd_tx_complete()
5899 qeth_schedule_recovery(card); in qeth_iqd_tx_complete()
5903 QETH_CARD_TEXT_(card, 5, "pel%u", bidx); in qeth_iqd_tx_complete()
5913 QETH_CARD_TEXT(card, 2, "outofbuf"); in qeth_iqd_tx_complete()
5914 qeth_schedule_recovery(card); in qeth_iqd_tx_complete()
5927 } else if (card->options.cq == QETH_CQ_ENABLED) { in qeth_iqd_tx_complete()
5939 struct qeth_card *card = queue->card; in qeth_tx_poll() local
5940 struct net_device *dev = card->dev; in qeth_tx_poll()
5944 if (IS_IQD(card)) in qeth_tx_poll()
5955 qeth_tx_complete_pending_bufs(card, queue, false, budget); in qeth_tx_poll()
5970 completed = qdio_inspect_output_queue(CARD_DDEV(card), queue_no, in qeth_tx_poll()
5988 qeth_handle_send_error(card, buffer, error); in qeth_tx_poll()
5989 if (IS_IQD(card)) in qeth_tx_poll()
5998 if (IS_IQD(card)) in qeth_tx_poll()
6021 static int qeth_setassparms_get_caps_cb(struct qeth_card *card, in qeth_setassparms_get_caps_cb() argument
6036 int qeth_setassparms_cb(struct qeth_card *card, in qeth_setassparms_cb() argument
6041 QETH_CARD_TEXT(card, 4, "defadpcb"); in qeth_setassparms_cb()
6048 card->options.ipa4.enabled = cmd->hdr.assists.enabled; in qeth_setassparms_cb()
6050 card->options.ipa6.enabled = cmd->hdr.assists.enabled; in qeth_setassparms_cb()
6055 struct qeth_cmd_buffer *qeth_get_setassparms_cmd(struct qeth_card *card, in qeth_get_setassparms_cmd() argument
6065 QETH_CARD_TEXT(card, 4, "getasscm"); in qeth_get_setassparms_cmd()
6066 iob = qeth_ipa_alloc_cmd(card, IPA_CMD_SETASSPARMS, prot, in qeth_get_setassparms_cmd()
6083 int qeth_send_simple_setassparms_prot(struct qeth_card *card, in qeth_send_simple_setassparms_prot() argument
6091 QETH_CARD_TEXT_(card, 4, "simassp%i", prot); in qeth_send_simple_setassparms_prot()
6092 iob = qeth_get_setassparms_cmd(card, ipa_func, cmd_code, length, prot); in qeth_send_simple_setassparms_prot()
6098 return qeth_send_ipa_cmd(card, iob, qeth_setassparms_cb, NULL); in qeth_send_simple_setassparms_prot()
6158 int qeth_setup_discipline(struct qeth_card *card, in qeth_setup_discipline() argument
6166 card->discipline = try_then_request_module( in qeth_setup_discipline()
6170 card->discipline = try_then_request_module( in qeth_setup_discipline()
6178 if (!card->discipline) { in qeth_setup_discipline()
6179 dev_err(&card->gdev->dev, "There is no kernel module to " in qeth_setup_discipline()
6184 rc = card->discipline->setup(card->gdev); in qeth_setup_discipline()
6190 card->discipline = NULL; in qeth_setup_discipline()
6195 card->options.layer = discipline; in qeth_setup_discipline()
6199 void qeth_remove_discipline(struct qeth_card *card) in qeth_remove_discipline() argument
6201 card->discipline->remove(card->gdev); in qeth_remove_discipline()
6203 if (IS_LAYER2(card)) in qeth_remove_discipline()
6207 card->options.layer = QETH_DISCIPLINE_UNDETERMINED; in qeth_remove_discipline()
6208 card->discipline = NULL; in qeth_remove_discipline()
6242 static int qeth_add_dbf_entry(struct qeth_card *card, char *name) in qeth_add_dbf_entry() argument
6246 card->debug = debug_register(name, 2, 1, 8); in qeth_add_dbf_entry()
6247 if (!card->debug) { in qeth_add_dbf_entry()
6251 if (debug_register_view(card->debug, &debug_hex_ascii_view)) in qeth_add_dbf_entry()
6257 new_entry->dbf_info = card->debug; in qeth_add_dbf_entry()
6265 debug_unregister(card->debug); in qeth_add_dbf_entry()
6283 static struct net_device *qeth_alloc_netdev(struct qeth_card *card) in qeth_alloc_netdev() argument
6288 switch (card->info.type) { in qeth_alloc_netdev()
6305 priv->tx_wanted_queues = IS_IQD(card) ? QETH_IQD_MIN_TXQ : 1; in qeth_alloc_netdev()
6307 dev->ml_priv = card; in qeth_alloc_netdev()
6313 SET_NETDEV_DEV(dev, &card->gdev->dev); in qeth_alloc_netdev()
6320 if (IS_IQD(card)) in qeth_alloc_netdev()
6339 struct qeth_card *card; in qeth_core_probe_device() local
6353 card = qeth_alloc_card(gdev); in qeth_core_probe_device()
6354 if (!card) { in qeth_core_probe_device()
6362 card->debug = qeth_get_dbf_entry(dbf_name); in qeth_core_probe_device()
6363 if (!card->debug) { in qeth_core_probe_device()
6364 rc = qeth_add_dbf_entry(card, dbf_name); in qeth_core_probe_device()
6369 qeth_setup_card(card); in qeth_core_probe_device()
6370 card->dev = qeth_alloc_netdev(card); in qeth_core_probe_device()
6371 if (!card->dev) { in qeth_core_probe_device()
6376 qeth_determine_capabilities(card); in qeth_core_probe_device()
6377 qeth_set_blkt_defaults(card); in qeth_core_probe_device()
6379 card->qdio.in_q = qeth_alloc_qdio_queue(); in qeth_core_probe_device()
6380 if (!card->qdio.in_q) { in qeth_core_probe_device()
6385 card->qdio.no_out_queues = card->dev->num_tx_queues; in qeth_core_probe_device()
6386 rc = qeth_update_from_chp_desc(card); in qeth_core_probe_device()
6392 enforced_disc = qeth_enforce_discipline(card); in qeth_core_probe_device()
6398 card->info.layer_enforced = true; in qeth_core_probe_device()
6400 rc = qeth_setup_discipline(card, enforced_disc); in qeth_core_probe_device()
6411 qeth_free_qdio_queue(card->qdio.in_q); in qeth_core_probe_device()
6413 free_netdev(card->dev); in qeth_core_probe_device()
6415 qeth_core_free_card(card); in qeth_core_probe_device()
6423 struct qeth_card *card = dev_get_drvdata(&gdev->dev); in qeth_core_remove_device() local
6425 QETH_CARD_TEXT(card, 2, "removedv"); in qeth_core_remove_device()
6427 mutex_lock(&card->discipline_mutex); in qeth_core_remove_device()
6428 if (card->discipline) in qeth_core_remove_device()
6429 qeth_remove_discipline(card); in qeth_core_remove_device()
6430 mutex_unlock(&card->discipline_mutex); in qeth_core_remove_device()
6432 qeth_free_qdio_queues(card); in qeth_core_remove_device()
6434 qeth_free_qdio_queue(card->qdio.in_q); in qeth_core_remove_device()
6435 free_netdev(card->dev); in qeth_core_remove_device()
6436 qeth_core_free_card(card); in qeth_core_remove_device()
6442 struct qeth_card *card = dev_get_drvdata(&gdev->dev); in qeth_core_set_online() local
6446 mutex_lock(&card->discipline_mutex); in qeth_core_set_online()
6447 if (!card->discipline) { in qeth_core_set_online()
6448 def_discipline = IS_IQD(card) ? QETH_DISCIPLINE_LAYER3 : in qeth_core_set_online()
6450 rc = qeth_setup_discipline(card, def_discipline); in qeth_core_set_online()
6455 rc = qeth_set_online(card, card->discipline); in qeth_core_set_online()
6458 mutex_unlock(&card->discipline_mutex); in qeth_core_set_online()
6464 struct qeth_card *card = dev_get_drvdata(&gdev->dev); in qeth_core_set_offline() local
6467 mutex_lock(&card->discipline_mutex); in qeth_core_set_offline()
6468 rc = qeth_set_offline(card, card->discipline, false); in qeth_core_set_offline()
6469 mutex_unlock(&card->discipline_mutex); in qeth_core_set_offline()
6476 struct qeth_card *card = dev_get_drvdata(&gdev->dev); in qeth_core_shutdown() local
6478 qeth_set_allowed_threads(card, 0, 1); in qeth_core_shutdown()
6479 if ((gdev->state == CCWGROUP_ONLINE) && card->info.hwtrap) in qeth_core_shutdown()
6480 qeth_hw_trap(card, QETH_DIAGS_TRAP_DISARM); in qeth_core_shutdown()
6481 qeth_qdio_clear_card(card, 0); in qeth_core_shutdown()
6482 qeth_drain_output_queues(card); in qeth_core_shutdown()
6483 qdio_free(CARD_DDEV(card)); in qeth_core_shutdown()
6526 struct qeth_card *card = dev->ml_priv; in qeth_siocdevprivate() local
6531 rc = qeth_snmp_command(card, data); in qeth_siocdevprivate()
6534 if ((IS_OSD(card) || IS_OSM(card) || IS_OSX(card)) && in qeth_siocdevprivate()
6535 !IS_VM_NIC(card)) in qeth_siocdevprivate()
6539 rc = qeth_query_oat_command(card, data); in qeth_siocdevprivate()
6545 QETH_CARD_TEXT_(card, 2, "ioce%x", rc); in qeth_siocdevprivate()
6552 struct qeth_card *card = dev->ml_priv; in qeth_do_ioctl() local
6573 QETH_CARD_TEXT_(card, 2, "ioce%x", rc); in qeth_do_ioctl()
6578 static int qeth_start_csum_cb(struct qeth_card *card, struct qeth_reply *reply, in qeth_start_csum_cb() argument
6591 static int qeth_set_csum_off(struct qeth_card *card, enum qeth_ipa_funcs cstype, in qeth_set_csum_off() argument
6594 return qeth_send_simple_setassparms_prot(card, cstype, IPA_CMD_ASS_STOP, in qeth_set_csum_off()
6598 static int qeth_set_csum_on(struct qeth_card *card, enum qeth_ipa_funcs cstype, in qeth_set_csum_on() argument
6608 if (IS_LAYER3(card) && prot == QETH_PROT_IPV4 && in qeth_set_csum_on()
6612 iob = qeth_get_setassparms_cmd(card, cstype, IPA_CMD_ASS_START, 0, in qeth_set_csum_on()
6617 rc = qeth_send_ipa_cmd(card, iob, qeth_start_csum_cb, &features); in qeth_set_csum_on()
6622 qeth_set_csum_off(card, cstype, prot); in qeth_set_csum_on()
6626 iob = qeth_get_setassparms_cmd(card, cstype, IPA_CMD_ASS_ENABLE, in qeth_set_csum_on()
6630 qeth_set_csum_off(card, cstype, prot); in qeth_set_csum_on()
6637 rc = qeth_send_ipa_cmd(card, iob, qeth_setassparms_get_caps_cb, &caps); in qeth_set_csum_on()
6639 qeth_set_csum_off(card, cstype, prot); in qeth_set_csum_on()
6645 qeth_set_csum_off(card, cstype, prot); in qeth_set_csum_on()
6649 dev_info(&card->gdev->dev, "HW Checksumming (%sbound IPv%d) enabled\n", in qeth_set_csum_on()
6658 static int qeth_set_ipa_csum(struct qeth_card *card, bool on, int cstype, in qeth_set_ipa_csum() argument
6661 return on ? qeth_set_csum_on(card, cstype, prot, lp2lp) : in qeth_set_ipa_csum()
6662 qeth_set_csum_off(card, cstype, prot); in qeth_set_ipa_csum()
6665 static int qeth_start_tso_cb(struct qeth_card *card, struct qeth_reply *reply, in qeth_start_tso_cb() argument
6679 static int qeth_set_tso_off(struct qeth_card *card, in qeth_set_tso_off() argument
6682 return qeth_send_simple_setassparms_prot(card, IPA_OUTBOUND_TSO, in qeth_set_tso_off()
6686 static int qeth_set_tso_on(struct qeth_card *card, in qeth_set_tso_on() argument
6694 iob = qeth_get_setassparms_cmd(card, IPA_OUTBOUND_TSO, in qeth_set_tso_on()
6699 rc = qeth_send_ipa_cmd(card, iob, qeth_start_tso_cb, &tso_data); in qeth_set_tso_on()
6704 qeth_set_tso_off(card, prot); in qeth_set_tso_on()
6708 iob = qeth_get_setassparms_cmd(card, IPA_OUTBOUND_TSO, in qeth_set_tso_on()
6712 qeth_set_tso_off(card, prot); in qeth_set_tso_on()
6719 rc = qeth_send_ipa_cmd(card, iob, qeth_setassparms_get_caps_cb, &caps); in qeth_set_tso_on()
6721 qeth_set_tso_off(card, prot); in qeth_set_tso_on()
6727 qeth_set_tso_off(card, prot); in qeth_set_tso_on()
6731 dev_info(&card->gdev->dev, "TSOv%u enabled (MSS: %u)\n", prot, in qeth_set_tso_on()
6736 static int qeth_set_ipa_tso(struct qeth_card *card, bool on, in qeth_set_ipa_tso() argument
6739 return on ? qeth_set_tso_on(card, prot) : qeth_set_tso_off(card, prot); in qeth_set_ipa_tso()
6742 static int qeth_set_ipa_rx_csum(struct qeth_card *card, bool on) in qeth_set_ipa_rx_csum() argument
6747 if (qeth_is_supported(card, IPA_INBOUND_CHECKSUM)) in qeth_set_ipa_rx_csum()
6748 rc_ipv4 = qeth_set_ipa_csum(card, on, IPA_INBOUND_CHECKSUM, in qeth_set_ipa_rx_csum()
6750 if (!qeth_is_supported6(card, IPA_INBOUND_CHECKSUM_V6)) in qeth_set_ipa_rx_csum()
6754 rc_ipv6 = qeth_set_ipa_csum(card, on, IPA_INBOUND_CHECKSUM, in qeth_set_ipa_rx_csum()
6771 struct qeth_card *card = dev->ml_priv; in qeth_enable_hw_features() local
6780 if (IS_LAYER2(card) && IS_VM_NIC(card)) { in qeth_enable_hw_features()
6786 dev_warn(&card->gdev->dev, in qeth_enable_hw_features()
6791 static void qeth_check_restricted_features(struct qeth_card *card, in qeth_check_restricted_features() argument
6798 if (!card->info.has_lp2lp_cso_v6) in qeth_check_restricted_features()
6800 if (!card->info.has_lp2lp_cso_v4) in qeth_check_restricted_features()
6804 qeth_flush_local_addrs6(card); in qeth_check_restricted_features()
6806 qeth_flush_local_addrs4(card); in qeth_check_restricted_features()
6811 struct qeth_card *card = dev->ml_priv; in qeth_set_features() local
6815 QETH_CARD_TEXT(card, 2, "setfeat"); in qeth_set_features()
6816 QETH_CARD_HEX(card, 2, &features, sizeof(features)); in qeth_set_features()
6819 rc = qeth_set_ipa_csum(card, features & NETIF_F_IP_CSUM, in qeth_set_features()
6821 &card->info.has_lp2lp_cso_v4); in qeth_set_features()
6826 rc = qeth_set_ipa_csum(card, features & NETIF_F_IPV6_CSUM, in qeth_set_features()
6828 &card->info.has_lp2lp_cso_v6); in qeth_set_features()
6833 rc = qeth_set_ipa_rx_csum(card, features & NETIF_F_RXCSUM); in qeth_set_features()
6838 rc = qeth_set_ipa_tso(card, features & NETIF_F_TSO, in qeth_set_features()
6844 rc = qeth_set_ipa_tso(card, features & NETIF_F_TSO6, in qeth_set_features()
6850 qeth_check_restricted_features(card, dev->features ^ features, in qeth_set_features()
6865 struct qeth_card *card = dev->ml_priv; in qeth_fix_features() local
6867 QETH_CARD_TEXT(card, 2, "fixfeat"); in qeth_fix_features()
6868 if (!qeth_is_supported(card, IPA_OUTBOUND_CHECKSUM)) in qeth_fix_features()
6870 if (!qeth_is_supported6(card, IPA_OUTBOUND_CHECKSUM_V6)) in qeth_fix_features()
6872 if (!qeth_is_supported(card, IPA_INBOUND_CHECKSUM) && in qeth_fix_features()
6873 !qeth_is_supported6(card, IPA_INBOUND_CHECKSUM_V6)) in qeth_fix_features()
6875 if (!qeth_is_supported(card, IPA_OUTBOUND_TSO)) in qeth_fix_features()
6877 if (!qeth_is_supported6(card, IPA_OUTBOUND_TSO)) in qeth_fix_features()
6880 QETH_CARD_HEX(card, 2, &features, sizeof(features)); in qeth_fix_features()
6889 struct qeth_card *card = dev->ml_priv; in qeth_features_check() local
6893 READ_ONCE(card->options.isolation) != ISOLATION_MODE_FWD) { in qeth_features_check()
6901 if (!card->info.has_lp2lp_cso_v4) in qeth_features_check()
6904 if (restricted && qeth_next_hop_is_local_v4(card, skb)) in qeth_features_check()
6908 if (!card->info.has_lp2lp_cso_v6) in qeth_features_check()
6911 if (restricted && qeth_next_hop_is_local_v6(card, skb)) in qeth_features_check()
6943 struct qeth_card *card = dev->ml_priv; in qeth_get_stats64() local
6947 QETH_CARD_TEXT(card, 5, "getstat"); in qeth_get_stats64()
6949 stats->rx_packets = card->stats.rx_packets; in qeth_get_stats64()
6950 stats->rx_bytes = card->stats.rx_bytes; in qeth_get_stats64()
6951 stats->rx_errors = card->stats.rx_length_errors + in qeth_get_stats64()
6952 card->stats.rx_frame_errors + in qeth_get_stats64()
6953 card->stats.rx_fifo_errors; in qeth_get_stats64()
6954 stats->rx_dropped = card->stats.rx_dropped_nomem + in qeth_get_stats64()
6955 card->stats.rx_dropped_notsupp + in qeth_get_stats64()
6956 card->stats.rx_dropped_runt; in qeth_get_stats64()
6957 stats->multicast = card->stats.rx_multicast; in qeth_get_stats64()
6958 stats->rx_length_errors = card->stats.rx_length_errors; in qeth_get_stats64()
6959 stats->rx_frame_errors = card->stats.rx_frame_errors; in qeth_get_stats64()
6960 stats->rx_fifo_errors = card->stats.rx_fifo_errors; in qeth_get_stats64()
6962 for (i = 0; i < card->qdio.no_out_queues; i++) { in qeth_get_stats64()
6963 queue = card->qdio.out_qs[i]; in qeth_get_stats64()
6997 int qeth_set_real_num_tx_queues(struct qeth_card *card, unsigned int count) in qeth_set_real_num_tx_queues() argument
6999 struct net_device *dev = card->dev; in qeth_set_real_num_tx_queues()
7003 if (IS_IQD(card)) in qeth_set_real_num_tx_queues()
7008 if (rc && IS_IQD(card)) in qeth_set_real_num_tx_queues()
7033 struct qeth_card *card = dev->ml_priv; in qeth_osa_select_queue() local
7035 if (qeth_uses_tx_prio_queueing(card)) in qeth_osa_select_queue()
7036 return qeth_get_priority_queue(card, skb); in qeth_osa_select_queue()
7044 struct qeth_card *card = dev->ml_priv; in qeth_open() local
7048 QETH_CARD_TEXT(card, 4, "qethopen"); in qeth_open()
7050 card->data.state = CH_STATE_UP; in qeth_open()
7054 qeth_for_each_output_queue(card, queue, i) { in qeth_open()
7060 napi_enable(&card->napi); in qeth_open()
7061 napi_schedule(&card->napi); in qeth_open()
7071 struct qeth_card *card = dev->ml_priv; in qeth_stop() local
7075 QETH_CARD_TEXT(card, 4, "qethstop"); in qeth_stop()
7077 napi_disable(&card->napi); in qeth_stop()
7078 cancel_delayed_work_sync(&card->buffer_reclaim_work); in qeth_stop()
7079 qdio_stop_irq(CARD_DDEV(card)); in qeth_stop()
7082 qeth_for_each_output_queue(card, queue, i) in qeth_stop()
7088 qeth_for_each_output_queue(card, queue, i) { in qeth_stop()