Commit 9012b28a authored by Holger Schurig's avatar Holger Schurig Committed by John W. Linville

[PATCH] libertas: make debug configurable

The debug output of libertas was either not present or it was overwhelming.
This patch adds the possibility to specify a bitmask for the area of
interest. One should then only get the desired output.
Signed-off-by: default avatarHolger Schurig <hs4233@mail.mn-solutions.de>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 46868202
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -402,11 +402,11 @@ static int libertas_event_initcmd(wlan_private *priv, void **response_buf, ...@@ -402,11 +402,11 @@ static int libertas_event_initcmd(wlan_private *priv, void **response_buf,
u16 wait_option = cmd_option_waitforrsp; u16 wait_option = cmd_option_waitforrsp;
if (!(*cmdnode = libertas_get_free_cmd_ctrl_node(priv))) { if (!(*cmdnode = libertas_get_free_cmd_ctrl_node(priv))) {
lbs_pr_debug(1, "failed libertas_get_free_cmd_ctrl_node\n"); lbs_deb_debugfs("failed libertas_get_free_cmd_ctrl_node\n");
return -ENOMEM; return -ENOMEM;
} }
if (!(*response_buf = kmalloc(3000, GFP_KERNEL))) { if (!(*response_buf = kmalloc(3000, GFP_KERNEL))) {
lbs_pr_debug(1, "failed to allocate response buffer!\n"); lbs_deb_debugfs("failed to allocate response buffer!\n");
return -ENOMEM; return -ENOMEM;
} }
libertas_set_cmd_ctrl_node(priv, *cmdnode, 0, wait_option, NULL); libertas_set_cmd_ctrl_node(priv, *cmdnode, 0, wait_option, NULL);
...@@ -1864,7 +1864,7 @@ static ssize_t wlan_debugfs_write(struct file *f, const char __user *buf, ...@@ -1864,7 +1864,7 @@ static ssize_t wlan_debugfs_write(struct file *f, const char __user *buf,
return 0; return 0;
if (copy_from_user(pdata, buf, cnt)) { if (copy_from_user(pdata, buf, cnt)) {
lbs_pr_debug(1, "Copy from user failed\n"); lbs_deb_debugfs("Copy from user failed\n");
kfree(pdata); kfree(pdata);
return 0; return 0;
} }
......
...@@ -7,8 +7,6 @@ ...@@ -7,8 +7,6 @@
#include <linux/spinlock.h> #include <linux/spinlock.h>
extern unsigned int libertas_debug;
#ifdef CONFIG_LIBERTAS_DEBUG #ifdef CONFIG_LIBERTAS_DEBUG
#define DEBUG #define DEBUG
#define PROC_DEBUG #define PROC_DEBUG
...@@ -16,6 +14,71 @@ extern unsigned int libertas_debug; ...@@ -16,6 +14,71 @@ extern unsigned int libertas_debug;
#define DRV_NAME "usb8xxx" #define DRV_NAME "usb8xxx"
#define LBS_DEB_ENTER (1<<0)
#define LBS_DEB_LEAVE (1<<1)
#define LBS_DEB_MAIN (1<<2)
#define LBS_DEB_NET (1<<3)
#define LBS_DEB_MESH (1<<4)
#define LBS_DEB_WEXT (1<<5)
#define LBS_DEB_IOCTL (1<<6)
#define LBS_DEB_SCAN (1<<7)
#define LBS_DEB_ASSOC (1<<8)
#define LBS_DEB_JOIN (1<<9)
#define LBS_DEB_11D (1<<10)
#define LBS_DEB_DEBUGFS (1<<11)
#define LBS_DEB_ETHTOOL (1<<12)
#define LBS_DEB_HOST (1<<13)
#define LBS_DEB_CMD (1<<14)
#define LBS_DEB_RX (1<<15)
#define LBS_DEB_TX (1<<16)
#define LBS_DEB_FW (1<<17)
#define LBS_DEB_USB (1<<18)
#define LBS_DEB_CS (1<<19)
#define LBS_DEB_THREAD (1<<20)
#define LBS_DEB_HEX (1<<21)
extern unsigned int libertas_debug_flags;
#ifdef DEBUG
#define LBS_DEB_LL(grp, fmt, args...) \
do { if ((libertas_debug_flags & (grp)) == (grp)) \
printk(KERN_DEBUG DRV_NAME "%s: " fmt, \
in_interrupt() ? " (INT)" : "", ## args); } while (0)
#else
#define LBS_DEB_LL(grp, fmt, args...) do {} while (0)
#endif
#define lbs_deb_enter(grp) \
LBS_DEB_LL(grp | LBS_DEB_ENTER, "%s() %d enter\n", __FUNCTION__, __LINE__);
#define lbs_deb_enter_args(grp, fmt, args...) \
LBS_DEB_LL(grp | LBS_DEB_ENTER, "%s(" fmt "):%d\n", __FUNCTION__, ## args, __LINE__);
#define lbs_deb_leave(grp) \
LBS_DEB_LL(grp | LBS_DEB_LEAVE, "%s():%d leave\n", __FUNCTION__, __LINE__);
#define lbs_deb_leave_args(grp, fmt, args...) \
LBS_DEB_LL(grp | LBS_DEB_LEAVE, "%s():%d leave, " fmt "\n", \
__FUNCTION__, __LINE__, ##args);
#define lbs_deb_main(fmt, args...) LBS_DEB_LL(LBS_DEB_MAIN, fmt, ##args)
#define lbs_deb_net(fmt, args...) LBS_DEB_LL(LBS_DEB_NET, fmt, ##args)
#define lbs_deb_mesh(fmt, args...) LBS_DEB_LL(LBS_DEB_MESH, fmt, ##args)
#define lbs_deb_wext(fmt, args...) LBS_DEB_LL(LBS_DEB_WEXT, fmt, ##args)
#define lbs_deb_ioctl(fmt, args...) LBS_DEB_LL(LBS_DEB_IOCTL, fmt, ##args)
#define lbs_deb_scan(fmt, args...) LBS_DEB_LL(LBS_DEB_SCAN, fmt, ##args)
#define lbs_deb_assoc(fmt, args...) LBS_DEB_LL(LBS_DEB_ASSOC, fmt, ##args)
#define lbs_deb_join(fmt, args...) LBS_DEB_LL(LBS_DEB_JOIN, fmt, ##args)
#define lbs_deb_11d(fmt, args...) LBS_DEB_LL(LBS_DEB_11D, fmt, ##args)
#define lbs_deb_debugfs(fmt, args...) LBS_DEB_LL(LBS_DEB_DEBUGFS, fmt, ##args)
#define lbs_deb_ethtool(fmt, args...) LBS_DEB_LL(LBS_DEB_ETHTOOL, fmt, ##args)
#define lbs_deb_host(fmt, args...) LBS_DEB_LL(LBS_DEB_HOST, fmt, ##args)
#define lbs_deb_cmd(fmt, args...) LBS_DEB_LL(LBS_DEB_CMD, fmt, ##args)
#define lbs_deb_rx(fmt, args...) LBS_DEB_LL(LBS_DEB_RX, fmt, ##args)
#define lbs_deb_tx(fmt, args...) LBS_DEB_LL(LBS_DEB_TX, fmt, ##args)
#define lbs_deb_fw(fmt, args...) LBS_DEB_LL(LBS_DEB_FW, fmt, ##args)
#define lbs_deb_usb(fmt, args...) LBS_DEB_LL(LBS_DEB_USB, fmt, ##args)
#define lbs_deb_usbd(dev, fmt, args...) LBS_DEB_LL(LBS_DEB_USB, "%s:" fmt, (dev)->bus_id, ##args)
#define lbs_deb_cs(fmt, args...) LBS_DEB_LL(LBS_DEB_CS, fmt, ##args)
#define lbs_deb_thread(fmt, args...) LBS_DEB_LL(LBS_DEB_THREAD, fmt, ##args)
#define lbs_pr_info(format, args...) \ #define lbs_pr_info(format, args...) \
printk(KERN_INFO DRV_NAME": " format, ## args) printk(KERN_INFO DRV_NAME": " format, ## args)
#define lbs_pr_err(format, args...) \ #define lbs_pr_err(format, args...) \
...@@ -24,37 +87,25 @@ extern unsigned int libertas_debug; ...@@ -24,37 +87,25 @@ extern unsigned int libertas_debug;
printk(KERN_ALERT DRV_NAME": " format, ## args) printk(KERN_ALERT DRV_NAME": " format, ## args)
#ifdef DEBUG #ifdef DEBUG
#define lbs_pr_debug(level, format, args...) \
do { if (libertas_debug >= level) \
printk(KERN_INFO DRV_NAME": " format, ##args); } while (0)
#define lbs_dev_dbg(level, device, format, args...) \
lbs_pr_debug(level, "%s: " format, \
(device)->bus_id , ## args)
static inline void lbs_dbg_hex(char *prompt, u8 * buf, int len) static inline void lbs_dbg_hex(char *prompt, u8 * buf, int len)
{ {
int i = 0; int i = 0;
if (!libertas_debug) if (!(libertas_debug_flags & LBS_DEB_HEX))
return; return;
printk(KERN_DEBUG "%s: ", prompt); printk(KERN_DEBUG "%s: ", prompt);
for (i = 1; i <= len; i++) { for (i = 1; i <= len; i++) {
printk(KERN_DEBUG "%02x ", (u8) * buf); printk("%02x ", (u8) * buf);
buf++; buf++;
} }
printk("\n"); printk("\n");
} }
#else #else
#define lbs_pr_debug(level, format, args...) do {} while (0)
#define lbs_dev_dbg(level, device, format, args...) do {} while (0)
#define lbs_dbg_hex(x,y,z) do {} while (0) #define lbs_dbg_hex(x,y,z) do {} while (0)
#endif #endif
#define ENTER() lbs_pr_debug(1, "Enter: %s:%i\n", \
__FUNCTION__, __LINE__)
#define LEAVE() lbs_pr_debug(1, "Leave: %s:%i\n", \
__FUNCTION__, __LINE__)
/** Buffer Constants */ /** Buffer Constants */
......
...@@ -69,7 +69,7 @@ static int libertas_ethtool_get_eeprom(struct net_device *dev, ...@@ -69,7 +69,7 @@ static int libertas_ethtool_get_eeprom(struct net_device *dev,
/* +14 is for action, offset, and NOB in /* +14 is for action, offset, and NOB in
* response */ * response */
lbs_pr_debug(1, "action:%d offset: %x NOB: %02x\n", lbs_deb_ethtool("action:%d offset: %x NOB: %02x\n",
regctrl.action, regctrl.offset, regctrl.NOB); regctrl.action, regctrl.offset, regctrl.NOB);
ret = libertas_prepare_and_send_command(priv, ret = libertas_prepare_and_send_command(priv,
...@@ -81,8 +81,7 @@ static int libertas_ethtool_get_eeprom(struct net_device *dev, ...@@ -81,8 +81,7 @@ static int libertas_ethtool_get_eeprom(struct net_device *dev,
if (ret) { if (ret) {
if (adapter->prdeeprom) if (adapter->prdeeprom)
kfree(adapter->prdeeprom); kfree(adapter->prdeeprom);
LEAVE(); goto done;
return ret;
} }
mdelay(10); mdelay(10);
...@@ -101,7 +100,11 @@ static int libertas_ethtool_get_eeprom(struct net_device *dev, ...@@ -101,7 +100,11 @@ static int libertas_ethtool_get_eeprom(struct net_device *dev,
kfree(adapter->prdeeprom); kfree(adapter->prdeeprom);
// mutex_unlock(&priv->mutex); // mutex_unlock(&priv->mutex);
return 0; ret = 0;
done:
lbs_deb_enter_args(LBS_DEB_ETHTOOL, "ret %d", ret);
return ret;
} }
static void libertas_ethtool_get_stats(struct net_device * dev, static void libertas_ethtool_get_stats(struct net_device * dev,
...@@ -109,7 +112,7 @@ static void libertas_ethtool_get_stats(struct net_device * dev, ...@@ -109,7 +112,7 @@ static void libertas_ethtool_get_stats(struct net_device * dev,
{ {
wlan_private *priv = dev->priv; wlan_private *priv = dev->priv;
ENTER(); lbs_deb_enter(LBS_DEB_ETHTOOL);
stats->cmd = ETHTOOL_GSTATS; stats->cmd = ETHTOOL_GSTATS;
BUG_ON(stats->n_stats != MESH_STATS_NUM); BUG_ON(stats->n_stats != MESH_STATS_NUM);
...@@ -122,7 +125,7 @@ static void libertas_ethtool_get_stats(struct net_device * dev, ...@@ -122,7 +125,7 @@ static void libertas_ethtool_get_stats(struct net_device * dev,
data[5] = priv->mstats.fwd_bcast_cnt; data[5] = priv->mstats.fwd_bcast_cnt;
data[6] = priv->mstats.drop_blind; data[6] = priv->mstats.drop_blind;
LEAVE(); lbs_deb_enter(LBS_DEB_ETHTOOL);
} }
static int libertas_ethtool_get_stats_count(struct net_device * dev) static int libertas_ethtool_get_stats_count(struct net_device * dev)
...@@ -131,15 +134,16 @@ static int libertas_ethtool_get_stats_count(struct net_device * dev) ...@@ -131,15 +134,16 @@ static int libertas_ethtool_get_stats_count(struct net_device * dev)
wlan_private *priv = dev->priv; wlan_private *priv = dev->priv;
struct cmd_ds_mesh_access mesh_access; struct cmd_ds_mesh_access mesh_access;
ENTER(); lbs_deb_enter(LBS_DEB_ETHTOOL);
/* Get Mesh Statistics */ /* Get Mesh Statistics */
ret = libertas_prepare_and_send_command(priv, ret = libertas_prepare_and_send_command(priv,
cmd_mesh_access, cmd_act_mesh_get_stats, cmd_mesh_access, cmd_act_mesh_get_stats,
cmd_option_waitforrsp, 0, &mesh_access); cmd_option_waitforrsp, 0, &mesh_access);
if (ret) { if (ret) {
LEAVE(); ret = 0;
return 0; goto done;
} }
priv->mstats.fwd_drop_rbt = mesh_access.data[0]; priv->mstats.fwd_drop_rbt = mesh_access.data[0];
...@@ -150,8 +154,11 @@ static int libertas_ethtool_get_stats_count(struct net_device * dev) ...@@ -150,8 +154,11 @@ static int libertas_ethtool_get_stats_count(struct net_device * dev)
priv->mstats.fwd_bcast_cnt = mesh_access.data[5]; priv->mstats.fwd_bcast_cnt = mesh_access.data[5];
priv->mstats.drop_blind = mesh_access.data[6]; priv->mstats.drop_blind = mesh_access.data[6];
LEAVE(); ret = MESH_STATS_NUM;
return MESH_STATS_NUM;
done:
lbs_deb_enter_args(LBS_DEB_ETHTOOL, "ret %d", ret);
return ret;
} }
static void libertas_ethtool_get_strings (struct net_device * dev, static void libertas_ethtool_get_strings (struct net_device * dev,
...@@ -160,7 +167,8 @@ static void libertas_ethtool_get_strings (struct net_device * dev, ...@@ -160,7 +167,8 @@ static void libertas_ethtool_get_strings (struct net_device * dev,
{ {
int i; int i;
ENTER(); lbs_deb_enter(LBS_DEB_ETHTOOL);
switch (stringset) { switch (stringset) {
case ETH_SS_STATS: case ETH_SS_STATS:
for (i=0; i < MESH_STATS_NUM; i++) { for (i=0; i < MESH_STATS_NUM; i++) {
...@@ -170,7 +178,7 @@ static void libertas_ethtool_get_strings (struct net_device * dev, ...@@ -170,7 +178,7 @@ static void libertas_ethtool_get_strings (struct net_device * dev,
} }
break; break;
} }
LEAVE(); lbs_deb_enter(LBS_DEB_ETHTOOL);
} }
struct ethtool_ops libertas_ethtool_ops = { struct ethtool_ops libertas_ethtool_ops = {
......
...@@ -20,8 +20,8 @@ ...@@ -20,8 +20,8 @@
char *libertas_fw_name = NULL; char *libertas_fw_name = NULL;
module_param_named(fw_name, libertas_fw_name, charp, 0644); module_param_named(fw_name, libertas_fw_name, charp, 0644);
unsigned int libertas_debug = 0; unsigned int libertas_debug_flags = 0;
module_param(libertas_debug, int, 0); module_param_named(debug, libertas_debug_flags, int, 0);
/** /**
* @brief This function checks the validity of Boot2/FW image. * @brief This function checks the validity of Boot2/FW image.
...@@ -61,9 +61,9 @@ static int check_fwfile_format(u8 *data, u32 totlen) ...@@ -61,9 +61,9 @@ static int check_fwfile_format(u8 *data, u32 totlen)
} while (!exit); } while (!exit);
if (ret) if (ret)
lbs_pr_err("bin file format check FAIL...\n"); lbs_pr_err("firmware file format check FAIL\n");
else else
lbs_pr_debug(1, "bin file format check PASS...\n"); lbs_deb_fw("firmware file format check PASS\n");
return ret; return ret;
} }
...@@ -81,13 +81,13 @@ static int wlan_setup_station_hw(wlan_private * priv) ...@@ -81,13 +81,13 @@ static int wlan_setup_station_hw(wlan_private * priv)
int ret = -1; int ret = -1;
wlan_adapter *adapter = priv->adapter; wlan_adapter *adapter = priv->adapter;
ENTER(); lbs_deb_enter(LBS_DEB_FW);
if ((ret = request_firmware(&priv->firmware, libertas_fw_name, if ((ret = request_firmware(&priv->firmware, libertas_fw_name,
priv->hotplug_device)) < 0) { priv->hotplug_device)) < 0) {
lbs_pr_err("request_firmware() failed, error code = %#x\n", lbs_pr_err("request_firmware() failed with %#x\n",
ret); ret);
lbs_pr_err("%s not found in /lib/firmware\n", libertas_fw_name); lbs_pr_err("firmware %s not found\n", libertas_fw_name);
goto done; goto done;
} }
...@@ -101,7 +101,7 @@ static int wlan_setup_station_hw(wlan_private * priv) ...@@ -101,7 +101,7 @@ static int wlan_setup_station_hw(wlan_private * priv)
release_firmware(priv->firmware); release_firmware(priv->firmware);
if (ret) { if (ret) {
lbs_pr_debug(1, "Bootloader in invalid state!\n"); lbs_deb_fw("bootloader in invalid state\n");
ret = -1; ret = -1;
goto done; goto done;
} }
...@@ -133,9 +133,8 @@ static int wlan_setup_station_hw(wlan_private * priv) ...@@ -133,9 +133,8 @@ static int wlan_setup_station_hw(wlan_private * priv)
ret = 0; ret = 0;
done: done:
LEAVE(); lbs_deb_leave_args(LBS_DEB_FW, "ret %d", ret);
return ret;
return (ret);
} }
static int wlan_allocate_adapter(wlan_private * priv) static int wlan_allocate_adapter(wlan_private * priv)
...@@ -264,7 +263,7 @@ int libertas_init_fw(wlan_private * priv) ...@@ -264,7 +263,7 @@ int libertas_init_fw(wlan_private * priv)
int ret = -1; int ret = -1;
wlan_adapter *adapter = priv->adapter; wlan_adapter *adapter = priv->adapter;
ENTER(); lbs_deb_enter(LBS_DEB_FW);
/* Allocate adapter structure */ /* Allocate adapter structure */
if ((ret = wlan_allocate_adapter(priv)) != 0) if ((ret = wlan_allocate_adapter(priv)) != 0)
...@@ -288,7 +287,7 @@ int libertas_init_fw(wlan_private * priv) ...@@ -288,7 +287,7 @@ int libertas_init_fw(wlan_private * priv)
ret = 0; ret = 0;
done: done:
LEAVE(); lbs_deb_leave_args(LBS_DEB_FW, "ret %d", ret);
return ret; return ret;
} }
...@@ -297,25 +296,24 @@ void libertas_free_adapter(wlan_private * priv) ...@@ -297,25 +296,24 @@ void libertas_free_adapter(wlan_private * priv)
wlan_adapter *adapter = priv->adapter; wlan_adapter *adapter = priv->adapter;
if (!adapter) { if (!adapter) {
lbs_pr_debug(1, "Why double free adapter?:)\n"); lbs_deb_fw("why double free adapter?\n");
return; return;
} }
lbs_pr_debug(1, "Free command buffer\n"); lbs_deb_fw("free command buffer\n");
libertas_free_cmd_buffer(priv); libertas_free_cmd_buffer(priv);
lbs_pr_debug(1, "Free commandTimer\n"); lbs_deb_fw("free command_timer\n");
del_timer(&adapter->command_timer); del_timer(&adapter->command_timer);
lbs_pr_debug(1, "Free scantable\n"); lbs_deb_fw("free scantable\n");
if (adapter->scantable) { if (adapter->scantable) {
kfree(adapter->scantable); kfree(adapter->scantable);
adapter->scantable = NULL; adapter->scantable = NULL;
} }
lbs_pr_debug(1, "Free adapter\n");
/* Free the adapter object itself */ /* Free the adapter object itself */
lbs_deb_fw("free adapter\n");
kfree(adapter); kfree(adapter);
priv->adapter = NULL; priv->adapter = NULL;
} }
...@@ -334,17 +332,17 @@ static void command_timer_fn(unsigned long data) ...@@ -334,17 +332,17 @@ static void command_timer_fn(unsigned long data)
ptempnode = adapter->cur_cmd; ptempnode = adapter->cur_cmd;
if (ptempnode == NULL) { if (ptempnode == NULL) {
lbs_pr_debug(1, "PTempnode Empty\n"); lbs_deb_fw("ptempnode empty\n");
return; return;
} }
cmd = (struct cmd_ds_command *)ptempnode->bufvirtualaddr; cmd = (struct cmd_ds_command *)ptempnode->bufvirtualaddr;
if (!cmd) { if (!cmd) {
lbs_pr_debug(1, "cmd is NULL\n"); lbs_deb_fw("cmd is NULL\n");
return; return;
} }
lbs_pr_info("command_timer_fn fired (%x)\n", cmd->command); lbs_deb_fw("command_timer_fn fired, cmd %x\n", cmd->command);
if (!adapter->fw_ready) if (!adapter->fw_ready)
return; return;
...@@ -353,7 +351,7 @@ static void command_timer_fn(unsigned long data) ...@@ -353,7 +351,7 @@ static void command_timer_fn(unsigned long data)
adapter->cur_cmd = NULL; adapter->cur_cmd = NULL;
spin_unlock_irqrestore(&adapter->driver_lock, flags); spin_unlock_irqrestore(&adapter->driver_lock, flags);
lbs_pr_debug(1, "Re-sending same command as it timeout...!\n"); lbs_deb_fw("re-sending same command because of timeout\n");
libertas_queue_cmd(adapter, ptempnode, 0); libertas_queue_cmd(adapter, ptempnode, 0);
wake_up_interruptible(&priv->mainthread.waitq); wake_up_interruptible(&priv->mainthread.waitq);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -106,10 +106,10 @@ static void wlan_compute_rssi(wlan_private * priv, struct rxpd *p_rx_pd) ...@@ -106,10 +106,10 @@ static void wlan_compute_rssi(wlan_private * priv, struct rxpd *p_rx_pd)
{ {
wlan_adapter *adapter = priv->adapter; wlan_adapter *adapter = priv->adapter;
ENTER(); lbs_deb_enter(LBS_DEB_RX);
lbs_pr_debug(1, "rxpd: SNR = %d, NF = %d\n", p_rx_pd->snr, p_rx_pd->nf); lbs_deb_rx("rxpd: SNR %d, NF %d\n", p_rx_pd->snr, p_rx_pd->nf);
lbs_pr_debug(1, "Before computing SNR: SNR- avg = %d, NF-avg = %d\n", lbs_deb_rx("before computing SNR: SNR-avg = %d, NF-avg = %d\n",
adapter->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE, adapter->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE,
adapter->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE); adapter->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE);
...@@ -121,7 +121,7 @@ static void wlan_compute_rssi(wlan_private * priv, struct rxpd *p_rx_pd) ...@@ -121,7 +121,7 @@ static void wlan_compute_rssi(wlan_private * priv, struct rxpd *p_rx_pd)
adapter->SNR[TYPE_RXPD][TYPE_AVG] = wlan_getavgsnr(priv) * AVG_SCALE; adapter->SNR[TYPE_RXPD][TYPE_AVG] = wlan_getavgsnr(priv) * AVG_SCALE;
adapter->NF[TYPE_RXPD][TYPE_AVG] = wlan_getavgnf(priv) * AVG_SCALE; adapter->NF[TYPE_RXPD][TYPE_AVG] = wlan_getavgnf(priv) * AVG_SCALE;
lbs_pr_debug(1, "After computing SNR: SNR-avg = %d, NF-avg = %d\n", lbs_deb_rx("after computing SNR: SNR-avg = %d, NF-avg = %d\n",
adapter->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE, adapter->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE,
adapter->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE); adapter->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE);
...@@ -133,12 +133,12 @@ static void wlan_compute_rssi(wlan_private * priv, struct rxpd *p_rx_pd) ...@@ -133,12 +133,12 @@ static void wlan_compute_rssi(wlan_private * priv, struct rxpd *p_rx_pd)
CAL_RSSI(adapter->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE, CAL_RSSI(adapter->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE,
adapter->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE); adapter->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE);
LEAVE(); lbs_deb_leave(LBS_DEB_RX);
} }
void libertas_upload_rx_packet(wlan_private * priv, struct sk_buff *skb) void libertas_upload_rx_packet(wlan_private * priv, struct sk_buff *skb)
{ {
lbs_pr_debug(1, "skb->data=%p\n", skb->data); lbs_deb_rx("skb->data %p\n", skb->data);
if(IS_MESH_FRAME(skb)) if(IS_MESH_FRAME(skb))
skb->dev = priv->mesh_dev; skb->dev = priv->mesh_dev;
...@@ -171,7 +171,7 @@ int libertas_process_rxed_packet(wlan_private * priv, struct sk_buff *skb) ...@@ -171,7 +171,7 @@ int libertas_process_rxed_packet(wlan_private * priv, struct sk_buff *skb)
const u8 rfc1042_eth_hdr[] = { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 }; const u8 rfc1042_eth_hdr[] = { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 };
ENTER(); lbs_deb_enter(LBS_DEB_RX);
if (priv->adapter->debugmode & MRVDRV_DEBUG_RX_PATH) if (priv->adapter->debugmode & MRVDRV_DEBUG_RX_PATH)
lbs_dbg_hex("RX packet: ", skb->data, lbs_dbg_hex("RX packet: ", skb->data,
...@@ -191,7 +191,7 @@ int libertas_process_rxed_packet(wlan_private * priv, struct sk_buff *skb) ...@@ -191,7 +191,7 @@ int libertas_process_rxed_packet(wlan_private * priv, struct sk_buff *skb)
min_t(unsigned int, skb->len, 100)); min_t(unsigned int, skb->len, 100));
if (skb->len < (ETH_HLEN + 8 + sizeof(struct rxpd))) { if (skb->len < (ETH_HLEN + 8 + sizeof(struct rxpd))) {
lbs_pr_debug(1, "RX error: FRAME RECEIVED WITH BAD LENGTH\n"); lbs_deb_rx("rx err: frame received with bad length\n");
priv->stats.rx_length_errors++; priv->stats.rx_length_errors++;
ret = 0; ret = 0;
goto done; goto done;
...@@ -201,14 +201,14 @@ int libertas_process_rxed_packet(wlan_private * priv, struct sk_buff *skb) ...@@ -201,14 +201,14 @@ int libertas_process_rxed_packet(wlan_private * priv, struct sk_buff *skb)
* Check rxpd status and update 802.3 stat, * Check rxpd status and update 802.3 stat,
*/ */
if (!(p_rx_pd->status & MRVDRV_RXPD_STATUS_OK)) { if (!(p_rx_pd->status & MRVDRV_RXPD_STATUS_OK)) {
lbs_pr_debug(1, "RX error: frame received with bad status\n"); lbs_deb_rx("rx err: frame received with bad status\n");
lbs_pr_alert("rxpd Not OK\n"); lbs_pr_alert("rxpd not ok\n");
priv->stats.rx_errors++; priv->stats.rx_errors++;
ret = 0; ret = 0;
goto done; goto done;
} }
lbs_pr_debug(1, "RX Data: skb->len - sizeof(RxPd) = %d - %zd = %zd\n", lbs_deb_rx("rx data: skb->len-sizeof(RxPd) = %d-%zd = %zd\n",
skb->len, sizeof(struct rxpd), skb->len - sizeof(struct rxpd)); skb->len, sizeof(struct rxpd), skb->len - sizeof(struct rxpd));
lbs_dbg_hex("RX Data: Dest", p_rx_pkt->eth803_hdr.dest_addr, lbs_dbg_hex("RX Data: Dest", p_rx_pkt->eth803_hdr.dest_addr,
...@@ -266,7 +266,7 @@ int libertas_process_rxed_packet(wlan_private * priv, struct sk_buff *skb) ...@@ -266,7 +266,7 @@ int libertas_process_rxed_packet(wlan_private * priv, struct sk_buff *skb)
wlan_compute_rssi(priv, p_rx_pd); wlan_compute_rssi(priv, p_rx_pd);
lbs_pr_debug(1, "RX Data: size of actual packet = %d\n", skb->len); lbs_deb_rx("rx data: size of actual packet %d\n", skb->len);
priv->stats.rx_bytes += skb->len; priv->stats.rx_bytes += skb->len;
priv->stats.rx_packets++; priv->stats.rx_packets++;
...@@ -274,8 +274,7 @@ int libertas_process_rxed_packet(wlan_private * priv, struct sk_buff *skb) ...@@ -274,8 +274,7 @@ int libertas_process_rxed_packet(wlan_private * priv, struct sk_buff *skb)
ret = 0; ret = 0;
done: done:
LEAVE(); lbs_deb_leave_args(LBS_DEB_RX, "ret %d", ret);
return ret; return ret;
} }
...@@ -314,7 +313,7 @@ static u8 convert_mv_rate_to_radiotap(u8 rate) ...@@ -314,7 +313,7 @@ static u8 convert_mv_rate_to_radiotap(u8 rate)
case 11: /* 54 Mbps */ case 11: /* 54 Mbps */
return 108; return 108;
} }
lbs_pr_alert( "Invalid Marvell WLAN rate (%i)\n", rate); lbs_pr_alert("Invalid Marvell WLAN rate %i\n", rate);
return 0; return 0;
} }
...@@ -336,7 +335,7 @@ static int process_rxed_802_11_packet(wlan_private * priv, struct sk_buff *skb) ...@@ -336,7 +335,7 @@ static int process_rxed_802_11_packet(wlan_private * priv, struct sk_buff *skb)
struct rx_radiotap_hdr radiotap_hdr; struct rx_radiotap_hdr radiotap_hdr;
struct rx_radiotap_hdr *pradiotap_hdr; struct rx_radiotap_hdr *pradiotap_hdr;
ENTER(); lbs_deb_enter(LBS_DEB_RX);
p_rx_pkt = (struct rx80211packethdr *) skb->data; p_rx_pkt = (struct rx80211packethdr *) skb->data;
prxpd = &p_rx_pkt->rx_pd; prxpd = &p_rx_pkt->rx_pd;
...@@ -344,7 +343,7 @@ static int process_rxed_802_11_packet(wlan_private * priv, struct sk_buff *skb) ...@@ -344,7 +343,7 @@ static int process_rxed_802_11_packet(wlan_private * priv, struct sk_buff *skb)
// lbs_dbg_hex("RX Data: Before chop rxpd", skb->data, min(skb->len, 100)); // lbs_dbg_hex("RX Data: Before chop rxpd", skb->data, min(skb->len, 100));
if (skb->len < (ETH_HLEN + 8 + sizeof(struct rxpd))) { if (skb->len < (ETH_HLEN + 8 + sizeof(struct rxpd))) {
lbs_pr_debug(1, "RX error: FRAME RECEIVED WITH BAD LENGTH\n"); lbs_deb_rx("rx err: frame received wit bad length\n");
priv->stats.rx_length_errors++; priv->stats.rx_length_errors++;
ret = 0; ret = 0;
goto done; goto done;
...@@ -354,11 +353,11 @@ static int process_rxed_802_11_packet(wlan_private * priv, struct sk_buff *skb) ...@@ -354,11 +353,11 @@ static int process_rxed_802_11_packet(wlan_private * priv, struct sk_buff *skb)
* Check rxpd status and update 802.3 stat, * Check rxpd status and update 802.3 stat,
*/ */
if (!(prxpd->status & MRVDRV_RXPD_STATUS_OK)) { if (!(prxpd->status & MRVDRV_RXPD_STATUS_OK)) {
//lbs_pr_debug(1, "RX error: frame received with bad status\n"); //lbs_deb_rx("rx err: frame received with bad status\n");
priv->stats.rx_errors++; priv->stats.rx_errors++;
} }
lbs_pr_debug(1, "RX Data: skb->len - sizeof(RxPd) = %d - %zd = %zd\n", lbs_deb_rx("rx data: skb->len-sizeof(RxPd) = %d-%zd = %zd\n",
skb->len, sizeof(struct rxpd), skb->len - sizeof(struct rxpd)); skb->len, sizeof(struct rxpd), skb->len - sizeof(struct rxpd));
/* create the exported radio header */ /* create the exported radio header */
...@@ -399,7 +398,7 @@ static int process_rxed_802_11_packet(wlan_private * priv, struct sk_buff *skb) ...@@ -399,7 +398,7 @@ static int process_rxed_802_11_packet(wlan_private * priv, struct sk_buff *skb)
if ((skb_headroom(skb) < sizeof(struct rx_radiotap_hdr)) && if ((skb_headroom(skb) < sizeof(struct rx_radiotap_hdr)) &&
pskb_expand_head(skb, sizeof(struct rx_radiotap_hdr), 0, pskb_expand_head(skb, sizeof(struct rx_radiotap_hdr), 0,
GFP_ATOMIC)) { GFP_ATOMIC)) {
lbs_pr_alert( "%s: couldn't pskb_expand_head\n", lbs_pr_alert("%s: couldn't pskb_expand_head\n",
__func__); __func__);
} }
...@@ -414,7 +413,7 @@ static int process_rxed_802_11_packet(wlan_private * priv, struct sk_buff *skb) ...@@ -414,7 +413,7 @@ static int process_rxed_802_11_packet(wlan_private * priv, struct sk_buff *skb)
default: default:
/* unknown header */ /* unknown header */
lbs_pr_alert( "Unknown radiomode (%i)\n", lbs_pr_alert("Unknown radiomode %i\n",
priv->adapter->radiomode); priv->adapter->radiomode);
/* don't export any header */ /* don't export any header */
/* chop the rxpd */ /* chop the rxpd */
...@@ -431,15 +430,16 @@ static int process_rxed_802_11_packet(wlan_private * priv, struct sk_buff *skb) ...@@ -431,15 +430,16 @@ static int process_rxed_802_11_packet(wlan_private * priv, struct sk_buff *skb)
wlan_compute_rssi(priv, prxpd); wlan_compute_rssi(priv, prxpd);
lbs_pr_debug(1, "RX Data: size of actual packet = %d\n", skb->len); lbs_deb_rx("rx data: size of actual packet %d\n", skb->len);
priv->stats.rx_bytes += skb->len; priv->stats.rx_bytes += skb->len;
priv->stats.rx_packets++; priv->stats.rx_packets++;
libertas_upload_rx_packet(priv, skb); libertas_upload_rx_packet(priv, skb);
ret = 0; ret = 0;
done:
LEAVE();
return (ret); done:
skb->protocol = __constant_htons(0x0019); /* ETH_P_80211_RAW */
lbs_deb_leave_args(LBS_DEB_RX, "ret %d", ret);
return ret;
} }
This diff is collapsed.
...@@ -21,11 +21,11 @@ static inline void wlan_activate_thread(struct wlan_thread * thr) ...@@ -21,11 +21,11 @@ static inline void wlan_activate_thread(struct wlan_thread * thr)
static inline void wlan_deactivate_thread(struct wlan_thread * thr) static inline void wlan_deactivate_thread(struct wlan_thread * thr)
{ {
ENTER(); lbs_deb_enter(LBS_DEB_THREAD);
thr->pid = 0; thr->pid = 0;
LEAVE(); lbs_deb_leave(LBS_DEB_THREAD);
} }
static inline void wlan_create_thread(int (*wlanfunc) (void *), static inline void wlan_create_thread(int (*wlanfunc) (void *),
...@@ -36,7 +36,7 @@ static inline void wlan_create_thread(int (*wlanfunc) (void *), ...@@ -36,7 +36,7 @@ static inline void wlan_create_thread(int (*wlanfunc) (void *),
static inline int wlan_terminate_thread(struct wlan_thread * thr) static inline int wlan_terminate_thread(struct wlan_thread * thr)
{ {
ENTER(); lbs_deb_enter(LBS_DEB_THREAD);
/* Check if the thread is active or not */ /* Check if the thread is active or not */
if (!thr->pid) { if (!thr->pid) {
...@@ -45,7 +45,7 @@ static inline int wlan_terminate_thread(struct wlan_thread * thr) ...@@ -45,7 +45,7 @@ static inline int wlan_terminate_thread(struct wlan_thread * thr)
} }
kthread_stop(thr->task); kthread_stop(thr->task);
LEAVE(); lbs_deb_leave(LBS_DEB_THREAD);
return 0; return 0;
} }
......
...@@ -68,7 +68,7 @@ static int SendSinglePacket(wlan_private * priv, struct sk_buff *skb) ...@@ -68,7 +68,7 @@ static int SendSinglePacket(wlan_private * priv, struct sk_buff *skb)
u32 new_rate; u32 new_rate;
u8 *ptr = priv->adapter->tmptxbuf; u8 *ptr = priv->adapter->tmptxbuf;
ENTER(); lbs_deb_enter(LBS_DEB_TX);
if (priv->adapter->surpriseremoved) if (priv->adapter->surpriseremoved)
return -1; return -1;
...@@ -78,7 +78,7 @@ static int SendSinglePacket(wlan_private * priv, struct sk_buff *skb) ...@@ -78,7 +78,7 @@ static int SendSinglePacket(wlan_private * priv, struct sk_buff *skb)
min_t(unsigned int, skb->len, 100)); min_t(unsigned int, skb->len, 100));
if (!skb->len || (skb->len > MRVDRV_ETH_TX_PACKET_BUFFER_SIZE)) { if (!skb->len || (skb->len > MRVDRV_ETH_TX_PACKET_BUFFER_SIZE)) {
lbs_pr_debug(1, "Tx error: Bad skb length %d : %zd\n", lbs_deb_tx("tx err: skb length %d 0 or > %zd\n",
skb->len, MRVDRV_ETH_TX_PACKET_BUFFER_SIZE); skb->len, MRVDRV_ETH_TX_PACKET_BUFFER_SIZE);
ret = -1; ret = -1;
goto done; goto done;
...@@ -138,13 +138,13 @@ static int SendSinglePacket(wlan_private * priv, struct sk_buff *skb) ...@@ -138,13 +138,13 @@ static int SendSinglePacket(wlan_private * priv, struct sk_buff *skb)
sizeof(struct txpd)); sizeof(struct txpd));
if (ret) { if (ret) {
lbs_pr_debug(1, "Tx error: libertas_sbi_host_to_card failed: 0x%X\n", ret); lbs_deb_tx("tx err: libertas_sbi_host_to_card returned 0x%X\n", ret);
goto done; goto done;
} }
lbs_pr_debug(1, "SendSinglePacket succeeds\n"); lbs_deb_tx("SendSinglePacket succeeds\n");
done: done:
if (!ret) { if (!ret) {
priv->stats.tx_packets++; priv->stats.tx_packets++;
priv->stats.tx_bytes += skb->len; priv->stats.tx_bytes += skb->len;
...@@ -166,7 +166,7 @@ static int SendSinglePacket(wlan_private * priv, struct sk_buff *skb) ...@@ -166,7 +166,7 @@ static int SendSinglePacket(wlan_private * priv, struct sk_buff *skb)
priv->adapter->currenttxskb = NULL; priv->adapter->currenttxskb = NULL;
} }
LEAVE(); lbs_deb_leave_args(LBS_DEB_TX, "ret %d", ret);
return ret; return ret;
} }
...@@ -214,8 +214,7 @@ int libertas_process_tx(wlan_private * priv, struct sk_buff *skb) ...@@ -214,8 +214,7 @@ int libertas_process_tx(wlan_private * priv, struct sk_buff *skb)
{ {
int ret = -1; int ret = -1;
ENTER(); lbs_deb_enter(LBS_DEB_TX);
lbs_dbg_hex("TX Data", skb->data, min_t(unsigned int, skb->len, 100)); lbs_dbg_hex("TX Data", skb->data, min_t(unsigned int, skb->len, 100));
if (priv->wlan_dev.dnld_sent) { if (priv->wlan_dev.dnld_sent) {
...@@ -234,7 +233,7 @@ int libertas_process_tx(wlan_private * priv, struct sk_buff *skb) ...@@ -234,7 +233,7 @@ int libertas_process_tx(wlan_private * priv, struct sk_buff *skb)
ret = SendSinglePacket(priv, skb); ret = SendSinglePacket(priv, skb);
done: done:
LEAVE(); lbs_deb_leave_args(LBS_DEB_TX, "ret %d", ret);
return ret; return ret;
} }
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment