diff options
Diffstat (limited to 'drivers/net/wireless/b43legacy/main.c')
| -rw-r--r-- | drivers/net/wireless/b43legacy/main.c | 72 | 
1 files changed, 28 insertions, 44 deletions
diff --git a/drivers/net/wireless/b43legacy/main.c b/drivers/net/wireless/b43legacy/main.c index 3e612d0a13e..a1b8bf3ee73 100644 --- a/drivers/net/wireless/b43legacy/main.c +++ b/drivers/net/wireless/b43legacy/main.c @@ -846,10 +846,10 @@ static void handle_irq_noise(struct b43legacy_wldev *dev)  	/* Get the noise samples. */  	B43legacy_WARN_ON(dev->noisecalc.nr_samples >= 8);  	i = dev->noisecalc.nr_samples; -	noise[0] = limit_value(noise[0], 0, ARRAY_SIZE(phy->nrssi_lt) - 1); -	noise[1] = limit_value(noise[1], 0, ARRAY_SIZE(phy->nrssi_lt) - 1); -	noise[2] = limit_value(noise[2], 0, ARRAY_SIZE(phy->nrssi_lt) - 1); -	noise[3] = limit_value(noise[3], 0, ARRAY_SIZE(phy->nrssi_lt) - 1); +	noise[0] = clamp_val(noise[0], 0, ARRAY_SIZE(phy->nrssi_lt) - 1); +	noise[1] = clamp_val(noise[1], 0, ARRAY_SIZE(phy->nrssi_lt) - 1); +	noise[2] = clamp_val(noise[2], 0, ARRAY_SIZE(phy->nrssi_lt) - 1); +	noise[3] = clamp_val(noise[3], 0, ARRAY_SIZE(phy->nrssi_lt) - 1);  	dev->noisecalc.samples[i][0] = phy->nrssi_lt[noise[0]];  	dev->noisecalc.samples[i][1] = phy->nrssi_lt[noise[1]];  	dev->noisecalc.samples[i][2] = phy->nrssi_lt[noise[2]]; @@ -1138,14 +1138,22 @@ static void b43legacy_write_probe_resp_template(struct b43legacy_wldev *dev,  /* Asynchronously update the packet templates in template RAM.   * Locking: Requires wl->irq_lock to be locked. */ -static void b43legacy_update_templates(struct b43legacy_wl *wl, -				       struct sk_buff *beacon) +static void b43legacy_update_templates(struct b43legacy_wl *wl)  { +	struct sk_buff *beacon;  	/* This is the top half of the ansynchronous beacon update. The bottom  	 * half is the beacon IRQ. Beacon update must be asynchronous to avoid  	 * sending an invalid beacon. This can happen for example, if the  	 * firmware transmits a beacon while we are updating it. */ +	/* We could modify the existing beacon and set the aid bit in the TIM +	 * field, but that would probably require resizing and moving of data +	 * within the beacon template. Simply request a new beacon and let +	 * mac80211 do the hard work. */ +	beacon = ieee80211_beacon_get(wl->hw, wl->vif); +	if (unlikely(!beacon)) +		return; +  	if (wl->current_beacon)  		dev_kfree_skb_any(wl->current_beacon);  	wl->current_beacon = beacon; @@ -2358,8 +2366,7 @@ static int b43legacy_rng_init(struct b43legacy_wl *wl)  }  static int b43legacy_op_tx(struct ieee80211_hw *hw, -			   struct sk_buff *skb, -			   struct ieee80211_tx_control *ctl) +			   struct sk_buff *skb)  {  	struct b43legacy_wl *wl = hw_to_b43legacy_wl(hw);  	struct b43legacy_wldev *dev = wl->current_dev; @@ -2373,10 +2380,10 @@ static int b43legacy_op_tx(struct ieee80211_hw *hw,  	/* DMA-TX is done without a global lock. */  	if (b43legacy_using_pio(dev)) {  		spin_lock_irqsave(&wl->irq_lock, flags); -		err = b43legacy_pio_tx(dev, skb, ctl); +		err = b43legacy_pio_tx(dev, skb);  		spin_unlock_irqrestore(&wl->irq_lock, flags);  	} else -		err = b43legacy_dma_tx(dev, skb, ctl); +		err = b43legacy_dma_tx(dev, skb);  out:  	if (unlikely(err)) {  		/* Drop the packet. */ @@ -2385,8 +2392,7 @@ out:  	return NETDEV_TX_OK;  } -static int b43legacy_op_conf_tx(struct ieee80211_hw *hw, -				int queue, +static int b43legacy_op_conf_tx(struct ieee80211_hw *hw, u16 queue,  				const struct ieee80211_tx_queue_params *params)  {  	return 0; @@ -2729,10 +2735,13 @@ static int b43legacy_op_config_interface(struct ieee80211_hw *hw,  		memset(wl->bssid, 0, ETH_ALEN);  	if (b43legacy_status(dev) >= B43legacy_STAT_INITIALIZED) {  		if (b43legacy_is_mode(wl, IEEE80211_IF_TYPE_AP)) { -			B43legacy_WARN_ON(conf->type != IEEE80211_IF_TYPE_AP); +			B43legacy_WARN_ON(vif->type != IEEE80211_IF_TYPE_AP);  			b43legacy_set_ssid(dev, conf->ssid, conf->ssid_len); -			if (conf->beacon) -				b43legacy_update_templates(wl, conf->beacon); +			if (conf->changed & IEEE80211_IFCC_BEACON) +				b43legacy_update_templates(wl); +		} else if (b43legacy_is_mode(wl, IEEE80211_IF_TYPE_IBSS)) { +			if (conf->changed & IEEE80211_IFCC_BEACON) +				b43legacy_update_templates(wl);  		}  		b43legacy_write_mac_bssid_templates(dev);  	} @@ -2797,7 +2806,6 @@ static int b43legacy_wireless_core_start(struct b43legacy_wldev *dev)  	/* Start data flow (TX/RX) */  	b43legacy_mac_enable(dev);  	b43legacy_interrupt_enable(dev, dev->irq_savedstate); -	ieee80211_start_queues(dev->wl->hw);  	/* Start maintenance work */  	b43legacy_periodic_tasks_setup(dev); @@ -3399,32 +3407,10 @@ static int b43legacy_op_beacon_set_tim(struct ieee80211_hw *hw,  				       int aid, int set)  {  	struct b43legacy_wl *wl = hw_to_b43legacy_wl(hw); -	struct sk_buff *beacon; -	unsigned long flags; - -	/* We could modify the existing beacon and set the aid bit in the TIM -	 * field, but that would probably require resizing and moving of data -	 * within the beacon template. Simply request a new beacon and let -	 * mac80211 do the hard work. */ -	beacon = ieee80211_beacon_get(hw, wl->vif, NULL); -	if (unlikely(!beacon)) -		return -ENOMEM; -	spin_lock_irqsave(&wl->irq_lock, flags); -	b43legacy_update_templates(wl, beacon); -	spin_unlock_irqrestore(&wl->irq_lock, flags); - -	return 0; -} - -static int b43legacy_op_ibss_beacon_update(struct ieee80211_hw *hw, -					   struct sk_buff *beacon, -					   struct ieee80211_tx_control *ctl) -{ -	struct b43legacy_wl *wl = hw_to_b43legacy_wl(hw);  	unsigned long flags;  	spin_lock_irqsave(&wl->irq_lock, flags); -	b43legacy_update_templates(wl, beacon); +	b43legacy_update_templates(wl);  	spin_unlock_irqrestore(&wl->irq_lock, flags);  	return 0; @@ -3444,7 +3430,6 @@ static const struct ieee80211_ops b43legacy_hw_ops = {  	.stop			= b43legacy_op_stop,  	.set_retry_limit	= b43legacy_op_set_retry_limit,  	.set_tim		= b43legacy_op_beacon_set_tim, -	.beacon_update		= b43legacy_op_ibss_beacon_update,  };  /* Hard-reset the chip. Do not call this directly. @@ -3718,10 +3703,9 @@ static int b43legacy_wireless_init(struct ssb_device *dev)  	/* fill hw info */  	hw->flags = IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE | -		    IEEE80211_HW_RX_INCLUDES_FCS; -	hw->max_signal = 100; -	hw->max_rssi = -110; -	hw->max_noise = -110; +		    IEEE80211_HW_RX_INCLUDES_FCS | +		    IEEE80211_HW_SIGNAL_DBM | +		    IEEE80211_HW_NOISE_DBM;  	hw->queues = 1; /* FIXME: hardware has more queues */  	SET_IEEE80211_DEV(hw, dev->dev);  	if (is_valid_ether_addr(sprom->et1mac))  |