Lines Matching full:card
54 static struct qeth_ipaddr *qeth_l3_find_addr_by_ip(struct qeth_card *card, in qeth_l3_find_addr_by_ip() argument
61 hash_for_each_possible(card->rx_mode_addrs, addr, hnode, key) in qeth_l3_find_addr_by_ip()
65 hash_for_each_possible(card->ip_htable, addr, hnode, key) in qeth_l3_find_addr_by_ip()
86 static bool qeth_l3_is_addr_covered_by_ipato(struct qeth_card *card, in qeth_l3_is_addr_covered_by_ipato() argument
94 if (!card->ipato.enabled) in qeth_l3_is_addr_covered_by_ipato()
101 list_for_each_entry(ipatoe, &card->ipato.entries, entry) { in qeth_l3_is_addr_covered_by_ipato()
112 if ((addr->proto == QETH_PROT_IPV4) && card->ipato.invert4) in qeth_l3_is_addr_covered_by_ipato()
114 else if ((addr->proto == QETH_PROT_IPV6) && card->ipato.invert6) in qeth_l3_is_addr_covered_by_ipato()
120 static int qeth_l3_delete_ip(struct qeth_card *card, in qeth_l3_delete_ip() argument
127 QETH_CARD_TEXT(card, 2, "delrxip"); in qeth_l3_delete_ip()
129 QETH_CARD_TEXT(card, 2, "delvipa"); in qeth_l3_delete_ip()
131 QETH_CARD_TEXT(card, 2, "delip"); in qeth_l3_delete_ip()
134 QETH_CARD_HEX(card, 4, &tmp_addr->u.a4.addr, 4); in qeth_l3_delete_ip()
136 QETH_CARD_HEX(card, 4, &tmp_addr->u.a6.addr, 8); in qeth_l3_delete_ip()
137 QETH_CARD_HEX(card, 4, ((char *)&tmp_addr->u.a6.addr) + 8, 8); in qeth_l3_delete_ip()
140 addr = qeth_l3_find_addr_by_ip(card, tmp_addr); in qeth_l3_delete_ip()
148 if (qeth_card_hw_is_reachable(card)) in qeth_l3_delete_ip()
149 rc = qeth_l3_deregister_addr_entry(card, addr); in qeth_l3_delete_ip()
157 static int qeth_l3_add_ip(struct qeth_card *card, struct qeth_ipaddr *tmp_addr) in qeth_l3_add_ip() argument
164 QETH_CARD_TEXT(card, 2, "addrxip"); in qeth_l3_add_ip()
166 QETH_CARD_TEXT(card, 2, "addvipa"); in qeth_l3_add_ip()
168 QETH_CARD_TEXT(card, 2, "addip"); in qeth_l3_add_ip()
171 QETH_CARD_HEX(card, 4, &tmp_addr->u.a4.addr, 4); in qeth_l3_add_ip()
173 QETH_CARD_HEX(card, 4, &tmp_addr->u.a6.addr, 8); in qeth_l3_add_ip()
174 QETH_CARD_HEX(card, 4, ((char *)&tmp_addr->u.a6.addr) + 8, 8); in qeth_l3_add_ip()
177 addr = qeth_l3_find_addr_by_ip(card, tmp_addr); in qeth_l3_add_ip()
187 dev_warn(&card->gdev->dev, in qeth_l3_add_ip()
195 if (qeth_l3_is_addr_covered_by_ipato(card, addr)) { in qeth_l3_add_ip()
196 QETH_CARD_TEXT(card, 2, "tkovaddr"); in qeth_l3_add_ip()
199 hash_add(card->ip_htable, &addr->hnode, in qeth_l3_add_ip()
202 if (!qeth_card_hw_is_reachable(card)) { in qeth_l3_add_ip()
207 rc = qeth_l3_register_addr_entry(card, addr); in qeth_l3_add_ip()
219 static int qeth_l3_modify_ip(struct qeth_card *card, struct qeth_ipaddr *addr, in qeth_l3_modify_ip() argument
224 mutex_lock(&card->ip_lock); in qeth_l3_modify_ip()
225 rc = add ? qeth_l3_add_ip(card, addr) : qeth_l3_delete_ip(card, addr); in qeth_l3_modify_ip()
226 mutex_unlock(&card->ip_lock); in qeth_l3_modify_ip()
231 static void qeth_l3_drain_rx_mode_cache(struct qeth_card *card) in qeth_l3_drain_rx_mode_cache() argument
237 hash_for_each_safe(card->rx_mode_addrs, i, tmp, addr, hnode) { in qeth_l3_drain_rx_mode_cache()
243 static void qeth_l3_clear_ip_htable(struct qeth_card *card, int recover) in qeth_l3_clear_ip_htable() argument
249 QETH_CARD_TEXT(card, 4, "clearip"); in qeth_l3_clear_ip_htable()
251 mutex_lock(&card->ip_lock); in qeth_l3_clear_ip_htable()
253 hash_for_each_safe(card->ip_htable, i, tmp, addr, hnode) { in qeth_l3_clear_ip_htable()
262 mutex_unlock(&card->ip_lock); in qeth_l3_clear_ip_htable()
265 static void qeth_l3_recover_ip(struct qeth_card *card) in qeth_l3_recover_ip() argument
272 QETH_CARD_TEXT(card, 4, "recovrip"); in qeth_l3_recover_ip()
274 mutex_lock(&card->ip_lock); in qeth_l3_recover_ip()
276 hash_for_each_safe(card->ip_htable, i, tmp, addr, hnode) { in qeth_l3_recover_ip()
278 rc = qeth_l3_register_addr_entry(card, addr); in qeth_l3_recover_ip()
289 mutex_unlock(&card->ip_lock); in qeth_l3_recover_ip()
292 static int qeth_l3_setdelip_cb(struct qeth_card *card, struct qeth_reply *reply, in qeth_l3_setdelip_cb() argument
311 static int qeth_l3_send_setdelmc(struct qeth_card *card, in qeth_l3_send_setdelmc() argument
318 QETH_CARD_TEXT(card, 4, "setdelmc"); in qeth_l3_send_setdelmc()
320 iob = qeth_ipa_alloc_cmd(card, ipacmd, addr->proto, in qeth_l3_send_setdelmc()
333 return qeth_send_ipa_cmd(card, iob, qeth_l3_setdelip_cb, NULL); in qeth_l3_send_setdelmc()
362 static int qeth_l3_send_setdelip(struct qeth_card *card, in qeth_l3_send_setdelip() argument
370 QETH_CARD_TEXT(card, 4, "setdelip"); in qeth_l3_send_setdelip()
372 iob = qeth_ipa_alloc_cmd(card, ipacmd, addr->proto, in qeth_l3_send_setdelip()
379 QETH_CARD_TEXT_(card, 4, "flags%02X", flags); in qeth_l3_send_setdelip()
392 return qeth_send_ipa_cmd(card, iob, qeth_l3_setdelip_cb, NULL); in qeth_l3_send_setdelip()
395 static int qeth_l3_send_setrouting(struct qeth_card *card, in qeth_l3_send_setrouting() argument
402 QETH_CARD_TEXT(card, 4, "setroutg"); in qeth_l3_send_setrouting()
403 iob = qeth_ipa_alloc_cmd(card, IPA_CMD_SETRTG, prot, in qeth_l3_send_setrouting()
409 rc = qeth_send_ipa_cmd(card, iob, NULL, NULL); in qeth_l3_send_setrouting()
414 static int qeth_l3_correct_routing_type(struct qeth_card *card, in qeth_l3_correct_routing_type() argument
417 if (IS_IQD(card)) { in qeth_l3_correct_routing_type()
434 if (qeth_is_ipafunc_supported(card, prot, in qeth_l3_correct_routing_type()
447 int qeth_l3_setrouting_v4(struct qeth_card *card) in qeth_l3_setrouting_v4() argument
451 QETH_CARD_TEXT(card, 3, "setrtg4"); in qeth_l3_setrouting_v4()
453 rc = qeth_l3_correct_routing_type(card, &card->options.route4.type, in qeth_l3_setrouting_v4()
458 rc = qeth_l3_send_setrouting(card, card->options.route4.type, in qeth_l3_setrouting_v4()
461 card->options.route4.type = NO_ROUTER; in qeth_l3_setrouting_v4()
463 rc, CARD_DEVID(card)); in qeth_l3_setrouting_v4()
468 int qeth_l3_setrouting_v6(struct qeth_card *card) in qeth_l3_setrouting_v6() argument
472 QETH_CARD_TEXT(card, 3, "setrtg6"); in qeth_l3_setrouting_v6()
474 if (!qeth_is_supported(card, IPA_IPV6)) in qeth_l3_setrouting_v6()
476 rc = qeth_l3_correct_routing_type(card, &card->options.route6.type, in qeth_l3_setrouting_v6()
481 rc = qeth_l3_send_setrouting(card, card->options.route6.type, in qeth_l3_setrouting_v6()
484 card->options.route6.type = NO_ROUTER; in qeth_l3_setrouting_v6()
486 rc, CARD_DEVID(card)); in qeth_l3_setrouting_v6()
500 void qeth_l3_update_ipato(struct qeth_card *card) in qeth_l3_update_ipato() argument
505 hash_for_each(card->ip_htable, i, addr, hnode) { in qeth_l3_update_ipato()
508 addr->ipato = qeth_l3_is_addr_covered_by_ipato(card, addr); in qeth_l3_update_ipato()
512 static void qeth_l3_clear_ipato_list(struct qeth_card *card) in qeth_l3_clear_ipato_list() argument
516 mutex_lock(&card->ip_lock); in qeth_l3_clear_ipato_list()
518 list_for_each_entry_safe(ipatoe, tmp, &card->ipato.entries, entry) { in qeth_l3_clear_ipato_list()
523 qeth_l3_update_ipato(card); in qeth_l3_clear_ipato_list()
524 mutex_unlock(&card->ip_lock); in qeth_l3_clear_ipato_list()
527 int qeth_l3_add_ipato_entry(struct qeth_card *card, in qeth_l3_add_ipato_entry() argument
533 QETH_CARD_TEXT(card, 2, "addipato"); in qeth_l3_add_ipato_entry()
535 mutex_lock(&card->ip_lock); in qeth_l3_add_ipato_entry()
537 list_for_each_entry(ipatoe, &card->ipato.entries, entry) { in qeth_l3_add_ipato_entry()
549 list_add_tail(&new->entry, &card->ipato.entries); in qeth_l3_add_ipato_entry()
550 qeth_l3_update_ipato(card); in qeth_l3_add_ipato_entry()
553 mutex_unlock(&card->ip_lock); in qeth_l3_add_ipato_entry()
558 int qeth_l3_del_ipato_entry(struct qeth_card *card, in qeth_l3_del_ipato_entry() argument
565 QETH_CARD_TEXT(card, 2, "delipato"); in qeth_l3_del_ipato_entry()
567 mutex_lock(&card->ip_lock); in qeth_l3_del_ipato_entry()
569 list_for_each_entry_safe(ipatoe, tmp, &card->ipato.entries, entry) { in qeth_l3_del_ipato_entry()
576 qeth_l3_update_ipato(card); in qeth_l3_del_ipato_entry()
582 mutex_unlock(&card->ip_lock); in qeth_l3_del_ipato_entry()
587 int qeth_l3_modify_rxip_vipa(struct qeth_card *card, bool add, const u8 *ip, in qeth_l3_modify_rxip_vipa() argument
599 return qeth_l3_modify_ip(card, &addr, add); in qeth_l3_modify_rxip_vipa()
602 int qeth_l3_modify_hsuid(struct qeth_card *card, bool add) in qeth_l3_modify_hsuid() argument
611 addr.u.a6.addr.s6_addr[8+i] = card->options.hsuid[i]; in qeth_l3_modify_hsuid()
613 return qeth_l3_modify_ip(card, &addr, add); in qeth_l3_modify_hsuid()
616 static int qeth_l3_register_addr_entry(struct qeth_card *card, in qeth_l3_register_addr_entry() argument
623 if (card->options.sniffer) in qeth_l3_register_addr_entry()
627 QETH_CARD_TEXT(card, 2, "setaddr4"); in qeth_l3_register_addr_entry()
628 QETH_CARD_HEX(card, 3, &addr->u.a4.addr, sizeof(int)); in qeth_l3_register_addr_entry()
630 QETH_CARD_TEXT(card, 2, "setaddr6"); in qeth_l3_register_addr_entry()
631 QETH_CARD_HEX(card, 3, &addr->u.a6.addr, 8); in qeth_l3_register_addr_entry()
632 QETH_CARD_HEX(card, 3, ((char *)&addr->u.a6.addr) + 8, 8); in qeth_l3_register_addr_entry()
634 QETH_CARD_TEXT(card, 2, "setaddr?"); in qeth_l3_register_addr_entry()
635 QETH_CARD_HEX(card, 3, addr, sizeof(struct qeth_ipaddr)); in qeth_l3_register_addr_entry()
639 rc = qeth_l3_send_setdelmc(card, addr, IPA_CMD_SETIPM); in qeth_l3_register_addr_entry()
641 rc = qeth_l3_send_setdelip(card, addr, IPA_CMD_SETIP); in qeth_l3_register_addr_entry()
643 QETH_CARD_TEXT(card, 2, "failed"); in qeth_l3_register_addr_entry()
646 QETH_CARD_TEXT(card, 2, "FAILED"); in qeth_l3_register_addr_entry()
648 dev_warn(&card->gdev->dev, in qeth_l3_register_addr_entry()
654 static int qeth_l3_deregister_addr_entry(struct qeth_card *card, in qeth_l3_deregister_addr_entry() argument
659 if (card->options.sniffer) in qeth_l3_deregister_addr_entry()
663 QETH_CARD_TEXT(card, 2, "deladdr4"); in qeth_l3_deregister_addr_entry()
664 QETH_CARD_HEX(card, 3, &addr->u.a4.addr, sizeof(int)); in qeth_l3_deregister_addr_entry()
666 QETH_CARD_TEXT(card, 2, "deladdr6"); in qeth_l3_deregister_addr_entry()
667 QETH_CARD_HEX(card, 3, &addr->u.a6.addr, 8); in qeth_l3_deregister_addr_entry()
668 QETH_CARD_HEX(card, 3, ((char *)&addr->u.a6.addr) + 8, 8); in qeth_l3_deregister_addr_entry()
670 QETH_CARD_TEXT(card, 2, "deladdr?"); in qeth_l3_deregister_addr_entry()
671 QETH_CARD_HEX(card, 3, addr, sizeof(struct qeth_ipaddr)); in qeth_l3_deregister_addr_entry()
674 rc = qeth_l3_send_setdelmc(card, addr, IPA_CMD_DELIPM); in qeth_l3_deregister_addr_entry()
676 rc = qeth_l3_send_setdelip(card, addr, IPA_CMD_DELIP); in qeth_l3_deregister_addr_entry()
678 QETH_CARD_TEXT(card, 2, "failed"); in qeth_l3_deregister_addr_entry()
683 static int qeth_l3_setadapter_parms(struct qeth_card *card) in qeth_l3_setadapter_parms() argument
687 QETH_CARD_TEXT(card, 2, "setadprm"); in qeth_l3_setadapter_parms()
689 if (qeth_adp_supported(card, IPA_SETADP_ALTER_MAC_ADDRESS)) { in qeth_l3_setadapter_parms()
690 rc = qeth_setadpparms_change_macaddr(card); in qeth_l3_setadapter_parms()
692 dev_warn(&card->gdev->dev, "Reading the adapter MAC" in qeth_l3_setadapter_parms()
699 static int qeth_l3_start_ipa_arp_processing(struct qeth_card *card) in qeth_l3_start_ipa_arp_processing() argument
703 QETH_CARD_TEXT(card, 3, "ipaarp"); in qeth_l3_start_ipa_arp_processing()
705 if (!qeth_is_supported(card, IPA_ARP_PROCESSING)) { in qeth_l3_start_ipa_arp_processing()
706 dev_info(&card->gdev->dev, in qeth_l3_start_ipa_arp_processing()
708 netdev_name(card->dev)); in qeth_l3_start_ipa_arp_processing()
711 rc = qeth_send_simple_setassparms(card, IPA_ARP_PROCESSING, in qeth_l3_start_ipa_arp_processing()
714 dev_warn(&card->gdev->dev, in qeth_l3_start_ipa_arp_processing()
716 netdev_name(card->dev)); in qeth_l3_start_ipa_arp_processing()
721 static int qeth_l3_start_ipa_source_mac(struct qeth_card *card) in qeth_l3_start_ipa_source_mac() argument
725 QETH_CARD_TEXT(card, 3, "stsrcmac"); in qeth_l3_start_ipa_source_mac()
727 if (!qeth_is_supported(card, IPA_SOURCE_MAC)) { in qeth_l3_start_ipa_source_mac()
728 dev_info(&card->gdev->dev, in qeth_l3_start_ipa_source_mac()
730 netdev_name(card->dev)); in qeth_l3_start_ipa_source_mac()
734 rc = qeth_send_simple_setassparms(card, IPA_SOURCE_MAC, in qeth_l3_start_ipa_source_mac()
737 dev_warn(&card->gdev->dev, in qeth_l3_start_ipa_source_mac()
739 netdev_name(card->dev)); in qeth_l3_start_ipa_source_mac()
743 static int qeth_l3_start_ipa_vlan(struct qeth_card *card) in qeth_l3_start_ipa_vlan() argument
747 QETH_CARD_TEXT(card, 3, "strtvlan"); in qeth_l3_start_ipa_vlan()
749 if (!qeth_is_supported(card, IPA_FULL_VLAN)) { in qeth_l3_start_ipa_vlan()
750 dev_info(&card->gdev->dev, in qeth_l3_start_ipa_vlan()
751 "VLAN not supported on %s\n", netdev_name(card->dev)); in qeth_l3_start_ipa_vlan()
755 rc = qeth_send_simple_setassparms(card, IPA_VLAN_PRIO, in qeth_l3_start_ipa_vlan()
758 dev_warn(&card->gdev->dev, in qeth_l3_start_ipa_vlan()
760 netdev_name(card->dev)); in qeth_l3_start_ipa_vlan()
762 dev_info(&card->gdev->dev, "VLAN enabled\n"); in qeth_l3_start_ipa_vlan()
767 static int qeth_l3_start_ipa_multicast(struct qeth_card *card) in qeth_l3_start_ipa_multicast() argument
771 QETH_CARD_TEXT(card, 3, "stmcast"); in qeth_l3_start_ipa_multicast()
773 if (!qeth_is_supported(card, IPA_MULTICASTING)) { in qeth_l3_start_ipa_multicast()
774 dev_info(&card->gdev->dev, in qeth_l3_start_ipa_multicast()
776 netdev_name(card->dev)); in qeth_l3_start_ipa_multicast()
780 rc = qeth_send_simple_setassparms(card, IPA_MULTICASTING, in qeth_l3_start_ipa_multicast()
783 dev_warn(&card->gdev->dev, in qeth_l3_start_ipa_multicast()
785 netdev_name(card->dev)); in qeth_l3_start_ipa_multicast()
787 dev_info(&card->gdev->dev, "Multicast enabled\n"); in qeth_l3_start_ipa_multicast()
788 card->dev->flags |= IFF_MULTICAST; in qeth_l3_start_ipa_multicast()
793 static int qeth_l3_softsetup_ipv6(struct qeth_card *card) in qeth_l3_softsetup_ipv6() argument
798 QETH_CARD_TEXT(card, 3, "softipv6"); in qeth_l3_softsetup_ipv6()
800 if (IS_IQD(card)) in qeth_l3_softsetup_ipv6()
803 rc = qeth_send_simple_setassparms(card, IPA_IPV6, IPA_CMD_ASS_START, in qeth_l3_softsetup_ipv6()
806 dev_err(&card->gdev->dev, in qeth_l3_softsetup_ipv6()
808 netdev_name(card->dev)); in qeth_l3_softsetup_ipv6()
811 rc = qeth_send_simple_setassparms_v6(card, IPA_IPV6, IPA_CMD_ASS_START, in qeth_l3_softsetup_ipv6()
814 dev_err(&card->gdev->dev, in qeth_l3_softsetup_ipv6()
816 netdev_name(card->dev)); in qeth_l3_softsetup_ipv6()
819 rc = qeth_send_simple_setassparms_v6(card, IPA_PASSTHRU, in qeth_l3_softsetup_ipv6()
822 dev_warn(&card->gdev->dev, in qeth_l3_softsetup_ipv6()
824 netdev_name(card->dev)); in qeth_l3_softsetup_ipv6()
828 dev_info(&card->gdev->dev, "IPV6 enabled\n"); in qeth_l3_softsetup_ipv6()
832 static int qeth_l3_start_ipa_ipv6(struct qeth_card *card) in qeth_l3_start_ipa_ipv6() argument
834 QETH_CARD_TEXT(card, 3, "strtipv6"); in qeth_l3_start_ipa_ipv6()
836 if (!qeth_is_supported(card, IPA_IPV6)) { in qeth_l3_start_ipa_ipv6()
837 dev_info(&card->gdev->dev, in qeth_l3_start_ipa_ipv6()
838 "IPv6 not supported on %s\n", netdev_name(card->dev)); in qeth_l3_start_ipa_ipv6()
841 return qeth_l3_softsetup_ipv6(card); in qeth_l3_start_ipa_ipv6()
844 static int qeth_l3_start_ipa_broadcast(struct qeth_card *card) in qeth_l3_start_ipa_broadcast() argument
849 QETH_CARD_TEXT(card, 3, "stbrdcst"); in qeth_l3_start_ipa_broadcast()
850 card->info.broadcast_capable = 0; in qeth_l3_start_ipa_broadcast()
851 if (!qeth_is_supported(card, IPA_FILTERING)) { in qeth_l3_start_ipa_broadcast()
852 dev_info(&card->gdev->dev, in qeth_l3_start_ipa_broadcast()
854 netdev_name(card->dev)); in qeth_l3_start_ipa_broadcast()
858 rc = qeth_send_simple_setassparms(card, IPA_FILTERING, in qeth_l3_start_ipa_broadcast()
861 dev_warn(&card->gdev->dev, in qeth_l3_start_ipa_broadcast()
863 netdev_name(card->dev)); in qeth_l3_start_ipa_broadcast()
867 rc = qeth_send_simple_setassparms(card, IPA_FILTERING, in qeth_l3_start_ipa_broadcast()
870 dev_warn(&card->gdev->dev, in qeth_l3_start_ipa_broadcast()
872 netdev_name(card->dev)); in qeth_l3_start_ipa_broadcast()
875 card->info.broadcast_capable = QETH_BROADCAST_WITH_ECHO; in qeth_l3_start_ipa_broadcast()
876 dev_info(&card->gdev->dev, "Broadcast enabled\n"); in qeth_l3_start_ipa_broadcast()
877 rc = qeth_send_simple_setassparms(card, IPA_FILTERING, in qeth_l3_start_ipa_broadcast()
880 dev_warn(&card->gdev->dev, in qeth_l3_start_ipa_broadcast()
882 netdev_name(card->dev)); in qeth_l3_start_ipa_broadcast()
885 card->info.broadcast_capable = QETH_BROADCAST_WITHOUT_ECHO; in qeth_l3_start_ipa_broadcast()
887 if (card->info.broadcast_capable) in qeth_l3_start_ipa_broadcast()
888 card->dev->flags |= IFF_BROADCAST; in qeth_l3_start_ipa_broadcast()
890 card->dev->flags &= ~IFF_BROADCAST; in qeth_l3_start_ipa_broadcast()
894 static void qeth_l3_start_ipassists(struct qeth_card *card) in qeth_l3_start_ipassists() argument
896 QETH_CARD_TEXT(card, 3, "strtipas"); in qeth_l3_start_ipassists()
898 qeth_l3_start_ipa_arp_processing(card); /* go on*/ in qeth_l3_start_ipassists()
899 qeth_l3_start_ipa_source_mac(card); /* go on*/ in qeth_l3_start_ipassists()
900 qeth_l3_start_ipa_vlan(card); /* go on*/ in qeth_l3_start_ipassists()
901 qeth_l3_start_ipa_multicast(card); /* go on*/ in qeth_l3_start_ipassists()
902 qeth_l3_start_ipa_ipv6(card); /* go on*/ in qeth_l3_start_ipassists()
903 qeth_l3_start_ipa_broadcast(card); /* go on*/ in qeth_l3_start_ipassists()
906 static int qeth_l3_iqd_read_initial_mac_cb(struct qeth_card *card, in qeth_l3_iqd_read_initial_mac_cb() argument
916 eth_hw_addr_set(card->dev, cmd->data.create_destroy_addr.mac_addr); in qeth_l3_iqd_read_initial_mac_cb()
920 static int qeth_l3_iqd_read_initial_mac(struct qeth_card *card) in qeth_l3_iqd_read_initial_mac() argument
925 QETH_CARD_TEXT(card, 2, "hsrmac"); in qeth_l3_iqd_read_initial_mac()
927 iob = qeth_ipa_alloc_cmd(card, IPA_CMD_CREATE_ADDR, QETH_PROT_IPV6, in qeth_l3_iqd_read_initial_mac()
932 rc = qeth_send_ipa_cmd(card, iob, qeth_l3_iqd_read_initial_mac_cb, in qeth_l3_iqd_read_initial_mac()
937 static int qeth_l3_get_unique_id_cb(struct qeth_card *card, in qeth_l3_get_unique_id_cb() argument
948 dev_warn(&card->gdev->dev, "The network adapter failed to generate a unique ID\n"); in qeth_l3_get_unique_id_cb()
952 static u16 qeth_l3_get_unique_id(struct qeth_card *card, u16 uid) in qeth_l3_get_unique_id() argument
956 QETH_CARD_TEXT(card, 2, "guniqeid"); in qeth_l3_get_unique_id()
958 if (!qeth_is_supported(card, IPA_IPV6)) in qeth_l3_get_unique_id()
961 iob = qeth_ipa_alloc_cmd(card, IPA_CMD_CREATE_ADDR, QETH_PROT_IPV6, in qeth_l3_get_unique_id()
967 qeth_send_ipa_cmd(card, iob, qeth_l3_get_unique_id_cb, &uid); in qeth_l3_get_unique_id()
974 qeth_diags_trace_cb(struct qeth_card *card, struct qeth_reply *reply, in qeth_diags_trace_cb() argument
980 QETH_CARD_TEXT(card, 2, "diastrcb"); in qeth_diags_trace_cb()
985 QETH_CARD_TEXT_(card, 2, "dxter%x", rc); in qeth_diags_trace_cb()
993 card->info.promisc_mode = SET_PROMISC_MODE_OFF; in qeth_diags_trace_cb()
994 dev_info(&card->gdev->dev, "The HiperSockets network " in qeth_diags_trace_cb()
1004 card->info.promisc_mode = SET_PROMISC_MODE_ON; in qeth_diags_trace_cb()
1005 dev_info(&card->gdev->dev, "The HiperSockets network " in qeth_diags_trace_cb()
1009 dev_warn(&card->gdev->dev, "The device is not " in qeth_diags_trace_cb()
1014 dev_warn(&card->gdev->dev, "A HiperSockets " in qeth_diags_trace_cb()
1024 cmd->data.diagass.action, CARD_DEVID(card)); in qeth_diags_trace_cb()
1031 qeth_diags_trace(struct qeth_card *card, enum qeth_diags_trace_cmds diags_cmd) in qeth_diags_trace() argument
1036 QETH_CARD_TEXT(card, 2, "diagtrac"); in qeth_diags_trace()
1038 iob = qeth_get_diag_cmd(card, QETH_DIAGS_CMD_TRACE, 0); in qeth_diags_trace()
1044 return qeth_send_ipa_cmd(card, iob, qeth_diags_trace_cb, NULL); in qeth_diags_trace()
1049 struct qeth_card *card = arg; in qeth_l3_add_mcast_rtnl() local
1057 QETH_CARD_TEXT(card, 4, "addmc"); in qeth_l3_add_mcast_rtnl()
1074 ipm = qeth_l3_find_addr_by_ip(card, &tmp); in qeth_l3_add_mcast_rtnl()
1085 hash_add(card->rx_mode_addrs, &ipm->hnode, in qeth_l3_add_mcast_rtnl()
1090 if (!qeth_is_supported(card, IPA_IPV6)) in qeth_l3_add_mcast_rtnl()
1106 ipm = qeth_l3_find_addr_by_ip(card, &tmp); in qeth_l3_add_mcast_rtnl()
1117 hash_add(card->rx_mode_addrs, &ipm->hnode, in qeth_l3_add_mcast_rtnl()
1126 static void qeth_l3_set_promisc_mode(struct qeth_card *card) in qeth_l3_set_promisc_mode() argument
1128 bool enable = card->dev->flags & IFF_PROMISC; in qeth_l3_set_promisc_mode()
1130 if (card->info.promisc_mode == enable) in qeth_l3_set_promisc_mode()
1133 if (IS_VM_NIC(card)) { /* Guestlan trace */ in qeth_l3_set_promisc_mode()
1134 if (qeth_adp_supported(card, IPA_SETADP_SET_PROMISC_MODE)) in qeth_l3_set_promisc_mode()
1135 qeth_setadp_promisc_mode(card, enable); in qeth_l3_set_promisc_mode()
1136 } else if (card->options.sniffer && /* HiperSockets trace */ in qeth_l3_set_promisc_mode()
1137 qeth_adp_supported(card, IPA_SETADP_SET_DIAG_ASSIST)) { in qeth_l3_set_promisc_mode()
1139 QETH_CARD_TEXT(card, 3, "+promisc"); in qeth_l3_set_promisc_mode()
1140 qeth_diags_trace(card, QETH_DIAGS_CMD_TRACE_ENABLE); in qeth_l3_set_promisc_mode()
1142 QETH_CARD_TEXT(card, 3, "-promisc"); in qeth_l3_set_promisc_mode()
1143 qeth_diags_trace(card, QETH_DIAGS_CMD_TRACE_DISABLE); in qeth_l3_set_promisc_mode()
1150 struct qeth_card *card = container_of(work, struct qeth_card, in qeth_l3_rx_mode_work() local
1156 QETH_CARD_TEXT(card, 3, "setmulti"); in qeth_l3_rx_mode_work()
1158 if (!card->options.sniffer) { in qeth_l3_rx_mode_work()
1160 qeth_l3_add_mcast_rtnl(card->dev, 0, card); in qeth_l3_rx_mode_work()
1161 if (qeth_is_supported(card, IPA_FULL_VLAN)) in qeth_l3_rx_mode_work()
1162 vlan_for_each(card->dev, qeth_l3_add_mcast_rtnl, card); in qeth_l3_rx_mode_work()
1165 hash_for_each_safe(card->rx_mode_addrs, i, tmp, addr, hnode) { in qeth_l3_rx_mode_work()
1168 rc = qeth_l3_deregister_addr_entry(card, addr); in qeth_l3_rx_mode_work()
1175 rc = qeth_l3_register_addr_entry(card, addr); in qeth_l3_rx_mode_work()
1189 qeth_l3_set_promisc_mode(card); in qeth_l3_rx_mode_work()
1209 static int qeth_l3_arp_cmd_cb(struct qeth_card *card, struct qeth_reply *reply, in qeth_l3_arp_cmd_cb() argument
1214 qeth_setassparms_cb(card, reply, data); in qeth_l3_arp_cmd_cb()
1218 static int qeth_l3_arp_set_no_entries(struct qeth_card *card, int no_entries) in qeth_l3_arp_set_no_entries() argument
1223 QETH_CARD_TEXT(card, 3, "arpstnoe"); in qeth_l3_arp_set_no_entries()
1230 if (IS_VM_NIC(card)) in qeth_l3_arp_set_no_entries()
1232 if (!qeth_is_supported(card, IPA_ARP_PROCESSING)) { in qeth_l3_arp_set_no_entries()
1236 iob = qeth_get_setassparms_cmd(card, IPA_ARP_PROCESSING, in qeth_l3_arp_set_no_entries()
1244 rc = qeth_send_ipa_cmd(card, iob, qeth_l3_arp_cmd_cb, NULL); in qeth_l3_arp_set_no_entries()
1247 CARD_DEVID(card), rc); in qeth_l3_arp_set_no_entries()
1251 static __u32 get_arp_entry_size(struct qeth_card *card, in get_arp_entry_size() argument
1260 QETH_CARD_TEXT(card, 4, "arpev4"); in get_arp_entry_size()
1269 QETH_CARD_TEXT(card, 4, "arpev6"); in get_arp_entry_size()
1280 QETH_CARD_TEXT(card, 4, "arpinv"); in get_arp_entry_size()
1293 static int qeth_l3_arp_query_cb(struct qeth_card *card, in qeth_l3_arp_query_cb() argument
1304 QETH_CARD_TEXT(card, 3, "arpquecb"); in qeth_l3_arp_query_cb()
1308 QETH_CARD_TEXT_(card, 4, "%i", cmd->hdr.prot_version); in qeth_l3_arp_query_cb()
1310 QETH_CARD_TEXT(card, 4, "arpcberr"); in qeth_l3_arp_query_cb()
1311 QETH_CARD_TEXT_(card, 4, "%i", cmd->hdr.return_code); in qeth_l3_arp_query_cb()
1316 QETH_CARD_TEXT(card, 4, "setaperr"); in qeth_l3_arp_query_cb()
1317 QETH_CARD_TEXT_(card, 4, "%i", cmd->hdr.return_code); in qeth_l3_arp_query_cb()
1321 QETH_CARD_TEXT_(card, 4, "anoen%i", qdata->no_entries); in qeth_l3_arp_query_cb()
1334 QETH_CARD_TEXT(card, 4, "pmis"); in qeth_l3_arp_query_cb()
1335 QETH_CARD_TEXT_(card, 4, "%i", etype->ip); in qeth_l3_arp_query_cb()
1338 esize = get_arp_entry_size(card, qdata, etype, in qeth_l3_arp_query_cb()
1340 QETH_CARD_TEXT_(card, 5, "esz%i", esize); in qeth_l3_arp_query_cb()
1345 QETH_CARD_TEXT_(card, 4, "qaer3%i", -ENOSPC); in qeth_l3_arp_query_cb()
1361 QETH_CARD_TEXT_(card, 4, "nove%i", qinfo->no_entries); in qeth_l3_arp_query_cb()
1368 QETH_CARD_TEXT_(card, 4, "rc%i", 0); in qeth_l3_arp_query_cb()
1372 static int qeth_l3_query_arp_cache_info(struct qeth_card *card, in qeth_l3_query_arp_cache_info() argument
1380 QETH_CARD_TEXT_(card, 3, "qarpipv%i", prot); in qeth_l3_query_arp_cache_info()
1382 iob = qeth_get_setassparms_cmd(card, IPA_ARP_PROCESSING, in qeth_l3_query_arp_cache_info()
1389 rc = qeth_send_ipa_cmd(card, iob, qeth_l3_arp_query_cb, qinfo); in qeth_l3_query_arp_cache_info()
1392 CARD_DEVID(card), rc); in qeth_l3_query_arp_cache_info()
1396 static int qeth_l3_arp_query(struct qeth_card *card, char __user *udata) in qeth_l3_arp_query() argument
1401 QETH_CARD_TEXT(card, 3, "arpquery"); in qeth_l3_arp_query()
1403 if (!qeth_is_supported(card,/*IPA_QUERY_ARP_ADDR_INFO*/ in qeth_l3_arp_query()
1405 QETH_CARD_TEXT(card, 3, "arpqnsup"); in qeth_l3_arp_query()
1420 rc = qeth_l3_query_arp_cache_info(card, QETH_PROT_IPV4, &qinfo); in qeth_l3_arp_query()
1428 qeth_l3_query_arp_cache_info(card, QETH_PROT_IPV6, &qinfo); in qeth_l3_arp_query()
1431 QETH_CARD_TEXT(card, 4, "qactf"); in qeth_l3_arp_query()
1435 QETH_CARD_TEXT(card, 4, "qacts"); in qeth_l3_arp_query()
1443 static int qeth_l3_arp_modify_entry(struct qeth_card *card, in qeth_l3_arp_modify_entry() argument
1452 QETH_CARD_TEXT(card, 3, "arpadd"); in qeth_l3_arp_modify_entry()
1454 QETH_CARD_TEXT(card, 3, "arpdel"); in qeth_l3_arp_modify_entry()
1461 if (IS_VM_NIC(card)) in qeth_l3_arp_modify_entry()
1463 if (!qeth_is_supported(card, IPA_ARP_PROCESSING)) { in qeth_l3_arp_modify_entry()
1467 iob = qeth_get_setassparms_cmd(card, IPA_ARP_PROCESSING, arp_cmd, in qeth_l3_arp_modify_entry()
1476 rc = qeth_send_ipa_cmd(card, iob, qeth_l3_arp_cmd_cb, NULL); in qeth_l3_arp_modify_entry()
1479 arp_cmd, CARD_DEVID(card), rc); in qeth_l3_arp_modify_entry()
1483 static int qeth_l3_arp_flush_cache(struct qeth_card *card) in qeth_l3_arp_flush_cache() argument
1488 QETH_CARD_TEXT(card, 3, "arpflush"); in qeth_l3_arp_flush_cache()
1495 if (IS_VM_NIC(card) || IS_IQD(card)) in qeth_l3_arp_flush_cache()
1497 if (!qeth_is_supported(card, IPA_ARP_PROCESSING)) { in qeth_l3_arp_flush_cache()
1501 iob = qeth_get_setassparms_cmd(card, IPA_ARP_PROCESSING, in qeth_l3_arp_flush_cache()
1507 rc = qeth_send_ipa_cmd(card, iob, qeth_l3_arp_cmd_cb, NULL); in qeth_l3_arp_flush_cache()
1510 CARD_DEVID(card), rc); in qeth_l3_arp_flush_cache()
1517 struct qeth_card *card = dev->ml_priv; in qeth_l3_ndo_siocdevprivate() local
1528 rc = qeth_l3_arp_set_no_entries(card, rq->ifr_ifru.ifru_ivalue); in qeth_l3_ndo_siocdevprivate()
1535 rc = qeth_l3_arp_query(card, data); in qeth_l3_ndo_siocdevprivate()
1547 return qeth_l3_arp_modify_entry(card, &arp_entry, arp_cmd); in qeth_l3_ndo_siocdevprivate()
1553 rc = qeth_l3_arp_flush_cache(card); in qeth_l3_ndo_siocdevprivate()
1628 struct qeth_card *card = queue->card; in qeth_l3_fill_header() local
1647 if (proto == htons(ETH_P_IP) || IS_IQD(card)) { in qeth_l3_fill_header()
1661 if (IS_IQD(card) && skb_get_queue_mapping(skb) != QETH_IQD_MCAST_TXQ) in qeth_l3_fill_header()
1676 if (!IS_IQD(card)) in qeth_l3_fill_header()
1706 static int qeth_l3_xmit(struct qeth_card *card, struct sk_buff *skb, in qeth_l3_xmit() argument
1721 return qeth_xmit(card, skb, queue, proto, qeth_l3_fill_header); in qeth_l3_xmit()
1727 struct qeth_card *card = dev->ml_priv; in qeth_l3_hard_start_xmit() local
1735 if (IS_IQD(card)) { in qeth_l3_hard_start_xmit()
1736 queue = card->qdio.out_qs[qeth_iqd_translate_txq(dev, txq)]; in qeth_l3_hard_start_xmit()
1738 if (card->options.sniffer) in qeth_l3_hard_start_xmit()
1743 if (card->options.cq != QETH_CQ_ENABLED) in qeth_l3_hard_start_xmit()
1748 if (card->options.cq == QETH_CQ_ENABLED) in qeth_l3_hard_start_xmit()
1755 queue = card->qdio.out_qs[txq]; in qeth_l3_hard_start_xmit()
1762 if (proto == htons(ETH_P_IP) || IS_IQD(card)) in qeth_l3_hard_start_xmit()
1763 rc = qeth_l3_xmit(card, skb, queue, proto); in qeth_l3_hard_start_xmit()
1765 rc = qeth_xmit(card, skb, queue, proto, qeth_l3_fill_header); in qeth_l3_hard_start_xmit()
1778 struct qeth_card *card = dev->ml_priv; in qeth_l3_set_rx_mode() local
1780 schedule_work(&card->rx_mode_work); in qeth_l3_set_rx_mode()
1857 static int qeth_l3_setup_netdev(struct qeth_card *card) in qeth_l3_setup_netdev() argument
1859 struct net_device *dev = card->dev; in qeth_l3_setup_netdev()
1863 if (IS_OSD(card) || IS_OSX(card)) { in qeth_l3_setup_netdev()
1864 card->dev->netdev_ops = &qeth_l3_osa_netdev_ops; in qeth_l3_setup_netdev()
1867 dev->dev_id = qeth_l3_get_unique_id(card, dev->dev_id); in qeth_l3_setup_netdev()
1869 if (!IS_VM_NIC(card)) { in qeth_l3_setup_netdev()
1870 card->dev->features |= NETIF_F_SG; in qeth_l3_setup_netdev()
1871 card->dev->hw_features |= NETIF_F_TSO | in qeth_l3_setup_netdev()
1873 card->dev->vlan_features |= NETIF_F_TSO | in qeth_l3_setup_netdev()
1877 if (qeth_is_supported6(card, IPA_OUTBOUND_CHECKSUM_V6)) { in qeth_l3_setup_netdev()
1878 card->dev->hw_features |= NETIF_F_IPV6_CSUM; in qeth_l3_setup_netdev()
1879 card->dev->vlan_features |= NETIF_F_IPV6_CSUM; in qeth_l3_setup_netdev()
1881 if (qeth_is_supported6(card, IPA_OUTBOUND_TSO)) { in qeth_l3_setup_netdev()
1882 card->dev->hw_features |= NETIF_F_TSO6; in qeth_l3_setup_netdev()
1883 card->dev->vlan_features |= NETIF_F_TSO6; in qeth_l3_setup_netdev()
1887 if (card->dev->hw_features & NETIF_F_TSO6) in qeth_l3_setup_netdev()
1889 else if (card->dev->hw_features & NETIF_F_TSO) in qeth_l3_setup_netdev()
1893 } else if (IS_IQD(card)) { in qeth_l3_setup_netdev()
1894 card->dev->flags |= IFF_NOARP; in qeth_l3_setup_netdev()
1895 card->dev->netdev_ops = &qeth_l3_netdev_ops; in qeth_l3_setup_netdev()
1898 rc = qeth_l3_iqd_read_initial_mac(card); in qeth_l3_setup_netdev()
1904 card->dev->needed_headroom = headroom; in qeth_l3_setup_netdev()
1905 card->dev->features |= NETIF_F_HW_VLAN_CTAG_TX | in qeth_l3_setup_netdev()
1908 netif_keep_dst(card->dev); in qeth_l3_setup_netdev()
1909 if (card->dev->hw_features & (NETIF_F_TSO | NETIF_F_TSO6)) in qeth_l3_setup_netdev()
1910 netif_set_tso_max_size(card->dev, in qeth_l3_setup_netdev()
1911 PAGE_SIZE * (QETH_MAX_BUFFER_ELEMENTS(card) - 1)); in qeth_l3_setup_netdev()
1913 netif_napi_add(card->dev, &card->napi, qeth_poll); in qeth_l3_setup_netdev()
1914 return register_netdev(card->dev); in qeth_l3_setup_netdev()
1924 struct qeth_card *card = dev_get_drvdata(&gdev->dev); in qeth_l3_probe_device() local
1927 hash_init(card->ip_htable); in qeth_l3_probe_device()
1928 mutex_init(&card->ip_lock); in qeth_l3_probe_device()
1929 card->cmd_wq = alloc_ordered_workqueue("%s_cmd", 0, in qeth_l3_probe_device()
1931 if (!card->cmd_wq) in qeth_l3_probe_device()
1937 destroy_workqueue(card->cmd_wq); in qeth_l3_probe_device()
1944 INIT_WORK(&card->rx_mode_work, qeth_l3_rx_mode_work); in qeth_l3_probe_device()
1950 struct qeth_card *card = dev_get_drvdata(&cgdev->dev); in qeth_l3_remove_device() local
1955 qeth_set_allowed_threads(card, 0, 1); in qeth_l3_remove_device()
1956 wait_event(card->wait_q, qeth_threads_running(card, 0xffffffff) == 0); in qeth_l3_remove_device()
1959 qeth_set_offline(card, card->discipline, false); in qeth_l3_remove_device()
1961 if (card->dev->reg_state == NETREG_REGISTERED) in qeth_l3_remove_device()
1962 unregister_netdev(card->dev); in qeth_l3_remove_device()
1964 destroy_workqueue(card->cmd_wq); in qeth_l3_remove_device()
1965 qeth_l3_clear_ip_htable(card, 0); in qeth_l3_remove_device()
1966 qeth_l3_clear_ipato_list(card); in qeth_l3_remove_device()
1969 static int qeth_l3_set_online(struct qeth_card *card, bool carrier_ok) in qeth_l3_set_online() argument
1971 struct net_device *dev = card->dev; in qeth_l3_set_online()
1975 QETH_CARD_TEXT(card, 2, "softsetp"); in qeth_l3_set_online()
1977 rc = qeth_l3_setadapter_parms(card); in qeth_l3_set_online()
1979 QETH_CARD_TEXT_(card, 2, "2err%04x", rc); in qeth_l3_set_online()
1980 if (!card->options.sniffer) { in qeth_l3_set_online()
1981 qeth_l3_start_ipassists(card); in qeth_l3_set_online()
1983 rc = qeth_l3_setrouting_v4(card); in qeth_l3_set_online()
1985 QETH_CARD_TEXT_(card, 2, "4err%04x", rc); in qeth_l3_set_online()
1986 rc = qeth_l3_setrouting_v6(card); in qeth_l3_set_online()
1988 QETH_CARD_TEXT_(card, 2, "5err%04x", rc); in qeth_l3_set_online()
1991 card->state = CARD_STATE_SOFTSETUP; in qeth_l3_set_online()
1993 qeth_set_allowed_threads(card, 0xffffffff, 0); in qeth_l3_set_online()
1994 qeth_l3_recover_ip(card); in qeth_l3_set_online()
1997 rc = qeth_l3_setup_netdev(card); in qeth_l3_set_online()
2005 rc = qeth_set_real_num_tx_queues(card, in qeth_l3_set_online()
2006 qeth_tx_actual_queues(card)); in qeth_l3_set_online()
2020 if (card->info.open_when_online) { in qeth_l3_set_online()
2021 card->info.open_when_online = 0; in qeth_l3_set_online()
2030 qeth_set_allowed_threads(card, 0, 1); in qeth_l3_set_online()
2031 card->state = CARD_STATE_DOWN; in qeth_l3_set_online()
2032 qeth_l3_clear_ip_htable(card, 1); in qeth_l3_set_online()
2036 static void qeth_l3_set_offline(struct qeth_card *card) in qeth_l3_set_offline() argument
2038 qeth_set_allowed_threads(card, 0, 1); in qeth_l3_set_offline()
2039 qeth_l3_drain_rx_mode_cache(card); in qeth_l3_set_offline()
2041 if (card->options.sniffer && in qeth_l3_set_offline()
2042 (card->info.promisc_mode == SET_PROMISC_MODE_ON)) in qeth_l3_set_offline()
2043 qeth_diags_trace(card, QETH_DIAGS_CMD_TRACE_DISABLE); in qeth_l3_set_offline()
2045 if (card->state == CARD_STATE_SOFTSETUP) { in qeth_l3_set_offline()
2046 card->state = CARD_STATE_DOWN; in qeth_l3_set_offline()
2047 qeth_l3_clear_ip_htable(card, 1); in qeth_l3_set_offline()
2052 static int qeth_l3_control_event(struct qeth_card *card, in qeth_l3_control_event() argument
2067 static int qeth_l3_handle_ip_event(struct qeth_card *card, in qeth_l3_handle_ip_event() argument
2073 qeth_l3_modify_ip(card, addr, true); in qeth_l3_handle_ip_event()
2076 qeth_l3_modify_ip(card, addr, false); in qeth_l3_handle_ip_event()
2085 struct qeth_card *card; member
2095 qeth_l3_modify_ip(ip_work->card, &ip_work->addr, true); in qeth_l3_add_ip_worker()
2103 qeth_l3_modify_ip(ip_work->card, &ip_work->addr, false); in qeth_l3_delete_ip_worker()
2123 struct qeth_card *card; in qeth_l3_ip_event() local
2125 card = qeth_l3_get_card_from_dev(dev); in qeth_l3_ip_event()
2126 if (!card) in qeth_l3_ip_event()
2128 QETH_CARD_TEXT(card, 3, "ipevent"); in qeth_l3_ip_event()
2134 return qeth_l3_handle_ip_event(card, &addr, event); in qeth_l3_ip_event()
2148 struct qeth_card *card; in qeth_l3_ip6_event() local
2153 card = qeth_l3_get_card_from_dev(dev); in qeth_l3_ip6_event()
2154 if (!card) in qeth_l3_ip6_event()
2156 QETH_CARD_TEXT(card, 3, "ip6event"); in qeth_l3_ip6_event()
2157 if (!qeth_is_supported(card, IPA_IPV6)) in qeth_l3_ip6_event()
2169 ip_work->card = card; in qeth_l3_ip6_event()
2175 queue_work(card->cmd_wq, &ip_work->work); in qeth_l3_ip6_event()