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

Commit c6557050 authored by David S. Miller's avatar David S. Miller
Browse files
parents 638266f7 0112c9e9
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -224,7 +224,7 @@ static void setup_ht_cap(struct ieee80211_ht_info *ht_info)


	ht_info->ht_supported = 1;
	ht_info->ht_supported = 1;
	ht_info->cap = (u16)IEEE80211_HT_CAP_SUP_WIDTH
	ht_info->cap = (u16)IEEE80211_HT_CAP_SUP_WIDTH
			|(u16)IEEE80211_HT_CAP_MIMO_PS
			|(u16)IEEE80211_HT_CAP_SM_PS
			|(u16)IEEE80211_HT_CAP_SGI_40
			|(u16)IEEE80211_HT_CAP_SGI_40
			|(u16)IEEE80211_HT_CAP_DSSSCCK40;
			|(u16)IEEE80211_HT_CAP_DSSSCCK40;


+1 −6
Original line number Original line Diff line number Diff line
@@ -585,8 +585,6 @@ enum {
struct b43_qos_params {
struct b43_qos_params {
	/* The QOS parameters */
	/* The QOS parameters */
	struct ieee80211_tx_queue_params p;
	struct ieee80211_tx_queue_params p;
	/* Does this need to get uploaded to hardware? */
	bool need_hw_update;
};
};


struct b43_wldev;
struct b43_wldev;
@@ -648,11 +646,8 @@ struct b43_wl {
	bool beacon_templates_virgin; /* Never wrote the templates? */
	bool beacon_templates_virgin; /* Never wrote the templates? */
	struct work_struct beacon_update_trigger;
	struct work_struct beacon_update_trigger;


	/* The current QOS parameters for the 4 queues.
	/* The current QOS parameters for the 4 queues. */
	 * This is protected by the irq_lock. */
	struct b43_qos_params qos_params[4];
	struct b43_qos_params qos_params[4];
	/* Workqueue for updating QOS parameters in hardware. */
	struct work_struct qos_update_work;


	/* Work for adjustment of the transmission power.
	/* Work for adjustment of the transmission power.
	 * This is scheduled when we determine that the actual TX output
	 * This is scheduled when we determine that the actual TX output
+67 −52
Original line number Original line Diff line number Diff line
@@ -3059,36 +3059,31 @@ static void b43_qos_params_upload(struct b43_wldev *dev,
	}
	}
}
}


/* Update the QOS parameters in hardware. */
/* Mapping of mac80211 queue numbers to b43 QoS SHM offsets. */
static void b43_qos_update(struct b43_wldev *dev)
static const u16 b43_qos_shm_offsets[] = {
{
	/* [mac80211-queue-nr] = SHM_OFFSET, */
	struct b43_wl *wl = dev->wl;
	struct b43_qos_params *params;
	unsigned long flags;
	unsigned int i;

	/* Mapping of mac80211 queues to b43 SHM offsets. */
	static const u16 qos_shm_offsets[] = {
	[0] = B43_QOS_VOICE,
	[0] = B43_QOS_VOICE,
	[1] = B43_QOS_VIDEO,
	[1] = B43_QOS_VIDEO,
	[2] = B43_QOS_BESTEFFORT,
	[2] = B43_QOS_BESTEFFORT,
	[3] = B43_QOS_BACKGROUND,
	[3] = B43_QOS_BACKGROUND,
};
};
	BUILD_BUG_ON(ARRAY_SIZE(qos_shm_offsets) != ARRAY_SIZE(wl->qos_params));


	b43_mac_suspend(dev);
/* Update all QOS parameters in hardware. */
	spin_lock_irqsave(&wl->irq_lock, flags);
static void b43_qos_upload_all(struct b43_wldev *dev)
{
	struct b43_wl *wl = dev->wl;
	struct b43_qos_params *params;
	unsigned int i;

	BUILD_BUG_ON(ARRAY_SIZE(b43_qos_shm_offsets) !=
		     ARRAY_SIZE(wl->qos_params));


	b43_mac_suspend(dev);
	for (i = 0; i < ARRAY_SIZE(wl->qos_params); i++) {
	for (i = 0; i < ARRAY_SIZE(wl->qos_params); i++) {
		params = &(wl->qos_params[i]);
		params = &(wl->qos_params[i]);
		if (params->need_hw_update) {
		b43_qos_params_upload(dev, &(params->p),
		b43_qos_params_upload(dev, &(params->p),
					      qos_shm_offsets[i]);
				      b43_qos_shm_offsets[i]);
			params->need_hw_update = 0;
	}
	}
	}

	spin_unlock_irqrestore(&wl->irq_lock, flags);
	b43_mac_enable(dev);
	b43_mac_enable(dev);
}
}


@@ -3097,25 +3092,50 @@ static void b43_qos_clear(struct b43_wl *wl)
	struct b43_qos_params *params;
	struct b43_qos_params *params;
	unsigned int i;
	unsigned int i;


	/* Initialize QoS parameters to sane defaults. */

	BUILD_BUG_ON(ARRAY_SIZE(b43_qos_shm_offsets) !=
		     ARRAY_SIZE(wl->qos_params));

	for (i = 0; i < ARRAY_SIZE(wl->qos_params); i++) {
	for (i = 0; i < ARRAY_SIZE(wl->qos_params); i++) {
		params = &(wl->qos_params[i]);
		params = &(wl->qos_params[i]);


		memset(&(params->p), 0, sizeof(params->p));
		switch (b43_qos_shm_offsets[i]) {
		params->p.aifs = -1;
		case B43_QOS_VOICE:
		params->need_hw_update = 1;
			params->p.txop = 0;
			params->p.aifs = 2;
			params->p.cw_min = 0x0001;
			params->p.cw_max = 0x0001;
			break;
		case B43_QOS_VIDEO:
			params->p.txop = 0;
			params->p.aifs = 2;
			params->p.cw_min = 0x0001;
			params->p.cw_max = 0x0001;
			break;
		case B43_QOS_BESTEFFORT:
			params->p.txop = 0;
			params->p.aifs = 3;
			params->p.cw_min = 0x0001;
			params->p.cw_max = 0x03FF;
			break;
		case B43_QOS_BACKGROUND:
			params->p.txop = 0;
			params->p.aifs = 7;
			params->p.cw_min = 0x0001;
			params->p.cw_max = 0x03FF;
			break;
		default:
			B43_WARN_ON(1);
		}
	}
	}
}
}


/* Initialize the core's QOS capabilities */
/* Initialize the core's QOS capabilities */
static void b43_qos_init(struct b43_wldev *dev)
static void b43_qos_init(struct b43_wldev *dev)
{
{
	struct b43_wl *wl = dev->wl;
	unsigned int i;

	/* Upload the current QOS parameters. */
	/* Upload the current QOS parameters. */
	for (i = 0; i < ARRAY_SIZE(wl->qos_params); i++)
	b43_qos_upload_all(dev);
		wl->qos_params[i].need_hw_update = 1;
	b43_qos_update(dev);


	/* Enable QOS support. */
	/* Enable QOS support. */
	b43_hf_write(dev, b43_hf_read(dev) | B43_HF_EDCF);
	b43_hf_write(dev, b43_hf_read(dev) | B43_HF_EDCF);
@@ -3124,25 +3144,13 @@ static void b43_qos_init(struct b43_wldev *dev)
		    | B43_MMIO_IFSCTL_USE_EDCF);
		    | B43_MMIO_IFSCTL_USE_EDCF);
}
}


static void b43_qos_update_work(struct work_struct *work)
{
	struct b43_wl *wl = container_of(work, struct b43_wl, qos_update_work);
	struct b43_wldev *dev;

	mutex_lock(&wl->mutex);
	dev = wl->current_dev;
	if (likely(dev && (b43_status(dev) >= B43_STAT_INITIALIZED)))
		b43_qos_update(dev);
	mutex_unlock(&wl->mutex);
}

static int b43_op_conf_tx(struct ieee80211_hw *hw, u16 _queue,
static int b43_op_conf_tx(struct ieee80211_hw *hw, u16 _queue,
			  const struct ieee80211_tx_queue_params *params)
			  const struct ieee80211_tx_queue_params *params)
{
{
	struct b43_wl *wl = hw_to_b43_wl(hw);
	struct b43_wl *wl = hw_to_b43_wl(hw);
	unsigned long flags;
	struct b43_wldev *dev;
	unsigned int queue = (unsigned int)_queue;
	unsigned int queue = (unsigned int)_queue;
	struct b43_qos_params *p;
	int err = -ENODEV;


	if (queue >= ARRAY_SIZE(wl->qos_params)) {
	if (queue >= ARRAY_SIZE(wl->qos_params)) {
		/* Queue not available or don't support setting
		/* Queue not available or don't support setting
@@ -3150,16 +3158,25 @@ static int b43_op_conf_tx(struct ieee80211_hw *hw, u16 _queue,
		 * confuse mac80211. */
		 * confuse mac80211. */
		return 0;
		return 0;
	}
	}
	BUILD_BUG_ON(ARRAY_SIZE(b43_qos_shm_offsets) !=
		     ARRAY_SIZE(wl->qos_params));


	spin_lock_irqsave(&wl->irq_lock, flags);
	mutex_lock(&wl->mutex);
	p = &(wl->qos_params[queue]);
	dev = wl->current_dev;
	memcpy(&(p->p), params, sizeof(p->p));
	if (unlikely(!dev || (b43_status(dev) < B43_STAT_INITIALIZED)))
	p->need_hw_update = 1;
		goto out_unlock;
	spin_unlock_irqrestore(&wl->irq_lock, flags);


	queue_work(hw->workqueue, &wl->qos_update_work);
	memcpy(&(wl->qos_params[queue].p), params, sizeof(*params));
	b43_mac_suspend(dev);
	b43_qos_params_upload(dev, &(wl->qos_params[queue].p),
			      b43_qos_shm_offsets[queue]);
	b43_mac_enable(dev);
	err = 0;


	return 0;
out_unlock:
	mutex_unlock(&wl->mutex);

	return err;
}
}


static int b43_op_get_tx_stats(struct ieee80211_hw *hw,
static int b43_op_get_tx_stats(struct ieee80211_hw *hw,
@@ -4186,7 +4203,6 @@ static void b43_op_stop(struct ieee80211_hw *hw)
	struct b43_wldev *dev = wl->current_dev;
	struct b43_wldev *dev = wl->current_dev;


	b43_rfkill_exit(dev);
	b43_rfkill_exit(dev);
	cancel_work_sync(&(wl->qos_update_work));
	cancel_work_sync(&(wl->beacon_update_trigger));
	cancel_work_sync(&(wl->beacon_update_trigger));


	mutex_lock(&wl->mutex);
	mutex_lock(&wl->mutex);
@@ -4585,7 +4601,6 @@ static int b43_wireless_init(struct ssb_device *dev)
	spin_lock_init(&wl->shm_lock);
	spin_lock_init(&wl->shm_lock);
	mutex_init(&wl->mutex);
	mutex_init(&wl->mutex);
	INIT_LIST_HEAD(&wl->devlist);
	INIT_LIST_HEAD(&wl->devlist);
	INIT_WORK(&wl->qos_update_work, b43_qos_update_work);
	INIT_WORK(&wl->beacon_update_trigger, b43_beacon_update_trigger_work);
	INIT_WORK(&wl->beacon_update_trigger, b43_beacon_update_trigger_work);
	INIT_WORK(&wl->txpower_adjust_work, b43_phy_txpower_adjust_work);
	INIT_WORK(&wl->txpower_adjust_work, b43_phy_txpower_adjust_work);


+0 −1
Original line number Original line Diff line number Diff line
@@ -386,7 +386,6 @@ static void b43_set_original_gains(struct b43_wldev *dev)
void b43_nrssi_hw_write(struct b43_wldev *dev, u16 offset, s16 val)
void b43_nrssi_hw_write(struct b43_wldev *dev, u16 offset, s16 val)
{
{
	b43_phy_write(dev, B43_PHY_NRSSILT_CTRL, offset);
	b43_phy_write(dev, B43_PHY_NRSSILT_CTRL, offset);
	mmiowb();
	b43_phy_write(dev, B43_PHY_NRSSILT_DATA, (u16) val);
	b43_phy_write(dev, B43_PHY_NRSSILT_DATA, (u16) val);
}
}


+19 −13
Original line number Original line Diff line number Diff line
@@ -595,12 +595,14 @@ static void b43legacy_phy_initb5(struct b43legacy_wldev *dev)
				    0x0035) & 0xFFC0) | 0x0064);
				    0x0035) & 0xFFC0) | 0x0064);
		b43legacy_phy_write(dev, 0x005D, (b43legacy_phy_read(dev,
		b43legacy_phy_write(dev, 0x005D, (b43legacy_phy_read(dev,
				    0x005D) & 0xFF80) | 0x000A);
				    0x005D) & 0xFF80) | 0x000A);
		b43legacy_phy_write(dev, 0x5B, 0x0000);
		b43legacy_phy_write(dev, 0x5C, 0x0000);
	}
	}


	if (dev->bad_frames_preempt)
	if (dev->bad_frames_preempt)
		b43legacy_phy_write(dev, B43legacy_PHY_RADIO_BITFIELD,
		b43legacy_phy_write(dev, B43legacy_PHY_RADIO_BITFIELD,
				    b43legacy_phy_read(dev,
				    b43legacy_phy_read(dev,
				    B43legacy_PHY_RADIO_BITFIELD) | (1 << 11));
				    B43legacy_PHY_RADIO_BITFIELD) | (1 << 12));


	if (phy->analog == 1) {
	if (phy->analog == 1) {
		b43legacy_phy_write(dev, 0x0026, 0xCE00);
		b43legacy_phy_write(dev, 0x0026, 0xCE00);
@@ -753,7 +755,7 @@ static void b43legacy_phy_initb6(struct b43legacy_wldev *dev)
		b43legacy_radio_write16(dev, 0x0050, 0x0020);
		b43legacy_radio_write16(dev, 0x0050, 0x0020);
	}
	}
	if (phy->radio_rev <= 2) {
	if (phy->radio_rev <= 2) {
		b43legacy_radio_write16(dev, 0x007C, 0x0020);
		b43legacy_radio_write16(dev, 0x0050, 0x0020);
		b43legacy_radio_write16(dev, 0x005A, 0x0070);
		b43legacy_radio_write16(dev, 0x005A, 0x0070);
		b43legacy_radio_write16(dev, 0x005B, 0x007B);
		b43legacy_radio_write16(dev, 0x005B, 0x007B);
		b43legacy_radio_write16(dev, 0x005C, 0x00B0);
		b43legacy_radio_write16(dev, 0x005C, 0x00B0);
@@ -771,7 +773,7 @@ static void b43legacy_phy_initb6(struct b43legacy_wldev *dev)
		b43legacy_phy_write(dev, 0x002A, 0x8AC0);
		b43legacy_phy_write(dev, 0x002A, 0x8AC0);
	b43legacy_phy_write(dev, 0x0038, 0x0668);
	b43legacy_phy_write(dev, 0x0038, 0x0668);
	b43legacy_radio_set_txpower_bg(dev, 0xFFFF, 0xFFFF, 0xFFFF);
	b43legacy_radio_set_txpower_bg(dev, 0xFFFF, 0xFFFF, 0xFFFF);
	if (phy->radio_rev <= 5)
	if (phy->radio_rev == 4 || phy->radio_rev == 5)
		b43legacy_phy_write(dev, 0x005D, (b43legacy_phy_read(dev,
		b43legacy_phy_write(dev, 0x005D, (b43legacy_phy_read(dev,
				    0x005D) & 0xFF80) | 0x0003);
				    0x005D) & 0xFF80) | 0x0003);
	if (phy->radio_rev <= 2)
	if (phy->radio_rev <= 2)
@@ -1010,7 +1012,7 @@ static void b43legacy_phy_initg(struct b43legacy_wldev *dev)
		b43legacy_phy_initb5(dev);
		b43legacy_phy_initb5(dev);
	else
	else
		b43legacy_phy_initb6(dev);
		b43legacy_phy_initb6(dev);
	if (phy->rev >= 2 || phy->gmode)
	if (phy->rev >= 2 && phy->gmode)
		b43legacy_phy_inita(dev);
		b43legacy_phy_inita(dev);


	if (phy->rev >= 2) {
	if (phy->rev >= 2) {
@@ -1025,17 +1027,21 @@ static void b43legacy_phy_initg(struct b43legacy_wldev *dev)
		b43legacy_phy_write(dev, 0x0811, 0x0400);
		b43legacy_phy_write(dev, 0x0811, 0x0400);
		b43legacy_phy_write(dev, 0x0015, 0x00C0);
		b43legacy_phy_write(dev, 0x0015, 0x00C0);
	}
	}
	if (phy->rev >= 2 || phy->gmode) {
	if (phy->gmode) {
		tmp = b43legacy_phy_read(dev, 0x0400) & 0xFF;
		tmp = b43legacy_phy_read(dev, 0x0400) & 0xFF;
		if (tmp == 3 || tmp == 5) {
		if (tmp == 3) {
			b43legacy_phy_write(dev, 0x04C2, 0x1816);
			b43legacy_phy_write(dev, 0x04C3, 0x8606);
		}
		if (tmp == 4 || tmp == 5) {
			b43legacy_phy_write(dev, 0x04C2, 0x1816);
			b43legacy_phy_write(dev, 0x04C2, 0x1816);
			b43legacy_phy_write(dev, 0x04C3, 0x8006);
			b43legacy_phy_write(dev, 0x04C3, 0x8006);
			if (tmp == 5)
			b43legacy_phy_write(dev, 0x04CC,
			b43legacy_phy_write(dev, 0x04CC,
					    (b43legacy_phy_read(dev,
					    (b43legacy_phy_read(dev,
					     0x04CC) & 0x00FF) |
					     0x04CC) & 0x00FF) |
					     0x1F00);
					     0x1F00);
		}
		}
		if (phy->rev >= 2)
			b43legacy_phy_write(dev, 0x047E, 0x0078);
			b43legacy_phy_write(dev, 0x047E, 0x0078);
	}
	}
	if (phy->radio_rev == 8) {
	if (phy->radio_rev == 8) {
@@ -1078,7 +1084,7 @@ static void b43legacy_phy_initg(struct b43legacy_wldev *dev)
		else
		else
			b43legacy_phy_write(dev, 0x002F, 0x0202);
			b43legacy_phy_write(dev, 0x002F, 0x0202);
	}
	}
	if (phy->gmode || phy->rev >= 2) {
	if (phy->gmode) {
		b43legacy_phy_lo_adjust(dev, 0);
		b43legacy_phy_lo_adjust(dev, 0);
		b43legacy_phy_write(dev, 0x080F, 0x8078);
		b43legacy_phy_write(dev, 0x080F, 0x8078);
	}
	}
Loading