Lines Matching full:card

55 static struct qeth_ipaddr *qeth_l3_find_addr_by_ip(struct qeth_card *card,  in qeth_l3_find_addr_by_ip()  argument
62 hash_for_each_possible(card->rx_mode_addrs, addr, hnode, key) in qeth_l3_find_addr_by_ip()
66 hash_for_each_possible(card->ip_htable, addr, hnode, key) in qeth_l3_find_addr_by_ip()
87 static bool qeth_l3_is_addr_covered_by_ipato(struct qeth_card *card, in qeth_l3_is_addr_covered_by_ipato() argument
95 if (!card->ipato.enabled) in qeth_l3_is_addr_covered_by_ipato()
102 list_for_each_entry(ipatoe, &card->ipato.entries, entry) { in qeth_l3_is_addr_covered_by_ipato()
113 if ((addr->proto == QETH_PROT_IPV4) && card->ipato.invert4) in qeth_l3_is_addr_covered_by_ipato()
115 else if ((addr->proto == QETH_PROT_IPV6) && card->ipato.invert6) in qeth_l3_is_addr_covered_by_ipato()
121 static int qeth_l3_delete_ip(struct qeth_card *card, in qeth_l3_delete_ip() argument
128 QETH_CARD_TEXT(card, 2, "delrxip"); in qeth_l3_delete_ip()
130 QETH_CARD_TEXT(card, 2, "delvipa"); in qeth_l3_delete_ip()
132 QETH_CARD_TEXT(card, 2, "delip"); in qeth_l3_delete_ip()
135 QETH_CARD_HEX(card, 4, &tmp_addr->u.a4.addr, 4); in qeth_l3_delete_ip()
137 QETH_CARD_HEX(card, 4, &tmp_addr->u.a6.addr, 8); in qeth_l3_delete_ip()
138 QETH_CARD_HEX(card, 4, ((char *)&tmp_addr->u.a6.addr) + 8, 8); in qeth_l3_delete_ip()
141 addr = qeth_l3_find_addr_by_ip(card, tmp_addr); in qeth_l3_delete_ip()
149 if (qeth_card_hw_is_reachable(card)) in qeth_l3_delete_ip()
150 rc = qeth_l3_deregister_addr_entry(card, addr); in qeth_l3_delete_ip()
158 static int qeth_l3_add_ip(struct qeth_card *card, struct qeth_ipaddr *tmp_addr) in qeth_l3_add_ip() argument
165 QETH_CARD_TEXT(card, 2, "addrxip"); in qeth_l3_add_ip()
167 QETH_CARD_TEXT(card, 2, "addvipa"); in qeth_l3_add_ip()
169 QETH_CARD_TEXT(card, 2, "addip"); in qeth_l3_add_ip()
172 QETH_CARD_HEX(card, 4, &tmp_addr->u.a4.addr, 4); in qeth_l3_add_ip()
174 QETH_CARD_HEX(card, 4, &tmp_addr->u.a6.addr, 8); in qeth_l3_add_ip()
175 QETH_CARD_HEX(card, 4, ((char *)&tmp_addr->u.a6.addr) + 8, 8); in qeth_l3_add_ip()
178 addr = qeth_l3_find_addr_by_ip(card, tmp_addr); in qeth_l3_add_ip()
188 dev_warn(&card->gdev->dev, in qeth_l3_add_ip()
196 if (qeth_l3_is_addr_covered_by_ipato(card, addr)) { in qeth_l3_add_ip()
197 QETH_CARD_TEXT(card, 2, "tkovaddr"); in qeth_l3_add_ip()
200 hash_add(card->ip_htable, &addr->hnode, in qeth_l3_add_ip()
203 if (!qeth_card_hw_is_reachable(card)) { in qeth_l3_add_ip()
208 rc = qeth_l3_register_addr_entry(card, addr); in qeth_l3_add_ip()
220 static int qeth_l3_modify_ip(struct qeth_card *card, struct qeth_ipaddr *addr, in qeth_l3_modify_ip() argument
225 mutex_lock(&card->ip_lock); in qeth_l3_modify_ip()
226 rc = add ? qeth_l3_add_ip(card, addr) : qeth_l3_delete_ip(card, addr); in qeth_l3_modify_ip()
227 mutex_unlock(&card->ip_lock); in qeth_l3_modify_ip()
232 static void qeth_l3_drain_rx_mode_cache(struct qeth_card *card) in qeth_l3_drain_rx_mode_cache() argument
238 hash_for_each_safe(card->rx_mode_addrs, i, tmp, addr, hnode) { in qeth_l3_drain_rx_mode_cache()
244 static void qeth_l3_clear_ip_htable(struct qeth_card *card, int recover) in qeth_l3_clear_ip_htable() argument
250 QETH_CARD_TEXT(card, 4, "clearip"); in qeth_l3_clear_ip_htable()
252 mutex_lock(&card->ip_lock); in qeth_l3_clear_ip_htable()
254 hash_for_each_safe(card->ip_htable, i, tmp, addr, hnode) { in qeth_l3_clear_ip_htable()
264 mutex_unlock(&card->ip_lock); in qeth_l3_clear_ip_htable()
267 static void qeth_l3_recover_ip(struct qeth_card *card) in qeth_l3_recover_ip() argument
274 QETH_CARD_TEXT(card, 4, "recovrip"); in qeth_l3_recover_ip()
276 mutex_lock(&card->ip_lock); in qeth_l3_recover_ip()
278 hash_for_each_safe(card->ip_htable, i, tmp, addr, hnode) { in qeth_l3_recover_ip()
280 rc = qeth_l3_register_addr_entry(card, addr); in qeth_l3_recover_ip()
293 mutex_unlock(&card->ip_lock); in qeth_l3_recover_ip()
296 static int qeth_l3_setdelip_cb(struct qeth_card *card, struct qeth_reply *reply, in qeth_l3_setdelip_cb() argument
315 static int qeth_l3_send_setdelmc(struct qeth_card *card, in qeth_l3_send_setdelmc() argument
322 QETH_CARD_TEXT(card, 4, "setdelmc"); in qeth_l3_send_setdelmc()
324 iob = qeth_ipa_alloc_cmd(card, ipacmd, addr->proto, in qeth_l3_send_setdelmc()
337 return qeth_send_ipa_cmd(card, iob, qeth_l3_setdelip_cb, NULL); in qeth_l3_send_setdelmc()
366 static int qeth_l3_send_setdelip(struct qeth_card *card, in qeth_l3_send_setdelip() argument
374 QETH_CARD_TEXT(card, 4, "setdelip"); in qeth_l3_send_setdelip()
376 iob = qeth_ipa_alloc_cmd(card, ipacmd, addr->proto, in qeth_l3_send_setdelip()
383 QETH_CARD_TEXT_(card, 4, "flags%02X", flags); in qeth_l3_send_setdelip()
396 return qeth_send_ipa_cmd(card, iob, qeth_l3_setdelip_cb, NULL); in qeth_l3_send_setdelip()
399 static int qeth_l3_send_setrouting(struct qeth_card *card, in qeth_l3_send_setrouting() argument
406 QETH_CARD_TEXT(card, 4, "setroutg"); in qeth_l3_send_setrouting()
407 iob = qeth_ipa_alloc_cmd(card, IPA_CMD_SETRTG, prot, in qeth_l3_send_setrouting()
413 rc = qeth_send_ipa_cmd(card, iob, NULL, NULL); in qeth_l3_send_setrouting()
418 static int qeth_l3_correct_routing_type(struct qeth_card *card, in qeth_l3_correct_routing_type() argument
421 if (IS_IQD(card)) { in qeth_l3_correct_routing_type()
438 if (qeth_is_ipafunc_supported(card, prot, in qeth_l3_correct_routing_type()
451 int qeth_l3_setrouting_v4(struct qeth_card *card) in qeth_l3_setrouting_v4() argument
455 QETH_CARD_TEXT(card, 3, "setrtg4"); in qeth_l3_setrouting_v4()
457 rc = qeth_l3_correct_routing_type(card, &card->options.route4.type, in qeth_l3_setrouting_v4()
462 rc = qeth_l3_send_setrouting(card, card->options.route4.type, in qeth_l3_setrouting_v4()
465 card->options.route4.type = NO_ROUTER; in qeth_l3_setrouting_v4()
467 rc, CARD_DEVID(card)); in qeth_l3_setrouting_v4()
472 int qeth_l3_setrouting_v6(struct qeth_card *card) in qeth_l3_setrouting_v6() argument
476 QETH_CARD_TEXT(card, 3, "setrtg6"); in qeth_l3_setrouting_v6()
478 if (!qeth_is_supported(card, IPA_IPV6)) in qeth_l3_setrouting_v6()
480 rc = qeth_l3_correct_routing_type(card, &card->options.route6.type, in qeth_l3_setrouting_v6()
485 rc = qeth_l3_send_setrouting(card, card->options.route6.type, in qeth_l3_setrouting_v6()
488 card->options.route6.type = NO_ROUTER; in qeth_l3_setrouting_v6()
490 rc, CARD_DEVID(card)); in qeth_l3_setrouting_v6()
504 void qeth_l3_update_ipato(struct qeth_card *card) in qeth_l3_update_ipato() argument
509 hash_for_each(card->ip_htable, i, addr, hnode) { in qeth_l3_update_ipato()
512 addr->ipato = qeth_l3_is_addr_covered_by_ipato(card, addr); in qeth_l3_update_ipato()
516 static void qeth_l3_clear_ipato_list(struct qeth_card *card) in qeth_l3_clear_ipato_list() argument
520 mutex_lock(&card->ip_lock); in qeth_l3_clear_ipato_list()
522 list_for_each_entry_safe(ipatoe, tmp, &card->ipato.entries, entry) { in qeth_l3_clear_ipato_list()
527 qeth_l3_update_ipato(card); in qeth_l3_clear_ipato_list()
528 mutex_unlock(&card->ip_lock); in qeth_l3_clear_ipato_list()
531 int qeth_l3_add_ipato_entry(struct qeth_card *card, in qeth_l3_add_ipato_entry() argument
537 QETH_CARD_TEXT(card, 2, "addipato"); in qeth_l3_add_ipato_entry()
539 mutex_lock(&card->ip_lock); in qeth_l3_add_ipato_entry()
541 list_for_each_entry(ipatoe, &card->ipato.entries, entry) { in qeth_l3_add_ipato_entry()
553 list_add_tail(&new->entry, &card->ipato.entries); in qeth_l3_add_ipato_entry()
554 qeth_l3_update_ipato(card); in qeth_l3_add_ipato_entry()
557 mutex_unlock(&card->ip_lock); in qeth_l3_add_ipato_entry()
562 int qeth_l3_del_ipato_entry(struct qeth_card *card, in qeth_l3_del_ipato_entry() argument
569 QETH_CARD_TEXT(card, 2, "delipato"); in qeth_l3_del_ipato_entry()
571 mutex_lock(&card->ip_lock); in qeth_l3_del_ipato_entry()
573 list_for_each_entry_safe(ipatoe, tmp, &card->ipato.entries, entry) { in qeth_l3_del_ipato_entry()
580 qeth_l3_update_ipato(card); in qeth_l3_del_ipato_entry()
586 mutex_unlock(&card->ip_lock); in qeth_l3_del_ipato_entry()
591 int qeth_l3_modify_rxip_vipa(struct qeth_card *card, bool add, const u8 *ip, in qeth_l3_modify_rxip_vipa() argument
603 return qeth_l3_modify_ip(card, &addr, add); in qeth_l3_modify_rxip_vipa()
606 int qeth_l3_modify_hsuid(struct qeth_card *card, bool add) in qeth_l3_modify_hsuid() argument
615 addr.u.a6.addr.s6_addr[8+i] = card->options.hsuid[i]; in qeth_l3_modify_hsuid()
617 return qeth_l3_modify_ip(card, &addr, add); in qeth_l3_modify_hsuid()
620 static int qeth_l3_register_addr_entry(struct qeth_card *card, in qeth_l3_register_addr_entry() argument
627 if (card->options.sniffer) in qeth_l3_register_addr_entry()
631 QETH_CARD_TEXT(card, 2, "setaddr4"); in qeth_l3_register_addr_entry()
632 QETH_CARD_HEX(card, 3, &addr->u.a4.addr, sizeof(int)); in qeth_l3_register_addr_entry()
634 QETH_CARD_TEXT(card, 2, "setaddr6"); in qeth_l3_register_addr_entry()
635 QETH_CARD_HEX(card, 3, &addr->u.a6.addr, 8); in qeth_l3_register_addr_entry()
636 QETH_CARD_HEX(card, 3, ((char *)&addr->u.a6.addr) + 8, 8); in qeth_l3_register_addr_entry()
638 QETH_CARD_TEXT(card, 2, "setaddr?"); in qeth_l3_register_addr_entry()
639 QETH_CARD_HEX(card, 3, addr, sizeof(struct qeth_ipaddr)); in qeth_l3_register_addr_entry()
643 rc = qeth_l3_send_setdelmc(card, addr, IPA_CMD_SETIPM); in qeth_l3_register_addr_entry()
645 rc = qeth_l3_send_setdelip(card, addr, IPA_CMD_SETIP); in qeth_l3_register_addr_entry()
647 QETH_CARD_TEXT(card, 2, "failed"); in qeth_l3_register_addr_entry()
650 QETH_CARD_TEXT(card, 2, "FAILED"); in qeth_l3_register_addr_entry()
652 dev_warn(&card->gdev->dev, in qeth_l3_register_addr_entry()
658 static int qeth_l3_deregister_addr_entry(struct qeth_card *card, in qeth_l3_deregister_addr_entry() argument
663 if (card->options.sniffer) in qeth_l3_deregister_addr_entry()
667 QETH_CARD_TEXT(card, 2, "deladdr4"); in qeth_l3_deregister_addr_entry()
668 QETH_CARD_HEX(card, 3, &addr->u.a4.addr, sizeof(int)); in qeth_l3_deregister_addr_entry()
670 QETH_CARD_TEXT(card, 2, "deladdr6"); in qeth_l3_deregister_addr_entry()
671 QETH_CARD_HEX(card, 3, &addr->u.a6.addr, 8); in qeth_l3_deregister_addr_entry()
672 QETH_CARD_HEX(card, 3, ((char *)&addr->u.a6.addr) + 8, 8); in qeth_l3_deregister_addr_entry()
674 QETH_CARD_TEXT(card, 2, "deladdr?"); in qeth_l3_deregister_addr_entry()
675 QETH_CARD_HEX(card, 3, addr, sizeof(struct qeth_ipaddr)); in qeth_l3_deregister_addr_entry()
678 rc = qeth_l3_send_setdelmc(card, addr, IPA_CMD_DELIPM); in qeth_l3_deregister_addr_entry()
680 rc = qeth_l3_send_setdelip(card, addr, IPA_CMD_DELIP); in qeth_l3_deregister_addr_entry()
682 QETH_CARD_TEXT(card, 2, "failed"); in qeth_l3_deregister_addr_entry()
687 static int qeth_l3_setadapter_parms(struct qeth_card *card) in qeth_l3_setadapter_parms() argument
691 QETH_CARD_TEXT(card, 2, "setadprm"); in qeth_l3_setadapter_parms()
693 if (qeth_adp_supported(card, IPA_SETADP_ALTER_MAC_ADDRESS)) { in qeth_l3_setadapter_parms()
694 rc = qeth_setadpparms_change_macaddr(card); in qeth_l3_setadapter_parms()
696 dev_warn(&card->gdev->dev, "Reading the adapter MAC" in qeth_l3_setadapter_parms()
703 static int qeth_l3_start_ipa_arp_processing(struct qeth_card *card) in qeth_l3_start_ipa_arp_processing() argument
707 QETH_CARD_TEXT(card, 3, "ipaarp"); in qeth_l3_start_ipa_arp_processing()
709 if (!qeth_is_supported(card, IPA_ARP_PROCESSING)) { in qeth_l3_start_ipa_arp_processing()
710 dev_info(&card->gdev->dev, in qeth_l3_start_ipa_arp_processing()
712 netdev_name(card->dev)); in qeth_l3_start_ipa_arp_processing()
715 rc = qeth_send_simple_setassparms(card, IPA_ARP_PROCESSING, in qeth_l3_start_ipa_arp_processing()
718 dev_warn(&card->gdev->dev, in qeth_l3_start_ipa_arp_processing()
720 netdev_name(card->dev)); in qeth_l3_start_ipa_arp_processing()
725 static int qeth_l3_start_ipa_source_mac(struct qeth_card *card) in qeth_l3_start_ipa_source_mac() argument
729 QETH_CARD_TEXT(card, 3, "stsrcmac"); in qeth_l3_start_ipa_source_mac()
731 if (!qeth_is_supported(card, IPA_SOURCE_MAC)) { in qeth_l3_start_ipa_source_mac()
732 dev_info(&card->gdev->dev, in qeth_l3_start_ipa_source_mac()
734 netdev_name(card->dev)); in qeth_l3_start_ipa_source_mac()
738 rc = qeth_send_simple_setassparms(card, IPA_SOURCE_MAC, in qeth_l3_start_ipa_source_mac()
741 dev_warn(&card->gdev->dev, in qeth_l3_start_ipa_source_mac()
743 netdev_name(card->dev)); in qeth_l3_start_ipa_source_mac()
747 static int qeth_l3_start_ipa_vlan(struct qeth_card *card) in qeth_l3_start_ipa_vlan() argument
751 QETH_CARD_TEXT(card, 3, "strtvlan"); in qeth_l3_start_ipa_vlan()
753 if (!qeth_is_supported(card, IPA_FULL_VLAN)) { in qeth_l3_start_ipa_vlan()
754 dev_info(&card->gdev->dev, in qeth_l3_start_ipa_vlan()
755 "VLAN not supported on %s\n", netdev_name(card->dev)); in qeth_l3_start_ipa_vlan()
759 rc = qeth_send_simple_setassparms(card, IPA_VLAN_PRIO, in qeth_l3_start_ipa_vlan()
762 dev_warn(&card->gdev->dev, in qeth_l3_start_ipa_vlan()
764 netdev_name(card->dev)); in qeth_l3_start_ipa_vlan()
766 dev_info(&card->gdev->dev, "VLAN enabled\n"); in qeth_l3_start_ipa_vlan()
771 static int qeth_l3_start_ipa_multicast(struct qeth_card *card) in qeth_l3_start_ipa_multicast() argument
775 QETH_CARD_TEXT(card, 3, "stmcast"); in qeth_l3_start_ipa_multicast()
777 if (!qeth_is_supported(card, IPA_MULTICASTING)) { in qeth_l3_start_ipa_multicast()
778 dev_info(&card->gdev->dev, in qeth_l3_start_ipa_multicast()
780 netdev_name(card->dev)); in qeth_l3_start_ipa_multicast()
784 rc = qeth_send_simple_setassparms(card, IPA_MULTICASTING, in qeth_l3_start_ipa_multicast()
787 dev_warn(&card->gdev->dev, in qeth_l3_start_ipa_multicast()
789 netdev_name(card->dev)); in qeth_l3_start_ipa_multicast()
791 dev_info(&card->gdev->dev, "Multicast enabled\n"); in qeth_l3_start_ipa_multicast()
792 card->dev->flags |= IFF_MULTICAST; in qeth_l3_start_ipa_multicast()
797 static int qeth_l3_softsetup_ipv6(struct qeth_card *card) in qeth_l3_softsetup_ipv6() argument
802 QETH_CARD_TEXT(card, 3, "softipv6"); in qeth_l3_softsetup_ipv6()
804 if (IS_IQD(card)) in qeth_l3_softsetup_ipv6()
807 rc = qeth_send_simple_setassparms(card, IPA_IPV6, IPA_CMD_ASS_START, in qeth_l3_softsetup_ipv6()
810 dev_err(&card->gdev->dev, in qeth_l3_softsetup_ipv6()
812 netdev_name(card->dev)); in qeth_l3_softsetup_ipv6()
815 rc = qeth_send_simple_setassparms_v6(card, IPA_IPV6, IPA_CMD_ASS_START, in qeth_l3_softsetup_ipv6()
818 dev_err(&card->gdev->dev, in qeth_l3_softsetup_ipv6()
820 netdev_name(card->dev)); in qeth_l3_softsetup_ipv6()
823 rc = qeth_send_simple_setassparms_v6(card, IPA_PASSTHRU, in qeth_l3_softsetup_ipv6()
826 dev_warn(&card->gdev->dev, in qeth_l3_softsetup_ipv6()
828 netdev_name(card->dev)); in qeth_l3_softsetup_ipv6()
832 dev_info(&card->gdev->dev, "IPV6 enabled\n"); in qeth_l3_softsetup_ipv6()
836 static int qeth_l3_start_ipa_ipv6(struct qeth_card *card) in qeth_l3_start_ipa_ipv6() argument
838 QETH_CARD_TEXT(card, 3, "strtipv6"); in qeth_l3_start_ipa_ipv6()
840 if (!qeth_is_supported(card, IPA_IPV6)) { in qeth_l3_start_ipa_ipv6()
841 dev_info(&card->gdev->dev, in qeth_l3_start_ipa_ipv6()
842 "IPv6 not supported on %s\n", netdev_name(card->dev)); in qeth_l3_start_ipa_ipv6()
845 return qeth_l3_softsetup_ipv6(card); in qeth_l3_start_ipa_ipv6()
848 static int qeth_l3_start_ipa_broadcast(struct qeth_card *card) in qeth_l3_start_ipa_broadcast() argument
853 QETH_CARD_TEXT(card, 3, "stbrdcst"); in qeth_l3_start_ipa_broadcast()
854 card->info.broadcast_capable = 0; in qeth_l3_start_ipa_broadcast()
855 if (!qeth_is_supported(card, IPA_FILTERING)) { in qeth_l3_start_ipa_broadcast()
856 dev_info(&card->gdev->dev, in qeth_l3_start_ipa_broadcast()
858 netdev_name(card->dev)); in qeth_l3_start_ipa_broadcast()
862 rc = qeth_send_simple_setassparms(card, IPA_FILTERING, in qeth_l3_start_ipa_broadcast()
865 dev_warn(&card->gdev->dev, in qeth_l3_start_ipa_broadcast()
867 netdev_name(card->dev)); in qeth_l3_start_ipa_broadcast()
871 rc = qeth_send_simple_setassparms(card, IPA_FILTERING, in qeth_l3_start_ipa_broadcast()
874 dev_warn(&card->gdev->dev, in qeth_l3_start_ipa_broadcast()
876 netdev_name(card->dev)); in qeth_l3_start_ipa_broadcast()
879 card->info.broadcast_capable = QETH_BROADCAST_WITH_ECHO; in qeth_l3_start_ipa_broadcast()
880 dev_info(&card->gdev->dev, "Broadcast enabled\n"); in qeth_l3_start_ipa_broadcast()
881 rc = qeth_send_simple_setassparms(card, IPA_FILTERING, in qeth_l3_start_ipa_broadcast()
884 dev_warn(&card->gdev->dev, in qeth_l3_start_ipa_broadcast()
886 netdev_name(card->dev)); in qeth_l3_start_ipa_broadcast()
889 card->info.broadcast_capable = QETH_BROADCAST_WITHOUT_ECHO; in qeth_l3_start_ipa_broadcast()
891 if (card->info.broadcast_capable) in qeth_l3_start_ipa_broadcast()
892 card->dev->flags |= IFF_BROADCAST; in qeth_l3_start_ipa_broadcast()
894 card->dev->flags &= ~IFF_BROADCAST; in qeth_l3_start_ipa_broadcast()
898 static void qeth_l3_start_ipassists(struct qeth_card *card) in qeth_l3_start_ipassists() argument
900 QETH_CARD_TEXT(card, 3, "strtipas"); in qeth_l3_start_ipassists()
902 qeth_l3_start_ipa_arp_processing(card); /* go on*/ in qeth_l3_start_ipassists()
903 qeth_l3_start_ipa_source_mac(card); /* go on*/ in qeth_l3_start_ipassists()
904 qeth_l3_start_ipa_vlan(card); /* go on*/ in qeth_l3_start_ipassists()
905 qeth_l3_start_ipa_multicast(card); /* go on*/ in qeth_l3_start_ipassists()
906 qeth_l3_start_ipa_ipv6(card); /* go on*/ in qeth_l3_start_ipassists()
907 qeth_l3_start_ipa_broadcast(card); /* go on*/ in qeth_l3_start_ipassists()
910 static int qeth_l3_iqd_read_initial_mac_cb(struct qeth_card *card, in qeth_l3_iqd_read_initial_mac_cb() argument
920 eth_hw_addr_set(card->dev, cmd->data.create_destroy_addr.mac_addr); in qeth_l3_iqd_read_initial_mac_cb()
924 static int qeth_l3_iqd_read_initial_mac(struct qeth_card *card) in qeth_l3_iqd_read_initial_mac() argument
929 QETH_CARD_TEXT(card, 2, "hsrmac"); in qeth_l3_iqd_read_initial_mac()
931 iob = qeth_ipa_alloc_cmd(card, IPA_CMD_CREATE_ADDR, QETH_PROT_IPV6, in qeth_l3_iqd_read_initial_mac()
936 rc = qeth_send_ipa_cmd(card, iob, qeth_l3_iqd_read_initial_mac_cb, in qeth_l3_iqd_read_initial_mac()
941 static int qeth_l3_get_unique_id_cb(struct qeth_card *card, in qeth_l3_get_unique_id_cb() argument
952 dev_warn(&card->gdev->dev, "The network adapter failed to generate a unique ID\n"); in qeth_l3_get_unique_id_cb()
956 static u16 qeth_l3_get_unique_id(struct qeth_card *card, u16 uid) in qeth_l3_get_unique_id() argument
960 QETH_CARD_TEXT(card, 2, "guniqeid"); in qeth_l3_get_unique_id()
962 if (!qeth_is_supported(card, IPA_IPV6)) in qeth_l3_get_unique_id()
965 iob = qeth_ipa_alloc_cmd(card, IPA_CMD_CREATE_ADDR, QETH_PROT_IPV6, in qeth_l3_get_unique_id()
971 qeth_send_ipa_cmd(card, iob, qeth_l3_get_unique_id_cb, &uid); in qeth_l3_get_unique_id()
978 qeth_diags_trace_cb(struct qeth_card *card, struct qeth_reply *reply, in qeth_diags_trace_cb() argument
984 QETH_CARD_TEXT(card, 2, "diastrcb"); in qeth_diags_trace_cb()
989 QETH_CARD_TEXT_(card, 2, "dxter%x", rc); in qeth_diags_trace_cb()
997 card->info.promisc_mode = SET_PROMISC_MODE_OFF; in qeth_diags_trace_cb()
998 dev_info(&card->gdev->dev, "The HiperSockets network " in qeth_diags_trace_cb()
1008 card->info.promisc_mode = SET_PROMISC_MODE_ON; in qeth_diags_trace_cb()
1009 dev_info(&card->gdev->dev, "The HiperSockets network " in qeth_diags_trace_cb()
1013 dev_warn(&card->gdev->dev, "The device is not " in qeth_diags_trace_cb()
1018 dev_warn(&card->gdev->dev, "A HiperSockets " in qeth_diags_trace_cb()
1028 cmd->data.diagass.action, CARD_DEVID(card)); in qeth_diags_trace_cb()
1035 qeth_diags_trace(struct qeth_card *card, enum qeth_diags_trace_cmds diags_cmd) in qeth_diags_trace() argument
1040 QETH_CARD_TEXT(card, 2, "diagtrac"); in qeth_diags_trace()
1042 iob = qeth_get_diag_cmd(card, QETH_DIAGS_CMD_TRACE, 0); in qeth_diags_trace()
1048 return qeth_send_ipa_cmd(card, iob, qeth_diags_trace_cb, NULL); in qeth_diags_trace()
1053 struct qeth_card *card = arg; in qeth_l3_add_mcast_rtnl() local
1061 QETH_CARD_TEXT(card, 4, "addmc"); in qeth_l3_add_mcast_rtnl()
1078 ipm = qeth_l3_find_addr_by_ip(card, &tmp); in qeth_l3_add_mcast_rtnl()
1089 hash_add(card->rx_mode_addrs, &ipm->hnode, in qeth_l3_add_mcast_rtnl()
1094 if (!qeth_is_supported(card, IPA_IPV6)) in qeth_l3_add_mcast_rtnl()
1110 ipm = qeth_l3_find_addr_by_ip(card, &tmp); in qeth_l3_add_mcast_rtnl()
1121 hash_add(card->rx_mode_addrs, &ipm->hnode, in qeth_l3_add_mcast_rtnl()
1130 static void qeth_l3_set_promisc_mode(struct qeth_card *card) in qeth_l3_set_promisc_mode() argument
1132 bool enable = card->dev->flags & IFF_PROMISC; in qeth_l3_set_promisc_mode()
1134 if (card->info.promisc_mode == enable) in qeth_l3_set_promisc_mode()
1137 if (IS_VM_NIC(card)) { /* Guestlan trace */ in qeth_l3_set_promisc_mode()
1138 if (qeth_adp_supported(card, IPA_SETADP_SET_PROMISC_MODE)) in qeth_l3_set_promisc_mode()
1139 qeth_setadp_promisc_mode(card, enable); in qeth_l3_set_promisc_mode()
1140 } else if (card->options.sniffer && /* HiperSockets trace */ in qeth_l3_set_promisc_mode()
1141 qeth_adp_supported(card, IPA_SETADP_SET_DIAG_ASSIST)) { in qeth_l3_set_promisc_mode()
1143 QETH_CARD_TEXT(card, 3, "+promisc"); in qeth_l3_set_promisc_mode()
1144 qeth_diags_trace(card, QETH_DIAGS_CMD_TRACE_ENABLE); in qeth_l3_set_promisc_mode()
1146 QETH_CARD_TEXT(card, 3, "-promisc"); in qeth_l3_set_promisc_mode()
1147 qeth_diags_trace(card, QETH_DIAGS_CMD_TRACE_DISABLE); in qeth_l3_set_promisc_mode()
1154 struct qeth_card *card = container_of(work, struct qeth_card, in qeth_l3_rx_mode_work() local
1160 QETH_CARD_TEXT(card, 3, "setmulti"); in qeth_l3_rx_mode_work()
1162 if (!card->options.sniffer) { in qeth_l3_rx_mode_work()
1164 qeth_l3_add_mcast_rtnl(card->dev, 0, card); in qeth_l3_rx_mode_work()
1165 if (qeth_is_supported(card, IPA_FULL_VLAN)) in qeth_l3_rx_mode_work()
1166 vlan_for_each(card->dev, qeth_l3_add_mcast_rtnl, card); in qeth_l3_rx_mode_work()
1169 hash_for_each_safe(card->rx_mode_addrs, i, tmp, addr, hnode) { in qeth_l3_rx_mode_work()
1172 rc = qeth_l3_deregister_addr_entry(card, addr); in qeth_l3_rx_mode_work()
1179 rc = qeth_l3_register_addr_entry(card, addr); in qeth_l3_rx_mode_work()
1193 qeth_l3_set_promisc_mode(card); in qeth_l3_rx_mode_work()
1213 static int qeth_l3_arp_cmd_cb(struct qeth_card *card, struct qeth_reply *reply, in qeth_l3_arp_cmd_cb() argument
1218 qeth_setassparms_cb(card, reply, data); in qeth_l3_arp_cmd_cb()
1222 static int qeth_l3_arp_set_no_entries(struct qeth_card *card, int no_entries) in qeth_l3_arp_set_no_entries() argument
1227 QETH_CARD_TEXT(card, 3, "arpstnoe"); in qeth_l3_arp_set_no_entries()
1234 if (IS_VM_NIC(card)) in qeth_l3_arp_set_no_entries()
1236 if (!qeth_is_supported(card, IPA_ARP_PROCESSING)) { in qeth_l3_arp_set_no_entries()
1240 iob = qeth_get_setassparms_cmd(card, IPA_ARP_PROCESSING, in qeth_l3_arp_set_no_entries()
1248 rc = qeth_send_ipa_cmd(card, iob, qeth_l3_arp_cmd_cb, NULL); in qeth_l3_arp_set_no_entries()
1251 CARD_DEVID(card), rc); in qeth_l3_arp_set_no_entries()
1255 static __u32 get_arp_entry_size(struct qeth_card *card, in get_arp_entry_size() argument
1264 QETH_CARD_TEXT(card, 4, "arpev4"); in get_arp_entry_size()
1273 QETH_CARD_TEXT(card, 4, "arpev6"); in get_arp_entry_size()
1284 QETH_CARD_TEXT(card, 4, "arpinv"); in get_arp_entry_size()
1297 static int qeth_l3_arp_query_cb(struct qeth_card *card, in qeth_l3_arp_query_cb() argument
1308 QETH_CARD_TEXT(card, 3, "arpquecb"); in qeth_l3_arp_query_cb()
1312 QETH_CARD_TEXT_(card, 4, "%i", cmd->hdr.prot_version); in qeth_l3_arp_query_cb()
1314 QETH_CARD_TEXT(card, 4, "arpcberr"); in qeth_l3_arp_query_cb()
1315 QETH_CARD_TEXT_(card, 4, "%i", cmd->hdr.return_code); in qeth_l3_arp_query_cb()
1320 QETH_CARD_TEXT(card, 4, "setaperr"); in qeth_l3_arp_query_cb()
1321 QETH_CARD_TEXT_(card, 4, "%i", cmd->hdr.return_code); in qeth_l3_arp_query_cb()
1325 QETH_CARD_TEXT_(card, 4, "anoen%i", qdata->no_entries); in qeth_l3_arp_query_cb()
1338 QETH_CARD_TEXT(card, 4, "pmis"); in qeth_l3_arp_query_cb()
1339 QETH_CARD_TEXT_(card, 4, "%i", etype->ip); in qeth_l3_arp_query_cb()
1342 esize = get_arp_entry_size(card, qdata, etype, in qeth_l3_arp_query_cb()
1344 QETH_CARD_TEXT_(card, 5, "esz%i", esize); in qeth_l3_arp_query_cb()
1349 QETH_CARD_TEXT_(card, 4, "qaer3%i", -ENOSPC); in qeth_l3_arp_query_cb()
1365 QETH_CARD_TEXT_(card, 4, "nove%i", qinfo->no_entries); in qeth_l3_arp_query_cb()
1372 QETH_CARD_TEXT_(card, 4, "rc%i", 0); in qeth_l3_arp_query_cb()
1376 static int qeth_l3_query_arp_cache_info(struct qeth_card *card, in qeth_l3_query_arp_cache_info() argument
1384 QETH_CARD_TEXT_(card, 3, "qarpipv%i", prot); in qeth_l3_query_arp_cache_info()
1386 iob = qeth_get_setassparms_cmd(card, IPA_ARP_PROCESSING, in qeth_l3_query_arp_cache_info()
1393 rc = qeth_send_ipa_cmd(card, iob, qeth_l3_arp_query_cb, qinfo); in qeth_l3_query_arp_cache_info()
1396 CARD_DEVID(card), rc); in qeth_l3_query_arp_cache_info()
1400 static int qeth_l3_arp_query(struct qeth_card *card, char __user *udata) in qeth_l3_arp_query() argument
1405 QETH_CARD_TEXT(card, 3, "arpquery"); in qeth_l3_arp_query()
1407 if (!qeth_is_supported(card,/*IPA_QUERY_ARP_ADDR_INFO*/ in qeth_l3_arp_query()
1409 QETH_CARD_TEXT(card, 3, "arpqnsup"); in qeth_l3_arp_query()
1424 rc = qeth_l3_query_arp_cache_info(card, QETH_PROT_IPV4, &qinfo); in qeth_l3_arp_query()
1432 qeth_l3_query_arp_cache_info(card, QETH_PROT_IPV6, &qinfo); in qeth_l3_arp_query()
1435 QETH_CARD_TEXT(card, 4, "qactf"); in qeth_l3_arp_query()
1439 QETH_CARD_TEXT(card, 4, "qacts"); in qeth_l3_arp_query()
1447 static int qeth_l3_arp_modify_entry(struct qeth_card *card, in qeth_l3_arp_modify_entry() argument
1456 QETH_CARD_TEXT(card, 3, "arpadd"); in qeth_l3_arp_modify_entry()
1458 QETH_CARD_TEXT(card, 3, "arpdel"); in qeth_l3_arp_modify_entry()
1465 if (IS_VM_NIC(card)) in qeth_l3_arp_modify_entry()
1467 if (!qeth_is_supported(card, IPA_ARP_PROCESSING)) { in qeth_l3_arp_modify_entry()
1471 iob = qeth_get_setassparms_cmd(card, IPA_ARP_PROCESSING, arp_cmd, in qeth_l3_arp_modify_entry()
1480 rc = qeth_send_ipa_cmd(card, iob, qeth_l3_arp_cmd_cb, NULL); in qeth_l3_arp_modify_entry()
1483 arp_cmd, CARD_DEVID(card), rc); in qeth_l3_arp_modify_entry()
1487 static int qeth_l3_arp_flush_cache(struct qeth_card *card) in qeth_l3_arp_flush_cache() argument
1492 QETH_CARD_TEXT(card, 3, "arpflush"); in qeth_l3_arp_flush_cache()
1499 if (IS_VM_NIC(card) || IS_IQD(card)) in qeth_l3_arp_flush_cache()
1501 if (!qeth_is_supported(card, IPA_ARP_PROCESSING)) { in qeth_l3_arp_flush_cache()
1505 iob = qeth_get_setassparms_cmd(card, IPA_ARP_PROCESSING, in qeth_l3_arp_flush_cache()
1511 rc = qeth_send_ipa_cmd(card, iob, qeth_l3_arp_cmd_cb, NULL); in qeth_l3_arp_flush_cache()
1514 CARD_DEVID(card), rc); in qeth_l3_arp_flush_cache()
1521 struct qeth_card *card = dev->ml_priv; in qeth_l3_ndo_siocdevprivate() local
1532 rc = qeth_l3_arp_set_no_entries(card, rq->ifr_ifru.ifru_ivalue); in qeth_l3_ndo_siocdevprivate()
1539 rc = qeth_l3_arp_query(card, data); in qeth_l3_ndo_siocdevprivate()
1551 return qeth_l3_arp_modify_entry(card, &arp_entry, arp_cmd); in qeth_l3_ndo_siocdevprivate()
1557 rc = qeth_l3_arp_flush_cache(card); in qeth_l3_ndo_siocdevprivate()
1632 struct qeth_card *card = queue->card; in qeth_l3_fill_header() local
1651 if (proto == htons(ETH_P_IP) || IS_IQD(card)) { in qeth_l3_fill_header()
1665 if (IS_IQD(card) && skb_get_queue_mapping(skb) != QETH_IQD_MCAST_TXQ) in qeth_l3_fill_header()
1680 if (!IS_IQD(card)) in qeth_l3_fill_header()
1710 static int qeth_l3_xmit(struct qeth_card *card, struct sk_buff *skb, in qeth_l3_xmit() argument
1725 return qeth_xmit(card, skb, queue, proto, qeth_l3_fill_header); in qeth_l3_xmit()
1731 struct qeth_card *card = dev->ml_priv; in qeth_l3_hard_start_xmit() local
1739 if (IS_IQD(card)) { in qeth_l3_hard_start_xmit()
1740 queue = card->qdio.out_qs[qeth_iqd_translate_txq(dev, txq)]; in qeth_l3_hard_start_xmit()
1742 if (card->options.sniffer) in qeth_l3_hard_start_xmit()
1747 if (card->options.cq != QETH_CQ_ENABLED) in qeth_l3_hard_start_xmit()
1752 if (card->options.cq == QETH_CQ_ENABLED) in qeth_l3_hard_start_xmit()
1759 queue = card->qdio.out_qs[txq]; in qeth_l3_hard_start_xmit()
1766 if (proto == htons(ETH_P_IP) || IS_IQD(card)) in qeth_l3_hard_start_xmit()
1767 rc = qeth_l3_xmit(card, skb, queue, proto); in qeth_l3_hard_start_xmit()
1769 rc = qeth_xmit(card, skb, queue, proto, qeth_l3_fill_header); in qeth_l3_hard_start_xmit()
1782 struct qeth_card *card = dev->ml_priv; in qeth_l3_set_rx_mode() local
1784 schedule_work(&card->rx_mode_work); in qeth_l3_set_rx_mode()
1861 static int qeth_l3_setup_netdev(struct qeth_card *card) in qeth_l3_setup_netdev() argument
1863 struct net_device *dev = card->dev; in qeth_l3_setup_netdev()
1867 if (IS_OSD(card) || IS_OSX(card)) { in qeth_l3_setup_netdev()
1868 card->dev->netdev_ops = &qeth_l3_osa_netdev_ops; in qeth_l3_setup_netdev()
1871 dev->dev_id = qeth_l3_get_unique_id(card, dev->dev_id); in qeth_l3_setup_netdev()
1873 if (!IS_VM_NIC(card)) { in qeth_l3_setup_netdev()
1874 card->dev->features |= NETIF_F_SG; in qeth_l3_setup_netdev()
1875 card->dev->hw_features |= NETIF_F_TSO | in qeth_l3_setup_netdev()
1877 card->dev->vlan_features |= NETIF_F_TSO | in qeth_l3_setup_netdev()
1881 if (qeth_is_supported6(card, IPA_OUTBOUND_CHECKSUM_V6)) { in qeth_l3_setup_netdev()
1882 card->dev->hw_features |= NETIF_F_IPV6_CSUM; in qeth_l3_setup_netdev()
1883 card->dev->vlan_features |= NETIF_F_IPV6_CSUM; in qeth_l3_setup_netdev()
1885 if (qeth_is_supported6(card, IPA_OUTBOUND_TSO)) { in qeth_l3_setup_netdev()
1886 card->dev->hw_features |= NETIF_F_TSO6; in qeth_l3_setup_netdev()
1887 card->dev->vlan_features |= NETIF_F_TSO6; in qeth_l3_setup_netdev()
1891 if (card->dev->hw_features & NETIF_F_TSO6) in qeth_l3_setup_netdev()
1893 else if (card->dev->hw_features & NETIF_F_TSO) in qeth_l3_setup_netdev()
1897 } else if (IS_IQD(card)) { in qeth_l3_setup_netdev()
1898 card->dev->flags |= IFF_NOARP; in qeth_l3_setup_netdev()
1899 card->dev->netdev_ops = &qeth_l3_netdev_ops; in qeth_l3_setup_netdev()
1902 rc = qeth_l3_iqd_read_initial_mac(card); in qeth_l3_setup_netdev()
1908 card->dev->needed_headroom = headroom; in qeth_l3_setup_netdev()
1909 card->dev->features |= NETIF_F_HW_VLAN_CTAG_TX | in qeth_l3_setup_netdev()
1912 netif_keep_dst(card->dev); in qeth_l3_setup_netdev()
1913 if (card->dev->hw_features & (NETIF_F_TSO | NETIF_F_TSO6)) in qeth_l3_setup_netdev()
1914 netif_set_tso_max_size(card->dev, in qeth_l3_setup_netdev()
1915 PAGE_SIZE * (QETH_MAX_BUFFER_ELEMENTS(card) - 1)); in qeth_l3_setup_netdev()
1917 netif_napi_add(card->dev, &card->napi, qeth_poll); in qeth_l3_setup_netdev()
1918 return register_netdev(card->dev); in qeth_l3_setup_netdev()
1928 struct qeth_card *card = dev_get_drvdata(&gdev->dev); in qeth_l3_probe_device() local
1931 hash_init(card->ip_htable); in qeth_l3_probe_device()
1932 mutex_init(&card->ip_lock); in qeth_l3_probe_device()
1933 card->cmd_wq = alloc_ordered_workqueue("%s_cmd", 0, in qeth_l3_probe_device()
1935 if (!card->cmd_wq) in qeth_l3_probe_device()
1941 destroy_workqueue(card->cmd_wq); in qeth_l3_probe_device()
1948 INIT_WORK(&card->rx_mode_work, qeth_l3_rx_mode_work); in qeth_l3_probe_device()
1954 struct qeth_card *card = dev_get_drvdata(&cgdev->dev); in qeth_l3_remove_device() local
1959 qeth_set_allowed_threads(card, 0, 1); in qeth_l3_remove_device()
1960 wait_event(card->wait_q, qeth_threads_running(card, 0xffffffff) == 0); in qeth_l3_remove_device()
1963 qeth_set_offline(card, card->discipline, false); in qeth_l3_remove_device()
1965 if (card->dev->reg_state == NETREG_REGISTERED) in qeth_l3_remove_device()
1966 unregister_netdev(card->dev); in qeth_l3_remove_device()
1968 destroy_workqueue(card->cmd_wq); in qeth_l3_remove_device()
1969 qeth_l3_clear_ip_htable(card, 0); in qeth_l3_remove_device()
1970 qeth_l3_clear_ipato_list(card); in qeth_l3_remove_device()
1973 static int qeth_l3_set_online(struct qeth_card *card, bool carrier_ok) in qeth_l3_set_online() argument
1975 struct net_device *dev = card->dev; in qeth_l3_set_online()
1979 QETH_CARD_TEXT(card, 2, "softsetp"); in qeth_l3_set_online()
1981 rc = qeth_l3_setadapter_parms(card); in qeth_l3_set_online()
1983 QETH_CARD_TEXT_(card, 2, "2err%04x", rc); in qeth_l3_set_online()
1984 if (!card->options.sniffer) { in qeth_l3_set_online()
1985 qeth_l3_start_ipassists(card); in qeth_l3_set_online()
1987 rc = qeth_l3_setrouting_v4(card); in qeth_l3_set_online()
1989 QETH_CARD_TEXT_(card, 2, "4err%04x", rc); in qeth_l3_set_online()
1990 rc = qeth_l3_setrouting_v6(card); in qeth_l3_set_online()
1992 QETH_CARD_TEXT_(card, 2, "5err%04x", rc); in qeth_l3_set_online()
1995 card->state = CARD_STATE_SOFTSETUP; in qeth_l3_set_online()
1997 qeth_set_allowed_threads(card, 0xffffffff, 0); in qeth_l3_set_online()
1998 qeth_l3_recover_ip(card); in qeth_l3_set_online()
2001 rc = qeth_l3_setup_netdev(card); in qeth_l3_set_online()
2009 rc = qeth_set_real_num_tx_queues(card, in qeth_l3_set_online()
2010 qeth_tx_actual_queues(card)); in qeth_l3_set_online()
2026 napi_schedule(&card->napi); in qeth_l3_set_online()
2036 qeth_set_allowed_threads(card, 0, 1); in qeth_l3_set_online()
2037 card->state = CARD_STATE_DOWN; in qeth_l3_set_online()
2038 qeth_l3_clear_ip_htable(card, 1); in qeth_l3_set_online()
2042 static void qeth_l3_set_offline(struct qeth_card *card) in qeth_l3_set_offline() argument
2044 qeth_set_allowed_threads(card, 0, 1); in qeth_l3_set_offline()
2045 qeth_l3_drain_rx_mode_cache(card); in qeth_l3_set_offline()
2047 if (card->options.sniffer && in qeth_l3_set_offline()
2048 (card->info.promisc_mode == SET_PROMISC_MODE_ON)) in qeth_l3_set_offline()
2049 qeth_diags_trace(card, QETH_DIAGS_CMD_TRACE_DISABLE); in qeth_l3_set_offline()
2051 if (card->state == CARD_STATE_SOFTSETUP) { in qeth_l3_set_offline()
2052 card->state = CARD_STATE_DOWN; in qeth_l3_set_offline()
2053 qeth_l3_clear_ip_htable(card, 1); in qeth_l3_set_offline()
2058 static int qeth_l3_control_event(struct qeth_card *card, in qeth_l3_control_event() argument
2073 static int qeth_l3_handle_ip_event(struct qeth_card *card, in qeth_l3_handle_ip_event() argument
2079 qeth_l3_modify_ip(card, addr, true); in qeth_l3_handle_ip_event()
2082 qeth_l3_modify_ip(card, addr, false); in qeth_l3_handle_ip_event()
2091 struct qeth_card *card; member
2101 qeth_l3_modify_ip(ip_work->card, &ip_work->addr, true); in qeth_l3_add_ip_worker()
2109 qeth_l3_modify_ip(ip_work->card, &ip_work->addr, false); in qeth_l3_delete_ip_worker()
2129 struct qeth_card *card; in qeth_l3_ip_event() local
2131 card = qeth_l3_get_card_from_dev(dev); in qeth_l3_ip_event()
2132 if (!card) in qeth_l3_ip_event()
2134 QETH_CARD_TEXT(card, 3, "ipevent"); in qeth_l3_ip_event()
2140 return qeth_l3_handle_ip_event(card, &addr, event); in qeth_l3_ip_event()
2154 struct qeth_card *card; in qeth_l3_ip6_event() local
2159 card = qeth_l3_get_card_from_dev(dev); in qeth_l3_ip6_event()
2160 if (!card) in qeth_l3_ip6_event()
2162 QETH_CARD_TEXT(card, 3, "ip6event"); in qeth_l3_ip6_event()
2163 if (!qeth_is_supported(card, IPA_IPV6)) in qeth_l3_ip6_event()
2175 ip_work->card = card; in qeth_l3_ip6_event()
2181 queue_work(card->cmd_wq, &ip_work->work); in qeth_l3_ip6_event()