Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 102715
b: refs/heads/master
c: 7050ec8
h: refs/heads/master
i:
  102713: 0394ea7
  102711: c1b45af
v: v3
  • Loading branch information
Ivo van Doorn authored and John W. Linville committed May 22, 2008
1 parent 7da6d01 commit bcb530d
Show file tree
Hide file tree
Showing 12 changed files with 266 additions and 164 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4de36fe5abe077a4c65bf0b6a309865aa043e055
refs/heads/master: 7050ec821c52826b63835dde54ee3d71c7db4262
11 changes: 10 additions & 1 deletion trunk/drivers/net/wireless/rt2x00/rt2400pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -1492,12 +1492,21 @@ static int rt2400pci_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb,
struct rt2x00_intf *intf = vif_to_intf(control->vif);
struct queue_entry_priv_pci_tx *priv_tx;
struct skb_frame_desc *skbdesc;
struct txentry_desc txdesc;
u32 reg;

if (unlikely(!intf->beacon))
return -ENOBUFS;
priv_tx = intf->beacon->priv_data;

/*
* Copy all TX descriptor information into txdesc,
* after that we are free to use the skb->cb array
* for our information.
*/
intf->beacon->skb = skb;
rt2x00queue_create_tx_descriptor(intf->beacon, &txdesc, control);

/*
* Fill in skb descriptor
*/
Expand Down Expand Up @@ -1525,8 +1534,8 @@ static int rt2400pci_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb,
* Write entire beacon with descriptor to register,
* and kick the beacon generator.
*/
rt2x00lib_write_tx_desc(rt2x00dev, skb, control);
memcpy(priv_tx->data, skb->data, skb->len);
rt2x00queue_write_tx_descriptor(intf->beacon, &txdesc);
rt2x00dev->ops->lib->kick_tx_queue(rt2x00dev, QID_BEACON);

return 0;
Expand Down
11 changes: 10 additions & 1 deletion trunk/drivers/net/wireless/rt2x00/rt2500pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -1808,13 +1808,22 @@ static int rt2500pci_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb,
struct rt2x00_intf *intf = vif_to_intf(control->vif);
struct queue_entry_priv_pci_tx *priv_tx;
struct skb_frame_desc *skbdesc;
struct txentry_desc txdesc;
u32 reg;

if (unlikely(!intf->beacon))
return -ENOBUFS;

priv_tx = intf->beacon->priv_data;

/*
* Copy all TX descriptor information into txdesc,
* after that we are free to use the skb->cb array
* for our information.
*/
intf->beacon->skb = skb;
rt2x00queue_create_tx_descriptor(intf->beacon, &txdesc, control);

/*
* Fill in skb descriptor
*/
Expand Down Expand Up @@ -1842,8 +1851,8 @@ static int rt2500pci_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb,
* Write entire beacon with descriptor to register,
* and kick the beacon generator.
*/
rt2x00lib_write_tx_desc(rt2x00dev, skb, control);
memcpy(priv_tx->data, skb->data, skb->len);
rt2x00queue_write_tx_descriptor(intf->beacon, &txdesc);
rt2x00dev->ops->lib->kick_tx_queue(rt2x00dev, QID_BEACON);

return 0;
Expand Down
11 changes: 10 additions & 1 deletion trunk/drivers/net/wireless/rt2x00/rt2500usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1676,6 +1676,7 @@ static int rt2500usb_beacon_update(struct ieee80211_hw *hw,
struct rt2x00_intf *intf = vif_to_intf(control->vif);
struct queue_entry_priv_usb_bcn *priv_bcn;
struct skb_frame_desc *skbdesc;
struct txentry_desc txdesc;
int pipe = usb_sndbulkpipe(usb_dev, 1);
int length;
u16 reg;
Expand All @@ -1685,6 +1686,14 @@ static int rt2500usb_beacon_update(struct ieee80211_hw *hw,

priv_bcn = intf->beacon->priv_data;

/*
* Copy all TX descriptor information into txdesc,
* after that we are free to use the skb->cb array
* for our information.
*/
intf->beacon->skb = skb;
rt2x00queue_create_tx_descriptor(intf->beacon, &txdesc, control);

/*
* Add the descriptor in front of the skb.
*/
Expand Down Expand Up @@ -1713,7 +1722,7 @@ static int rt2500usb_beacon_update(struct ieee80211_hw *hw,
rt2x00_set_field16(&reg, TXRX_CSR19_BEACON_GEN, 0);
rt2500usb_register_write(rt2x00dev, TXRX_CSR19, reg);

rt2x00lib_write_tx_desc(rt2x00dev, skb, control);
rt2x00queue_write_tx_descriptor(intf->beacon, &txdesc);

/*
* USB devices cannot blindly pass the skb->len as the
Expand Down
42 changes: 35 additions & 7 deletions trunk/drivers/net/wireless/rt2x00/rt2x00.h
Original file line number Diff line number Diff line change
Expand Up @@ -926,6 +926,41 @@ static inline u16 get_duration_res(const unsigned int size, const u8 rate)
return ((size * 8 * 10) % rate);
}

/**
* rt2x00queue_create_tx_descriptor - Create TX descriptor from mac80211 input
* @entry: The entry which will be used to transfer the TX frame.
* @txdesc: rt2x00 TX descriptor which will be initialized by this function.
* @control: mac80211 TX control structure from where we read the information.
*
* This function will initialize the &struct txentry_desc based on information
* from mac80211. This descriptor can then be used by rt2x00lib and the drivers
* to correctly initialize the hardware descriptor.
* Note that before calling this function the skb->cb array must be untouched
* by rt2x00lib. Only after this function completes will it be save to
* overwrite the skb->cb information.
* The reason for this is that mac80211 writes its own tx information into
* the skb->cb array, and this function will use that information to initialize
* the &struct txentry_desc structure.
*/
void rt2x00queue_create_tx_descriptor(struct queue_entry *entry,
struct txentry_desc *txdesc,
struct ieee80211_tx_control *control);

/**
* rt2x00queue_write_tx_descriptor - Write TX descriptor to hardware
* @entry: The entry which will be used to transfer the TX frame.
* @txdesc: TX descriptor which will be used to write hardware descriptor
*
* This function will write a TX descriptor initialized by
* &rt2x00queue_create_tx_descriptor to the hardware. After this call
* has completed the frame is now owned by the hardware, the hardware
* queue will have automatically be kicked unless this frame was generated
* by rt2x00lib, in which case the frame is "special" and must be kicked
* by the caller.
*/
void rt2x00queue_write_tx_descriptor(struct queue_entry *entry,
struct txentry_desc *txdesc);

/**
* rt2x00queue_get_queue - Convert queue index to queue pointer
* @rt2x00dev: Pointer to &struct rt2x00_dev.
Expand Down Expand Up @@ -963,13 +998,6 @@ void rt2x00lib_txdone(struct queue_entry *entry,
void rt2x00lib_rxdone(struct queue_entry *entry,
struct rxdone_entry_desc *rxdesc);

/*
* TX descriptor initializer
*/
void rt2x00lib_write_tx_desc(struct rt2x00_dev *rt2x00dev,
struct sk_buff *skb,
struct ieee80211_tx_control *control);

/*
* mac80211 handlers.
*/
Expand Down
148 changes: 0 additions & 148 deletions trunk/drivers/net/wireless/rt2x00/rt2x00dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down
11 changes: 10 additions & 1 deletion trunk/drivers/net/wireless/rt2x00/rt2x00pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ int rt2x00pci_write_tx_data(struct rt2x00_dev *rt2x00dev,
struct queue_entry *entry = rt2x00queue_get_entry(queue, Q_INDEX);
struct queue_entry_priv_pci_tx *priv_tx = entry->priv_data;
struct skb_frame_desc *skbdesc;
struct txentry_desc txdesc;
u32 word;

if (rt2x00queue_full(queue))
Expand All @@ -57,6 +58,14 @@ int rt2x00pci_write_tx_data(struct rt2x00_dev *rt2x00dev,
return -EINVAL;
}

/*
* Copy all TX descriptor information into txdesc,
* after that we are free to use the skb->cb array
* for our information.
*/
entry->skb = skb;
rt2x00queue_create_tx_descriptor(entry, &txdesc, control);

/*
* Fill in skb descriptor
*/
Expand All @@ -69,8 +78,8 @@ int rt2x00pci_write_tx_data(struct rt2x00_dev *rt2x00dev,

memcpy(&priv_tx->control, control, sizeof(priv_tx->control));
memcpy(priv_tx->data, skb->data, skb->len);
rt2x00lib_write_tx_desc(rt2x00dev, skb, control);

rt2x00queue_write_tx_descriptor(entry, &txdesc);
rt2x00queue_index_inc(queue, Q_INDEX);

return 0;
Expand Down
Loading

0 comments on commit bcb530d

Please sign in to comment.