linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Michael Büsch" <m@bues.ch>
To: "Rafał Miłecki" <zajec5@gmail.com>
Cc: linux-wireless@vger.kernel.org,
	"John W. Linville" <linville@tuxdriver.com>,
	b43-dev@lists.infradead.org
Subject: Re: [PATCH 1/2] b43: implement PPR (Power Per Rate) management/API
Date: Sun, 20 Jul 2014 13:19:37 +0200	[thread overview]
Message-ID: <20140720131937.3229b17c@wiggum> (raw)
In-Reply-To: <1405854022-11833-1-git-send-email-zajec5@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1265 bytes --]

On Sun, 20 Jul 2014 13:00:21 +0200
Rafał Miłecki <zajec5@gmail.com> wrote:

> +#define B43_PPR_CCK_RATES_NUM		4
> +#define B43_PPR_OFDM_RATES_NUM		8
> +#define B43_PPR_MCS_RATES_NUM		8
> +
> +#define B43_PPR_RATES_NUM	(B43_PPR_CCK_RATES_NUM +	\
> +				 B43_PPR_OFDM_RATES_NUM * 2 +	\
> +				 B43_PPR_MCS_RATES_NUM * 4)
> +
> +struct b43_ppr_rates {
> +	u8 cck[B43_PPR_CCK_RATES_NUM];
> +	u8 ofdm[B43_PPR_OFDM_RATES_NUM];
> +	u8 ofdm_20_cdd[B43_PPR_OFDM_RATES_NUM];
> +	u8 mcs_20[B43_PPR_MCS_RATES_NUM]; /* SISO */
> +	u8 mcs_20_cdd[B43_PPR_MCS_RATES_NUM];
> +	u8 mcs_20_stbc[B43_PPR_MCS_RATES_NUM];
> +	u8 mcs_20_sdm[B43_PPR_MCS_RATES_NUM];
> +} __packed;
> +
> +struct b43_ppr {
> +	/* All powers are in qdbm (Q5.2) */
> +	union {
> +		u8 __all_rates[B43_PPR_RATES_NUM];
> +		struct b43_ppr_rates rates;
> +	} __packed;

I don't think this union has to be packed.
And most likely struct b43_ppr_rates is ok without packing, too.
You could probably remove it there and add a BUILD_BUG which checks something like (pseudocode):
BUILD_BUG_ON(offsetof(struct b43_ppr_rates.mcs_20_sdm) != B43_PPR_CCK_RATES_NUM + B43_PPR_OFDM_RATES_NUM * 2 + B43_PPR_MCS_RATES_NUM * 3);

Removing packed will produce much nicer code.

-- 
Michael

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  parent reply	other threads:[~2014-07-20 11:54 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-20 11:00 [PATCH 1/2] b43: implement PPR (Power Per Rate) management/API Rafał Miłecki
2014-07-20 11:00 ` [PATCH 2/2] b43: N-PHY: support setting custom TX power Rafał Miłecki
2014-07-20 11:02   ` Rafał Miłecki
2014-07-20 11:26   ` Michael Büsch
2014-07-20 11:50     ` Rafał Miłecki
2014-07-20 12:03       ` Michael Büsch
2014-07-20 11:49   ` Jonas Gorski
2014-07-20 11:53     ` Rafał Miłecki
2014-07-20 12:10       ` Jonas Gorski
2014-07-20 11:19 ` Michael Büsch [this message]
2014-07-20 11:34   ` [PATCH 1/2] b43: implement PPR (Power Per Rate) management/API Rafał Miłecki
2014-07-20 11:38 ` Jonas Gorski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140720131937.3229b17c@wiggum \
    --to=m@bues.ch \
    --cc=b43-dev@lists.infradead.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=zajec5@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).