# HG changeset patch # User Joseph Jezak # Node ID 44dc6d811204fa79fae1e9c1b0e1acd903ccbac3 # Parent 1dcc1205cc139dfd0529bd8d6efa3eee24e4cca2 Fixed ieee80211 sending, no more skbs. diff -r 1dcc1205cc13 -r 44dc6d811204 ieee80211softmac_io.c --- a/ieee80211softmac_io.c Fri Nov 25 18:25:54 2005 +++ b/ieee80211softmac_io.c Sat Nov 26 02:42:07 2005 @@ -33,7 +33,7 @@ */ #include "ieee80211softmac.h" -#include +#include /* Helper functions for inserting data into the frames */ @@ -67,18 +67,19 @@ /* Allocate a management frame */ -static struct sk_buff * +static u8 * ieee80211softmac_alloc_mgt(u32 size) { - struct sk_buff *skb; + u8 * data; + /* Add the header and FCS to the size */ size = size + IEEE80211_3ADDR_LEN; if(size > IEEE80211_DATA_LEN) return NULL; /* Allocate the skb */ - skb = alloc_skb(size, GFP_ATOMIC); - return skb; + data = kmalloc(size, GFP_ATOMIC); + return data; } /* Add a header to a management frame */ @@ -88,9 +89,9 @@ struct ieee80211_hdr_3addr *header = (struct ieee80211_hdr_3addr *)dst; /* Setup the FC */ - /* DA */ - - /* BA */ + /* Destination Address */ + + /* Source Address */ /* BSSID */ @@ -110,14 +111,25 @@ ieee80211softmac_send_mgt_frame(struct ieee80211softmac_device *mac, struct ieee80211_network *net, u32 type, u32 arg) { - struct sk_buff *skb; int pkt_size = 0; u16 status, seq, reason; - u8 *data; + u8 *data, *pkt; switch (type) { case IEEE80211_STYPE_ASSOC_REQ: case IEEE80211_STYPE_REASSOC_REQ: + pkt_size = ( + 2 + /* Capability Info */ + 2 + /* Listen Interval */ + /* MAC of AP if REASSOC */ + (type == IEEE80211_STYPE_REASSOC_REQ ? + ETH_ALEN : 0) + /* SSID */ + /* Rates */ + ); + pkt = ieee80211softmac_alloc_mgt(pkt_size); + if (pkt == NULL) + return -ENOMEM; break; case IEEE80211_STYPE_AUTH: status = (arg >> 16) & 0xFFFF; /* Status field */ @@ -130,10 +142,10 @@ ); /* Allocate Packet */ - skb = ieee80211softmac_alloc_mgt(pkt_size); - if(skb == NULL) + pkt = ieee80211softmac_alloc_mgt(pkt_size); + if(pkt == NULL) return -ENOMEM; - data = skb->data + IEEE80211_3ADDR_LEN; + data = pkt + IEEE80211_3ADDR_LEN; /* Algorithm */ *data = cpu_to_le16(0); /* FIXME Open, for now */ @@ -154,10 +166,10 @@ reason = arg & 0xFFFF; pkt_size = 2; /* Reason Code */ /* Allocate Packet */ - skb = ieee80211softmac_alloc_mgt(pkt_size); - if(skb == NULL) + pkt = ieee80211softmac_alloc_mgt(pkt_size); + if(pkt == NULL) return -ENOMEM; - data = skb->data + IEEE80211_3ADDR_LEN; + data = pkt + IEEE80211_3ADDR_LEN; /* Reason */ *data = cpu_to_le16(reason); @@ -169,13 +181,14 @@ }; /* Add the header */ - ieee80211softmac_add_3addr(mac, skb->head, net, type); + ieee80211softmac_add_3addr(mac, pkt, net, type); /* Send the packet to the ieee80211 layer for tx */ - ieee80211_xmit(skb, mac->ieee->dev); - - /* FIXME check if the xmit free's the skb and if not, - * is it safe to do so here? */ + ieee80211_tx_frame(mac->ieee, (struct ieee80211_hdr *) pkt, pkt_size); + + kfree(pkt); + data = NULL; + return 0; }