cfg80211: add debug print when processing a channel
authorLuis R. Rodriguez <lrodriguez@atheros.com>
Thu, 21 Oct 2010 13:47:04 +0000 (19:17 +0530)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 15 Nov 2010 18:24:14 +0000 (13:24 -0500)
In the worst case you are seeing really odd things you want
more information than what is provided right now, for those
that insist and want debug info through CONFIG_CFG80211_REG_DEBUG
provide a print of when we are processing a channel and with what
regulatory rule.

Cc: Easwar Krishnan <easwar.krishnan@atheros.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: Senthil Balasubramanian <senthilkumar@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
net/wireless/reg.c

index 6e7a9d853191bfca34084a8eb9172ef7290324fb..5556c5fe489a72e8f21c7bb96206267dae9e21e5 100644 (file)
@@ -728,6 +728,41 @@ static const char *reg_initiator_name(enum nl80211_reg_initiator initiator)
                return "Set by bug";
        }
 }
+
+static void chan_reg_rule_print_dbg(struct ieee80211_channel *chan,
+                                   u32 desired_bw_khz,
+                                   const struct ieee80211_reg_rule *reg_rule)
+{
+       const struct ieee80211_power_rule *power_rule;
+       const struct ieee80211_freq_range *freq_range;
+       char max_antenna_gain[32];
+
+       power_rule = &reg_rule->power_rule;
+       freq_range = &reg_rule->freq_range;
+
+       if (!power_rule->max_antenna_gain)
+               snprintf(max_antenna_gain, 32, "N/A");
+       else
+               snprintf(max_antenna_gain, 32, "%d", power_rule->max_antenna_gain);
+
+       REG_DBG_PRINT("cfg80211: Updating information on frequency %d MHz "
+                     "for %d a MHz width channel with regulatory rule:\n",
+                     chan->center_freq,
+                     KHZ_TO_MHZ(desired_bw_khz));
+
+       REG_DBG_PRINT("cfg80211: %d KHz - %d KHz @  KHz), (%s mBi, %d mBm)\n",
+                     freq_range->start_freq_khz,
+                     freq_range->end_freq_khz,
+                     max_antenna_gain,
+                     power_rule->max_eirp);
+}
+#else
+static void chan_reg_rule_print_dbg(struct ieee80211_channel *chan,
+                                   u32 desired_bw_khz,
+                                   const struct ieee80211_reg_rule *reg_rule)
+{
+       return;
+}
 #endif
 
 /*
@@ -790,6 +825,8 @@ static void handle_channel(struct wiphy *wiphy,
                return;
        }
 
+       chan_reg_rule_print_dbg(chan, desired_bw_khz, reg_rule);
+
        power_rule = &reg_rule->power_rule;
        freq_range = &reg_rule->freq_range;
 
@@ -1134,6 +1171,8 @@ static void handle_channel_custom(struct wiphy *wiphy,
                return;
        }
 
+       chan_reg_rule_print_dbg(chan, desired_bw_khz, reg_rule);
+
        power_rule = &reg_rule->power_rule;
        freq_range = &reg_rule->freq_range;