Skip to content

Commit

Permalink
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/gi…
Browse files Browse the repository at this point in the history
…t/linville/wireless-next-2.6
  • Loading branch information
David S. Miller committed Dec 26, 2009
2 parents d87fd25 + b6ce5c3 commit d346f49
Show file tree
Hide file tree
Showing 117 changed files with 2,965 additions and 1,122 deletions.
24 changes: 24 additions & 0 deletions Documentation/networking/regulatory.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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_.
9 changes: 2 additions & 7 deletions drivers/net/wireless/ath/ar9170/ar9170.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -143,7 +142,6 @@ struct ar9170_sta_tid {
u16 tid;
enum ar9170_tid_state state;
bool active;
u8 retry;
};

#define AR9170_QUEUE_TIMEOUT 64
Expand All @@ -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;
Expand Down Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions drivers/net/wireless/ath/ar9170/hw.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/wireless/ath/ar9170/mac.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
102 changes: 45 additions & 57 deletions drivers/net/wireless/ath/ar9170/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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));
}
Expand Down Expand Up @@ -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);
Expand All @@ -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) {
ar9170_tx_ampdu_callback(ar, skb);
} else if (arinfo->flags & AR9170_TX_FLAG_WAIT_FOR_ACK) {
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) {
if (info->flags & IEEE80211_TX_CTL_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 (info->flags & IEEE80211_TX_CTL_AMPDU) {
ar9170_tx_ampdu_callback(ar, skb);
} else {
arinfo->timeout = jiffies +
msecs_to_jiffies(AR9170_TX_TIMEOUT);

skb_queue_tail(&ar->tx_status[queue], skb);
}
}

if (!ar->tx_stats[queue].len &&
Expand Down Expand Up @@ -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
Expand All @@ -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;
} else {
arinfo->flags = AR9170_TX_FLAG_NO_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 {
txc->mac_control |= cpu_to_le16(AR9170_TX_MAC_RATE_PROBE);
}
}

out:
return 0;

err_out:
Expand Down Expand Up @@ -1671,8 +1663,7 @@ 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));
ar9170_tx_indicate_immba(ar, skb_peek_tail(&agg));

#ifdef AR9170_TXAGG_DEBUG
printk(KERN_DEBUG "%s: generated A-MPDU looks like this:\n",
Expand Down Expand Up @@ -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",
Expand All @@ -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)
Expand All @@ -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
Expand All @@ -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++;
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions drivers/net/wireless/ath/ar9170/usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ static struct usb_device_id ar9170_usb_ids[] = {
{ USB_DEVICE(0x0cde, 0x0023) },
/* Z-Com UB82 ABG */
{ USB_DEVICE(0x0cde, 0x0026) },
/* Sphairon Homelink 1202 */
{ USB_DEVICE(0x0cde, 0x0027) },
/* Arcadyan WN7512 */
{ USB_DEVICE(0x083a, 0xf522) },
/* Planex GWUS300 */
Expand Down
1 change: 0 additions & 1 deletion drivers/net/wireless/ath/ath9k/ath9k.h
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,6 @@ struct ath_softc {
int irq;
spinlock_t sc_resetlock;
spinlock_t sc_serial_rw;
spinlock_t ani_lock;
spinlock_t sc_pm_lock;
struct mutex mutex;

Expand Down
38 changes: 32 additions & 6 deletions drivers/net/wireless/ath/ath9k/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -289,23 +289,49 @@ static ssize_t read_file_rcstat(struct file *file, char __user *user_buf,
if (sc->cur_rate_table == NULL)
return 0;

max = 80 + sc->cur_rate_table->rate_cnt * 64;
max = 80 + sc->cur_rate_table->rate_cnt * 1024;
buf = kmalloc(max + 1, GFP_KERNEL);
if (buf == NULL)
return 0;
buf[max] = 0;

len += sprintf(buf, "%5s %15s %8s %9s %3s\n\n", "Rate", "Success",
"Retries", "XRetries", "PER");
len += sprintf(buf, "%6s %6s %6s "
"%10s %10s %10s %10s\n",
"HT", "MCS", "Rate",
"Success", "Retries", "XRetries", "PER");

for (i = 0; i < sc->cur_rate_table->rate_cnt; i++) {
u32 ratekbps = sc->cur_rate_table->info[i].ratekbps;
struct ath_rc_stats *stats = &sc->debug.stats.rcstats[i];
char mcs[5];
char htmode[5];
int used_mcs = 0, used_htmode = 0;

if (WLAN_RC_PHY_HT(sc->cur_rate_table->info[i].phy)) {
used_mcs = snprintf(mcs, 5, "%d",
sc->cur_rate_table->info[i].ratecode);

if (WLAN_RC_PHY_40(sc->cur_rate_table->info[i].phy))
used_htmode = snprintf(htmode, 5, "HT40");
else if (WLAN_RC_PHY_20(sc->cur_rate_table->info[i].phy))
used_htmode = snprintf(htmode, 5, "HT20");
else
used_htmode = snprintf(htmode, 5, "????");
}

mcs[used_mcs] = '\0';
htmode[used_htmode] = '\0';

len += snprintf(buf + len, max - len,
"%3u.%d: %8u %8u %8u %8u\n", ratekbps / 1000,
(ratekbps % 1000) / 100, stats->success,
stats->retries, stats->xretries,
"%6s %6s %3u.%d: "
"%10u %10u %10u %10u\n",
htmode,
mcs,
ratekbps / 1000,
(ratekbps % 1000) / 100,
stats->success,
stats->retries,
stats->xretries,
stats->per);
}

Expand Down
Loading

0 comments on commit d346f49

Please sign in to comment.