Skip to contentSkip to conversation

mac80211: Add iface name when calling WARN-ON.

PATCH Superseded [email protected] 3 participants 4 messages Mar 10, 2012 mac80211

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mac80211: Add iface name when calling WARN-ON.

From: Ben Greear <[email protected]>

This lets the user know which interface has failed the check_sdata_in_driver check.

---
:100644 100644 e8960ae... e62e7c3... M net/mac80211/driver-ops.h

 net/mac80211/driver-ops.h |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
net/mac80211/driver-ops.h +5 -1
index e8960ae..e62e7c3 100644
@@ -7,7 +7,11 @@
 
 static inline void check_sdata_in_driver(struct ieee80211_sub_if_data *sdata)
 {
-	WARN_ON(!(sdata->flags & IEEE80211_SDATA_IN_DRIVER));
+	if (unlikely(!(sdata->flags & IEEE80211_SDATA_IN_DRIVER))) {
+		printk(KERN_ERR "%s:  Failed check-sdata-in-driver check, flags: 0x%x\n",
+		       sdata->dev->name, sdata->flags);
+		WARN_ON(1);
+	}
 }
 
 static inline struct ieee80211_sub_if_data *
Signature · 1 line
1.7.3.4
maintainer
#1 lore raw
Quoted 16 lines · On Fri, 2012-03-09 at 10:36 -0800, [email protected] wrote:

From: Ben Greear <[email protected]>

This lets the user know which interface has failed the check_sdata_in_driver check.

---
:100644 100644 e8960ae... e62e7c3... M net/mac80211/driver-ops.h

 net/mac80211/driver-ops.h |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
net/mac80211/driver-ops.h +0 -0
index e8960ae..e62e7c3 100644

net/mac80211/driver-ops.h line 14

Quoted 9 lines
net/mac80211/driver-ops.h +5 -1
@@ -7,7 +7,11 @@
 
 static inline void check_sdata_in_driver(struct ieee80211_sub_if_data *sdata)
 {
-	WARN_ON(!(sdata->flags & IEEE80211_SDATA_IN_DRIVER));
+	if (unlikely(!(sdata->flags & IEEE80211_SDATA_IN_DRIVER))) {
+		printk(KERN_ERR "%s:  Failed check-sdata-in-driver check, flags: 0x%x\n",
+		       sdata->dev->name, sdata->flags);
+		WARN_ON(1);
+	}

How about WARN(!(...), ...) instead -- that way the message will be part of the warning too.

johannes

author
#2 lore raw
Quoted 30 lines · Johannes Berg
Quoted 16 lines · On Fri, 2012-03-09 at 10:36 -0800, [email protected] wrote:

From: Ben Greear<[email protected]>

This lets the user know which interface has failed the check_sdata_in_driver check.

---
:100644 100644 e8960ae... e62e7c3... M net/mac80211/driver-ops.h

  net/mac80211/driver-ops.h |    6 +++++-
  1 files changed, 5 insertions(+), 1 deletions(-)
net/mac80211/driver-ops.h +0 -0
index e8960ae..e62e7c3 100644

net/mac80211/driver-ops.h line 14

Quoted 9 lines
net/mac80211/driver-ops.h +5 -1
@@ -7,7 +7,11 @@
 
  static inline void check_sdata_in_driver(struct ieee80211_sub_if_data *sdata)
  {
-	WARN_ON(!(sdata->flags&  IEEE80211_SDATA_IN_DRIVER));
+	if (unlikely(!(sdata->flags&  IEEE80211_SDATA_IN_DRIVER))) {
+		printk(KERN_ERR "%s:  Failed check-sdata-in-driver check, flags: 0x%x\n",
+		       sdata->dev->name, sdata->flags);
+		WARN_ON(1);
+	}

How about WARN(!(...), ...) instead -- that way the message will be part of the warning too.

Quoted 1 line

johannes

Sure. Also, should I maybe un-inline this thing since it is now a bit bigger code wise?

Thanks,
Ben

Signature · 2 lines
Ben Greear <[email protected]>
Candela Technologies Inc  http://www.candelatech.com
#3 lore raw

On Sat, 2012-03-10 at 09:16 -0800, Ben Greear wrote:
[]

Quoted 1 line
Quoted 1 line

net/mac80211/driver-ops.h

Quoted 1 line
net/mac80211/driver-ops.h +0 -0

[]

Quoted 8 lines
Quoted 8 lines

net/mac80211/driver-ops.h line 12

Quoted 8 lines
net/mac80211/driver-ops.h +3 -1
@@ -7,7 +7,11 @@
 
  static inline void check_sdata_in_driver(struct ieee80211_sub_if_data *sdata)
  {
-	WARN_ON(!(sdata->flags&  IEEE80211_SDATA_IN_DRIVER));
+	if (unlikely(!(sdata->flags&  IEEE80211_SDATA_IN_DRIVER))) {
+		printk(KERN_ERR "%s:  Failed check-sdata-in-driver check, flags: 0x%x\n",
+		       sdata->dev->name, sdata->flags);

Perhaps better as:

		netdev_err(sdata->dev, "%s(): Failed check, flags: 0x%x\n",
			   __func__, sdata->flags);