static int qtnf_disconnect(struct wiphy *wiphy, struct net_device *dev, u16 reason_code) { struct qtnf_wmac *mac = wiphy_priv(wiphy); struct qtnf_vif *vif; int ret; vif = qtnf_mac_get_base_vif(mac); if (!vif) { pr_err("MAC%u: primary VIF is not configured\n", mac->macid); return -EFAULT; } if (vif->wdev.iftype != NL80211_IFTYPE_STATION) return -EOPNOTSUPP; if (vif->sta_state == QTNF_STA_DISCONNECTED) return 0; ret = qtnf_cmd_send_disconnect(vif, reason_code); if (ret) { pr_err("VIF%u.%u: failed to disconnect\n", mac->macid, vif->vifid); return ret; } vif->sta_state = QTNF_STA_DISCONNECTED; return 0; }
static int qtnf_set_wiphy_params(struct wiphy *wiphy, u32 changed) { struct qtnf_wmac *mac = wiphy_priv(wiphy); struct qtnf_vif *vif; int ret; vif = qtnf_mac_get_base_vif(mac); if (!vif) { pr_err("MAC%u: primary VIF is not configured\n", mac->macid); return -EFAULT; } if (changed & (WIPHY_PARAM_RETRY_LONG | WIPHY_PARAM_RETRY_SHORT)) { pr_err("MAC%u: can't modify retry params\n", mac->macid); return -EOPNOTSUPP; } ret = qtnf_cmd_send_update_phy_params(mac, changed); if (ret) pr_err("MAC%u: failed to update PHY params\n", mac->macid); return ret; }
static int qtnf_core_mac_attach(struct qtnf_bus *bus, unsigned int macid) { struct qtnf_wmac *mac; struct qtnf_vif *vif; int ret; if (!(bus->hw_info.mac_bitmap & BIT(macid))) { pr_info("MAC%u is not active in FW\n", macid); return 0; } mac = qtnf_core_mac_alloc(bus, macid); if (IS_ERR(mac)) { pr_err("MAC%u allocation failed\n", macid); return PTR_ERR(mac); } ret = qtnf_cmd_get_mac_info(mac); if (ret) { pr_err("MAC%u: failed to get info\n", macid); goto error; } vif = qtnf_mac_get_base_vif(mac); if (!vif) { pr_err("MAC%u: primary VIF is not ready\n", macid); ret = -EFAULT; goto error; } ret = qtnf_cmd_send_add_intf(vif, NL80211_IFTYPE_AP, vif->mac_addr); if (ret) { pr_err("MAC%u: failed to add VIF\n", macid); goto error; } ret = qtnf_cmd_send_get_phy_params(mac); if (ret) { pr_err("MAC%u: failed to get PHY settings\n", macid); goto error; } ret = qtnf_mac_init_bands(mac); if (ret) { pr_err("MAC%u: failed to init bands\n", macid); goto error; } ret = qtnf_wiphy_register(&bus->hw_info, mac); if (ret) { pr_err("MAC%u: wiphy registration failed\n", macid); goto error; } mac->wiphy_registered = 1; rtnl_lock(); ret = qtnf_core_net_attach(mac, vif, "wlan%d", NET_NAME_ENUM, NL80211_IFTYPE_AP); rtnl_unlock(); if (ret) { pr_err("MAC%u: failed to attach netdev\n", macid); vif->wdev.iftype = NL80211_IFTYPE_UNSPECIFIED; vif->netdev = NULL; goto error; } pr_debug("MAC%u initialized\n", macid); return 0; error: qtnf_core_mac_detach(bus, macid); return ret; }