Lines Matching +full:spurious +full:- +full:oc

1 // SPDX-License-Identifier: GPL-2.0
42 rc = -EOPNOTSUPP; in qeth_l2_setdelmac_makerc()
45 rc = -ENOSPC; in qeth_l2_setdelmac_makerc()
49 rc = -EADDRINUSE; in qeth_l2_setdelmac_makerc()
53 rc = -EADDRNOTAVAIL; in qeth_l2_setdelmac_makerc()
56 rc = -ENOENT; in qeth_l2_setdelmac_makerc()
59 rc = -EIO; in qeth_l2_setdelmac_makerc()
71 return qeth_l2_setdelmac_makerc(card, cmd->hdr.return_code); in qeth_l2_send_setdelmac_cb()
84 return -ENOMEM; in qeth_l2_send_setdelmac()
86 cmd->data.setdelmac.mac_length = ETH_ALEN; in qeth_l2_send_setdelmac()
87 ether_addr_copy(cmd->data.setdelmac.mac, mac); in qeth_l2_send_setdelmac()
98 dev_info(&card->gdev->dev, in qeth_l2_send_setmac()
102 case -EADDRINUSE: in qeth_l2_send_setmac()
103 dev_warn(&card->gdev->dev, in qeth_l2_send_setmac()
106 case -EADDRNOTAVAIL: in qeth_l2_send_setmac()
107 dev_warn(&card->gdev->dev, in qeth_l2_send_setmac()
123 if (rc == -EADDRINUSE) in qeth_l2_write_mac()
152 hash_for_each_safe(card->rx_mode_addrs, i, tmp, mac, hnode) { in qeth_l2_drain_rx_mode_cache()
153 hash_del(&mac->hnode); in qeth_l2_drain_rx_mode_cache()
165 hdr->hdr.l2.pkt_length = data_len; in qeth_l2_fill_header()
168 hdr->hdr.l2.id = QETH_HEADER_TYPE_L2_TSO; in qeth_l2_fill_header()
170 hdr->hdr.l2.id = QETH_HEADER_TYPE_LAYER2; in qeth_l2_fill_header()
171 if (skb->ip_summed == CHECKSUM_PARTIAL) in qeth_l2_fill_header()
172 qeth_tx_csum(skb, &hdr->hdr.l2.flags[1], proto); in qeth_l2_fill_header()
177 hdr->hdr.l2.flags[2] |= QETH_LAYER2_FLAG_MULTICAST; in qeth_l2_fill_header()
179 hdr->hdr.l2.flags[2] |= QETH_LAYER2_FLAG_BROADCAST; in qeth_l2_fill_header()
181 hdr->hdr.l2.flags[2] |= QETH_LAYER2_FLAG_UNICAST; in qeth_l2_fill_header()
186 if (veth->h_vlan_proto == htons(ETH_P_8021Q)) { in qeth_l2_fill_header()
187 hdr->hdr.l2.flags[2] |= QETH_LAYER2_FLAG_VLAN; in qeth_l2_fill_header()
188 hdr->hdr.l2.vlan_id = ntohs(veth->h_vlan_TCI); in qeth_l2_fill_header()
201 return -EINVAL; in qeth_l2_setdelvlan_makerc()
203 return -EEXIST; in qeth_l2_setdelvlan_makerc()
205 return -ENOENT; in qeth_l2_setdelvlan_makerc()
207 return -EPERM; in qeth_l2_setdelvlan_makerc()
209 return -EIO; in qeth_l2_setdelvlan_makerc()
220 if (cmd->hdr.return_code) { in qeth_l2_send_setdelvlan_cb()
222 cmd->data.setdelvlan.vlan_id, 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()
239 return -ENOMEM; in qeth_l2_send_setdelvlan()
241 cmd->data.setdelvlan.vlan_id = i; in qeth_l2_send_setdelvlan()
248 struct qeth_card *card = dev->ml_priv; in qeth_l2_vlan_rx_add_vid()
260 struct qeth_card *card = dev->ml_priv; in qeth_l2_vlan_rx_kill_vid()
273 WRITE_ONCE(card->info.pnso_mode, mode); in qeth_l2_set_pnso_mode()
277 drain_workqueue(card->event_wq); in qeth_l2_set_pnso_mode()
293 card->dev, &info.info, NULL); in qeth_l2_dev2br_fdb_flush()
323 return (rc) ? rc : -EADDRNOTAVAIL; 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()
333 if (!is_valid_ether_addr(card->dev->dev_addr)) 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()
346 if (card->info.dev_addr_is_registered) in qeth_l2_validate_addr()
350 return -EPERM; in qeth_l2_validate_addr()
356 struct qeth_card *card = dev->ml_priv; in qeth_l2_set_mac_address()
364 return -EOPNOTSUPP; in qeth_l2_set_mac_address()
366 QETH_CARD_HEX(card, 3, addr->sa_data, ETH_ALEN); in qeth_l2_set_mac_address()
367 if (!is_valid_ether_addr(addr->sa_data)) in qeth_l2_set_mac_address()
368 return -EADDRNOTAVAIL; in qeth_l2_set_mac_address()
371 if (ether_addr_equal_64bits(dev->dev_addr, addr->sa_data) && 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()
379 ether_addr_copy(old_addr, dev->dev_addr); in qeth_l2_set_mac_address()
380 eth_hw_addr_set(dev, addr->sa_data); in qeth_l2_set_mac_address()
382 if (card->info.dev_addr_is_registered) in qeth_l2_set_mac_address()
384 card->info.dev_addr_is_registered = 1; in qeth_l2_set_mac_address()
396 if (card->options.sbp.reflect_promisc_primary) 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()
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()
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()
424 mutex_unlock(&card->sbp_lock); in qeth_l2_set_promisc_mode()
434 u32 mac_hash = get_unaligned((u32 *)(&ha->addr[2])); in qeth_l2_add_mac()
437 hash_for_each_possible(card->rx_mode_addrs, mac, hnode, mac_hash) { in qeth_l2_add_mac()
438 if (ether_addr_equal_64bits(ha->addr, mac->mac_addr)) { in qeth_l2_add_mac()
439 mac->disp_flag = QETH_DISP_ADDR_DO_NOTHING; in qeth_l2_add_mac()
448 ether_addr_copy(mac->mac_addr, ha->addr); in qeth_l2_add_mac()
449 mac->disp_flag = QETH_DISP_ADDR_ADD; in qeth_l2_add_mac()
451 hash_add(card->rx_mode_addrs, &mac->hnode, mac_hash); in qeth_l2_add_mac()
458 struct net_device *dev = card->dev; 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()
475 switch (mac->disp_flag) { in qeth_l2_rx_mode_work()
477 qeth_l2_remove_mac(card, mac->mac_addr); in qeth_l2_rx_mode_work()
478 hash_del(&mac->hnode); in qeth_l2_rx_mode_work()
482 rc = qeth_l2_write_mac(card, mac->mac_addr); in qeth_l2_rx_mode_work()
484 hash_del(&mac->hnode); in qeth_l2_rx_mode_work()
491 mac->disp_flag = QETH_DISP_ADDR_DELETE; in qeth_l2_rx_mode_work()
501 struct qeth_card *card = dev->ml_priv; in qeth_l2_hard_start_xmit()
507 qdisc_skb_cb(skb)->pkt_len = skb->len; in qeth_l2_hard_start_xmit()
510 queue = card->qdio.out_qs[txq]; in qeth_l2_hard_start_xmit()
531 struct qeth_card *card = dev->ml_priv; in qeth_l2_set_rx_mode()
533 schedule_work(&card->rx_mode_work); in qeth_l2_set_rx_mode()
537 * qeth_l2_pnso() - perform network subchannel operation
539 * @oc: Operation Code
540 * @cnc: Boolean Change-Notification Control
546 * callback function for every entry in the list. If "change-notification-
550 static int qeth_l2_pnso(struct qeth_card *card, u8 oc, int cnc, in qeth_l2_pnso() argument
563 return -ENOMEM; in qeth_l2_pnso()
567 rc = ccw_device_pnso(ddev, rr, oc, rr->naihdr.resume_token, in qeth_l2_pnso()
574 size = rr->naihdr.naids; in qeth_l2_pnso()
580 elems = (rr->response.length - sizeof(struct chsc_header) - in qeth_l2_pnso()
583 if (!isfirstblock && (rr->naihdr.instance != prev_instance)) { in qeth_l2_pnso()
586 rc = -EAGAIN; in qeth_l2_pnso()
590 prev_instance = rr->naihdr.instance; in qeth_l2_pnso()
592 (*cb)(priv, &rr->entries[i]); in qeth_l2_pnso()
593 } while ((rc == -EBUSY) || (!rc && /* list stored */ in qeth_l2_pnso()
594 /* resume token is non-zero => list incomplete */ in qeth_l2_pnso()
595 (rr->naihdr.resume_token.t1 || rr->naihdr.resume_token.t2))); in qeth_l2_pnso()
598 QETH_CARD_TEXT_(card, 2, "PNrp%04x", rr->response.code); in qeth_l2_pnso()
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()
616 * qeth_l2_dev2br_fdb_notify() - update fdb of master bridge
619 * 1 - removal of an object
620 * 0 - addition of an object
622 * 0x01 - VLAN, 0x02 - MAC, 0x03 - VLAN and MAC
634 ether_addr_copy(ntfy_mac, addr_lnid->mac); in qeth_l2_dev2br_fdb_notify()
653 card->dev, &info.info, NULL); in qeth_l2_dev2br_fdb_notify()
659 card->dev, &info.info, NULL); in qeth_l2_dev2br_fdb_notify()
672 if (entry->addr_lnid.lnid < VLAN_N_VID) in qeth_l2_dev2br_an_set_cb()
675 (struct net_if_token *)&entry->nit, in qeth_l2_dev2br_an_set_cb()
676 (struct mac_addr_lnid *)&entry->addr_lnid); in qeth_l2_dev2br_an_set_cb()
680 * qeth_l2_dev2br_an_set() -
685 * Returns negative errno-compatible error indication or 0 on success.
698 if (rc == -EAGAIN) in qeth_l2_dev2br_an_set()
700 * addresses reported -> disable address notification in qeth_l2_dev2br_an_set()
731 (priv->brport_features & BR_LEARNING_SYNC) && in qeth_l2_must_learn()
734 (netdev->netdev_ops == &qeth_l2_iqd_netdev_ops || in qeth_l2_must_learn()
735 netdev->netdev_ops == &qeth_l2_osa_netdev_ops)); in qeth_l2_must_learn()
739 * qeth_l2_br2dev_worker() - update local MACs
751 struct net_device *lsyncdev = br2dev_event_work->lsync_dev; in qeth_l2_br2dev_worker()
752 struct net_device *dstdev = br2dev_event_work->dst_dev; in qeth_l2_br2dev_worker()
753 struct net_device *brdev = br2dev_event_work->br_dev; in qeth_l2_br2dev_worker()
754 unsigned long event = br2dev_event_work->event; in qeth_l2_br2dev_worker()
755 unsigned char *addr = br2dev_event_work->addr; in qeth_l2_br2dev_worker()
756 struct qeth_card *card = lsyncdev->ml_priv; in qeth_l2_br2dev_worker()
774 iter = &brdev->adj_list.lower; in qeth_l2_br2dev_worker()
792 lowerdev->ifindex); in qeth_l2_br2dev_worker()
831 return -ENOMEM; in qeth_l2_br2dev_queue_work()
832 INIT_WORK(&worker_data->work, qeth_l2_br2dev_worker); in qeth_l2_br2dev_queue_work()
833 worker_data->br_dev = brdev; in qeth_l2_br2dev_queue_work()
834 worker_data->lsync_dev = lsyncdev; in qeth_l2_br2dev_queue_work()
835 worker_data->dst_dev = dstdev; in qeth_l2_br2dev_queue_work()
836 worker_data->event = event; in qeth_l2_br2dev_queue_work()
837 ether_addr_copy(worker_data->addr, addr); in qeth_l2_br2dev_queue_work()
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()
870 iter = &brdev->adj_list.lower; in qeth_l2_switchdev_event()
874 card = lowerdev->ml_priv; in qeth_l2_switchdev_event()
878 fdb_info->addr); in qeth_l2_switchdev_event()
931 QETH_DBF_TEXT_(SETUP, 2, "b2d-%04d", in qeth_l2_br2dev_put()
940 struct qeth_card *card = dev->ml_priv; in qeth_l2_bridge_getlink()
944 if (!priv->brport_hw_features || !netif_device_present(dev) || in qeth_l2_bridge_getlink()
946 return -EOPNOTSUPP; in qeth_l2_bridge_getlink()
949 mode, priv->brport_features, in qeth_l2_bridge_getlink()
950 priv->brport_hw_features, in qeth_l2_bridge_getlink()
959 * qeth_l2_bridge_setlink() - set bridgeport attributes
972 struct qeth_card *card = dev->ml_priv; in qeth_l2_bridge_setlink()
979 return -ENODEV; in qeth_l2_bridge_setlink()
994 return -EINVAL; in qeth_l2_bridge_setlink()
998 return -EINVAL; in qeth_l2_bridge_setlink()
1004 return -EINVAL; in qeth_l2_bridge_setlink()
1005 if (!(priv->brport_hw_features & BR_LEARNING_SYNC)) { in qeth_l2_bridge_setlink()
1008 return -EOPNOTSUPP; in qeth_l2_bridge_setlink()
1013 return -EOPNOTSUPP; in qeth_l2_bridge_setlink()
1017 if (enable == !!(priv->brport_features & BR_LEARNING_SYNC)) in qeth_l2_bridge_setlink()
1020 mutex_lock(&card->sbp_lock); in qeth_l2_bridge_setlink()
1024 rc = -EBUSY; in qeth_l2_bridge_setlink()
1031 priv->brport_features |= BR_LEARNING_SYNC; in qeth_l2_bridge_setlink()
1038 priv->brport_features ^= BR_LEARNING_SYNC; in qeth_l2_bridge_setlink()
1043 mutex_unlock(&card->sbp_lock); in qeth_l2_bridge_setlink()
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()
1096 card->dev->features |= NETIF_F_VLAN_CHALLENGED; 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()
1104 card->dev->features |= NETIF_F_SG; 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()
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()
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()
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()
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()
1133 PAGE_SIZE * (QDIO_MAX_ELEMENTS_PER_BUFFER - 1)); 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()
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()
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()
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()
1156 /* Conditional to avoid spurious error messages */ 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()
1164 card->options.sbp.hostnotification = 0; in qeth_l2_setup_bridgeport_attrs()
1169 * qeth_l2_detect_dev2br_support() -
1177 struct qeth_priv *priv = netdev_priv(card->dev); in qeth_l2_detect_dev2br_support()
1185 dev2br_supported = card->info.ids_valid && in qeth_l2_detect_dev2br_support()
1190 priv->brport_hw_features |= BR_LEARNING_SYNC; in qeth_l2_detect_dev2br_support()
1192 priv->brport_hw_features &= ~BR_LEARNING_SYNC; in qeth_l2_detect_dev2br_support()
1197 struct qeth_priv *priv = netdev_priv(card->dev); in qeth_l2_enable_brport_features()
1200 if (priv->brport_features & BR_LEARNING_SYNC) { in qeth_l2_enable_brport_features()
1201 if (priv->brport_hw_features & BR_LEARNING_SYNC) { in qeth_l2_enable_brport_features()
1204 if (rc == -EAGAIN) { in qeth_l2_enable_brport_features()
1212 netdev_err(card->dev, in qeth_l2_enable_brport_features()
1217 priv->brport_features ^= BR_LEARNING_SYNC; in qeth_l2_enable_brport_features()
1220 dev_warn(&card->gdev->dev, in qeth_l2_enable_brport_features()
1222 priv->brport_features ^= BR_LEARNING_SYNC; in qeth_l2_enable_brport_features()
1232 * qeth_bridge_emit_host_event() - bridgeport address change notification
1237 * object, 0 - addition of an object.
1238 * 0x01 - VLAN, 0x02 - MAC, 0x03 - VLAN and MAC.
1243 * reported by the hardware, and also when notifications are enabled -
1264 addr_lnid->lnid); in qeth_bridge_emit_host_event()
1269 addr_lnid->mac); in qeth_bridge_emit_host_event()
1273 token->cssid, token->ssid, token->devnum); in qeth_bridge_emit_host_event()
1275 scnprintf(str[i], sizeof(str[i]), "NTOK_IID=%02x", token->iid); in qeth_bridge_emit_host_event()
1278 token->chpid); in qeth_bridge_emit_host_event()
1281 token->chid); in qeth_bridge_emit_host_event()
1294 kobject_uevent_env(&card->gdev->dev.kobj, KOBJ_CHANGE, env); in qeth_bridge_emit_host_event()
1320 (data->role == QETH_SBP_ROLE_NONE) ? "none" : in qeth_bridge_state_change_worker()
1321 (data->role == QETH_SBP_ROLE_PRIMARY) ? "primary" : in qeth_bridge_state_change_worker()
1322 (data->role == QETH_SBP_ROLE_SECONDARY) ? "secondary" : in qeth_bridge_state_change_worker()
1325 (data->state == QETH_SBP_STATE_INACTIVE) ? "inactive" : in qeth_bridge_state_change_worker()
1326 (data->state == QETH_SBP_STATE_STANDBY) ? "standby" : in qeth_bridge_state_change_worker()
1327 (data->state == QETH_SBP_STATE_ACTIVE) ? "active" : in qeth_bridge_state_change_worker()
1329 kobject_uevent_env(&data->card->gdev->dev.kobj, in qeth_bridge_state_change_worker()
1337 struct qeth_sbp_port_data *qports = &cmd->data.sbp.data.port_data; in qeth_bridge_state_change()
1341 if (qports->num_entries == 0) { in qeth_bridge_state_change()
1345 if (qports->entry_length != sizeof(struct qeth_sbp_port_entry)) { in qeth_bridge_state_change()
1346 QETH_CARD_TEXT_(card, 2, "BPsz%04x", qports->entry_length); in qeth_bridge_state_change()
1355 INIT_WORK(&data->worker, qeth_bridge_state_change_worker); in qeth_bridge_state_change()
1356 data->card = card; in qeth_bridge_state_change()
1358 data->role = qports->entry[0].role; in qeth_bridge_state_change()
1359 data->state = qports->entry[0].state; in qeth_bridge_state_change()
1361 queue_work(card->event_wq, &data->worker); in qeth_bridge_state_change()
1380 card = data->card; in qeth_l2_dev2br_worker()
1381 priv = netdev_priv(card->dev); in qeth_l2_dev2br_worker()
1385 if (READ_ONCE(card->info.pnso_mode) == QETH_PNSO_NONE) in qeth_l2_dev2br_worker()
1388 if (data->ac_event.lost_event_mask) { in qeth_l2_dev2br_worker()
1389 /* Potential re-config in progress, try again later: */ 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()
1412 /* TODO: if we want to retry after -EAGAIN, be 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()
1424 priv->brport_features ^= BR_LEARNING_SYNC; in qeth_l2_dev2br_worker()
1433 for (i = 0; i < data->ac_event.num_entries; i++) { in qeth_l2_dev2br_worker()
1435 &data->ac_event.entry[i]; in qeth_l2_dev2br_worker()
1437 entry->change_code, in qeth_l2_dev2br_worker()
1438 &entry->token, in qeth_l2_dev2br_worker()
1439 &entry->addr_lnid); in qeth_l2_dev2br_worker()
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()
1462 if (data->ac_event.lost_event_mask) { in qeth_addr_change_event_worker()
1463 /* Potential re-config in progress, try again later: */ 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()
1473 (data->ac_event.lost_event_mask == 0x01) in qeth_addr_change_event_worker()
1475 : (data->ac_event.lost_event_mask == 0x02) 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()
1485 for (i = 0; i < data->ac_event.num_entries; i++) { in qeth_addr_change_event_worker()
1487 &data->ac_event.entry[i]; in qeth_addr_change_event_worker()
1488 qeth_bridge_emit_host_event(data->card, in qeth_addr_change_event_worker()
1490 entry->change_code, in qeth_addr_change_event_worker()
1491 &entry->token, in qeth_addr_change_event_worker()
1492 &entry->addr_lnid); in qeth_addr_change_event_worker()
1503 &cmd->data.addrchange; in qeth_addr_change_event()
1507 if (card->info.pnso_mode == QETH_PNSO_NONE) in qeth_addr_change_event()
1511 if (cmd->hdr.return_code != 0x0000) { in qeth_addr_change_event()
1512 if (cmd->hdr.return_code == 0x0010) { in qeth_addr_change_event()
1513 if (hostevs->lost_event_mask == 0x00) in qeth_addr_change_event()
1514 hostevs->lost_event_mask = 0xff; in qeth_addr_change_event()
1517 cmd->hdr.return_code); in qeth_addr_change_event()
1522 hostevs->num_entries; in qeth_addr_change_event()
1529 if (card->info.pnso_mode == QETH_PNSO_BRIDGEPORT) in qeth_addr_change_event()
1530 INIT_DELAYED_WORK(&data->dwork, qeth_addr_change_event_worker); in qeth_addr_change_event()
1532 INIT_DELAYED_WORK(&data->dwork, qeth_l2_dev2br_worker); in qeth_addr_change_event()
1533 data->card = card; in qeth_addr_change_event()
1534 data->ac_event = *hostevs; in qeth_addr_change_event()
1535 memcpy(data->ac_event.entry, hostevs->entry, extrasize); in qeth_addr_change_event()
1536 queue_delayed_work(card->event_wq, &data->dwork, 0); in qeth_addr_change_event()
1554 struct qeth_ipacmd_setbridgeport *sbp = &cmd->data.sbp; in qeth_bridgeport_makerc()
1555 enum qeth_ipa_sbp_cmd setcmd = sbp->hdr.command_code; in qeth_bridgeport_makerc()
1556 u16 ipa_rc = cmd->hdr.return_code; in qeth_bridgeport_makerc()
1557 u16 sbp_rc = sbp->hdr.return_code; in qeth_bridgeport_makerc()
1571 rc = -EOPNOTSUPP; in qeth_bridgeport_makerc()
1575 rc = -ENODEV; /* maybe not the best code here? */ in qeth_bridgeport_makerc()
1576 dev_err(&card->gdev->dev, in qeth_bridgeport_makerc()
1581 rc = -EPERM; in qeth_bridgeport_makerc()
1582 dev_err(&card->gdev->dev, in qeth_bridgeport_makerc()
1589 rc = -EEXIST; in qeth_bridgeport_makerc()
1590 dev_err(&card->gdev->dev, in qeth_bridgeport_makerc()
1594 rc = -EBUSY; in qeth_bridgeport_makerc()
1595 dev_err(&card->gdev->dev, in qeth_bridgeport_makerc()
1599 rc = -EIO; in qeth_bridgeport_makerc()
1604 rc = -EBUSY; in qeth_bridgeport_makerc()
1605 dev_err(&card->gdev->dev, in qeth_bridgeport_makerc()
1610 rc = -EEXIST; in qeth_bridgeport_makerc()
1611 dev_err(&card->gdev->dev, in qeth_bridgeport_makerc()
1616 rc = -EBUSY; in qeth_bridgeport_makerc()
1617 dev_err(&card->gdev->dev, in qeth_bridgeport_makerc()
1622 rc = -EACCES; in qeth_bridgeport_makerc()
1623 dev_err(&card->gdev->dev, in qeth_bridgeport_makerc()
1627 rc = -EIO; in qeth_bridgeport_makerc()
1632 rc = -EOPNOTSUPP; in qeth_bridgeport_makerc()
1635 rc = -EOPNOTSUPP; in qeth_bridgeport_makerc()
1638 rc = -EIO; in qeth_bridgeport_makerc()
1665 hdr = &__ipa_cmd(iob)->data.sbp.hdr; in qeth_sbp_build_cmd()
1666 hdr->cmdlength = sizeof(*hdr) + data_length; in qeth_sbp_build_cmd()
1667 hdr->command_code = sbp_cmd; in qeth_sbp_build_cmd()
1668 hdr->used_total = 1; in qeth_sbp_build_cmd()
1669 hdr->seq_no = 1; in qeth_sbp_build_cmd()
1677 struct _qeth_sbp_cbctl *cbctl = (struct _qeth_sbp_cbctl *)reply->param; in qeth_bridgeport_query_support_cb()
1685 cbctl->data.supported = in qeth_bridgeport_query_support_cb()
1686 cmd->data.sbp.data.query_cmds_supp.supported_cmds; in qeth_bridgeport_query_support_cb()
1691 * qeth_bridgeport_query_support() - store bitmask of supported subfunctions.
1695 * strucutre: card->options.sbp.supported_funcs.
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()
1721 struct _qeth_sbp_cbctl *cbctl = (struct _qeth_sbp_cbctl *)reply->param; in qeth_bridgeport_query_ports_cb()
1730 qports = &cmd->data.sbp.data.port_data; in qeth_bridgeport_query_ports_cb()
1731 if (qports->entry_length != sizeof(struct qeth_sbp_port_entry)) { in qeth_bridgeport_query_ports_cb()
1732 QETH_CARD_TEXT_(card, 2, "SBPs%04x", qports->entry_length); in qeth_bridgeport_query_ports_cb()
1733 return -EINVAL; in qeth_bridgeport_query_ports_cb()
1736 if (qports->num_entries > 0) { in qeth_bridgeport_query_ports_cb()
1737 if (cbctl->data.qports.role) in qeth_bridgeport_query_ports_cb()
1738 *cbctl->data.qports.role = qports->entry[0].role; in qeth_bridgeport_query_ports_cb()
1739 if (cbctl->data.qports.state) in qeth_bridgeport_query_ports_cb()
1740 *cbctl->data.qports.state = qports->entry[0].state; in qeth_bridgeport_query_ports_cb()
1746 * qeth_bridgeport_query_ports() - query local bridgeport status.
1748 * @role: Role of the port: 0-none, 1-primary, 2-secondary.
1749 * @state: State of the port: 0-inactive, 1-standby, 2-active.
1751 * Returns negative errno-compatible error indication or 0 on success.
1769 if (!(card->options.sbp.supported_funcs & IPA_SBP_QUERY_BRIDGE_PORTS)) in qeth_bridgeport_query_ports()
1770 return -EOPNOTSUPP; in qeth_bridgeport_query_ports()
1773 return -ENOMEM; in qeth_bridgeport_query_ports()
1789 * qeth_bridgeport_setrole() - Assign primary role to the port.
1793 * Returns negative errno-compatible error indication or 0 on success.
1814 return -EINVAL; in qeth_bridgeport_setrole()
1816 if (!(card->options.sbp.supported_funcs & setcmd)) in qeth_bridgeport_setrole()
1817 return -EOPNOTSUPP; in qeth_bridgeport_setrole()
1820 return -ENOMEM; in qeth_bridgeport_setrole()
1832 if (entry->addr_lnid.lnid < VLAN_N_VID) in qeth_bridgeport_an_set_cb()
1835 (struct net_if_token *)&entry->nit, in qeth_bridgeport_an_set_cb()
1836 (struct mac_addr_lnid *)&entry->addr_lnid); in qeth_bridgeport_an_set_cb()
1840 * qeth_bridgeport_an_set() - Enable or disable bridgeport address notification
1842 * @enable: 0 - disable, non-zero - enable notifications
1844 * Returns negative errno-compatible error indication or 0 on success.
1853 if (!card->options.sbp.supported_funcs) in qeth_bridgeport_an_set()
1854 return -EOPNOTSUPP; in qeth_bridgeport_an_set()
1882 rc = -EOPNOTSUPP; in qeth_l2_vnicc_makerc()
1885 rc = -EALREADY; in qeth_l2_vnicc_makerc()
1888 rc = -EBUSY; in qeth_l2_vnicc_makerc()
1891 rc = -ENOSPC; in qeth_l2_vnicc_makerc()
1894 rc = -EACCES; in qeth_l2_vnicc_makerc()
1897 rc = -EIO; in qeth_l2_vnicc_makerc()
1910 struct qeth_ipacmd_vnicc *rep = &cmd->data.vnicc; in qeth_l2_vnicc_request_cb()
1911 u32 sub_cmd = cmd->data.vnicc.hdr.sub_command; in qeth_l2_vnicc_request_cb()
1914 if (cmd->hdr.return_code) 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()
1921 *(u32 *)reply->param = rep->data.query_cmds.sup_cmds; in qeth_l2_vnicc_request_cb()
1923 *(u32 *)reply->param = rep->data.getset_timeout.timeout; in qeth_l2_vnicc_request_cb()
1941 hdr = &__ipa_cmd(iob)->data.vnicc.hdr; in qeth_l2_vnicc_build_cmd()
1942 hdr->data_length = sizeof(*hdr) + data_length; in qeth_l2_vnicc_build_cmd()
1943 hdr->sub_command = vnicc_cmd; in qeth_l2_vnicc_build_cmd()
1955 return -ENOMEM; in qeth_l2_vnicc_query_chars()
1970 return -ENOMEM; in qeth_l2_vnicc_query_cmds()
1972 __ipa_cmd(iob)->data.vnicc.data.query_cmds.vnic_char = vnic_char; in qeth_l2_vnicc_query_cmds()
1986 return -ENOMEM; in qeth_l2_vnicc_set_char()
1988 __ipa_cmd(iob)->data.vnicc.data.set_char.vnic_char = vnic_char; in qeth_l2_vnicc_set_char()
2004 return -ENOMEM; in qeth_l2_vnicc_getset_timeout()
2006 getset_timeout = &__ipa_cmd(iob)->data.vnicc.data.getset_timeout; in qeth_l2_vnicc_getset_timeout()
2007 getset_timeout->vnic_char = vnicc; in qeth_l2_vnicc_getset_timeout()
2010 getset_timeout->timeout = *timeout; in qeth_l2_vnicc_getset_timeout()
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()
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()
2039 return -EOPNOTSUPP; in qeth_l2_vnicc_set_state()
2042 return -EBUSY; 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()
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()
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()
2076 &card->options.vnicc.learning_timeout); in qeth_l2_vnicc_set_state()
2090 if (!(card->options.vnicc.sup_chars & vnicc)) in qeth_l2_vnicc_get_state()
2091 return -EOPNOTSUPP; in qeth_l2_vnicc_get_state()
2094 return -EBUSY; in qeth_l2_vnicc_get_state()
2100 *state = (card->options.vnicc.cur_chars & vnicc) ? true : false; in qeth_l2_vnicc_get_state()
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()
2116 return -EOPNOTSUPP; in qeth_l2_vnicc_set_timeout()
2119 return -EBUSY; in qeth_l2_vnicc_set_timeout()
2122 if (card->options.vnicc.learning_timeout == timeout) in qeth_l2_vnicc_set_timeout()
2127 card->options.vnicc.learning_timeout = timeout; in qeth_l2_vnicc_set_timeout()
2135 card->options.vnicc.learning_timeout = timeout; in qeth_l2_vnicc_set_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()
2152 return -EOPNOTSUPP; in qeth_l2_vnicc_get_timeout()
2155 return -EBUSY; in qeth_l2_vnicc_get_timeout()
2158 *timeout = card->options.vnicc.learning_timeout; in qeth_l2_vnicc_get_timeout()
2170 if (!card->options.vnicc.sup_chars) 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()
2184 * qeth_bridgeport_allowed - are any qeth_bridgeport functions allowed?
2192 struct qeth_priv *priv = netdev_priv(card->dev); in qeth_bridgeport_allowed()
2195 !(priv->brport_features & BR_LEARNING_SYNC)); in qeth_bridgeport_allowed()
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()
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()
2213 /* (re-)initialize VNICC */
2216 u32 *timeout = &card->options.vnicc.learning_timeout; in qeth_l2_vnicc_init()
2224 card->options.vnicc.rx_bcast_enabled = 0; 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()
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()
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()
2269 dev_err(&card->gdev->dev, "Configuring the VNIC characteristics failed\n"); in qeth_l2_vnicc_init()
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()
2297 mutex_init(&card->sbp_lock); in qeth_l2_probe_device()
2299 if (gdev->dev.type) { in qeth_l2_probe_device()
2300 rc = device_add_groups(&gdev->dev, qeth_l2_attr_groups); in qeth_l2_probe_device()
2304 gdev->dev.type = &qeth_l2_devtype; 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()
2316 if (gdev->dev.type != &qeth_l2_devtype) in qeth_l2_remove_device()
2317 device_remove_groups(&gdev->dev, qeth_l2_attr_groups); in qeth_l2_remove_device()
2320 wait_event(card->wait_q, qeth_threads_running(card, 0xffffffff) == 0); in qeth_l2_remove_device()
2322 if (gdev->state == CCWGROUP_ONLINE) 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()
2327 if (priv->brport_features & BR_LEARNING_SYNC) { in qeth_l2_remove_device()
2332 unregister_netdev(card->dev); in qeth_l2_remove_device()
2338 struct net_device *dev = card->dev; in qeth_l2_set_online()
2343 mutex_lock(&card->sbp_lock); in qeth_l2_set_online()
2345 if (card->options.sbp.supported_funcs) { 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()
2362 card->state = CARD_STATE_SOFTSETUP; in qeth_l2_set_online()
2366 if (dev->reg_state != NETREG_REGISTERED) { in qeth_l2_set_online()
2393 napi_schedule(&card->napi); in qeth_l2_set_online()
2394 /* kick-start the NAPI softirq: */ in qeth_l2_set_online()
2405 card->state = CARD_STATE_DOWN; in qeth_l2_set_online()
2411 struct qeth_priv *priv = netdev_priv(card->dev); 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()
2420 if (priv->brport_features & BR_LEARNING_SYNC) in qeth_l2_set_offline()
2428 switch (cmd->hdr.command) { in qeth_l2_control_event()
2431 if (cmd->data.sbp.hdr.command_code == in qeth_l2_control_event()