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

Commit d346f49d authored by David S. Miller's avatar David S. Miller
Browse files
parents d87fd25d b6ce5c33
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
@@ -188,3 +188,27 @@ Then in some part of your code after your wiphy has been registered:
		       &mydriver_jp_regdom.reg_rules[i],
		       sizeof(struct ieee80211_reg_rule));
	regulatory_struct_hint(rd);

Statically compiled regulatory database
---------------------------------------

In most situations the userland solution using CRDA as described
above is the preferred solution.  However in some cases a set of
rules built into the kernel itself may be desirable.  To account
for this situation, a configuration option has been provided
(i.e. CONFIG_CFG80211_INTERNAL_REGDB).  With this option enabled,
the wireless database information contained in net/wireless/db.txt is
used to generate a data structure encoded in net/wireless/regdb.c.
That option also enables code in net/wireless/reg.c which queries
the data in regdb.c as an alternative to using CRDA.

The file net/wireless/db.txt should be kept up-to-date with the db.txt
file available in the git repository here:

    git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-regdb.git

Again, most users in most situations should be using the CRDA package
provided with their distribution, and in most other situations users
should be building and using CRDA on their own rather than using
this option.  If you are not absolutely sure that you should be using
CONFIG_CFG80211_INTERNAL_REGDB then _DO_NOT_USE_IT_.
+2 −7
Original line number Diff line number Diff line
@@ -109,7 +109,6 @@ struct ar9170_rxstream_mpdu_merge {
	bool has_plcp;
};

#define AR9170_NUM_MAX_BA_RETRY	5
#define AR9170_NUM_TID	16
#define WME_BA_BMP_SIZE         64
#define AR9170_NUM_MAX_AGG_LEN	(2 * WME_BA_BMP_SIZE)
@@ -143,7 +142,6 @@ struct ar9170_sta_tid {
	u16 tid;
	enum ar9170_tid_state state;
	bool active;
	u8 retry;
};

#define AR9170_QUEUE_TIMEOUT		64
@@ -154,6 +152,8 @@ struct ar9170_sta_tid {

#define AR9170_NUM_TX_STATUS		128
#define AR9170_NUM_TX_AGG_MAX		30
#define AR9170_NUM_TX_LIMIT_HARD       AR9170_TXQ_DEPTH
#define AR9170_NUM_TX_LIMIT_SOFT       (AR9170_TXQ_DEPTH - 10)

struct ar9170 {
	struct ieee80211_hw *hw;
@@ -248,13 +248,8 @@ struct ar9170_sta_info {
	unsigned int ampdu_max_len;
};

#define AR9170_TX_FLAG_WAIT_FOR_ACK	BIT(0)
#define AR9170_TX_FLAG_NO_ACK		BIT(1)
#define AR9170_TX_FLAG_BLOCK_ACK	BIT(2)

struct ar9170_tx_info {
	unsigned long timeout;
	unsigned int flags;
};

#define IS_STARTED(a)		(((struct ar9170 *)a)->state >= AR9170_STARTED)
+1 −0
Original line number Diff line number Diff line
@@ -276,6 +276,7 @@ struct ar9170_tx_control {
#define AR9170_TX_MAC_RATE_PROBE		0x8000

/* either-or */
#define AR9170_TX_PHY_MOD_MASK			0x00000003
#define AR9170_TX_PHY_MOD_CCK			0x00000000
#define AR9170_TX_PHY_MOD_OFDM			0x00000001
#define AR9170_TX_PHY_MOD_HT			0x00000002
+1 −1
Original line number Diff line number Diff line
@@ -117,7 +117,7 @@ int ar9170_set_qos(struct ar9170 *ar)
	ar9170_regwrite(AR9170_MAC_REG_AC1_AC0_TXOP,
			ar->edcf[0].txop | ar->edcf[1].txop << 16);
	ar9170_regwrite(AR9170_MAC_REG_AC3_AC2_TXOP,
			ar->edcf[1].txop | ar->edcf[3].txop << 16);
			ar->edcf[2].txop | ar->edcf[3].txop << 16);

	ar9170_regwrite_finish();

+45 −57
Original line number Diff line number Diff line
@@ -194,12 +194,15 @@ static inline u16 ar9170_get_seq(struct sk_buff *skb)
	return ar9170_get_seq_h((void *) txc->frame_data);
}

static inline u16 ar9170_get_tid_h(struct ieee80211_hdr *hdr)
{
	return (ieee80211_get_qos_ctl(hdr))[0] & IEEE80211_QOS_CTL_TID_MASK;
}

static inline u16 ar9170_get_tid(struct sk_buff *skb)
{
	struct ar9170_tx_control *txc = (void *) skb->data;
	struct ieee80211_hdr *hdr = (void *) txc->frame_data;

	return (ieee80211_get_qos_ctl(hdr))[0] & IEEE80211_QOS_CTL_TID_MASK;
	return ar9170_get_tid_h((struct ieee80211_hdr *) txc->frame_data);
}

#define GET_NEXT_SEQ(seq)	((seq + 1) & 0x0fff)
@@ -213,10 +216,10 @@ static void ar9170_print_txheader(struct ar9170 *ar, struct sk_buff *skb)
	struct ar9170_tx_info *arinfo = (void *) txinfo->rate_driver_data;
	struct ieee80211_hdr *hdr = (void *) txc->frame_data;

	printk(KERN_DEBUG "%s: => FRAME [skb:%p, q:%d, DA:[%pM] flags:%x s:%d "
	printk(KERN_DEBUG "%s: => FRAME [skb:%p, q:%d, DA:[%pM] s:%d "
			  "mac_ctrl:%04x, phy_ctrl:%08x, timeout:[%d ms]]\n",
	       wiphy_name(ar->hw->wiphy), skb, skb_get_queue_mapping(skb),
	       ieee80211_get_DA(hdr), arinfo->flags, ar9170_get_seq_h(hdr),
	       ieee80211_get_DA(hdr), ar9170_get_seq_h(hdr),
	       le16_to_cpu(txc->mac_control), le32_to_cpu(txc->phy_control),
	       jiffies_to_msecs(arinfo->timeout - jiffies));
}
@@ -430,7 +433,7 @@ void ar9170_tx_callback(struct ar9170 *ar, struct sk_buff *skb)
	spin_lock_irqsave(&ar->tx_stats_lock, flags);
	ar->tx_stats[queue].len--;

	if (skb_queue_empty(&ar->tx_pending[queue])) {
	if (ar->tx_stats[queue].len < AR9170_NUM_TX_LIMIT_SOFT) {
#ifdef AR9170_QUEUE_STOP_DEBUG
		printk(KERN_DEBUG "%s: wake queue %d\n",
		       wiphy_name(ar->hw->wiphy), queue);
@@ -440,22 +443,17 @@ void ar9170_tx_callback(struct ar9170 *ar, struct sk_buff *skb)
	}
	spin_unlock_irqrestore(&ar->tx_stats_lock, flags);

	if (arinfo->flags & AR9170_TX_FLAG_BLOCK_ACK) {
	if (info->flags & IEEE80211_TX_CTL_NO_ACK) {
		ar9170_tx_status(ar, skb, AR9170_TX_STATUS_FAILED);
	} else {
		if (info->flags & IEEE80211_TX_CTL_AMPDU) {
			ar9170_tx_ampdu_callback(ar, skb);
	} else if (arinfo->flags & AR9170_TX_FLAG_WAIT_FOR_ACK) {
		} else {
			arinfo->timeout = jiffies +
				  msecs_to_jiffies(AR9170_TX_TIMEOUT);

			skb_queue_tail(&ar->tx_status[queue], skb);
	} else if (arinfo->flags & AR9170_TX_FLAG_NO_ACK) {
		ar9170_tx_status(ar, skb, AR9170_TX_STATUS_FAILED);
	} else {
#ifdef AR9170_QUEUE_DEBUG
		printk(KERN_DEBUG "%s: unsupported frame flags!\n",
		       wiphy_name(ar->hw->wiphy));
		ar9170_print_txheader(ar, skb);
#endif /* AR9170_QUEUE_DEBUG */
		dev_kfree_skb_any(skb);
		}
	}

	if (!ar->tx_stats[queue].len &&
@@ -1407,17 +1405,6 @@ static int ar9170_tx_prepare(struct ar9170 *ar, struct sk_buff *skb)

	if (!(info->flags & IEEE80211_TX_CTL_NO_ACK) &&
	     (is_valid_ether_addr(ieee80211_get_DA(hdr)))) {
		if (info->flags & IEEE80211_TX_CTL_AMPDU) {
			if (unlikely(!info->control.sta))
				goto err_out;

			txc->mac_control |= cpu_to_le16(AR9170_TX_MAC_AGGR);
			arinfo->flags = AR9170_TX_FLAG_BLOCK_ACK;

			goto out;
		}

		txc->mac_control |= cpu_to_le16(AR9170_TX_MAC_RATE_PROBE);
		/*
		 * WARNING:
		 * Putting the QoS queue bits into an unexplored territory is
@@ -1431,12 +1418,17 @@ static int ar9170_tx_prepare(struct ar9170 *ar, struct sk_buff *skb)

		txc->phy_control |=
			cpu_to_le32(queue << AR9170_TX_PHY_QOS_SHIFT);
		arinfo->flags = AR9170_TX_FLAG_WAIT_FOR_ACK;

		if (info->flags & IEEE80211_TX_CTL_AMPDU) {
			if (unlikely(!info->control.sta))
				goto err_out;

			txc->mac_control |= cpu_to_le16(AR9170_TX_MAC_AGGR);
		} else {
		arinfo->flags = AR9170_TX_FLAG_NO_ACK;
			txc->mac_control |= cpu_to_le16(AR9170_TX_MAC_RATE_PROBE);
		}
	}

out:
	return 0;

err_out:
@@ -1671,7 +1663,6 @@ static bool ar9170_tx_ampdu(struct ar9170 *ar)
		 * tell the FW/HW that this is the last frame,
		 * that way it will wait for the immediate block ack.
		 */
		if (likely(skb_peek_tail(&agg)))
		ar9170_tx_indicate_immba(ar, skb_peek_tail(&agg));

#ifdef AR9170_TXAGG_DEBUG
@@ -1716,6 +1707,21 @@ static void ar9170_tx(struct ar9170 *ar)

	for (i = 0; i < __AR9170_NUM_TXQ; i++) {
		spin_lock_irqsave(&ar->tx_stats_lock, flags);
		frames = min(ar->tx_stats[i].limit - ar->tx_stats[i].len,
			     skb_queue_len(&ar->tx_pending[i]));

		if (remaining_space < frames) {
#ifdef AR9170_QUEUE_DEBUG
			printk(KERN_DEBUG "%s: tx quota reached queue:%d, "
			       "remaining slots:%d, needed:%d\n",
			       wiphy_name(ar->hw->wiphy), i, remaining_space,
			       frames);
#endif /* AR9170_QUEUE_DEBUG */
			frames = remaining_space;
		}

		ar->tx_stats[i].len += frames;
		ar->tx_stats[i].count += frames;
		if (ar->tx_stats[i].len >= ar->tx_stats[i].limit) {
#ifdef AR9170_QUEUE_DEBUG
			printk(KERN_DEBUG "%s: queue %d full\n",
@@ -1733,25 +1739,8 @@ static void ar9170_tx(struct ar9170 *ar)
			__ar9170_dump_txstats(ar);
#endif /* AR9170_QUEUE_STOP_DEBUG */
			ieee80211_stop_queue(ar->hw, i);
			spin_unlock_irqrestore(&ar->tx_stats_lock, flags);
			continue;
		}

		frames = min(ar->tx_stats[i].limit - ar->tx_stats[i].len,
			     skb_queue_len(&ar->tx_pending[i]));

		if (remaining_space < frames) {
#ifdef AR9170_QUEUE_DEBUG
			printk(KERN_DEBUG "%s: tx quota reached queue:%d, "
			       "remaining slots:%d, needed:%d\n",
			       wiphy_name(ar->hw->wiphy), i, remaining_space,
			       frames);
#endif /* AR9170_QUEUE_DEBUG */
			frames = remaining_space;
		}

		ar->tx_stats[i].len += frames;
		ar->tx_stats[i].count += frames;
		spin_unlock_irqrestore(&ar->tx_stats_lock, flags);

		if (!frames)
@@ -1773,7 +1762,7 @@ static void ar9170_tx(struct ar9170 *ar)
			arinfo->timeout = jiffies +
					  msecs_to_jiffies(AR9170_TX_TIMEOUT);

			if (arinfo->flags == AR9170_TX_FLAG_BLOCK_ACK)
			if (info->flags & IEEE80211_TX_CTL_AMPDU)
				atomic_inc(&ar->tx_ampdu_pending);

#ifdef AR9170_QUEUE_DEBUG
@@ -1784,7 +1773,7 @@ static void ar9170_tx(struct ar9170 *ar)

			err = ar->tx(ar, skb);
			if (unlikely(err)) {
				if (arinfo->flags == AR9170_TX_FLAG_BLOCK_ACK)
				if (info->flags & IEEE80211_TX_CTL_AMPDU)
					atomic_dec(&ar->tx_ampdu_pending);

				frames_failed++;
@@ -2366,7 +2355,6 @@ static void ar9170_sta_notify(struct ieee80211_hw *hw,
			sta_info->agg[i].state = AR9170_TID_STATE_SHUTDOWN;
			sta_info->agg[i].active = false;
			sta_info->agg[i].ssn = 0;
			sta_info->agg[i].retry = 0;
			sta_info->agg[i].tid = i;
			INIT_LIST_HEAD(&sta_info->agg[i].list);
			skb_queue_head_init(&sta_info->agg[i].queue);
Loading