Lines Matching refs:card
38 struct qeth_card *card = dev->ml_priv; in qeth_l2_do_ioctl() local
42 if (!card) in qeth_l2_do_ioctl()
45 if ((card->state != CARD_STATE_UP) && in qeth_l2_do_ioctl()
46 (card->state != CARD_STATE_SOFTSETUP)) in qeth_l2_do_ioctl()
49 if (card->info.type == QETH_CARD_TYPE_OSN) in qeth_l2_do_ioctl()
54 rc = qeth_snmp_command(card, rq->ifr_ifru.ifru_data); in qeth_l2_do_ioctl()
57 if ((card->info.type == QETH_CARD_TYPE_OSD || in qeth_l2_do_ioctl()
58 card->info.type == QETH_CARD_TYPE_OSM || in qeth_l2_do_ioctl()
59 card->info.type == QETH_CARD_TYPE_OSX) && in qeth_l2_do_ioctl()
60 !card->info.guestlan) in qeth_l2_do_ioctl()
77 rc = qeth_query_oat_command(card, rq->ifr_ifru.ifru_data); in qeth_l2_do_ioctl()
83 QETH_CARD_TEXT_(card, 2, "ioce%d", rc); in qeth_l2_do_ioctl()
89 struct qeth_card *card; in qeth_l2_verify_dev() local
94 list_for_each_entry(card, &qeth_core_card_list.list, list) { in qeth_l2_verify_dev()
95 if (card->dev == dev) { in qeth_l2_verify_dev()
107 struct qeth_card *card; in qeth_l2_netdev_by_devno() local
116 list_for_each_entry(card, &qeth_core_card_list.list, list) { in qeth_l2_netdev_by_devno()
117 ccw_device_get_id(CARD_RDEV(card), &read_devid); in qeth_l2_netdev_by_devno()
119 ndev = card->dev; in qeth_l2_netdev_by_devno()
127 static int qeth_l2_send_setgroupmac_cb(struct qeth_card *card, in qeth_l2_send_setgroupmac_cb() argument
134 QETH_CARD_TEXT(card, 2, "L2Sgmacb"); in qeth_l2_send_setgroupmac_cb()
140 mac, QETH_CARD_IFNAME(card)); in qeth_l2_send_setgroupmac_cb()
145 mac, QETH_CARD_IFNAME(card), cmd->hdr.return_code); in qeth_l2_send_setgroupmac_cb()
149 static int qeth_l2_send_setgroupmac(struct qeth_card *card, __u8 *mac) in qeth_l2_send_setgroupmac() argument
151 QETH_CARD_TEXT(card, 2, "L2Sgmac"); in qeth_l2_send_setgroupmac()
152 return qeth_l2_send_setdelmac(card, mac, IPA_CMD_SETGMAC, in qeth_l2_send_setgroupmac()
156 static int qeth_l2_send_delgroupmac_cb(struct qeth_card *card, in qeth_l2_send_delgroupmac_cb() argument
163 QETH_CARD_TEXT(card, 2, "L2Dgmacb"); in qeth_l2_send_delgroupmac_cb()
168 mac, QETH_CARD_IFNAME(card), cmd->hdr.return_code); in qeth_l2_send_delgroupmac_cb()
172 static int qeth_l2_send_delgroupmac(struct qeth_card *card, __u8 *mac) in qeth_l2_send_delgroupmac() argument
174 QETH_CARD_TEXT(card, 2, "L2Dgmac"); in qeth_l2_send_delgroupmac()
175 return qeth_l2_send_setdelmac(card, mac, IPA_CMD_DELGMAC, in qeth_l2_send_delgroupmac()
179 static void qeth_l2_add_mc(struct qeth_card *card, __u8 *mac, int vmac) in qeth_l2_add_mc() argument
194 rc = qeth_l2_send_setdelmac(card, mac, IPA_CMD_SETVMAC, in qeth_l2_add_mc()
197 rc = qeth_l2_send_setgroupmac(card, mac); in qeth_l2_add_mc()
201 list_add_tail(&mc->list, &card->mc_list); in qeth_l2_add_mc()
206 static void qeth_l2_del_all_mc(struct qeth_card *card, int del) in qeth_l2_del_all_mc() argument
210 spin_lock_bh(&card->mclock); in qeth_l2_del_all_mc()
211 list_for_each_entry_safe(mc, tmp, &card->mc_list, list) { in qeth_l2_del_all_mc()
214 qeth_l2_send_setdelmac(card, mc->mc_addr, in qeth_l2_del_all_mc()
217 qeth_l2_send_delgroupmac(card, mc->mc_addr); in qeth_l2_del_all_mc()
222 spin_unlock_bh(&card->mclock); in qeth_l2_del_all_mc()
225 static inline int qeth_l2_get_cast_type(struct qeth_card *card, in qeth_l2_get_cast_type() argument
228 if (card->info.type == QETH_CARD_TYPE_OSN) in qeth_l2_get_cast_type()
237 static void qeth_l2_fill_header(struct qeth_card *card, struct qeth_hdr *hdr, in qeth_l2_fill_header() argument
263 static int qeth_l2_send_setdelvlan_cb(struct qeth_card *card, in qeth_l2_send_setdelvlan_cb() argument
268 QETH_CARD_TEXT(card, 2, "L2sdvcb"); in qeth_l2_send_setdelvlan_cb()
273 QETH_CARD_IFNAME(card), cmd->hdr.return_code); in qeth_l2_send_setdelvlan_cb()
274 QETH_CARD_TEXT_(card, 2, "L2VL%4x", cmd->hdr.command); in qeth_l2_send_setdelvlan_cb()
275 QETH_CARD_TEXT_(card, 2, "err%d", cmd->hdr.return_code); in qeth_l2_send_setdelvlan_cb()
280 static int qeth_l2_send_setdelvlan(struct qeth_card *card, __u16 i, in qeth_l2_send_setdelvlan() argument
286 QETH_CARD_TEXT_(card, 4, "L2sdv%x", ipacmd); in qeth_l2_send_setdelvlan()
287 iob = qeth_get_ipacmd_buffer(card, ipacmd, QETH_PROT_IPV4); in qeth_l2_send_setdelvlan()
290 return qeth_send_ipa_cmd(card, iob, in qeth_l2_send_setdelvlan()
294 static void qeth_l2_process_vlans(struct qeth_card *card) in qeth_l2_process_vlans() argument
297 QETH_CARD_TEXT(card, 3, "L2prcvln"); in qeth_l2_process_vlans()
298 spin_lock_bh(&card->vlanlock); in qeth_l2_process_vlans()
299 list_for_each_entry(id, &card->vid_list, list) { in qeth_l2_process_vlans()
300 qeth_l2_send_setdelvlan(card, id->vid, IPA_CMD_SETVLAN); in qeth_l2_process_vlans()
302 spin_unlock_bh(&card->vlanlock); in qeth_l2_process_vlans()
308 struct qeth_card *card = dev->ml_priv; in qeth_l2_vlan_rx_add_vid() local
311 QETH_CARD_TEXT_(card, 4, "aid:%d", vid); in qeth_l2_vlan_rx_add_vid()
314 if (card->info.type == QETH_CARD_TYPE_OSM) { in qeth_l2_vlan_rx_add_vid()
315 QETH_CARD_TEXT(card, 3, "aidOSM"); in qeth_l2_vlan_rx_add_vid()
318 if (qeth_wait_for_threads(card, QETH_RECOVER_THREAD)) { in qeth_l2_vlan_rx_add_vid()
319 QETH_CARD_TEXT(card, 3, "aidREC"); in qeth_l2_vlan_rx_add_vid()
325 qeth_l2_send_setdelvlan(card, vid, IPA_CMD_SETVLAN); in qeth_l2_vlan_rx_add_vid()
326 spin_lock_bh(&card->vlanlock); in qeth_l2_vlan_rx_add_vid()
327 list_add_tail(&id->list, &card->vid_list); in qeth_l2_vlan_rx_add_vid()
328 spin_unlock_bh(&card->vlanlock); in qeth_l2_vlan_rx_add_vid()
339 struct qeth_card *card = dev->ml_priv; in qeth_l2_vlan_rx_kill_vid() local
341 QETH_CARD_TEXT_(card, 4, "kid:%d", vid); in qeth_l2_vlan_rx_kill_vid()
342 if (card->info.type == QETH_CARD_TYPE_OSM) { in qeth_l2_vlan_rx_kill_vid()
343 QETH_CARD_TEXT(card, 3, "kidOSM"); in qeth_l2_vlan_rx_kill_vid()
346 if (qeth_wait_for_threads(card, QETH_RECOVER_THREAD)) { in qeth_l2_vlan_rx_kill_vid()
347 QETH_CARD_TEXT(card, 3, "kidREC"); in qeth_l2_vlan_rx_kill_vid()
350 spin_lock_bh(&card->vlanlock); in qeth_l2_vlan_rx_kill_vid()
351 list_for_each_entry(id, &card->vid_list, list) { in qeth_l2_vlan_rx_kill_vid()
358 spin_unlock_bh(&card->vlanlock); in qeth_l2_vlan_rx_kill_vid()
360 qeth_l2_send_setdelvlan(card, vid, IPA_CMD_DELVLAN); in qeth_l2_vlan_rx_kill_vid()
363 qeth_l2_set_multicast_list(card->dev); in qeth_l2_vlan_rx_kill_vid()
367 static int qeth_l2_stop_card(struct qeth_card *card, int recovery_mode) in qeth_l2_stop_card() argument
372 QETH_DBF_HEX(SETUP, 2, &card, sizeof(void *)); in qeth_l2_stop_card()
374 qeth_set_allowed_threads(card, 0, 1); in qeth_l2_stop_card()
375 if (card->read.state == CH_STATE_UP && in qeth_l2_stop_card()
376 card->write.state == CH_STATE_UP && in qeth_l2_stop_card()
377 (card->state == CARD_STATE_UP)) { in qeth_l2_stop_card()
379 card->info.type != QETH_CARD_TYPE_OSN) { in qeth_l2_stop_card()
380 qeth_l2_stop(card->dev); in qeth_l2_stop_card()
383 dev_close(card->dev); in qeth_l2_stop_card()
386 card->info.mac_bits &= ~QETH_LAYER2_MAC_REGISTERED; in qeth_l2_stop_card()
387 card->state = CARD_STATE_SOFTSETUP; in qeth_l2_stop_card()
389 if (card->state == CARD_STATE_SOFTSETUP) { in qeth_l2_stop_card()
390 qeth_l2_del_all_mc(card, 0); in qeth_l2_stop_card()
391 qeth_clear_ipacmd_list(card); in qeth_l2_stop_card()
392 card->state = CARD_STATE_HARDSETUP; in qeth_l2_stop_card()
394 if (card->state == CARD_STATE_HARDSETUP) { in qeth_l2_stop_card()
395 qeth_qdio_clear_card(card, 0); in qeth_l2_stop_card()
396 qeth_clear_qdio_buffers(card); in qeth_l2_stop_card()
397 qeth_clear_working_pool_list(card); in qeth_l2_stop_card()
398 card->state = CARD_STATE_DOWN; in qeth_l2_stop_card()
400 if (card->state == CARD_STATE_DOWN) { in qeth_l2_stop_card()
401 qeth_clear_cmd_buffers(&card->read); in qeth_l2_stop_card()
402 qeth_clear_cmd_buffers(&card->write); in qeth_l2_stop_card()
407 static int qeth_l2_process_inbound_buffer(struct qeth_card *card, in qeth_l2_process_inbound_buffer() argument
418 skb = qeth_core_get_next_skb(card, in qeth_l2_process_inbound_buffer()
419 &card->qdio.in_q->bufs[card->rx.b_index], in qeth_l2_process_inbound_buffer()
420 &card->rx.b_element, &card->rx.e_offset, &hdr); in qeth_l2_process_inbound_buffer()
425 skb->dev = card->dev; in qeth_l2_process_inbound_buffer()
432 *((__u32 *)skb->cb) = ++card->seqno.pkt_seqno; in qeth_l2_process_inbound_buffer()
437 if (card->info.type == QETH_CARD_TYPE_OSN) { in qeth_l2_process_inbound_buffer()
442 card->osn_info.data_cb(skb); in qeth_l2_process_inbound_buffer()
448 QETH_CARD_TEXT(card, 3, "inbunkno"); in qeth_l2_process_inbound_buffer()
454 card->stats.rx_packets++; in qeth_l2_process_inbound_buffer()
455 card->stats.rx_bytes += len; in qeth_l2_process_inbound_buffer()
462 struct qeth_card *card = container_of(napi, struct qeth_card, napi); in qeth_l2_poll() local
468 if (card->options.performance_stats) { in qeth_l2_poll()
469 card->perf_stats.inbound_cnt++; in qeth_l2_poll()
470 card->perf_stats.inbound_start_time = qeth_get_micros(); in qeth_l2_poll()
474 if (!card->rx.b_count) { in qeth_l2_poll()
475 card->rx.qdio_err = 0; in qeth_l2_poll()
476 card->rx.b_count = qdio_get_next_buffers( in qeth_l2_poll()
477 card->data.ccwdev, 0, &card->rx.b_index, in qeth_l2_poll()
478 &card->rx.qdio_err); in qeth_l2_poll()
479 if (card->rx.b_count <= 0) { in qeth_l2_poll()
480 card->rx.b_count = 0; in qeth_l2_poll()
483 card->rx.b_element = in qeth_l2_poll()
484 &card->qdio.in_q->bufs[card->rx.b_index] in qeth_l2_poll()
486 card->rx.e_offset = 0; in qeth_l2_poll()
489 while (card->rx.b_count) { in qeth_l2_poll()
490 buffer = &card->qdio.in_q->bufs[card->rx.b_index]; in qeth_l2_poll()
491 if (!(card->rx.qdio_err && in qeth_l2_poll()
492 qeth_check_qdio_errors(card, buffer->buffer, in qeth_l2_poll()
493 card->rx.qdio_err, "qinerr"))) in qeth_l2_poll()
495 card, new_budget, &done); in qeth_l2_poll()
500 if (card->options.performance_stats) in qeth_l2_poll()
501 card->perf_stats.bufs_rec++; in qeth_l2_poll()
502 qeth_put_buffer_pool_entry(card, in qeth_l2_poll()
504 qeth_queue_input_buffer(card, card->rx.b_index); in qeth_l2_poll()
505 card->rx.b_count--; in qeth_l2_poll()
506 if (card->rx.b_count) { in qeth_l2_poll()
507 card->rx.b_index = in qeth_l2_poll()
508 (card->rx.b_index + 1) % in qeth_l2_poll()
510 card->rx.b_element = in qeth_l2_poll()
511 &card->qdio.in_q in qeth_l2_poll()
512 ->bufs[card->rx.b_index] in qeth_l2_poll()
514 card->rx.e_offset = 0; in qeth_l2_poll()
526 if (qdio_start_irq(card->data.ccwdev, 0)) in qeth_l2_poll()
527 napi_schedule(&card->napi); in qeth_l2_poll()
529 if (card->options.performance_stats) in qeth_l2_poll()
530 card->perf_stats.inbound_time += qeth_get_micros() - in qeth_l2_poll()
531 card->perf_stats.inbound_start_time; in qeth_l2_poll()
535 static int qeth_l2_send_setdelmac(struct qeth_card *card, __u8 *mac, in qeth_l2_send_setdelmac() argument
544 QETH_CARD_TEXT(card, 2, "L2sdmac"); in qeth_l2_send_setdelmac()
545 iob = qeth_get_ipacmd_buffer(card, ipacmd, QETH_PROT_IPV4); in qeth_l2_send_setdelmac()
549 return qeth_send_ipa_cmd(card, iob, reply_cb, NULL); in qeth_l2_send_setdelmac()
552 static int qeth_l2_send_setmac_cb(struct qeth_card *card, in qeth_l2_send_setmac_cb() argument
558 QETH_CARD_TEXT(card, 2, "L2Smaccb"); in qeth_l2_send_setmac_cb()
561 QETH_CARD_TEXT_(card, 2, "L2er%x", cmd->hdr.return_code); in qeth_l2_send_setmac_cb()
562 card->info.mac_bits &= ~QETH_LAYER2_MAC_REGISTERED; in qeth_l2_send_setmac_cb()
566 dev_warn(&card->gdev->dev, in qeth_l2_send_setmac_cb()
572 dev_warn(&card->gdev->dev, in qeth_l2_send_setmac_cb()
580 card->info.mac_bits |= QETH_LAYER2_MAC_REGISTERED; in qeth_l2_send_setmac_cb()
581 memcpy(card->dev->dev_addr, cmd->data.setdelmac.mac, in qeth_l2_send_setmac_cb()
583 dev_info(&card->gdev->dev, in qeth_l2_send_setmac_cb()
585 card->dev->dev_addr, card->dev->name); in qeth_l2_send_setmac_cb()
590 static int qeth_l2_send_setmac(struct qeth_card *card, __u8 *mac) in qeth_l2_send_setmac() argument
592 QETH_CARD_TEXT(card, 2, "L2Setmac"); in qeth_l2_send_setmac()
593 return qeth_l2_send_setdelmac(card, mac, IPA_CMD_SETVMAC, in qeth_l2_send_setmac()
597 static int qeth_l2_send_delmac_cb(struct qeth_card *card, in qeth_l2_send_delmac_cb() argument
603 QETH_CARD_TEXT(card, 2, "L2Dmaccb"); in qeth_l2_send_delmac_cb()
606 QETH_CARD_TEXT_(card, 2, "err%d", cmd->hdr.return_code); in qeth_l2_send_delmac_cb()
609 card->info.mac_bits &= ~QETH_LAYER2_MAC_REGISTERED; in qeth_l2_send_delmac_cb()
614 static int qeth_l2_send_delmac(struct qeth_card *card, __u8 *mac) in qeth_l2_send_delmac() argument
616 QETH_CARD_TEXT(card, 2, "L2Delmac"); in qeth_l2_send_delmac()
617 if (!(card->info.mac_bits & QETH_LAYER2_MAC_REGISTERED)) in qeth_l2_send_delmac()
619 return qeth_l2_send_setdelmac(card, mac, IPA_CMD_DELVMAC, in qeth_l2_send_delmac()
623 static int qeth_l2_request_initial_mac(struct qeth_card *card) in qeth_l2_request_initial_mac() argument
629 QETH_DBF_TEXT_(SETUP, 2, "doL2%s", CARD_BUS_ID(card)); in qeth_l2_request_initial_mac()
631 if (qeth_is_supported(card, IPA_SETADAPTERPARMS)) { in qeth_l2_request_initial_mac()
632 rc = qeth_query_setadapterparms(card); in qeth_l2_request_initial_mac()
636 CARD_BUS_ID(card), rc); in qeth_l2_request_initial_mac()
640 if (card->info.type == QETH_CARD_TYPE_IQD || in qeth_l2_request_initial_mac()
641 card->info.type == QETH_CARD_TYPE_OSM || in qeth_l2_request_initial_mac()
642 card->info.type == QETH_CARD_TYPE_OSX || in qeth_l2_request_initial_mac()
643 card->info.guestlan) { in qeth_l2_request_initial_mac()
644 rc = qeth_setadpparms_change_macaddr(card); in qeth_l2_request_initial_mac()
647 "device %s: x%x\n", CARD_BUS_ID(card), rc); in qeth_l2_request_initial_mac()
651 QETH_DBF_HEX(SETUP, 2, card->dev->dev_addr, OSA_ADDR_LEN); in qeth_l2_request_initial_mac()
653 eth_random_addr(card->dev->dev_addr); in qeth_l2_request_initial_mac()
654 memcpy(card->dev->dev_addr, vendor_pre, 3); in qeth_l2_request_initial_mac()
662 struct qeth_card *card = dev->ml_priv; in qeth_l2_set_mac_address() local
665 QETH_CARD_TEXT(card, 3, "setmac"); in qeth_l2_set_mac_address()
668 QETH_CARD_TEXT(card, 3, "setmcINV"); in qeth_l2_set_mac_address()
672 if (card->info.type == QETH_CARD_TYPE_OSN || in qeth_l2_set_mac_address()
673 card->info.type == QETH_CARD_TYPE_OSM || in qeth_l2_set_mac_address()
674 card->info.type == QETH_CARD_TYPE_OSX) { in qeth_l2_set_mac_address()
675 QETH_CARD_TEXT(card, 3, "setmcTYP"); in qeth_l2_set_mac_address()
678 QETH_CARD_HEX(card, 3, addr->sa_data, OSA_ADDR_LEN); in qeth_l2_set_mac_address()
679 if (qeth_wait_for_threads(card, QETH_RECOVER_THREAD)) { in qeth_l2_set_mac_address()
680 QETH_CARD_TEXT(card, 3, "setmcREC"); in qeth_l2_set_mac_address()
683 rc = qeth_l2_send_delmac(card, &card->dev->dev_addr[0]); in qeth_l2_set_mac_address()
685 rc = qeth_l2_send_setmac(card, addr->sa_data); in qeth_l2_set_mac_address()
691 struct qeth_card *card = dev->ml_priv; in qeth_l2_set_multicast_list() local
694 if (card->info.type == QETH_CARD_TYPE_OSN) in qeth_l2_set_multicast_list()
697 QETH_CARD_TEXT(card, 3, "setmulti"); in qeth_l2_set_multicast_list()
698 if (qeth_threads_running(card, QETH_RECOVER_THREAD) && in qeth_l2_set_multicast_list()
699 (card->state != CARD_STATE_UP)) in qeth_l2_set_multicast_list()
701 qeth_l2_del_all_mc(card, 1); in qeth_l2_set_multicast_list()
702 spin_lock_bh(&card->mclock); in qeth_l2_set_multicast_list()
704 qeth_l2_add_mc(card, ha->addr, 0); in qeth_l2_set_multicast_list()
707 qeth_l2_add_mc(card, ha->addr, 1); in qeth_l2_set_multicast_list()
709 spin_unlock_bh(&card->mclock); in qeth_l2_set_multicast_list()
710 if (!qeth_adp_supported(card, IPA_SETADP_SET_PROMISC_MODE)) in qeth_l2_set_multicast_list()
712 qeth_setadp_promisc_mode(card); in qeth_l2_set_multicast_list()
720 struct qeth_card *card = dev->ml_priv; in qeth_l2_hard_start_xmit() local
723 int cast_type = qeth_l2_get_cast_type(card, skb); in qeth_l2_hard_start_xmit()
724 struct qeth_qdio_out_q *queue = card->qdio.out_qs in qeth_l2_hard_start_xmit()
725 [qeth_get_priority_queue(card, skb, ipv, cast_type)]; in qeth_l2_hard_start_xmit()
731 if ((card->state != CARD_STATE_UP) || !card->lan_online) { in qeth_l2_hard_start_xmit()
732 card->stats.tx_carrier_errors++; in qeth_l2_hard_start_xmit()
736 if ((card->info.type == QETH_CARD_TYPE_OSN) && in qeth_l2_hard_start_xmit()
740 if (card->options.performance_stats) { in qeth_l2_hard_start_xmit()
741 card->perf_stats.outbound_cnt++; in qeth_l2_hard_start_xmit()
742 card->perf_stats.outbound_start_time = qeth_get_micros(); in qeth_l2_hard_start_xmit()
746 if (card->info.type == QETH_CARD_TYPE_OSN) in qeth_l2_hard_start_xmit()
749 if (card->info.type == QETH_CARD_TYPE_IQD) { in qeth_l2_hard_start_xmit()
759 qeth_l2_fill_header(card, hdr, new_skb, ipv, cast_type); in qeth_l2_hard_start_xmit()
772 qeth_l2_fill_header(card, hdr, new_skb, ipv, cast_type); in qeth_l2_hard_start_xmit()
776 elements = qeth_get_elements_no(card, new_skb, elements_needed); in qeth_l2_hard_start_xmit()
783 if (card->info.type != QETH_CARD_TYPE_IQD) { in qeth_l2_hard_start_xmit()
787 rc = qeth_do_send_packet(card, queue, new_skb, hdr, in qeth_l2_hard_start_xmit()
790 rc = qeth_do_send_packet_fast(card, queue, new_skb, hdr, in qeth_l2_hard_start_xmit()
793 card->stats.tx_packets++; in qeth_l2_hard_start_xmit()
794 card->stats.tx_bytes += tx_bytes; in qeth_l2_hard_start_xmit()
811 if (card->options.performance_stats) in qeth_l2_hard_start_xmit()
812 card->perf_stats.outbound_time += qeth_get_micros() - in qeth_l2_hard_start_xmit()
813 card->perf_stats.outbound_start_time; in qeth_l2_hard_start_xmit()
817 card->stats.tx_dropped++; in qeth_l2_hard_start_xmit()
818 card->stats.tx_errors++; in qeth_l2_hard_start_xmit()
828 struct qeth_card *card = dev->ml_priv; in __qeth_l2_open() local
831 QETH_CARD_TEXT(card, 4, "qethopen"); in __qeth_l2_open()
832 if (card->state == CARD_STATE_UP) in __qeth_l2_open()
834 if (card->state != CARD_STATE_SOFTSETUP) in __qeth_l2_open()
837 if ((card->info.type != QETH_CARD_TYPE_OSN) && in __qeth_l2_open()
838 (!(card->info.mac_bits & QETH_LAYER2_MAC_REGISTERED))) { in __qeth_l2_open()
839 QETH_CARD_TEXT(card, 4, "nomacadr"); in __qeth_l2_open()
842 card->data.state = CH_STATE_UP; in __qeth_l2_open()
843 card->state = CARD_STATE_UP; in __qeth_l2_open()
846 if (qdio_stop_irq(card->data.ccwdev, 0) >= 0) { in __qeth_l2_open()
847 napi_enable(&card->napi); in __qeth_l2_open()
848 napi_schedule(&card->napi); in __qeth_l2_open()
856 struct qeth_card *card = dev->ml_priv; in qeth_l2_open() local
858 QETH_CARD_TEXT(card, 5, "qethope_"); in qeth_l2_open()
859 if (qeth_wait_for_threads(card, QETH_RECOVER_THREAD)) { in qeth_l2_open()
860 QETH_CARD_TEXT(card, 3, "openREC"); in qeth_l2_open()
868 struct qeth_card *card = dev->ml_priv; in qeth_l2_stop() local
870 QETH_CARD_TEXT(card, 4, "qethstop"); in qeth_l2_stop()
872 if (card->state == CARD_STATE_UP) { in qeth_l2_stop()
873 card->state = CARD_STATE_SOFTSETUP; in qeth_l2_stop()
874 napi_disable(&card->napi); in qeth_l2_stop()
881 struct qeth_card *card = dev_get_drvdata(&gdev->dev); in qeth_l2_probe_device() local
883 INIT_LIST_HEAD(&card->vid_list); in qeth_l2_probe_device()
884 INIT_LIST_HEAD(&card->mc_list); in qeth_l2_probe_device()
885 card->options.layer2 = 1; in qeth_l2_probe_device()
886 card->info.hwtrap = 0; in qeth_l2_probe_device()
892 struct qeth_card *card = dev_get_drvdata(&cgdev->dev); in qeth_l2_remove_device() local
894 qeth_set_allowed_threads(card, 0, 1); in qeth_l2_remove_device()
895 wait_event(card->wait_q, qeth_threads_running(card, 0xffffffff) == 0); in qeth_l2_remove_device()
900 if (card->dev) { in qeth_l2_remove_device()
901 unregister_netdev(card->dev); in qeth_l2_remove_device()
902 card->dev = NULL; in qeth_l2_remove_device()
938 static int qeth_l2_setup_netdev(struct qeth_card *card) in qeth_l2_setup_netdev() argument
940 switch (card->info.type) { in qeth_l2_setup_netdev()
942 card->dev = alloc_netdev(0, "hsi%d", ether_setup); in qeth_l2_setup_netdev()
945 card->dev = alloc_netdev(0, "osn%d", ether_setup); in qeth_l2_setup_netdev()
946 card->dev->flags |= IFF_NOARP; in qeth_l2_setup_netdev()
949 card->dev = alloc_etherdev(0); in qeth_l2_setup_netdev()
952 if (!card->dev) in qeth_l2_setup_netdev()
955 card->dev->ml_priv = card; in qeth_l2_setup_netdev()
956 card->dev->watchdog_timeo = QETH_TX_TIMEOUT; in qeth_l2_setup_netdev()
957 card->dev->mtu = card->info.initial_mtu; in qeth_l2_setup_netdev()
958 card->dev->netdev_ops = &qeth_l2_netdev_ops; in qeth_l2_setup_netdev()
959 if (card->info.type != QETH_CARD_TYPE_OSN) in qeth_l2_setup_netdev()
960 SET_ETHTOOL_OPS(card->dev, &qeth_l2_ethtool_ops); in qeth_l2_setup_netdev()
962 SET_ETHTOOL_OPS(card->dev, &qeth_l2_osn_ops); in qeth_l2_setup_netdev()
963 card->dev->features |= NETIF_F_HW_VLAN_CTAG_FILTER; in qeth_l2_setup_netdev()
964 card->info.broadcast_capable = 1; in qeth_l2_setup_netdev()
965 qeth_l2_request_initial_mac(card); in qeth_l2_setup_netdev()
966 SET_NETDEV_DEV(card->dev, &card->gdev->dev); in qeth_l2_setup_netdev()
967 netif_napi_add(card->dev, &card->napi, qeth_l2_poll, QETH_NAPI_WEIGHT); in qeth_l2_setup_netdev()
968 return register_netdev(card->dev); in qeth_l2_setup_netdev()
973 struct qeth_card *card = dev_get_drvdata(&gdev->dev); in __qeth_l2_set_online() local
977 mutex_lock(&card->discipline_mutex); in __qeth_l2_set_online()
978 mutex_lock(&card->conf_mutex); in __qeth_l2_set_online()
980 QETH_DBF_HEX(SETUP, 2, &card, sizeof(void *)); in __qeth_l2_set_online()
982 recover_flag = card->state; in __qeth_l2_set_online()
983 rc = qeth_core_hardsetup_card(card); in __qeth_l2_set_online()
989 qeth_trace_features(card); in __qeth_l2_set_online()
991 if (!card->dev && qeth_l2_setup_netdev(card)) { in __qeth_l2_set_online()
996 if (card->info.type != QETH_CARD_TYPE_OSN) in __qeth_l2_set_online()
997 qeth_l2_send_setmac(card, &card->dev->dev_addr[0]); in __qeth_l2_set_online()
999 if (qeth_is_diagass_supported(card, QETH_DIAGS_CMD_TRAP)) { in __qeth_l2_set_online()
1000 if (card->info.hwtrap && in __qeth_l2_set_online()
1001 qeth_hw_trap(card, QETH_DIAGS_TRAP_ARM)) in __qeth_l2_set_online()
1002 card->info.hwtrap = 0; in __qeth_l2_set_online()
1004 card->info.hwtrap = 0; in __qeth_l2_set_online()
1006 card->state = CARD_STATE_HARDSETUP; in __qeth_l2_set_online()
1007 memset(&card->rx, 0, sizeof(struct qeth_rx)); in __qeth_l2_set_online()
1008 qeth_print_status_message(card); in __qeth_l2_set_online()
1013 rc = qeth_send_startlan(card); in __qeth_l2_set_online()
1017 dev_warn(&card->gdev->dev, in __qeth_l2_set_online()
1019 card->lan_online = 0; in __qeth_l2_set_online()
1025 card->lan_online = 1; in __qeth_l2_set_online()
1028 if ((card->info.type == QETH_CARD_TYPE_OSD) || in __qeth_l2_set_online()
1029 (card->info.type == QETH_CARD_TYPE_OSX)) { in __qeth_l2_set_online()
1031 rc = qeth_set_access_ctrl_online(card, 0); in __qeth_l2_set_online()
1038 if (card->info.type != QETH_CARD_TYPE_OSN && in __qeth_l2_set_online()
1039 card->info.type != QETH_CARD_TYPE_OSM) in __qeth_l2_set_online()
1040 qeth_l2_process_vlans(card); in __qeth_l2_set_online()
1042 netif_tx_disable(card->dev); in __qeth_l2_set_online()
1044 rc = qeth_init_qdio_queues(card); in __qeth_l2_set_online()
1050 card->state = CARD_STATE_SOFTSETUP; in __qeth_l2_set_online()
1051 if (card->lan_online) in __qeth_l2_set_online()
1052 netif_carrier_on(card->dev); in __qeth_l2_set_online()
1054 netif_carrier_off(card->dev); in __qeth_l2_set_online()
1056 qeth_set_allowed_threads(card, 0xffffffff, 0); in __qeth_l2_set_online()
1059 card->info.type != QETH_CARD_TYPE_OSN) { in __qeth_l2_set_online()
1060 __qeth_l2_open(card->dev); in __qeth_l2_set_online()
1063 dev_open(card->dev); in __qeth_l2_set_online()
1067 qeth_l2_set_multicast_list(card->dev); in __qeth_l2_set_online()
1071 mutex_unlock(&card->conf_mutex); in __qeth_l2_set_online()
1072 mutex_unlock(&card->discipline_mutex); in __qeth_l2_set_online()
1076 qeth_l2_stop_card(card, 0); in __qeth_l2_set_online()
1077 ccw_device_set_offline(CARD_DDEV(card)); in __qeth_l2_set_online()
1078 ccw_device_set_offline(CARD_WDEV(card)); in __qeth_l2_set_online()
1079 ccw_device_set_offline(CARD_RDEV(card)); in __qeth_l2_set_online()
1081 card->state = CARD_STATE_RECOVER; in __qeth_l2_set_online()
1083 card->state = CARD_STATE_DOWN; in __qeth_l2_set_online()
1084 mutex_unlock(&card->conf_mutex); in __qeth_l2_set_online()
1085 mutex_unlock(&card->discipline_mutex); in __qeth_l2_set_online()
1097 struct qeth_card *card = dev_get_drvdata(&cgdev->dev); in __qeth_l2_set_offline() local
1101 mutex_lock(&card->discipline_mutex); in __qeth_l2_set_offline()
1102 mutex_lock(&card->conf_mutex); in __qeth_l2_set_offline()
1104 QETH_DBF_HEX(SETUP, 3, &card, sizeof(void *)); in __qeth_l2_set_offline()
1106 if (card->dev && netif_carrier_ok(card->dev)) in __qeth_l2_set_offline()
1107 netif_carrier_off(card->dev); in __qeth_l2_set_offline()
1108 recover_flag = card->state; in __qeth_l2_set_offline()
1109 if ((!recovery_mode && card->info.hwtrap) || card->info.hwtrap == 2) { in __qeth_l2_set_offline()
1110 qeth_hw_trap(card, QETH_DIAGS_TRAP_DISARM); in __qeth_l2_set_offline()
1111 card->info.hwtrap = 1; in __qeth_l2_set_offline()
1113 qeth_l2_stop_card(card, recovery_mode); in __qeth_l2_set_offline()
1114 rc = ccw_device_set_offline(CARD_DDEV(card)); in __qeth_l2_set_offline()
1115 rc2 = ccw_device_set_offline(CARD_WDEV(card)); in __qeth_l2_set_offline()
1116 rc3 = ccw_device_set_offline(CARD_RDEV(card)); in __qeth_l2_set_offline()
1122 card->state = CARD_STATE_RECOVER; in __qeth_l2_set_offline()
1125 mutex_unlock(&card->conf_mutex); in __qeth_l2_set_offline()
1126 mutex_unlock(&card->discipline_mutex); in __qeth_l2_set_offline()
1137 struct qeth_card *card; in qeth_l2_recover() local
1140 card = (struct qeth_card *) ptr; in qeth_l2_recover()
1141 QETH_CARD_TEXT(card, 2, "recover1"); in qeth_l2_recover()
1142 if (!qeth_do_run_thread(card, QETH_RECOVER_THREAD)) in qeth_l2_recover()
1144 QETH_CARD_TEXT(card, 2, "recover2"); in qeth_l2_recover()
1145 dev_warn(&card->gdev->dev, in qeth_l2_recover()
1147 qeth_set_recovery_task(card); in qeth_l2_recover()
1148 __qeth_l2_set_offline(card->gdev, 1); in qeth_l2_recover()
1149 rc = __qeth_l2_set_online(card->gdev, 1); in qeth_l2_recover()
1151 dev_info(&card->gdev->dev, in qeth_l2_recover()
1154 qeth_close_dev(card); in qeth_l2_recover()
1155 dev_warn(&card->gdev->dev, "The qeth device driver " in qeth_l2_recover()
1158 qeth_clear_recovery_task(card); in qeth_l2_recover()
1159 qeth_clear_thread_start_bit(card, QETH_RECOVER_THREAD); in qeth_l2_recover()
1160 qeth_clear_thread_running_bit(card, QETH_RECOVER_THREAD); in qeth_l2_recover()
1177 struct qeth_card *card = dev_get_drvdata(&gdev->dev); in qeth_l2_shutdown() local
1178 qeth_set_allowed_threads(card, 0, 1); in qeth_l2_shutdown()
1179 if ((gdev->state == CCWGROUP_ONLINE) && card->info.hwtrap) in qeth_l2_shutdown()
1180 qeth_hw_trap(card, QETH_DIAGS_TRAP_DISARM); in qeth_l2_shutdown()
1181 qeth_qdio_clear_card(card, 0); in qeth_l2_shutdown()
1182 qeth_clear_qdio_buffers(card); in qeth_l2_shutdown()
1187 struct qeth_card *card = dev_get_drvdata(&gdev->dev); in qeth_l2_pm_suspend() local
1189 if (card->dev) in qeth_l2_pm_suspend()
1190 netif_device_detach(card->dev); in qeth_l2_pm_suspend()
1191 qeth_set_allowed_threads(card, 0, 1); in qeth_l2_pm_suspend()
1192 wait_event(card->wait_q, qeth_threads_running(card, 0xffffffff) == 0); in qeth_l2_pm_suspend()
1195 if (card->state == CARD_STATE_UP) { in qeth_l2_pm_suspend()
1196 if (card->info.hwtrap) in qeth_l2_pm_suspend()
1197 qeth_hw_trap(card, QETH_DIAGS_TRAP_DISARM); in qeth_l2_pm_suspend()
1198 __qeth_l2_set_offline(card->gdev, 1); in qeth_l2_pm_suspend()
1200 __qeth_l2_set_offline(card->gdev, 0); in qeth_l2_pm_suspend()
1206 struct qeth_card *card = dev_get_drvdata(&gdev->dev); in qeth_l2_pm_resume() local
1212 if (card->state == CARD_STATE_RECOVER) { in qeth_l2_pm_resume()
1213 rc = __qeth_l2_set_online(card->gdev, 1); in qeth_l2_pm_resume()
1216 dev_close(card->dev); in qeth_l2_pm_resume()
1220 rc = __qeth_l2_set_online(card->gdev, 0); in qeth_l2_pm_resume()
1222 qeth_set_allowed_threads(card, 0xffffffff, 0); in qeth_l2_pm_resume()
1223 if (card->dev) in qeth_l2_pm_resume()
1224 netif_device_attach(card->dev); in qeth_l2_pm_resume()
1226 dev_warn(&card->gdev->dev, "The qeth device driver " in qeth_l2_pm_resume()
1247 static int qeth_osn_send_control_data(struct qeth_card *card, int len, in qeth_osn_send_control_data() argument
1253 QETH_CARD_TEXT(card, 5, "osndctrd"); in qeth_osn_send_control_data()
1255 wait_event(card->wait_q, in qeth_osn_send_control_data()
1256 atomic_cmpxchg(&card->write.irq_pending, 0, 1) == 0); in qeth_osn_send_control_data()
1257 qeth_prepare_control_data(card, len, iob); in qeth_osn_send_control_data()
1258 QETH_CARD_TEXT(card, 6, "osnoirqp"); in qeth_osn_send_control_data()
1259 spin_lock_irqsave(get_ccwdev_lock(card->write.ccwdev), flags); in qeth_osn_send_control_data()
1260 rc = ccw_device_start(card->write.ccwdev, &card->write.ccw, in qeth_osn_send_control_data()
1262 spin_unlock_irqrestore(get_ccwdev_lock(card->write.ccwdev), flags); in qeth_osn_send_control_data()
1266 QETH_CARD_TEXT_(card, 2, " err%d", rc); in qeth_osn_send_control_data()
1268 atomic_set(&card->write.irq_pending, 0); in qeth_osn_send_control_data()
1269 wake_up(&card->wait_q); in qeth_osn_send_control_data()
1274 static int qeth_osn_send_ipa_cmd(struct qeth_card *card, in qeth_osn_send_ipa_cmd() argument
1279 QETH_CARD_TEXT(card, 4, "osndipa"); in qeth_osn_send_ipa_cmd()
1281 qeth_prepare_ipa_cmd(card, iob, QETH_PROT_OSN2); in qeth_osn_send_ipa_cmd()
1288 return qeth_osn_send_control_data(card, s1, iob); in qeth_osn_send_ipa_cmd()
1294 struct qeth_card *card; in qeth_osn_assist() local
1299 card = dev->ml_priv; in qeth_osn_assist()
1300 if (!card) in qeth_osn_assist()
1302 QETH_CARD_TEXT(card, 2, "osnsdmc"); in qeth_osn_assist()
1303 if ((card->state != CARD_STATE_UP) && in qeth_osn_assist()
1304 (card->state != CARD_STATE_SOFTSETUP)) in qeth_osn_assist()
1306 iob = qeth_wait_for_buffer(&card->write); in qeth_osn_assist()
1308 rc = qeth_osn_send_ipa_cmd(card, iob, data_len); in qeth_osn_assist()
1317 struct qeth_card *card; in qeth_osn_register() local
1322 card = (*dev)->ml_priv; in qeth_osn_register()
1323 if (!card) in qeth_osn_register()
1325 QETH_CARD_TEXT(card, 2, "osnreg"); in qeth_osn_register()
1328 card->osn_info.assist_cb = assist_cb; in qeth_osn_register()
1329 card->osn_info.data_cb = data_cb; in qeth_osn_register()
1336 struct qeth_card *card; in qeth_osn_deregister() local
1340 card = dev->ml_priv; in qeth_osn_deregister()
1341 if (!card) in qeth_osn_deregister()
1343 QETH_CARD_TEXT(card, 2, "osndereg"); in qeth_osn_deregister()
1344 card->osn_info.assist_cb = NULL; in qeth_osn_deregister()
1345 card->osn_info.data_cb = NULL; in qeth_osn_deregister()