diff options
Diffstat (limited to 'drivers/net/wireless/p54')
-rw-r--r-- | drivers/net/wireless/p54/p54common.c | 51 | ||||
-rw-r--r-- | drivers/net/wireless/p54/p54common.h | 18 | ||||
-rw-r--r-- | drivers/net/wireless/p54/p54usb.c | 10 |
3 files changed, 46 insertions, 33 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; |
diff --git a/drivers/net/wireless/p54/p54common.h b/drivers/net/wireless/p54/p54common.h index 2245fcce92dc..8db6c0e8e540 100644 --- a/drivers/net/wireless/p54/p54common.h +++ b/drivers/net/wireless/p54/p54common.h | |||
@@ -183,16 +183,16 @@ struct p54_frame_sent_hdr { | |||
183 | 183 | ||
184 | struct p54_tx_control_allocdata { | 184 | struct p54_tx_control_allocdata { |
185 | u8 rateset[8]; | 185 | u8 rateset[8]; |
186 | u16 padding; | 186 | u8 unalloc0[2]; |
187 | u8 wep_key_present; | 187 | u8 key_type; |
188 | u8 wep_key_len; | 188 | u8 key_len; |
189 | u8 wep_key[16]; | 189 | u8 key[16]; |
190 | __le32 frame_type; | 190 | u8 hw_queue; |
191 | u32 padding2; | 191 | u8 unalloc1[9]; |
192 | __le16 magic4; | 192 | u8 tx_antenna; |
193 | u8 antenna; | ||
194 | u8 output_power; | 193 | u8 output_power; |
195 | __le32 magic5; | 194 | u8 cts_rate; |
195 | u8 unalloc2[3]; | ||
196 | u8 align[0]; | 196 | u8 align[0]; |
197 | } __attribute__ ((packed)); | 197 | } __attribute__ ((packed)); |
198 | 198 | ||
diff --git a/drivers/net/wireless/p54/p54usb.c b/drivers/net/wireless/p54/p54usb.c index 815c095ef797..cbaca23a9453 100644 --- a/drivers/net/wireless/p54/p54usb.c +++ b/drivers/net/wireless/p54/p54usb.c | |||
@@ -109,7 +109,17 @@ static void p54u_rx_cb(struct urb *urb) | |||
109 | urb->context = skb; | 109 | urb->context = skb; |
110 | skb_queue_tail(&priv->rx_queue, skb); | 110 | skb_queue_tail(&priv->rx_queue, skb); |
111 | } else { | 111 | } else { |
112 | if (!priv->hw_type) | ||
113 | skb_push(skb, sizeof(struct net2280_tx_hdr)); | ||
114 | |||
115 | skb_reset_tail_pointer(skb); | ||
112 | skb_trim(skb, 0); | 116 | skb_trim(skb, 0); |
117 | if (urb->transfer_buffer != skb_tail_pointer(skb)) { | ||
118 | /* this should not happen */ | ||
119 | WARN_ON(1); | ||
120 | urb->transfer_buffer = skb_tail_pointer(skb); | ||
121 | } | ||
122 | |||
113 | skb_queue_tail(&priv->rx_queue, skb); | 123 | skb_queue_tail(&priv->rx_queue, skb); |
114 | } | 124 | } |
115 | 125 | ||