aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt2x00dev.c
diff options
context:
space:
mode:
authorIvo van Doorn <IvDoorn@gmail.com>2008-01-24 04:56:25 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:05:07 -0500
commit08992f7fb139c7dbaf593402312ee5a055352f05 (patch)
treecfa1459e4940cf493438a3db950b5339dae4ca88 /drivers/net/wireless/rt2x00/rt2x00dev.c
parent22c96c28b47ce74d78aad1afbed88b26f43ce24b (diff)
rt2x00: Add skb descriptor
Use the skb->cb field to add a frame description that can be used to transfer information passed each rt2x00 layer. This reduces the required arguments for rt2x00lib_write_tx_desc(). Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2x00dev.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00dev.c47
1 files changed, 22 insertions, 25 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c
index e8949785c662..4f32ee8f4cb7 100644
--- a/drivers/net/wireless/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
@@ -573,36 +573,26 @@ EXPORT_SYMBOL_GPL(rt2x00lib_rxdone);
573 * TX descriptor initializer 573 * TX descriptor initializer
574 */ 574 */
575void rt2x00lib_write_tx_desc(struct rt2x00_dev *rt2x00dev, 575void rt2x00lib_write_tx_desc(struct rt2x00_dev *rt2x00dev,
576 __le32 *txd, 576 struct sk_buff *skb,
577 struct ieee80211_hdr *ieee80211hdr,
578 unsigned int length,
579 struct ieee80211_tx_control *control) 577 struct ieee80211_tx_control *control)
580{ 578{
581 struct txdata_entry_desc desc; 579 struct txdata_entry_desc desc;
582 struct data_ring *ring; 580 struct skb_desc *skbdesc = get_skb_desc(skb);
581 struct ieee80211_hdr *ieee80211hdr = skbdesc->data;
582 __le32 *txd = skbdesc->desc;
583 int tx_rate; 583 int tx_rate;
584 int bitrate; 584 int bitrate;
585 int length;
585 int duration; 586 int duration;
586 int residual; 587 int residual;
587 u16 frame_control; 588 u16 frame_control;
588 u16 seq_ctrl; 589 u16 seq_ctrl;
589 590
590 /* 591 memset(&desc, 0, sizeof(desc));
591 * Make sure the descriptor is properly cleared.
592 */
593 memset(&desc, 0x00, sizeof(desc));
594 592
595 /* 593 desc.cw_min = skbdesc->ring->tx_params.cw_min;
596 * Get ring pointer, if we fail to obtain the 594 desc.cw_max = skbdesc->ring->tx_params.cw_max;
597 * correct ring, then use the first TX ring. 595 desc.aifs = skbdesc->ring->tx_params.aifs;
598 */
599 ring = rt2x00lib_get_ring(rt2x00dev, control->queue);
600 if (!ring)
601 ring = rt2x00lib_get_ring(rt2x00dev, IEEE80211_TX_QUEUE_DATA0);
602
603 desc.cw_min = ring->tx_params.cw_min;
604 desc.cw_max = ring->tx_params.cw_max;
605 desc.aifs = ring->tx_params.aifs;
606 596
607 /* 597 /*
608 * Identify queue 598 * Identify queue
@@ -683,17 +673,18 @@ void rt2x00lib_write_tx_desc(struct rt2x00_dev *rt2x00dev,
683 desc.signal = DEVICE_GET_RATE_FIELD(tx_rate, PLCP); 673 desc.signal = DEVICE_GET_RATE_FIELD(tx_rate, PLCP);
684 desc.service = 0x04; 674 desc.service = 0x04;
685 675
676 length = skbdesc->data_len + FCS_LEN;
686 if (test_bit(ENTRY_TXD_OFDM_RATE, &desc.flags)) { 677 if (test_bit(ENTRY_TXD_OFDM_RATE, &desc.flags)) {
687 desc.length_high = ((length + FCS_LEN) >> 6) & 0x3f; 678 desc.length_high = (length >> 6) & 0x3f;
688 desc.length_low = ((length + FCS_LEN) & 0x3f); 679 desc.length_low = length & 0x3f;
689 } else { 680 } else {
690 bitrate = DEVICE_GET_RATE_FIELD(tx_rate, RATE); 681 bitrate = DEVICE_GET_RATE_FIELD(tx_rate, RATE);
691 682
692 /* 683 /*
693 * Convert length to microseconds. 684 * Convert length to microseconds.
694 */ 685 */
695 residual = get_duration_res(length + FCS_LEN, bitrate); 686 residual = get_duration_res(length, bitrate);
696 duration = get_duration(length + FCS_LEN, bitrate); 687 duration = get_duration(length, bitrate);
697 688
698 if (residual != 0) { 689 if (residual != 0) {
699 duration++; 690 duration++;
@@ -716,8 +707,14 @@ void rt2x00lib_write_tx_desc(struct rt2x00_dev *rt2x00dev,
716 desc.signal |= 0x08; 707 desc.signal |= 0x08;
717 } 708 }
718 709
719 rt2x00dev->ops->lib->write_tx_desc(rt2x00dev, txd, &desc, 710 rt2x00dev->ops->lib->write_tx_desc(rt2x00dev, txd, &desc, ieee80211hdr,
720 ieee80211hdr, length, control); 711 skbdesc->data_len, control);
712
713 /*
714 * Update ring entry.
715 */
716 skbdesc->entry->skb = skb;
717 memcpy(&skbdesc->entry->tx_status.control, control, sizeof(*control));
721} 718}
722EXPORT_SYMBOL_GPL(rt2x00lib_write_tx_desc); 719EXPORT_SYMBOL_GPL(rt2x00lib_write_tx_desc);
723 720