some more fixes for wds sta separation
[openwrt.git] / package / madwifi / patches-testing / 309-performance.patch
1 --- a/ath/if_ath.c
2 +++ b/ath/if_ath.c
3 @@ -3334,7 +3334,6 @@
4 struct ath_softc *sc = dev->priv;
5 struct ieee80211_node *ni = NULL;
6 struct ath_buf *bf = NULL;
7 - struct ether_header *eh;
8 ath_bufhead bf_head;
9 struct ath_buf *tbf;
10 struct sk_buff *tskb;
11 @@ -3349,6 +3348,7 @@
12 */
13 int requeue = 0;
14 #ifdef ATH_SUPERG_FF
15 + struct ether_header *eh;
16 unsigned int pktlen;
17 struct ieee80211com *ic = &sc->sc_ic;
18 struct ath_txq *txq = NULL;
19 --- a/net80211/ieee80211_output.c
20 +++ b/net80211/ieee80211_output.c
21 @@ -280,7 +280,7 @@
22 * normal vap. */
23 if (vap->iv_xrvap && (ni == vap->iv_bss) &&
24 vap->iv_xrvap->iv_sta_assoc) {
25 - struct sk_buff *skb1 = skb_copy(skb, GFP_ATOMIC);
26 + struct sk_buff *skb1 = skb_clone(skb, GFP_ATOMIC);
27 if (skb1) {
28 memset(SKB_CB(skb1), 0, sizeof(struct ieee80211_cb));
29 #ifdef IEEE80211_DEBUG_REFCNT
30 @@ -561,7 +561,7 @@
31 struct ieee80211_key *key, struct sk_buff *skb, int ismulticast)
32 {
33 /* XXX pre-calculate per node? */
34 - int need_headroom = LLC_SNAPFRAMELEN + hdrsize + IEEE80211_ADDR_LEN;
35 + int need_headroom = LLC_SNAPFRAMELEN + hdrsize;
36 int need_tailroom = 0;
37 #ifdef ATH_SUPERG_FF
38 int isff = ATH_FF_MAGIC_PRESENT(skb);
39 @@ -603,109 +603,56 @@
40 need_tailroom += cip->ic_miclen;
41 }
42
43 - if (skb_shared(skb)) {
44 - /* Take our own reference to the node in the clone */
45 - ieee80211_ref_node(SKB_NI(skb));
46 - /* Unshare the node, decrementing users in the old skb */
47 - skb = skb_unshare(skb, GFP_ATOMIC);
48 + need_headroom -= skb_headroom(skb);
49 + if (isff)
50 + need_tailroom -= skb_tailroom(skb2);
51 + else
52 + need_tailroom -= skb_tailroom(skb);
53 +
54 + if (need_headroom < 0)
55 + need_headroom = 0;
56 + if (need_tailroom < 0)
57 + need_tailroom = 0;
58 +
59 + if (skb_cloned(skb) || (need_headroom > 0) ||
60 + (!isff && (need_tailroom > 0))) {
61 +
62 + if (pskb_expand_head(skb, need_headroom, need_tailroom, GFP_ATOMIC)) {
63 + IEEE80211_DPRINTF(vap, IEEE80211_MSG_OUTPUT,
64 + "%s: cannot expand storage (tail)\n", __func__);
65 + goto error;
66 + }
67 }
68
69 #ifdef ATH_SUPERG_FF
70 if (isff) {
71 - if (skb == NULL) {
72 - IEEE80211_DPRINTF(vap, IEEE80211_MSG_OUTPUT,
73 - "%s: cannot unshare for encapsulation\n",
74 - __func__);
75 - vap->iv_stats.is_tx_nobuf++;
76 - ieee80211_dev_kfree_skb(&skb2);
77 -
78 - return NULL;
79 - }
80 + inter_headroom -= skb_headroom(skb2);
81 + if (inter_headroom < 0)
82 + inter_headroom = 0;
83 + if ((skb_cloned(skb2) ||
84 + (inter_headroom > 0) || (need_tailroom > 0))) {
85
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);
90 - if (skb == NULL) {
91 + if (pskb_expand_head(skb2, inter_headroom,
92 + need_tailroom, GFP_ATOMIC)) {
93 IEEE80211_DPRINTF(vap, IEEE80211_MSG_OUTPUT,
94 - "%s: cannot expand storage (head1)\n",
95 - __func__);
96 - vap->iv_stats.is_tx_nobuf++;
97 - ieee80211_dev_kfree_skb(&skb2);
98 - return NULL;
99 - } else
100 - ieee80211_skb_copy_noderef(tmp, skb);
101 - ieee80211_dev_kfree_skb(&tmp);
102 - /* NB: cb[] area was copied, but not next ptr. must do that
103 - * prior to return on success. */
104 - }
105 -
106 - /* second skb with header and tail adjustments possible */
107 - if (skb_tailroom(skb2) < need_tailroom) {
108 - int n = 0;
109 - if (inter_headroom > skb_headroom(skb2))
110 - n = inter_headroom - skb_headroom(skb2);
111 - if (pskb_expand_head(skb2, n,
112 - need_tailroom - skb_tailroom(skb2), GFP_ATOMIC)) {
113 - ieee80211_dev_kfree_skb(&skb2);
114 - IEEE80211_DPRINTF(vap, IEEE80211_MSG_OUTPUT,
115 - "%s: cannot expand storage (tail2)\n",
116 - __func__);
117 - vap->iv_stats.is_tx_nobuf++;
118 - /* this shouldn't happen, but don't send first ff either */
119 - ieee80211_dev_kfree_skb(&skb);
120 + "%s: cannot expand storage (tail)\n", __func__);
121 + goto error;
122 }
123 - } else if (skb_headroom(skb2) < inter_headroom) {
124 - struct sk_buff *tmp = skb2;
125 -
126 - skb2 = skb_realloc_headroom(skb2, inter_headroom);
127 - if (skb2 == NULL) {
128 - IEEE80211_DPRINTF(vap, IEEE80211_MSG_OUTPUT,
129 - "%s: cannot expand storage (head2)\n",
130 - __func__);
131 - vap->iv_stats.is_tx_nobuf++;
132 - /* this shouldn't happen, but don't send first ff either */
133 - ieee80211_dev_kfree_skb(&skb);
134 - skb = NULL;
135 - } else
136 - ieee80211_skb_copy_noderef(tmp, skb);
137 - ieee80211_dev_kfree_skb(&tmp);
138 }
139 - if (skb) {
140 - skb->next = skb2;
141 - }
142 - return skb;
143 + skb->next = skb2;
144 }
145 #endif /* ATH_SUPERG_FF */
146 - if (skb == NULL) {
147 - IEEE80211_DPRINTF(vap, IEEE80211_MSG_OUTPUT,
148 - "%s: cannot unshare for encapsulation\n", __func__);
149 - vap->iv_stats.is_tx_nobuf++;
150 - } else if (skb_tailroom(skb) < need_tailroom) {
151 - int n = 0;
152 - if (need_headroom > skb_headroom(skb))
153 - n = need_headroom - skb_headroom(skb);
154 - if (pskb_expand_head(skb, n, need_tailroom -
155 - skb_tailroom(skb), GFP_ATOMIC)) {
156 - IEEE80211_DPRINTF(vap, IEEE80211_MSG_OUTPUT,
157 - "%s: cannot expand storage (tail)\n", __func__);
158 - vap->iv_stats.is_tx_nobuf++;
159 - ieee80211_dev_kfree_skb(&skb);
160 - }
161 - } else if (skb_headroom(skb) < need_headroom) {
162 - struct sk_buff *tmp = skb;
163 - skb = skb_realloc_headroom(skb, need_headroom);
164 - /* Increment reference count after copy */
165 - if (skb == NULL) {
166 - IEEE80211_DPRINTF(vap, IEEE80211_MSG_OUTPUT,
167 - "%s: cannot expand storage (head)\n", __func__);
168 - vap->iv_stats.is_tx_nobuf++;
169 - } else
170 - ieee80211_skb_copy_noderef(tmp, skb);
171 - ieee80211_dev_kfree_skb(&tmp);
172 - }
173
174 return skb;
175 +
176 +error:
177 + vap->iv_stats.is_tx_nobuf++;
178 + ieee80211_dev_kfree_skb(&skb);
179 +#ifdef ATH_SUPERG_FF
180 + if (skb2)
181 + ieee80211_dev_kfree_skb(&skb2);
182 +#endif
183 + return NULL;
184 }
185
186 #define KEY_UNDEFINED(k) ((k).wk_cipher == &ieee80211_cipher_none)
187 --- a/net80211/ieee80211_input.c
188 +++ b/net80211/ieee80211_input.c
189 @@ -713,7 +713,7 @@
190 /* ether_type must be length as FF frames are always LLC/SNAP encap'd */
191 frame_len = ntohs(eh_tmp->ether_type);
192
193 - skb1 = skb_copy(skb, GFP_ATOMIC);
194 + skb1 = skb_clone(skb, GFP_ATOMIC);
195 if (skb1 == NULL)
196 goto err;
197 ieee80211_skb_copy_noderef(skb, skb1);
198 @@ -1118,7 +1118,7 @@
199
200 if (ETHER_IS_MULTICAST(eh->ether_dhost) && !netif_queue_stopped(dev)) {
201 /* Create a SKB for the BSS to send out. */
202 - skb1 = skb_copy(skb, GFP_ATOMIC);
203 + skb1 = skb_clone(skb, GFP_ATOMIC);
204 if (skb1)
205 SKB_NI(skb1) = ieee80211_ref_node(vap->iv_bss);
206 }
207 @@ -2265,7 +2265,7 @@
208 if (filter_type && ((vap->app_filter & filter_type) == filter_type)) {
209 struct sk_buff *skb1;
210
211 - skb1 = skb_copy(skb, GFP_ATOMIC);
212 + skb1 = skb_clone(skb, GFP_ATOMIC);
213 if (skb1 == NULL)
214 return;
215 /* We duplicate the reference after skb_copy */
This page took 0.052205 seconds and 5 git commands to generate.