Esempio n. 1
0
static int qtnf_change_beacon(struct wiphy *wiphy, struct net_device *dev,
			      struct cfg80211_beacon_data *info)
{
	struct qtnf_vif *vif = qtnf_netdev_get_priv(dev);

	return qtnf_mgmt_set_appie(vif, info);
}
Esempio n. 2
0
static int qtnf_change_beacon(struct wiphy *wiphy, struct net_device *dev,
			      struct cfg80211_beacon_data *info)
{
	struct qtnf_vif *vif = qtnf_netdev_get_priv(dev);

	if (!(vif->bss_status & QTNF_STATE_AP_START)) {
		pr_err("VIF%u.%u: not started\n", vif->mac->macid, vif->vifid);
		return -EFAULT;
	}

	return qtnf_mgmt_set_appie(vif, info);
}
Esempio n. 3
0
static int qtnf_start_ap(struct wiphy *wiphy, struct net_device *dev,
			 struct cfg80211_ap_settings *settings)
{
	struct qtnf_vif *vif = qtnf_netdev_get_priv(dev);
	struct qtnf_wmac *mac = wiphy_priv(wiphy);
	struct qtnf_bss_config *bss_cfg;
	int ret;

	if (!cfg80211_chandef_identical(&mac->chandef, &settings->chandef)) {
		memcpy(&mac->chandef, &settings->chandef, sizeof(mac->chandef));
		if (vif->vifid != 0)
			pr_warn("%s: unexpected chan %u (%u MHz)\n", dev->name,
				settings->chandef.chan->hw_value,
				settings->chandef.chan->center_freq);
	}

	bss_cfg = &vif->bss_cfg;
	memset(bss_cfg, 0, sizeof(*bss_cfg));

	bss_cfg->bcn_period = settings->beacon_interval;
	bss_cfg->dtim = settings->dtim_period;
	bss_cfg->auth_type = settings->auth_type;
	bss_cfg->privacy = settings->privacy;

	bss_cfg->ssid_len = settings->ssid_len;
	memcpy(&bss_cfg->ssid, settings->ssid, bss_cfg->ssid_len);

	memcpy(&bss_cfg->crypto, &settings->crypto,
	       sizeof(struct cfg80211_crypto_settings));

	ret = qtnf_cmd_send_config_ap(vif);
	if (ret) {
		pr_err("VIF%u.%u: failed to push config to FW\n",
		       vif->mac->macid, vif->vifid);
		goto out;
	}

	if (!(vif->bss_status & QTNF_STATE_AP_CONFIG)) {
		pr_err("VIF%u.%u: AP config failed in FW\n", vif->mac->macid,
		       vif->vifid);
		ret = -EFAULT;
		goto out;
	}

	ret = qtnf_mgmt_set_appie(vif, &settings->beacon);
	if (ret) {
		pr_err("VIF%u.%u: failed to add IEs to beacon\n",
		       vif->mac->macid, vif->vifid);
		goto out;
	}

	ret = qtnf_cmd_send_start_ap(vif);
	if (ret) {
		pr_err("VIF%u.%u: failed to start AP\n", vif->mac->macid,
		       vif->vifid);
		goto out;
	}

	if (!(vif->bss_status & QTNF_STATE_AP_START)) {
		pr_err("VIF%u.%u: FW failed to start AP operation\n",
		       vif->mac->macid, vif->vifid);
		ret = -EFAULT;
	}

out:
	return ret;
}