Lines Matching refs: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()
263 mutex_unlock(&card->ip_lock); in qeth_l3_clear_ip_htable()
266 static void qeth_l3_recover_ip(struct qeth_card *card) in qeth_l3_recover_ip() argument
273 QETH_CARD_TEXT(card, 4, "recovrip"); in qeth_l3_recover_ip()
275 mutex_lock(&card->ip_lock); in qeth_l3_recover_ip()
277 hash_for_each_safe(card->ip_htable, i, tmp, addr, hnode) { in qeth_l3_recover_ip()
279 rc = qeth_l3_register_addr_entry(card, addr); in qeth_l3_recover_ip()
292 mutex_unlock(&card->ip_lock); in qeth_l3_recover_ip()
295 static int qeth_l3_setdelip_cb(struct qeth_card *card, struct qeth_reply *reply, in qeth_l3_setdelip_cb() argument
314 static int qeth_l3_send_setdelmc(struct qeth_card *card, in qeth_l3_send_setdelmc() argument
321 QETH_CARD_TEXT(card, 4, "setdelmc"); in qeth_l3_send_setdelmc()
323 iob = qeth_ipa_alloc_cmd(card, ipacmd, addr->proto, in qeth_l3_send_setdelmc()
336 return qeth_send_ipa_cmd(card, iob, qeth_l3_setdelip_cb, NULL); in qeth_l3_send_setdelmc()
365 static int qeth_l3_send_setdelip(struct qeth_card *card, in qeth_l3_send_setdelip() argument
373 QETH_CARD_TEXT(card, 4, "setdelip"); in qeth_l3_send_setdelip()
375 iob = qeth_ipa_alloc_cmd(card, ipacmd, addr->proto, in qeth_l3_send_setdelip()
382 QETH_CARD_TEXT_(card, 4, "flags%02X", flags); in qeth_l3_send_setdelip()
395 return qeth_send_ipa_cmd(card, iob, qeth_l3_setdelip_cb, NULL); in qeth_l3_send_setdelip()
398 static int qeth_l3_send_setrouting(struct qeth_card *card, in qeth_l3_send_setrouting() argument
405 QETH_CARD_TEXT(card, 4, "setroutg"); in qeth_l3_send_setrouting()
406 iob = qeth_ipa_alloc_cmd(card, IPA_CMD_SETRTG, prot, in qeth_l3_send_setrouting()
412 rc = qeth_send_ipa_cmd(card, iob, NULL, NULL); in qeth_l3_send_setrouting()
417 static int qeth_l3_correct_routing_type(struct qeth_card *card, in qeth_l3_correct_routing_type() argument
420 if (IS_IQD(card)) { in qeth_l3_correct_routing_type()
437 if (qeth_is_ipafunc_supported(card, prot, in qeth_l3_correct_routing_type()
450 int qeth_l3_setrouting_v4(struct qeth_card *card) in qeth_l3_setrouting_v4() argument
454 QETH_CARD_TEXT(card, 3, "setrtg4"); in qeth_l3_setrouting_v4()
456 rc = qeth_l3_correct_routing_type(card, &card->options.route4.type, in qeth_l3_setrouting_v4()
461 rc = qeth_l3_send_setrouting(card, card->options.route4.type, in qeth_l3_setrouting_v4()
464 card->options.route4.type = NO_ROUTER; in qeth_l3_setrouting_v4()
466 rc, CARD_DEVID(card)); in qeth_l3_setrouting_v4()
471 int qeth_l3_setrouting_v6(struct qeth_card *card) in qeth_l3_setrouting_v6() argument
475 QETH_CARD_TEXT(card, 3, "setrtg6"); in qeth_l3_setrouting_v6()
477 if (!qeth_is_supported(card, IPA_IPV6)) in qeth_l3_setrouting_v6()
479 rc = qeth_l3_correct_routing_type(card, &card->options.route6.type, in qeth_l3_setrouting_v6()
484 rc = qeth_l3_send_setrouting(card, card->options.route6.type, in qeth_l3_setrouting_v6()
487 card->options.route6.type = NO_ROUTER; in qeth_l3_setrouting_v6()
489 rc, CARD_DEVID(card)); in qeth_l3_setrouting_v6()
503 void qeth_l3_update_ipato(struct qeth_card *card) in qeth_l3_update_ipato() argument
508 hash_for_each(card->ip_htable, i, addr, hnode) { in qeth_l3_update_ipato()
511 addr->ipato = qeth_l3_is_addr_covered_by_ipato(card, addr); in qeth_l3_update_ipato()
515 static void qeth_l3_clear_ipato_list(struct qeth_card *card) in qeth_l3_clear_ipato_list() argument
519 mutex_lock(&card->ip_lock); in qeth_l3_clear_ipato_list()
521 list_for_each_entry_safe(ipatoe, tmp, &card->ipato.entries, entry) { in qeth_l3_clear_ipato_list()
526 qeth_l3_update_ipato(card); in qeth_l3_clear_ipato_list()
527 mutex_unlock(&card->ip_lock); in qeth_l3_clear_ipato_list()
530 int qeth_l3_add_ipato_entry(struct qeth_card *card, in qeth_l3_add_ipato_entry() argument
536 QETH_CARD_TEXT(card, 2, "addipato"); in qeth_l3_add_ipato_entry()
538 mutex_lock(&card->ip_lock); in qeth_l3_add_ipato_entry()
540 list_for_each_entry(ipatoe, &card->ipato.entries, entry) { in qeth_l3_add_ipato_entry()
552 list_add_tail(&new->entry, &card->ipato.entries); in qeth_l3_add_ipato_entry()
553 qeth_l3_update_ipato(card); in qeth_l3_add_ipato_entry()
556 mutex_unlock(&card->ip_lock); in qeth_l3_add_ipato_entry()
561 int qeth_l3_del_ipato_entry(struct qeth_card *card, in qeth_l3_del_ipato_entry() argument
568 QETH_CARD_TEXT(card, 2, "delipato"); in qeth_l3_del_ipato_entry()
570 mutex_lock(&card->ip_lock); in qeth_l3_del_ipato_entry()
572 list_for_each_entry_safe(ipatoe, tmp, &card->ipato.entries, entry) { in qeth_l3_del_ipato_entry()
579 qeth_l3_update_ipato(card); in qeth_l3_del_ipato_entry()
585 mutex_unlock(&card->ip_lock); in qeth_l3_del_ipato_entry()
590 int qeth_l3_modify_rxip_vipa(struct qeth_card *card, bool add, const u8 *ip, in qeth_l3_modify_rxip_vipa() argument
602 return qeth_l3_modify_ip(card, &addr, add); in qeth_l3_modify_rxip_vipa()
605 int qeth_l3_modify_hsuid(struct qeth_card *card, bool add) in qeth_l3_modify_hsuid() argument
614 addr.u.a6.addr.s6_addr[8+i] = card->options.hsuid[i]; in qeth_l3_modify_hsuid()
616 return qeth_l3_modify_ip(card, &addr, add); in qeth_l3_modify_hsuid()
619 static int qeth_l3_register_addr_entry(struct qeth_card *card, in qeth_l3_register_addr_entry() argument
626 if (card->options.sniffer) in qeth_l3_register_addr_entry()
630 QETH_CARD_TEXT(card, 2, "setaddr4"); in qeth_l3_register_addr_entry()
631 QETH_CARD_HEX(card, 3, &addr->u.a4.addr, sizeof(int)); in qeth_l3_register_addr_entry()
633 QETH_CARD_TEXT(card, 2, "setaddr6"); in qeth_l3_register_addr_entry()
634 QETH_CARD_HEX(card, 3, &addr->u.a6.addr, 8); in qeth_l3_register_addr_entry()
635 QETH_CARD_HEX(card, 3, ((char *)&addr->u.a6.addr) + 8, 8); in qeth_l3_register_addr_entry()
637 QETH_CARD_TEXT(card, 2, "setaddr?"); in qeth_l3_register_addr_entry()
638 QETH_CARD_HEX(card, 3, addr, sizeof(struct qeth_ipaddr)); in qeth_l3_register_addr_entry()
642 rc = qeth_l3_send_setdelmc(card, addr, IPA_CMD_SETIPM); in qeth_l3_register_addr_entry()
644 rc = qeth_l3_send_setdelip(card, addr, IPA_CMD_SETIP); in qeth_l3_register_addr_entry()
646 QETH_CARD_TEXT(card, 2, "failed"); in qeth_l3_register_addr_entry()
649 QETH_CARD_TEXT(card, 2, "FAILED"); in qeth_l3_register_addr_entry()
651 dev_warn(&card->gdev->dev, in qeth_l3_register_addr_entry()
657 static int qeth_l3_deregister_addr_entry(struct qeth_card *card, in qeth_l3_deregister_addr_entry() argument
662 if (card->options.sniffer) in qeth_l3_deregister_addr_entry()
666 QETH_CARD_TEXT(card, 2, "deladdr4"); in qeth_l3_deregister_addr_entry()
667 QETH_CARD_HEX(card, 3, &addr->u.a4.addr, sizeof(int)); in qeth_l3_deregister_addr_entry()
669 QETH_CARD_TEXT(card, 2, "deladdr6"); in qeth_l3_deregister_addr_entry()
670 QETH_CARD_HEX(card, 3, &addr->u.a6.addr, 8); in qeth_l3_deregister_addr_entry()
671 QETH_CARD_HEX(card, 3, ((char *)&addr->u.a6.addr) + 8, 8); in qeth_l3_deregister_addr_entry()
673 QETH_CARD_TEXT(card, 2, "deladdr?"); in qeth_l3_deregister_addr_entry()
674 QETH_CARD_HEX(card, 3, addr, sizeof(struct qeth_ipaddr)); in qeth_l3_deregister_addr_entry()
677 rc = qeth_l3_send_setdelmc(card, addr, IPA_CMD_DELIPM); in qeth_l3_deregister_addr_entry()
679 rc = qeth_l3_send_setdelip(card, addr, IPA_CMD_DELIP); in qeth_l3_deregister_addr_entry()
681 QETH_CARD_TEXT(card, 2, "failed"); in qeth_l3_deregister_addr_entry()
686 static int qeth_l3_setadapter_parms(struct qeth_card *card) in qeth_l3_setadapter_parms() argument
690 QETH_CARD_TEXT(card, 2, "setadprm"); in qeth_l3_setadapter_parms()
692 if (qeth_adp_supported(card, IPA_SETADP_ALTER_MAC_ADDRESS)) { in qeth_l3_setadapter_parms()
693 rc = qeth_setadpparms_change_macaddr(card); in qeth_l3_setadapter_parms()
695 dev_warn(&card->gdev->dev, "Reading the adapter MAC" in qeth_l3_setadapter_parms()
702 static int qeth_l3_start_ipa_arp_processing(struct qeth_card *card) in qeth_l3_start_ipa_arp_processing() argument
706 QETH_CARD_TEXT(card, 3, "ipaarp"); in qeth_l3_start_ipa_arp_processing()
708 if (!qeth_is_supported(card, IPA_ARP_PROCESSING)) { in qeth_l3_start_ipa_arp_processing()
709 dev_info(&card->gdev->dev, in qeth_l3_start_ipa_arp_processing()
711 netdev_name(card->dev)); in qeth_l3_start_ipa_arp_processing()
714 rc = qeth_send_simple_setassparms(card, IPA_ARP_PROCESSING, in qeth_l3_start_ipa_arp_processing()
717 dev_warn(&card->gdev->dev, in qeth_l3_start_ipa_arp_processing()
719 netdev_name(card->dev)); in qeth_l3_start_ipa_arp_processing()
724 static int qeth_l3_start_ipa_source_mac(struct qeth_card *card) in qeth_l3_start_ipa_source_mac() argument
728 QETH_CARD_TEXT(card, 3, "stsrcmac"); in qeth_l3_start_ipa_source_mac()
730 if (!qeth_is_supported(card, IPA_SOURCE_MAC)) { in qeth_l3_start_ipa_source_mac()
731 dev_info(&card->gdev->dev, in qeth_l3_start_ipa_source_mac()
733 netdev_name(card->dev)); in qeth_l3_start_ipa_source_mac()
737 rc = qeth_send_simple_setassparms(card, IPA_SOURCE_MAC, in qeth_l3_start_ipa_source_mac()
740 dev_warn(&card->gdev->dev, in qeth_l3_start_ipa_source_mac()
742 netdev_name(card->dev)); in qeth_l3_start_ipa_source_mac()
746 static int qeth_l3_start_ipa_vlan(struct qeth_card *card) in qeth_l3_start_ipa_vlan() argument
750 QETH_CARD_TEXT(card, 3, "strtvlan"); in qeth_l3_start_ipa_vlan()
752 if (!qeth_is_supported(card, IPA_FULL_VLAN)) { in qeth_l3_start_ipa_vlan()
753 dev_info(&card->gdev->dev, in qeth_l3_start_ipa_vlan()
754 "VLAN not supported on %s\n", netdev_name(card->dev)); in qeth_l3_start_ipa_vlan()
758 rc = qeth_send_simple_setassparms(card, IPA_VLAN_PRIO, in qeth_l3_start_ipa_vlan()
761 dev_warn(&card->gdev->dev, in qeth_l3_start_ipa_vlan()
763 netdev_name(card->dev)); in qeth_l3_start_ipa_vlan()
765 dev_info(&card->gdev->dev, "VLAN enabled\n"); in qeth_l3_start_ipa_vlan()
770 static int qeth_l3_start_ipa_multicast(struct qeth_card *card) in qeth_l3_start_ipa_multicast() argument
774 QETH_CARD_TEXT(card, 3, "stmcast"); in qeth_l3_start_ipa_multicast()
776 if (!qeth_is_supported(card, IPA_MULTICASTING)) { in qeth_l3_start_ipa_multicast()
777 dev_info(&card->gdev->dev, in qeth_l3_start_ipa_multicast()
779 netdev_name(card->dev)); in qeth_l3_start_ipa_multicast()
783 rc = qeth_send_simple_setassparms(card, IPA_MULTICASTING, in qeth_l3_start_ipa_multicast()
786 dev_warn(&card->gdev->dev, in qeth_l3_start_ipa_multicast()
788 netdev_name(card->dev)); in qeth_l3_start_ipa_multicast()
790 dev_info(&card->gdev->dev, "Multicast enabled\n"); in qeth_l3_start_ipa_multicast()
791 card->dev->flags |= IFF_MULTICAST; in qeth_l3_start_ipa_multicast()
796 static int qeth_l3_softsetup_ipv6(struct qeth_card *card) in qeth_l3_softsetup_ipv6() argument
801 QETH_CARD_TEXT(card, 3, "softipv6"); in qeth_l3_softsetup_ipv6()
803 if (IS_IQD(card)) in qeth_l3_softsetup_ipv6()
806 rc = qeth_send_simple_setassparms(card, IPA_IPV6, IPA_CMD_ASS_START, in qeth_l3_softsetup_ipv6()
809 dev_err(&card->gdev->dev, in qeth_l3_softsetup_ipv6()
811 netdev_name(card->dev)); in qeth_l3_softsetup_ipv6()
814 rc = qeth_send_simple_setassparms_v6(card, IPA_IPV6, IPA_CMD_ASS_START, in qeth_l3_softsetup_ipv6()
817 dev_err(&card->gdev->dev, in qeth_l3_softsetup_ipv6()
819 netdev_name(card->dev)); in qeth_l3_softsetup_ipv6()
822 rc = qeth_send_simple_setassparms_v6(card, IPA_PASSTHRU, in qeth_l3_softsetup_ipv6()
825 dev_warn(&card->gdev->dev, in qeth_l3_softsetup_ipv6()
827 netdev_name(card->dev)); in qeth_l3_softsetup_ipv6()
831 dev_info(&card->gdev->dev, "IPV6 enabled\n"); in qeth_l3_softsetup_ipv6()
835 static int qeth_l3_start_ipa_ipv6(struct qeth_card *card) in qeth_l3_start_ipa_ipv6() argument
837 QETH_CARD_TEXT(card, 3, "strtipv6"); in qeth_l3_start_ipa_ipv6()
839 if (!qeth_is_supported(card, IPA_IPV6)) { in qeth_l3_start_ipa_ipv6()
840 dev_info(&card->gdev->dev, in qeth_l3_start_ipa_ipv6()
841 "IPv6 not supported on %s\n", netdev_name(card->dev)); in qeth_l3_start_ipa_ipv6()
844 return qeth_l3_softsetup_ipv6(card); in qeth_l3_start_ipa_ipv6()
847 static int qeth_l3_start_ipa_broadcast(struct qeth_card *card) in qeth_l3_start_ipa_broadcast() argument
852 QETH_CARD_TEXT(card, 3, "stbrdcst"); in qeth_l3_start_ipa_broadcast()
853 card->info.broadcast_capable = 0; in qeth_l3_start_ipa_broadcast()
854 if (!qeth_is_supported(card, IPA_FILTERING)) { in qeth_l3_start_ipa_broadcast()
855 dev_info(&card->gdev->dev, in qeth_l3_start_ipa_broadcast()
857 netdev_name(card->dev)); in qeth_l3_start_ipa_broadcast()
861 rc = qeth_send_simple_setassparms(card, IPA_FILTERING, in qeth_l3_start_ipa_broadcast()
864 dev_warn(&card->gdev->dev, in qeth_l3_start_ipa_broadcast()
866 netdev_name(card->dev)); in qeth_l3_start_ipa_broadcast()
870 rc = qeth_send_simple_setassparms(card, IPA_FILTERING, in qeth_l3_start_ipa_broadcast()
873 dev_warn(&card->gdev->dev, in qeth_l3_start_ipa_broadcast()
875 netdev_name(card->dev)); in qeth_l3_start_ipa_broadcast()
878 card->info.broadcast_capable = QETH_BROADCAST_WITH_ECHO; in qeth_l3_start_ipa_broadcast()
879 dev_info(&card->gdev->dev, "Broadcast enabled\n"); in qeth_l3_start_ipa_broadcast()
880 rc = qeth_send_simple_setassparms(card, IPA_FILTERING, in qeth_l3_start_ipa_broadcast()
883 dev_warn(&card->gdev->dev, in qeth_l3_start_ipa_broadcast()
885 netdev_name(card->dev)); in qeth_l3_start_ipa_broadcast()
888 card->info.broadcast_capable = QETH_BROADCAST_WITHOUT_ECHO; in qeth_l3_start_ipa_broadcast()
890 if (card->info.broadcast_capable) in qeth_l3_start_ipa_broadcast()
891 card->dev->flags |= IFF_BROADCAST; in qeth_l3_start_ipa_broadcast()
893 card->dev->flags &= ~IFF_BROADCAST; in qeth_l3_start_ipa_broadcast()
897 static void qeth_l3_start_ipassists(struct qeth_card *card) in qeth_l3_start_ipassists() argument
899 QETH_CARD_TEXT(card, 3, "strtipas"); in qeth_l3_start_ipassists()
901 qeth_l3_start_ipa_arp_processing(card); /* go on*/ in qeth_l3_start_ipassists()
902 qeth_l3_start_ipa_source_mac(card); /* go on*/ in qeth_l3_start_ipassists()
903 qeth_l3_start_ipa_vlan(card); /* go on*/ in qeth_l3_start_ipassists()
904 qeth_l3_start_ipa_multicast(card); /* go on*/ in qeth_l3_start_ipassists()
905 qeth_l3_start_ipa_ipv6(card); /* go on*/ in qeth_l3_start_ipassists()
906 qeth_l3_start_ipa_broadcast(card); /* go on*/ in qeth_l3_start_ipassists()
909 static int qeth_l3_iqd_read_initial_mac_cb(struct qeth_card *card, in qeth_l3_iqd_read_initial_mac_cb() argument
919 ether_addr_copy(card->dev->dev_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()
1520 struct qeth_card *card = dev->ml_priv; in qeth_l3_do_ioctl() local
1531 rc = qeth_l3_arp_set_no_entries(card, rq->ifr_ifru.ifru_ivalue); in qeth_l3_do_ioctl()
1538 rc = qeth_l3_arp_query(card, data); in qeth_l3_do_ioctl()
1550 return qeth_l3_arp_modify_entry(card, &arp_entry, arp_cmd); in qeth_l3_do_ioctl()
1556 rc = qeth_l3_arp_flush_cache(card); in qeth_l3_do_ioctl()
1631 struct qeth_card *card = queue->card; in qeth_l3_fill_header() local
1650 if (proto == htons(ETH_P_IP) || IS_IQD(card)) { in qeth_l3_fill_header()
1664 if (IS_IQD(card) && skb_get_queue_mapping(skb) != QETH_IQD_MCAST_TXQ) in qeth_l3_fill_header()
1679 if (!IS_IQD(card)) in qeth_l3_fill_header()
1709 static int qeth_l3_xmit(struct qeth_card *card, struct sk_buff *skb, in qeth_l3_xmit() argument
1724 return qeth_xmit(card, skb, queue, proto, qeth_l3_fill_header); in qeth_l3_xmit()
1730 struct qeth_card *card = dev->ml_priv; in qeth_l3_hard_start_xmit() local
1738 if (IS_IQD(card)) { in qeth_l3_hard_start_xmit()
1739 queue = card->qdio.out_qs[qeth_iqd_translate_txq(dev, txq)]; in qeth_l3_hard_start_xmit()
1741 if (card->options.sniffer) in qeth_l3_hard_start_xmit()
1746 if (card->options.cq != QETH_CQ_ENABLED) in qeth_l3_hard_start_xmit()
1751 if (card->options.cq == QETH_CQ_ENABLED) in qeth_l3_hard_start_xmit()
1758 queue = card->qdio.out_qs[txq]; in qeth_l3_hard_start_xmit()
1765 if (proto == htons(ETH_P_IP) || IS_IQD(card)) in qeth_l3_hard_start_xmit()
1766 rc = qeth_l3_xmit(card, skb, queue, proto); in qeth_l3_hard_start_xmit()
1768 rc = qeth_xmit(card, skb, queue, proto, qeth_l3_fill_header); in qeth_l3_hard_start_xmit()
1781 struct qeth_card *card = dev->ml_priv; in qeth_l3_set_rx_mode() local
1783 schedule_work(&card->rx_mode_work); in qeth_l3_set_rx_mode()
1831 struct qeth_card *card = dev->ml_priv; in qeth_l3_osa_select_queue() local
1833 if (qeth_uses_tx_prio_queueing(card)) in qeth_l3_osa_select_queue()
1834 return qeth_get_priority_queue(card, skb); in qeth_l3_osa_select_queue()
1871 static int qeth_l3_setup_netdev(struct qeth_card *card) in qeth_l3_setup_netdev() argument
1873 struct net_device *dev = card->dev; in qeth_l3_setup_netdev()
1877 if (IS_OSD(card) || IS_OSX(card)) { in qeth_l3_setup_netdev()
1878 card->dev->netdev_ops = &qeth_l3_osa_netdev_ops; in qeth_l3_setup_netdev()
1881 dev->dev_id = qeth_l3_get_unique_id(card, dev->dev_id); in qeth_l3_setup_netdev()
1883 if (!IS_VM_NIC(card)) { in qeth_l3_setup_netdev()
1884 card->dev->features |= NETIF_F_SG; in qeth_l3_setup_netdev()
1885 card->dev->hw_features |= NETIF_F_TSO | in qeth_l3_setup_netdev()
1887 card->dev->vlan_features |= NETIF_F_TSO | in qeth_l3_setup_netdev()
1891 if (qeth_is_supported6(card, IPA_OUTBOUND_CHECKSUM_V6)) { in qeth_l3_setup_netdev()
1892 card->dev->hw_features |= NETIF_F_IPV6_CSUM; in qeth_l3_setup_netdev()
1893 card->dev->vlan_features |= NETIF_F_IPV6_CSUM; in qeth_l3_setup_netdev()
1895 if (qeth_is_supported6(card, IPA_OUTBOUND_TSO)) { in qeth_l3_setup_netdev()
1896 card->dev->hw_features |= NETIF_F_TSO6; in qeth_l3_setup_netdev()
1897 card->dev->vlan_features |= NETIF_F_TSO6; in qeth_l3_setup_netdev()
1901 if (card->dev->hw_features & NETIF_F_TSO6) in qeth_l3_setup_netdev()
1903 else if (card->dev->hw_features & NETIF_F_TSO) in qeth_l3_setup_netdev()
1907 } else if (IS_IQD(card)) { in qeth_l3_setup_netdev()
1908 card->dev->flags |= IFF_NOARP; in qeth_l3_setup_netdev()
1909 card->dev->netdev_ops = &qeth_l3_netdev_ops; in qeth_l3_setup_netdev()
1912 rc = qeth_l3_iqd_read_initial_mac(card); in qeth_l3_setup_netdev()
1918 card->dev->needed_headroom = headroom; in qeth_l3_setup_netdev()
1919 card->dev->features |= NETIF_F_HW_VLAN_CTAG_TX | in qeth_l3_setup_netdev()
1922 netif_keep_dst(card->dev); in qeth_l3_setup_netdev()
1923 if (card->dev->hw_features & (NETIF_F_TSO | NETIF_F_TSO6)) in qeth_l3_setup_netdev()
1924 netif_set_gso_max_size(card->dev, in qeth_l3_setup_netdev()
1925 PAGE_SIZE * (QETH_MAX_BUFFER_ELEMENTS(card) - 1)); in qeth_l3_setup_netdev()
1927 netif_napi_add(card->dev, &card->napi, qeth_poll, QETH_NAPI_WEIGHT); in qeth_l3_setup_netdev()
1928 return register_netdev(card->dev); in qeth_l3_setup_netdev()
1938 struct qeth_card *card = dev_get_drvdata(&gdev->dev); in qeth_l3_probe_device() local
1941 hash_init(card->ip_htable); in qeth_l3_probe_device()
1942 mutex_init(&card->ip_lock); in qeth_l3_probe_device()
1943 card->cmd_wq = alloc_ordered_workqueue("%s_cmd", 0, in qeth_l3_probe_device()
1945 if (!card->cmd_wq) in qeth_l3_probe_device()
1951 destroy_workqueue(card->cmd_wq); in qeth_l3_probe_device()
1958 INIT_WORK(&card->rx_mode_work, qeth_l3_rx_mode_work); in qeth_l3_probe_device()
1964 struct qeth_card *card = dev_get_drvdata(&cgdev->dev); in qeth_l3_remove_device() local
1969 qeth_set_allowed_threads(card, 0, 1); in qeth_l3_remove_device()
1970 wait_event(card->wait_q, qeth_threads_running(card, 0xffffffff) == 0); in qeth_l3_remove_device()
1973 qeth_set_offline(card, card->discipline, false); in qeth_l3_remove_device()
1975 if (card->dev->reg_state == NETREG_REGISTERED) in qeth_l3_remove_device()
1976 unregister_netdev(card->dev); in qeth_l3_remove_device()
1978 flush_workqueue(card->cmd_wq); in qeth_l3_remove_device()
1979 destroy_workqueue(card->cmd_wq); in qeth_l3_remove_device()
1980 qeth_l3_clear_ip_htable(card, 0); in qeth_l3_remove_device()
1981 qeth_l3_clear_ipato_list(card); in qeth_l3_remove_device()
1984 static int qeth_l3_set_online(struct qeth_card *card, bool carrier_ok) in qeth_l3_set_online() argument
1986 struct net_device *dev = card->dev; in qeth_l3_set_online()
1990 QETH_CARD_TEXT(card, 2, "softsetp"); in qeth_l3_set_online()
1992 rc = qeth_l3_setadapter_parms(card); in qeth_l3_set_online()
1994 QETH_CARD_TEXT_(card, 2, "2err%04x", rc); in qeth_l3_set_online()
1995 if (!card->options.sniffer) { in qeth_l3_set_online()
1996 qeth_l3_start_ipassists(card); in qeth_l3_set_online()
1998 rc = qeth_l3_setrouting_v4(card); in qeth_l3_set_online()
2000 QETH_CARD_TEXT_(card, 2, "4err%04x", rc); in qeth_l3_set_online()
2001 rc = qeth_l3_setrouting_v6(card); in qeth_l3_set_online()
2003 QETH_CARD_TEXT_(card, 2, "5err%04x", rc); in qeth_l3_set_online()
2006 card->state = CARD_STATE_SOFTSETUP; in qeth_l3_set_online()
2008 qeth_set_allowed_threads(card, 0xffffffff, 0); in qeth_l3_set_online()
2009 qeth_l3_recover_ip(card); in qeth_l3_set_online()
2012 rc = qeth_l3_setup_netdev(card); in qeth_l3_set_online()
2020 rc = qeth_set_real_num_tx_queues(card, in qeth_l3_set_online()
2021 qeth_tx_actual_queues(card)); in qeth_l3_set_online()
2037 napi_schedule(&card->napi); in qeth_l3_set_online()
2047 qeth_set_allowed_threads(card, 0, 1); in qeth_l3_set_online()
2048 card->state = CARD_STATE_DOWN; in qeth_l3_set_online()
2049 qeth_l3_clear_ip_htable(card, 1); in qeth_l3_set_online()
2053 static void qeth_l3_set_offline(struct qeth_card *card) in qeth_l3_set_offline() argument
2055 qeth_set_allowed_threads(card, 0, 1); in qeth_l3_set_offline()
2056 qeth_l3_drain_rx_mode_cache(card); in qeth_l3_set_offline()
2058 if (card->options.sniffer && in qeth_l3_set_offline()
2059 (card->info.promisc_mode == SET_PROMISC_MODE_ON)) in qeth_l3_set_offline()
2060 qeth_diags_trace(card, QETH_DIAGS_CMD_TRACE_DISABLE); in qeth_l3_set_offline()
2062 if (card->state == CARD_STATE_SOFTSETUP) { in qeth_l3_set_offline()
2063 card->state = CARD_STATE_DOWN; in qeth_l3_set_offline()
2064 qeth_l3_clear_ip_htable(card, 1); in qeth_l3_set_offline()
2069 static int qeth_l3_control_event(struct qeth_card *card, in qeth_l3_control_event() argument
2085 static int qeth_l3_handle_ip_event(struct qeth_card *card, in qeth_l3_handle_ip_event() argument
2091 qeth_l3_modify_ip(card, addr, true); in qeth_l3_handle_ip_event()
2094 qeth_l3_modify_ip(card, addr, false); in qeth_l3_handle_ip_event()
2103 struct qeth_card *card; member
2113 qeth_l3_modify_ip(ip_work->card, &ip_work->addr, true); in qeth_l3_add_ip_worker()
2121 qeth_l3_modify_ip(ip_work->card, &ip_work->addr, false); in qeth_l3_delete_ip_worker()
2141 struct qeth_card *card; in qeth_l3_ip_event() local
2143 card = qeth_l3_get_card_from_dev(dev); in qeth_l3_ip_event()
2144 if (!card) in qeth_l3_ip_event()
2146 QETH_CARD_TEXT(card, 3, "ipevent"); in qeth_l3_ip_event()
2152 return qeth_l3_handle_ip_event(card, &addr, event); in qeth_l3_ip_event()
2166 struct qeth_card *card; in qeth_l3_ip6_event() local
2171 card = qeth_l3_get_card_from_dev(dev); in qeth_l3_ip6_event()
2172 if (!card) in qeth_l3_ip6_event()
2174 QETH_CARD_TEXT(card, 3, "ip6event"); in qeth_l3_ip6_event()
2175 if (!qeth_is_supported(card, IPA_IPV6)) in qeth_l3_ip6_event()
2187 ip_work->card = card; in qeth_l3_ip6_event()
2193 queue_work(card->cmd_wq, &ip_work->work); in qeth_l3_ip6_event()