1 Index: madwifi-trunk-r3314/ath/if_ath.c
2 ===================================================================
3 --- madwifi-trunk-r3314.orig/ath/if_ath.c
4 +++ madwifi-trunk-r3314/ath/if_ath.c
6 struct ath_softc *sc = dev->priv;
7 struct ieee80211_node *ni = NULL;
8 struct ath_buf *bf = NULL;
9 - struct ether_header *eh;
11 struct ath_buf *tbf, *tempbf;
17 + struct ether_header *eh;
19 struct ieee80211com *ic = &sc->sc_ic;
21 @@ -3314,27 +3314,9 @@
27 - /* If the skb data is shared, we will copy it so we can strip padding
28 - * without affecting any other bridge ports. */
29 - if (skb_cloned(skb)) {
30 - /* Remember the original SKB so we can free up our references */
31 - struct sk_buff *skb_new;
32 - skb_new = skb_copy(skb, GFP_ATOMIC);
33 - if (skb_new == NULL) {
34 - DPRINTF(sc, ATH_DEBUG_XMIT,
35 - "Dropping; skb_copy failure.\n");
36 - /* No free RAM, do not requeue! */
37 - goto hardstart_fail;
39 - ieee80211_skb_copy_noderef(skb, skb_new);
40 - ieee80211_dev_kfree_skb(&skb);
43 eh = (struct ether_header *)skb->data;
46 /* NB: use this lock to protect an->an_tx_ffbuf (and txq->axq_stageq)
47 * in athff_can_aggregate() call too. */
48 ATH_TXQ_LOCK_IRQ(txq);
49 Index: madwifi-trunk-r3314/net80211/ieee80211_output.c
50 ===================================================================
51 --- madwifi-trunk-r3314.orig/net80211/ieee80211_output.c
52 +++ madwifi-trunk-r3314/net80211/ieee80211_output.c
55 if (vap->iv_xrvap && (ni == vap->iv_bss) &&
56 vap->iv_xrvap->iv_sta_assoc) {
57 - struct sk_buff *skb1 = skb_copy(skb, GFP_ATOMIC);
58 + struct sk_buff *skb1 = skb_clone(skb, GFP_ATOMIC);
60 memset(SKB_CB(skb1), 0, sizeof(struct ieee80211_cb));
61 #ifdef IEEE80211_DEBUG_REFCNT
63 struct ieee80211_key *key, struct sk_buff *skb, int ismulticast)
65 /* XXX pre-calculate per node? */
66 - int need_headroom = LLC_SNAPFRAMELEN + hdrsize + IEEE80211_ADDR_LEN;
67 + int need_headroom = LLC_SNAPFRAMELEN + hdrsize;
68 int need_tailroom = 0;
70 int isff = ATH_FF_MAGIC_PRESENT(skb);
71 @@ -608,109 +608,56 @@
72 need_tailroom += cip->ic_miclen;
75 - if (skb_shared(skb)) {
76 - /* Take our own reference to the node in the clone */
77 - ieee80211_ref_node(SKB_CB(skb)->ni);
78 - /* Unshare the node, decrementing users in the old skb */
79 - skb = skb_unshare(skb, GFP_ATOMIC);
80 + need_headroom -= skb_headroom(skb);
82 + need_tailroom -= skb_tailroom(skb2);
84 + need_tailroom -= skb_tailroom(skb);
86 + if (need_headroom < 0)
88 + if (need_tailroom < 0)
91 + if (skb_cloned(skb) || (need_headroom > 0) ||
92 + (!isff && (need_tailroom > 0))) {
94 + if (pskb_expand_head(skb, need_headroom, need_tailroom, GFP_ATOMIC)) {
95 + IEEE80211_DPRINTF(vap, IEEE80211_MSG_OUTPUT,
96 + "%s: cannot expand storage (tail)\n", __func__);
104 - IEEE80211_DPRINTF(vap, IEEE80211_MSG_OUTPUT,
105 - "%s: cannot unshare for encapsulation\n",
107 - vap->iv_stats.is_tx_nobuf++;
108 - ieee80211_dev_kfree_skb(&skb2);
112 + inter_headroom -= skb_headroom(skb2);
113 + if (inter_headroom < 0)
114 + inter_headroom = 0;
115 + if ((skb_cloned(skb2) ||
116 + (inter_headroom > 0) || (need_tailroom > 0))) {
118 - /* first skb header */
119 - if (skb_headroom(skb) < need_headroom) {
120 - struct sk_buff *tmp = skb;
121 - skb = skb_realloc_headroom(skb, need_headroom);
123 + if (pskb_expand_head(skb2, inter_headroom,
124 + need_tailroom, GFP_ATOMIC)) {
125 IEEE80211_DPRINTF(vap, IEEE80211_MSG_OUTPUT,
126 - "%s: cannot expand storage (head1)\n",
128 - vap->iv_stats.is_tx_nobuf++;
129 - ieee80211_dev_kfree_skb(&skb2);
132 - ieee80211_skb_copy_noderef(tmp, skb);
133 - ieee80211_dev_kfree_skb(&tmp);
134 - /* NB: cb[] area was copied, but not next ptr. must do that
135 - * prior to return on success. */
138 - /* second skb with header and tail adjustments possible */
139 - if (skb_tailroom(skb2) < need_tailroom) {
141 - if (inter_headroom > skb_headroom(skb2))
142 - n = inter_headroom - skb_headroom(skb2);
143 - if (pskb_expand_head(skb2, n,
144 - need_tailroom - skb_tailroom(skb2), GFP_ATOMIC)) {
145 - ieee80211_dev_kfree_skb(&skb2);
146 - IEEE80211_DPRINTF(vap, IEEE80211_MSG_OUTPUT,
147 - "%s: cannot expand storage (tail2)\n",
149 - vap->iv_stats.is_tx_nobuf++;
150 - /* this shouldn't happen, but don't send first ff either */
151 - ieee80211_dev_kfree_skb(&skb);
152 + "%s: cannot expand storage (tail)\n", __func__);
155 - } else if (skb_headroom(skb2) < inter_headroom) {
156 - struct sk_buff *tmp = skb2;
158 - skb2 = skb_realloc_headroom(skb2, inter_headroom);
159 - if (skb2 == NULL) {
160 - IEEE80211_DPRINTF(vap, IEEE80211_MSG_OUTPUT,
161 - "%s: cannot expand storage (head2)\n",
163 - vap->iv_stats.is_tx_nobuf++;
164 - /* this shouldn't happen, but don't send first ff either */
165 - ieee80211_dev_kfree_skb(&skb);
168 - ieee80211_skb_copy_noderef(tmp, skb);
169 - ieee80211_dev_kfree_skb(&tmp);
177 #endif /* ATH_SUPERG_FF */
179 - IEEE80211_DPRINTF(vap, IEEE80211_MSG_OUTPUT,
180 - "%s: cannot unshare for encapsulation\n", __func__);
181 - vap->iv_stats.is_tx_nobuf++;
182 - } else if (skb_tailroom(skb) < need_tailroom) {
184 - if (need_headroom > skb_headroom(skb))
185 - n = need_headroom - skb_headroom(skb);
186 - if (pskb_expand_head(skb, n, need_tailroom -
187 - skb_tailroom(skb), GFP_ATOMIC)) {
188 - IEEE80211_DPRINTF(vap, IEEE80211_MSG_OUTPUT,
189 - "%s: cannot expand storage (tail)\n", __func__);
190 - vap->iv_stats.is_tx_nobuf++;
191 - ieee80211_dev_kfree_skb(&skb);
193 - } else if (skb_headroom(skb) < need_headroom) {
194 - struct sk_buff *tmp = skb;
195 - skb = skb_realloc_headroom(skb, need_headroom);
196 - /* Increment reference count after copy */
198 - IEEE80211_DPRINTF(vap, IEEE80211_MSG_OUTPUT,
199 - "%s: cannot expand storage (head)\n", __func__);
200 - vap->iv_stats.is_tx_nobuf++;
202 - ieee80211_skb_copy_noderef(tmp, skb);
203 - ieee80211_dev_kfree_skb(&tmp);
209 + vap->iv_stats.is_tx_nobuf++;
210 + ieee80211_dev_kfree_skb(&skb);
211 +#ifdef ATH_SUPERG_FF
213 + ieee80211_dev_kfree_skb(&skb2);
218 #define KEY_UNDEFINED(k) ((k).wk_cipher == &ieee80211_cipher_none)
219 Index: madwifi-trunk-r3314/net80211/ieee80211_input.c
220 ===================================================================
221 --- madwifi-trunk-r3314.orig/net80211/ieee80211_input.c
222 +++ madwifi-trunk-r3314/net80211/ieee80211_input.c
224 struct ieee80211_frame *wh;
225 struct ieee80211_key *key;
226 struct ether_header *eh;
227 - struct sk_buff *skb2;
232 vap->iv_stats.is_rx_tooshort++;
235 - /* Clone the SKB... we assume somewhere in this driver that we 'own'
236 - * the skbuff passed into hard start and we do a lot of messing with it
237 - * but bridges under some cases will not clone for the first pass of skb
238 - * to a bridge port, but will then clone for subsequent ones. This is
239 - * odd behavior but it means that if we have trashed the skb we are given
240 - * then other ports get clones of the residual garbage.
242 - if ((skb2 = skb_copy(skb, GFP_ATOMIC)) == NULL) {
243 - vap->iv_devstats.tx_dropped++;
246 - ieee80211_skb_copy_noderef(skb, skb2);
247 - ieee80211_dev_kfree_skb(&skb);
251 * Bit of a cheat here, we use a pointer for a 3-address
253 /* ether_type must be length as FF frames are always LLC/SNAP encap'd */
254 frame_len = ntohs(eh_tmp->ether_type);
256 - skb1 = skb_copy(skb, GFP_ATOMIC);
257 + skb1 = skb_clone(skb, GFP_ATOMIC);
260 ieee80211_skb_copy_noderef(skb, skb1);
261 @@ -1137,7 +1122,7 @@
263 if (ETHER_IS_MULTICAST(eh->ether_dhost) && !netif_queue_stopped(dev)) {
264 /* Create a SKB for the BSS to send out. */
265 - skb1 = skb_copy(skb, GFP_ATOMIC);
266 + skb1 = skb_clone(skb, GFP_ATOMIC);
268 SKB_CB(skb1)->ni = ieee80211_ref_node(vap->iv_bss);