Lines Matching full:card

31 static int qeth_l2_setdelmac_makerc(struct qeth_card *card, u16 retcode)  in qeth_l2_setdelmac_makerc()  argument
36 QETH_CARD_TEXT_(card, 2, "err%04x", retcode); in qeth_l2_setdelmac_makerc()
65 static int qeth_l2_send_setdelmac_cb(struct qeth_card *card, in qeth_l2_send_setdelmac_cb() argument
71 return qeth_l2_setdelmac_makerc(card, cmd->hdr.return_code); in qeth_l2_send_setdelmac_cb()
74 static int qeth_l2_send_setdelmac(struct qeth_card *card, const __u8 *mac, in qeth_l2_send_setdelmac() argument
80 QETH_CARD_TEXT(card, 2, "L2sdmac"); in qeth_l2_send_setdelmac()
81 iob = qeth_ipa_alloc_cmd(card, ipacmd, QETH_PROT_IPV4, in qeth_l2_send_setdelmac()
88 return qeth_send_ipa_cmd(card, iob, qeth_l2_send_setdelmac_cb, NULL); in qeth_l2_send_setdelmac()
91 static int qeth_l2_send_setmac(struct qeth_card *card, const __u8 *mac) in qeth_l2_send_setmac() argument
95 QETH_CARD_TEXT(card, 2, "L2Setmac"); in qeth_l2_send_setmac()
96 rc = qeth_l2_send_setdelmac(card, mac, IPA_CMD_SETVMAC); in qeth_l2_send_setmac()
98 dev_info(&card->gdev->dev, in qeth_l2_send_setmac()
103 dev_warn(&card->gdev->dev, in qeth_l2_send_setmac()
107 dev_warn(&card->gdev->dev, in qeth_l2_send_setmac()
115 static int qeth_l2_write_mac(struct qeth_card *card, u8 *mac) in qeth_l2_write_mac() argument
121 QETH_CARD_TEXT(card, 2, "L2Wmac"); in qeth_l2_write_mac()
122 rc = qeth_l2_send_setdelmac(card, mac, cmd); in qeth_l2_write_mac()
125 ether_addr_to_u64(mac), CARD_DEVID(card)); in qeth_l2_write_mac()
128 ether_addr_to_u64(mac), CARD_DEVID(card), rc); in qeth_l2_write_mac()
132 static int qeth_l2_remove_mac(struct qeth_card *card, u8 *mac) in qeth_l2_remove_mac() argument
138 QETH_CARD_TEXT(card, 2, "L2Rmac"); in qeth_l2_remove_mac()
139 rc = qeth_l2_send_setdelmac(card, mac, cmd); in qeth_l2_remove_mac()
142 ether_addr_to_u64(mac), CARD_DEVID(card), rc); in qeth_l2_remove_mac()
146 static void qeth_l2_drain_rx_mode_cache(struct qeth_card *card) in qeth_l2_drain_rx_mode_cache() argument
152 hash_for_each_safe(card->rx_mode_addrs, i, tmp, mac, hnode) { in qeth_l2_drain_rx_mode_cache()
192 static int qeth_l2_setdelvlan_makerc(struct qeth_card *card, u16 retcode) in qeth_l2_setdelvlan_makerc() argument
195 QETH_CARD_TEXT_(card, 2, "err%04x", retcode); in qeth_l2_setdelvlan_makerc()
213 static int qeth_l2_send_setdelvlan_cb(struct qeth_card *card, in qeth_l2_send_setdelvlan_cb() argument
219 QETH_CARD_TEXT(card, 2, "L2sdvcb"); in qeth_l2_send_setdelvlan_cb()
223 CARD_DEVID(card), cmd->hdr.return_code); in qeth_l2_send_setdelvlan_cb()
224 QETH_CARD_TEXT_(card, 2, "L2VL%4x", cmd->hdr.command); in qeth_l2_send_setdelvlan_cb()
226 return qeth_l2_setdelvlan_makerc(card, cmd->hdr.return_code); in qeth_l2_send_setdelvlan_cb()
229 static int qeth_l2_send_setdelvlan(struct qeth_card *card, __u16 i, in qeth_l2_send_setdelvlan() argument
235 QETH_CARD_TEXT_(card, 4, "L2sdv%x", ipacmd); in qeth_l2_send_setdelvlan()
236 iob = qeth_ipa_alloc_cmd(card, ipacmd, QETH_PROT_IPV4, in qeth_l2_send_setdelvlan()
242 return qeth_send_ipa_cmd(card, iob, qeth_l2_send_setdelvlan_cb, NULL); in qeth_l2_send_setdelvlan()
248 struct qeth_card *card = dev->ml_priv; in qeth_l2_vlan_rx_add_vid() local
250 QETH_CARD_TEXT_(card, 4, "aid:%d", vid); in qeth_l2_vlan_rx_add_vid()
254 return qeth_l2_send_setdelvlan(card, vid, IPA_CMD_SETVLAN); in qeth_l2_vlan_rx_add_vid()
260 struct qeth_card *card = dev->ml_priv; in qeth_l2_vlan_rx_kill_vid() local
262 QETH_CARD_TEXT_(card, 4, "kid:%d", vid); in qeth_l2_vlan_rx_kill_vid()
266 return qeth_l2_send_setdelvlan(card, vid, IPA_CMD_DELVLAN); in qeth_l2_vlan_rx_kill_vid()
269 static void qeth_l2_set_pnso_mode(struct qeth_card *card, in qeth_l2_set_pnso_mode() argument
272 spin_lock_irq(get_ccwdev_lock(CARD_RDEV(card))); in qeth_l2_set_pnso_mode()
273 WRITE_ONCE(card->info.pnso_mode, mode); in qeth_l2_set_pnso_mode()
274 spin_unlock_irq(get_ccwdev_lock(CARD_RDEV(card))); in qeth_l2_set_pnso_mode()
277 drain_workqueue(card->event_wq); in qeth_l2_set_pnso_mode()
280 static void qeth_l2_dev2br_fdb_flush(struct qeth_card *card) in qeth_l2_dev2br_fdb_flush() argument
284 QETH_CARD_TEXT(card, 2, "fdbflush"); in qeth_l2_dev2br_fdb_flush()
293 card->dev, &info.info, NULL); in qeth_l2_dev2br_fdb_flush()
296 static int qeth_l2_request_initial_mac(struct qeth_card *card) in qeth_l2_request_initial_mac() argument
300 QETH_CARD_TEXT(card, 2, "l2reqmac"); in qeth_l2_request_initial_mac()
303 rc = qeth_vm_request_mac(card); in qeth_l2_request_initial_mac()
307 CARD_DEVID(card), rc); in qeth_l2_request_initial_mac()
308 QETH_CARD_TEXT_(card, 2, "err%04x", rc); in qeth_l2_request_initial_mac()
312 rc = qeth_setadpparms_change_macaddr(card); in qeth_l2_request_initial_mac()
316 CARD_DEVID(card), rc); in qeth_l2_request_initial_mac()
317 QETH_CARD_TEXT_(card, 2, "1err%04x", rc); in qeth_l2_request_initial_mac()
322 if (IS_OSM(card) || IS_OSX(card)) in qeth_l2_request_initial_mac()
324 eth_hw_addr_random(card->dev); in qeth_l2_request_initial_mac()
327 QETH_CARD_HEX(card, 2, card->dev->dev_addr, card->dev->addr_len); in qeth_l2_request_initial_mac()
331 static void qeth_l2_register_dev_addr(struct qeth_card *card) in qeth_l2_register_dev_addr() argument
333 if (!is_valid_ether_addr(card->dev->dev_addr)) in qeth_l2_register_dev_addr()
334 qeth_l2_request_initial_mac(card); in qeth_l2_register_dev_addr()
336 if (!qeth_l2_send_setmac(card, card->dev->dev_addr)) in qeth_l2_register_dev_addr()
337 card->info.dev_addr_is_registered = 1; in qeth_l2_register_dev_addr()
339 card->info.dev_addr_is_registered = 0; in qeth_l2_register_dev_addr()
344 struct qeth_card *card = dev->ml_priv; in qeth_l2_validate_addr() local
346 if (card->info.dev_addr_is_registered) in qeth_l2_validate_addr()
349 QETH_CARD_TEXT(card, 4, "nomacadr"); in qeth_l2_validate_addr()
356 struct qeth_card *card = dev->ml_priv; in qeth_l2_set_mac_address() local
360 QETH_CARD_TEXT(card, 3, "setmac"); in qeth_l2_set_mac_address()
362 if (IS_OSM(card) || IS_OSX(card)) { in qeth_l2_set_mac_address()
363 QETH_CARD_TEXT(card, 3, "setmcTYP"); in qeth_l2_set_mac_address()
366 QETH_CARD_HEX(card, 3, addr->sa_data, ETH_ALEN); in qeth_l2_set_mac_address()
372 card->info.dev_addr_is_registered) in qeth_l2_set_mac_address()
376 rc = qeth_l2_send_setmac(card, addr->sa_data); in qeth_l2_set_mac_address()
382 if (card->info.dev_addr_is_registered) in qeth_l2_set_mac_address()
383 qeth_l2_remove_mac(card, old_addr); in qeth_l2_set_mac_address()
384 card->info.dev_addr_is_registered = 1; in qeth_l2_set_mac_address()
388 static void qeth_l2_promisc_to_bridge(struct qeth_card *card, bool enable) in qeth_l2_promisc_to_bridge() argument
393 QETH_CARD_TEXT(card, 3, "pmisc2br"); in qeth_l2_promisc_to_bridge()
396 if (card->options.sbp.reflect_promisc_primary) in qeth_l2_promisc_to_bridge()
403 rc = qeth_bridgeport_setrole(card, role); in qeth_l2_promisc_to_bridge()
404 QETH_CARD_TEXT_(card, 2, "bpm%c%04x", enable ? '+' : '-', rc); in qeth_l2_promisc_to_bridge()
406 card->options.sbp.role = role; in qeth_l2_promisc_to_bridge()
407 card->info.promisc_mode = enable; in qeth_l2_promisc_to_bridge()
411 static void qeth_l2_set_promisc_mode(struct qeth_card *card) in qeth_l2_set_promisc_mode() argument
413 bool enable = card->dev->flags & IFF_PROMISC; in qeth_l2_set_promisc_mode()
415 if (card->info.promisc_mode == enable) in qeth_l2_set_promisc_mode()
418 if (qeth_adp_supported(card, IPA_SETADP_SET_PROMISC_MODE)) { in qeth_l2_set_promisc_mode()
419 qeth_setadp_promisc_mode(card, enable); in qeth_l2_set_promisc_mode()
421 mutex_lock(&card->sbp_lock); in qeth_l2_set_promisc_mode()
422 if (card->options.sbp.reflect_promisc) in qeth_l2_set_promisc_mode()
423 qeth_l2_promisc_to_bridge(card, enable); in qeth_l2_set_promisc_mode()
424 mutex_unlock(&card->sbp_lock); in qeth_l2_set_promisc_mode()
428 /* New MAC address is added to the hash table and marked to be written on card
432 static void qeth_l2_add_mac(struct qeth_card *card, struct netdev_hw_addr *ha) in qeth_l2_add_mac() argument
437 hash_for_each_possible(card->rx_mode_addrs, mac, hnode, mac_hash) { in qeth_l2_add_mac()
451 hash_add(card->rx_mode_addrs, &mac->hnode, mac_hash); in qeth_l2_add_mac()
456 struct qeth_card *card = container_of(work, struct qeth_card, in qeth_l2_rx_mode_work() local
458 struct net_device *dev = card->dev; in qeth_l2_rx_mode_work()
465 QETH_CARD_TEXT(card, 3, "setmulti"); in qeth_l2_rx_mode_work()
469 qeth_l2_add_mac(card, ha); in qeth_l2_rx_mode_work()
471 qeth_l2_add_mac(card, ha); in qeth_l2_rx_mode_work()
474 hash_for_each_safe(card->rx_mode_addrs, i, tmp, mac, hnode) { in qeth_l2_rx_mode_work()
477 qeth_l2_remove_mac(card, mac->mac_addr); in qeth_l2_rx_mode_work()
482 rc = qeth_l2_write_mac(card, mac->mac_addr); in qeth_l2_rx_mode_work()
495 qeth_l2_set_promisc_mode(card); in qeth_l2_rx_mode_work()
501 struct qeth_card *card = dev->ml_priv; in qeth_l2_hard_start_xmit() local
508 if (IS_IQD(card)) in qeth_l2_hard_start_xmit()
510 queue = card->qdio.out_qs[txq]; in qeth_l2_hard_start_xmit()
512 rc = qeth_xmit(card, skb, queue, vlan_get_protocol(skb), in qeth_l2_hard_start_xmit()
531 struct qeth_card *card = dev->ml_priv; in qeth_l2_set_rx_mode() local
533 schedule_work(&card->rx_mode_work); in qeth_l2_set_rx_mode()
538 * @card: qeth_card structure pointer
550 static int qeth_l2_pnso(struct qeth_card *card, u8 oc, int cnc, in qeth_l2_pnso() argument
554 struct ccw_device *ddev = CARD_DDEV(card); in qeth_l2_pnso()
565 QETH_CARD_TEXT(card, 2, "PNSO"); in qeth_l2_pnso()
598 QETH_CARD_TEXT_(card, 2, "PNrp%04x", rr->response.code); in qeth_l2_pnso()
604 static bool qeth_is_my_net_if_token(struct qeth_card *card, in qeth_is_my_net_if_token() argument
607 return ((card->info.ddev_devno == token->devnum) && in qeth_is_my_net_if_token()
608 (card->info.cssid == token->cssid) && in qeth_is_my_net_if_token()
609 (card->info.iid == token->iid) && in qeth_is_my_net_if_token()
610 (card->info.ssid == token->ssid) && in qeth_is_my_net_if_token()
611 (card->info.chpid == token->chpid) && in qeth_is_my_net_if_token()
612 (card->info.chid == token->chid)); in qeth_is_my_net_if_token()
617 * @card: qeth_card structure pointer
627 static void qeth_l2_dev2br_fdb_notify(struct qeth_card *card, u8 code, in qeth_l2_dev2br_fdb_notify() argument
642 if (qeth_is_my_net_if_token(card, token)) in qeth_l2_dev2br_fdb_notify()
653 card->dev, &info.info, NULL); in qeth_l2_dev2br_fdb_notify()
654 QETH_CARD_TEXT(card, 4, "andelmac"); in qeth_l2_dev2br_fdb_notify()
655 QETH_CARD_TEXT_(card, 4, in qeth_l2_dev2br_fdb_notify()
659 card->dev, &info.info, NULL); in qeth_l2_dev2br_fdb_notify()
660 QETH_CARD_TEXT(card, 4, "anaddmac"); in qeth_l2_dev2br_fdb_notify()
661 QETH_CARD_TEXT_(card, 4, in qeth_l2_dev2br_fdb_notify()
670 struct qeth_card *card = priv; in qeth_l2_dev2br_an_set_cb() local
674 qeth_l2_dev2br_fdb_notify(card, code, in qeth_l2_dev2br_an_set_cb()
682 * @card: qeth_card structure pointer
690 static int qeth_l2_dev2br_an_set(struct qeth_card *card, bool enable) in qeth_l2_dev2br_an_set() argument
695 QETH_CARD_TEXT(card, 2, "anseton"); in qeth_l2_dev2br_an_set()
696 rc = qeth_l2_pnso(card, PNSO_OC_NET_ADDR_INFO, 1, in qeth_l2_dev2br_an_set()
697 qeth_l2_dev2br_an_set_cb, card); in qeth_l2_dev2br_an_set()
702 qeth_l2_pnso(card, PNSO_OC_NET_ADDR_INFO, 0, in qeth_l2_dev2br_an_set()
705 QETH_CARD_TEXT(card, 2, "ansetoff"); in qeth_l2_dev2br_an_set()
706 rc = qeth_l2_pnso(card, PNSO_OC_NET_ADDR_INFO, 0, NULL, NULL); in qeth_l2_dev2br_an_set()
756 struct qeth_card *card = lsyncdev->ml_priv; in qeth_l2_br2dev_worker() local
761 QETH_CARD_TEXT_(card, 4, "b2dw%04lx", event); in qeth_l2_br2dev_worker()
762 QETH_CARD_TEXT_(card, 4, "ma%012llx", ether_addr_to_u64(addr)); in qeth_l2_br2dev_worker()
789 QETH_CARD_TEXT(card, 2, "b2derris"); in qeth_l2_br2dev_worker()
790 QETH_CARD_TEXT_(card, 2, in qeth_l2_br2dev_worker()
809 QETH_CARD_TEXT_(card, 2, "b2derr%02lx", event); in qeth_l2_br2dev_worker()
827 struct qeth_card *card; in qeth_l2_br2dev_queue_work() local
839 card = lsyncdev->ml_priv; in qeth_l2_br2dev_queue_work()
844 queue_work(card->event_wq, &worker_data->work); in qeth_l2_br2dev_queue_work()
856 struct qeth_card *card; in qeth_l2_switchdev_event() local
874 card = lowerdev->ml_priv; in qeth_l2_switchdev_event()
875 QETH_CARD_TEXT_(card, 4, "b2dqw%03lx", event); in qeth_l2_switchdev_event()
880 QETH_CARD_TEXT(card, 2, "b2dqwerr"); in qeth_l2_switchdev_event()
940 struct qeth_card *card = dev->ml_priv; in qeth_l2_bridge_getlink() local
945 qeth_bridgeport_is_in_use(card)) in qeth_l2_bridge_getlink()
972 struct qeth_card *card = dev->ml_priv; in qeth_l2_bridge_setlink() local
1020 mutex_lock(&card->sbp_lock); in qeth_l2_bridge_setlink()
1022 if (qeth_bridgeport_is_in_use(card)) { in qeth_l2_bridge_setlink()
1026 qeth_l2_set_pnso_mode(card, QETH_PNSO_ADDR_INFO); in qeth_l2_bridge_setlink()
1027 rc = qeth_l2_dev2br_an_set(card, true); in qeth_l2_bridge_setlink()
1029 qeth_l2_set_pnso_mode(card, QETH_PNSO_NONE); in qeth_l2_bridge_setlink()
1035 rc = qeth_l2_dev2br_an_set(card, false); in qeth_l2_bridge_setlink()
1037 qeth_l2_set_pnso_mode(card, QETH_PNSO_NONE); in qeth_l2_bridge_setlink()
1039 qeth_l2_dev2br_fdb_flush(card); in qeth_l2_bridge_setlink()
1043 mutex_unlock(&card->sbp_lock); in qeth_l2_bridge_setlink()
1088 static int qeth_l2_setup_netdev(struct qeth_card *card) in qeth_l2_setup_netdev() argument
1090 card->dev->netdev_ops = IS_IQD(card) ? &qeth_l2_iqd_netdev_ops : in qeth_l2_setup_netdev()
1092 card->dev->needed_headroom = sizeof(struct qeth_hdr); in qeth_l2_setup_netdev()
1093 card->dev->priv_flags |= IFF_UNICAST_FLT; in qeth_l2_setup_netdev()
1095 if (IS_OSM(card)) { in qeth_l2_setup_netdev()
1096 card->dev->features |= NETIF_F_VLAN_CHALLENGED; in qeth_l2_setup_netdev()
1098 if (!IS_VM_NIC(card)) in qeth_l2_setup_netdev()
1099 card->dev->hw_features |= NETIF_F_HW_VLAN_CTAG_FILTER; in qeth_l2_setup_netdev()
1100 card->dev->features |= NETIF_F_HW_VLAN_CTAG_FILTER; in qeth_l2_setup_netdev()
1103 if (IS_OSD(card) && !IS_VM_NIC(card)) { in qeth_l2_setup_netdev()
1104 card->dev->features |= NETIF_F_SG; in qeth_l2_setup_netdev()
1106 if (qeth_is_supported(card, IPA_OUTBOUND_CHECKSUM)) { in qeth_l2_setup_netdev()
1107 card->dev->hw_features |= NETIF_F_IP_CSUM; in qeth_l2_setup_netdev()
1108 card->dev->vlan_features |= NETIF_F_IP_CSUM; in qeth_l2_setup_netdev()
1111 if (qeth_is_supported6(card, IPA_OUTBOUND_CHECKSUM_V6)) { in qeth_l2_setup_netdev()
1112 card->dev->hw_features |= NETIF_F_IPV6_CSUM; in qeth_l2_setup_netdev()
1113 card->dev->vlan_features |= NETIF_F_IPV6_CSUM; in qeth_l2_setup_netdev()
1115 if (qeth_is_supported(card, IPA_INBOUND_CHECKSUM) || in qeth_l2_setup_netdev()
1116 qeth_is_supported6(card, IPA_INBOUND_CHECKSUM_V6)) { in qeth_l2_setup_netdev()
1117 card->dev->hw_features |= NETIF_F_RXCSUM; in qeth_l2_setup_netdev()
1118 card->dev->vlan_features |= NETIF_F_RXCSUM; in qeth_l2_setup_netdev()
1120 if (qeth_is_supported(card, IPA_OUTBOUND_TSO)) { in qeth_l2_setup_netdev()
1121 card->dev->hw_features |= NETIF_F_TSO; in qeth_l2_setup_netdev()
1122 card->dev->vlan_features |= NETIF_F_TSO; in qeth_l2_setup_netdev()
1124 if (qeth_is_supported6(card, IPA_OUTBOUND_TSO)) { in qeth_l2_setup_netdev()
1125 card->dev->hw_features |= NETIF_F_TSO6; in qeth_l2_setup_netdev()
1126 card->dev->vlan_features |= NETIF_F_TSO6; in qeth_l2_setup_netdev()
1129 if (card->dev->hw_features & (NETIF_F_TSO | NETIF_F_TSO6)) { in qeth_l2_setup_netdev()
1130 card->dev->needed_headroom = sizeof(struct qeth_hdr_tso); in qeth_l2_setup_netdev()
1131 netif_keep_dst(card->dev); in qeth_l2_setup_netdev()
1132 netif_set_tso_max_size(card->dev, in qeth_l2_setup_netdev()
1136 netif_napi_add(card->dev, &card->napi, qeth_poll); in qeth_l2_setup_netdev()
1137 return register_netdev(card->dev); in qeth_l2_setup_netdev()
1140 static void qeth_l2_trace_features(struct qeth_card *card) in qeth_l2_trace_features() argument
1143 QETH_CARD_TEXT(card, 2, "featuSBP"); in qeth_l2_trace_features()
1144 QETH_CARD_HEX(card, 2, &card->options.sbp.supported_funcs, in qeth_l2_trace_features()
1145 sizeof(card->options.sbp.supported_funcs)); in qeth_l2_trace_features()
1147 QETH_CARD_TEXT(card, 2, "feaVNICC"); in qeth_l2_trace_features()
1148 QETH_CARD_HEX(card, 2, &card->options.vnicc.sup_chars, in qeth_l2_trace_features()
1149 sizeof(card->options.vnicc.sup_chars)); in qeth_l2_trace_features()
1152 static void qeth_l2_setup_bridgeport_attrs(struct qeth_card *card) in qeth_l2_setup_bridgeport_attrs() argument
1154 if (!card->options.sbp.reflect_promisc && in qeth_l2_setup_bridgeport_attrs()
1155 card->options.sbp.role != QETH_SBP_ROLE_NONE) { in qeth_l2_setup_bridgeport_attrs()
1157 qeth_bridgeport_setrole(card, card->options.sbp.role); in qeth_l2_setup_bridgeport_attrs()
1159 qeth_bridgeport_query_ports(card, &card->options.sbp.role, in qeth_l2_setup_bridgeport_attrs()
1162 if (card->options.sbp.hostnotification) { in qeth_l2_setup_bridgeport_attrs()
1163 if (qeth_bridgeport_an_set(card, 1)) in qeth_l2_setup_bridgeport_attrs()
1164 card->options.sbp.hostnotification = 0; in qeth_l2_setup_bridgeport_attrs()
1170 * Detect whether this card supports 'dev to bridge fdb network address
1173 * @card: qeth_card structure pointer
1175 static void qeth_l2_detect_dev2br_support(struct qeth_card *card) in qeth_l2_detect_dev2br_support() argument
1177 struct qeth_priv *priv = netdev_priv(card->dev); in qeth_l2_detect_dev2br_support()
1180 QETH_CARD_TEXT(card, 2, "d2brsup"); in qeth_l2_detect_dev2br_support()
1181 if (!IS_IQD(card)) in qeth_l2_detect_dev2br_support()
1185 dev2br_supported = card->info.ids_valid && in qeth_l2_detect_dev2br_support()
1187 QETH_CARD_TEXT_(card, 2, "D2Bsup%02x", dev2br_supported); in qeth_l2_detect_dev2br_support()
1195 static void qeth_l2_enable_brport_features(struct qeth_card *card) in qeth_l2_enable_brport_features() argument
1197 struct qeth_priv *priv = netdev_priv(card->dev); in qeth_l2_enable_brport_features()
1202 qeth_l2_set_pnso_mode(card, QETH_PNSO_ADDR_INFO); in qeth_l2_enable_brport_features()
1203 rc = qeth_l2_dev2br_an_set(card, true); in qeth_l2_enable_brport_features()
1206 qeth_l2_set_pnso_mode(card, QETH_PNSO_NONE); in qeth_l2_enable_brport_features()
1207 qeth_l2_dev2br_fdb_flush(card); in qeth_l2_enable_brport_features()
1208 qeth_l2_set_pnso_mode(card, QETH_PNSO_ADDR_INFO); in qeth_l2_enable_brport_features()
1209 rc = qeth_l2_dev2br_an_set(card, true); in qeth_l2_enable_brport_features()
1212 netdev_err(card->dev, in qeth_l2_enable_brport_features()
1215 qeth_l2_set_pnso_mode(card, QETH_PNSO_NONE); in qeth_l2_enable_brport_features()
1216 qeth_l2_dev2br_fdb_flush(card); in qeth_l2_enable_brport_features()
1220 dev_warn(&card->gdev->dev, in qeth_l2_enable_brport_features()
1233 * @card: qeth_card structure pointer, for udev events.
1246 static void qeth_bridge_emit_host_event(struct qeth_card *card, in qeth_bridge_emit_host_event() argument
1294 kobject_uevent_env(&card->gdev->dev.kobj, KOBJ_CHANGE, env); in qeth_bridge_emit_host_event()
1299 struct qeth_card *card; member
1329 kobject_uevent_env(&data->card->gdev->dev.kobj, in qeth_bridge_state_change_worker()
1334 static void qeth_bridge_state_change(struct qeth_card *card, in qeth_bridge_state_change() argument
1340 QETH_CARD_TEXT(card, 2, "brstchng"); in qeth_bridge_state_change()
1342 QETH_CARD_TEXT(card, 2, "BPempty"); in qeth_bridge_state_change()
1346 QETH_CARD_TEXT_(card, 2, "BPsz%04x", qports->entry_length); in qeth_bridge_state_change()
1352 QETH_CARD_TEXT(card, 2, "BPSalloc"); in qeth_bridge_state_change()
1356 data->card = card; in qeth_bridge_state_change()
1361 queue_work(card->event_wq, &data->worker); in qeth_bridge_state_change()
1366 struct qeth_card *card; member
1374 struct qeth_card *card; in qeth_l2_dev2br_worker() local
1380 card = data->card; in qeth_l2_dev2br_worker()
1381 priv = netdev_priv(card->dev); in qeth_l2_dev2br_worker()
1383 QETH_CARD_TEXT(card, 4, "dev2brew"); in qeth_l2_dev2br_worker()
1385 if (READ_ONCE(card->info.pnso_mode) == QETH_PNSO_NONE) in qeth_l2_dev2br_worker()
1391 queue_delayed_work(card->event_wq, dwork, in qeth_l2_dev2br_worker()
1396 if (!netif_device_present(card->dev)) { in qeth_l2_dev2br_worker()
1403 CARD_DEVID(card)); in qeth_l2_dev2br_worker()
1404 /* Card fdb and bridge fdb are out of sync, card has stopped in qeth_l2_dev2br_worker()
1409 qeth_l2_dev2br_fdb_flush(card); in qeth_l2_dev2br_worker()
1410 rc = qeth_l2_dev2br_an_set(card, true); in qeth_l2_dev2br_worker()
1417 netdev_err(card->dev, in qeth_l2_dev2br_worker()
1420 WRITE_ONCE(card->info.pnso_mode, in qeth_l2_dev2br_worker()
1423 qeth_l2_dev2br_fdb_flush(card); in qeth_l2_dev2br_worker()
1428 CARD_DEVID(card)); in qeth_l2_dev2br_worker()
1436 qeth_l2_dev2br_fdb_notify(card, in qeth_l2_dev2br_worker()
1451 struct qeth_card *card; in qeth_addr_change_event_worker() local
1455 card = data->card; in qeth_addr_change_event_worker()
1457 QETH_CARD_TEXT(data->card, 4, "adrchgew"); in qeth_addr_change_event_worker()
1459 if (READ_ONCE(card->info.pnso_mode) == QETH_PNSO_NONE) in qeth_addr_change_event_worker()
1464 if (!mutex_trylock(&card->sbp_lock)) { in qeth_addr_change_event_worker()
1465 queue_delayed_work(card->event_wq, dwork, in qeth_addr_change_event_worker()
1470 dev_info(&data->card->gdev->dev, in qeth_addr_change_event_worker()
1472 netdev_name(card->dev), in qeth_addr_change_event_worker()
1479 data->card->options.sbp.hostnotification = 0; in qeth_addr_change_event_worker()
1480 card->info.pnso_mode = QETH_PNSO_NONE; in qeth_addr_change_event_worker()
1481 mutex_unlock(&data->card->sbp_lock); in qeth_addr_change_event_worker()
1482 qeth_bridge_emit_host_event(data->card, anev_abort, in qeth_addr_change_event_worker()
1488 qeth_bridge_emit_host_event(data->card, in qeth_addr_change_event_worker()
1499 static void qeth_addr_change_event(struct qeth_card *card, in qeth_addr_change_event() argument
1507 if (card->info.pnso_mode == QETH_PNSO_NONE) in qeth_addr_change_event()
1510 QETH_CARD_TEXT(card, 4, "adrchgev"); in qeth_addr_change_event()
1516 QETH_CARD_TEXT_(card, 2, "ACHN%04x", in qeth_addr_change_event()
1526 QETH_CARD_TEXT(card, 2, "ACNalloc"); in qeth_addr_change_event()
1529 if (card->info.pnso_mode == QETH_PNSO_BRIDGEPORT) in qeth_addr_change_event()
1533 data->card = card; in qeth_addr_change_event()
1536 queue_delayed_work(card->event_wq, &data->dwork, 0); in qeth_addr_change_event()
1551 static int qeth_bridgeport_makerc(struct qeth_card *card, in qeth_bridgeport_makerc() argument
1563 if ((IS_IQD(card) && ipa_rc == IPA_RC_SUCCESS) || in qeth_bridgeport_makerc()
1564 (!IS_IQD(card) && ipa_rc == sbp_rc)) { in qeth_bridgeport_makerc()
1576 dev_err(&card->gdev->dev, in qeth_bridgeport_makerc()
1582 dev_err(&card->gdev->dev, in qeth_bridgeport_makerc()
1590 dev_err(&card->gdev->dev, in qeth_bridgeport_makerc()
1595 dev_err(&card->gdev->dev, in qeth_bridgeport_makerc()
1605 dev_err(&card->gdev->dev, in qeth_bridgeport_makerc()
1611 dev_err(&card->gdev->dev, in qeth_bridgeport_makerc()
1617 dev_err(&card->gdev->dev, in qeth_bridgeport_makerc()
1623 dev_err(&card->gdev->dev, in qeth_bridgeport_makerc()
1643 QETH_CARD_TEXT_(card, 2, "SBPi%04x", ipa_rc); in qeth_bridgeport_makerc()
1644 QETH_CARD_TEXT_(card, 2, "SBPc%04x", sbp_rc); in qeth_bridgeport_makerc()
1649 static struct qeth_cmd_buffer *qeth_sbp_build_cmd(struct qeth_card *card, in qeth_sbp_build_cmd() argument
1653 enum qeth_ipa_cmds ipa_cmd = IS_IQD(card) ? IPA_CMD_SETBRIDGEPORT_IQD : in qeth_sbp_build_cmd()
1658 iob = qeth_ipa_alloc_cmd(card, ipa_cmd, QETH_PROT_NONE, in qeth_sbp_build_cmd()
1673 static int qeth_bridgeport_query_support_cb(struct qeth_card *card, in qeth_bridgeport_query_support_cb() argument
1680 QETH_CARD_TEXT(card, 2, "brqsupcb"); in qeth_bridgeport_query_support_cb()
1681 rc = qeth_bridgeport_makerc(card, cmd); in qeth_bridgeport_query_support_cb()
1692 * @card: qeth_card structure pointer.
1695 * strucutre: card->options.sbp.supported_funcs.
1697 static void qeth_bridgeport_query_support(struct qeth_card *card) in qeth_bridgeport_query_support() argument
1702 QETH_CARD_TEXT(card, 2, "brqsuppo"); in qeth_bridgeport_query_support()
1703 iob = qeth_sbp_build_cmd(card, IPA_SBP_QUERY_COMMANDS_SUPPORTED, in qeth_bridgeport_query_support()
1708 if (qeth_send_ipa_cmd(card, iob, qeth_bridgeport_query_support_cb, in qeth_bridgeport_query_support()
1710 card->options.sbp.role = QETH_SBP_ROLE_NONE; in qeth_bridgeport_query_support()
1711 card->options.sbp.supported_funcs = 0; in qeth_bridgeport_query_support()
1714 card->options.sbp.supported_funcs = cbctl.data.supported; in qeth_bridgeport_query_support()
1717 static int qeth_bridgeport_query_ports_cb(struct qeth_card *card, in qeth_bridgeport_query_ports_cb() argument
1725 QETH_CARD_TEXT(card, 2, "brqprtcb"); in qeth_bridgeport_query_ports_cb()
1726 rc = qeth_bridgeport_makerc(card, cmd); in qeth_bridgeport_query_ports_cb()
1732 QETH_CARD_TEXT_(card, 2, "SBPs%04x", qports->entry_length); in qeth_bridgeport_query_ports_cb()
1747 * @card: qeth_card structure pointer.
1755 int qeth_bridgeport_query_ports(struct qeth_card *card, in qeth_bridgeport_query_ports() argument
1768 QETH_CARD_TEXT(card, 2, "brqports"); in qeth_bridgeport_query_ports()
1769 if (!(card->options.sbp.supported_funcs & IPA_SBP_QUERY_BRIDGE_PORTS)) in qeth_bridgeport_query_ports()
1771 iob = qeth_sbp_build_cmd(card, IPA_SBP_QUERY_BRIDGE_PORTS, 0); in qeth_bridgeport_query_ports()
1775 return qeth_send_ipa_cmd(card, iob, qeth_bridgeport_query_ports_cb, in qeth_bridgeport_query_ports()
1779 static int qeth_bridgeport_set_cb(struct qeth_card *card, in qeth_bridgeport_set_cb() argument
1784 QETH_CARD_TEXT(card, 2, "brsetrcb"); in qeth_bridgeport_set_cb()
1785 return qeth_bridgeport_makerc(card, cmd); in qeth_bridgeport_set_cb()
1790 * @card: qeth_card structure pointer.
1795 int qeth_bridgeport_setrole(struct qeth_card *card, enum qeth_sbp_roles role) in qeth_bridgeport_setrole() argument
1801 QETH_CARD_TEXT(card, 2, "brsetrol"); in qeth_bridgeport_setrole()
1816 if (!(card->options.sbp.supported_funcs & setcmd)) in qeth_bridgeport_setrole()
1818 iob = qeth_sbp_build_cmd(card, setcmd, cmdlength); in qeth_bridgeport_setrole()
1822 return qeth_send_ipa_cmd(card, iob, qeth_bridgeport_set_cb, NULL); in qeth_bridgeport_setrole()
1828 struct qeth_card *card = (struct qeth_card *)priv; in qeth_bridgeport_an_set_cb() local
1834 qeth_bridge_emit_host_event(card, anev_reg_unreg, code, in qeth_bridgeport_an_set_cb()
1841 * @card: qeth_card structure pointer.
1849 int qeth_bridgeport_an_set(struct qeth_card *card, int enable) in qeth_bridgeport_an_set() argument
1853 if (!card->options.sbp.supported_funcs) in qeth_bridgeport_an_set()
1857 qeth_bridge_emit_host_event(card, anev_reset, 0, NULL, NULL); in qeth_bridgeport_an_set()
1858 qeth_l2_set_pnso_mode(card, QETH_PNSO_BRIDGEPORT); in qeth_bridgeport_an_set()
1859 rc = qeth_l2_pnso(card, PNSO_OC_NET_BRIDGE_INFO, 1, in qeth_bridgeport_an_set()
1860 qeth_bridgeport_an_set_cb, card); in qeth_bridgeport_an_set()
1862 qeth_l2_set_pnso_mode(card, QETH_PNSO_NONE); in qeth_bridgeport_an_set()
1864 rc = qeth_l2_pnso(card, PNSO_OC_NET_BRIDGE_INFO, 0, NULL, NULL); in qeth_bridgeport_an_set()
1865 qeth_l2_set_pnso_mode(card, QETH_PNSO_NONE); in qeth_bridgeport_an_set()
1873 static int qeth_l2_vnicc_makerc(struct qeth_card *card, u16 ipa_rc) in qeth_l2_vnicc_makerc() argument
1900 QETH_CARD_TEXT_(card, 2, "err%04x", ipa_rc); in qeth_l2_vnicc_makerc()
1905 static int qeth_l2_vnicc_request_cb(struct qeth_card *card, in qeth_l2_vnicc_request_cb() argument
1913 QETH_CARD_TEXT(card, 2, "vniccrcb"); in qeth_l2_vnicc_request_cb()
1915 return qeth_l2_vnicc_makerc(card, cmd->hdr.return_code); in qeth_l2_vnicc_request_cb()
1917 card->options.vnicc.sup_chars = rep->vnicc_cmds.supported; in qeth_l2_vnicc_request_cb()
1918 card->options.vnicc.cur_chars = rep->vnicc_cmds.enabled; in qeth_l2_vnicc_request_cb()
1928 static struct qeth_cmd_buffer *qeth_l2_vnicc_build_cmd(struct qeth_card *card, in qeth_l2_vnicc_build_cmd() argument
1935 iob = qeth_ipa_alloc_cmd(card, IPA_CMD_VNICC, QETH_PROT_NONE, in qeth_l2_vnicc_build_cmd()
1948 static int qeth_l2_vnicc_query_chars(struct qeth_card *card) in qeth_l2_vnicc_query_chars() argument
1952 QETH_CARD_TEXT(card, 2, "vniccqch"); in qeth_l2_vnicc_query_chars()
1953 iob = qeth_l2_vnicc_build_cmd(card, IPA_VNICC_QUERY_CHARS, 0); in qeth_l2_vnicc_query_chars()
1957 return qeth_send_ipa_cmd(card, iob, qeth_l2_vnicc_request_cb, NULL); in qeth_l2_vnicc_query_chars()
1961 static int qeth_l2_vnicc_query_cmds(struct qeth_card *card, u32 vnic_char, in qeth_l2_vnicc_query_cmds() argument
1966 QETH_CARD_TEXT(card, 2, "vniccqcm"); in qeth_l2_vnicc_query_cmds()
1967 iob = qeth_l2_vnicc_build_cmd(card, IPA_VNICC_QUERY_CMDS, in qeth_l2_vnicc_query_cmds()
1974 return qeth_send_ipa_cmd(card, iob, qeth_l2_vnicc_request_cb, sup_cmds); in qeth_l2_vnicc_query_cmds()
1978 static int qeth_l2_vnicc_set_char(struct qeth_card *card, u32 vnic_char, in qeth_l2_vnicc_set_char() argument
1983 QETH_CARD_TEXT(card, 2, "vniccedc"); in qeth_l2_vnicc_set_char()
1984 iob = qeth_l2_vnicc_build_cmd(card, cmd, VNICC_DATA_SIZEOF(set_char)); in qeth_l2_vnicc_set_char()
1990 return qeth_send_ipa_cmd(card, iob, qeth_l2_vnicc_request_cb, NULL); in qeth_l2_vnicc_set_char()
1994 static int qeth_l2_vnicc_getset_timeout(struct qeth_card *card, u32 vnicc, in qeth_l2_vnicc_getset_timeout() argument
2000 QETH_CARD_TEXT(card, 2, "vniccgst"); in qeth_l2_vnicc_getset_timeout()
2001 iob = qeth_l2_vnicc_build_cmd(card, cmd, in qeth_l2_vnicc_getset_timeout()
2012 return qeth_send_ipa_cmd(card, iob, qeth_l2_vnicc_request_cb, timeout); in qeth_l2_vnicc_getset_timeout()
2016 static bool qeth_l2_vnicc_recover_timeout(struct qeth_card *card, u32 vnicc, in qeth_l2_vnicc_recover_timeout() argument
2019 if (card->options.vnicc.sup_chars & vnicc && in qeth_l2_vnicc_recover_timeout()
2020 card->options.vnicc.getset_timeout_sup & vnicc && in qeth_l2_vnicc_recover_timeout()
2021 !qeth_l2_vnicc_getset_timeout(card, vnicc, IPA_VNICC_SET_TIMEOUT, in qeth_l2_vnicc_recover_timeout()
2029 int qeth_l2_vnicc_set_state(struct qeth_card *card, u32 vnicc, bool state) in qeth_l2_vnicc_set_state() argument
2034 QETH_CARD_TEXT(card, 2, "vniccsch"); in qeth_l2_vnicc_set_state()
2037 if (!(card->options.vnicc.sup_chars & vnicc) || in qeth_l2_vnicc_set_state()
2038 !(card->options.vnicc.set_char_sup & vnicc)) in qeth_l2_vnicc_set_state()
2041 if (qeth_bridgeport_is_in_use(card)) in qeth_l2_vnicc_set_state()
2047 card->options.vnicc.wanted_chars |= vnicc; in qeth_l2_vnicc_set_state()
2050 card->options.vnicc.wanted_chars &= ~vnicc; in qeth_l2_vnicc_set_state()
2054 if (card->options.vnicc.cur_chars == card->options.vnicc.wanted_chars) in qeth_l2_vnicc_set_state()
2057 /* if card is not ready, simply stop here */ in qeth_l2_vnicc_set_state()
2058 if (!qeth_card_hw_is_reachable(card)) { in qeth_l2_vnicc_set_state()
2060 card->options.vnicc.cur_chars |= vnicc; in qeth_l2_vnicc_set_state()
2062 card->options.vnicc.cur_chars &= ~vnicc; in qeth_l2_vnicc_set_state()
2066 rc = qeth_l2_vnicc_set_char(card, vnicc, cmd); in qeth_l2_vnicc_set_state()
2068 card->options.vnicc.wanted_chars = in qeth_l2_vnicc_set_state()
2069 card->options.vnicc.cur_chars; in qeth_l2_vnicc_set_state()
2073 card->options.vnicc.rx_bcast_enabled = true; in qeth_l2_vnicc_set_state()
2075 qeth_l2_vnicc_recover_timeout(card, vnicc, in qeth_l2_vnicc_set_state()
2076 &card->options.vnicc.learning_timeout); in qeth_l2_vnicc_set_state()
2083 int qeth_l2_vnicc_get_state(struct qeth_card *card, u32 vnicc, bool *state) in qeth_l2_vnicc_get_state() argument
2087 QETH_CARD_TEXT(card, 2, "vniccgch"); in qeth_l2_vnicc_get_state()
2090 if (!(card->options.vnicc.sup_chars & vnicc)) in qeth_l2_vnicc_get_state()
2093 if (qeth_bridgeport_is_in_use(card)) in qeth_l2_vnicc_get_state()
2096 /* if card is ready, query current VNICC state */ in qeth_l2_vnicc_get_state()
2097 if (qeth_card_hw_is_reachable(card)) in qeth_l2_vnicc_get_state()
2098 rc = qeth_l2_vnicc_query_chars(card); in qeth_l2_vnicc_get_state()
2100 *state = (card->options.vnicc.cur_chars & vnicc) ? true : false; in qeth_l2_vnicc_get_state()
2107 int qeth_l2_vnicc_set_timeout(struct qeth_card *card, u32 timeout) in qeth_l2_vnicc_set_timeout() argument
2111 QETH_CARD_TEXT(card, 2, "vniccsto"); in qeth_l2_vnicc_set_timeout()
2114 if (!(card->options.vnicc.sup_chars & QETH_VNICC_LEARNING) || in qeth_l2_vnicc_set_timeout()
2115 !(card->options.vnicc.getset_timeout_sup & QETH_VNICC_LEARNING)) in qeth_l2_vnicc_set_timeout()
2118 if (qeth_bridgeport_is_in_use(card)) in qeth_l2_vnicc_set_timeout()
2122 if (card->options.vnicc.learning_timeout == timeout) in qeth_l2_vnicc_set_timeout()
2125 /* if card is not ready, simply store the value internally and return */ in qeth_l2_vnicc_set_timeout()
2126 if (!qeth_card_hw_is_reachable(card)) { in qeth_l2_vnicc_set_timeout()
2127 card->options.vnicc.learning_timeout = timeout; in qeth_l2_vnicc_set_timeout()
2131 /* send timeout value to card; if successful, store value internally */ in qeth_l2_vnicc_set_timeout()
2132 rc = qeth_l2_vnicc_getset_timeout(card, QETH_VNICC_LEARNING, in qeth_l2_vnicc_set_timeout()
2135 card->options.vnicc.learning_timeout = timeout; in qeth_l2_vnicc_set_timeout()
2143 int qeth_l2_vnicc_get_timeout(struct qeth_card *card, u32 *timeout) in qeth_l2_vnicc_get_timeout() argument
2147 QETH_CARD_TEXT(card, 2, "vniccgto"); in qeth_l2_vnicc_get_timeout()
2150 if (!(card->options.vnicc.sup_chars & QETH_VNICC_LEARNING) || in qeth_l2_vnicc_get_timeout()
2151 !(card->options.vnicc.getset_timeout_sup & QETH_VNICC_LEARNING)) in qeth_l2_vnicc_get_timeout()
2154 if (qeth_bridgeport_is_in_use(card)) in qeth_l2_vnicc_get_timeout()
2157 /* if card is ready, get timeout. Otherwise, just return stored value */ in qeth_l2_vnicc_get_timeout()
2158 *timeout = card->options.vnicc.learning_timeout; in qeth_l2_vnicc_get_timeout()
2159 if (qeth_card_hw_is_reachable(card)) in qeth_l2_vnicc_get_timeout()
2160 rc = qeth_l2_vnicc_getset_timeout(card, QETH_VNICC_LEARNING, in qeth_l2_vnicc_get_timeout()
2168 static bool _qeth_l2_vnicc_is_in_use(struct qeth_card *card) in _qeth_l2_vnicc_is_in_use() argument
2170 if (!card->options.vnicc.sup_chars) in _qeth_l2_vnicc_is_in_use()
2173 * or the card is offline. in _qeth_l2_vnicc_is_in_use()
2175 if (card->options.vnicc.cur_chars == QETH_VNICC_DEFAULT) { in _qeth_l2_vnicc_is_in_use()
2176 if (!card->options.vnicc.rx_bcast_enabled || in _qeth_l2_vnicc_is_in_use()
2177 !qeth_card_hw_is_reachable(card)) in _qeth_l2_vnicc_is_in_use()
2185 * @card: qeth_card structure pointer
2190 bool qeth_bridgeport_allowed(struct qeth_card *card) in qeth_bridgeport_allowed() argument
2192 struct qeth_priv *priv = netdev_priv(card->dev); in qeth_bridgeport_allowed()
2194 return (!_qeth_l2_vnicc_is_in_use(card) && in qeth_bridgeport_allowed()
2199 static bool qeth_l2_vnicc_recover_char(struct qeth_card *card, u32 vnicc, in qeth_l2_vnicc_recover_char() argument
2204 if (card->options.vnicc.sup_chars & vnicc && in qeth_l2_vnicc_recover_char()
2205 card->options.vnicc.set_char_sup & vnicc && in qeth_l2_vnicc_recover_char()
2206 !qeth_l2_vnicc_set_char(card, vnicc, cmd)) in qeth_l2_vnicc_recover_char()
2208 card->options.vnicc.wanted_chars &= ~vnicc; in qeth_l2_vnicc_recover_char()
2209 card->options.vnicc.wanted_chars |= QETH_VNICC_DEFAULT & vnicc; in qeth_l2_vnicc_recover_char()
2214 static void qeth_l2_vnicc_init(struct qeth_card *card) in qeth_l2_vnicc_init() argument
2216 u32 *timeout = &card->options.vnicc.learning_timeout; in qeth_l2_vnicc_init()
2222 QETH_CARD_TEXT(card, 2, "vniccini"); in qeth_l2_vnicc_init()
2224 card->options.vnicc.rx_bcast_enabled = 0; in qeth_l2_vnicc_init()
2226 if (qeth_l2_vnicc_query_chars(card)) { in qeth_l2_vnicc_init()
2227 if (card->options.vnicc.wanted_chars != QETH_VNICC_DEFAULT || in qeth_l2_vnicc_init()
2229 dev_err(&card->gdev->dev, "Configuring the VNIC characteristics failed\n"); in qeth_l2_vnicc_init()
2231 card->options.vnicc.sup_chars = 0; in qeth_l2_vnicc_init()
2232 card->options.vnicc.cur_chars = 0; in qeth_l2_vnicc_init()
2233 card->options.vnicc.wanted_chars = QETH_VNICC_DEFAULT; in qeth_l2_vnicc_init()
2237 chars_tmp = card->options.vnicc.sup_chars; in qeth_l2_vnicc_init()
2238 chars_len = sizeof(card->options.vnicc.sup_chars) * BITS_PER_BYTE; in qeth_l2_vnicc_init()
2241 if (qeth_l2_vnicc_query_cmds(card, vnicc, &sup_cmds)) { in qeth_l2_vnicc_init()
2247 card->options.vnicc.getset_timeout_sup |= vnicc; in qeth_l2_vnicc_init()
2249 card->options.vnicc.getset_timeout_sup &= ~vnicc; in qeth_l2_vnicc_init()
2252 card->options.vnicc.set_char_sup |= vnicc; in qeth_l2_vnicc_init()
2254 card->options.vnicc.set_char_sup &= ~vnicc; in qeth_l2_vnicc_init()
2257 error |= qeth_l2_vnicc_recover_timeout(card, QETH_VNICC_LEARNING, in qeth_l2_vnicc_init()
2260 chars_tmp = card->options.vnicc.wanted_chars ^ in qeth_l2_vnicc_init()
2261 card->options.vnicc.cur_chars; in qeth_l2_vnicc_init()
2262 chars_len = sizeof(card->options.vnicc.wanted_chars) * BITS_PER_BYTE; in qeth_l2_vnicc_init()
2265 enable = card->options.vnicc.wanted_chars & vnicc; in qeth_l2_vnicc_init()
2266 error |= qeth_l2_vnicc_recover_char(card, vnicc, enable); in qeth_l2_vnicc_init()
2269 dev_err(&card->gdev->dev, "Configuring the VNIC characteristics failed\n"); in qeth_l2_vnicc_init()
2273 static void qeth_l2_vnicc_set_defaults(struct qeth_card *card) in qeth_l2_vnicc_set_defaults() argument
2276 card->options.vnicc.sup_chars = QETH_VNICC_ALL; in qeth_l2_vnicc_set_defaults()
2277 card->options.vnicc.cur_chars = QETH_VNICC_DEFAULT; in qeth_l2_vnicc_set_defaults()
2278 card->options.vnicc.learning_timeout = QETH_VNICC_DEFAULT_TIMEOUT; in qeth_l2_vnicc_set_defaults()
2280 card->options.vnicc.set_char_sup = QETH_VNICC_ALL; in qeth_l2_vnicc_set_defaults()
2281 card->options.vnicc.getset_timeout_sup = QETH_VNICC_LEARNING; in qeth_l2_vnicc_set_defaults()
2283 card->options.vnicc.wanted_chars = QETH_VNICC_DEFAULT; in qeth_l2_vnicc_set_defaults()
2293 struct qeth_card *card = dev_get_drvdata(&gdev->dev); in qeth_l2_probe_device() local
2296 qeth_l2_vnicc_set_defaults(card); in qeth_l2_probe_device()
2297 mutex_init(&card->sbp_lock); in qeth_l2_probe_device()
2307 INIT_WORK(&card->rx_mode_work, qeth_l2_rx_mode_work); in qeth_l2_probe_device()
2313 struct qeth_card *card = dev_get_drvdata(&gdev->dev); in qeth_l2_remove_device() local
2319 qeth_set_allowed_threads(card, 0, 1); in qeth_l2_remove_device()
2320 wait_event(card->wait_q, qeth_threads_running(card, 0xffffffff) == 0); in qeth_l2_remove_device()
2323 qeth_set_offline(card, card->discipline, false); in qeth_l2_remove_device()
2325 if (card->dev->reg_state == NETREG_REGISTERED) { in qeth_l2_remove_device()
2326 priv = netdev_priv(card->dev); in qeth_l2_remove_device()
2332 unregister_netdev(card->dev); in qeth_l2_remove_device()
2336 static int qeth_l2_set_online(struct qeth_card *card, bool carrier_ok) in qeth_l2_set_online() argument
2338 struct net_device *dev = card->dev; in qeth_l2_set_online()
2341 qeth_l2_detect_dev2br_support(card); in qeth_l2_set_online()
2343 mutex_lock(&card->sbp_lock); in qeth_l2_set_online()
2344 qeth_bridgeport_query_support(card); in qeth_l2_set_online()
2345 if (card->options.sbp.supported_funcs) { in qeth_l2_set_online()
2346 qeth_l2_setup_bridgeport_attrs(card); in qeth_l2_set_online()
2347 dev_info(&card->gdev->dev, in qeth_l2_set_online()
2350 mutex_unlock(&card->sbp_lock); in qeth_l2_set_online()
2352 qeth_l2_register_dev_addr(card); in qeth_l2_set_online()
2355 qeth_l2_vnicc_init(card); in qeth_l2_set_online()
2357 qeth_l2_trace_features(card); in qeth_l2_set_online()
2360 QETH_CARD_TEXT(card, 2, "softsetp"); in qeth_l2_set_online()
2362 card->state = CARD_STATE_SOFTSETUP; in qeth_l2_set_online()
2364 qeth_set_allowed_threads(card, 0xffffffff, 0); in qeth_l2_set_online()
2367 rc = qeth_l2_setup_netdev(card); in qeth_l2_set_online()
2375 rc = qeth_set_real_num_tx_queues(card, in qeth_l2_set_online()
2376 qeth_tx_actual_queues(card)); in qeth_l2_set_online()
2389 qeth_l2_enable_brport_features(card); in qeth_l2_set_online()
2393 napi_schedule(&card->napi); in qeth_l2_set_online()
2404 qeth_set_allowed_threads(card, 0, 1); in qeth_l2_set_online()
2405 card->state = CARD_STATE_DOWN; in qeth_l2_set_online()
2409 static void qeth_l2_set_offline(struct qeth_card *card) in qeth_l2_set_offline() argument
2411 struct qeth_priv *priv = netdev_priv(card->dev); in qeth_l2_set_offline()
2413 qeth_set_allowed_threads(card, 0, 1); in qeth_l2_set_offline()
2414 qeth_l2_drain_rx_mode_cache(card); in qeth_l2_set_offline()
2416 if (card->state == CARD_STATE_SOFTSETUP) in qeth_l2_set_offline()
2417 card->state = CARD_STATE_DOWN; in qeth_l2_set_offline()
2419 qeth_l2_set_pnso_mode(card, QETH_PNSO_NONE); in qeth_l2_set_offline()
2421 qeth_l2_dev2br_fdb_flush(card); in qeth_l2_set_offline()
2425 static int qeth_l2_control_event(struct qeth_card *card, in qeth_l2_control_event() argument
2433 qeth_bridge_state_change(card, cmd); in qeth_l2_control_event()
2439 qeth_addr_change_event(card, cmd); in qeth_l2_control_event()