Re: [PATCH] net: mac80211: tx.c: be sure of 'sdata->vif.type' must be NL80211_IFTYPE_AP when be in NL80211_IFTYPE_AP case

Chen Gang
2013-12-01T11:50:33Z

On 12/01/2013 05:37 PM, Johannes Berg wrote:
> On Sun, 2013-12-01 at 07:48 +0800, Chen Gang wrote:
>
>> If ieee80211_subif_start_xmit() is not performance sensitive (I guess
>> so), we can use some short static functions instead of some code blocks
>> within ieee80211_subif_start_xmit().
>>
>> - ieee80211_subif_start_xmit() is a long function (600+ lines).
>>
>> - use short static function can share some code.
>>
>> - if code can be shared, the work flow can be more clearer too (don't
>> need fall-through or goto).
>
> Frankly, I'm getting tired of discussing this. Please don't try to
> rewrite this code until you've understood it. You suggesting that
> "start_xmit()" isn't a performance sensitive function makes me realize
> you haven't even tried.
>

OK, thank you for "you are getting tired ...". Please help try when you
have time. :-)

No I didn't try -- so use 'if' and 'guess' for discussing.

Hmm... if it is performance sensitive:

- use static function instead of some code block and try to share them.
it adds additional instructions, but can shrink binary code size.
if the performance is acceptable, it is the best way to me.

- else (1st way not acceptable), use macro instead of static function.
it expends binary code size, but can save some instructions.
if the performance is acceptable, it is the acceptable way to me.

- If neither of static function nor macro are acceptable,
I still prefer to use 'goto' instead of 'fall-through'.
that can let all compilers feel well, and can not feel any strange.

normally, when prev case uses fall-through,
it need be sure of next case need not notice about it (prev case).
or it will make a little strange for readers when read next case.

Welcome any suggestions or completions.

Thanks.
--
Chen Gang