From patchwork Mon Mar 2 17:40:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Westphal X-Patchwork-Id: 5916181 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 2E9E2BF440 for ; Mon, 2 Mar 2015 17:40:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5CC6F201F2 for ; Mon, 2 Mar 2015 17:40:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5203B201DD for ; Mon, 2 Mar 2015 17:40:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754802AbbCBRkv (ORCPT ); Mon, 2 Mar 2015 12:40:51 -0500 Received: from Chamillionaire.breakpoint.cc ([80.244.247.6]:54115 "EHLO Chamillionaire.breakpoint.cc" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754648AbbCBRkr (ORCPT ); Mon, 2 Mar 2015 12:40:47 -0500 Received: from fw by Chamillionaire.breakpoint.cc with local (Exim 4.80) (envelope-from ) id 1YSUKj-0003UZ-TY; Mon, 02 Mar 2015 18:40:45 +0100 From: Florian Westphal To: Cc: Florian Westphal , linux-wireless@vger.kernel.org Subject: [PATCH RFC 08/14] net: wireless: mac80211: shrink ieee80211_tx_info Date: Mon, 2 Mar 2015 18:40:22 +0100 Message-Id: <1425318028-26531-9-git-send-email-fw@strlen.de> X-Mailer: git-send-email 2.0.5 In-Reply-To: <1425318028-26531-1-git-send-email-fw@strlen.de> References: <1425318028-26531-1-git-send-email-fw@strlen.de> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP to make it fit into (future) 44-byte sized skb->cb[]. This works, since flags is only used to store values from mac80211_tx_control_flags enum, and these are just 2 bits. We can thus move this to the padding hole inside the union. Also add BUILD_BUG_ON magic to make sure that the new flags field doesn't share storage w. other members of the union. Cc: linux-wireless@vger.kernel.org Signed-off-by: Florian Westphal --- include/net/mac80211.h | 11 ++++++++--- net/mac80211/main.c | 3 +++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 63c3708..36c2599 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -737,16 +737,21 @@ struct ieee80211_tx_info { u8 use_cts_prot:1; u8 short_preamble:1; u8 skip_table:1; - /* 2 bytes free */ + enum mac80211_tx_control_flags flags:2; + /* used for BUILD_BUG_ON validation that ->flags won't + * overlap with jiffies below */ + char flags_end[0]; }; /* only needed before rate control */ unsigned long jiffies; + + /* used for BUILD_BUG_ON validation that ->flags won't + * overlap with other members of this union. */ + char union_end[0]; }; /* NB: vif can be NULL for injected frames */ struct ieee80211_vif *vif; struct ieee80211_key_conf *hw_key; - u32 flags; - /* 4 bytes free */ } control; struct { struct ieee80211_tx_rate rates[IEEE80211_TX_MAX_RATES]; diff --git a/net/mac80211/main.c b/net/mac80211/main.c index 5e09d35..9e8c807 100644 --- a/net/mac80211/main.c +++ b/net/mac80211/main.c @@ -1218,6 +1218,9 @@ static int __init ieee80211_init(void) BUILD_BUG_ON(offsetof(struct ieee80211_tx_info, driver_data) + IEEE80211_TX_INFO_DRIVER_DATA_SIZE > sizeof(skb->cb)); + BUILD_BUG_ON(offsetof(struct ieee80211_tx_info, control.flags_end) < + offsetof(struct ieee80211_tx_info, control.union_end)); + ret = rc80211_minstrel_init(); if (ret) return ret;