Linux wireless drivers development
 help / color / mirror / Atom feed
* [PATCH] conserve stack space due to padding
@ 2007-06-14  7:26 Johannes Berg
  2007-06-15 13:30 ` Jiri Benc
  0 siblings, 1 reply; 2+ messages in thread
From: Johannes Berg @ 2007-06-14  7:26 UTC (permalink / raw)
  To: linux-wireless; +Cc: Jiri Benc, Michael Wu, John W. Linville

This patch reorders some fields in struct ieee802_11_elems to save 17*7
or 17*3 bytes (on 64/32-bit machines respectively) stack space in a few
functions.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>

---
I don't think this hurts readability at all since these things are
*very* structured to begin with. And having 8/4 byte fields alternate
with 1 byte fields isn't such a great idea.

 net/mac80211/ieee80211_sta.c |   35 +++++++++++++++++++----------------
 1 file changed, 19 insertions(+), 16 deletions(-)

--- wireless-dev.orig/net/mac80211/ieee80211_sta.c	2007-06-14 09:19:48.780669913 +0200
+++ wireless-dev/net/mac80211/ieee80211_sta.c	2007-06-14 09:21:28.720669913 +0200
@@ -79,39 +79,42 @@ static int ieee80211_sta_config_auth(str
 
 /* Parsed Information Elements */
 struct ieee802_11_elems {
+	/* pointers to IEs */
 	u8 *ssid;
-	u8 ssid_len;
 	u8 *supp_rates;
-	u8 supp_rates_len;
 	u8 *fh_params;
-	u8 fh_params_len;
 	u8 *ds_params;
-	u8 ds_params_len;
 	u8 *cf_params;
-	u8 cf_params_len;
 	u8 *tim;
-	u8 tim_len;
 	u8 *ibss_params;
-	u8 ibss_params_len;
 	u8 *challenge;
-	u8 challenge_len;
 	u8 *wpa;
-	u8 wpa_len;
 	u8 *rsn;
-	u8 rsn_len;
 	u8 *erp_info;
-	u8 erp_info_len;
 	u8 *ht_cap_param;
-	u8 ht_cap_param_len;
 	u8 *ht_extra_param;
-	u8 ht_extra_param_len;
 	u8 *ext_supp_rates;
-	u8 ext_supp_rates_len;
 	u8 *wmm_info;
-	u8 wmm_info_len;
 	u8 *wmm_param;
-	u8 wmm_param_len;
 	u8 *tspec;
+
+	/* length of them, respectively */
+	u8 ssid_len;
+	u8 supp_rates_len;
+	u8 fh_params_len;
+	u8 ds_params_len;
+	u8 cf_params_len;
+	u8 tim_len;
+	u8 ibss_params_len;
+	u8 challenge_len;
+	u8 wpa_len;
+	u8 rsn_len;
+	u8 erp_info_len;
+	u8 ht_cap_param_len;
+	u8 ht_extra_param_len;
+	u8 ext_supp_rates_len;
+	u8 wmm_info_len;
+	u8 wmm_param_len;
 	u8 tspec_len;
 };
 



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] conserve stack space due to padding
  2007-06-14  7:26 [PATCH] conserve stack space due to padding Johannes Berg
@ 2007-06-15 13:30 ` Jiri Benc
  0 siblings, 0 replies; 2+ messages in thread
From: Jiri Benc @ 2007-06-15 13:30 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless, Michael Wu, John W. Linville

On Thu, 14 Jun 2007 09:26:11 +0200, Johannes Berg wrote:
> This patch reorders some fields in struct ieee802_11_elems to save 17*7
> or 17*3 bytes (on 64/32-bit machines respectively) stack space in a few
> functions.
> 
> Signed-off-by: Johannes Berg <johannes@sipsolutions.net>

Acked-by: Jiri Benc <jbenc@suse.cz>

-- 
Jiri Benc
SUSE Labs

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-06-15 13:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-14  7:26 [PATCH] conserve stack space due to padding Johannes Berg
2007-06-15 13:30 ` Jiri Benc

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox