p54: upgrade memrecord to p54_tx_info

mac80211 reserves 24 bytes in skb->cb for the driver.
So far, we only used them to keep track of used and free device memory.
But p54spi will need a slice of it, as well as the stuck frame detection.

Signed-off-by: Christian Lamparter <chunkeey@web.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
Christian Lamparter 2009-01-09 21:06:06 +01:00 committed by John W. Linville
parent 63f2dc9f2f
commit 3cd08b383b
3 changed files with 21 additions and 17 deletions

View File

@ -44,6 +44,16 @@ enum p54_control_frame_types {
P54_CONTROL_TYPE_BT_OPTIONS = 35 P54_CONTROL_TYPE_BT_OPTIONS = 35
}; };
/* provide 16 bytes for the transport back-end */
#define P54_TX_INFO_DATA_SIZE 16
/* stored in ieee80211_tx_info's rate_driver_data */
struct p54_tx_info {
u32 start_addr;
u32 end_addr;
void *data[P54_TX_INFO_DATA_SIZE / sizeof(void *)];
};
#define P54_MAX_CTRL_FRAME_LEN 0x1000 #define P54_MAX_CTRL_FRAME_LEN 0x1000
#define P54_HDR_FLAG_CONTROL BIT(15) #define P54_HDR_FLAG_CONTROL BIT(15)

View File

@ -700,7 +700,7 @@ void p54_free_skb(struct ieee80211_hw *dev, struct sk_buff *skb)
{ {
struct p54_common *priv = dev->priv; struct p54_common *priv = dev->priv;
struct ieee80211_tx_info *info; struct ieee80211_tx_info *info;
struct memrecord *range; struct p54_tx_info *range;
unsigned long flags; unsigned long flags;
u32 freed = 0, last_addr = priv->rx_start; u32 freed = 0, last_addr = priv->rx_start;
@ -718,18 +718,18 @@ void p54_free_skb(struct ieee80211_hw *dev, struct sk_buff *skb)
range = (void *)info->rate_driver_data; range = (void *)info->rate_driver_data;
if (skb->prev != (struct sk_buff *)&priv->tx_queue) { if (skb->prev != (struct sk_buff *)&priv->tx_queue) {
struct ieee80211_tx_info *ni; struct ieee80211_tx_info *ni;
struct memrecord *mr; struct p54_tx_info *mr;
ni = IEEE80211_SKB_CB(skb->prev); ni = IEEE80211_SKB_CB(skb->prev);
mr = (struct memrecord *)ni->rate_driver_data; mr = (struct p54_tx_info *)ni->rate_driver_data;
last_addr = mr->end_addr; last_addr = mr->end_addr;
} }
if (skb->next != (struct sk_buff *)&priv->tx_queue) { if (skb->next != (struct sk_buff *)&priv->tx_queue) {
struct ieee80211_tx_info *ni; struct ieee80211_tx_info *ni;
struct memrecord *mr; struct p54_tx_info *mr;
ni = IEEE80211_SKB_CB(skb->next); ni = IEEE80211_SKB_CB(skb->next);
mr = (struct memrecord *)ni->rate_driver_data; mr = (struct p54_tx_info *)ni->rate_driver_data;
freed = mr->start_addr - last_addr; freed = mr->start_addr - last_addr;
} else } else
freed = priv->rx_end - last_addr; freed = priv->rx_end - last_addr;
@ -771,7 +771,7 @@ static void p54_rx_frame_sent(struct ieee80211_hw *dev, struct sk_buff *skb)
struct p54_frame_sent *payload = (struct p54_frame_sent *) hdr->data; struct p54_frame_sent *payload = (struct p54_frame_sent *) hdr->data;
struct sk_buff *entry = (struct sk_buff *) priv->tx_queue.next; struct sk_buff *entry = (struct sk_buff *) priv->tx_queue.next;
u32 addr = le32_to_cpu(hdr->req_id) - priv->headroom; u32 addr = le32_to_cpu(hdr->req_id) - priv->headroom;
struct memrecord *range = NULL; struct p54_tx_info *range = NULL;
u32 freed = 0; u32 freed = 0;
u32 last_addr = priv->rx_start; u32 last_addr = priv->rx_start;
unsigned long flags; unsigned long flags;
@ -793,10 +793,10 @@ static void p54_rx_frame_sent(struct ieee80211_hw *dev, struct sk_buff *skb)
if (entry->next != (struct sk_buff *)&priv->tx_queue) { if (entry->next != (struct sk_buff *)&priv->tx_queue) {
struct ieee80211_tx_info *ni; struct ieee80211_tx_info *ni;
struct memrecord *mr; struct p54_tx_info *mr;
ni = IEEE80211_SKB_CB(entry->next); ni = IEEE80211_SKB_CB(entry->next);
mr = (struct memrecord *)ni->rate_driver_data; mr = (struct p54_tx_info *)ni->rate_driver_data;
freed = mr->start_addr - last_addr; freed = mr->start_addr - last_addr;
} else } else
freed = priv->rx_end - last_addr; freed = priv->rx_end - last_addr;
@ -1013,8 +1013,8 @@ EXPORT_SYMBOL_GPL(p54_rx);
* can find some unused memory to upload our packets to. However, data that we * can find some unused memory to upload our packets to. However, data that we
* want the card to TX needs to stay intact until the card has told us that * want the card to TX needs to stay intact until the card has told us that
* it is done with it. This function finds empty places we can upload to and * it is done with it. This function finds empty places we can upload to and
* marks allocated areas as reserved if necessary. p54_rx_frame_sent frees * marks allocated areas as reserved if necessary. p54_rx_frame_sent or
* allocated areas. * p54_free_skb frees allocated areas.
*/ */
static int p54_assign_address(struct ieee80211_hw *dev, struct sk_buff *skb, static int p54_assign_address(struct ieee80211_hw *dev, struct sk_buff *skb,
struct p54_hdr *data, u32 len) struct p54_hdr *data, u32 len)
@ -1023,7 +1023,7 @@ static int p54_assign_address(struct ieee80211_hw *dev, struct sk_buff *skb,
struct sk_buff *entry = priv->tx_queue.next; struct sk_buff *entry = priv->tx_queue.next;
struct sk_buff *target_skb = NULL; struct sk_buff *target_skb = NULL;
struct ieee80211_tx_info *info; struct ieee80211_tx_info *info;
struct memrecord *range; struct p54_tx_info *range;
u32 last_addr = priv->rx_start; u32 last_addr = priv->rx_start;
u32 largest_hole = 0; u32 largest_hole = 0;
u32 target_addr = priv->rx_start; u32 target_addr = priv->rx_start;

View File

@ -247,12 +247,6 @@ struct pda_country {
#define PDR_COUNTRY_CERT_IODOOR_OUTDOOR 0x30 #define PDR_COUNTRY_CERT_IODOOR_OUTDOOR 0x30
#define PDR_COUNTRY_CERT_INDEX 0x0F #define PDR_COUNTRY_CERT_INDEX 0x0F
/* stored in skb->cb */
struct memrecord {
u32 start_addr;
u32 end_addr;
};
struct p54_eeprom_lm86 { struct p54_eeprom_lm86 {
union { union {
struct { struct {