linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Calvin Owens <jcalvinowens@gmail.com>
To: Joe Perches <joe@perches.com>
Cc: Johannes Berg <johannes@sipsolutions.net>,
	"David S. Miller" <davem@davemloft.net>,
	"John W. Linville" <linville@tuxdriver.com>,
	linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] ieee80211: Print human-readable disassoc/deauth reason codes
Date: Tue, 11 Feb 2014 11:52:32 -0600	[thread overview]
Message-ID: <20140211175232.GA782@gmail.com> (raw)
In-Reply-To: <1392138837.2511.2.camel@joe-AO722>

On Tuesday 02/11 at 09:13 -0800, Joe Perches wrote:
> On Tue, 2014-02-11 at 10:37 -0600, Calvin Owens wrote:
> > Create a function to return a descriptive string for each reason code,
> > and print that in addition to the numeric value in the kernel log. These
> > codes are easily found on popular search engines, but one is generally
> > not able to access the internet when dealing with wireless connectivity
> > issues.
> []
> >  include/net/mac80211.h | 10 +++++++++
> >  net/mac80211/main.c    | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++
> >  net/mac80211/mlme.c    | 12 +++++------
> >  3 files changed, 73 insertions(+), 6 deletions(-)
> 
> Is there a reason why all of this this shouldn't
> be a static function local to mlme.c?
> 
> Is this ever going to be used somewhere else?

The enum for the reason code is defined in "include/linux/ieee80211.h",
which is #include'd in 61 different files, so I thought it was
conceivable that it might. I also thought the compiler wasn't likely to
inline it even if it were static, since it wasn't tiny and had several
callers.

The switch statement approach produces nice, smaller code though:
(as opposed to the original with the array of strings)

ffffffff81728ac0 <ieee80211_get_reason_code_string>:
ffffffff81728ac0:       83 ef 01                sub    $0x1,%edi
ffffffff81728ac3:       55                      push   %rbp
ffffffff81728ac4:       48 c7 c0 f5 a7 a6 81    mov    $0xffffffff81a6a7f5,%rax
ffffffff81728acb:       66 83 ff 41             cmp    $0x41,%di
ffffffff81728acf:       48 89 e5                mov    %rsp,%rbp
ffffffff81728ad2:       77 0b                   ja     ffffffff81728adf <ieee80211_get_reason_code_string+0x1f>
ffffffff81728ad4:       0f b7 ff                movzwl %di,%edi
ffffffff81728ad7:       48 8b 04 fd 40 98 8e    mov -0x7e7167c0(,%rdi,8),%rax
ffffffff81728ade:       81 
ffffffff81728adf:       5d                      pop    %rbp
ffffffff81728ae0:       c3                      retq   
ffffffff81728ae1:       66 66 66 66 66 66 2e    data32 data32 data32 data32 data32 nopw %cs:0x0(%rax,%rax,1)
ffffffff81728ae8:       0f 1f 84 00 00 00 00 
ffffffff81728aef:       00 

... so it probably would get inlined. I'll make it static and resend.

Thanks,
Calvin

  reply	other threads:[~2014-02-11 17:53 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-06  1:44 [PATCH] ieee80211: Print human-readable disassoc/deauth reason codes Calvin Owens
2014-02-06  4:44 ` Joe Perches
2014-02-10 11:09   ` Johannes Berg
2014-02-10 16:39     ` Joe Perches
2014-02-11  1:25       ` [PATCH v2] " Calvin Owens
2014-02-11  1:39         ` Joe Perches
2014-02-11 16:37           ` [PATCH v3] " Calvin Owens
2014-02-11 16:48             ` Antonio Quartulli
2014-02-11 17:59               ` Calvin Owens
2014-02-11 18:19               ` Johannes Berg
2014-02-11 17:13             ` Joe Perches
2014-02-11 17:52               ` Calvin Owens [this message]
2014-02-11 18:36                 ` [PATCH v4] " Calvin Owens
2014-02-12 10:46                   ` Johannes Berg
2014-02-06  8:37 ` [PATCH] " Johannes Berg
2014-02-07 12:53   ` Kalle Valo
2014-02-07 15:46     ` Larry Finger
2014-02-07 22:25       ` Luca Coelho
2014-02-08  6:38         ` Kalle Valo
2014-02-07 20:50   ` Calvin Owens
2014-02-10  8:50 ` Jouni Malinen

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=20140211175232.GA782@gmail.com \
    --to=jcalvinowens@gmail.com \
    --cc=davem@davemloft.net \
    --cc=joe@perches.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.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).