rt2x00: Use ieee80211 fc handlers
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/9 rt2x00: Use ieee80211 fc handlers
With the introduction of the ieee80211 fc handlers we can now remove the rt2x00.h versions to use the global versions.
--- drivers/net/wireless/rt2x00/rt2x00.h | 27 --------------------------- drivers/net/wireless/rt2x00/rt2x00dev.c | 5 ++--- drivers/net/wireless/rt2x00/rt2x00queue.c | 14 +++++--------- 3 files changed, 7 insertions(+), 39 deletions(-)
drivers/net/wireless/rt2x00/rt2x00.h +0 -27
@@ -111,33 +111,6 @@#define EIFS ( SIFS + (8 * (IEEE80211_HEADER + ACK_SIZE)) )/* -* IEEE802.11 header defines -*/ -static inline int is_rts_frame (u16 fc) -{ -return (((fc &IEEE80211_FCTL_FTYPE ) ==IEEE80211_FTYPE_CTL ) && - ((fc &IEEE80211_FCTL_STYPE ) ==IEEE80211_STYPE_RTS )); -} - -static inline int is_cts_frame (u16 fc) -{ -return (((fc &IEEE80211_FCTL_FTYPE ) ==IEEE80211_FTYPE_CTL ) && - ((fc &IEEE80211_FCTL_STYPE ) ==IEEE80211_STYPE_CTS )); -} - -static inline int is_probe_resp (u16 fc) -{ -return (((fc &IEEE80211_FCTL_FTYPE ) ==IEEE80211_FTYPE_MGMT ) && - ((fc &IEEE80211_FCTL_STYPE ) ==IEEE80211_STYPE_PROBE_RESP )); -} - -static inline int is_beacon (u16 fc) -{ -return (((fc &IEEE80211_FCTL_FTYPE ) ==IEEE80211_FTYPE_MGMT ) && - ((fc &IEEE80211_FCTL_STYPE ) ==IEEE80211_STYPE_BEACON )); -} - -/* * Chipset identification * The chipset on the device is composed of a RT and RF chip. * The chipset combination is important for determining device capabilities.
drivers/net/wireless/rt2x00/rt2x00dev.c +2 -3
@@ -561,7 +561,6 @@ void rt2x00lib_rxdone(struct queue_entry *entry,unsigned int align;unsigned int i;int idx =-1 ; -u16 fc;/* * The data behind the ieee80211 header must be
@@ -606,8 +605,8 @@ void rt2x00lib_rxdone(struct queue_entry *entry,* Only update link status if this is a beacon frame carrying our bssid. */ hdr = (struct ieee80211_hdr *)entry->skb->data; - fc =le16_to_cpu (hdr->frame_control); -if (is_beacon (fc) && (rxdesc->dev_flags &RXDONE_MY_BSS )) +if (ieee80211_is_beacon (hdr->frame_control) && + (rxdesc->dev_flags &RXDONE_MY_BSS ))rt2x00lib_update_link_stats (&rt2x00dev->link, rxdesc->rssi); rt2x00dev->link.qual.rx_success++;
drivers/net/wireless/rt2x00/rt2x00queue.c +5 -9
@@ -80,7 +80,6 @@ void rt2x00queue_create_tx_descriptor(struct queue_entry *entry,unsigned int data_length;unsigned int duration;unsigned int residual; -u16 frame_control;memset (txdesc,0 ,sizeof (*txdesc));
@@ -96,11 +95,6 @@ void rt2x00queue_create_tx_descriptor(struct queue_entry *entry, data_length = entry->skb->len +4 ;/* -* Read required fields from ieee80211 header. -*/ - frame_control =le16_to_cpu (hdr->frame_control); - -/* * Check whether this frame is to be acked. */ if (!(tx_info->flags &IEEE80211_TX_CTL_NO_ACK ))
@@ -109,9 +103,10 @@ void rt2x00queue_create_tx_descriptor(struct queue_entry *entry,/* * Check if this is a RTS/CTS frame */ -if (is_rts_frame (frame_control) ||is_cts_frame (frame_control)) { +if (ieee80211_is_rts (hdr->frame_control) || +ieee80211_is_cts (hdr->frame_control)) {__set_bit (ENTRY_TXD_BURST , &txdesc->flags); -if (is_rts_frame (frame_control)) +if (ieee80211_is_rts (hdr->frame_control))__set_bit (ENTRY_TXD_RTS_FRAME , &txdesc->flags);else __set_bit (ENTRY_TXD_CTS_FRAME , &txdesc->flags);
@@ -139,7 +134,8 @@ void rt2x00queue_create_tx_descriptor(struct queue_entry *entry,* Beacons and probe responses require the tsf timestamp * to be inserted into the frame. */ -if (txdesc->queue ==QID_BEACON ||is_probe_resp (frame_control)) +if (ieee80211_is_beacon (hdr->frame_control) || +ieee80211_is_probe_resp (hdr->frame_control))__set_bit (ENTRY_TXD_REQ_TIMESTAMP , &txdesc->flags);/*
Signature · 1 line
1.5.5.4
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 2/9 rt2x00: Properly clean up beacon skbs.
From: Gertjan van Wingerde <[email protected]>
The skbs containing the beacons weren't properly cleaned up for rt2400pci, rt2500pci, rt61pci, and rt73usb. Clean up those skbs in the manner appropriate for each driver.
--- drivers/net/wireless/rt2x00/rt2x00dev.c | 6 ++++++ drivers/net/wireless/rt2x00/rt61pci.c | 6 ++++++ drivers/net/wireless/rt2x00/rt73usb.c | 6 ++++++ 3 files changed, 18 insertions(+), 0 deletions(-)
drivers/net/wireless/rt2x00/rt2x00dev.c +6 -0
@@ -474,6 +474,12 @@ static void rt2x00lib_beacondone_iter(void *data, u8 *mac, vif->type != IEEE80211_IF_TYPE_IBSS)return ; +/* +* Clean up the beacon skb. +*/ +dev_kfree_skb_irq (intf->beacon->skb); + intf->beacon->skb =NULL ; +spin_lock (&intf->lock); intf->delayed_flags |=DELAYED_UPDATE_BEACON ;spin_unlock (&intf->lock);
drivers/net/wireless/rt2x00/rt61pci.c +6 -0
@@ -2402,6 +2402,12 @@ static int rt61pci_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb) skb->data, skb->len);rt61pci_kick_tx_queue (rt2x00dev,QID_BEACON ); +/* +* Clean up beacon skb. +*/ +dev_kfree_skb_any (skb); + intf->beacon->skb =NULL ; +return 0 ; }
drivers/net/wireless/rt2x00/rt73usb.c +6 -0
@@ -2001,6 +2001,12 @@ static int rt73usb_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb) REGISTER_TIMEOUT32(skb->len));rt73usb_kick_tx_queue (rt2x00dev,QID_BEACON ); +/* +* Clean up the beacon skb. +*/ +dev_kfree_skb (skb); + intf->beacon->skb =NULL ; +return 0 ; }
Signature · 1 line
1.5.5.4
PATCH 3/9 rt2x00: Convert rt2x00 to use generic DMA-mapping API
From: Gertjan van Wingerde <[email protected]>
At the same time clean up the device administration a bit, by storing a pointer to struct device instead of a void pointer that is dependent on the type of device. The normal PCI and USB subsystem provided macros can be used to convert the device pointer to the right type.
This makes the rt2x00 driver a bit more type-safe.
--- drivers/net/wireless/rt2x00/rt2400pci.c | 2 +- drivers/net/wireless/rt2x00/rt2500pci.c | 2 +- drivers/net/wireless/rt2x00/rt2500usb.c | 5 +++-- drivers/net/wireless/rt2x00/rt2x00.h | 6 +----- drivers/net/wireless/rt2x00/rt2x00pci.c | 19 +++++++++---------- drivers/net/wireless/rt2x00/rt2x00usb.c | 11 +++++++---- drivers/net/wireless/rt2x00/rt61pci.c | 4 ++-- drivers/net/wireless/rt2x00/rt73usb.c | 2 +- 8 files changed, 25 insertions(+), 26 deletions(-)
drivers/net/wireless/rt2x00/rt2400pci.c +1 -1
@@ -1366,7 +1366,7 @@ static void rt2400pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)IEEE80211_HW_SIGNAL_DBM ; rt2x00dev->hw->extra_tx_headroom =0 ; -SET_IEEE80211_DEV (rt2x00dev->hw, &rt2x00dev_pci (rt2x00dev)->dev); +SET_IEEE80211_DEV (rt2x00dev->hw, rt2x00dev->dev);SET_IEEE80211_PERM_ADDR (rt2x00dev->hw,rt2x00_eeprom_addr (rt2x00dev,EEPROM_MAC_ADDR_0 ));
drivers/net/wireless/rt2x00/rt2500pci.c +1 -1
@@ -1688,7 +1688,7 @@ static void rt2500pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev) rt2x00dev->hw->extra_tx_headroom =0 ; -SET_IEEE80211_DEV (rt2x00dev->hw, &rt2x00dev_pci (rt2x00dev)->dev); +SET_IEEE80211_DEV (rt2x00dev->hw, rt2x00dev->dev);SET_IEEE80211_PERM_ADDR (rt2x00dev->hw,rt2x00_eeprom_addr (rt2x00dev,EEPROM_MAC_ADDR_0 ));
drivers/net/wireless/rt2x00/rt2500usb.c +3 -2
@@ -1588,7 +1588,7 @@ static void rt2500usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev) rt2x00dev->hw->extra_tx_headroom =TXD_DESC_SIZE ; -SET_IEEE80211_DEV (rt2x00dev->hw, &rt2x00dev_usb (rt2x00dev)->dev); +SET_IEEE80211_DEV (rt2x00dev->hw, rt2x00dev->dev);SET_IEEE80211_PERM_ADDR (rt2x00dev->hw,rt2x00_eeprom_addr (rt2x00dev,EEPROM_MAC_ADDR_0 ));
@@ -1672,7 +1672,8 @@ static int rt2500usb_probe_hw(struct rt2x00_dev *rt2x00dev)static int rt2500usb_beacon_update (struct ieee80211_hw *hw,struct sk_buff *skb) {struct rt2x00_dev *rt2x00dev = hw->priv; -struct usb_device *usb_dev =rt2x00dev_usb_dev (rt2x00dev); +struct usb_device *usb_dev = +interface_to_usbdev (to_usb_interface (rt2x00dev->dev));struct ieee80211_tx_info *tx_info =IEEE80211_SKB_CB (skb);struct rt2x00_intf *intf =vif_to_intf (tx_info->control.vif);struct queue_entry_priv_usb_bcn *bcn_priv;
drivers/net/wireless/rt2x00/rt2x00.h +1 -5
@@ -625,11 +625,7 @@ struct rt2x00_dev {* When accessing this variable, the rt2x00dev_{pci,usb} * macro's should be used for correct typecasting. */ -void *dev; -#define rt2x00dev_pci (__dev) ( (struct pci_dev *)(__dev)->dev ) -#define rt2x00dev_usb (__dev) ( (struct usb_interface *)(__dev)->dev ) -#define rt2x00dev_usb_dev (__dev)\ - ( (struct usb_device *)interface_to_usbdev(rt2x00dev_usb(__dev)) ) +struct device *dev;/* * Callback functions.
drivers/net/wireless/rt2x00/rt2x00pci.c +9 -10
@@ -194,7 +194,6 @@ EXPORT_SYMBOL_GPL(rt2x00pci_txdone);static int rt2x00pci_alloc_queue_dma (struct rt2x00_dev *rt2x00dev,struct data_queue *queue) { -struct pci_dev *pci_dev =rt2x00dev_pci (rt2x00dev);struct queue_entry_priv_pci *entry_priv;void *addr;dma_addr_t dma;
@@ -203,7 +202,8 @@ static int rt2x00pci_alloc_queue_dma(struct rt2x00_dev *rt2x00dev,/* * Allocate DMA memory for descriptor and buffer. */ - addr =pci_alloc_consistent (pci_dev,dma_size (queue), &dma); + addr =dma_alloc_coherent (rt2x00dev->dev,dma_size (queue), &dma, +GFP_KERNEL |GFP_DMA );if (!addr)return -ENOMEM ;
@@ -226,19 +226,18 @@ static int rt2x00pci_alloc_queue_dma(struct rt2x00_dev *rt2x00dev,static void rt2x00pci_free_queue_dma (struct rt2x00_dev *rt2x00dev,struct data_queue *queue) { -struct pci_dev *pci_dev =rt2x00dev_pci (rt2x00dev);struct queue_entry_priv_pci *entry_priv = queue->entries[0 ].priv_data;if (entry_priv->data) -pci_free_consistent (pci_dev,dma_size (queue), - entry_priv->data, entry_priv->data_dma); +dma_free_coherent (rt2x00dev->dev,dma_size (queue), + entry_priv->data, entry_priv->data_dma); entry_priv->data =NULL ; }int rt2x00pci_initialize (struct rt2x00_dev *rt2x00dev) { -struct pci_dev *pci_dev =rt2x00dev_pci (rt2x00dev); +struct pci_dev *pci_dev =to_pci_dev (rt2x00dev->dev);struct data_queue *queue;int status;
@@ -279,7 +278,7 @@ void rt2x00pci_uninitialize(struct rt2x00_dev *rt2x00dev)/* * Free irq line. */ -free_irq (rt2x00dev_pci (rt2x00dev)->irq, rt2x00dev); +free_irq (to_pci_dev (rt2x00dev->dev)->irq, rt2x00dev);/* * Free DMA
@@ -308,7 +307,7 @@ static void rt2x00pci_free_reg(struct rt2x00_dev *rt2x00dev)static int rt2x00pci_alloc_reg (struct rt2x00_dev *rt2x00dev) { -struct pci_dev *pci_dev =rt2x00dev_pci (rt2x00dev); +struct pci_dev *pci_dev =to_pci_dev (rt2x00dev->dev); rt2x00dev->csr.base =ioremap (pci_resource_start (pci_dev,0 ),pci_resource_len (pci_dev,0 ));
@@ -357,7 +356,7 @@ int rt2x00pci_probe(struct pci_dev *pci_dev, const struct pci_device_id *id)if (pci_set_mwi (pci_dev))ERROR_PROBE ("MWI not available.\n" ); -if (pci_set_dma_mask (pci_dev,DMA_32BIT_MASK )) { +if (dma_set_mask (&pci_dev->dev,DMA_32BIT_MASK )) {ERROR_PROBE ("PCI DMA not supported.\n" ); retval = -EIO ; goto exit_disable_device;
@@ -373,7 +372,7 @@ int rt2x00pci_probe(struct pci_dev *pci_dev, const struct pci_device_id *id)pci_set_drvdata (pci_dev, hw); rt2x00dev = hw->priv; - rt2x00dev->dev = pci_dev; + rt2x00dev->dev = &pci_dev->dev; rt2x00dev->ops = ops; rt2x00dev->hw = hw;
drivers/net/wireless/rt2x00/rt2x00usb.c +7 -4
@@ -40,7 +40,8 @@ int rt2x00usb_vendor_request(struct rt2x00_dev *rt2x00dev, void *buffer, const u16 buffer_length, const int timeout) { - struct usb_device *usb_dev = rt2x00dev_usb_dev(rt2x00dev); + struct usb_device *usb_dev = +interface_to_usbdev (to_usb_interface (rt2x00dev->dev));int status;unsigned int i; unsigned int pipe =
@@ -176,7 +177,8 @@ static void rt2x00usb_interrupt_txdone(struct urb *urb)int rt2x00usb_write_tx_data (struct queue_entry *entry) {struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; -struct usb_device *usb_dev =rt2x00dev_usb_dev (rt2x00dev); +struct usb_device *usb_dev = +interface_to_usbdev (to_usb_interface (rt2x00dev->dev));struct queue_entry_priv_usb *entry_priv = entry->priv_data;struct skb_frame_desc *skbdesc;u32 length;
@@ -364,7 +366,8 @@ EXPORT_SYMBOL_GPL(rt2x00usb_disable_radio);void rt2x00usb_init_rxentry (struct rt2x00_dev *rt2x00dev,struct queue_entry *entry) { -struct usb_device *usb_dev =rt2x00dev_usb_dev (rt2x00dev); +struct usb_device *usb_dev = +interface_to_usbdev (to_usb_interface (rt2x00dev->dev));struct queue_entry_priv_usb *entry_priv = entry->priv_data; usb_fill_bulk_urb(entry_priv->urb, usb_dev,
@@ -558,7 +561,7 @@ int rt2x00usb_probe(struct usb_interface *usb_intf,usb_set_intfdata (usb_intf, hw); rt2x00dev = hw->priv; - rt2x00dev->dev = usb_intf; + rt2x00dev->dev = &usb_intf->dev; rt2x00dev->ops = ops; rt2x00dev->hw = hw;mutex_init (&rt2x00dev->usb_cache_mutex);
drivers/net/wireless/rt2x00/rt61pci.c +2 -2
@@ -1973,7 +1973,7 @@ static int rt61pci_init_eeprom(struct rt2x00_dev *rt2x00dev)* To determine the RT chip we have to read the * PCI header of the device. */ -pci_read_config_word (rt2x00dev_pci (rt2x00dev), +pci_read_config_word (to_pci_dev (rt2x00dev->dev),PCI_CONFIG_HEADER_DEVICE , &device); value =rt2x00_get_field16 (eeprom,EEPROM_ANTENNA_RF_TYPE );rt2x00pci_register_read (rt2x00dev,MAC_CSR0 , ®);
@@ -2239,7 +2239,7 @@ static void rt61pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)IEEE80211_HW_SIGNAL_DBM ; rt2x00dev->hw->extra_tx_headroom =0 ; -SET_IEEE80211_DEV (rt2x00dev->hw, &rt2x00dev_pci (rt2x00dev)->dev); +SET_IEEE80211_DEV (rt2x00dev->hw, rt2x00dev->dev);SET_IEEE80211_PERM_ADDR (rt2x00dev->hw,rt2x00_eeprom_addr (rt2x00dev,EEPROM_MAC_ADDR_0 ));
drivers/net/wireless/rt2x00/rt73usb.c +1 -1
@@ -1821,7 +1821,7 @@ static void rt73usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev)IEEE80211_HW_SIGNAL_DBM ; rt2x00dev->hw->extra_tx_headroom =TXD_DESC_SIZE ; -SET_IEEE80211_DEV (rt2x00dev->hw, &rt2x00dev_usb (rt2x00dev)->dev); +SET_IEEE80211_DEV (rt2x00dev->hw, rt2x00dev->dev);SET_IEEE80211_PERM_ADDR (rt2x00dev->hw,rt2x00_eeprom_addr (rt2x00dev,EEPROM_MAC_ADDR_0 ));
Signature · 1 line
1.5.5.4
PATCH 4/9 rt2x00: Centralize allocation of RX skbs.
From: Gertjan van Wingerde <[email protected]>
In preparation of replacing the statically allocated DMA buffers with dynamically mapped skbs, centralize the allocation of RX skbs to rt2x00queue.c and let rt2x00pci already use them.
--- drivers/net/wireless/rt2x00/rt2x00.h | 10 +++- drivers/net/wireless/rt2x00/rt2x00pci.c | 77 ++++++++++++++++++---------- drivers/net/wireless/rt2x00/rt2x00queue.c | 71 ++++++++++++++++++++------ drivers/net/wireless/rt2x00/rt2x00usb.c | 21 +------- 4 files changed, 113 insertions(+), 66 deletions(-)
drivers/net/wireless/rt2x00/rt2x00.h +8 -2
@@ -899,10 +899,16 @@ static inline u16 get_duration_res(const unsigned int size, const u8 rate) }/** -* rt2x00queue_alloc_rxskb - allocate a skb for RX purposes. +* rt2x00queue_alloc_skb - allocate a skb. * @queue: The queue for which the skb will be applicable. */ -struct sk_buff *rt2x00queue_alloc_rxskb (struct data_queue *queue); +struct sk_buff *rt2x00queue_alloc_skb (struct data_queue *queue); + +/** +* rt2x00queue_free_skb - free a skb +* @skb: The skb to free. +*/ +void rt2x00queue_free_skb (struct sk_buff *skb);/** * rt2x00queue_create_tx_descriptor - Create TX descriptor from mac80211 input
drivers/net/wireless/rt2x00/rt2x00pci.c +49 -28
94 lines not on this page · raw message
drivers/net/wireless/rt2x00/rt2x00queue.c +54 -17
114 lines not on this page · raw message
drivers/net/wireless/rt2x00/rt2x00usb.c +2 -19
@@ -300,7 +300,7 @@ static void rt2x00usb_interrupt_rxdone(struct urb *urb)* If allocation fails, we should drop the current frame * so we can recycle the existing sk buffer for the new frame. */ - skb =rt2x00queue_alloc_rxskb (entry->queue); + skb =rt2x00queue_alloc_skb (entry->queue);if (!skb) goto skip_entry;
@@ -434,8 +434,6 @@ static void rt2x00usb_free_urb(struct rt2x00_dev *rt2x00dev, entry_priv = queue->entries[i].priv_data;usb_kill_urb (entry_priv->urb);usb_free_urb (entry_priv->urb); -if (queue->entries[i].skb) -kfree_skb (queue->entries[i].skb); }/*
@@ -457,10 +455,7 @@ static void rt2x00usb_free_urb(struct rt2x00_dev *rt2x00dev,int rt2x00usb_initialize (struct rt2x00_dev *rt2x00dev) {struct data_queue *queue; -struct sk_buff *skb; -unsigned int entry_size; -unsigned int i; -int uninitialized_var (status ); +int status;/* * Allocate DMA
@@ -471,18 +466,6 @@ int rt2x00usb_initialize(struct rt2x00_dev *rt2x00dev) goto exit; } -/* -* For the RX queue, skb's should be allocated. -*/ - entry_size = rt2x00dev->rx->data_size + rt2x00dev->rx->desc_size; -for (i =0 ; i < rt2x00dev->rx->limit; i++) { - skb =rt2x00queue_alloc_rxskb (rt2x00dev->rx); -if (!skb) - goto exit; - - rt2x00dev->rx->entries[i].skb = skb; - } -return 0 ; exit:
Signature · 1 line
1.5.5.4
PATCH 5/9 rt2x00: Replace statically allocated DMA buffers with mapped skb's.
From: Gertjan van Wingerde <[email protected]>
The current PCI drivers require a lot of pre-allocated DMA buffers. Reduce this by using dynamically mapped skb's (using pci_map_single) instead of the pre- allocated DMA buffers that are allocated at device start-up time.
At the same time move common RX path code into rt2x00lib from rt2x00pci and rt2x00usb, as the RX paths now are now almost the same.
--- drivers/net/wireless/rt2x00/rt2400pci.c | 13 ++-- drivers/net/wireless/rt2x00/rt2500pci.c | 10 ++- drivers/net/wireless/rt2x00/rt2x00.h | 28 +++++- drivers/net/wireless/rt2x00/rt2x00dev.c | 64 ++++++++++----- drivers/net/wireless/rt2x00/rt2x00pci.c | 125 ++++++++--------------------- drivers/net/wireless/rt2x00/rt2x00pci.h | 3 - drivers/net/wireless/rt2x00/rt2x00queue.c | 85 +++++++++++++++++--- drivers/net/wireless/rt2x00/rt2x00queue.h | 16 ++-- drivers/net/wireless/rt2x00/rt2x00usb.c | 27 +----- drivers/net/wireless/rt2x00/rt61pci.c | 9 +- 10 files changed, 204 insertions(+), 176 deletions(-)
drivers/net/wireless/rt2x00/rt2400pci.c +7 -6
@@ -632,15 +632,15 @@ static void rt2400pci_init_rxentry(struct rt2x00_dev *rt2x00dev, struct queue_entry *entry) {struct queue_entry_priv_pci *entry_priv = entry->priv_data; +struct skb_frame_desc *skbdesc =get_skb_frame_desc (entry->skb);u32 word;rt2x00_desc_read (entry_priv->desc,2 , &word); -rt2x00_set_field32 (&word,RXD_W2_BUFFER_LENGTH , - entry->queue->data_size); +rt2x00_set_field32 (&word,RXD_W2_BUFFER_LENGTH , entry->skb->len);rt2x00_desc_write (entry_priv->desc,2 , word);rt2x00_desc_read (entry_priv->desc,1 , &word); -rt2x00_set_field32 (&word,RXD_W1_BUFFER_ADDRESS , entry_priv->data_dma); +rt2x00_set_field32 (&word,RXD_W1_BUFFER_ADDRESS , skbdesc->skb_dma);rt2x00_desc_write (entry_priv->desc,1 , word);rt2x00_desc_read (entry_priv->desc,0 , &word);
@@ -1012,7 +1012,7 @@ static void rt2400pci_write_tx_desc(struct rt2x00_dev *rt2x00dev,* Start writing the descriptor words. */ rt2x00_desc_read (entry_priv->desc,1 , &word); -rt2x00_set_field32 (&word,TXD_W1_BUFFER_ADDRESS , entry_priv->data_dma); +rt2x00_set_field32 (&word,TXD_W1_BUFFER_ADDRESS , skbdesc->skb_dma);rt2x00_desc_write (entry_priv->desc,1 , word);rt2x00_desc_read (txd,2 , &word);
@@ -1412,9 +1412,10 @@ static int rt2400pci_probe_hw(struct rt2x00_dev *rt2x00dev)rt2400pci_probe_hw_mode (rt2x00dev);/* -* This device requires the atim queue +* This device requires the atim queue and DMA-mapped skbs. */ __set_bit (DRIVER_REQUIRE_ATIM_QUEUE , &rt2x00dev->flags); +__set_bit (DRIVER_REQUIRE_DMA , &rt2x00dev->flags);/* * Set the rssi offset.
@@ -1526,7 +1527,7 @@ 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. */ -memcpy (entry_priv->data, skb->data, skb->len); +rt2x00queue_map_txskb (rt2x00dev, intf->beacon->skb);rt2x00queue_write_tx_descriptor (intf->beacon, &txdesc); rt2x00dev->ops->lib->kick_tx_queue (rt2x00dev,QID_BEACON );
drivers/net/wireless/rt2x00/rt2500pci.c +6 -4
@@ -727,10 +727,11 @@ static void rt2500pci_init_rxentry(struct rt2x00_dev *rt2x00dev, struct queue_entry *entry) {struct queue_entry_priv_pci *entry_priv = entry->priv_data; +struct skb_frame_desc *skbdesc =get_skb_frame_desc (entry->skb);u32 word;rt2x00_desc_read (entry_priv->desc,1 , &word); -rt2x00_set_field32 (&word,RXD_W1_BUFFER_ADDRESS , entry_priv->data_dma); +rt2x00_set_field32 (&word,RXD_W1_BUFFER_ADDRESS , skbdesc->skb_dma);rt2x00_desc_write (entry_priv->desc,1 , word);rt2x00_desc_read (entry_priv->desc,0 , &word);
@@ -1171,7 +1172,7 @@ static void rt2500pci_write_tx_desc(struct rt2x00_dev *rt2x00dev,* Start writing the descriptor words. */ rt2x00_desc_read (entry_priv->desc,1 , &word); -rt2x00_set_field32 (&word,TXD_W1_BUFFER_ADDRESS , entry_priv->data_dma); +rt2x00_set_field32 (&word,TXD_W1_BUFFER_ADDRESS , skbdesc->skb_dma);rt2x00_desc_write (entry_priv->desc,1 , word);rt2x00_desc_read (txd,2 , &word);
@@ -1752,9 +1753,10 @@ static int rt2500pci_probe_hw(struct rt2x00_dev *rt2x00dev)rt2500pci_probe_hw_mode (rt2x00dev);/* -* This device requires the atim queue +* This device requires the atim queue and DMA-mapped skbs. */ __set_bit (DRIVER_REQUIRE_ATIM_QUEUE , &rt2x00dev->flags); +__set_bit (DRIVER_REQUIRE_DMA , &rt2x00dev->flags);/* * Set the rssi offset.
@@ -1842,7 +1844,7 @@ 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. */ -memcpy (entry_priv->data, skb->data, skb->len); +rt2x00queue_map_txskb (rt2x00dev, intf->beacon->skb);rt2x00queue_write_tx_descriptor (intf->beacon, &txdesc); rt2x00dev->ops->lib->kick_tx_queue (rt2x00dev,QID_BEACON );
drivers/net/wireless/rt2x00/rt2x00.h +23 -5
@@ -601,6 +601,7 @@ enum rt2x00_flags {DRIVER_REQUIRE_BEACON_GUARD ,DRIVER_REQUIRE_ATIM_QUEUE ,DRIVER_REQUIRE_SCHEDULED , + DRIVER_REQUIRE_DMA,/* * Driver configuration
@@ -899,16 +900,33 @@ static inline u16 get_duration_res(const unsigned int size, const u8 rate) }/** -* rt2x00queue_alloc_skb - allocate a skb. +* rt2x00queue_alloc_rxskb - allocate a skb for RX purposes. +* @rt2x00dev: Pointer to &struct rt2x00_dev. * @queue: The queue for which the skb will be applicable. */ -struct sk_buff *rt2x00queue_alloc_skb (struct data_queue *queue); +struct sk_buff *rt2x00queue_alloc_rxskb (struct rt2x00_dev *rt2x00dev, +struct queue_entry *entry); + +/** +* rt2x00queue_map_txskb - Map a skb into DMA for TX purposes. +* @rt2x00dev: Pointer to &struct rt2x00_dev. +* @skb: The skb to map. +*/ +void rt2x00queue_map_txskb (struct rt2x00_dev *rt2x00dev,struct sk_buff *skb); + +/** +* rt2x00queue_unmap_skb - Unmap a skb from DMA. +* @rt2x00dev: Pointer to &struct rt2x00_dev. +* @skb: The skb to unmap. +*/ +void rt2x00queue_unmap_skb (struct rt2x00_dev *rt2x00dev,struct sk_buff *skb);/** * rt2x00queue_free_skb - free a skb +* @rt2x00dev: Pointer to &struct rt2x00_dev. * @skb: The skb to free. */ -void rt2x00queue_free_skb (struct sk_buff *skb); +void rt2x00queue_free_skb (struct rt2x00_dev *rt2x00dev,struct sk_buff *skb);/** * rt2x00queue_create_tx_descriptor - Create TX descriptor from mac80211 input
@@ -977,8 +995,8 @@ void rt2x00queue_index_inc(struct data_queue *queue, enum queue_index index);void rt2x00lib_beacondone (struct rt2x00_dev *rt2x00dev);void rt2x00lib_txdone (struct queue_entry *entry,struct txdone_entry_desc *txdesc); -void rt2x00lib_rxdone (struct queue_entry *entry, -struct rxdone_entry_desc *rxdesc); +void rt2x00lib_rxdone (struct rt2x00_dev *rt2x00dev, +struct queue_entry *entry);/* * mac80211 handlers.
drivers/net/wireless/rt2x00/rt2x00dev.c +45 -19
133 lines not on this page · raw message
drivers/net/wireless/rt2x00/rt2x00pci.c +33 -92
182 lines not on this page · raw message
drivers/net/wireless/rt2x00/rt2x00pci.h +0 -3
@@ -107,9 +107,6 @@ int rt2x00pci_write_tx_data(struct queue_entry *entry);struct queue_entry_priv_pci {__le32 *desc;dma_addr_t desc_dma; - -void *data; -dma_addr_t data_dma; };/**
drivers/net/wireless/rt2x00/rt2x00queue.c +72 -13
153 lines not on this page · raw message
drivers/net/wireless/rt2x00/rt2x00queue.h +9 -7
@@ -83,9 +83,10 @@ enum data_queue_qid {* enum skb_frame_desc_flags: Flags for &struct skb_frame_desc * */ -//enum skb_frame_desc_flags { -// TEMPORARILY EMPTY -//}; +enum skb_frame_desc_flags { +SKBDESC_DMA_MAPPED_RX = (1 <<0 ), +SKBDESC_DMA_MAPPED_TX = (1 <<1 ), +};/** * struct skb_frame_desc: Descriptor information for the skb buffer
@@ -94,19 +95,20 @@ enum data_queue_qid {* this structure should not exceed the size of that array (40 bytes). * * @flags: Frame flags, see &enum skb_frame_desc_flags. -* @data: Pointer to data part of frame (Start of ieee80211 header). +* @desc_len: Length of the frame descriptor. * @desc: Pointer to descriptor part of the frame. * Note that this pointer could point to something outside * of the scope of the skb->data pointer. -* @data_len: Length of the frame data. -* @desc_len: Length of the frame descriptor. +* @skb_dma: (PCI-only) the DMA address associated with the sk buffer. * @entry: The entry to which this sk buffer belongs. */ struct skb_frame_desc {unsigned int flags; -void *desc;unsigned int desc_len; +void *desc; + +dma_addr_t skb_dma;struct queue_entry *entry; };
drivers/net/wireless/rt2x00/rt2x00usb.c +4 -23
@@ -266,9 +266,7 @@ static void rt2x00usb_interrupt_rxdone(struct urb *urb) {struct queue_entry *entry = (struct queue_entry *)urb->context;struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; -struct sk_buff *skb; -struct skb_frame_desc *skbdesc; -struct rxdone_entry_desc rxdesc; +struct skb_frame_desc *skbdesc =get_skb_frame_desc (entry->skb);u8 rxd[32 ]; if (!test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags) ||
@@ -284,36 +282,19 @@ static void rt2x00usb_interrupt_rxdone(struct urb *urb) goto skip_entry;/* -* Fill in skb descriptor +* Fill in desc fields of the skb descriptor */ - skbdesc =get_skb_frame_desc (entry->skb); -memset (skbdesc,0 ,sizeof (*skbdesc)); - skbdesc->entry = entry; skbdesc->desc = rxd; skbdesc->desc_len = entry->queue->desc_size; -memset (&rxdesc,0 ,sizeof (rxdesc)); - rt2x00dev->ops->lib->fill_rxdone (entry, &rxdesc); - -/* -* Allocate a new sk buffer to replace the current one. -* If allocation fails, we should drop the current frame -* so we can recycle the existing sk buffer for the new frame. -*/ - skb =rt2x00queue_alloc_skb (entry->queue); -if (!skb) - goto skip_entry; -/* * Send the frame to rt2x00lib for further processing. */ -rt2x00lib_rxdone (entry, &rxdesc); +rt2x00lib_rxdone (rt2x00dev, entry);/* -* Replace current entry's skb with the newly allocated one, -* and reinitialize the urb. +* Reinitialize the urb. */ - entry->skb = skb; urb->transfer_buffer = entry->skb->data; urb->transfer_buffer_length = entry->skb->len;
drivers/net/wireless/rt2x00/rt61pci.c +5 -4
@@ -1030,11 +1030,12 @@ static void rt61pci_init_rxentry(struct rt2x00_dev *rt2x00dev, struct queue_entry *entry) {struct queue_entry_priv_pci *entry_priv = entry->priv_data; +struct skb_frame_desc *skbdesc =get_skb_frame_desc (entry->skb);u32 word;rt2x00_desc_read (entry_priv->desc,5 , &word);rt2x00_set_field32 (&word,RXD_W5_BUFFER_PHYSICAL_ADDRESS , - entry_priv->data_dma); + skbdesc->skb_dma);rt2x00_desc_write (entry_priv->desc,5 , word);rt2x00_desc_read (entry_priv->desc,0 , &word);
@@ -1522,7 +1523,6 @@ static void rt61pci_write_tx_desc(struct rt2x00_dev *rt2x00dev, struct txentry_desc *txdesc) {struct skb_frame_desc *skbdesc =get_skb_frame_desc (skb); -struct queue_entry_priv_pci *entry_priv = skbdesc->entry->priv_data;__le32 *txd = skbdesc->desc;u32 word;
@@ -1557,7 +1557,7 @@ static void rt61pci_write_tx_desc(struct rt2x00_dev *rt2x00dev,rt2x00_desc_read (txd,6 , &word);rt2x00_set_field32 (&word,TXD_W6_BUFFER_PHYSICAL_ADDRESS , - entry_priv->data_dma); + skbdesc->skb_dma);rt2x00_desc_write (txd,6 , word);if (skbdesc->desc_len >TXINFO_SIZE ) {
@@ -2302,9 +2302,10 @@ static int rt61pci_probe_hw(struct rt2x00_dev *rt2x00dev)rt61pci_probe_hw_mode (rt2x00dev);/* -* This device requires firmware. +* This device requires firmware and DMA mapped skbs. */ __set_bit (DRIVER_REQUIRE_FIRMWARE , &rt2x00dev->flags); +__set_bit (DRIVER_REQUIRE_DMA , &rt2x00dev->flags);/* * Set the rssi offset.
Signature · 1 line
1.5.5.4
PATCH 6/9 rt2x00: Cleanup symbol exports
With a bit of code moving to rt2x00lib within the
TX and RX paths we can now remove a lot of EXPORT_SYMBOL_GPL() statements. This cleans up the interface between rt2x00lib and the drivers and has the additional benefit that rt2x00pci and rt2x00usb are trimmed down in size as well since they have less to do.
--- drivers/net/wireless/rt2x00/rt2400pci.c | 2 +- drivers/net/wireless/rt2x00/rt2500pci.c | 2 +- drivers/net/wireless/rt2x00/rt2x00.h | 34 ------------------- drivers/net/wireless/rt2x00/rt2x00dev.c | 29 ++++++++++++++++ drivers/net/wireless/rt2x00/rt2x00lib.h | 51 +++++++++++++++++++++++++++- drivers/net/wireless/rt2x00/rt2x00pci.c | 49 --------------------------- drivers/net/wireless/rt2x00/rt2x00pci.h | 9 ----- drivers/net/wireless/rt2x00/rt2x00queue.c | 15 ++++++-- drivers/net/wireless/rt2x00/rt2x00queue.h | 2 + drivers/net/wireless/rt2x00/rt2x00usb.c | 42 ++++-------------------- drivers/net/wireless/rt2x00/rt61pci.c | 4 +- 11 files changed, 102 insertions(+), 137 deletions(-)
drivers/net/wireless/rt2x00/rt2400pci.c +1 -1
@@ -1154,7 +1154,7 @@ static void rt2400pci_txdone(struct rt2x00_dev *rt2x00dev, } txdesc.retry =rt2x00_get_field32 (word,TXD_W0_RETRY_COUNT ); -rt2x00pci_txdone (rt2x00dev, entry, &txdesc); +rt2x00lib_txdone (entry, &txdesc); } }
drivers/net/wireless/rt2x00/rt2500pci.c +1 -1
@@ -1312,7 +1312,7 @@ static void rt2500pci_txdone(struct rt2x00_dev *rt2x00dev, } txdesc.retry =rt2x00_get_field32 (word,TXD_W0_RETRY_COUNT ); -rt2x00pci_txdone (rt2x00dev, entry, &txdesc); +rt2x00lib_txdone (entry, &txdesc); } }
drivers/net/wireless/rt2x00/rt2x00.h +0 -34
@@ -900,14 +900,6 @@ static inline u16 get_duration_res(const unsigned int size, const u8 rate) }/** -* rt2x00queue_alloc_rxskb - allocate a skb for RX purposes. -* @rt2x00dev: Pointer to &struct rt2x00_dev. -* @queue: The queue for which the skb will be applicable. -*/ -struct sk_buff *rt2x00queue_alloc_rxskb (struct rt2x00_dev *rt2x00dev, -struct queue_entry *entry); - -/** * rt2x00queue_map_txskb - Map a skb into DMA for TX purposes. * @rt2x00dev: Pointer to &struct rt2x00_dev. * @skb: The skb to map.
@@ -915,20 +907,6 @@ struct sk_buff *rt2x00queue_alloc_rxskb(struct rt2x00_dev *rt2x00dev,void rt2x00queue_map_txskb (struct rt2x00_dev *rt2x00dev,struct sk_buff *skb);/** -* rt2x00queue_unmap_skb - Unmap a skb from DMA. -* @rt2x00dev: Pointer to &struct rt2x00_dev. -* @skb: The skb to unmap. -*/ -void rt2x00queue_unmap_skb (struct rt2x00_dev *rt2x00dev,struct sk_buff *skb); - -/** -* rt2x00queue_free_skb - free a skb -* @rt2x00dev: Pointer to &struct rt2x00_dev. -* @skb: The skb to free. -*/ -void rt2x00queue_free_skb (struct rt2x00_dev *rt2x00dev,struct sk_buff *skb); - -/** * 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.
@@ -977,18 +955,6 @@ struct data_queue *rt2x00queue_get_queue(struct rt2x00_dev *rt2x00dev,struct queue_entry *rt2x00queue_get_entry (struct data_queue *queue,enum queue_index index); -/** -* rt2x00queue_index_inc - Index incrementation function -* @queue: Queue (&struct data_queue) to perform the action on. -* @index: Index type (&enum queue_index) to perform the action on. -* -* This function will increase the requested index on the queue, -* it will grab the appropriate locks and handle queue overflow events by -* resetting the index to the start of the queue. -*/ -void rt2x00queue_index_inc (struct data_queue *queue,enum queue_index index); - -/* * Interrupt context handlers. */
drivers/net/wireless/rt2x00/rt2x00dev.c +29 -0
@@ -504,6 +504,12 @@ void rt2x00lib_txdone(struct queue_entry *entry, {struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;struct ieee80211_tx_info *tx_info =IEEE80211_SKB_CB (entry->skb); +enum data_queue_qid qid =skb_get_queue_mapping (entry->skb); + +/* +* Unmap the skb. +*/ +rt2x00queue_unmap_skb (rt2x00dev, entry->skb);/* * Send frame to debugfs immediately, after this call is completed
@@ -552,7 +558,25 @@ void rt2x00lib_txdone(struct queue_entry *entry,ieee80211_tx_status_irqsafe (rt2x00dev->hw, entry->skb); else dev_kfree_skb_irq(entry->skb); + +/* +* Make this entry available for reuse. +*/ entry->skb =NULL ; + entry->flags =0 ; + + rt2x00dev->ops->lib->init_txentry (rt2x00dev, entry); + +__clear_bit (ENTRY_OWNER_DEVICE_DATA , &entry->flags); +rt2x00queue_index_inc (entry->queue,Q_INDEX_DONE ); + +/* +* If the data queue was below the threshold before the txdone +* handler we must make sure the packet queue in the mac80211 stack +* is reenabled when the txdone handler has finished. +*/ +if (!rt2x00queue_threshold (entry->queue)) +ieee80211_wake_queue (rt2x00dev->hw, qid); }EXPORT_SYMBOL_GPL (rt2x00lib_txdone);
@@ -657,6 +681,11 @@ void rt2x00lib_rxdone(struct rt2x00_dev *rt2x00dev,* Replace the skb with the freshly allocated one. */ entry->skb = skb; + entry->flags =0 ; + + rt2x00dev->ops->lib->init_rxentry (rt2x00dev, entry); + +rt2x00queue_index_inc (entry->queue,Q_INDEX ); }EXPORT_SYMBOL_GPL (rt2x00lib_rxdone);
drivers/net/wireless/rt2x00/rt2x00lib.h +49 -2
59 lines not on this page · raw message
drivers/net/wireless/rt2x00/rt2x00pci.c +0 -49
67 lines not on this page · raw message
drivers/net/wireless/rt2x00/rt2x00pci.h +0 -9
@@ -115,15 +115,6 @@ struct queue_entry_priv_pci {*/ void rt2x00pci_rxdone (struct rt2x00_dev *rt2x00dev); -/** -* rt2x00pci_txdone - Handle TX done events -* @rt2x00dev: Device pointer, see &struct rt2x00_dev. -* @entry: Entry which has completed the transmission of a frame. -* @desc: TX done descriptor -*/ -void rt2x00pci_txdone (struct rt2x00_dev *rt2x00dev,struct queue_entry *entry, -struct txdone_entry_desc *desc); -/* * Device initialization handlers. */
drivers/net/wireless/rt2x00/rt2x00queue.c +11 -4
@@ -77,7 +77,6 @@ struct sk_buff *rt2x00queue_alloc_rxskb(struct rt2x00_dev *rt2x00dev,return skb; } -EXPORT_SYMBOL_GPL (rt2x00queue_alloc_rxskb);void rt2x00queue_map_txskb (struct rt2x00_dev *rt2x00dev,struct sk_buff *skb) {
@@ -105,7 +104,6 @@ void rt2x00queue_unmap_skb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb) skbdesc->flags &= ~SKBDESC_DMA_MAPPED_TX ; } } -EXPORT_SYMBOL_GPL (rt2x00queue_unmap_skb);void rt2x00queue_free_skb (struct rt2x00_dev *rt2x00dev,struct sk_buff *skb) {
@@ -123,7 +121,6 @@ void rt2x00queue_free_skb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb)dev_kfree_skb_any (skb); } -EXPORT_SYMBOL_GPL (rt2x00queue_free_skb);void rt2x00queue_create_tx_descriptor (struct queue_entry *entry,struct txentry_desc *txdesc)
@@ -289,6 +286,7 @@ int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb) {struct queue_entry *entry =rt2x00queue_get_entry (queue,Q_INDEX );struct txentry_desc txdesc; +struct skb_frame_desc *skbdesc;if (unlikely (rt2x00queue_full (queue)))return -EINVAL ;
@@ -309,11 +307,21 @@ int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb) entry->skb = skb;rt2x00queue_create_tx_descriptor (entry, &txdesc); +/* +* skb->cb array is now ours and we are free to use it. +*/ + skbdesc =get_skb_frame_desc (entry->skb); +memset (skbdesc,0 ,sizeof (*skbdesc)); + skbdesc->entry = entry; +if (unlikely (queue->rt2x00dev->ops->lib->write_tx_data (entry))) {__clear_bit (ENTRY_OWNER_DEVICE_DATA , &entry->flags);return -EIO ; } +if (test_bit (DRIVER_REQUIRE_DMA , &queue->rt2x00dev->flags)) +rt2x00queue_map_txskb (queue->rt2x00dev, skb); +__set_bit (ENTRY_DATA_PENDING , &entry->flags);rt2x00queue_index_inc (queue,Q_INDEX );
@@ -389,7 +397,6 @@ void rt2x00queue_index_inc(struct data_queue *queue, enum queue_index index)spin_unlock_irqrestore (&queue->lock, irqflags); } -EXPORT_SYMBOL_GPL (rt2x00queue_index_inc);static void rt2x00queue_reset (struct data_queue *queue) {
drivers/net/wireless/rt2x00/rt2x00queue.h +2 -0
@@ -82,6 +82,8 @@ enum data_queue_qid {/** * enum skb_frame_desc_flags: Flags for &struct skb_frame_desc * +* @SKBDESC_DMA_MAPPED_RX: &skb_dma field has been mapped for RX +* @SKBDESC_DMA_MAPPED_TX: &skb_dma field has been mapped for TX */ enum skb_frame_desc_flags {SKBDESC_DMA_MAPPED_RX = (1 <<0 ),
drivers/net/wireless/rt2x00/rt2x00usb.c +7 -35
82 lines not on this page · raw message
drivers/net/wireless/rt2x00/rt61pci.c +2 -2
@@ -1767,7 +1767,7 @@ static void rt61pci_txdone(struct rt2x00_dev *rt2x00dev)__set_bit (TXDONE_UNKNOWN , &txdesc.flags); txdesc.retry =0 ; -rt2x00pci_txdone (rt2x00dev, entry_done, &txdesc); +rt2x00lib_txdone (entry_done, &txdesc); entry_done =rt2x00queue_get_entry (queue,Q_INDEX_DONE ); }
@@ -1787,7 +1787,7 @@ static void rt61pci_txdone(struct rt2x00_dev *rt2x00dev) } txdesc.retry =rt2x00_get_field32 (reg,STA_CSR4_RETRY_COUNT ); -rt2x00pci_txdone (rt2x00dev, entry, &txdesc); +rt2x00lib_txdone (entry, &txdesc); } }
Signature · 1 line
1.5.5.4
PATCH 7/9 rt2x00: Fix sparse warning on nested container_of()
Sparse produces warnings about nested contain_of() statements, this means that lines like:
interface_to_usbdev(to_usb_interface(rt2x00dev->dev));
will upset sparse.
Add a new macro to rt2x00usb.h which will convert to device structure to the usb_device pointer in 2 steps to prevent this sparse warning.
--- drivers/net/wireless/rt2x00/rt2500usb.c | 3 +-- drivers/net/wireless/rt2x00/rt2x00usb.c | 9 +++------ drivers/net/wireless/rt2x00/rt2x00usb.h | 6 ++++++ 3 files changed, 10 insertions(+), 8 deletions(-)
drivers/net/wireless/rt2x00/rt2500usb.c +1 -2
@@ -1672,8 +1672,7 @@ static int rt2500usb_probe_hw(struct rt2x00_dev *rt2x00dev)static int rt2500usb_beacon_update (struct ieee80211_hw *hw,struct sk_buff *skb) {struct rt2x00_dev *rt2x00dev = hw->priv; -struct usb_device *usb_dev = -interface_to_usbdev (to_usb_interface (rt2x00dev->dev)); +struct usb_device *usb_dev =to_usb_device_intf (rt2x00dev->dev);struct ieee80211_tx_info *tx_info =IEEE80211_SKB_CB (skb);struct rt2x00_intf *intf =vif_to_intf (tx_info->control.vif);struct queue_entry_priv_usb_bcn *bcn_priv;
drivers/net/wireless/rt2x00/rt2x00usb.c +3 -6
@@ -40,8 +40,7 @@ int rt2x00usb_vendor_request(struct rt2x00_dev *rt2x00dev, void *buffer, const u16 buffer_length, const int timeout) { - struct usb_device *usb_dev = -interface_to_usbdev (to_usb_interface (rt2x00dev->dev)); + struct usb_device *usb_dev = to_usb_device_intf(rt2x00dev->dev);int status;unsigned int i; unsigned int pipe =
@@ -162,8 +161,7 @@ static void rt2x00usb_interrupt_txdone(struct urb *urb)int rt2x00usb_write_tx_data (struct queue_entry *entry) {struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; -struct usb_device *usb_dev = -interface_to_usbdev (to_usb_interface (rt2x00dev->dev)); +struct usb_device *usb_dev =to_usb_device_intf (rt2x00dev->dev);struct queue_entry_priv_usb *entry_priv = entry->priv_data;struct skb_frame_desc *skbdesc;u32 length;
@@ -319,8 +317,7 @@ EXPORT_SYMBOL_GPL(rt2x00usb_disable_radio);void rt2x00usb_init_rxentry (struct rt2x00_dev *rt2x00dev,struct queue_entry *entry) { -struct usb_device *usb_dev = -interface_to_usbdev (to_usb_interface (rt2x00dev->dev)); +struct usb_device *usb_dev =to_usb_device_intf (rt2x00dev->dev);struct queue_entry_priv_usb *entry_priv = entry->priv_data; usb_fill_bulk_urb(entry_priv->urb, usb_dev,
drivers/net/wireless/rt2x00/rt2x00usb.h +6 -0
@@ -26,6 +26,12 @@#ifndef RT2X00USB_H #define RT2X00USB_H +#define to_usb_device_intf (d) \ +({ \ + struct usb_interface *intf = to_usb_interface(d); \ + interface_to_usbdev(intf); \ +}) +/* * This variable should be used with the * usb_driver structure initialization.
Signature · 1 line
1.5.5.4
PATCH 8/9 rt2x00: Increase queue size
Without the preallocated DMA we can now safely increase the queue size withotu negative impact on the memory requirements of rt2x00.
--- drivers/net/wireless/rt2x00/rt2x00queue.h | 17 ++++++++++------- 1 files changed, 10 insertions(+), 7 deletions(-)
drivers/net/wireless/rt2x00/rt2x00queue.h +10 -7
@@ -42,15 +42,18 @@/** * DOC: Number of entries per queue * -* After research it was concluded that 12 entries in a RX and TX -* queue would be sufficient. Although this is almost one third of -* the amount the legacy driver allocated, the queues aren't getting -* filled to the maximum even when working with the maximum rate. +* Under normal load without fragmentation 12 entries are sufficient +* without the queue being filled up to the maximum. When using fragmentation +* and the queue threshold code we need to add some additional margins to +* make sure the queue will never (or only under extreme load) fill up +* completely. +* Since we don't use preallocated DMA having a large number of queue entries +* will have only minimal impact on the memory requirements for the queue. */ -#define RX_ENTRIES 12 -#define TX_ENTRIES 12 +#define RX_ENTRIES 24 +#define TX_ENTRIES 24#define BEACON_ENTRIES 1 -#define ATIM_ENTRIES 1 +#define ATIM_ENTRIES 8/** * enum data_queue_qid: Queue identification
Signature · 1 line
1.5.5.4
PATCH 9/9 rt2x00: Release rt2x00 2.1.8
--- drivers/net/wireless/rt2x00/rt2x00.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/wireless/rt2x00/rt2x00.h +1 -1
@@ -44,7 +44,7 @@/* * Module information. */ -#define DRV_VERSION "2.1.7" +#define DRV_VERSION "2.1.8"#define DRV_PROJECT "http://rt2x00.serialmonkey.com"/*
Signature · 1 line
1.5.5.4