From: Joe Perches <joe@perches.com>
To: Thomas Pedersen <thomas@cozybit.com>
Cc: johannes@sipsolutions.net, linux-wireless@vger.kernel.org,
devel@lists.open80211s.org
Subject: Re: [PATCH 5/6] mac80211: stringify another plink state
Date: Mon, 08 Apr 2013 15:19:12 -0700 [thread overview]
Message-ID: <1365459552.2029.20.camel@joe-AO722> (raw)
In-Reply-To: <1365456467.2029.16.camel@joe-AO722>
On Mon, 2013-04-08 at 14:27 -0700, Joe Perches wrote:
> On Mon, 2013-04-08 at 11:06 -0700, Thomas Pedersen wrote:
> > The patch "mac80211: stringify mesh peering events" missed
> > an opportunity to print the peering state as a string.
>
> Perhaps it's better to use functions for these instead of
> indexing in case an index is somehow incorrectly set.
Maybe:
net/mac80211/mesh_plink.c | 73 +++++++++++++++++++++++++++++++++--------------
1 file changed, 51 insertions(+), 22 deletions(-)
diff --git a/net/mac80211/mesh_plink.c b/net/mac80211/mesh_plink.c
index 937e06f..55d01d4 100644
--- a/net/mac80211/mesh_plink.c
+++ b/net/mac80211/mesh_plink.c
@@ -37,27 +37,55 @@ enum plink_event {
CLS_IGNR
};
-static const char * const mplstates[] = {
- [NL80211_PLINK_LISTEN] = "LISTEN",
- [NL80211_PLINK_OPN_SNT] = "OPN-SNT",
- [NL80211_PLINK_OPN_RCVD] = "OPN-RCVD",
- [NL80211_PLINK_CNF_RCVD] = "CNF_RCVD",
- [NL80211_PLINK_ESTAB] = "ESTAB",
- [NL80211_PLINK_HOLDING] = "HOLDING",
- [NL80211_PLINK_BLOCKED] = "BLOCKED"
-};
+static const char *mplstates(enum nl80211_plink_state state)
+{
+ switch (state) {
+ case NL80211_PLINK_LISTEN:
+ return "LISTEN";
+ case NL80211_PLINK_OPN_SNT:
+ return "OPN-SNT";
+ case NL80211_PLINK_OPN_RCVD:
+ return "OPN-RCVD";
+ case NL80211_PLINK_CNF_RCVD:
+ return "CNF_RCVD";
+ case NL80211_PLINK_ESTAB:
+ return "ESTAB";
+ case NL80211_PLINK_HOLDING:
+ return "HOLDING";
+ case NL80211_PLINK_BLOCKED:
+ return "BLOCKED";
+ default:
+ break;
+ }
+ return "UNKNOWN_PLINK_STATE";
+}
-static const char * const mplevents[] = {
- [PLINK_UNDEFINED] = "NONE",
- [OPN_ACPT] = "OPN_ACPT",
- [OPN_RJCT] = "OPN_RJCT",
- [OPN_IGNR] = "OPN_IGNR",
- [CNF_ACPT] = "CNF_ACPT",
- [CNF_RJCT] = "CNF_RJCT",
- [CNF_IGNR] = "CNF_IGNR",
- [CLS_ACPT] = "CLS_ACPT",
- [CLS_IGNR] = "CLS_IGNR"
-};
+static const char *mplevents(enum plink_event event)
+{
+ switch (event) {
+ case PLINK_UNDEFINED:
+ return "NONE";
+ case OPN_ACPT:
+ return "OPN_ACPT";
+ case OPN_RJCT:
+ return "OPN_RJCT";
+ case OPN_IGNR:
+ return "OPN_IGNR";
+ case CNF_ACPT:
+ return "CNF_ACPT";
+ case CNF_RJCT:
+ return "CNF_RJCT";
+ case CNF_IGNR:
+ return "CNF_IGNR";
+ case CLS_ACPT:
+ return "CLS_ACPT";
+ case CLS_IGNR:
+ return "CLS_IGNR";
+ default:
+ break;
+ }
+ return "UNKNOWN_PLINK_EVENT";
+}
static int mesh_plink_frame_tx(struct ieee80211_sub_if_data *sdata,
enum ieee80211_self_protected_actioncode action,
@@ -841,8 +869,9 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata,
}
}
- mpl_dbg(sdata, "peer %pM in state %s got event %s\n", mgmt->sa,
- mplstates[sta->plink_state], mplevents[event]);
+ mpl_dbg(sdata, "peer %pM in state %d (%s) got event %d (%s)\n",
+ mgmt->sa, sta->plink_state, mplstates(sta->plink_state),
+ event, mplevents(event));
reason = 0;
spin_lock_bh(&sta->lock);
switch (sta->plink_state) {
next prev parent reply other threads:[~2013-04-08 22:19 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-08 18:06 [PATCH 1/6] mac80211: unset FC retry bit in mesh fwding path Thomas Pedersen
2013-04-08 18:06 ` [PATCH 2/6] mac80211: exclude multicast frames from BA accounting Thomas Pedersen
2013-04-09 9:47 ` Johannes Berg
2013-04-10 22:15 ` Thomas Pedersen
2013-04-08 18:06 ` [PATCH 3/6] mac80211: ieee80211_queue_stopped returns reasons Thomas Pedersen
2013-04-08 18:32 ` Antonio Quartulli
2013-04-08 18:37 ` Johannes Berg
2013-04-08 19:30 ` Thomas Pedersen
2013-04-08 19:38 ` Johannes Berg
2013-04-08 19:57 ` Thomas Pedersen
2013-04-09 9:37 ` Johannes Berg
2013-04-10 17:36 ` Thomas Pedersen
2013-04-10 18:16 ` Johannes Berg
2013-04-08 18:06 ` [PATCH 4/6] mac80211: limit mesh forwarding drops Thomas Pedersen
2013-04-08 18:06 ` [PATCH 5/6] mac80211: stringify another plink state Thomas Pedersen
2013-04-09 9:48 ` Johannes Berg
2013-04-08 18:06 ` [PATCH 6/6] mac80211: avoid mesh peer rate update warning Thomas Pedersen
2013-04-09 9:38 ` Johannes Berg
2013-04-09 9:42 ` Johannes Berg
2013-04-10 17:38 ` Thomas Pedersen
[not found] ` <1782507887.154.1365455855469.JavaMail.mail@webmail12>
2013-04-08 21:27 ` [PATCH 5/6] mac80211: stringify another plink state Joe Perches
2013-04-08 22:19 ` Joe Perches [this message]
2013-04-09 9:39 ` [PATCH 1/6] mac80211: unset FC retry bit in mesh fwding path Johannes Berg
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=1365459552.2029.20.camel@joe-AO722 \
--to=joe@perches.com \
--cc=devel@lists.open80211s.org \
--cc=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
--cc=thomas@cozybit.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.