rt2x00: rt2800pci: move TX descriptor functions to the rt2800mmio module
Move the functions into a separate module, in order to make those usable from other modules. Also move the TX descriptor related defines from rt2800pci.h into rt2800mmio.h. Signed-off-by: Gabor Juhos <juhosg@openwrt.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:

committed by
John W. Linville

parent
45c67550ad
commit
0bc202b3bb
@@ -30,6 +30,74 @@
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/export.h>
|
||||
|
||||
#include "rt2x00.h"
|
||||
#include "rt2x00mmio.h"
|
||||
#include "rt2800mmio.h"
|
||||
|
||||
/*
|
||||
* TX descriptor initialization
|
||||
*/
|
||||
__le32 *rt2800mmio_get_txwi(struct queue_entry *entry)
|
||||
{
|
||||
return (__le32 *) entry->skb->data;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(rt2800mmio_get_txwi);
|
||||
|
||||
void rt2800mmio_write_tx_desc(struct queue_entry *entry,
|
||||
struct txentry_desc *txdesc)
|
||||
{
|
||||
struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb);
|
||||
struct queue_entry_priv_mmio *entry_priv = entry->priv_data;
|
||||
__le32 *txd = entry_priv->desc;
|
||||
u32 word;
|
||||
const unsigned int txwi_size = entry->queue->winfo_size;
|
||||
|
||||
/*
|
||||
* The buffers pointed by SD_PTR0/SD_LEN0 and SD_PTR1/SD_LEN1
|
||||
* must contains a TXWI structure + 802.11 header + padding + 802.11
|
||||
* data. We choose to have SD_PTR0/SD_LEN0 only contains TXWI and
|
||||
* SD_PTR1/SD_LEN1 contains 802.11 header + padding + 802.11
|
||||
* data. It means that LAST_SEC0 is always 0.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Initialize TX descriptor
|
||||
*/
|
||||
word = 0;
|
||||
rt2x00_set_field32(&word, TXD_W0_SD_PTR0, skbdesc->skb_dma);
|
||||
rt2x00_desc_write(txd, 0, word);
|
||||
|
||||
word = 0;
|
||||
rt2x00_set_field32(&word, TXD_W1_SD_LEN1, entry->skb->len);
|
||||
rt2x00_set_field32(&word, TXD_W1_LAST_SEC1,
|
||||
!test_bit(ENTRY_TXD_MORE_FRAG, &txdesc->flags));
|
||||
rt2x00_set_field32(&word, TXD_W1_BURST,
|
||||
test_bit(ENTRY_TXD_BURST, &txdesc->flags));
|
||||
rt2x00_set_field32(&word, TXD_W1_SD_LEN0, txwi_size);
|
||||
rt2x00_set_field32(&word, TXD_W1_LAST_SEC0, 0);
|
||||
rt2x00_set_field32(&word, TXD_W1_DMA_DONE, 0);
|
||||
rt2x00_desc_write(txd, 1, word);
|
||||
|
||||
word = 0;
|
||||
rt2x00_set_field32(&word, TXD_W2_SD_PTR1,
|
||||
skbdesc->skb_dma + txwi_size);
|
||||
rt2x00_desc_write(txd, 2, word);
|
||||
|
||||
word = 0;
|
||||
rt2x00_set_field32(&word, TXD_W3_WIV,
|
||||
!test_bit(ENTRY_TXD_ENCRYPT_IV, &txdesc->flags));
|
||||
rt2x00_set_field32(&word, TXD_W3_QSEL, 2);
|
||||
rt2x00_desc_write(txd, 3, word);
|
||||
|
||||
/*
|
||||
* Register descriptor details in skb frame descriptor.
|
||||
*/
|
||||
skbdesc->desc = txd;
|
||||
skbdesc->desc_len = TXD_DESC_SIZE;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(rt2800mmio_write_tx_desc);
|
||||
|
||||
#include "rt2x00.h"
|
||||
|
||||
|
Reference in New Issue
Block a user