static int wil_cfg80211_change_beacon(struct wiphy *wiphy,
				      struct net_device *ndev,
				      struct cfg80211_beacon_data *bcon)
{
	struct wil6210_priv *wil = wiphy_to_wil(wiphy);
	int rc;

	wil_dbg_misc(wil, "%s()\n", __func__);

	if (wil_fix_bcon(wil, bcon)) {
		wil_dbg_misc(wil, "Fixed bcon\n");
		wil_print_bcon_data(bcon);
	}

	/* FW do not form regular beacon, so bcon IE's are not set
	 * For the DMG bcon, when it will be supported, bcon IE's will
	 * be reused; add something like:
	 * wmi_set_ie(wil, WMI_FRAME_BEACON, bcon->beacon_ies_len,
	 * bcon->beacon_ies);
	 */
	rc = wmi_set_ie(wil, WMI_FRAME_PROBE_RESP,
			bcon->proberesp_ies_len,
			bcon->proberesp_ies);
	if (rc) {
		wil_err(wil, "set_ie(PROBE_RESP) failed\n");
		return rc;
	}

	rc = wmi_set_ie(wil, WMI_FRAME_ASSOC_RESP,
			bcon->assocresp_ies_len,
			bcon->assocresp_ies);
	if (rc) {
		wil_err(wil, "set_ie(ASSOC_RESP) failed\n");
		return rc;
	}

	return 0;
}
Example #2
0
static int wil_cfg80211_start_ap(struct wiphy *wiphy,
                                 struct net_device *ndev,
                                 struct cfg80211_ap_settings *info)
{
    int rc = 0;
    struct wil6210_priv *wil = wiphy_to_wil(wiphy);
    struct wireless_dev *wdev = ndev->ieee80211_ptr;
    struct ieee80211_channel *channel = info->chandef.chan;
    struct cfg80211_beacon_data *bcon = &info->beacon;
    u8 wmi_nettype = wil_iftype_nl2wmi(wdev->iftype);

    if (!channel) {
        wil_err(wil, "AP: No channel???\n");
        return -EINVAL;
    }

    wil_dbg_misc(wil, "AP on Channel %d %d MHz, %s\n", channel->hw_value,
                 channel->center_freq, info->privacy ? "secure" : "open");
    print_hex_dump_bytes("SSID ", DUMP_PREFIX_OFFSET,
                         info->ssid, info->ssid_len);

    if (wil_fix_bcon(wil, bcon))
        wil_dbg_misc(wil, "Fixed bcon\n");

    mutex_lock(&wil->mutex);

    rc = wil_reset(wil);
    if (rc)
        goto out;

    /* Rx VRING. */
    rc = wil_rx_init(wil);
    if (rc)
        goto out;

    rc = wmi_set_ssid(wil, info->ssid_len, info->ssid);
    if (rc)
        goto out;

    /* MAC address - pre-requisite for other commands */
    wmi_set_mac_address(wil, ndev->dev_addr);

    /* IE's */
    /* bcon 'head IE's are not relevant for 60g band */
    /*
     * FW do not form regular beacon, so bcon IE's are not set
     * For the DMG bcon, when it will be supported, bcon IE's will
     * be reused; add something like:
     * wmi_set_ie(wil, WMI_FRAME_BEACON, bcon->beacon_ies_len,
     * bcon->beacon_ies);
     */
    wmi_set_ie(wil, WMI_FRAME_PROBE_RESP, bcon->proberesp_ies_len,
               bcon->proberesp_ies);
    wmi_set_ie(wil, WMI_FRAME_ASSOC_RESP, bcon->assocresp_ies_len,
               bcon->assocresp_ies);

    wil->secure_pcp = info->privacy;

    rc = wmi_pcp_start(wil, info->beacon_interval, wmi_nettype,
                       channel->hw_value);
    if (rc)
        goto out;


    netif_carrier_on(ndev);

out:
    mutex_unlock(&wil->mutex);
    return rc;
}