rt2x00: Merge PCI and USB versions of write_tx_data into single function.
Now that rt2x00pci_write_tx_data and rt2x00usb_write_tx_data are similar we can merge them in a single function in rt2x00queue.c. Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com> Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
parent
fe7256971f
commit
78eea11b0e
@ -1588,7 +1588,6 @@ static const struct rt2x00lib_ops rt2400pci_rt2x00_ops = {
|
|||||||
.reset_tuner = rt2400pci_reset_tuner,
|
.reset_tuner = rt2400pci_reset_tuner,
|
||||||
.link_tuner = rt2400pci_link_tuner,
|
.link_tuner = rt2400pci_link_tuner,
|
||||||
.write_tx_desc = rt2400pci_write_tx_desc,
|
.write_tx_desc = rt2400pci_write_tx_desc,
|
||||||
.write_tx_data = rt2x00pci_write_tx_data,
|
|
||||||
.write_beacon = rt2400pci_write_beacon,
|
.write_beacon = rt2400pci_write_beacon,
|
||||||
.kick_tx_queue = rt2400pci_kick_tx_queue,
|
.kick_tx_queue = rt2400pci_kick_tx_queue,
|
||||||
.kill_tx_queue = rt2400pci_kill_tx_queue,
|
.kill_tx_queue = rt2400pci_kill_tx_queue,
|
||||||
|
@ -1886,7 +1886,6 @@ static const struct rt2x00lib_ops rt2500pci_rt2x00_ops = {
|
|||||||
.reset_tuner = rt2500pci_reset_tuner,
|
.reset_tuner = rt2500pci_reset_tuner,
|
||||||
.link_tuner = rt2500pci_link_tuner,
|
.link_tuner = rt2500pci_link_tuner,
|
||||||
.write_tx_desc = rt2500pci_write_tx_desc,
|
.write_tx_desc = rt2500pci_write_tx_desc,
|
||||||
.write_tx_data = rt2x00pci_write_tx_data,
|
|
||||||
.write_beacon = rt2500pci_write_beacon,
|
.write_beacon = rt2500pci_write_beacon,
|
||||||
.kick_tx_queue = rt2500pci_kick_tx_queue,
|
.kick_tx_queue = rt2500pci_kick_tx_queue,
|
||||||
.kill_tx_queue = rt2500pci_kill_tx_queue,
|
.kill_tx_queue = rt2500pci_kill_tx_queue,
|
||||||
|
@ -1779,7 +1779,6 @@ static const struct rt2x00lib_ops rt2500usb_rt2x00_ops = {
|
|||||||
.link_stats = rt2500usb_link_stats,
|
.link_stats = rt2500usb_link_stats,
|
||||||
.reset_tuner = rt2500usb_reset_tuner,
|
.reset_tuner = rt2500usb_reset_tuner,
|
||||||
.write_tx_desc = rt2500usb_write_tx_desc,
|
.write_tx_desc = rt2500usb_write_tx_desc,
|
||||||
.write_tx_data = rt2x00usb_write_tx_data,
|
|
||||||
.write_beacon = rt2500usb_write_beacon,
|
.write_beacon = rt2500usb_write_beacon,
|
||||||
.get_tx_data_len = rt2500usb_get_tx_data_len,
|
.get_tx_data_len = rt2500usb_get_tx_data_len,
|
||||||
.kick_tx_queue = rt2x00usb_kick_tx_queue,
|
.kick_tx_queue = rt2x00usb_kick_tx_queue,
|
||||||
|
@ -1044,7 +1044,6 @@ static const struct rt2x00lib_ops rt2800pci_rt2x00_ops = {
|
|||||||
.reset_tuner = rt2800_reset_tuner,
|
.reset_tuner = rt2800_reset_tuner,
|
||||||
.link_tuner = rt2800_link_tuner,
|
.link_tuner = rt2800_link_tuner,
|
||||||
.write_tx_desc = rt2800pci_write_tx_desc,
|
.write_tx_desc = rt2800pci_write_tx_desc,
|
||||||
.write_tx_data = rt2x00pci_write_tx_data,
|
|
||||||
.write_tx_datadesc = rt2800pci_write_tx_datadesc,
|
.write_tx_datadesc = rt2800pci_write_tx_datadesc,
|
||||||
.write_beacon = rt2800_write_beacon,
|
.write_beacon = rt2800_write_beacon,
|
||||||
.kick_tx_queue = rt2800pci_kick_tx_queue,
|
.kick_tx_queue = rt2800pci_kick_tx_queue,
|
||||||
|
@ -652,7 +652,6 @@ static const struct rt2x00lib_ops rt2800usb_rt2x00_ops = {
|
|||||||
.reset_tuner = rt2800_reset_tuner,
|
.reset_tuner = rt2800_reset_tuner,
|
||||||
.link_tuner = rt2800_link_tuner,
|
.link_tuner = rt2800_link_tuner,
|
||||||
.write_tx_desc = rt2800usb_write_tx_desc,
|
.write_tx_desc = rt2800usb_write_tx_desc,
|
||||||
.write_tx_data = rt2x00usb_write_tx_data,
|
|
||||||
.write_beacon = rt2800_write_beacon,
|
.write_beacon = rt2800_write_beacon,
|
||||||
.get_tx_data_len = rt2800usb_get_tx_data_len,
|
.get_tx_data_len = rt2800usb_get_tx_data_len,
|
||||||
.kick_tx_queue = rt2x00usb_kick_tx_queue,
|
.kick_tx_queue = rt2x00usb_kick_tx_queue,
|
||||||
|
@ -60,49 +60,6 @@ int rt2x00pci_regbusy_read(struct rt2x00_dev *rt2x00dev,
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(rt2x00pci_regbusy_read);
|
EXPORT_SYMBOL_GPL(rt2x00pci_regbusy_read);
|
||||||
|
|
||||||
/*
|
|
||||||
* TX data handlers.
|
|
||||||
*/
|
|
||||||
int rt2x00pci_write_tx_data(struct queue_entry *entry,
|
|
||||||
struct txentry_desc *txdesc)
|
|
||||||
{
|
|
||||||
struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This should not happen, we already checked the entry
|
|
||||||
* was ours. When the hardware disagrees there has been
|
|
||||||
* a queue corruption!
|
|
||||||
*/
|
|
||||||
if (unlikely(rt2x00dev->ops->lib->get_entry_state(entry))) {
|
|
||||||
ERROR(rt2x00dev,
|
|
||||||
"Corrupt queue %d, accessing entry which is not ours.\n"
|
|
||||||
"Please file bug report to %s.\n",
|
|
||||||
entry->queue->qid, DRV_PROJECT);
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Add the requested extra tx headroom in front of the skb.
|
|
||||||
*/
|
|
||||||
skb_push(entry->skb, rt2x00dev->ops->extra_tx_headroom);
|
|
||||||
memset(entry->skb->data, 0, rt2x00dev->ops->extra_tx_headroom);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Call the driver's write_tx_datadesc function, if it exists.
|
|
||||||
*/
|
|
||||||
if (rt2x00dev->ops->lib->write_tx_datadesc)
|
|
||||||
rt2x00dev->ops->lib->write_tx_datadesc(entry, txdesc);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Map the skb to DMA.
|
|
||||||
*/
|
|
||||||
if (test_bit(DRIVER_REQUIRE_DMA, &rt2x00dev->flags))
|
|
||||||
rt2x00queue_map_txskb(rt2x00dev, entry->skb);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
EXPORT_SYMBOL_GPL(rt2x00pci_write_tx_data);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* TX/RX data handlers.
|
* TX/RX data handlers.
|
||||||
*/
|
*/
|
||||||
|
@ -85,16 +85,6 @@ int rt2x00pci_regbusy_read(struct rt2x00_dev *rt2x00dev,
|
|||||||
const struct rt2x00_field32 field,
|
const struct rt2x00_field32 field,
|
||||||
u32 *reg);
|
u32 *reg);
|
||||||
|
|
||||||
/**
|
|
||||||
* rt2x00pci_write_tx_data - Initialize data for TX operation
|
|
||||||
* @entry: The entry where the frame is located
|
|
||||||
*
|
|
||||||
* This function will initialize the DMA and skb descriptor
|
|
||||||
* to prepare the entry for the actual TX operation.
|
|
||||||
*/
|
|
||||||
int rt2x00pci_write_tx_data(struct queue_entry *entry,
|
|
||||||
struct txentry_desc *txdesc);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* struct queue_entry_priv_pci: Per entry PCI specific information
|
* struct queue_entry_priv_pci: Per entry PCI specific information
|
||||||
*
|
*
|
||||||
|
@ -404,6 +404,46 @@ static void rt2x00queue_create_tx_descriptor(struct queue_entry *entry,
|
|||||||
rt2x00queue_create_tx_descriptor_plcp(entry, txdesc, hwrate);
|
rt2x00queue_create_tx_descriptor_plcp(entry, txdesc, hwrate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int rt2x00queue_write_tx_data(struct queue_entry *entry,
|
||||||
|
struct txentry_desc *txdesc)
|
||||||
|
{
|
||||||
|
struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This should not happen, we already checked the entry
|
||||||
|
* was ours. When the hardware disagrees there has been
|
||||||
|
* a queue corruption!
|
||||||
|
*/
|
||||||
|
if (unlikely(rt2x00dev->ops->lib->get_entry_state &&
|
||||||
|
rt2x00dev->ops->lib->get_entry_state(entry))) {
|
||||||
|
ERROR(rt2x00dev,
|
||||||
|
"Corrupt queue %d, accessing entry which is not ours.\n"
|
||||||
|
"Please file bug report to %s.\n",
|
||||||
|
entry->queue->qid, DRV_PROJECT);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Add the requested extra tx headroom in front of the skb.
|
||||||
|
*/
|
||||||
|
skb_push(entry->skb, rt2x00dev->ops->extra_tx_headroom);
|
||||||
|
memset(entry->skb->data, 0, rt2x00dev->ops->extra_tx_headroom);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Call the driver's write_tx_datadesc function, if it exists.
|
||||||
|
*/
|
||||||
|
if (rt2x00dev->ops->lib->write_tx_datadesc)
|
||||||
|
rt2x00dev->ops->lib->write_tx_datadesc(entry, txdesc);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Map the skb to DMA.
|
||||||
|
*/
|
||||||
|
if (test_bit(DRIVER_REQUIRE_DMA, &rt2x00dev->flags))
|
||||||
|
rt2x00queue_map_txskb(rt2x00dev, entry->skb);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static void rt2x00queue_write_tx_descriptor(struct queue_entry *entry,
|
static void rt2x00queue_write_tx_descriptor(struct queue_entry *entry,
|
||||||
struct txentry_desc *txdesc)
|
struct txentry_desc *txdesc)
|
||||||
{
|
{
|
||||||
@ -515,8 +555,7 @@ int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb,
|
|||||||
* call failed. Since we always return NETDEV_TX_OK to mac80211,
|
* call failed. Since we always return NETDEV_TX_OK to mac80211,
|
||||||
* this frame will simply be dropped.
|
* this frame will simply be dropped.
|
||||||
*/
|
*/
|
||||||
if (unlikely(queue->rt2x00dev->ops->lib->write_tx_data(entry,
|
if (unlikely(rt2x00queue_write_tx_data(entry, &txdesc))) {
|
||||||
&txdesc))) {
|
|
||||||
clear_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags);
|
clear_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags);
|
||||||
entry->skb = NULL;
|
entry->skb = NULL;
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
@ -207,27 +207,6 @@ static void rt2x00usb_interrupt_txdone(struct urb *urb)
|
|||||||
rt2x00lib_txdone(entry, &txdesc);
|
rt2x00lib_txdone(entry, &txdesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
int rt2x00usb_write_tx_data(struct queue_entry *entry,
|
|
||||||
struct txentry_desc *txdesc)
|
|
||||||
{
|
|
||||||
struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Add the descriptor in front of the skb.
|
|
||||||
*/
|
|
||||||
skb_push(entry->skb, entry->queue->desc_size);
|
|
||||||
memset(entry->skb->data, 0, entry->queue->desc_size);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Call the driver's write_tx_datadesc function, if it exists.
|
|
||||||
*/
|
|
||||||
if (rt2x00dev->ops->lib->write_tx_datadesc)
|
|
||||||
rt2x00dev->ops->lib->write_tx_datadesc(entry, txdesc);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
EXPORT_SYMBOL_GPL(rt2x00usb_write_tx_data);
|
|
||||||
|
|
||||||
static inline void rt2x00usb_kick_tx_entry(struct queue_entry *entry)
|
static inline void rt2x00usb_kick_tx_entry(struct queue_entry *entry)
|
||||||
{
|
{
|
||||||
struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
|
struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
|
||||||
|
@ -350,16 +350,6 @@ int rt2x00usb_regbusy_read(struct rt2x00_dev *rt2x00dev,
|
|||||||
*/
|
*/
|
||||||
void rt2x00usb_disable_radio(struct rt2x00_dev *rt2x00dev);
|
void rt2x00usb_disable_radio(struct rt2x00_dev *rt2x00dev);
|
||||||
|
|
||||||
/**
|
|
||||||
* rt2x00usb_write_tx_data - Initialize URB for TX operation
|
|
||||||
* @entry: The entry where the frame is located
|
|
||||||
*
|
|
||||||
* This function will initialize the URB and skb descriptor
|
|
||||||
* to prepare the entry for the actual TX operation.
|
|
||||||
*/
|
|
||||||
int rt2x00usb_write_tx_data(struct queue_entry *entry,
|
|
||||||
struct txentry_desc *txdesc);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* struct queue_entry_priv_usb: Per entry USB specific information
|
* struct queue_entry_priv_usb: Per entry USB specific information
|
||||||
*
|
*
|
||||||
|
@ -2800,7 +2800,6 @@ static const struct rt2x00lib_ops rt61pci_rt2x00_ops = {
|
|||||||
.reset_tuner = rt61pci_reset_tuner,
|
.reset_tuner = rt61pci_reset_tuner,
|
||||||
.link_tuner = rt61pci_link_tuner,
|
.link_tuner = rt61pci_link_tuner,
|
||||||
.write_tx_desc = rt61pci_write_tx_desc,
|
.write_tx_desc = rt61pci_write_tx_desc,
|
||||||
.write_tx_data = rt2x00pci_write_tx_data,
|
|
||||||
.write_beacon = rt61pci_write_beacon,
|
.write_beacon = rt61pci_write_beacon,
|
||||||
.kick_tx_queue = rt61pci_kick_tx_queue,
|
.kick_tx_queue = rt61pci_kick_tx_queue,
|
||||||
.kill_tx_queue = rt61pci_kill_tx_queue,
|
.kill_tx_queue = rt61pci_kill_tx_queue,
|
||||||
|
@ -2249,7 +2249,6 @@ static const struct rt2x00lib_ops rt73usb_rt2x00_ops = {
|
|||||||
.reset_tuner = rt73usb_reset_tuner,
|
.reset_tuner = rt73usb_reset_tuner,
|
||||||
.link_tuner = rt73usb_link_tuner,
|
.link_tuner = rt73usb_link_tuner,
|
||||||
.write_tx_desc = rt73usb_write_tx_desc,
|
.write_tx_desc = rt73usb_write_tx_desc,
|
||||||
.write_tx_data = rt2x00usb_write_tx_data,
|
|
||||||
.write_beacon = rt73usb_write_beacon,
|
.write_beacon = rt73usb_write_beacon,
|
||||||
.get_tx_data_len = rt73usb_get_tx_data_len,
|
.get_tx_data_len = rt73usb_get_tx_data_len,
|
||||||
.kick_tx_queue = rt2x00usb_kick_tx_queue,
|
.kick_tx_queue = rt2x00usb_kick_tx_queue,
|
||||||
|
Loading…
Reference in New Issue
Block a user