Message ID | 1377248299-21007-14-git-send-email-k.eugene.e@gmail.com (mailing list archive) |
---|---|
State | Not Applicable, archived |
Headers | show |
On Fri, 2013-08-23 at 10:58 +0200, Eugene Krasnikov wrote: > Adding wcn36xx.h [] > +#define wcn36xx_err(fmt, arg...) \ > + printk(KERN_ERR pr_fmt("ERROR " fmt), ##arg); > + > +#define wcn36xx_warn(fmt, arg...) \ > + printk(KERN_WARNING pr_fmt("WARNING " fmt), ##arg) > + > +#define wcn36xx_info(fmt, arg...) \ > + printk(KERN_INFO pr_fmt(fmt), ##arg) > + I these would be better using: #define wcn36xx_err(fmt, ...) \ pr_err("ERROR " fmt, ##__VA_ARGS__) etc... > +#define wcn36xx_dbg(mask, fmt, arg...) do { \ > + if (debug_mask & mask) \ > + printk(KERN_DEBUG pr_fmt(fmt), ##arg); \ > +} while (0) And maybe this one using pr_debug so dynamic_debug can work too. -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Since wcn36xx soon will become a part of ath family and all ath drivers are using printk i thought it's reasonable to use common approach everywhere:) May be in future all ath debug functions will be united into one debug framework and the same code will be used everywhere. 2013/8/24 Joe Perches <joe@perches.com>: > On Fri, 2013-08-23 at 10:58 +0200, Eugene Krasnikov wrote: >> Adding wcn36xx.h > [] >> +#define wcn36xx_err(fmt, arg...) \ >> + printk(KERN_ERR pr_fmt("ERROR " fmt), ##arg); >> + >> +#define wcn36xx_warn(fmt, arg...) \ >> + printk(KERN_WARNING pr_fmt("WARNING " fmt), ##arg) >> + >> +#define wcn36xx_info(fmt, arg...) \ >> + printk(KERN_INFO pr_fmt(fmt), ##arg) >> + > > I these would be better using: > > #define wcn36xx_err(fmt, ...) \ > pr_err("ERROR " fmt, ##__VA_ARGS__) > > etc... > >> +#define wcn36xx_dbg(mask, fmt, arg...) do { \ >> + if (debug_mask & mask) \ >> + printk(KERN_DEBUG pr_fmt(fmt), ##arg); \ >> +} while (0) > > And maybe this one using pr_debug so dynamic_debug > can work too. > >
Joe Perches <joe@perches.com> writes: >> +#define wcn36xx_dbg(mask, fmt, arg...) do { \ >> + if (debug_mask & mask) \ >> + printk(KERN_DEBUG pr_fmt(fmt), ##arg); \ >> +} while (0) > > And maybe this one using pr_debug so dynamic_debug > can work too. Please, no dynamic_debug. It's useless on a wifi driver.
On Mon, 2013-09-02 at 17:15 +0300, Kalle Valo wrote: > Joe Perches <joe@perches.com> writes: > > >> +#define wcn36xx_dbg(mask, fmt, arg...) do { \ > >> + if (debug_mask & mask) \ > >> + printk(KERN_DEBUG pr_fmt(fmt), ##arg); \ > >> +} while (0) > > > > And maybe this one using pr_debug so dynamic_debug > > can work too. > > Please, no dynamic_debug. It's useless on a wifi driver. Why is that? -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Joe Perches <joe@perches.com> writes: > On Mon, 2013-09-02 at 17:15 +0300, Kalle Valo wrote: >> Joe Perches <joe@perches.com> writes: >> >> >> +#define wcn36xx_dbg(mask, fmt, arg...) do { \ >> >> + if (debug_mask & mask) \ >> >> + printk(KERN_DEBUG pr_fmt(fmt), ##arg); \ >> >> +} while (0) >> > >> > And maybe this one using pr_debug so dynamic_debug >> > can work too. >> >> Please, no dynamic_debug. It's useless on a wifi driver. > > Why is that? It's not really usable in practise, at least the last time I looked at it. It's cumbersome to enable log messages based on their line numbers and line numbers change so you can't really make any scripts to help with that. And enabling log messages on the file level is sometimes too much. So it would really need some sort of grouping feature with a stable interface.
On Tue, 2013-09-03 at 08:08 +0300, Kalle Valo wrote: > Joe Perches <joe@perches.com> writes: > Please, no dynamic_debug. It's useless on a wifi driver. > > Why is that? > It's not really usable in practise, at least the last time I looked at > it. Then you probably haven't looked recently. > It's cumbersome to enable log messages based on their line numbers > and line numbers change so you can't really make any scripts to help > with that. Most don't do that. Generally it's enabled/disabled by module. > And enabling log messages on the file level is sometimes too > much. So it would really need some sort of grouping feature with a > stable interface. Like by module? -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Joe Perches <joe@perches.com> writes: > Most don't do that. > Generally it's enabled/disabled by module. > >> And enabling log messages on the file level is sometimes too >> much. So it would really need some sort of grouping feature with a >> stable interface. > > Like by module? What does module mean in this context? File like "wmi.c" or something else?
On Tue, 2013-09-03 at 08:25 +0300, Kalle Valo wrote: > Joe Perches <joe@perches.com> writes: > > > Most don't do that. > > Generally it's enabled/disabled by module. > > > >> And enabling log messages on the file level is sometimes too > >> much. So it would really need some sort of grouping feature with a > >> stable interface. > > > > Like by module? > > What does module mean in this context? KBUILD_MODNAME -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Joe Perches <joe@perches.com> writes: > On Tue, 2013-09-03 at 08:25 +0300, Kalle Valo wrote: >> Joe Perches <joe@perches.com> writes: >> >> > Most don't do that. >> > Generally it's enabled/disabled by module. >> > >> >> And enabling log messages on the file level is sometimes too >> >> much. So it would really need some sort of grouping feature with a >> >> stable interface. >> > >> > Like by module? >> >> What does module mean in this context? > > KBUILD_MODNAME Ok, so there's no way to have functionality like ATH6KL_DBG_BOOT which prints information from various files during firmware boot. So dynamic_debug is not really usable for my work flow.
On Tue, 2013-09-03 at 08:39 +0300, Kalle Valo wrote: > >> What does module mean in this context? > > > > KBUILD_MODNAME > > Ok, so there's no way to have functionality like ATH6KL_DBG_BOOT which > prints information from various files during firmware boot. So > dynamic_debug is not really usable for my work flow. I'm confused by your response. Dynamic debug can work with external masks/levels. What functionality do you think you're missing? -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Joe Perches <joe@perches.com> writes: > On Tue, 2013-09-03 at 08:39 +0300, Kalle Valo wrote: >> >> What does module mean in this context? >> > >> > KBUILD_MODNAME >> >> Ok, so there's no way to have functionality like ATH6KL_DBG_BOOT which >> prints information from various files during firmware boot. So >> dynamic_debug is not really usable for my work flow. > > I'm confused by your response. > Dynamic debug can work with external masks/levels. > What functionality do you think you're missing? I was just replying to your question why I think dynamic_debug is not usable in wifi drivers.
diff --git a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h new file mode 100644 index 0000000..61f579d --- /dev/null +++ b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h @@ -0,0 +1,236 @@ +/* + * Copyright (c) 2013 Eugene Krasnikov <k.eugene.e@gmail.com> + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _WCN36XX_H_ +#define _WCN36XX_H_ + +#include <linux/completion.h> +#include <linux/printk.h> +#include <linux/spinlock.h> +#include <net/mac80211.h> + +#include "hal.h" +#include "smd.h" +#include "txrx.h" +#include "dxe.h" +#include "pmc.h" +#include "debug.h" + +#define WLAN_NV_FILE "wlan/prima/WCNSS_qcom_wlan_nv.bin" +#define WCN36XX_AGGR_BUFFER_SIZE 64 + +extern unsigned int debug_mask; + +enum wcn36xx_debug_mask { + WCN36XX_DBG_DXE = 0x00000001, + WCN36XX_DBG_DXE_DUMP = 0x00000002, + WCN36XX_DBG_SMD = 0x00000004, + WCN36XX_DBG_SMD_DUMP = 0x00000008, + WCN36XX_DBG_RX = 0x00000010, + WCN36XX_DBG_RX_DUMP = 0x00000020, + WCN36XX_DBG_TX = 0x00000040, + WCN36XX_DBG_TX_DUMP = 0x00000080, + WCN36XX_DBG_HAL = 0x00000100, + WCN36XX_DBG_HAL_DUMP = 0x00000200, + WCN36XX_DBG_MAC = 0x00000400, + WCN36XX_DBG_BEACON = 0x00000800, + WCN36XX_DBG_BEACON_DUMP = 0x00001000, + WCN36XX_DBG_PMC = 0x00002000, + WCN36XX_DBG_PMC_DUMP = 0x00004000, + WCN36XX_DBG_ANY = 0xffffffff, +}; + +#define wcn36xx_err(fmt, arg...) \ + printk(KERN_ERR pr_fmt("ERROR " fmt), ##arg); + +#define wcn36xx_warn(fmt, arg...) \ + printk(KERN_WARNING pr_fmt("WARNING " fmt), ##arg) + +#define wcn36xx_info(fmt, arg...) \ + printk(KERN_INFO pr_fmt(fmt), ##arg) + +#define wcn36xx_dbg(mask, fmt, arg...) do { \ + if (debug_mask & mask) \ + printk(KERN_DEBUG pr_fmt(fmt), ##arg); \ +} while (0) + +#define wcn36xx_dbg_dump(mask, prefix_str, buf, len) do { \ + if (debug_mask & mask) \ + print_hex_dump(KERN_DEBUG, pr_fmt(prefix_str), \ + DUMP_PREFIX_OFFSET, 32, 1, \ + buf, len, false); \ +} while (0) + +#define WCN36XX_HW_CHANNEL(__wcn) (__wcn->hw->conf.chandef.chan->hw_value) +#define WCN36XX_BAND(__wcn) (__wcn->hw->conf.chandef.chan->band) +#define WCN36XX_CENTER_FREQ(__wcn) (__wcn->hw->conf.chandef.chan->center_freq) +#define WCN36XX_LISTEN_INTERVAL(__wcn) (__wcn->hw->conf.listen_interval) +#define WCN36XX_FLAGS(__wcn) (__wcn->hw->flags) +#define WCN36XX_MAX_POWER(__wcn) (__wcn->hw->conf.chandef.chan->max_power) + +static inline void buff_to_be(u32 *buf, size_t len) +{ + int i; + for (i = 0; i < len; i++) + buf[i] = cpu_to_be32(buf[i]); +} + +struct nv_data { + int is_valid; + u8 table; +}; + +/* Interface for platform control path + * + * @open: hook must be called when wcn36xx wants to open control channel. + * @tx: sends a buffer. + */ +struct wcn36xx_platform_ctrl_ops { + int (*open)(void *drv_priv, void *rsp_cb); + void (*close)(void); + int (*tx)(char *buf, size_t len); + int (*get_hw_mac)(u8 *addr); + int (*smsm_change_state)(u32 clear_mask, u32 set_mask); +}; + +/** + * struct wcn36xx_vif - holds VIF related fields + * + * @bss_index: bss_index is initially set to 0xFF. bss_index is received from + * HW after first config_bss call and must be used in delete_bss and + * enter/exit_bmps. + */ +struct wcn36xx_vif { + u8 bss_index; + u8 ucast_dpu_signature; + /* Returned from WCN36XX_HAL_ADD_STA_SELF_RSP */ + u8 self_sta_index; + u8 self_dpu_desc_index; +}; + +/** + * struct wcn36xx_sta - holds STA related fields + * + * @tid: traffic ID that is used during AMPDU and in TX BD. + * @sta_index: STA index is returned from HW after config_sta call and is + * used in both SMD channel and TX BD. + * @dpu_desc_index: DPU descriptor index is returned from HW after config_sta + * call and is used in TX BD. + * @bss_sta_index: STA index is returned from HW after config_bss call and is + * used in both SMD channel and TX BD. See table bellow when it is used. + * @bss_dpu_desc_index: DPU descriptor index is returned from HW after + * config_bss call and is used in TX BD. + * ______________________________________________ + * | | STA | AP | + * |______________|_____________|_______________| + * | TX BD |bss_sta_index| sta_index | + * |______________|_____________|_______________| + * |all SMD calls |bss_sta_index| sta_index | + * |______________|_____________|_______________| + * |smd_delete_sta| sta_index | sta_index | + * |______________|_____________|_______________| + */ +struct wcn36xx_sta { + u16 tid; + u8 sta_index; + u8 dpu_desc_index; + u8 bss_sta_index; + u8 bss_dpu_desc_index; + bool is_data_encrypted; +}; +struct wcn36xx_dxe_ch; +struct wcn36xx { + struct ieee80211_hw *hw; + struct device *dev; + struct mac_address addresses; + struct wcn36xx_hal_mac_ssid ssid; + u16 aid; + struct wcn36xx_vif *current_vif; + struct wcn36xx_sta *sta; + u8 dtim_period; + enum ani_ed_type encrypt_type; + + /* WoW related*/ + struct mutex pm_mutex; + bool is_suspended; + bool is_con_lost_pending; + + u8 fw_revision; + u8 fw_version; + u8 fw_minor; + u8 fw_major; + + /* extra byte for the NULL termination */ + u8 crm_version[WCN36XX_HAL_VERSION_LENGTH + 1]; + u8 wlan_version[WCN36XX_HAL_VERSION_LENGTH + 1]; + + /* IRQs */ + int tx_irq; + int rx_irq; + void __iomem *mmio; + + /* Rates */ + struct wcn36xx_hal_supported_rates supported_rates; + + struct wcn36xx_platform_ctrl_ops *ctrl_ops; + /* + * smd_buf must be protected with smd_mutex to garantee + * that all messages are sent one after another + */ + u8 *smd_buf; + struct mutex smd_mutex; + + bool is_joining; + + /* DXE channels */ + struct wcn36xx_dxe_ch dxe_tx_l_ch; /* TX low */ + struct wcn36xx_dxe_ch dxe_tx_h_ch; /* TX high */ + struct wcn36xx_dxe_ch dxe_rx_l_ch; /* RX low */ + struct wcn36xx_dxe_ch dxe_rx_h_ch; /* RX high */ + + /* For synchronization of DXE resources from BH, IRQ and WQ contexts */ + spinlock_t dxe_lock; + bool queues_stopped; + + /* Memory pools */ + struct wcn36xx_dxe_mem_pool mgmt_mem_pool; + struct wcn36xx_dxe_mem_pool data_mem_pool; + + struct sk_buff *tx_ack_skb; + + /* Power management */ + enum wcn36xx_power_state pw_state; + +#ifdef CONFIG_WCN36XX_DEBUGFS + /* Debug file system entry */ + struct wcn36xx_dfs_entry dfs; +#endif /* CONFIG_WCN36XX_DEBUGFS */ + +}; + +static inline bool wcn36xx_is_fw_version(struct wcn36xx *wcn, + u8 major, + u8 minor, + u8 version, + u8 revision) +{ + return (wcn->fw_major == major && + wcn->fw_minor == minor && + wcn->fw_version == version && + wcn->fw_revision == revision); +} + +#endif /* _WCN36XX_H_ */
Adding wcn36xx.h Signed-off-by: Eugene Krasnikov <k.eugene.e@gmail.com> --- drivers/net/wireless/ath/wcn36xx/wcn36xx.h | 236 +++++++++++++++++++++++++++++ 1 file changed, 236 insertions(+) create mode 100644 drivers/net/wireless/ath/wcn36xx/wcn36xx.h