aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/p54/p54common.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/p54/p54common.c')
-rw-r--r--drivers/net/wireless/p54/p54common.c51
1 files changed, 27 insertions, 24 deletions
diff --git a/drivers/net/wireless/p54/p54common.c b/drivers/net/wireless/p54/p54common.c
index 83cd85e1f847..29be3dc8ee09 100644
--- a/drivers/net/wireless/p54/p54common.c
+++ b/drivers/net/wireless/p54/p54common.c
@@ -413,12 +413,12 @@ static void p54_rx_frame_sent(struct ieee80211_hw *dev, struct sk_buff *skb)
413 last_addr = range->end_addr; 413 last_addr = range->end_addr;
414 __skb_unlink(entry, &priv->tx_queue); 414 __skb_unlink(entry, &priv->tx_queue);
415 memset(&info->status, 0, sizeof(info->status)); 415 memset(&info->status, 0, sizeof(info->status));
416 priv->tx_stats[skb_get_queue_mapping(skb)].len--;
417 entry_hdr = (struct p54_control_hdr *) entry->data; 416 entry_hdr = (struct p54_control_hdr *) entry->data;
418 entry_data = (struct p54_tx_control_allocdata *) entry_hdr->data; 417 entry_data = (struct p54_tx_control_allocdata *) entry_hdr->data;
419 if ((entry_hdr->magic1 & cpu_to_le16(0x4000)) != 0) 418 if ((entry_hdr->magic1 & cpu_to_le16(0x4000)) != 0)
420 pad = entry_data->align[0]; 419 pad = entry_data->align[0];
421 420
421 priv->tx_stats[entry_data->hw_queue - 4].len--;
422 if (!(info->flags & IEEE80211_TX_CTL_NO_ACK)) { 422 if (!(info->flags & IEEE80211_TX_CTL_NO_ACK)) {
423 if (!(payload->status & 0x01)) 423 if (!(payload->status & 0x01))
424 info->flags |= IEEE80211_TX_STAT_ACK; 424 info->flags |= IEEE80211_TX_STAT_ACK;
@@ -557,6 +557,7 @@ static int p54_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
557 struct p54_tx_control_allocdata *txhdr; 557 struct p54_tx_control_allocdata *txhdr;
558 size_t padding, len; 558 size_t padding, len;
559 u8 rate; 559 u8 rate;
560 u8 cts_rate = 0x20;
560 561
561 current_queue = &priv->tx_stats[skb_get_queue_mapping(skb)]; 562 current_queue = &priv->tx_stats[skb_get_queue_mapping(skb)];
562 if (unlikely(current_queue->len > current_queue->limit)) 563 if (unlikely(current_queue->len > current_queue->limit))
@@ -581,28 +582,28 @@ static int p54_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
581 hdr->type = (info->flags & IEEE80211_TX_CTL_NO_ACK) ? 0 : cpu_to_le16(1); 582 hdr->type = (info->flags & IEEE80211_TX_CTL_NO_ACK) ? 0 : cpu_to_le16(1);
582 hdr->retry1 = hdr->retry2 = info->control.retry_limit; 583 hdr->retry1 = hdr->retry2 = info->control.retry_limit;
583 584
584 memset(txhdr->wep_key, 0x0, 16);
585 txhdr->padding = 0;
586 txhdr->padding2 = 0;
587
588 /* TODO: add support for alternate retry TX rates */ 585 /* TODO: add support for alternate retry TX rates */
589 rate = ieee80211_get_tx_rate(dev, info)->hw_value; 586 rate = ieee80211_get_tx_rate(dev, info)->hw_value;
590 if (info->flags & IEEE80211_TX_CTL_SHORT_PREAMBLE) 587 if (info->flags & IEEE80211_TX_CTL_SHORT_PREAMBLE) {
591 rate |= 0x10; 588 rate |= 0x10;
592 if (info->flags & IEEE80211_TX_CTL_USE_RTS_CTS) 589 cts_rate |= 0x10;
590 }
591 if (info->flags & IEEE80211_TX_CTL_USE_RTS_CTS) {
593 rate |= 0x40; 592 rate |= 0x40;
594 else if (info->flags & IEEE80211_TX_CTL_USE_CTS_PROTECT) 593 cts_rate |= ieee80211_get_rts_cts_rate(dev, info)->hw_value;
594 } else if (info->flags & IEEE80211_TX_CTL_USE_CTS_PROTECT) {
595 rate |= 0x20; 595 rate |= 0x20;
596 cts_rate |= ieee80211_get_rts_cts_rate(dev, info)->hw_value;
597 }
596 memset(txhdr->rateset, rate, 8); 598 memset(txhdr->rateset, rate, 8);
597 txhdr->wep_key_present = 0; 599 txhdr->key_type = 0;
598 txhdr->wep_key_len = 0; 600 txhdr->key_len = 0;
599 txhdr->frame_type = cpu_to_le32(skb_get_queue_mapping(skb) + 4); 601 txhdr->hw_queue = skb_get_queue_mapping(skb) + 4;
600 txhdr->magic4 = 0; 602 txhdr->tx_antenna = (info->antenna_sel_tx == 0) ?
601 txhdr->antenna = (info->antenna_sel_tx == 0) ?
602 2 : info->antenna_sel_tx - 1; 603 2 : info->antenna_sel_tx - 1;
603 txhdr->output_power = 0x7f; // HW Maximum 604 txhdr->output_power = 0x7f; // HW Maximum
604 txhdr->magic5 = (info->flags & IEEE80211_TX_CTL_NO_ACK) ? 605 txhdr->cts_rate = (info->flags & IEEE80211_TX_CTL_NO_ACK) ?
605 0 : ((rate > 0x3) ? cpu_to_le32(0x33) : cpu_to_le32(0x23)); 606 0 : cts_rate;
606 if (padding) 607 if (padding)
607 txhdr->align[0] = padding; 608 txhdr->align[0] = padding;
608 609
@@ -836,10 +837,21 @@ static int p54_start(struct ieee80211_hw *dev)
836 struct p54_common *priv = dev->priv; 837 struct p54_common *priv = dev->priv;
837 int err; 838 int err;
838 839
840 if (!priv->cached_vdcf) {
841 priv->cached_vdcf = kzalloc(sizeof(struct p54_tx_control_vdcf)+
842 priv->tx_hdr_len + sizeof(struct p54_control_hdr),
843 GFP_KERNEL);
844
845 if (!priv->cached_vdcf)
846 return -ENOMEM;
847 }
848
839 err = priv->open(dev); 849 err = priv->open(dev);
840 if (!err) 850 if (!err)
841 priv->mode = IEEE80211_IF_TYPE_MNTR; 851 priv->mode = IEEE80211_IF_TYPE_MNTR;
842 852
853 p54_init_vdcf(dev);
854
843 return err; 855 return err;
844} 856}
845 857
@@ -1019,15 +1031,6 @@ struct ieee80211_hw *p54_init_common(size_t priv_data_len)
1019 dev->extra_tx_headroom = sizeof(struct p54_control_hdr) + 4 + 1031 dev->extra_tx_headroom = sizeof(struct p54_control_hdr) + 4 +
1020 sizeof(struct p54_tx_control_allocdata); 1032 sizeof(struct p54_tx_control_allocdata);
1021 1033
1022 priv->cached_vdcf = kzalloc(sizeof(struct p54_tx_control_vdcf) +
1023 priv->tx_hdr_len + sizeof(struct p54_control_hdr), GFP_KERNEL);
1024
1025 if (!priv->cached_vdcf) {
1026 ieee80211_free_hw(dev);
1027 return NULL;
1028 }
1029
1030 p54_init_vdcf(dev);
1031 mutex_init(&priv->conf_mutex); 1034 mutex_init(&priv->conf_mutex);
1032 1035
1033 return dev; 1036 return dev;