1 Index: madwifi-trunk-r3314/ath/if_ath.c
2 ===================================================================
3 --- madwifi-trunk-r3314.orig/ath/if_ath.c 2008-04-17 18:17:28.000000000 +0200
4 +++ madwifi-trunk-r3314/ath/if_ath.c 2008-04-17 18:17:28.000000000 +0200
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 2008-04-17 18:17:27.000000000 +0200
52 +++ madwifi-trunk-r3314/net80211/ieee80211_output.c 2008-04-17 18:18:04.000000000 +0200
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
62 @@ -615,100 +615,45 @@
63 skb = skb_unshare(skb, GFP_ATOMIC);
69 + if (skb_cloned(skb) ||
70 + (need_headroom > skb_headroom(skb)) ||
71 + (!isff && (need_tailroom > skb_tailroom(skb)))) {
73 + if (pskb_expand_head(skb, need_headroom, need_tailroom, GFP_ATOMIC)) {
74 IEEE80211_DPRINTF(vap, IEEE80211_MSG_OUTPUT,
75 - "%s: cannot unshare for encapsulation\n",
77 + "%s: cannot expand storage (tail)\n", __func__);
78 vap->iv_stats.is_tx_nobuf++;
79 - ieee80211_dev_kfree_skb(&skb2);
81 + ieee80211_dev_kfree_skb(&skb);
86 - /* first skb header */
87 - if (skb_headroom(skb) < need_headroom) {
88 - struct sk_buff *tmp = skb;
89 - skb = skb_realloc_headroom(skb, need_headroom);
91 - IEEE80211_DPRINTF(vap, IEEE80211_MSG_OUTPUT,
92 - "%s: cannot expand storage (head1)\n",
94 - vap->iv_stats.is_tx_nobuf++;
95 - ieee80211_dev_kfree_skb(&skb2);
98 - ieee80211_skb_copy_noderef(tmp, skb);
99 - ieee80211_dev_kfree_skb(&tmp);
100 - /* NB: cb[] area was copied, but not next ptr. must do that
101 - * prior to return on success. */
102 +#ifdef ATH_SUPERG_FF
104 + if (skb_shared(skb2)) {
105 + /* Take our own reference to the node in the clone */
106 + ieee80211_ref_node(SKB_CB(skb2)->ni);
107 + /* Unshare the node, decrementing users in the old skb */
108 + skb2 = skb_unshare(skb2, GFP_ATOMIC);
111 - /* second skb with header and tail adjustments possible */
112 - if (skb_tailroom(skb2) < need_tailroom) {
114 - if (inter_headroom > skb_headroom(skb2))
115 - n = inter_headroom - skb_headroom(skb2);
116 - if (pskb_expand_head(skb2, n,
117 - need_tailroom - skb_tailroom(skb2), GFP_ATOMIC)) {
118 - ieee80211_dev_kfree_skb(&skb2);
119 - IEEE80211_DPRINTF(vap, IEEE80211_MSG_OUTPUT,
120 - "%s: cannot expand storage (tail2)\n",
122 - vap->iv_stats.is_tx_nobuf++;
123 - /* this shouldn't happen, but don't send first ff either */
124 - ieee80211_dev_kfree_skb(&skb);
126 - } else if (skb_headroom(skb2) < inter_headroom) {
127 - struct sk_buff *tmp = skb2;
128 + if ((skb_cloned(skb2) ||
129 + (inter_headroom > skb_headroom(skb2)) ||
130 + (need_tailroom > skb_tailroom(skb2)))) {
132 - skb2 = skb_realloc_headroom(skb2, inter_headroom);
133 - if (skb2 == NULL) {
134 + if (pskb_expand_head(skb2, inter_headroom,
135 + need_tailroom, GFP_ATOMIC)) {
136 IEEE80211_DPRINTF(vap, IEEE80211_MSG_OUTPUT,
137 - "%s: cannot expand storage (head2)\n",
139 + "%s: cannot expand storage (tail)\n", __func__);
140 vap->iv_stats.is_tx_nobuf++;
141 - /* this shouldn't happen, but don't send first ff either */
142 ieee80211_dev_kfree_skb(&skb);
145 - ieee80211_skb_copy_noderef(tmp, skb);
146 - ieee80211_dev_kfree_skb(&tmp);
150 + ieee80211_dev_kfree_skb(&skb2);
157 #endif /* ATH_SUPERG_FF */
159 - IEEE80211_DPRINTF(vap, IEEE80211_MSG_OUTPUT,
160 - "%s: cannot unshare for encapsulation\n", __func__);
161 - vap->iv_stats.is_tx_nobuf++;
162 - } else if (skb_tailroom(skb) < need_tailroom) {
164 - if (need_headroom > skb_headroom(skb))
165 - n = need_headroom - skb_headroom(skb);
166 - if (pskb_expand_head(skb, n, need_tailroom -
167 - skb_tailroom(skb), GFP_ATOMIC)) {
168 - IEEE80211_DPRINTF(vap, IEEE80211_MSG_OUTPUT,
169 - "%s: cannot expand storage (tail)\n", __func__);
170 - vap->iv_stats.is_tx_nobuf++;
171 - ieee80211_dev_kfree_skb(&skb);
173 - } else if (skb_headroom(skb) < need_headroom) {
174 - struct sk_buff *tmp = skb;
175 - skb = skb_realloc_headroom(skb, need_headroom);
176 - /* Increment reference count after copy */
178 - IEEE80211_DPRINTF(vap, IEEE80211_MSG_OUTPUT,
179 - "%s: cannot expand storage (head)\n", __func__);
180 - vap->iv_stats.is_tx_nobuf++;
182 - ieee80211_skb_copy_noderef(tmp, skb);
183 - ieee80211_dev_kfree_skb(&tmp);
188 Index: madwifi-trunk-r3314/net80211/ieee80211_input.c
189 ===================================================================
190 --- madwifi-trunk-r3314.orig/net80211/ieee80211_input.c 2008-04-17 18:17:28.000000000 +0200
191 +++ madwifi-trunk-r3314/net80211/ieee80211_input.c 2008-04-17 18:25:48.000000000 +0200
193 vap->iv_stats.is_rx_tooshort++;
196 - /* Clone the SKB... we assume somewhere in this driver that we 'own'
197 - * the skbuff passed into hard start and we do a lot of messing with it
198 - * but bridges under some cases will not clone for the first pass of skb
199 - * to a bridge port, but will then clone for subsequent ones. This is
200 - * odd behavior but it means that if we have trashed the skb we are given
201 - * then other ports get clones of the residual garbage.
203 - if ((skb2 = skb_copy(skb, GFP_ATOMIC)) == NULL) {
204 - vap->iv_devstats.tx_dropped++;
207 - ieee80211_skb_copy_noderef(skb, skb2);
208 - ieee80211_dev_kfree_skb(&skb);
212 * Bit of a cheat here, we use a pointer for a 3-address
214 /* ether_type must be length as FF frames are always LLC/SNAP encap'd */
215 frame_len = ntohs(eh_tmp->ether_type);
217 - skb1 = skb_copy(skb, GFP_ATOMIC);
218 + skb1 = skb_clone(skb, GFP_ATOMIC);
221 ieee80211_skb_copy_noderef(skb, skb1);
222 @@ -1137,7 +1123,7 @@
224 if (ETHER_IS_MULTICAST(eh->ether_dhost) && !netif_queue_stopped(dev)) {
225 /* Create a SKB for the BSS to send out. */
226 - skb1 = skb_copy(skb, GFP_ATOMIC);
227 + skb1 = skb_clone(skb, GFP_ATOMIC);
229 SKB_CB(skb1)->ni = ieee80211_ref_node(vap->iv_bss);