]> err.no Git - linux-2.6/blobdiff - drivers/net/wireless/rt2x00/rt2x00dev.c
rt2x00: Split rt2x00lib_write_tx_desc()
[linux-2.6] / drivers / net / wireless / rt2x00 / rt2x00dev.c
index 46c377873f163ac2af548213b5509008ae514904..171f445962dbd21178d4ef9b32d3e01b6c4c6abf 100644 (file)
@@ -611,154 +611,6 @@ void rt2x00lib_rxdone(struct queue_entry *entry,
 }
 EXPORT_SYMBOL_GPL(rt2x00lib_rxdone);
 
-/*
- * TX descriptor initializer
- */
-void rt2x00lib_write_tx_desc(struct rt2x00_dev *rt2x00dev,
-                            struct sk_buff *skb,
-                            struct ieee80211_tx_control *control)
-{
-       struct txentry_desc txdesc;
-       struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb);
-       struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skbdesc->data;
-       const struct rt2x00_rate *rate;
-       int tx_rate;
-       int length;
-       int duration;
-       int residual;
-       u16 frame_control;
-       u16 seq_ctrl;
-
-       memset(&txdesc, 0, sizeof(txdesc));
-
-       txdesc.queue = skbdesc->entry->queue->qid;
-       txdesc.cw_min = skbdesc->entry->queue->cw_min;
-       txdesc.cw_max = skbdesc->entry->queue->cw_max;
-       txdesc.aifs = skbdesc->entry->queue->aifs;
-
-       /*
-        * Read required fields from ieee80211 header.
-        */
-       frame_control = le16_to_cpu(hdr->frame_control);
-       seq_ctrl = le16_to_cpu(hdr->seq_ctrl);
-
-       tx_rate = control->tx_rate->hw_value;
-
-       /*
-        * Check whether this frame is to be acked
-        */
-       if (!(control->flags & IEEE80211_TXCTL_NO_ACK))
-               __set_bit(ENTRY_TXD_ACK, &txdesc.flags);
-
-       /*
-        * Check if this is a RTS/CTS frame
-        */
-       if (is_rts_frame(frame_control) || is_cts_frame(frame_control)) {
-               __set_bit(ENTRY_TXD_BURST, &txdesc.flags);
-               if (is_rts_frame(frame_control)) {
-                       __set_bit(ENTRY_TXD_RTS_FRAME, &txdesc.flags);
-                       __set_bit(ENTRY_TXD_ACK, &txdesc.flags);
-               } else
-                       __clear_bit(ENTRY_TXD_ACK, &txdesc.flags);
-               if (control->rts_cts_rate)
-                       tx_rate = control->rts_cts_rate->hw_value;
-       }
-
-       /*
-        * Determine retry information.
-        */
-       txdesc.retry_limit = control->retry_limit;
-       if (control->flags & IEEE80211_TXCTL_LONG_RETRY_LIMIT)
-               __set_bit(ENTRY_TXD_RETRY_MODE, &txdesc.flags);
-
-       /*
-        * Check if more fragments are pending
-        */
-       if (ieee80211_get_morefrag(hdr)) {
-               __set_bit(ENTRY_TXD_BURST, &txdesc.flags);
-               __set_bit(ENTRY_TXD_MORE_FRAG, &txdesc.flags);
-       }
-
-       /*
-        * Beacons and probe responses require the tsf timestamp
-        * to be inserted into the frame.
-        */
-       if (txdesc.queue == QID_BEACON || is_probe_resp(frame_control))
-               __set_bit(ENTRY_TXD_REQ_TIMESTAMP, &txdesc.flags);
-
-       /*
-        * Determine with what IFS priority this frame should be send.
-        * Set ifs to IFS_SIFS when the this is not the first fragment,
-        * or this fragment came after RTS/CTS.
-        */
-       if (test_bit(ENTRY_TXD_RTS_FRAME, &txdesc.flags)) {
-               txdesc.ifs = IFS_SIFS;
-       } else if (control->flags & IEEE80211_TXCTL_FIRST_FRAGMENT) {
-               __set_bit(ENTRY_TXD_FIRST_FRAGMENT, &txdesc.flags);
-               txdesc.ifs = IFS_BACKOFF;
-       } else {
-               txdesc.ifs = IFS_SIFS;
-       }
-
-       /*
-        * PLCP setup
-        * Length calculation depends on OFDM/CCK rate.
-        */
-       rate = rt2x00_get_rate(tx_rate);
-       txdesc.signal = rate->plcp;
-       txdesc.service = 0x04;
-
-       length = skbdesc->data_len + FCS_LEN;
-       if (rate->flags & DEV_RATE_OFDM) {
-               __set_bit(ENTRY_TXD_OFDM_RATE, &txdesc.flags);
-
-               txdesc.length_high = (length >> 6) & 0x3f;
-               txdesc.length_low = length & 0x3f;
-       } else {
-               /*
-                * Convert length to microseconds.
-                */
-               residual = get_duration_res(length, rate->bitrate);
-               duration = get_duration(length, rate->bitrate);
-
-               if (residual != 0) {
-                       duration++;
-
-                       /*
-                        * Check if we need to set the Length Extension
-                        */
-                       if (rate->bitrate == 110 && residual <= 30)
-                               txdesc.service |= 0x80;
-               }
-
-               txdesc.length_high = (duration >> 8) & 0xff;
-               txdesc.length_low = duration & 0xff;
-
-               /*
-                * When preamble is enabled we should set the
-                * preamble bit for the signal.
-                */
-               if (rt2x00_get_rate_preamble(tx_rate))
-                       txdesc.signal |= 0x08;
-       }
-
-       rt2x00dev->ops->lib->write_tx_desc(rt2x00dev, skb, &txdesc);
-
-       /*
-        * Update queue entry.
-        */
-       skbdesc->entry->skb = skb;
-
-       /*
-        * The frame has been completely initialized and ready
-        * for sending to the device. The caller will push the
-        * frame to the device, but we are going to push the
-        * frame to debugfs here.
-        */
-       rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_TX, skb);
-}
-EXPORT_SYMBOL_GPL(rt2x00lib_write_tx_desc);
-
 /*
  * Driver initialization handlers.
  */