Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c55b3766 authored by Hauke Mehrtens's avatar Hauke Mehrtens Committed by John W. Linville
Browse files

brcmsmac: add support for adhoc mode



This adds adhoc mode support to brcmsmac.

Signed-off-by: default avatarHauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 492b71e8
Loading
Loading
Loading
Loading
+8 −4
Original line number Original line Diff line number Diff line
@@ -357,11 +357,12 @@ brcms_ops_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
{
{
	struct brcms_info *wl = hw->priv;
	struct brcms_info *wl = hw->priv;


	/* Just STA and AP for now */
	/* Just STA, AP and ADHOC for now */
	if (vif->type != NL80211_IFTYPE_STATION &&
	if (vif->type != NL80211_IFTYPE_STATION &&
	    vif->type != NL80211_IFTYPE_AP) {
	    vif->type != NL80211_IFTYPE_AP &&
	    vif->type != NL80211_IFTYPE_ADHOC) {
		brcms_err(wl->wlc->hw->d11core,
		brcms_err(wl->wlc->hw->d11core,
			  "%s: Attempt to add type %d, only STA and AP for now\n",
			  "%s: Attempt to add type %d, only STA, AP and AdHoc for now\n",
			  __func__, vif->type);
			  __func__, vif->type);
		return -EOPNOTSUPP;
		return -EOPNOTSUPP;
	}
	}
@@ -374,6 +375,8 @@ brcms_ops_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
	else if (vif->type == NL80211_IFTYPE_AP)
	else if (vif->type == NL80211_IFTYPE_AP)
		brcms_c_start_ap(wl->wlc, vif->addr, vif->bss_conf.bssid,
		brcms_c_start_ap(wl->wlc, vif->addr, vif->bss_conf.bssid,
				 vif->bss_conf.ssid, vif->bss_conf.ssid_len);
				 vif->bss_conf.ssid, vif->bss_conf.ssid_len);
	else if (vif->type == NL80211_IFTYPE_ADHOC)
		brcms_c_start_adhoc(wl->wlc, vif->addr);
	spin_unlock_bh(&wl->lock);
	spin_unlock_bh(&wl->lock);


	return 0;
	return 0;
@@ -1056,7 +1059,8 @@ static int ieee_hw_init(struct ieee80211_hw *hw)
	/* channel change time is dependent on chip and band  */
	/* channel change time is dependent on chip and band  */
	hw->channel_change_time = 7 * 1000;
	hw->channel_change_time = 7 * 1000;
	hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
	hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
				     BIT(NL80211_IFTYPE_AP);
				     BIT(NL80211_IFTYPE_AP) |
				     BIT(NL80211_IFTYPE_ADHOC);


	/*
	/*
	 * deactivate sending probe responses by ucude, because this will
	 * deactivate sending probe responses by ucude, because this will
+11 −0
Original line number Original line Diff line number Diff line
@@ -2186,6 +2186,14 @@ void brcms_c_start_ap(struct brcms_c_info *wlc, u8 *addr, const u8 *bssid,
	brcms_b_mctrl(wlc->hw, MCTL_AP | MCTL_INFRA, MCTL_AP | MCTL_INFRA);
	brcms_b_mctrl(wlc->hw, MCTL_AP | MCTL_INFRA, MCTL_AP | MCTL_INFRA);
}
}


void brcms_c_start_adhoc(struct brcms_c_info *wlc, u8 *addr)
{
	memcpy(wlc->pub->cur_etheraddr, addr, sizeof(wlc->pub->cur_etheraddr));
	wlc->bsscfg->type = BRCMS_TYPE_ADHOC;

	brcms_b_mctrl(wlc->hw, MCTL_AP | MCTL_INFRA, 0);
}

/* Initialize GPIOs that are controlled by D11 core */
/* Initialize GPIOs that are controlled by D11 core */
static void brcms_c_gpio_init(struct brcms_c_info *wlc)
static void brcms_c_gpio_init(struct brcms_c_info *wlc)
{
{
@@ -3077,6 +3085,9 @@ static bool brcms_c_ps_allowed(struct brcms_c_info *wlc)
	if (wlc->bsscfg->type == BRCMS_TYPE_AP)
	if (wlc->bsscfg->type == BRCMS_TYPE_AP)
		return false;
		return false;


	if (wlc->bsscfg->type == BRCMS_TYPE_ADHOC)
		return false;

	return true;
	return true;
}
}


+1 −0
Original line number Original line Diff line number Diff line
@@ -334,6 +334,7 @@ extern bool brcms_c_tx_flush_completed(struct brcms_c_info *wlc);
extern void brcms_c_start_station(struct brcms_c_info *wlc, u8 *addr);
extern void brcms_c_start_station(struct brcms_c_info *wlc, u8 *addr);
extern void brcms_c_start_ap(struct brcms_c_info *wlc, u8 *addr,
extern void brcms_c_start_ap(struct brcms_c_info *wlc, u8 *addr,
			     const u8 *bssid, u8 *ssid, size_t ssid_len);
			     const u8 *bssid, u8 *ssid, size_t ssid_len);
extern void brcms_c_start_adhoc(struct brcms_c_info *wlc, u8 *addr);
extern void brcms_c_update_beacon(struct brcms_c_info *wlc);
extern void brcms_c_update_beacon(struct brcms_c_info *wlc);
extern void brcms_c_set_new_beacon(struct brcms_c_info *wlc,
extern void brcms_c_set_new_beacon(struct brcms_c_info *wlc,
				   struct sk_buff *beacon, u16 tim_offset,
				   struct sk_buff *beacon, u16 tim_offset,