staging: rtl8192e: Fix more checkpatch.pl warnings
v3 cover staging: rtl8192e: Fix more checkpatch.pl warnings
This series applies some of review comments by Dan (thanks!) as well as does further cleanups.
Further series will probably focus more on changing driver architecture into something that may get accepted into -wireless.
This series should apply cleanly to staging-testing(7192a5dd5) branches.
One changeset - #14 will not apply cleanly if the following patch will be applied:
[PATCH v2] staging: rtl8192e: Change cpu_to_le16 to le16_to_cpu
It should apply via 3-way merge (only one line of context is different)
Target tested on netbook with rtl8192e card vs Linus master (1a9f064f):
- Module load/unload
- Interface up/down
- Network scanning
- Connect to WPA2 network + ping route
I've found one bug in the driver (it happens also on master) - rtllib doesn't handle rmmod of active (WPA) r8192e_pci - module refcount drops below 0.
Built-tested for each patch in series on staging-testing
New changes (patch numbers are valid for v3):
- #6 Removal of rtllib_crypt.[ch] - unused files are bad
- #10 Simplification of rtllib_proces_probe_response - fixing LONG_LINES in process
- #24 Fix new checkpatch warnings (OOM_MESSAGE)
- #25 Remove another unused file (rtl_crypto.h)
- #26-#28 Replace ?: expression with min/max macros
- #29 Remove unused debug messages
- #30 Simplify/Optimize rtl8192_phy_checkBBAndRF()
- #31 Replace RT_TRACE(COMP_ERR,...) with netdev_* errors - this are error messages that were (and should be) displayed, with this patch it will be clearly visible where they belong (+log levels were changed to more appropriate).
- #32 Trivial reindentations
- #33 Simplify awkward WoL reporting in rtl8192E_suspend()
What happened to v2 changesets (patch numbers are valid for v2 unless noted):
- Patches 1-9 were already applied by Greg - Thanks!
- Patch 10 was split and reworked into v3 patches: 1, 2, 3
- Patches 11, 12 were cherry-picked into v3 patches 4, 5
- Patch 13 became a series of patches removing whole RTLLIB_* debug "system" (v3 patches 7-9, 11-19, 20). Where possible netdev_* was used, but in some cases it would look awkward so I left with pr_*
- Patch 14 was cherry-picked into v3 patch 21 (Again - thanks for patience Dan)
- Patches 15, 17, 18, 19, 20 were thrown out - they fix some LONG_LINE warnings, but it's not worth it as readability of code goes down - I will remove remaining warnings while refactoring the driver
- Patch 16 was cherry-picked into v3 patch 22
- Patch 21 was cherry-picked into v3 patch 23
Notes from v2:
New cleanup patchset for rtl8192e. It fixes (mostly) checkpatch.pl warnings. When applied, checkpatch.pl warning count drops to 34 (from 1111). It should apply cleanly to staging-next/testing (c610f7f7) branches.
Series was smoke tested on rtl8192e card vs staging-next:
- Module load/unload
- Interface up/down
Most of changes are related to checkpatch.pl with the exception of
- bugfix - staging: rtl8192e: Fix DeviceID in rtl8192_pci_findadapter() This is clearly (in my opinion) typo - I checked two rtl8192e cards from different vendors and both had DeviceID == 0x8192.
- Removal of unimplemented/unused iwpriv handlers - they just give false sense of hope to iwpriv user
Additional changes in v2:
- Fix (most) LONG_LINE warnings
- Replace memcpy() with custom macro - later __aligned(2) will be added to structures (where possible) - I prefer not to do this change before I have working hardware. Unfortunantely these cards are grumpy and refuse to enable radio in PC mPCIe slot (even after soldering W_DISABLE override and using two different antenna sets)
- Fix (most) remaining PREFER_PR_LEVEL warnings
Notes from v1:
This series of patches fixes another set of checkpatch.pl warnings.
Most of the patches are trivial, with the exception of #8, #7 and #5; Driver logic should not be affected.
Some of the patches cause LONG_LINE warnings, but fix has to wait until I do more driver refactorings (It's hard to keep line length when variable names have 30 characters).
Mateusz Kulikowski (33):
staging: rtl8192e: Declare ethernet addresses as __aligned(2)
staging: rtl8192e: Fix PREFER_ETHER_ADDR_COPY warnings
staging: rtl8192e: Mark unaligned memcpy()
staging: rtl8192e: Fix DEEP_INDENTATION warning in
rtllib_parse_info_param()
staging: rtl8192e: Replace memcmp() with ether_addr_equal_unaligned()
staging: rtl8192e: Remove rtllib_crypt.[ch]
staging: rtl8192e: Replace RTLLIB_DEBUG(DL_ERR) with netdev_*()
staging: rtl8192e: Remove RTLLIB_ERROR() and RTLLIB_WARNING()
staging: rtl8192e: Remove RTLLIB_DEBUG_WX()
staging: rtl8192e: Simplify rtllib_proces_probe_response()
staging: rtl8192e: Remove RTLLIB_DEBUG_SCAN()
staging: rtl8192e: Remove RTLLIB_DEBUG_(FRAG|EAP|DROP|STATE|TX|RX)()
staging: rtl8192e: Remove RTLLIB_DEBUG_QOS()
staging: rtl8192e: Remove RTLLIB_DEBUG_MGMT()
staging: rtl8192e: Remove RTLLIB_DEBUG_INFO()
staging: rtl8192e: Remove RTLLIB_DEBUG()
staging: rtl8192e: Remove RTLLIB_DEBUG_DATA()
staging: rtl8192e: Remove remains of RTLLIB_*_DEBUG() (including proc
entry)
staging: rtl8192e: Remove assert() macro
staging: rtl8192e: Fix PREFER_PR_LEVEL warnings
staging: rtl8192e: Fix LONG_LINE warnings
staging: rtl8192e: Fix LONG_LING in rtllib_parse_info_param()
staging: rtl8192e: Remove unimplemented iwpriv handlers
staging: rtl8192e: Fix OOM_MESSAGE warnings
staging: rtl8192e: Remove unused rtl_crypto.h
staging: rtl8192e: Replace ?: with max_t
staging: rtl8192e: Replace ?: with min_t
staging: rtl8192e: Replace ?: with max
staging: rtl8192e: Remove unneeded RT_TRACE(COMP_ERR,...)
staging: rtl8192e: rtl8192_phy_checkBBAndRF(): Don't check MAC
staging: rtl8192e: Replace RT_TRACE(COMP_ERR, ...) with netdev_*
staging: rtl8192e: Fix trivial LONG_LINE errors
staging: rtl8192e: rtl8192E_suspend(): Fix WOL reporting
drivers/staging/rtl8192e/dot11d.h | 4 +- drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c | 25 +- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 58 +- .../staging/rtl8192e/rtl8192e/r8192E_firmware.c | 43 +- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 116 ++- drivers/staging/rtl8192e/rtl8192e/rtl_cam.c | 18 +- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 77 +- drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 1 - drivers/staging/rtl8192e/rtl8192e/rtl_crypto.h | 382 -------- drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 274 ++++-- drivers/staging/rtl8192e/rtl8192e/rtl_pm.c | 6 +- drivers/staging/rtl8192e/rtl8192e/rtl_ps.c | 4 +- drivers/staging/rtl8192e/rtl8192e/rtl_wx.c | 108 +-- drivers/staging/rtl8192e/rtl819x_BAProc.c | 149 ++- drivers/staging/rtl8192e/rtl819x_HTProc.c | 54 +- drivers/staging/rtl8192e/rtl819x_Qos.h | 4 +- drivers/staging/rtl8192e/rtl819x_TS.h | 2 +- drivers/staging/rtl8192e/rtl819x_TSProc.c | 75 +- drivers/staging/rtl8192e/rtllib.h | 86 +- drivers/staging/rtl8192e/rtllib_crypt.c | 254 ----- drivers/staging/rtl8192e/rtllib_crypt.h | 34 - drivers/staging/rtl8192e/rtllib_crypt_ccmp.c | 2 +- drivers/staging/rtl8192e/rtllib_crypt_tkip.c | 85 +- drivers/staging/rtl8192e/rtllib_debug.h | 8 - drivers/staging/rtl8192e/rtllib_module.c | 63 +- drivers/staging/rtl8192e/rtllib_rx.c | 1003 +++++++++++--------- drivers/staging/rtl8192e/rtllib_softmac.c | 167 ++-- drivers/staging/rtl8192e/rtllib_softmac_wx.c | 18 +- drivers/staging/rtl8192e/rtllib_tx.c | 78 +- drivers/staging/rtl8192e/rtllib_wx.c | 53 +- 30 files changed, 1239 insertions(+), 2012 deletions(-) delete mode 100644 drivers/staging/rtl8192e/rtl8192e/rtl_crypto.h delete mode 100644 drivers/staging/rtl8192e/rtllib_crypt.c delete mode 100644 drivers/staging/rtl8192e/rtllib_crypt.h
Signature · 1 line
1.8.4.1
PATCH v3 1/33 staging: rtl8192e: Declare ethernet addresses as __aligned(2)
Add __aligned(2) into ethernet addresses allocated on stack or in non-packed structures. Use ETH_ALEN as array length in places where it was hardcoded to 6.
--- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 3 ++- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 5 +++-- drivers/staging/rtl8192e/rtl8192e/rtl_wx.c | 7 ++++--- drivers/staging/rtl8192e/rtl819x_Qos.h | 4 ++-- drivers/staging/rtl8192e/rtl819x_TS.h | 2 +- drivers/staging/rtl8192e/rtllib.h | 10 +++++----- drivers/staging/rtl8192e/rtllib_crypt_tkip.c | 3 ++- drivers/staging/rtl8192e/rtllib_rx.c | 6 +++++- drivers/staging/rtl8192e/rtllib_softmac.c | 8 ++++---- drivers/staging/rtl8192e/rtllib_tx.c | 3 ++- 10 files changed, 30 insertions(+), 21 deletions(-)
drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +2 -1
@@ -321,7 +321,8 @@ static void rtl8192_read_eeprom_info(struct net_device *dev)u8 ICVer8192, ICVer8256;u16 i, usValue, IC_Version;u16 EEPROMId; -u8 bMac_Tmp_Addr[6 ] = {0x00 ,0xe0 ,0x4c ,0x00 ,0x00 ,0x01 }; +u8 bMac_Tmp_Addr[ETH_ALEN ]__aligned(2) = {0x00 ,0xe0 ,0x4c , +0x00 ,0x00 ,0x01 };RT_TRACE (COMP_INIT ,"====> rtl8192_read_eeprom_info\n" );
drivers/staging/rtl8192e/rtl8192e/rtl_core.c +3 -2
@@ -2573,8 +2573,9 @@ static int rtl8192_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)int ret =-1 ;struct rtllib_device *ieee = priv->rtllib;u32 key[4 ]; -u8 broadcast_addr[6 ] = {0xff ,0xff ,0xff ,0xff ,0xff ,0xff }; -u8 zero_addr[6 ] = {0 }; +u8 broadcast_addr[ETH_ALEN ]__aligned(2) = {0xff ,0xff ,0xff , +0xff ,0xff ,0xff }; +u8 zero_addr[ETH_ALEN ]__aligned(2) = {0 };struct iw_point *p = &wrq->u.data;struct ieee_param *ipw =NULL ;
drivers/staging/rtl8192e/rtl8192e/rtl_wx.c +4 -3
@@ -193,7 +193,7 @@ static int r8192_wx_force_mic_error(struct net_device *dev,#define MAX_ADHOC_PEER_NUM 64struct adhoc_peer_entry { -unsigned char MacAddr[ETH_ALEN ]; +unsigned char MacAddr[ETH_ALEN ]__aligned(2) ;unsigned char WirelessMode;unsigned char bCurTxBW40MHz; };
@@ -987,8 +987,9 @@ static int r8192_wx_set_enc_ext(struct net_device *dev, ret =rtllib_wx_set_encode_ext (ieee, info, wrqu, extra); { -u8 broadcast_addr[6 ] = {0xff ,0xff ,0xff ,0xff ,0xff ,0xff }; -u8 zero[6 ] = {0 }; +u8 broadcast_addr[ETH_ALEN ]__aligned(2) = {0xff ,0xff ,0xff , +0xff ,0xff ,0xff }; +u8 zero[ETH_ALEN ]__aligned(2) = {0 };u32 key[4 ] = {0 };struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;struct iw_point *encoding = &wrqu->encoding;
drivers/staging/rtl8192e/rtl819x_Qos.h +2 -2
@@ -255,8 +255,8 @@ union qos_tclas {u8 Priority;u8 ClassifierType;u8 Mask; -u8 SrcAddr[6 ]; -u8 DstAddr[6 ]; +u8 SrcAddr[ETH_ALEN ]__aligned(2) ; +u8 DstAddr[ETH_ALEN ]__aligned(2) ;u16 Type; }TYPE0_ETH ;
drivers/staging/rtl8192e/rtl819x_TS.h +1 -1
@@ -35,7 +35,7 @@ struct ts_common_info {struct list_head List;struct timer_list SetupTimer;struct timer_list InactTimer; -u8 Addr[6 ]; +u8 Addr[ETH_ALEN ]__aligned(2) ;union tspec_body TSpec;union qos_tclas TClass[TCLAS_NUM ];u8 TClasProc;
drivers/staging/rtl8192e/rtllib.h +5 -5
@@ -1531,7 +1531,7 @@ struct rtllib_network {u16 CcxRmState[2 ];bool bMBssidValid;u8 MBssidMask; -u8 MBssid[6 ]; +u8 MBssid[ETH_ALEN ]__aligned(2) ;bool bWithCcxVerNum;u8 BssCcxVerNumber;/* These are network statistics */
@@ -1866,7 +1866,7 @@ struct rt_link_detect {struct sw_cam_table { -u8 macaddr[6 ]; +u8 macaddr[ETH_ALEN ];bool bused;u8 key_buf[16 ];u16 key_type;
@@ -1913,7 +1913,7 @@ enum ratr_table_mode_8192s {#define NUM_PMKID_CACHE 16struct rt_pmkid_list {u8 bUsed; -u8 Bssid[6 ]; +u8 Bssid[ETH_ALEN ]__aligned(2) ;u8 PMKID[16 ];u8 SsidBuf[33 ];u8 *ssid_octet;
@@ -2083,7 +2083,7 @@ struct rtllib_device {u8 *wpa_ie;size_t wps_ie_len;u8 *wps_ie; -u8 ap_mac_addr[6 ]; +u8 ap_mac_addr[ETH_ALEN ]__aligned(2) ;u16 pairwise_key_type;u16 group_key_type;
@@ -2105,7 +2105,7 @@ struct rtllib_device {u16 rts;/* RTS threshold */ /* Association info */ -u8 bssid[ETH_ALEN ]; +u8 bssid[ETH_ALEN ]__aligned(2) ;/* This stores infos for the current network. * Either the network we are associated in INFRASTRUCTURE
drivers/staging/rtl8192e/rtllib_crypt_tkip.c +2 -1
@@ -52,7 +52,8 @@ struct rtllib_tkip_data {struct crypto_blkcipher *tx_tfm_arc4;struct crypto_hash *tx_tfm_michael;/* scratch buffers for virt_to_page() (crypto API) */ -u8 rx_hdr[16 ], tx_hdr[16 ]; +u8 rx_hdr[16 ]__aligned(2) ; +u8 tx_hdr[16 ]__aligned(2) ; };static void *rtllib_tkip_init (int key_idx)
drivers/staging/rtl8192e/rtllib_rx.c +5 -1
@@ -1258,7 +1258,11 @@ static int rtllib_rx_InfraAdhoc(struct rtllib_device *ieee, struct sk_buff *skb,struct rx_ts_record *pTS =NULL ;u16 fc, sc, SeqNum =0 ;u8 type, stype, multicast =0 , unicast =0 , nr_subframes =0 ,TID =0 ; -u8 dst[ETH_ALEN ], src[ETH_ALEN ], bssid[ETH_ALEN ] = {0 }, *payload; +u8 dst[ETH_ALEN ]__aligned(2) ; +u8 src[ETH_ALEN ]__aligned(2) ; +u8 bssid[ETH_ALEN ]__aligned(2) = {0 }; +u8 *payload; +size_t hdrlen =0 ;bool bToOtherSTA = false;int ret =0 , i =0 ;
drivers/staging/rtl8192e/rtllib_softmac.c +4 -4
@@ -1931,7 +1931,7 @@ static inline u16 assoc_parse(struct rtllib_device *ieee, struct sk_buff *skb,void rtllib_rx_probe_rq (struct rtllib_device *ieee,struct sk_buff *skb) { -u8 dest[ETH_ALEN ]; +u8 dest[ETH_ALEN ]__aligned(2) ; ieee->softmac_stats.rx_probe_rq++;if (probe_rq_parse (ieee, skb, dest) >0 ) {
@@ -1943,7 +1943,7 @@ void rtllib_rx_probe_rq(struct rtllib_device *ieee, struct sk_buff *skb)static inline void rtllib_rx_auth_rq (struct rtllib_device *ieee,struct sk_buff *skb) { -u8 dest[ETH_ALEN ]; +u8 dest[ETH_ALEN ]__aligned(2) ;int status; ieee->softmac_stats.rx_auth_rq++;
@@ -1957,7 +1957,7 @@ static inline void rtllib_rx_assoc_rq(struct rtllib_device *ieee, struct sk_buff *skb) { -u8 dest[ETH_ALEN ]; +u8 dest[ETH_ALEN ]__aligned(2) ; ieee->softmac_stats.rx_ass_rq++;if (assoc_rq_parse (skb, dest) !=-1 )
@@ -2911,7 +2911,7 @@ exit:struct sk_buff *rtllib_get_beacon_ (struct rtllib_device *ieee) { -u8 broadcast_addr[] = {0xff ,0xff ,0xff ,0xff ,0xff ,0xff }; +u8 broadcast_addr[]__aligned(2) = {0xff ,0xff ,0xff ,0xff ,0xff ,0xff };struct sk_buff *skb;struct rtllib_probe_response *b;
drivers/staging/rtl8192e/rtllib_tx.c +2 -1
@@ -579,7 +579,8 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) .seq_ctl = 0, .qos_ctl = 0 }; -u8 dest[ETH_ALEN ], src[ETH_ALEN ]; +u8 dest[ETH_ALEN ]__aligned(2) ; +u8 src[ETH_ALEN ]__aligned(2) ;int qos_actived = ieee->current_network.qos_data.active;struct lib80211_crypt_data *crypt =NULL ;struct cb_desc *tcb_desc;
Signature · 1 line
1.8.4.1
Re: [PATCH v3 01/33] staging: rtl8192e: Declare ethernet addresses as __aligned(2)
Quoted 2 lines · Mateusz Kulikowski
Add
__aligned(2)into ethernet addresses allocated on stack or in non-packed structures. UseETH_ALENas array length in places where it was hardcoded to 6.
[]
drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
Quoted 1 line
drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +0
-0
[]
drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c static void rtl8192_read_eeprom_info(struct net_device *dev) · line 325
Quoted 7 lines
drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +2
-1@@ -321,7 +321,8 @@ static void rtl8192_read_eeprom_info(struct net_device *dev)u8 ICVer8192, ICVer8256;u16 i, usValue, IC_Version;u16 EEPROMId; -u8 bMac_Tmp_Addr[6 ] = {0x00 ,0xe0 ,0x4c ,0x00 ,0x00 ,0x01 }; +u8 bMac_Tmp_Addr[ETH_ALEN ]__aligned(2) = {0x00 ,0xe0 ,0x4c , +0x00 ,0x00 ,0x01 };
While this is safe, as this follows a u16, it's unnecessary.
Also, ideally, this would be
u8 foo[ETH_ALEN] = {
1, 2, 3, 4, 5, 6
};or just left on a single line.
drivers/staging/rtl8192e/rtl8192e/rtl_core.c
Quoted 1 line
drivers/staging/rtl8192e/rtl8192e/rtl_core.c +0
-0
[]
drivers/staging/rtl8192e/rtl8192e/rtl_core.c static int rtl8192_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) · line 2578
Quoted 9 lines
drivers/staging/rtl8192e/rtl8192e/rtl_core.c +3
-2@@ -2573,8 +2573,9 @@ static int rtl8192_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)int ret =-1 ;struct rtllib_device *ieee = priv->rtllib;u32 key[4 ]; -u8 broadcast_addr[6 ] = {0xff ,0xff ,0xff ,0xff ,0xff ,0xff }; -u8 zero_addr[6 ] = {0 }; +u8 broadcast_addr[ETH_ALEN ]__aligned(2) = {0xff ,0xff ,0xff , +0xff ,0xff ,0xff }; +u8 zero_addr[ETH_ALEN ]__aligned(2) = {0 };
If these are used only in tests, these are probably better being removed and using is_<foo>_ether_addr or maybe if these used in things other than tests, being converted to static const so they are not reinitialized on each call of the function.
Re: [PATCH v3 01/33] staging: rtl8192e: Declare ethernet addresses as __aligned(2)
Quoted 16 lines · Joe Perches
Quoted 2 lines · Mateusz Kulikowski
Add
__aligned(2)into ethernet addresses allocated on stack or in non-packed structures. UseETH_ALENas array length in places where it was hardcoded to 6.[]
drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
Quoted 1 line
drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +0
-0[]
drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c static void rtl8192_read_eeprom_info(struct net_device *dev) · line 325
Quoted 7 lines
drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +2
-1@@ -321,7 +321,8 @@ static void rtl8192_read_eeprom_info(struct net_device *dev)u8 ICVer8192, ICVer8256;u16 i, usValue, IC_Version;u16 EEPROMId; -u8 bMac_Tmp_Addr[6 ] = {0x00 ,0xe0 ,0x4c ,0x00 ,0x00 ,0x01 }; +u8 bMac_Tmp_Addr[ETH_ALEN ]__aligned(2) = {0x00 ,0xe0 ,0x4c , +0x00 ,0x00 ,0x01 };While this is safe, as this follows a u16, it's unnecessary.
Quoted 5 lines
Also, ideally, this would be
u8 foo[ETH_ALEN] = { 1, 2, 3, 4, 5, 6 };or just left on a single line.
I put __aligned to most places to show authors intention and to prevent someone from breaking it by (for example) removing u16 above due some refactoring.
If you insist - I will remove it.
Quoted 19 lines
drivers/staging/rtl8192e/rtl8192e/rtl_core.c
Quoted 2 lines
drivers/staging/rtl8192e/rtl8192e/rtl_core.c +0
-0[]
drivers/staging/rtl8192e/rtl8192e/rtl_core.c static int rtl8192_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) · line 2578
Quoted 9 lines
drivers/staging/rtl8192e/rtl8192e/rtl_core.c +3
-2@@ -2573,8 +2573,9 @@ static int rtl8192_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)int ret =-1 ;struct rtllib_device *ieee = priv->rtllib;u32 key[4 ]; -u8 broadcast_addr[6 ] = {0xff ,0xff ,0xff ,0xff ,0xff ,0xff }; -u8 zero_addr[6 ] = {0 }; +u8 broadcast_addr[ETH_ALEN ]__aligned(2) = {0xff ,0xff ,0xff , +0xff ,0xff ,0xff }; +u8 zero_addr[ETH_ALEN ]__aligned(2) = {0 };If these are used only in tests, these are probably better being removed and using is_<foo>_ether_addr or maybe if these used in things other than tests, being converted to static const so they are not reinitialized on each call of the function.
zero_addr in fact is used only for comparison - I'll use is_eth_zero_addr;
broadcast is used as parameter so will make it static const (and update used functions to accept const ethaddr)
Regards,
Mateusz
Re: [PATCH v3 01/33] staging: rtl8192e: Declare ethernet addresses as __aligned(2)
Quoted 23 lines · Mateusz Kulikowski
Quoted 16 lines · Joe Perches
Quoted 2 lines · Mateusz Kulikowski
Add
__aligned(2)into ethernet addresses allocated on stack or in non-packed structures. UseETH_ALENas array length in places where it was hardcoded to 6.[]
drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
Quoted 1 line
drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +0
-0[]
drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c static void rtl8192_read_eeprom_info(struct net_device *dev) · line 325
Quoted 7 lines
drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +2
-1@@ -321,7 +321,8 @@ static void rtl8192_read_eeprom_info(struct net_device *dev)u8 ICVer8192, ICVer8256;u16 i, usValue, IC_Version;u16 EEPROMId; -u8 bMac_Tmp_Addr[6 ] = {0x00 ,0xe0 ,0x4c ,0x00 ,0x00 ,0x01 }; +u8 bMac_Tmp_Addr[ETH_ALEN ]__aligned(2) = {0x00 ,0xe0 ,0x4c , +0x00 ,0x00 ,0x01 };While this is safe, as this follows a u16, it's unnecessary.
Quoted 5 lines
Also, ideally, this would be
u8 foo[ETH_ALEN] = { 1, 2, 3, 4, 5, 6 };or just left on a single line.
Quoted 4 lines
I put
__alignedto most places to show authors intention and to prevent someone from breaking it by (for example) removing u16 above due some refactoring.If you insist - I will remove it.
I'm not very insistent.
PATCH v3 2/33 staging: rtl8192e: Fix PREFER_ETHER_ADDR_COPY warnings
In reply to Mateusz KulikowskiReplace memcpy() with ether_addr_copy() where possible to make checkpatch.pl happy.
--- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 2 +- drivers/staging/rtl8192e/rtl819x_BAProc.c | 13 +++--- drivers/staging/rtl8192e/rtllib_crypt_tkip.c | 19 ++++---- drivers/staging/rtl8192e/rtllib_rx.c | 46 +++++++++--------- drivers/staging/rtl8192e/rtllib_softmac.c | 64 +++++++++++++------------- drivers/staging/rtl8192e/rtllib_softmac_wx.c | 4 +- drivers/staging/rtl8192e/rtllib_tx.c | 24 +++++----- 7 files changed, 89 insertions(+), 83 deletions(-)
drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +1 -1
@@ -384,7 +384,7 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) *(u16 *)(&dev->dev_addr[i]) = usValue; } }else { -memcpy (dev->dev_addr, bMac_Tmp_Addr,6 ); +ether_addr_copy (dev->dev_addr, bMac_Tmp_Addr); } RT_TRACE(COMP_INIT, "Permanent Address = %pM\n",
drivers/staging/rtl8192e/rtl819x_BAProc.c +7 -6
@@ -18,6 +18,7 @@******************************************************************************/ #include <asm/byteorder.h> #include <asm/unaligned.h> +#include <linux/etherdevice.h> #include "rtllib.h" #include "rtl819x_BA.h"
@@ -103,10 +104,10 @@ static struct sk_buff *rtllib_ADDBA(struct rtllib_device *ieee, u8 *Dst, BAReq = (struct rtllib_hdr_3addr *)skb_put (skb,sizeof (struct rtllib_hdr_3addr )); -memcpy (BAReq->addr1, Dst,ETH_ALEN ); -memcpy (BAReq->addr2, ieee->dev->dev_addr,ETH_ALEN ); +ether_addr_copy (BAReq->addr1, Dst); +ether_addr_copy (BAReq->addr2, ieee->dev->dev_addr); -memcpy (BAReq->addr3, ieee->current_network.bssid,ETH_ALEN ); +ether_addr_copy (BAReq->addr3, ieee->current_network.bssid); BAReq->frame_ctl =cpu_to_le16 (RTLLIB_STYPE_MANAGE_ACT ); tag = (u8 *)skb_put (skb,9 );
@@ -167,9 +168,9 @@ static struct sk_buff *rtllib_DELBA(struct rtllib_device *ieee, u8 *dst, Delba = (struct rtllib_hdr_3addr *)skb_put (skb,sizeof (struct rtllib_hdr_3addr )); -memcpy (Delba->addr1, dst,ETH_ALEN ); -memcpy (Delba->addr2, ieee->dev->dev_addr,ETH_ALEN ); -memcpy (Delba->addr3, ieee->current_network.bssid,ETH_ALEN ); +ether_addr_copy (Delba->addr1, dst); +ether_addr_copy (Delba->addr2, ieee->dev->dev_addr); +ether_addr_copy (Delba->addr3, ieee->current_network.bssid); Delba->frame_ctl =cpu_to_le16 (RTLLIB_STYPE_MANAGE_ACT ); tag = (u8 *)skb_put (skb,6 );
drivers/staging/rtl8192e/rtllib_crypt_tkip.c +10 -9
@@ -21,6 +21,7 @@#include <linux/crypto.h> #include <linux/scatterlist.h> #include <linux/crc32.h> +#include <linux/etherdevice.h> #include "rtllib.h"
@@ -533,20 +534,20 @@ static void michael_mic_hdr(struct sk_buff *skb, u8 *hdr)switch (le16_to_cpu (hdr11->frame_ctl) & (RTLLIB_FCTL_FROMDS |RTLLIB_FCTL_TODS )) {case RTLLIB_FCTL_TODS : -memcpy (hdr, hdr11->addr3,ETH_ALEN );/* DA */ -memcpy (hdr +ETH_ALEN , hdr11->addr2,ETH_ALEN );/* SA */ +ether_addr_copy (hdr, hdr11->addr3);/* DA */ +ether_addr_copy (hdr +ETH_ALEN , hdr11->addr2);/* SA */ break ;case RTLLIB_FCTL_FROMDS : -memcpy (hdr, hdr11->addr1,ETH_ALEN );/* DA */ -memcpy (hdr +ETH_ALEN , hdr11->addr3,ETH_ALEN );/* SA */ +ether_addr_copy (hdr, hdr11->addr1);/* DA */ +ether_addr_copy (hdr +ETH_ALEN , hdr11->addr3);/* SA */ break ;case RTLLIB_FCTL_FROMDS |RTLLIB_FCTL_TODS : -memcpy (hdr, hdr11->addr3,ETH_ALEN );/* DA */ -memcpy (hdr +ETH_ALEN , hdr11->addr4,ETH_ALEN );/* SA */ +ether_addr_copy (hdr, hdr11->addr3);/* DA */ +ether_addr_copy (hdr +ETH_ALEN , hdr11->addr4);/* SA */ break ;case 0 : -memcpy (hdr, hdr11->addr1,ETH_ALEN );/* DA */ -memcpy (hdr +ETH_ALEN , hdr11->addr2,ETH_ALEN );/* SA */ +ether_addr_copy (hdr, hdr11->addr1);/* DA */ +ether_addr_copy (hdr +ETH_ALEN , hdr11->addr2);/* SA */ break ; }
@@ -599,7 +600,7 @@ static void rtllib_michael_mic_failure(struct net_device *dev,else ev.flags |=IW_MICFAILURE_PAIRWISE ; ev.src_addr.sa_family =ARPHRD_ETHER ; -memcpy (ev.src_addr.sa_data, hdr->addr2,ETH_ALEN ); +ether_addr_copy (ev.src_addr.sa_data, hdr->addr2);memset (&wrqu,0 ,sizeof (wrqu)); wrqu.data.length =sizeof (ev);wireless_send_event (dev,IWEVMICHAELMICFAILURE , &wrqu, (char *) &ev);
drivers/staging/rtl8192e/rtllib_rx.c +25 -21
93 lines not on this page · raw message
drivers/staging/rtl8192e/rtllib_softmac.c +32 -32
149 lines not on this page · raw message
drivers/staging/rtl8192e/rtllib_softmac_wx.c +2 -2
@@ -160,7 +160,7 @@ int rtllib_wx_set_wap(struct rtllib_device *ieee,if (is_zero_ether_addr (temp->sa_data)) {spin_lock_irqsave (&ieee->lock, flags); -memcpy (ieee->current_network.bssid, temp->sa_data,ETH_ALEN ); +ether_addr_copy (ieee->current_network.bssid, temp->sa_data); ieee->wap_set =0 ;spin_unlock_irqrestore (&ieee->lock, flags); ret =-1 ;
@@ -177,7 +177,7 @@ int rtllib_wx_set_wap(struct rtllib_device *ieee,spin_lock_irqsave (&ieee->lock, flags); ieee->cannot_notify = false; -memcpy (ieee->current_network.bssid, temp->sa_data,ETH_ALEN ); +ether_addr_copy (ieee->current_network.bssid, temp->sa_data); ieee->wap_set = !is_zero_ether_addr (temp->sa_data);spin_unlock_irqrestore (&ieee->lock, flags);
drivers/staging/rtl8192e/rtllib_tx.c +12 -12
@@ -609,8 +609,8 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) goto success; }/* Save source and destination addresses */ -memcpy (dest, skb->data,ETH_ALEN ); -memcpy (src, skb->data+ETH_ALEN ,ETH_ALEN ); +ether_addr_copy (dest, skb->data); +ether_addr_copy (src, skb->data +ETH_ALEN );memset (skb->cb,0 ,sizeof (skb->cb)); ether_type =ntohs (((struct ethhdr *)skb->data)->h_proto);
@@ -695,22 +695,22 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev)/* To DS: Addr1 = BSSID, Addr2 = SA, * Addr3 = DA */ -memcpy (&header.addr1, ieee->current_network.bssid, -ETH_ALEN ); -memcpy (&header.addr2, &src,ETH_ALEN ); +ether_addr_copy (header.addr1, + ieee->current_network.bssid); +ether_addr_copy (header.addr2, src);if (IsAmsdu) -memcpy (&header.addr3, - ieee->current_network.bssid,ETH_ALEN ); +ether_addr_copy (header.addr3, + ieee->current_network.bssid);else -memcpy (&header.addr3, &dest,ETH_ALEN ); +ether_addr_copy (header.addr3, dest); }else if (ieee->iw_mode ==IW_MODE_ADHOC ) {/* not From/To DS: Addr1 = DA, Addr2 = SA, * Addr3 = BSSID */ -memcpy (&header.addr1, dest,ETH_ALEN ); -memcpy (&header.addr2, src,ETH_ALEN ); -memcpy (&header.addr3, ieee->current_network.bssid, -ETH_ALEN ); +ether_addr_copy (header.addr1, dest); +ether_addr_copy (header.addr2, src); +ether_addr_copy (header.addr3, + ieee->current_network.bssid); } bIsMulticast =is_multicast_ether_addr (header.addr1);
Signature · 1 line
1.8.4.1
Greg KH
maintainerRe: [PATCH v3 02/33] staging: rtl8192e: Fix PREFER_ETHER_ADDR_COPY warnings
Quoted 2 lines · Mateusz Kulikowski
Replace
memcpy()withether_addr_copy()where possible to make checkpatch.pl happy.
I need proof that this is ok to do, please provide that in the changelog entry.
thanks,
greg k-h
Re: [PATCH v3 02/33] staging: rtl8192e: Fix PREFER_ETHER_ADDR_COPY warnings
Quoted 6 lines · Greg KH
Quoted 2 lines · Mateusz Kulikowski
Replace
memcpy()withether_addr_copy()where possible to make checkpatch.pl happy.I need proof that this is ok to do, please provide that in the changelog entry.
What kind of proof do you expect?
I've added BUG into ether_addr_copy (on unaligned addresses) and did some basic networking tests (pings using WPA2/CCMP AP). Of course I haven't done 100% coverage test to driver.
Additionally I manually analyzed code (although human errors are possible).
Do you want me to run some static analyzer as well? Or are this two enough (just add them to changelog).
Regards,
Mateusz
Greg KH
maintainerRe: [PATCH v3 02/33] staging: rtl8192e: Fix PREFER_ETHER_ADDR_COPY warnings
Quoted 9 lines · Mateusz Kulikowski
Quoted 6 lines · Greg KH
Quoted 2 lines · Mateusz Kulikowski
Replace
memcpy()withether_addr_copy()where possible to make checkpatch.pl happy.I need proof that this is ok to do, please provide that in the changelog entry.
What kind of proof do you expect?
Something, you can't just have this single line here and assume that I "know" you actually checked this...
Re: [PATCH v3 02/33] staging: rtl8192e: Fix PREFER_ETHER_ADDR_COPY warnings
Quoted 6 lines · Greg KH
Quoted 5 lines · Mateusz Kulikowski
Quoted 4 lines · Greg KH
Quoted 2 lines · Mateusz Kulikowski
Replace
memcpy()withether_addr_copy()where possible to make checkpatch.pl happy.
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
I need proof that this is ok to do, please provide that in the changelog entry.
What kind of proof do you expect?
Something, you can't just have this single line here and assume that I "know" you actually checked this...
Of course - I understand that (now).
What I meant by this question was - Are the steps I took to verify patch enough for you (so I'll add information about them to v4 changelog) or do you require more checks from my side (for example using static code analyzer).
I assume it's enough and just put it into changelog.
Regards,
Mateusz
PATCH v3 3/33 staging: rtl8192e: Mark unaligned memcpy()
In reply to Mateusz KulikowskiComment unaligned memcpy() that trigger PREFER_ETHER_ADDR_COPY checkpatch.pl warning.
It will prevent accidential "Fix" to ether_addr_copy().
--- drivers/staging/rtl8192e/rtllib_rx.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)
drivers/staging/rtl8192e/rtllib_rx.c +12 -8
@@ -488,15 +488,19 @@ void rtllib_indicate_packets(struct rtllib_device *ieee, struct rtllib_rxb **prx* and replace EtherType */ skb_pull (sub_skb,SNAP_SIZE ); -memcpy (skb_push (sub_skb,ETH_ALEN ), prxb->src,ETH_ALEN ); -memcpy (skb_push (sub_skb,ETH_ALEN ), prxb->dst,ETH_ALEN ); +memcpy (skb_push (sub_skb,ETH_ALEN ), prxb->src, +ETH_ALEN );/* Must be unaligned */ +memcpy (skb_push (sub_skb,ETH_ALEN ), prxb->dst, +ETH_ALEN );/* Must be unaligned */ }else {u16 len;/* Leave Ethernet header part of hdr and full payload */ len = sub_skb->len;memcpy (skb_push (sub_skb,2 ), &len,2 ); -memcpy (skb_push (sub_skb,ETH_ALEN ), prxb->src,ETH_ALEN ); -memcpy (skb_push (sub_skb,ETH_ALEN ), prxb->dst,ETH_ALEN ); +memcpy (skb_push (sub_skb,ETH_ALEN ), prxb->src, +ETH_ALEN );/* Must be unaligned */ +memcpy (skb_push (sub_skb,ETH_ALEN ), prxb->dst, +ETH_ALEN );/* Must be unaligned */ }/* Indicate the packets to upper layer */
@@ -781,15 +785,15 @@ static u8 parse_subframe(struct rtllib_device *ieee, struct sk_buff *skb, rxb->subframes[0 ] = sub_skb; -memcpy (rxb->src, src,ETH_ALEN ); -memcpy (rxb->dst, dst,ETH_ALEN ); +memcpy (rxb->src, src,ETH_ALEN );/* Must stay unaligned */ +memcpy (rxb->dst, dst,ETH_ALEN );/* Must stay unaligned */ rxb->subframes[0 ]->dev = ieee->dev;return 1 ; } rxb->nr_subframes =0 ; -memcpy (rxb->src, src,ETH_ALEN ); -memcpy (rxb->dst, dst,ETH_ALEN ); +memcpy (rxb->src, src,ETH_ALEN );/* Must stay unaligned */ +memcpy (rxb->dst, dst,ETH_ALEN );/* Must stay unaligned */ while (skb->len >ETHERNET_HEADER_SIZE ) {/* Offset 12 denote 2 mac address */ nSubframe_Length = *((u16 *)(skb->data +12 ));
Signature · 1 line
1.8.4.1
Greg KH
maintainerRe: [PATCH v3 03/33] staging: rtl8192e: Mark unaligned memcpy()
Quoted 3 lines · Mateusz Kulikowski
Comment unaligned
memcpy()that triggerPREFER_ETHER_ADDR_COPYcheckpatch.pl warning.
It will prevent accidential "Fix" toether_addr_copy().
What do you mean by this? Why will the comment remove the issue?
Re: [PATCH v3 03/33] staging: rtl8192e: Mark unaligned memcpy()
Quoted 7 lines · Greg KH
Quoted 3 lines · Mateusz Kulikowski
Comment unaligned
memcpy()that triggerPREFER_ETHER_ADDR_COPYcheckpatch.pl warning.
It will prevent accidential "Fix" toether_addr_copy().What do you mean by this? Why will the comment remove the issue?
It will not, It will prevent people from sending checkpatch 'fixes' until I (or someone else) will submit ultimate fix - that is ether_addr_copy_unaligned().
I didn't included it into this series, as this requires cross-tree synchronization (net + staging) and I prefer to do it later in a smaller changeset (2 patches - one for net, one for staging).
If you think it's unnecessary, I'll throw it away in v4.
Regards,
Mateusz
Re: [PATCH v3 03/33] staging: rtl8192e: Mark unaligned memcpy()
In reply to Mateusz KulikowskiQuoted 14 lines · Mateusz Kulikowski
Comment unaligned
memcpy()that triggerPREFER_ETHER_ADDR_COPYcheckpatch.pl warning.
It will prevent accidential "Fix" toether_addr_copy().Signed-off-by Mateusz Kulikowski <[email protected]>--- drivers/staging/rtl8192e/rtllib_rx.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)drivers/staging/rtl8192e/rtllib_rx.c +0
-0
drivers/staging/rtl8192e/rtllib_rx.c void rtllib_indicate_packets(struct rtllib_device *ieee, struct rtllib_rxb **prx · line 492
Quoted 7 lines
drivers/staging/rtl8192e/rtllib_rx.c +2
-2@@ -488,15 +488,19 @@ void rtllib_indicate_packets(struct rtllib_device *ieee, struct rtllib_rxb **prx* and replace EtherType */ skb_pull (sub_skb,SNAP_SIZE ); -memcpy (skb_push (sub_skb,ETH_ALEN ), prxb->src,ETH_ALEN ); -memcpy (skb_push (sub_skb,ETH_ALEN ), prxb->dst,ETH_ALEN ); +memcpy (skb_push (sub_skb,ETH_ALEN ), prxb->src, +ETH_ALEN );/* Must be unaligned */
Which part isn't aligned? I think they both are.
regards,
dan carpenter
Re: [PATCH v3 03/33] staging: rtl8192e: Mark unaligned memcpy()
On 11.05.2015 10:26, Dan Carpenter wrote:
(...)
Quoted 10 lines
drivers/staging/rtl8192e/rtllib_rx.c void rtllib_indicate_packets(struct rtllib_device *ieee, struct rtllib_rxb **prx · line 492
Quoted 6 lines
drivers/staging/rtl8192e/rtllib_rx.c +2
-2*/ skb_pull (sub_skb,SNAP_SIZE ); -memcpy (skb_push (sub_skb,ETH_ALEN ), prxb->src,ETH_ALEN ); -memcpy (skb_push (sub_skb,ETH_ALEN ), prxb->dst,ETH_ALEN ); +memcpy (skb_push (sub_skb,ETH_ALEN ), prxb->src, +ETH_ALEN );/* Must be unaligned */ Which part isn't aligned? I think they both are.
struct rtllib_rxb *prxb = prxbIndicateArray[j];
struct rtllib_rxb {
u8 nr_subframes;
struct sk_buff *subframes[MAX_SUBFRAME_COUNT == 64];
u8 dst[ETH_ALEN]; // here
u8 src[ETH_ALEN]; // here
} __packed;Either I forgot alignment / packing rules or this fields are never aligned "by design".
If I remember correctly - I missed it in the first version as well, but then added BUG into ether_addr_copy().
Regards,
Mateusz
Re: [PATCH v3 03/33] staging: rtl8192e: Mark unaligned memcpy()
Quoted 14 lines · Mateusz Kulikowski
On 11.05.2015 10:26, Dan Carpenter wrote:
(...)Quoted 10 lines
drivers/staging/rtl8192e/rtllib_rx.c void rtllib_indicate_packets(struct rtllib_device *ieee, struct rtllib_rxb **prx · line 492
Quoted 6 lines
drivers/staging/rtl8192e/rtllib_rx.c +2
-2*/ skb_pull (sub_skb,SNAP_SIZE ); -memcpy (skb_push (sub_skb,ETH_ALEN ), prxb->src,ETH_ALEN ); -memcpy (skb_push (sub_skb,ETH_ALEN ), prxb->dst,ETH_ALEN ); +memcpy (skb_push (sub_skb,ETH_ALEN ), prxb->src, +ETH_ALEN );/* Must be unaligned */ Which part isn't aligned? I think they both are.
struct
rtllib_rxb*prxb = prxbIndicateArray[j];
Quoted 8 lines
struct rtllib_rxb { u8 nr_subframes; struct sk_buff *subframes[MAX_SUBFRAME_COUNT == 64]; u8 dst[ETH_ALEN]; // here u8 src[ETH_ALEN]; // here } __packed;Either I forgot alignment / packing rules or this fields are never aligned "by design".
You must have forgotten something... Everything after the pointer is going to be aligned sizeof(void *).
regards,
dan carpenter
Re: [PATCH v3 03/33] staging: rtl8192e: Mark unaligned memcpy()
Quoted 2 lines · Dan Carpenter
Quoted 1 line · Mateusz Kulikowski
On 11.05.2015 10:26, Dan Carpenter wrote:
(...)
Quoted 12 lines
Quoted 12 lines
Quoted 3 lines
Which part isn't aligned? I think they both are.
struct
rtllib_rxb*prxb = prxbIndicateArray[j];struct rtllib_rxb { u8 nr_subframes; struct sk_buff *subframes[MAX_SUBFRAME_COUNT == 64]; u8 dst[ETH_ALEN]; // here u8 src[ETH_ALEN]; // here } __packed;
Quoted 4 lines
Quoted 1 line
Either I forgot alignment / packing rules or this fields are never aligned "by design".
You must have forgotten something... Everything after the pointer is going to be aligned
sizeof(void *).
That would be true, if structure was not __packed:
$ pahole drivers/staging/rtl8192e/rtllib.ko -C rtllib_rxb
struct rtllib_rxb {
u8 nr_subframes; /* 0 1 */
struct sk_buff * subframes[64]; /* 1 256 */
/* --- cacheline 4 boundary (256 bytes) was 1 bytes ago --- */
u8 dst[6]; /* 257 6 */
u8 src[6]; /* 263 6 *//* size: 269, cachelines: 5, members: 4 */ /* last cacheline: 13 bytes */ };
Am I right?
Regards,
Mateusz
Re: [PATCH v3 03/33] staging: rtl8192e: Mark unaligned memcpy()
Quoted 16 lines · Mateusz Kulikowski
Quoted 2 lines · Dan Carpenter
Quoted 1 line · Mateusz Kulikowski
On 11.05.2015 10:26, Dan Carpenter wrote:
(...)
Quoted 12 lines
Quoted 12 lines
Quoted 3 lines
Which part isn't aligned? I think they both are.
struct
rtllib_rxb*prxb = prxbIndicateArray[j];struct rtllib_rxb { u8 nr_subframes; struct sk_buff *subframes[MAX_SUBFRAME_COUNT == 64]; u8 dst[ETH_ALEN]; // here u8 src[ETH_ALEN]; // here } __packed;
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Either I forgot alignment / packing rules or this fields are never aligned "by design".
You must have forgotten something... Everything after the pointer is going to be aligned
sizeof(void *).That would be true, if structure was not
__packed:
Oh. Duh... You are correct.
I'm not positive it's "by design" though, this is staging code so maybe they just added __packed to every struct. In fact, I'm pretty sure unaligned pointers don't work on some arches so the __packed is probably a bug.
regards,
dan carpenter
Re: [PATCH v3 03/33] staging: rtl8192e: Mark unaligned memcpy()
Quoted 16 lines · Dan Carpenter
Quoted 15 lines · Mateusz Kulikowski
Quoted 2 lines · Dan Carpenter
Quoted 1 line · Mateusz Kulikowski
On 11.05.2015 10:26, Dan Carpenter wrote:
(...)
Quoted 11 lines
Quoted 11 lines
Quoted 3 lines
Which part isn't aligned? I think they both are.
struct
rtllib_rxb*prxb = prxbIndicateArray[j];struct rtllib_rxb { u8 nr_subframes; struct sk_buff *subframes[MAX_SUBFRAME_COUNT == 64]; u8 dst[ETH_ALEN]; // here u8 src[ETH_ALEN]; // here } __packed;
(...)
Quoted 6 lines
I'm not positive it's "by design" though, this is staging code so maybe they just added
__packedto every struct. In fact, I'm pretty sure unaligned pointers don't work on some arches so the__packedis probably a bug.
I doubt anyone uses it on anything else than some low cost x86 netbooks.
I removed __packed and did a small test today (download 10mb of garbage, check md5)
- it doesn't seem to affect driver (on staging-testing, without this patchset).
Nevertheless I would prefer to leave it like that for this patch set if it's OK with you and perhaps include it for next series I'll work on.
Regards,
Mateusz
Re: [PATCH v3 03/33] staging: rtl8192e: Mark unaligned memcpy()
Quoted 19 lines · Mateusz Kulikowski
Quoted 16 lines · Dan Carpenter
Quoted 15 lines · Mateusz Kulikowski
Quoted 2 lines · Dan Carpenter
Quoted 1 line · Mateusz Kulikowski
On 11.05.2015 10:26, Dan Carpenter wrote:
(...)
Quoted 11 lines
Quoted 11 lines
Quoted 3 lines
Which part isn't aligned? I think they both are.
struct
rtllib_rxb*prxb = prxbIndicateArray[j];struct rtllib_rxb { u8 nr_subframes; struct sk_buff *subframes[MAX_SUBFRAME_COUNT == 64]; u8 dst[ETH_ALEN]; // here u8 src[ETH_ALEN]; // here } __packed;(...)
Quoted 1 line
Quoted 8 lines
Quoted 5 lines
I'm not positive it's "by design" though, this is staging code so maybe they just added
__packedto every struct. In fact, I'm pretty sure unaligned pointers don't work on some arches so the__packedis probably a bug.I doubt anyone uses it on anything else than some low cost x86 netbooks.
Generally though, there shouldn't be pointers in __packed structs. __packed means we care about alignment very much, probably more than we care about speed. So it means we are sharing the data with the hardware or with userspace which requires a specific layout. We shouldn't be giving kernel pointers to userspace or the hardware. (These are rules of thumb).
Quoted 5 lines
I removed
__packedand did a small test today (download 10mb of garbage, check md5)
- it doesn't seem to affect driver (on staging-testing, without this patchset).Nevertheless I would prefer to leave it like that for this patch set if it's OK with you and perhaps include it for next series I'll work on.
I think Greg asked for a v4 of this patchset? You can leave the code as is if you want. :) You didn't introduce the bug and I'm not your boss. :P
regards,
dan carpenter
PATCH v3 4/33 staging: rtl8192e: Fix DEEP_INDENTATION warning in rtllib_parse_info_param()
In reply to Mateusz KulikowskiMove MFIE_TYPE_GENERIC handler to rtllib_parse_mife_generic() function. Code was not altered significantly, therefore in some places it generates LONG_LINE checkpatch.pl warnings.
--- drivers/staging/rtl8192e/rtllib_rx.c | 364 +++++++++++++++++------------------ 1 file changed, 178 insertions(+), 186 deletions(-)
drivers/staging/rtl8192e/rtllib_rx.c +178 -186
@@ -1743,6 +1743,181 @@ static inline void rtllib_extract_country_ie( } +static void rtllib_parse_mife_generic (struct rtllib_device *ieee, +struct rtllib_info_element *info_element, +struct rtllib_network *network, +u16 *tmp_htcap_len, +u16 *tmp_htinfo_len) +{ +u16 ht_realtek_agg_len =0 ; +u8 ht_realtek_agg_buf[MAX_IE_LEN ]; + +if (!rtllib_parse_qos_info_param_IE (info_element, network)) +return ; + +if (info_element->len >=4 && + info_element->data[0 ] ==0x00 && info_element->data[1 ] ==0x50 && + info_element->data[2 ] ==0xf2 && info_element->data[3 ] ==0x01 ) { + network->wpa_ie_len =min (info_element->len +2 , +MAX_WPA_IE_LEN ); +memcpy (network->wpa_ie, info_element, network->wpa_ie_len); +return ; + } + +if (info_element->len ==7 && info_element->data[0 ] ==0x00 && + info_element->data[1 ] ==0xe0 && info_element->data[2 ] ==0x4c && + info_element->data[3 ] ==0x01 && info_element->data[4 ] ==0x02 ) + network->Turbo_Enable =1 ; + +if (*tmp_htcap_len ==0 ) { +if (info_element->len >=4 && info_element->data[0 ] ==0x00 && + info_element->data[1 ] ==0x90 && + info_element->data[2 ] ==0x4c && + info_element->data[3 ] ==0x033 ) { + *tmp_htcap_len =min_t (u8, info_element->len,MAX_IE_LEN ); +if (*tmp_htcap_len !=0 ) { + network->bssht.bdHTSpecVer =HT_SPEC_VER_EWC ; + network->bssht.bdHTCapLen =min_t (u16, *tmp_htcap_len,sizeof (network->bssht.bdHTCapBuf)); +memcpy (network->bssht.bdHTCapBuf, + info_element->data, + network->bssht.bdHTCapLen); + } + } +if (*tmp_htcap_len !=0 ) { + network->bssht.bdSupportHT = true; + network->bssht.bdHT1R = ((((struct ht_capab_ele *)(network->bssht.bdHTCapBuf))->MCS[1 ]) ==0 ); + }else { + network->bssht.bdSupportHT = false; + network->bssht.bdHT1R = false; + } + } + + +if (*tmp_htinfo_len ==0 ) { +if (info_element->len >=4 && info_element->data[0 ] ==0x00 && + info_element->data[1 ] ==0x90 && + info_element->data[2 ] ==0x4c && + info_element->data[3 ] ==0x034 ) { + *tmp_htinfo_len =min_t (u8, info_element->len, +MAX_IE_LEN ); +if (*tmp_htinfo_len !=0 ) { + network->bssht.bdHTSpecVer =HT_SPEC_VER_EWC ; + network->bssht.bdHTInfoLen =min_t (u16, *tmp_htinfo_len,sizeof (network->bssht.bdHTInfoBuf)); +memcpy (network->bssht.bdHTInfoBuf, + info_element->data, + network->bssht.bdHTInfoLen); + } + + } + } + +if (ieee->aggregation) { +if (network->bssht.bdSupportHT) { +if (info_element->len >=4 && + info_element->data[0 ] ==0x00 && + info_element->data[1 ] ==0xe0 && + info_element->data[2 ] ==0x4c && + info_element->data[3 ] ==0x02 ) { + ht_realtek_agg_len =min_t (u8, + info_element->len, +MAX_IE_LEN ); +memcpy (ht_realtek_agg_buf, info_element->data, + info_element->len); + } +if (ht_realtek_agg_len >=5 ) { + network->realtek_cap_exit = true; + network->bssht.bdRT2RTAggregation = true; + +if ((ht_realtek_agg_buf[4 ] ==1 ) && + (ht_realtek_agg_buf[5 ] &0x02 )) + network->bssht.bdRT2RTLongSlotTime = true; + +if ((ht_realtek_agg_buf[4 ] ==1 ) && + (ht_realtek_agg_buf[5 ] &RT_HT_CAP_USE_92SE )) + network->bssht.RT2RT_HT_Mode |=RT_HT_CAP_USE_92SE ; + } + } +if (ht_realtek_agg_len >=5 ) { +if ((ht_realtek_agg_buf[5 ] &RT_HT_CAP_USE_SOFTAP )) + network->bssht.RT2RT_HT_Mode |=RT_HT_CAP_USE_SOFTAP ; + } + } + +if ((info_element->len >=3 && info_element->data[0 ] ==0x00 && + info_element->data[1 ] ==0x05 && info_element->data[2 ] ==0xb5 ) || + (info_element->len >=3 && info_element->data[0 ] ==0x00 && + info_element->data[1 ] ==0x0a && info_element->data[2 ] ==0xf7 ) || + (info_element->len >=3 && info_element->data[0 ] ==0x00 && + info_element->data[1 ] ==0x10 && info_element->data[2 ] ==0x18 )) { + network->broadcom_cap_exist = true; + } + +if (info_element->len >=3 && info_element->data[0 ] ==0x00 && + info_element->data[1 ] ==0x0c && info_element->data[2 ] ==0x43 ) + network->ralink_cap_exist = true; + +if ((info_element->len >=3 && info_element->data[0 ] ==0x00 && + info_element->data[1 ] ==0x03 && info_element->data[2 ] ==0x7f ) || + (info_element->len >=3 && info_element->data[0 ] ==0x00 && + info_element->data[1 ] ==0x13 && info_element->data[2 ] ==0x74 )) + network->atheros_cap_exist = true; + +if ((info_element->len >=3 && info_element->data[0 ] ==0x00 && + info_element->data[1 ] ==0x50 && info_element->data[2 ] ==0x43 )) + network->marvell_cap_exist = true; + +if (info_element->len >=3 && info_element->data[0 ] ==0x00 && + info_element->data[1 ] ==0x40 && info_element->data[2 ] ==0x96 ) + network->cisco_cap_exist = true; + +if (info_element->len >=3 && info_element->data[0 ] ==0x00 && + info_element->data[1 ] ==0x0a && info_element->data[2 ] ==0xf5 ) + network->airgo_cap_exist = true; + +if (info_element->len >4 && info_element->data[0 ] ==0x00 && + info_element->data[1 ] ==0x40 && info_element->data[2 ] ==0x96 && + info_element->data[3 ] ==0x01 ) { +if (info_element->len ==6 ) { +memcpy (network->CcxRmState, &info_element[4 ],2 ); +if (network->CcxRmState[0 ] !=0 ) + network->bCcxRmEnable = true; +else + network->bCcxRmEnable = false; + network->MBssidMask = network->CcxRmState[1 ] &0x07 ; +if (network->MBssidMask !=0 ) { + network->bMBssidValid = true; + network->MBssidMask =0xff << (network->MBssidMask); +ether_addr_copy (network->MBssid, + network->bssid); + network->MBssid[5 ] &= network->MBssidMask; + }else { + network->bMBssidValid = false; + } + }else { + network->bCcxRmEnable = false; + } + } +if (info_element->len >4 && info_element->data[0 ] ==0x00 && + info_element->data[1 ] ==0x40 && info_element->data[2 ] ==0x96 && + info_element->data[3 ] ==0x03 ) { +if (info_element->len ==5 ) { + network->bWithCcxVerNum = true; + network->BssCcxVerNumber = info_element->data[4 ]; + }else { + network->bWithCcxVerNum = false; + network->BssCcxVerNumber =0 ; + } + } +if (info_element->len >4 && info_element->data[0 ] ==0x00 && + info_element->data[1 ] ==0x50 && info_element->data[2 ] ==0xf2 && + info_element->data[3 ] ==0x04 ) { +RTLLIB_DEBUG_MGMT ("MFIE_TYPE_WZC: %d bytes\n" , + info_element->len); + network->wzc_ie_len =min (info_element->len+2 ,MAX_WZC_IE_LEN ); +memcpy (network->wzc_ie, info_element, network->wzc_ie_len); + } +} + int rtllib_parse_info_param(struct rtllib_device *ieee, struct rtllib_info_element *info_element, u16 length,
@@ -1753,8 +1928,6 @@ int rtllib_parse_info_param(struct rtllib_device *ieee,short offset;u16 tmp_htcap_len =0 ;u16 tmp_htinfo_len =0 ; -u16 ht_realtek_agg_len =0 ; -u8 ht_realtek_agg_buf[MAX_IE_LEN ];char rates_str[64 ];char *p;
@@ -1907,191 +2080,10 @@ int rtllib_parse_info_param(struct rtllib_device *ieee,case MFIE_TYPE_GENERIC :RTLLIB_DEBUG_MGMT ("MFIE_TYPE_GENERIC: %d bytes\n" , info_element->len); -if (!rtllib_parse_qos_info_param_IE (info_element, - network)) -break ; -if (info_element->len >=4 && - info_element->data[0 ] ==0x00 && - info_element->data[1 ] ==0x50 && - info_element->data[2 ] ==0xf2 && - info_element->data[3 ] ==0x01 ) { - network->wpa_ie_len =min (info_element->len +2 , -MAX_WPA_IE_LEN ); -memcpy (network->wpa_ie, info_element, - network->wpa_ie_len); -break ; - } -if (info_element->len ==7 && - info_element->data[0 ] ==0x00 && - info_element->data[1 ] ==0xe0 && - info_element->data[2 ] ==0x4c && - info_element->data[3 ] ==0x01 && - info_element->data[4 ] ==0x02 ) - network->Turbo_Enable =1 ; - -if (tmp_htcap_len ==0 ) { -if (info_element->len >=4 && - info_element->data[0 ] ==0x00 && - info_element->data[1 ] ==0x90 && - info_element->data[2 ] ==0x4c && - info_element->data[3 ] ==0x033 ) { - - tmp_htcap_len =min_t (u8, info_element->len,MAX_IE_LEN ); -if (tmp_htcap_len !=0 ) { - network->bssht.bdHTSpecVer =HT_SPEC_VER_EWC ; - network->bssht.bdHTCapLen =min_t (u16, tmp_htcap_len,sizeof (network->bssht.bdHTCapBuf)); -memcpy (network->bssht.bdHTCapBuf, info_element->data, network->bssht.bdHTCapLen); - } - } -if (tmp_htcap_len !=0 ) { - network->bssht.bdSupportHT = true; - network->bssht.bdHT1R = ((((struct ht_capab_ele *)(network->bssht.bdHTCapBuf))->MCS[1 ]) ==0 ); - }else { - network->bssht.bdSupportHT = false; - network->bssht.bdHT1R = false; - } - } - - -if (tmp_htinfo_len ==0 ) { -if (info_element->len >=4 && - info_element->data[0 ] ==0x00 && - info_element->data[1 ] ==0x90 && - info_element->data[2 ] ==0x4c && - info_element->data[3 ] ==0x034 ) { - tmp_htinfo_len =min_t (u8, info_element->len,MAX_IE_LEN ); -if (tmp_htinfo_len !=0 ) { - network->bssht.bdHTSpecVer =HT_SPEC_VER_EWC ; - network->bssht.bdHTInfoLen =min_t (u16, tmp_htinfo_len,sizeof (network->bssht.bdHTInfoBuf)); -memcpy (network->bssht.bdHTInfoBuf, info_element->data, network->bssht.bdHTInfoLen); - } - } - } - -if (ieee->aggregation) { -if (network->bssht.bdSupportHT) { -if (info_element->len >=4 && - info_element->data[0 ] ==0x00 && - info_element->data[1 ] ==0xe0 && - info_element->data[2 ] ==0x4c && - info_element->data[3 ] ==0x02 ) { - ht_realtek_agg_len =min_t (u8, info_element->len,MAX_IE_LEN ); -memcpy (ht_realtek_agg_buf, info_element->data, info_element->len); - } -if (ht_realtek_agg_len >=5 ) { - network->realtek_cap_exit = true; - network->bssht.bdRT2RTAggregation = true; - -if ((ht_realtek_agg_buf[4 ] ==1 ) && (ht_realtek_agg_buf[5 ] &0x02 )) - network->bssht.bdRT2RTLongSlotTime = true; - -if ((ht_realtek_agg_buf[4 ] ==1 ) && (ht_realtek_agg_buf[5 ] &RT_HT_CAP_USE_92SE )) - network->bssht.RT2RT_HT_Mode |=RT_HT_CAP_USE_92SE ; - } - } -if (ht_realtek_agg_len >=5 ) { -if ((ht_realtek_agg_buf[5 ] &RT_HT_CAP_USE_SOFTAP )) - network->bssht.RT2RT_HT_Mode |=RT_HT_CAP_USE_SOFTAP ; - } - } - -if ((info_element->len >=3 && - info_element->data[0 ] ==0x00 && - info_element->data[1 ] ==0x05 && - info_element->data[2 ] ==0xb5 ) || - (info_element->len >=3 && - info_element->data[0 ] ==0x00 && - info_element->data[1 ] ==0x0a && - info_element->data[2 ] ==0xf7 ) || - (info_element->len >=3 && - info_element->data[0 ] ==0x00 && - info_element->data[1 ] ==0x10 && - info_element->data[2 ] ==0x18 )) { - network->broadcom_cap_exist = true; - } -if (info_element->len >=3 && - info_element->data[0 ] ==0x00 && - info_element->data[1 ] ==0x0c && - info_element->data[2 ] ==0x43 ) - network->ralink_cap_exist = true; -if ((info_element->len >=3 && - info_element->data[0 ] ==0x00 && - info_element->data[1 ] ==0x03 && - info_element->data[2 ] ==0x7f ) || - (info_element->len >=3 && - info_element->data[0 ] ==0x00 && - info_element->data[1 ] ==0x13 && - info_element->data[2 ] ==0x74 )) - network->atheros_cap_exist = true; - -if ((info_element->len >=3 && - info_element->data[0 ] ==0x00 && - info_element->data[1 ] ==0x50 && - info_element->data[2 ] ==0x43 )) - network->marvell_cap_exist = true; -if (info_element->len >=3 && - info_element->data[0 ] ==0x00 && - info_element->data[1 ] ==0x40 && - info_element->data[2 ] ==0x96 ) - network->cisco_cap_exist = true; - - -if (info_element->len >=3 && - info_element->data[0 ] ==0x00 && - info_element->data[1 ] ==0x0a && - info_element->data[2 ] ==0xf5 ) - network->airgo_cap_exist = true; - -if (info_element->len >4 && - info_element->data[0 ] ==0x00 && - info_element->data[1 ] ==0x40 && - info_element->data[2 ] ==0x96 && - info_element->data[3 ] ==0x01 ) { -if (info_element->len ==6 ) { -memcpy (network->CcxRmState, &info_element[4 ],2 ); -if (network->CcxRmState[0 ] !=0 ) - network->bCcxRmEnable = true; -else - network->bCcxRmEnable = false; - network->MBssidMask = network->CcxRmState[1 ] &0x07 ; -if (network->MBssidMask !=0 ) { - network->bMBssidValid = true; - network->MBssidMask =0xff << (network->MBssidMask); -ether_addr_copy (network->MBssid, network->bssid); - network->MBssid[5 ] &= network->MBssidMask; - }else { - network->bMBssidValid = false; - } - }else { - network->bCcxRmEnable = false; - } - } -if (info_element->len >4 && - info_element->data[0 ] ==0x00 && - info_element->data[1 ] ==0x40 && - info_element->data[2 ] ==0x96 && - info_element->data[3 ] ==0x03 ) { -if (info_element->len ==5 ) { - network->bWithCcxVerNum = true; - network->BssCcxVerNumber = info_element->data[4 ]; - }else { - network->bWithCcxVerNum = false; - network->BssCcxVerNumber =0 ; - } - } -if (info_element->len >4 && - info_element->data[0 ] ==0x00 && - info_element->data[1 ] ==0x50 && - info_element->data[2 ] ==0xf2 && - info_element->data[3 ] ==0x04 ) { -RTLLIB_DEBUG_MGMT ("MFIE_TYPE_WZC: %d bytes\n" , - info_element->len); - network->wzc_ie_len =min (info_element->len+2 , -MAX_WZC_IE_LEN ); -memcpy (network->wzc_ie, info_element, - network->wzc_ie_len); - } +rtllib_parse_mife_generic (ieee, info_element, network, + &tmp_htcap_len, + &tmp_htinfo_len);break ;case MFIE_TYPE_RSN :
Signature · 1 line
1.8.4.1
Re: [PATCH v3 04/33] staging: rtl8192e: Fix DEEP_INDENTATION warning in rtllib_parse_info_param()
Quoted 3 lines · Mateusz Kulikowski
Move
MFIE_TYPE_GENERIChandler tortllib_parse_mife_generic()function. Code was not altered significantly, therefore in some places it generatesLONG_LINEcheckpatch.pl warnings.
apart from long line it is also giving warnings for:
1) multiple blank lines
2) Blank lines aren't necessary before a close brace
3) spaces preferred around that '+'
regards
sudip
Re: [PATCH v3 04/33] staging: rtl8192e: Fix DEEP_INDENTATION warning in rtllib_parse_info_param()
Quoted 5 lines · Sudip Mukherjee
Quoted 3 lines · Mateusz Kulikowski
Move
MFIE_TYPE_GENERIChandler tortllib_parse_mife_generic()function. Code was not altered significantly, therefore in some places it generatesLONG_LINEcheckpatch.pl warnings.apart from long line it is also giving warnings for:
You're running checkpatch --strict right?
Quoted 3 lines
1) multiple blank lines
2) Blank lines aren't necessary before a close brace
3) spaces preferred around that '+'
I will fix them (as they're pretty straightforward), and will probably do --strict checks for my patches in future;
I will not fix more complex checks in such cases, because patch like this was supposed to simplify function (i.e. split it) - without changing it's code too much.
Is it ok with you?
Regards,
Mateusz
Re: [PATCH v3 04/33] staging: rtl8192e: Fix DEEP_INDENTATION warning in rtllib_parse_info_param()
Quoted 11 lines · Mateusz Kulikowski
Quoted 1 line · Sudip Mukherjee
On Sat, May 09, 2015 at 11:18:52PM +0200, Mateusz Kulikowski wrote:
You're running checkpatch --strict right?
Quoted 3 lines
1) multiple blank lines
2) Blank lines aren't necessary before a close brace
3) spaces preferred around that '+'I will fix them (as they're pretty straightforward), and will probably do --strict checks for my patches in future;
I think --strict is the suggested way of checking.
And if i remember correctly it was once discussed to make --strict the default mode, but I think that was never done.
Quoted 6 lines
I will not fix more complex checks in such cases, because patch like this was supposed to simplify function (i.e. split it) - without changing it's code too much.
Is it ok with you?
ofcourse, checkpatch also complained about many other things, but they will need separate patch to correct.
regards
sudip
Quoted 4 lines
Regards,
Mateusz
Re: [PATCH v3 04/33] staging: rtl8192e: Fix DEEP_INDENTATION warning in rtllib_parse_info_param()
In reply to Mateusz KulikowskiActually, to be honest, I would prefer if you moved things without changing it too much. I have a script to review "move code to a new function" patches but if everything moves and changes as well then it's confusing and I have to do it by hand.
regards,
dan carpenter
Re: [PATCH v3 04/33] staging: rtl8192e: Fix DEEP_INDENTATION warning in rtllib_parse_info_param()
In reply to Mateusz Kulikowskidrivers/staging/rtl8192e/rtllib_rx.c static inline void rtllib_extract_country_ie( · line 1760
Quoted 3 lines · Mateusz Kulikowski
drivers/staging/rtl8192e/rtllib_rx.c +3
-0+if (info_element->len >=4 && + info_element->data[0 ] ==0x00 && info_element->data[1 ] ==0x50 && + info_element->data[2 ] ==0xf2 && info_element->data[3 ] ==0x01 ) {
This if statement was actually easier to read in the original code:
if (info_element->len >= 4 &&
info_element->data[0] == 0x00 &&
info_element->data[1] == 0x50 &&
info_element->data[2] == 0xf2 &&
info_element->data[3] == 0x01) {Your eye can immediately spot the bits which are different on each line when they are lined up like that.
regards,
dan carpenter
Re: [PATCH v3 04/33] staging: rtl8192e: Fix DEEP_INDENTATION warning in rtllib_parse_info_param()
Quoted 8 lines · Dan Carpenter
drivers/staging/rtl8192e/rtllib_rx.c static inline void rtllib_extract_country_ie( · line 1760
Quoted 3 lines · Mateusz Kulikowski
drivers/staging/rtl8192e/rtllib_rx.c +3
-0+if (info_element->len >=4 && + info_element->data[0 ] ==0x00 && info_element->data[1 ] ==0x50 && + info_element->data[2 ] ==0xf2 && info_element->data[3 ] ==0x01 ) {This if statement was actually easier to read in the original code:
Quoted 8 lines
if (info_element->len >= 4 && info_element->data[0] == 0x00 && info_element->data[1] == 0x50 && info_element->data[2] == 0xf2 && info_element->data[3] == 0x01) {Your eye can immediately spot the bits which are different on each line when they are lined up like that.
You're right - will fix that.
Regards,
Mateusz
PATCH v3 5/33 staging: rtl8192e: Replace memcmp() with ether_addr_equal_unaligned()
In reply to Mateusz KulikowskiUse dedicated macro to compare ethernet addresses in probe_rq_parse().
--- drivers/staging/rtl8192e/rtllib_softmac.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/rtl8192e/rtllib_softmac.c +2 -1
@@ -1852,7 +1852,8 @@ static short probe_rq_parse(struct rtllib_device *ieee, struct sk_buff *skb,return -1 ;/* corrupted */ bssid_match = - (memcmp (header->addr3, ieee->current_network.bssid,ETH_ALEN ) !=0 ) && + (!ether_addr_equal_unaligned (header->addr3, + ieee->current_network.bssid)) && (!is_broadcast_ether_addr (header->addr3));if (bssid_match)return -1 ;
Signature · 1 line
1.8.4.1
PATCH v3 6/33 staging: rtl8192e: Remove rtllib_crypt.[ch]
In reply to Mateusz KulikowskiIt is neither compiled nor used in rtl8192e.
--- drivers/staging/rtl8192e/rtllib_crypt.c | 254 -------------------------------- drivers/staging/rtl8192e/rtllib_crypt.h | 34 ----- 2 files changed, 288 deletions(-) delete mode 100644 drivers/staging/rtl8192e/rtllib_crypt.c delete mode 100644 drivers/staging/rtl8192e/rtllib_crypt.h
drivers/staging/rtl8192e/rtllib_crypt.c deleted +0 -254
@@ -1,254 +0,0 @@ -/* -* Host AP crypto routines -* -* Copyright (c) 2002-2003, Jouni Malinen <[email protected]> -* Portions Copyright (C) 2004, Intel Corporation <[email protected]> -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License version 2 as -* published by the Free Software Foundation. See README and COPYING for -* more details. -* -*/ - -#include <linux/module.h> -#include <linux/init.h> -#include <linux/slab.h> -#include <linux/string.h> -#include <linux/errno.h> - -#include "rtllib.h" - -struct rtllib_crypto_alg { -struct list_head list; -struct lib80211_crypto_ops *ops; -}; - - -struct rtllib_crypto { -struct list_head algs; -spinlock_t lock; -}; - -static struct rtllib_crypto *hcrypt; - -void rtllib_crypt_deinit_entries (struct lib80211_crypt_info *info, -int force) -{ -struct list_head *ptr, *n; -struct lib80211_crypt_data *entry; - -for (ptr = info->crypt_deinit_list.next, n = ptr->next; - ptr != &info->crypt_deinit_list; ptr = n, n = ptr->next) { - entry = list_entry(ptr, struct lib80211_crypt_data, list); - -if (atomic_read (&entry->refcnt) !=0 && !force) -continue ; - -list_del (ptr); - -if (entry->ops) - entry->ops->deinit (entry->priv); -kfree (entry); - } -} -EXPORT_SYMBOL (rtllib_crypt_deinit_entries); - -void rtllib_crypt_deinit_handler (unsigned long data) -{ -struct lib80211_crypt_info *info = (struct lib80211_crypt_info *)data; -unsigned long flags; - -spin_lock_irqsave (info->lock, flags); -rtllib_crypt_deinit_entries (info,0 ); -if (!list_empty (&info->crypt_deinit_list)) { -printk (KERN_DEBUG -"%s: entries remaining in delayed crypt deletion list\n" , - info->name); - info->crypt_deinit_timer.expires = jiffies +HZ ; -add_timer (&info->crypt_deinit_timer); - } -spin_unlock_irqrestore (info->lock, flags); - -} -EXPORT_SYMBOL (rtllib_crypt_deinit_handler); - -void rtllib_crypt_delayed_deinit (struct lib80211_crypt_info *info, -struct lib80211_crypt_data **crypt) -{ -struct lib80211_crypt_data *tmp; -unsigned long flags; - -if (*crypt ==NULL ) -return ; - - tmp = *crypt; - *crypt =NULL ; - -/* must not run ops->deinit() while there may be pending encrypt or -* decrypt operations. Use a list of delayed deinits to avoid needing -* locking. -*/ - -spin_lock_irqsave (info->lock, flags); -list_add (&tmp->list, &info->crypt_deinit_list); -if (!timer_pending (&info->crypt_deinit_timer)) { - info->crypt_deinit_timer.expires = jiffies +HZ ; -add_timer (&info->crypt_deinit_timer); - } -spin_unlock_irqrestore (info->lock, flags); -} -EXPORT_SYMBOL (rtllib_crypt_delayed_deinit); - -int rtllib_register_crypto_ops (struct lib80211_crypto_ops *ops) -{ -unsigned long flags; -struct rtllib_crypto_alg *alg; - -if (hcrypt ==NULL ) -return -1 ; - - alg =kzalloc (sizeof (*alg),GFP_KERNEL ); -if (alg ==NULL ) -return -ENOMEM ; - - alg->ops = ops; - -spin_lock_irqsave (&hcrypt->lock, flags); -list_add (&alg->list, &hcrypt->algs); -spin_unlock_irqrestore (&hcrypt->lock, flags); - -printk (KERN_DEBUG "rtllib_crypt: registered algorithm '%s'\n" , - ops->name); - -return 0 ; -} -EXPORT_SYMBOL (rtllib_register_crypto_ops); - -int rtllib_unregister_crypto_ops (struct lib80211_crypto_ops *ops) -{ -unsigned long flags; -struct list_head *ptr; -struct rtllib_crypto_alg *del_alg =NULL ; - -if (hcrypt ==NULL ) -return -1 ; - -spin_lock_irqsave (&hcrypt->lock, flags); -for (ptr = hcrypt->algs.next; ptr != &hcrypt->algs; ptr = ptr->next) { -struct rtllib_crypto_alg *alg = - (struct rtllib_crypto_alg *) ptr; -if (alg->ops == ops) { -list_del (&alg->list); - del_alg = alg; -break ; - } - } -spin_unlock_irqrestore (&hcrypt->lock, flags); - -if (del_alg) { -printk (KERN_DEBUG "rtllib_crypt: unregistered algorithm '%s'\n" , - ops->name); -kfree (del_alg); - } - -return del_alg ?0 :-1 ; -} -EXPORT_SYMBOL (rtllib_unregister_crypto_ops); - - -struct lib80211_crypto_ops *rtllib_get_crypto_ops (const char *name) -{ -unsigned long flags; -struct list_head *ptr; -struct rtllib_crypto_alg *found_alg =NULL ; - -if (hcrypt ==NULL ) -return NULL ; - -spin_lock_irqsave (&hcrypt->lock, flags); -for (ptr = hcrypt->algs.next; ptr != &hcrypt->algs; ptr = ptr->next) { -struct rtllib_crypto_alg *alg = - (struct rtllib_crypto_alg *) ptr; -if (strcmp (alg->ops->name, name) ==0 ) { - found_alg = alg; -break ; - } - } -spin_unlock_irqrestore (&hcrypt->lock, flags); - -if (found_alg) -return found_alg->ops; -else -return NULL ; -} -EXPORT_SYMBOL (rtllib_get_crypto_ops); - - -static void *rtllib_crypt_null_init (int keyidx) {return (void *)1 ; } -static void rtllib_crypt_null_deinit (void *priv) {} - -static struct lib80211_crypto_ops rtllib_crypt_null = { - .name ="NULL" , - .init = rtllib_crypt_null_init, - .deinit = rtllib_crypt_null_deinit, - .encrypt_mpdu =NULL , - .decrypt_mpdu =NULL , - .encrypt_msdu =NULL , - .decrypt_msdu =NULL , - .set_key =NULL , - .get_key =NULL , - .extra_mpdu_prefix_len =0 , - .extra_mpdu_postfix_len =0 , - .extra_msdu_prefix_len =0 , - .extra_msdu_postfix_len =0 , - .owner =THIS_MODULE , -}; - - -int __init rtllib_crypto_init (void ) -{ -int ret = -ENOMEM ; - - hcrypt =kzalloc (sizeof (*hcrypt),GFP_KERNEL ); -if (!hcrypt) - goto out; - -INIT_LIST_HEAD (&hcrypt->algs); -spin_lock_init (&hcrypt->lock); - - ret =lib80211_register_crypto_ops (&rtllib_crypt_null); -if (ret <0 ) { -kfree (hcrypt); - hcrypt =NULL ; - } -out: -return ret; -} - - -void __exit rtllib_crypto_deinit(void) -{ -struct list_head *ptr, *n; - -if (hcrypt ==NULL ) -return ; - -for (ptr = hcrypt->algs.next, n = ptr->next; ptr != &hcrypt->algs; - ptr = n, n = ptr->next) { -struct rtllib_crypto_alg *alg = - (struct rtllib_crypto_alg *) ptr; -list_del (ptr); -printk (KERN_DEBUG -"rtllib_crypt: unregistered algorithm '%s' (deinit)\n" , - alg->ops->name); -kfree (alg); - } - -kfree (hcrypt); -} - -module_init (rtllib_crypto_init); -module_exit (rtllib_crypto_deinit); - -MODULE_LICENSE ("GPL" );
drivers/staging/rtl8192e/rtllib_crypt.h deleted +0 -34
@@ -1,34 +0,0 @@ -/* -* Original code based on Host AP (software wireless LAN access point) driver -* for Intersil Prism2/2.5/3. -* -* Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen -* <[email protected]> -* Copyright (c) 2002-2003, Jouni Malinen <[email protected]> -* -* Adaption to a generic IEEE 802.11 stack by James Ketrenos -* <[email protected]> -* -* Copyright (c) 2004, Intel Corporation -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License version 2 as -* published by the Free Software Foundation. See README and COPYING for -* more details. -*/ - -/* This file defines the interface to the rtllib crypto module. -*/ -#ifndef RTLLIB_CRYPT_H -#define RTLLIB_CRYPT_H - -#include <linux/skbuff.h> - -int rtllib_register_crypto_ops (struct lib80211_crypto_ops *ops); -int rtllib_unregister_crypto_ops (struct lib80211_crypto_ops *ops); -struct lib80211_crypto_ops *rtllib_get_crypto_ops (const char *name); -void rtllib_crypt_deinit_entries (struct lib80211_crypt_info *info,int force); -void rtllib_crypt_deinit_handler (unsigned long data); -void rtllib_crypt_delayed_deinit (struct lib80211_crypt_info *info, -struct lib80211_crypt_data **crypt); -#endif
Signature · 1 line
1.8.4.1
PATCH v3 7/33 staging: rtl8192e: Replace RTLLIB_DEBUG(DL_ERR) with netdev_*()
In reply to Mateusz KulikowskiReplace all RTLLIB_DEBUG(RTLLIB_DL_ERR, *) calls with netdev_err() for errors that really should be reported to user.
Use netdev_warn() for the rest.
Rephrase some of the messages to make them more readable/compact.
--- drivers/staging/rtl8192e/rtl819x_BAProc.c | 79 +++++++++++++--------------- drivers/staging/rtl8192e/rtl819x_HTProc.c | 23 ++++---- drivers/staging/rtl8192e/rtl819x_TSProc.c | 19 ++++--- drivers/staging/rtl8192e/rtllib_rx.c | 15 ++++-- drivers/staging/rtl8192e/rtllib_softmac.c | 6 +-- drivers/staging/rtl8192e/rtllib_softmac_wx.c | 6 +-- 6 files changed, 75 insertions(+), 73 deletions(-)
drivers/staging/rtl8192e/rtl819x_BAProc.c +38 -41
@@ -88,12 +88,12 @@ static struct sk_buff *rtllib_ADDBA(struct rtllib_device *ieee, u8 *Dst,"========>%s(), frame(%d) sentd to: %pM, ieee->dev:%p\n" , __func__, type, Dst, ieee->dev);if (pBA ==NULL ) { -RTLLIB_DEBUG (RTLLIB_DL_ERR ,"pBA is NULL\n" ); +netdev_warn (ieee->dev,"pBA is NULL\n" );return NULL ; } skb =dev_alloc_skb (len +sizeof (struct rtllib_hdr_3addr ));if (skb ==NULL ) { -RTLLIB_DEBUG (RTLLIB_DL_ERR ,"can't alloc skb for ADDBA_REQ\n" ); +netdev_err (ieee->dev,"Can't alloc skb for ADDBA_REQ\n" );return NULL ; }
@@ -159,7 +159,7 @@ static struct sk_buff *rtllib_DELBA(struct rtllib_device *ieee, u8 *dst, skb =dev_alloc_skb (len +sizeof (struct rtllib_hdr_3addr ));if (skb ==NULL ) { -RTLLIB_DEBUG (RTLLIB_DL_ERR ,"can't alloc skb for ADDBA_REQ\n" ); +netdev_err (ieee->dev,"Can't alloc skb for DELBA_REQ\n" );return NULL ; }
@@ -247,10 +247,9 @@ int rtllib_rx_ADDBAReq(struct rtllib_device *ieee, struct sk_buff *skb)struct rx_ts_record *pTS =NULL ;if (skb->len <sizeof (struct rtllib_hdr_3addr ) +9 ) { -RTLLIB_DEBUG (RTLLIB_DL_ERR , -" Invalid skb len in BAREQ(%d / %d)\n" , - (int )skb->len, - (int )(sizeof (struct rtllib_hdr_3addr ) +9 )); +netdev_warn (ieee->dev,"Invalid skb len in BAREQ(%d / %d)\n" , + (int )skb->len, + (int )(sizeof (struct rtllib_hdr_3addr ) +9 ));return -1 ; }
@@ -270,24 +269,24 @@ int rtllib_rx_ADDBAReq(struct rtllib_device *ieee, struct sk_buff *skb) (ieee->pHTInfo->bCurrentHTSupport == false) || (ieee->pHTInfo->IOTAction & HT_IOT_ACT_REJECT_ADDBA_REQ)) { rc =ADDBA_STATUS_REFUSED ; -RTLLIB_DEBUG (RTLLIB_DL_ERR , -"Failed to reply on ADDBA_REQ as some capability is not ready(%d, %d)\n" , - ieee->current_network.qos_data.active, - ieee->pHTInfo->bCurrentHTSupport); +netdev_warn (ieee->dev, +"Failed to reply on ADDBA_REQ as some capability is not ready(%d, %d)\n" , + ieee->current_network.qos_data.active, + ieee->pHTInfo->bCurrentHTSupport); goto OnADDBAReq_Fail; }if (!GetTs (ieee, (struct ts_common_info **)(&pTS), dst, (u8)(pBaParamSet->field.TID),RX_DIR , true)) { rc =ADDBA_STATUS_REFUSED ; -RTLLIB_DEBUG (RTLLIB_DL_ERR ,"can't get TS in %s()\n" , __func__); +netdev_warn (ieee->dev,"%s(): can't get TS\n" , __func__); goto OnADDBAReq_Fail; } pBA = &pTS->RxAdmittedBARecord;if (pBaParamSet->field.BAPolicy ==BA_POLICY_DELAYED ) { rc =ADDBA_STATUS_INVALID_PARAM ; -RTLLIB_DEBUG (RTLLIB_DL_ERR , -"BA Policy is not correct in %s()\n" , __func__); +netdev_warn (ieee->dev,"%s(): BA Policy is not correct\n" , + __func__); goto OnADDBAReq_Fail; }
@@ -334,10 +333,9 @@ int rtllib_rx_ADDBARsp(struct rtllib_device *ieee, struct sk_buff *skb)u16 ReasonCode;if (skb->len <sizeof (struct rtllib_hdr_3addr ) +9 ) { -RTLLIB_DEBUG (RTLLIB_DL_ERR , -"Invalid skb len in BARSP(%d / %d)\n" , - (int )skb->len, - (int )(sizeof (struct rtllib_hdr_3addr ) +9 )); +netdev_warn (ieee->dev,"Invalid skb len in BARSP(%d / %d)\n" , + (int )skb->len, + (int )(sizeof (struct rtllib_hdr_3addr ) +9 ));return -1 ; } rsp = (struct rtllib_hdr_3addr *)skb->data;
@@ -353,11 +351,11 @@ int rtllib_rx_ADDBARsp(struct rtllib_device *ieee, struct sk_buff *skb)if (ieee->current_network.qos_data.active ==0 || ieee->pHTInfo->bCurrentHTSupport == false || ieee->pHTInfo->bCurrentAMPDUEnable == false) { -RTLLIB_DEBUG (RTLLIB_DL_ERR , -"reject to ADDBA_RSP as some capability is not ready(%d, %d, %d)\n" , - ieee->current_network.qos_data.active, - ieee->pHTInfo->bCurrentHTSupport, - ieee->pHTInfo->bCurrentAMPDUEnable); +netdev_warn (ieee->dev, +"reject to ADDBA_RSP as some capability is not ready(%d, %d, %d)\n" , + ieee->current_network.qos_data.active, + ieee->pHTInfo->bCurrentHTSupport, + ieee->pHTInfo->bCurrentAMPDUEnable); ReasonCode =DELBA_REASON_UNKNOWN_BA ; goto OnADDBARsp_Reject; }
@@ -365,7 +363,7 @@ int rtllib_rx_ADDBARsp(struct rtllib_device *ieee, struct sk_buff *skb)if (!GetTs (ieee, (struct ts_common_info **)(&pTS), dst, (u8)(pBaParamSet->field.TID),TX_DIR , false)) { -RTLLIB_DEBUG (RTLLIB_DL_ERR ,"can't get TS in %s()\n" , __func__); +netdev_warn (ieee->dev,"%s(): can't get TS\n" , __func__); ReasonCode =DELBA_REASON_UNKNOWN_BA ; goto OnADDBARsp_Reject; }
@@ -381,8 +379,9 @@ int rtllib_rx_ADDBARsp(struct rtllib_device *ieee, struct sk_buff *skb)return -1 ; }else if ((pPendingBA->bValid == false) || (*pDialogToken != pPendingBA->DialogToken)) { -RTLLIB_DEBUG (RTLLIB_DL_ERR , -"OnADDBARsp(): Recv ADDBA Rsp. BA invalid, DELBA!\n" ); +netdev_warn (ieee->dev, +"%s(): Recv ADDBA Rsp. BA invalid, DELBA!\n" , + __func__); ReasonCode =DELBA_REASON_UNKNOWN_BA ; goto OnADDBARsp_Reject; }else {
@@ -435,19 +434,18 @@ int rtllib_rx_DELBA(struct rtllib_device *ieee, struct sk_buff *skb)u8 *dst =NULL ;if (skb->len <sizeof (struct rtllib_hdr_3addr ) +6 ) { -RTLLIB_DEBUG (RTLLIB_DL_ERR , -"Invalid skb len in DELBA(%d / %d)\n" , - (int )skb->len, - (int )(sizeof (struct rtllib_hdr_3addr ) +6 )); +netdev_warn (ieee->dev,"Invalid skb len in DELBA(%d / %d)\n" , + (int )skb->len, + (int )(sizeof (struct rtllib_hdr_3addr ) +6 ));return -1 ; }if (ieee->current_network.qos_data.active ==0 || ieee->pHTInfo->bCurrentHTSupport == false) { -RTLLIB_DEBUG (RTLLIB_DL_ERR , -"received DELBA while QOS or HT is not supported(%d, %d)\n" , - ieee->current_network. qos_data.active, - ieee->pHTInfo->bCurrentHTSupport); +netdev_warn (ieee->dev, +"received DELBA while QOS or HT is not supported(%d, %d)\n" , + ieee->current_network. qos_data.active, + ieee->pHTInfo->bCurrentHTSupport);return -1 ; }
@@ -463,10 +461,10 @@ int rtllib_rx_DELBA(struct rtllib_device *ieee, struct sk_buff *skb)if (!GetTs (ieee, (struct ts_common_info **)&pRxTs, dst, (u8 )pDelBaParamSet->field.TID,RX_DIR , false)) { -RTLLIB_DEBUG (RTLLIB_DL_ERR , -"can't get TS for RXTS in %s().dst: %pM TID:%d\n" , - __func__, dst, - (u8 )pDelBaParamSet->field.TID); +netdev_warn (ieee->dev, +"%s(): can't get TS for RXTS. dst:%pM TID:%d\n" , + __func__, dst, + (u8 )pDelBaParamSet->field.TID);return -1 ; }
@@ -476,9 +474,8 @@ int rtllib_rx_DELBA(struct rtllib_device *ieee, struct sk_buff *skb)if (!GetTs (ieee, (struct ts_common_info **)&pTxTs, dst, (u8 )pDelBaParamSet->field.TID,TX_DIR , false)) { -RTLLIB_DEBUG (RTLLIB_DL_ERR , -"can't get TS for TXTS in %s()\n" , - __func__); +netdev_warn (ieee->dev,"%s(): can't get TS for TXTS\n" , + __func__);return -1 ; }
drivers/staging/rtl8192e/rtl819x_HTProc.c +11 -12
@@ -291,8 +291,8 @@ void HTConstructCapabilityElement(struct rtllib_device *ieee, u8 *posHTCap,struct ht_capab_ele *pCapELE =NULL ;if ((posHTCap ==NULL ) || (pHT ==NULL )) { -RTLLIB_DEBUG (RTLLIB_DL_ERR , -"posHTCap or pHTInfo can't be null in HTConstructCapabilityElement()\n" ); +netdev_warn (ieee->dev, +"%s(): posHTCap and pHTInfo are null\n" , __func__);return ; }memset (posHTCap,0 , *len);
@@ -373,8 +373,9 @@ void HTConstructInfoElement(struct rtllib_device *ieee, u8 *posHTInfo,struct ht_info_ele *pHTInfoEle = (struct ht_info_ele *)posHTInfo;if ((posHTInfo ==NULL ) || (pHTInfoEle ==NULL )) { -RTLLIB_DEBUG (RTLLIB_DL_ERR , -"posHTInfo or pHTInfoEle can't be null in HTConstructInfoElement()\n" ); +netdev_warn (ieee->dev, +"%s(): posHTInfo and pHTInfoEle are null\n" , + __func__);return ; }
@@ -413,8 +414,7 @@ void HTConstructRT2RTAggElement(struct rtllib_device *ieee, u8 *posRT2RTAgg, u8 *len) {if (posRT2RTAgg ==NULL ) { -RTLLIB_DEBUG (RTLLIB_DL_ERR , -"posRT2RTAgg can't be null in HTConstructRT2RTAggElement()\n" ); +netdev_warn (ieee->dev,"%s(): posRT2RTAgg is null\n" , __func__);return ; }memset (posRT2RTAgg,0 , *len);
@@ -437,8 +437,7 @@ static u8 HT_PickMCSRate(struct rtllib_device *ieee, u8 *pOperateMCS)u8 i;if (pOperateMCS ==NULL ) { -RTLLIB_DEBUG (RTLLIB_DL_ERR , -"pOperateMCS can't be null in HT_PickMCSRate()\n" ); +netdev_warn (ieee->dev,"%s(): pOperateMCS is null\n" , __func__);return false; }
@@ -472,8 +471,9 @@ u8 HTGetHighestMCSRate(struct rtllib_device *ieee, u8 *pMCSRateSet,u8 availableMcsRate[16 ];if (pMCSRateSet ==NULL || pMCSFilter ==NULL ) { -RTLLIB_DEBUG (RTLLIB_DL_ERR , -"pMCSRateSet or pMCSFilter can't be null in HTGetHighestMCSRate()\n" ); +netdev_warn (ieee->dev, +"%s(): pMCSRateSet and pMCSFilter are null\n" , + __func__);return false; }for (i =0 ; i <16 ; i++)
@@ -538,8 +538,7 @@ void HTOnAssocRsp(struct rtllib_device *ieee)static u8 EWC11NHTInfo[] = {0x00 ,0x90 ,0x4c ,0x34 };if (pHTInfo->bCurrentHTSupport == false) { -RTLLIB_DEBUG (RTLLIB_DL_ERR , -"<=== HTOnAssocRsp(): HT_DISABLE\n" ); +netdev_warn (ieee->dev,"%s(): HT_DISABLE\n" , __func__);return ; }RTLLIB_DEBUG (RTLLIB_DL_HT ,"===> HTOnAssocRsp_wq(): HT_ENABLE\n" );
drivers/staging/rtl8192e/rtl819x_TSProc.c +9 -10
@@ -78,8 +78,9 @@ static void RxPktPendingTimeout(unsigned long data) pRxTs->RxTimeoutIndicateSeq =0xffff ;if (index >REORDER_WIN_SIZE ) { -RTLLIB_DEBUG (RTLLIB_DL_ERR , -"RxReorderIndicatePacket(): Rx Reorder struct buffer full!!\n" ); +netdev_warn (ieee->dev, +"%s(): Rx Reorder struct buffer full\n" , + __func__);spin_unlock_irqrestore (&(ieee->reorder_spinlock), flags);return ;
@@ -318,17 +319,15 @@ bool GetTs(struct rtllib_device *ieee, struct ts_common_info **ppTS,enum direction_value Dir;if (is_multicast_ether_addr (Addr)) { -RTLLIB_DEBUG (RTLLIB_DL_ERR , -"ERR! get TS for Broadcast or Multicast\n" ); +netdev_warn (ieee->dev,"Get TS for Broadcast or Multicast\n" );return false; }if (ieee->current_network.qos_data.supported ==0 ) {UP =0 ; }else {if (!IsACValid (TID )) { -RTLLIB_DEBUG (RTLLIB_DL_ERR , -"ERR! in %s(), TID(%d) is not valid\n" , - __func__,TID ); +netdev_warn (ieee->dev,"%s(): TID(%d) is not valid\n" , + __func__,TID );return false; }
@@ -413,9 +412,9 @@ bool GetTs(struct rtllib_device *ieee, struct ts_common_info **ppTS,return true; } -RTLLIB_DEBUG (RTLLIB_DL_ERR , -"ERR!!in function %s() There is not enough dir=%d(0=up down=1) TS record to be used!!" , - __func__, Dir); +netdev_warn (ieee->dev, +"There is not enough dir=%d(0=up down=1) TS record to be used!" , + Dir);return false; }
drivers/staging/rtl8192e/rtllib_rx.c +11 -4
@@ -658,7 +658,9 @@ static void RxReorderIndicatePacket(struct rtllib_device *ieee,* indicate all the packets in struct buffer and get * reorder entries. */ -RTLLIB_DEBUG (RTLLIB_DL_ERR ,"RxReorderIndicatePacket(): There is no reorder entry!! Packet is dropped!!\n" ); +netdev_err (ieee->dev, +"%s(): There is no reorder entry! Packet is dropped!\n" , + __func__); {int i;
@@ -680,7 +682,9 @@ static void RxReorderIndicatePacket(struct rtllib_device *ieee, SN_EQUAL(pReorderEntry->SeqNum, pTS->RxIndicateSeq)) {/* This protect struct buffer from overflow. */ if (index >=REORDER_WIN_SIZE ) { -RTLLIB_DEBUG (RTLLIB_DL_ERR ,"RxReorderIndicatePacket(): Buffer overflow!!\n" ); +netdev_err (ieee->dev, +"%s(): Buffer overflow!\n" , + __func__); bPktInBuf = true;break ; }
@@ -711,7 +715,9 @@ static void RxReorderIndicatePacket(struct rtllib_device *ieee, pTS->RxTimeoutIndicateSeq =0xffff ;if (index >REORDER_WIN_SIZE ) { -RTLLIB_DEBUG (RTLLIB_DL_ERR ,"RxReorderIndicatePacket(): Rx Reorder struct buffer full!!\n" ); +netdev_err (ieee->dev, +"%s(): Rx Reorder struct buffer full!\n" , + __func__);spin_unlock_irqrestore (&(ieee->reorder_spinlock), flags);return ;
@@ -915,7 +921,8 @@ static int rtllib_rx_check_duplicate(struct rtllib_device *ieee, pRxTS->RxLastFragNum = frag; pRxTS->RxLastSeqNum =WLAN_GET_SEQ_SEQ (sc); }else { -RTLLIB_DEBUG (RTLLIB_DL_ERR ,"ERR!!%s(): No TS!! Skip the check!!\n" , __func__); +netdev_warn (ieee->dev,"%s(): No TS! Skip the check!\n" , + __func__);return -1 ; } }
drivers/staging/rtl8192e/rtllib_softmac.c +3 -3
@@ -2200,8 +2200,8 @@ static void rtllib_process_action(struct rtllib_device *ieee, struct sk_buff *sku8 category =0 ;if (act ==NULL ) { -RTLLIB_DEBUG (RTLLIB_DL_ERR , -"error to get payload of action frame\n" ); +netdev_warn (ieee->dev, +"Error getting payload of action frame\n" );return ; }
@@ -3074,7 +3074,7 @@ void rtllib_softmac_init(struct rtllib_device *ieee) ieee->seq_ctrl[i] =0 ; ieee->pDot11dInfo =kzalloc (sizeof (struct rt_dot11d_info ),GFP_ATOMIC );if (!ieee->pDot11dInfo) -RTLLIB_DEBUG (RTLLIB_DL_ERR ,"can't alloc memory for DOT11D\n" ); +netdev_err (ieee->dev,"Can't alloc memory for DOT11D\n" ); ieee->LinkDetectInfo.SlotIndex =0 ; ieee->LinkDetectInfo.SlotNum =2 ; ieee->LinkDetectInfo.NumRecvBcnInPeriod =0 ;
drivers/staging/rtl8192e/rtllib_softmac_wx.c +3 -3
@@ -575,9 +575,9 @@ int rtllib_wx_set_power(struct rtllib_device *ieee,if ((!ieee->sta_wake_up) || (!ieee->enter_sleep_state) || (!ieee->ps_is_queue_empty)) { -RTLLIB_DEBUG (RTLLIB_DL_ERR , -"%s(): PS mode is tried to be use but driver missed a callback\n\n" , - __func__); +netdev_warn (ieee->dev, +"%s(): PS mode is tried to be use but driver missed a callback\n" , + __func__);return -1 ; }
Signature · 1 line
1.8.4.1
Re: [PATCH v3 07/33] staging: rtl8192e: Replace RTLLIB_DEBUG(DL_ERR) with netdev_*()
Quoted 4 lines · Mateusz Kulikowski
Replace all
RTLLIB_DEBUG(RTLLIB_DL_ERR, *)calls withnetdev_err()for errors that really should be reported to user.
Usenetdev_warn()for the rest.
Rephrase some of the messages to make them more readable/compact.
checkpatch is saying :
CHECK: Alignment should match open parenthesis #332: FILE: drivers/staging/rtl8192e/rtl819x_TSProc.c:82:
+ netdev_warn(ieee->dev,
+ "%s(): Rx Reorder struct buffer full\n",
regards
sudip
Re: [PATCH v3 07/33] staging: rtl8192e: Replace RTLLIB_DEBUG(DL_ERR) with netdev_*()
drivers/staging/rtl8192e/rtl819x_TSProc.c static void RxPktPendingTimeout(unsigned long data) · line 82
Quoted 11 lines · Sudip Mukherjee
Quoted 4 lines · Mateusz Kulikowski
Replace all
RTLLIB_DEBUG(RTLLIB_DL_ERR, *)calls withnetdev_err()for errors that really should be reported to user.
Usenetdev_warn()for the rest.
Rephrase some of the messages to make them more readable/compact.checkpatch is saying :
CHECK: Alignment should match open parenthesis #332: FILE:drivers/staging/rtl8192e/rtl819x_TSProc.c:82:drivers/staging/rtl8192e/rtl819x_TSProc.c +2
-0+ netdev_warn(ieee->dev, + "%s(): Rx Reorder struct buffer full\n",
That's clearly a typo - thanks - will fix it - checkpatch didn't noticed that in non-strict mode.
Regards,
Mateusz
PATCH v3 8/33 staging: rtl8192e: Remove RTLLIB_ERROR() and RTLLIB_WARNING()
In reply to Mateusz KulikowskiUse pr_* where needed (rtllib init code).
--- drivers/staging/rtl8192e/rtllib.h | 2 -- drivers/staging/rtl8192e/rtllib_module.c | 8 +++----- 2 files changed, 3 insertions(+), 7 deletions(-)
drivers/staging/rtl8192e/rtllib.h +0 -2
@@ -701,8 +701,6 @@ do { \#define RTLLIB_DL_TRACE (1<<29)#define RTLLIB_DL_DATA (1<<30)#define RTLLIB_DL_ERR (1<<31) -#define RTLLIB_ERROR(f, a...) pr_err("rtllib: " f, ## a) -#define RTLLIB_WARNING(f, a...) pr_warn("rtllib: " f, ## a) #define RTLLIB_DEBUG_INFO(f, a...) RTLLIB_DEBUG(RTLLIB_DL_INFO, f, ## a) #define RTLLIB_DEBUG_WX(f, a...) RTLLIB_DEBUG(RTLLIB_DL_WX, f, ## a)
drivers/staging/rtl8192e/rtllib_module.c +3 -5
@@ -107,7 +107,7 @@ struct net_device *alloc_rtllib(int sizeof_priv) dev =alloc_etherdev (sizeof (struct rtllib_device ) + sizeof_priv);if (!dev) { -RTLLIB_ERROR ("Unable to network device.\n" ); +pr_err ("Unable to allocate net_device.\n" );return NULL ; } ieee = (struct rtllib_device *)netdev_priv_rsl (dev);
@@ -116,8 +116,7 @@ struct net_device *alloc_rtllib(int sizeof_priv) err =rtllib_networks_allocate (ieee);if (err) { -RTLLIB_ERROR ("Unable to allocate beacon storage: %d\n" , - err); +pr_err ("Unable to allocate beacon storage: %d\n" , err); goto failed; }rtllib_networks_initialize (ieee);
@@ -240,8 +239,7 @@ static int __init rtllib_init(void) rtllib_debug_level = debug; rtllib_proc =proc_mkdir (DRV_NAME , init_net.proc_net);if (rtllib_proc ==NULL ) { -RTLLIB_ERROR ("Unable to create " DRV_NAME -" proc directory\n" ); +pr_err ("Unable to create " DRV_NAME " proc directory\n" );return -EIO ; } e =proc_create ("debug_level" ,S_IRUGO |S_IWUSR , rtllib_proc, &fops);
Signature · 1 line
1.8.4.1
PATCH v3 9/33 staging: rtl8192e: Remove RTLLIB_DEBUG_WX()
In reply to Mateusz KulikowskiUse netdev_dbg() instead of RTLLIB_DEBUG_WX().
Rewrite some messages to be more readable.
--- drivers/staging/rtl8192e/rtllib.h | 1 - drivers/staging/rtl8192e/rtllib_wx.c | 33 ++++++++++++++++----------------- 2 files changed, 16 insertions(+), 18 deletions(-)
drivers/staging/rtl8192e/rtllib.h +0 -1
@@ -703,7 +703,6 @@ do { \#define RTLLIB_DL_ERR (1<<31) #define RTLLIB_DEBUG_INFO(f, a...) RTLLIB_DEBUG(RTLLIB_DL_INFO, f, ## a) -#define RTLLIB_DEBUG_WX(f, a...) RTLLIB_DEBUG(RTLLIB_DL_WX, f, ## a) #define RTLLIB_DEBUG_SCAN(f, a...) RTLLIB_DEBUG(RTLLIB_DL_SCAN, f, ## a) #define RTLLIB_DEBUG_STATE(f, a...) RTLLIB_DEBUG(RTLLIB_DL_STATE, f, ## a) #define RTLLIB_DEBUG_MGMT(f, a...) RTLLIB_DEBUG(RTLLIB_DL_MGMT, f, ## a)
drivers/staging/rtl8192e/rtllib_wx.c +16 -17
@@ -266,7 +266,7 @@ int rtllib_wx_get_scan(struct rtllib_device *ieee,int i =0 ;int err =0 ; -RTLLIB_DEBUG_WX ("Getting scan\n" ); +netdev_dbg (ieee->dev,"Getting scan\n" );down (&ieee->wx_sem);spin_lock_irqsave (&ieee->lock, flags);
@@ -293,7 +293,7 @@ int rtllib_wx_get_scan(struct rtllib_device *ieee, wrqu->data.length = ev - extra; wrqu->data.flags =0 ; -RTLLIB_DEBUG_WX ("exit: %d networks returned.\n" , i); +netdev_dbg (ieee->dev,"%s(): %d networks returned.\n" , __func__, i);return err; }
@@ -311,7 +311,7 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee,int i, key, key_provided, len;struct lib80211_crypt_data **crypt; -RTLLIB_DEBUG_WX ("SET_ENCODE\n" ); +netdev_dbg (ieee->dev,"%s()\n" , __func__); key = erq->flags &IW_ENCODE_INDEX ;if (key) {
@@ -324,16 +324,16 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee, key = ieee->crypt_info.tx_keyidx; } -RTLLIB_DEBUG_WX ("Key: %d [%s]\n" , key, key_provided ? +netdev_dbg (ieee->dev,"Key: %d [%s]\n" , key, key_provided ?"provided" :"default" ); crypt = &ieee->crypt_info.crypt[key];if (erq->flags &IW_ENCODE_DISABLED ) {if (key_provided && *crypt) { -RTLLIB_DEBUG_WX ("Disabling encryption on key %d.\n" , - key); +netdev_dbg (ieee->dev, +"Disabling encryption on key %d.\n" , key);lib80211_crypt_delayed_deinit (&ieee->crypt_info, crypt); }else -RTLLIB_DEBUG_WX ("Disabling encryption.\n" ); +netdev_dbg (ieee->dev,"Disabling encryption.\n" );/* Check all the keys to see if any are still configured, * and if no key index was provided, de-init them all
@@ -405,9 +405,9 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee,if (len > erq->length)memset (sec.keys[key] + erq->length,0 , len - erq->length); -RTLLIB_DEBUG_WX ("Setting key %d to '%s' (%d:%d bytes)\n" , - key,escape_essid (sec.keys[key], len), - erq->length, len); +netdev_dbg (ieee->dev,"Setting key %d to '%s' (%d:%d bytes)\n" , + key,escape_essid (sec.keys[key], len), erq->length, + len); sec.key_sizes[key] = len; (*crypt)->ops->set_key (sec.keys[key], len,NULL , (*crypt)->priv);
@@ -436,8 +436,8 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee,/* No key data - just set the default TX key index */ if (key_provided) { -RTLLIB_DEBUG_WX ("Setting key %d to default Tx key.\n" , - key); +netdev_dbg (ieee->dev, +"Setting key %d as default Tx key.\n" , key); ieee->crypt_info.tx_keyidx = key; sec.active_key = key; sec.flags |=SEC_ACTIVE_KEY ;
@@ -449,7 +449,7 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee,WLAN_AUTH_SHARED_KEY ; sec.auth_mode = ieee->open_wep ?WLAN_AUTH_OPEN :WLAN_AUTH_SHARED_KEY ; sec.flags |=SEC_AUTH_MODE ; -RTLLIB_DEBUG_WX ("Auth: %s\n" , sec.auth_mode ==WLAN_AUTH_OPEN ? +netdev_dbg (ieee->dev,"Auth: %s\n" , sec.auth_mode ==WLAN_AUTH_OPEN ?"OPEN" :"SHARED KEY" );/* For now we just support WEP, so only set that security level...
@@ -485,7 +485,7 @@ int rtllib_wx_get_encode(struct rtllib_device *ieee,int len, key;struct lib80211_crypt_data *crypt; -RTLLIB_DEBUG_WX ("GET_ENCODE\n" ); +netdev_dbg (ieee->dev,"%s()\n" , __func__);if (ieee->iw_mode ==IW_MODE_MONITOR )return -1 ;
@@ -592,8 +592,7 @@ int rtllib_wx_set_encode_ext(struct rtllib_device *ieee, module ="rtllib_crypt_ccmp" ;break ;default : -RTLLIB_DEBUG_WX ("%s: unknown crypto alg %d\n" , - dev->name, ext->alg); +netdev_dbg (ieee->dev,"Unknown crypto alg %d\n" , ext->alg); ret = -EINVAL ; goto done; }
@@ -673,7 +672,7 @@ done:if (ieee->reset_on_keychange && ieee->iw_mode !=IW_MODE_INFRA && ieee->reset_port && ieee->reset_port (dev)) { -RTLLIB_DEBUG_WX ("%s: reset_port failed\n" , dev->name); +netdev_dbg (ieee->dev,"Port reset failed\n" );return -EINVAL ; }return ret;
Signature · 1 line
1.8.4.1
PATCH v3 10/33 staging: rtl8192e: Simplify rtllib_proces_probe_response()
In reply to Mateusz Kulikowski- Extract frame_ctl once and use it as variable.
- Drop endian conversion in is_beacon() function (used in simplified function only)
- Simplify debug messages
- Invert STYPE checks in debug messages - it is valid as only BEACON and PROBE_RESP are allowed
--- drivers/staging/rtl8192e/rtllib_rx.c | 37 +++++++++++++++--------------------- 1 file changed, 15 insertions(+), 22 deletions(-)
drivers/staging/rtl8192e/rtllib_rx.c +15 -22
@@ -2430,9 +2430,9 @@ static inline void update_network(struct rtllib_network *dst, dst->BssCcxVerNumber = src->BssCcxVerNumber; } -static inline int is_beacon (__le16 fc) +static inline int is_beacon (u16 fc) { -return (WLAN_FC_GET_STYPE (le16_to_cpu (fc)) ==RTLLIB_STYPE_BEACON ); +return (WLAN_FC_GET_STYPE (fc) ==RTLLIB_STYPE_BEACON ); }static int IsPassiveChannel (struct rtllib_device *rtllib,u8 channel)
@@ -2473,6 +2473,7 @@ static inline void rtllib_process_probe_response(short renew;struct rtllib_network *network =kzalloc (sizeof (struct rtllib_network ),GFP_ATOMIC ); +u16 frame_ctl =le16_to_cpu (beacon->header.frame_ctl);if (!network)return ;
@@ -2501,12 +2502,9 @@ static inline void rtllib_process_probe_response(if (rtllib_network_init (ieee, beacon, network, stats)) {RTLLIB_DEBUG_SCAN ("Dropped '%s' ( %pM) via %s.\n" ,escape_essid (info_element->data, - info_element->len), - beacon->header.addr3, -WLAN_FC_GET_STYPE ( -le16_to_cpu (beacon->header.frame_ctl)) == -RTLLIB_STYPE_PROBE_RESP ? -"PROBE RESPONSE" :"BEACON" ); + info_element->len), beacon->header.addr3, +is_beacon (frame_ctl) ?"BEACON" : +"PROBE RESPONSE" ); goto free_network; }
@@ -2514,8 +2512,7 @@ static inline void rtllib_process_probe_response(if (!rtllib_legal_channel (ieee, network->channel)) goto free_network; -if (WLAN_FC_GET_STYPE (le16_to_cpu (beacon->header.frame_ctl)) == -RTLLIB_STYPE_PROBE_RESP ) { +if (WLAN_FC_GET_STYPE (frame_ctl) ==RTLLIB_STYPE_PROBE_RESP ) {if (IsPassiveChannel (ieee, network->channel)) { netdev_info(ieee->dev, "GetScanInfo(): For Global Domain, filter probe response at channel(%d).\n",
@@ -2548,7 +2545,7 @@ static inline void rtllib_process_probe_response(else ieee->current_network.buseprotection = false; } -if (is_beacon (beacon->header.frame_ctl)) { +if (is_beacon (frame_ctl)) {if (ieee->state >=RTLLIB_LINKED ) ieee->LinkDetectInfo.NumRecvBcnInPeriod++; }
@@ -2585,22 +2582,18 @@ static inline void rtllib_process_probe_response(RTLLIB_DEBUG_SCAN ("Adding '%s' ( %pM) via %s.\n" ,escape_essid (network->ssid, network->ssid_len), network->bssid, -WLAN_FC_GET_STYPE ( -le16_to_cpu (beacon->header.frame_ctl)) == -RTLLIB_STYPE_PROBE_RESP ? -"PROBE RESPONSE" :"BEACON" ); +is_beacon (frame_ctl) ?"BEACON" : +"PROBE RESPONSE" );memcpy (target, network,sizeof (*target));list_add_tail (&target->list, &ieee->network_list);if (ieee->softmac_features &IEEE_SOFTMAC_ASSOCIATE )rtllib_softmac_new_net (ieee, network); }else {RTLLIB_DEBUG_SCAN ("Updating '%s' ( %pM) via %s.\n" , -escape_essid (target->ssid, - target->ssid_len), target->bssid, -WLAN_FC_GET_STYPE ( -le16_to_cpu (beacon->header.frame_ctl)) == -RTLLIB_STYPE_PROBE_RESP ? -"PROBE RESPONSE" :"BEACON" ); +escape_essid (target->ssid, target->ssid_len), + target->bssid, +is_beacon (frame_ctl) ?"BEACON" : +"PROBE RESPONSE" );/* we have an entry and we are going to update it. But this * entry may be already expired. In this case we do the same
@@ -2621,7 +2614,7 @@ static inline void rtllib_process_probe_response( }spin_unlock_irqrestore (&ieee->lock, flags); -if (is_beacon (beacon->header.frame_ctl) && +if (is_beacon (frame_ctl) &&is_same_network (&ieee->current_network, network, (network->ssid_len ?1 :0 )) && (ieee->state ==RTLLIB_LINKED )) {
Signature · 1 line
1.8.4.1
PATCH v3 11/33 staging: rtl8192e: Remove RTLLIB_DEBUG_SCAN()
In reply to Mateusz KulikowskiUse netdev_dbg() instead, remove duplicated logs.
--- drivers/staging/rtl8192e/rtllib.h | 1 - drivers/staging/rtl8192e/rtllib_rx.c | 101 ++++++++++++++++------------------- drivers/staging/rtl8192e/rtllib_wx.c | 12 +++-- 3 files changed, 54 insertions(+), 60 deletions(-)
drivers/staging/rtl8192e/rtllib.h +0 -1
@@ -703,7 +703,6 @@ do { \#define RTLLIB_DL_ERR (1<<31) #define RTLLIB_DEBUG_INFO(f, a...) RTLLIB_DEBUG(RTLLIB_DL_INFO, f, ## a) -#define RTLLIB_DEBUG_SCAN(f, a...) RTLLIB_DEBUG(RTLLIB_DL_SCAN, f, ## a) #define RTLLIB_DEBUG_STATE(f, a...) RTLLIB_DEBUG(RTLLIB_DL_STATE, f, ## a) #define RTLLIB_DEBUG_MGMT(f, a...) RTLLIB_DEBUG(RTLLIB_DL_MGMT, f, ## a) #define RTLLIB_DEBUG_FRAG(f, a...) RTLLIB_DEBUG(RTLLIB_DL_FRAG, f, ## a)
drivers/staging/rtl8192e/rtllib_rx.c +47 -54
175 lines not on this page · raw message
drivers/staging/rtl8192e/rtllib_wx.c +7 -5
@@ -281,11 +281,13 @@ int rtllib_wx_get_scan(struct rtllib_device *ieee, ev =rtl819x_translate_scan (ieee, ev, stop, network, info); else - RTLLIB_DEBUG_SCAN("Not showing network '%s ( %pM)' due to age (%lums).\n", -escape_essid (network->ssid, - network->ssid_len), - network->bssid, - (jiffies - network->last_scanned) / (HZ / 100)); + netdev_dbg(ieee->dev, +"Network '%s ( %pM)' hidden due to age (%lums).\n" , +escape_essid (network->ssid, + network->ssid_len), + network->bssid, + (jiffies - network->last_scanned) / + (HZ / 100)); }spin_unlock_irqrestore (&ieee->lock, flags);
Signature · 1 line
1.8.4.1
PATCH v3 12/33 staging: rtl8192e: Remove RTLLIB_DEBUG_(FRAG|EAP|DROP|STATE|TX|RX)()
In reply to Mateusz KulikowskiUse netdev_dbg() instead.
--- drivers/staging/rtl8192e/rtllib.h | 6 ---- drivers/staging/rtl8192e/rtllib_rx.c | 58 ++++++++++++++++++++---------------- drivers/staging/rtl8192e/rtllib_tx.c | 5 ++-- 3 files changed, 35 insertions(+), 34 deletions(-)
drivers/staging/rtl8192e/rtllib.h +0 -6
@@ -703,13 +703,7 @@ do { \#define RTLLIB_DL_ERR (1<<31) #define RTLLIB_DEBUG_INFO(f, a...) RTLLIB_DEBUG(RTLLIB_DL_INFO, f, ## a) -#define RTLLIB_DEBUG_STATE(f, a...) RTLLIB_DEBUG(RTLLIB_DL_STATE, f, ## a) #define RTLLIB_DEBUG_MGMT(f, a...) RTLLIB_DEBUG(RTLLIB_DL_MGMT, f, ## a) -#define RTLLIB_DEBUG_FRAG(f, a...) RTLLIB_DEBUG(RTLLIB_DL_FRAG, f, ## a) -#define RTLLIB_DEBUG_EAP(f, a...) RTLLIB_DEBUG(RTLLIB_DL_EAP, f, ## a) -#define RTLLIB_DEBUG_DROP(f, a...) RTLLIB_DEBUG(RTLLIB_DL_DROP, f, ## a) -#define RTLLIB_DEBUG_TX(f, a...) RTLLIB_DEBUG(RTLLIB_DL_TX, f, ## a) -#define RTLLIB_DEBUG_RX(f, a...) RTLLIB_DEBUG(RTLLIB_DL_RX, f, ## a) #define RTLLIB_DEBUG_QOS(f, a...) RTLLIB_DEBUG(RTLLIB_DL_QOS, f, ## a)#ifndef ETH_P_PAE
drivers/staging/rtl8192e/rtllib_rx.c +32 -26
118 lines not on this page · raw message
drivers/staging/rtl8192e/rtllib_tx.c +3 -2
@@ -670,8 +670,9 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev)struct eapol *eap = (struct eapol *)(skb->data +sizeof (struct ethhdr ) -SNAP_SIZE -sizeof (u16)); -RTLLIB_DEBUG_EAP ("TX: IEEE 802.11 EAPOL frame: %s\n" , -eap_get_type (eap->type)); +netdev_dbg (ieee->dev, +"TX: IEEE 802.11 EAPOL frame: %s\n" , +eap_get_type (eap->type)); }/* Advance the SKB to the start of the payload */
Signature · 1 line
1.8.4.1
PATCH v3 13/33 staging: rtl8192e: Remove RTLLIB_DEBUG_QOS()
In reply to Mateusz Kulikowski- Pass extra argument (rtllib_device) to rtllib_parse_qos_info_param_IE() and update_network()
- Replace RTLLIB_DEBUG_QOS() with netdev_dbg()
- Remove RTLLIB_DEBUG_QOS()
--- drivers/staging/rtl8192e/rtllib.h | 1 - drivers/staging/rtl8192e/rtllib_rx.c | 26 ++++++++++++++------------ 2 files changed, 14 insertions(+), 13 deletions(-)
drivers/staging/rtl8192e/rtllib.h +0 -1
@@ -704,7 +704,6 @@ do { \ #define RTLLIB_DEBUG_INFO(f, a...) RTLLIB_DEBUG(RTLLIB_DL_INFO, f, ## a) #define RTLLIB_DEBUG_MGMT(f, a...) RTLLIB_DEBUG(RTLLIB_DL_MGMT, f, ## a) -#define RTLLIB_DEBUG_QOS(f, a...) RTLLIB_DEBUG(RTLLIB_DL_QOS, f, ## a)#ifndef ETH_P_PAE #define ETH_P_PAE 0x888E/* Port Access Entity (IEEE 802.1X) */
drivers/staging/rtl8192e/rtllib_rx.c +14 -12
@@ -1661,9 +1661,10 @@ static int rtllib_qos_convert_ac_to_parameters(struct rtllib_qos_parameter_info* parameters element. check the information element length to decide * which type to read */ -static int rtllib_parse_qos_info_param_IE (struct rtllib_info_element +static int rtllib_parse_qos_info_param_IE (struct rtllib_device *ieee, +struct rtllib_info_element *info_element, -struct rtllib_network *network) +struct rtllib_network *network) {int rc =0 ;struct rtllib_qos_information_element qos_info_element;
@@ -1688,7 +1689,7 @@ static int rtllib_parse_qos_info_param_IE(struct rtllib_info_element }if (rc ==0 ) { -RTLLIB_DEBUG_QOS ("QoS is supported\n" ); +netdev_dbg (ieee->dev,"QoS is supported\n" ); network->qos_data.supported =1 ; }return rc;
@@ -1765,7 +1766,7 @@ static void rtllib_parse_mife_generic(struct rtllib_device *ieee,u16 ht_realtek_agg_len =0 ;u8 ht_realtek_agg_buf[MAX_IE_LEN ]; -if (!rtllib_parse_qos_info_param_IE (info_element, network)) +if (!rtllib_parse_qos_info_param_IE (ieee, info_element, network))return ; if (info_element->len >= 4 &&
@@ -2325,7 +2326,8 @@ static inline int is_same_network(struct rtllib_network *src, } -static inline void update_network (struct rtllib_network *dst, +static inline void update_network (struct rtllib_device *ieee, +struct rtllib_network *dst,struct rtllib_network *src) {int qos_active;
@@ -2399,12 +2401,12 @@ static inline void update_network(struct rtllib_network *dst, sizeof(struct rtllib_qos_data));if (dst->qos_data.supported ==1 ) {if (dst->ssid_len) -RTLLIB_DEBUG_QOS - ("QoS the network %s is QoS supported\n" , - dst->ssid); +netdev_dbg (ieee->dev, +"QoS the network %s is QoS supported\n" , + dst->ssid);else -RTLLIB_DEBUG_QOS - ("QoS the network is QoS supported\n" ); +netdev_dbg (ieee->dev, +"QoS the network is QoS supported\n" ); } dst->qos_data.active = qos_active; dst->qos_data.old_param_count = old_param;
@@ -2540,7 +2542,7 @@ static inline void rtllib_process_probe_response(spin_lock_irqsave (&ieee->lock, flags);if (is_same_network (&ieee->current_network, network, (network->ssid_len ?1 :0 ))) { -update_network (&ieee->current_network, network); +update_network (ieee, &ieee->current_network, network);if ((ieee->current_network.mode ==IEEE_N_24G || ieee->current_network.mode ==IEEE_G ) && ieee->current_network.berp_info_valid) {
@@ -2610,7 +2612,7 @@ static inline void rtllib_process_probe_response( network->ssid_len) == 0) && (ieee->state == RTLLIB_NOLINK)))) renew =1 ; -update_network (target, network); +update_network (ieee, target, network);if (renew && (ieee->softmac_features &IEEE_SOFTMAC_ASSOCIATE ))rtllib_softmac_new_net (ieee, network); }
Signature · 1 line
1.8.4.1
PATCH v3 14/33 staging: rtl8192e: Remove RTLLIB_DEBUG_MGMT()
In reply to Mateusz Kulikowski- Use netdev_dbg() instead of RTLLIB_DEBUG_MGMT()
- Remove RTLLIB_DEBUG_MGMT()
- Pass net_device to auth_parse(), auth_rq_parse() and assoc_rq_parse()
- Remove duplicated messages
--- drivers/staging/rtl8192e/rtllib.h | 2 - drivers/staging/rtl8192e/rtllib_rx.c | 71 +++++++++++++++---------------- drivers/staging/rtl8192e/rtllib_softmac.c | 50 ++++++++++------------ 3 files changed, 58 insertions(+), 65 deletions(-)
drivers/staging/rtl8192e/rtllib.h +0 -2
@@ -703,8 +703,6 @@ do { \#define RTLLIB_DL_ERR (1<<31) #define RTLLIB_DEBUG_INFO(f, a...) RTLLIB_DEBUG(RTLLIB_DL_INFO, f, ## a) -#define RTLLIB_DEBUG_MGMT(f, a...) RTLLIB_DEBUG(RTLLIB_DL_MGMT, f, ## a) -#ifndef ETH_P_PAE #define ETH_P_PAE 0x888E/* Port Access Entity (IEEE 802.1X) */ #define ETH_P_IP 0x0800/* Internet Protocol packet */
drivers/staging/rtl8192e/rtllib_rx.c +35 -36
154 lines not on this page · raw message
drivers/staging/rtl8192e/rtllib_softmac.c +23 -27
161 lines not on this page · raw message
Signature · 1 line
1.8.4.1
PATCH v3 15/33 staging: rtl8192e: Remove RTLLIB_DEBUG_INFO()
In reply to Mateusz KulikowskiUse pr_debug() instead.
--- drivers/staging/rtl8192e/rtllib.h | 1 - drivers/staging/rtl8192e/rtllib_module.c | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-)
drivers/staging/rtl8192e/rtllib.h +0 -1
@@ -701,7 +701,6 @@ do { \#define RTLLIB_DL_TRACE (1<<29)#define RTLLIB_DL_DATA (1<<30)#define RTLLIB_DL_ERR (1<<31) -#define RTLLIB_DEBUG_INFO(f, a...) RTLLIB_DEBUG(RTLLIB_DL_INFO, f, ## a)#ifndef ETH_P_PAE #define ETH_P_PAE 0x888E/* Port Access Entity (IEEE 802.1X) */
drivers/staging/rtl8192e/rtllib_module.c +1 -1
@@ -103,7 +103,7 @@ struct net_device *alloc_rtllib(int sizeof_priv)struct net_device *dev;int i, err; -RTLLIB_DEBUG_INFO ("Initializing...\n" ); +pr_debug ("rtllib: Initializing...\n" ); dev =alloc_etherdev (sizeof (struct rtllib_device ) + sizeof_priv);if (!dev) {
Signature · 1 line
1.8.4.1
PATCH v3 16/33 staging: rtl8192e: Remove RTLLIB_DEBUG()
In reply to Mateusz Kulikowski- Use netdev_dbg or netdev_vdbg instead of RTLLIB_DEBUG()
- Reformat some messages for better readability
- Remove RTLLIB_DEBUG messages that make no sense
--- drivers/staging/rtl8192e/rtl819x_BAProc.c | 35 +++++++++------------ drivers/staging/rtl8192e/rtl819x_HTProc.c | 21 ++++++------- drivers/staging/rtl8192e/rtl819x_TSProc.c | 35 +++++++++------------ drivers/staging/rtl8192e/rtllib.h | 5 --- drivers/staging/rtl8192e/rtllib_rx.c | 52 +++++++++++++++++-------------- 5 files changed, 67 insertions(+), 81 deletions(-)
drivers/staging/rtl8192e/rtl819x_BAProc.c +14 -21
@@ -84,9 +84,9 @@ static struct sk_buff *rtllib_ADDBA(struct rtllib_device *ieee, u8 *Dst,u8 *tag =NULL ;u16 len = ieee->tx_headroom +9 ; -RTLLIB_DEBUG (RTLLIB_DL_TRACE |RTLLIB_DL_BA , -"========>%s(), frame(%d) sentd to: %pM, ieee->dev:%p\n" , - __func__, type, Dst, ieee->dev); +netdev_dbg (ieee->dev,"%s(): frame(%d) sentd to: %pM, ieee->dev:%p\n" , + __func__, type, Dst, ieee->dev); +if (pBA ==NULL ) {netdev_warn (ieee->dev,"pBA is NULL\n" );return NULL ;
@@ -148,9 +148,8 @@ static struct sk_buff *rtllib_DELBA(struct rtllib_device *ieee, u8 *dst,u16 len =6 + ieee->tx_headroom;if (net_ratelimit ()) -RTLLIB_DEBUG (RTLLIB_DL_TRACE |RTLLIB_DL_BA , -"========>%s(), ReasonCode(%d) sentd to: %pM\n" , - __func__, ReasonCode, dst); +netdev_dbg (ieee->dev,"%s(): ReasonCode(%d) sentd to: %pM\n" , + __func__, ReasonCode, dst);memset (&DelbaParamSet,0 ,2 );
@@ -186,9 +185,6 @@ static struct sk_buff *rtllib_DELBA(struct rtllib_device *ieee, u8 *dst, tag +=2 ;RTLLIB_DEBUG_DATA (RTLLIB_DL_DATA |RTLLIB_DL_BA , skb->data, skb->len); -if (net_ratelimit ()) -RTLLIB_DEBUG (RTLLIB_DL_TRACE |RTLLIB_DL_BA ,"<=====%s()\n" , - __func__);return skb; }
@@ -203,8 +199,7 @@ static void rtllib_send_ADDBAReq(struct rtllib_device *ieee, u8 *dst,RT_TRACE (COMP_DBG ,"====>to send ADDBAREQ!!!!!\n" );softmac_mgmt_xmit (skb, ieee); }else { -RTLLIB_DEBUG (RTLLIB_DL_ERR , -"alloc skb error in function %s()\n" , __func__); +netdev_dbg (ieee->dev,"Failed to generate ADDBAReq packet.\n" ); } }
@@ -217,8 +212,7 @@ static void rtllib_send_ADDBARsp(struct rtllib_device *ieee, u8 *dst,if (skb)softmac_mgmt_xmit (skb, ieee);else -RTLLIB_DEBUG (RTLLIB_DL_ERR , -"alloc skb error in function %s()\n" , __func__); +netdev_dbg (ieee->dev,"Failed to generate ADDBARsp packet.\n" ); } static void rtllib_send_DELBA(struct rtllib_device *ieee, u8 *dst,
@@ -231,8 +225,7 @@ static void rtllib_send_DELBA(struct rtllib_device *ieee, u8 *dst,if (skb)softmac_mgmt_xmit (skb, ieee);else -RTLLIB_DEBUG (RTLLIB_DL_ERR , -"alloc skb error in function %s()\n" , __func__); +netdev_dbg (ieee->dev,"Failed to generate DELBA packet.\n" ); }int rtllib_rx_ADDBAReq (struct rtllib_device *ieee,struct sk_buff *skb)
@@ -374,20 +367,20 @@ int rtllib_rx_ADDBARsp(struct rtllib_device *ieee, struct sk_buff *skb)if (pAdmittedBA->bValid == true) { -RTLLIB_DEBUG (RTLLIB_DL_BA , -"OnADDBARsp(): Recv ADDBA Rsp. Drop because already admit it!\n" ); +netdev_dbg (ieee->dev,"%s(): ADDBA response already admitted\n" , + __func__);return -1 ; }else if ((pPendingBA->bValid == false) || (*pDialogToken != pPendingBA->DialogToken)) {netdev_warn (ieee->dev, -"%s(): Recv ADDBA Rsp. BA invalid, DELBA!\n" , +"%s(): ADDBA Rsp. BA invalid, DELBA!\n" , __func__); ReasonCode =DELBA_REASON_UNKNOWN_BA ; goto OnADDBARsp_Reject; }else { -RTLLIB_DEBUG (RTLLIB_DL_BA , -"OnADDBARsp(): Recv ADDBA Rsp. BA is admitted! Status code:%X\n" , - *pStatusCode); +netdev_dbg (ieee->dev, +"%s(): Recv ADDBA Rsp. BA is admitted! Status code:%X\n" , + __func__, *pStatusCode);DeActivateBAEntry (ieee, pPendingBA); }
drivers/staging/rtl8192e/rtl819x_HTProc.c +10 -11
@@ -217,8 +217,7 @@ static void HTIOTPeerDetermine(struct rtllib_device *ieee)else pHTInfo->IOTPeer =HT_IOT_PEER_UNKNOWN ; -RTLLIB_DEBUG (RTLLIB_DL_IOT ,"Joseph debug!! IOTPEER: %x\n" , - pHTInfo->IOTPeer); +netdev_dbg (ieee->dev,"IOTPEER: %x\n" , pHTInfo->IOTPeer); }static u8 HTIOTActIsDisableMCS14 (struct rtllib_device *ieee,u8 *PeerMacAddr)
@@ -328,9 +327,9 @@ void HTConstructCapabilityElement(struct rtllib_device *ieee, u8 *posHTCap, pCapELE->LSigTxopProtect =0 ; -RTLLIB_DEBUG (RTLLIB_DL_HT , -"TX HT cap/info ele BW=%d MaxAMSDUSize:%d DssCCk:%d\n" , - pCapELE->ChlWidth, pCapELE->MaxAMSDUSize, pCapELE->DssCCk); +netdev_dbg (ieee->dev, +"TX HT cap/info ele BW=%d MaxAMSDUSize:%d DssCCk:%d\n" , + pCapELE->ChlWidth, pCapELE->MaxAMSDUSize, pCapELE->DssCCk);if (IsEncrypt) { pCapELE->MPDUDensity =7 ;
@@ -541,7 +540,7 @@ void HTOnAssocRsp(struct rtllib_device *ieee)netdev_warn (ieee->dev,"%s(): HT_DISABLE\n" , __func__);return ; } -RTLLIB_DEBUG (RTLLIB_DL_HT ,"===> HTOnAssocRsp_wq(): HT_ENABLE\n" ); +netdev_dbg (ieee->dev,"%s(): HT_ENABLE\n" , __func__);if (!memcmp (pHTInfo->PeerHTCapBuf, EWC11NHTCap,sizeof (EWC11NHTCap))) pPeerHTCap = (struct ht_capab_ele *)(&pHTInfo->PeerHTCapBuf[4 ]);
@@ -646,7 +645,7 @@ void HTInitializeHTInfo(struct rtllib_device *ieee) {struct rt_hi_throughput *pHTInfo = ieee->pHTInfo; -RTLLIB_DEBUG (RTLLIB_DL_HT ,"===========>%s()\n" , __func__); +netdev_vdbg (ieee->dev,"%s()\n" , __func__); pHTInfo->bCurrentHTSupport = false; pHTInfo->bCurBW40MHz = false;
@@ -716,7 +715,7 @@ void HTResetSelfAndSavePeerSetting(struct rtllib_device *ieee,struct rt_hi_throughput *pHTInfo = ieee->pHTInfo;u8 bIOTAction =0 ; -RTLLIB_DEBUG (RTLLIB_DL_HT ,"==============>%s()\n" , __func__); +netdev_vdbg (ieee->dev,"%s()\n" , __func__);/* unmark bEnableHT flag here is the same reason why unmarked in * function rtllib_softmac_new_net. WB 2008.09.10 */
@@ -840,8 +839,7 @@ u8 HTCCheck(struct rtllib_device *ieee, u8 *pFrame) {if (ieee->pHTInfo->bCurrentHTSupport) {if ((IsQoSDataFrame (pFrame) &&Frame_Order (pFrame)) ==1 ) { -RTLLIB_DEBUG (RTLLIB_DL_HT , -"HT CONTROL FILED EXIST!!\n" ); +netdev_dbg (ieee->dev,"HT CONTROL FILED EXIST!!\n" );return true; } }
@@ -852,7 +850,8 @@ static void HTSetConnectBwModeCallback(struct rtllib_device *ieee) {struct rt_hi_throughput *pHTInfo = ieee->pHTInfo; -RTLLIB_DEBUG (RTLLIB_DL_HT ,"======>%s()\n" , __func__); +netdev_vdbg (ieee->dev,"%s()\n" , __func__); +if (pHTInfo->bCurBW40MHz) {if (pHTInfo->CurSTAExtChnlOffset ==HT_EXTCHNL_OFFSET_UPPER ) ieee->set_chan(ieee->dev,
drivers/staging/rtl8192e/rtl819x_TSProc.c +14 -21
@@ -58,9 +58,9 @@ static void RxPktPendingTimeout(unsigned long data) pRxTs->RxIndicateSeq = (pRxTs->RxIndicateSeq +1 ) %4096 ; -RTLLIB_DEBUG (RTLLIB_DL_REORDER , -"%s(): Indicate SeqNum: %d\n" , - __func__, pReorderEntry->SeqNum); +netdev_dbg (ieee->dev, +"%s(): Indicate SeqNum: %d\n" , + __func__, pReorderEntry->SeqNum); ieee->stats_IndicateArray[index] = pReorderEntry->prxb; index++;
@@ -105,8 +105,7 @@ static void TsAddBaProcess(unsigned long data) TxTsRecord[num]);TsInitAddBA (ieee, pTxTs,BA_POLICY_IMMEDIATE , false); -RTLLIB_DEBUG (RTLLIB_DL_BA , -"TsAddBaProcess(): ADDBA Req is started!!\n" ); +netdev_dbg (ieee->dev,"%s(): ADDBA Req is started\n" , __func__); }static void ResetTsCommonInfo (struct ts_common_info *pTsCommonInfo)
@@ -145,7 +144,7 @@ void TSInitialize(struct rtllib_device *ieee)struct rx_reorder_entry *pRxReorderEntry = ieee->RxReorderEntry;u8 count =0 ; -RTLLIB_DEBUG (RTLLIB_DL_TS ,"==========>%s()\n" , __func__); +netdev_vdbg (ieee->dev,"%s()\n" , __func__);INIT_LIST_HEAD (&ieee->Tx_TS_Admit_List);INIT_LIST_HEAD (&ieee->Tx_TS_Pending_List);INIT_LIST_HEAD (&ieee->Tx_TS_Unused_List);
@@ -356,8 +355,7 @@ bool GetTs(struct rtllib_device *ieee, struct ts_common_info **ppTS,return true;if (!bAddNewTs) { -RTLLIB_DEBUG (RTLLIB_DL_TS , -"add new TS failed(tid:%d)\n" ,UP ); +netdev_dbg (ieee->dev,"add new TS failed(tid:%d)\n" ,UP );return false; }
@@ -373,7 +371,6 @@ bool GetTs(struct rtllib_device *ieee, struct ts_common_info **ppTS, ((TxRxSelect == TX_DIR) ? DIR_DOWN : DIR_UP) : ((TxRxSelect ==TX_DIR ) ?DIR_UP :DIR_DOWN ); -RTLLIB_DEBUG (RTLLIB_DL_TS ,"to add Ts\n" );if (!list_empty (pUnusedList)) { (*ppTS) =list_entry (pUnusedList->next, struct ts_common_info, List);
@@ -392,9 +389,9 @@ bool GetTs(struct rtllib_device *ieee, struct ts_common_info **ppTS,ResetRxTsEntry (tmp); } -RTLLIB_DEBUG (RTLLIB_DL_TS , -"to init current TS, UP:%d, Dir:%d, addr: %pM ppTs=%p\n" , -UP , Dir, Addr, *ppTS); +netdev_dbg (ieee->dev, +"to init current TS, UP:%d, Dir:%d, addr: %pM ppTs=%p\n" , +UP , Dir, Addr, *ppTS); pTSInfo->field.ucTrafficType =0 ; pTSInfo->field.ucTSID =UP ; pTSInfo->field.ucDirection = Dir;
@@ -436,9 +433,8 @@ static void RemoveTsEntry(struct rtllib_device *ieee, struct ts_common_info *pTs pRxReorderEntry = (struct rx_reorder_entry *)list_entry (pRxTS->RxPendingPktList.prev, struct rx_reorder_entry, List); -RTLLIB_DEBUG (RTLLIB_DL_REORDER , -"%s(): Delete SeqNum %d!\n" , __func__, - pRxReorderEntry->SeqNum); +netdev_dbg (ieee->dev,"%s(): Delete SeqNum %d!\n" , + __func__, pRxReorderEntry->SeqNum);list_del_init (&pRxReorderEntry->List); {int i =0 ;
@@ -538,16 +534,13 @@ void TsStartAddBaProcess(struct rtllib_device *ieee, struct tx_ts_record *pTxTS) pTxTS->bAddBaReqInProgress = true;if (pTxTS->bAddBaReqDelayed) { -RTLLIB_DEBUG (RTLLIB_DL_BA , -"TsStartAddBaProcess(): Delayed Start ADDBA after 60 sec!!\n" ); +netdev_dbg (ieee->dev,"Start ADDBA after 60 sec!!\n" );mod_timer (&pTxTS->TsAddBaTimer, jiffies +msecs_to_jiffies (TS_ADDBA_DELAY )); }else { -RTLLIB_DEBUG (RTLLIB_DL_BA , -"TsStartAddBaProcess(): Immediately Start ADDBA now!!\n" ); +netdev_dbg (ieee->dev,"Immediately Start ADDBA\n" );mod_timer (&pTxTS->TsAddBaTimer, jiffies+10 ); } }else -RTLLIB_DEBUG (RTLLIB_DL_BA ,"%s()==>BA timer is already added\n" , - __func__); +netdev_dbg (ieee->dev,"BA timer is already added\n" ); }
drivers/staging/rtl8192e/rtllib.h +0 -5
@@ -643,11 +643,6 @@ enum wireless_network_type {/* debug macros */ extern u32 rtllib_debug_level; -#define RTLLIB_DEBUG(level, fmt, args...) \ -do { \ - if (rtllib_debug_level & (level)) \ - printk(KERN_DEBUG "rtllib: " fmt, ## args); \ -} while (0)#define RTLLIB_DEBUG_DATA (level, data, datalen) \ do { \
drivers/staging/rtl8192e/rtllib_rx.c +29 -23
118 lines not on this page · raw message
Signature · 1 line
1.8.4.1
PATCH v3 17/33 staging: rtl8192e: Remove RTLLIB_DEBUG_DATA()
In reply to Mateusz KulikowskiUse print_hex_dump_bytes() if VERBOSE_DEBUG is enabled.
--- drivers/staging/rtl8192e/rtl819x_BAProc.c | 20 ++++++++++++++++---- drivers/staging/rtl8192e/rtl819x_HTProc.c | 7 +++++-- drivers/staging/rtl8192e/rtllib.h | 11 ----------- drivers/staging/rtl8192e/rtllib_tx.c | 5 ++++- 4 files changed, 25 insertions(+), 18 deletions(-)
drivers/staging/rtl8192e/rtl819x_BAProc.c +16 -4
@@ -133,7 +133,10 @@ static struct sk_buff *rtllib_ADDBA(struct rtllib_device *ieee, u8 *Dst, tag +=2 ; } -RTLLIB_DEBUG_DATA (RTLLIB_DL_DATA |RTLLIB_DL_BA , skb->data, skb->len); +#ifdef VERBOSE_DEBUG +print_hex_dump_bytes ("rtllib_ADDBA(): " ,DUMP_PREFIX_NONE , skb->data, + skb->len); +#endif return skb; }
@@ -184,7 +187,10 @@ static struct sk_buff *rtllib_DELBA(struct rtllib_device *ieee, u8 *dst,put_unaligned_le16 (ReasonCode, tag); tag +=2 ; -RTLLIB_DEBUG_DATA (RTLLIB_DL_DATA |RTLLIB_DL_BA , skb->data, skb->len); +#ifdef VERBOSE_DEBUG +print_hex_dump_bytes ("rtllib_DELBA(): " ,DUMP_PREFIX_NONE , skb->data, + skb->len); +#endif return skb; }
@@ -246,7 +252,10 @@ int rtllib_rx_ADDBAReq(struct rtllib_device *ieee, struct sk_buff *skb)return -1 ; } -RTLLIB_DEBUG_DATA (RTLLIB_DL_DATA |RTLLIB_DL_BA , skb->data, skb->len); +#ifdef VERBOSE_DEBUG +print_hex_dump_bytes ("rtllib_rx_ADDBAReq(): " ,DUMP_PREFIX_NONE , + skb->data, skb->len); +#endif req = (struct rtllib_hdr_3addr *) skb->data; tag = (u8 *)req;
@@ -442,7 +451,10 @@ int rtllib_rx_DELBA(struct rtllib_device *ieee, struct sk_buff *skb)return -1 ; } -RTLLIB_DEBUG_DATA (RTLLIB_DL_DATA |RTLLIB_DL_BA , skb->data, skb->len); +#ifdef VERBOSE_DEBUG +print_hex_dump_bytes ("rtllib_rx_DELBA(): " ,DUMP_PREFIX_NONE , skb->data, + skb->len); +#endif delba = (struct rtllib_hdr_3addr *)skb->data; dst = (u8 *)(&delba->addr2[0 ]); delba +=sizeof (struct rtllib_hdr_3addr );
drivers/staging/rtl8192e/rtl819x_HTProc.c +5 -2
@@ -553,8 +553,11 @@ void HTOnAssocRsp(struct rtllib_device *ieee)else pPeerHTInfo = (struct ht_info_ele *)(pHTInfo->PeerHTInfoBuf); -RTLLIB_DEBUG_DATA (RTLLIB_DL_DATA |RTLLIB_DL_HT , pPeerHTCap, -sizeof (struct ht_capab_ele )); + +#ifdef VERBOSE_DEBUG +print_hex_dump_bytes ("HTOnAssocRsp(): " ,DUMP_PREFIX_NONE , + pPeerHTCap,sizeof (struct ht_capab_ele )); +#endif HTSetConnectBwMode (ieee, (enum ht_channel_width )(pPeerHTCap->ChlWidth), (enum ht_extchnl_offset )(pPeerHTInfo->ExtChlOffset)); pHTInfo->bCurTxBW40MHz = ((pPeerHTInfo->RecommemdedTxWidth == 1) ?
drivers/staging/rtl8192e/rtllib.h +0 -11
@@ -642,17 +642,6 @@ enum wireless_network_type {#define OUI_SUBTYPE_QOS_CAPABI 5/* debug macros */ -extern u32 rtllib_debug_level; - -#define RTLLIB_DEBUG_DATA (level, data, datalen) \ - do { \ - if ((rtllib_debug_level & (level)) == (level)) { \ - printk(KERN_DEBUG "rtllib: %s()\n", __func__); \ - print_hex_dump_bytes(KERN_DEBUG, DUMP_PREFIX_NONE, \ - data, datalen); \ - } \ - } while (0) -/* To use the debug system; * * If you are defining a new debug classification, simply add it to the #define
drivers/staging/rtl8192e/rtllib_tx.c +4 -1
@@ -260,7 +260,10 @@ static int rtllib_classify(struct sk_buff *skb, u8 bIsAmsdu)if (eth->h_proto !=htons (ETH_P_IP ))return 0 ; -RTLLIB_DEBUG_DATA (RTLLIB_DL_DATA , skb->data, skb->len); +#ifdef VERBOSE_DEBUG +print_hex_dump_bytes ("rtllib_classify(): " ,DUMP_PREFIX_NONE , skb->data, + skb->len); +#endif ip =ip_hdr (skb);switch (ip->tos &0xfc ) {case 0x20 :
Signature · 1 line
1.8.4.1
PATCH v3 18/33 staging: rtl8192e: Remove remains of RTLLIB_*_DEBUG() (including proc entry)
In reply to Mateusz KulikowskiRemove rest of rtllib "debug" system - it is no longer used - proper netdev_* functions are used in most cases.
--- drivers/staging/rtl8192e/rtllib.h | 45 -------------------------- drivers/staging/rtl8192e/rtllib_module.c | 55 -------------------------------- 2 files changed, 100 deletions(-)
drivers/staging/rtl8192e/rtllib.h +0 -45
@@ -641,51 +641,6 @@ enum wireless_network_type {#define OUI_SUBTYPE_WMM_PARAM 1#define OUI_SUBTYPE_QOS_CAPABI 5 -/* debug macros */ -/* To use the debug system; -* -* If you are defining a new debug classification, simply add it to the #define -* list here in the form of: -* -* #define RTLLIB_DL_xxxx VALUE -* -* shifting value to the left one bit from the previous entry. xxxx should be -* the name of the classification (for example, WEP) -* -* You then need to either add a RTLLIB_xxxx_DEBUG() macro definition for your -* classification, or use RTLLIB_DEBUG(RTLLIB_DL_xxxx, ...) whenever you want -* to send output to that classification. -* -* To add your debug level to the list of levels seen when you perform -* -* % cat /proc/net/ipw/debug_level -* -* you simply need to add your entry to the ipw_debug_levels array. -*/ - -#define RTLLIB_DL_INFO (1<<0) -#define RTLLIB_DL_WX (1<<1) -#define RTLLIB_DL_SCAN (1<<2) -#define RTLLIB_DL_STATE (1<<3) -#define RTLLIB_DL_MGMT (1<<4) -#define RTLLIB_DL_FRAG (1<<5) -#define RTLLIB_DL_EAP (1<<6) -#define RTLLIB_DL_DROP (1<<7) - -#define RTLLIB_DL_TX (1<<8) -#define RTLLIB_DL_RX (1<<9) - -#define RTLLIB_DL_HT (1<<10) -#define RTLLIB_DL_BA (1<<11) -#define RTLLIB_DL_TS (1<<12) -#define RTLLIB_DL_QOS (1<<13) -#define RTLLIB_DL_REORDER (1<<14) -#define RTLLIB_DL_IOT (1<<15) -#define RTLLIB_DL_IPS (1<<16) -#define RTLLIB_DL_TRACE (1<<29) -#define RTLLIB_DL_DATA (1<<30) -#define RTLLIB_DL_ERR (1<<31) -#ifndef ETH_P_PAE #define ETH_P_PAE 0x888E/* Port Access Entity (IEEE 802.1X) */ #define ETH_P_IP 0x0800/* Internet Protocol packet */
drivers/staging/rtl8192e/rtllib_module.c +0 -55
68 lines not on this page · raw message
Signature · 1 line
1.8.4.1
PATCH v3 19/33 staging: rtl8192e: Remove assert() macro
In reply to Mateusz KulikowskiAssert macro printed warning message (and was used once). Remove it, and add netdev_warn() in place where it was called.
--- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 5 +++-- drivers/staging/rtl8192e/rtllib_debug.h | 8 -------- 2 files changed, 3 insertions(+), 10 deletions(-)
drivers/staging/rtl8192e/rtl8192e/rtl_core.c +3 -2
@@ -1885,8 +1885,9 @@ void rtl8192_hard_data_xmit(struct sk_buff *skb, struct net_device *dev,return ; } -assert (queue_index !=TXCMD_QUEUE ); - +if (queue_index !=TXCMD_QUEUE ) +netdev_warn (dev,"%s(): queue index != TXCMD_QUEUE\n" , + __func__);memcpy ((unsigned char *)(skb->cb), &dev,sizeof (dev));skb_push (skb, priv->rtllib->tx_headroom);
drivers/staging/rtl8192e/rtllib_debug.h +0 -8
@@ -76,12 +76,4 @@ do { \ printk(KERN_DEBUG DRV_NAME ":" x "\n", ##args);\ } while (0) -#define assert (expr) \ -do { \ - if (!(expr)) { \ - pr_info("Assertion failed! %s,%s,%s,line=%d\n", \ - #expr, __FILE__, __func__, __LINE__); \ - } \ -} while (0) -#endif
Signature · 1 line
1.8.4.1
PATCH v3 20/33 staging: rtl8192e: Fix PREFER_PR_LEVEL warnings
In reply to Mateusz KulikowskiFix most of remaining PREFER_PR_LEVEL warnings in rtllib. Replace printk() with netdev_* if possible, pr_* in other cases. All pr_* use __func__ to easily trace message back to rtllib
--- drivers/staging/rtl8192e/rtllib_crypt_ccmp.c | 2 +- drivers/staging/rtl8192e/rtllib_crypt_tkip.c | 63 ++++++++++++---------------- drivers/staging/rtl8192e/rtllib_rx.c | 5 ++- 3 files changed, 31 insertions(+), 39 deletions(-)
drivers/staging/rtl8192e/rtllib_crypt_ccmp.c +1 -1
@@ -69,7 +69,7 @@ static void *rtllib_ccmp_init(int key_idx) priv->tfm = (void *)crypto_alloc_cipher ("aes" ,0 ,CRYPTO_ALG_ASYNC );if (IS_ERR (priv->tfm)) { -pr_debug ("rtllib_crypt_ccmp: could not allocate crypto API aes\n" ); +pr_debug ("%s(): could not allocate crypto API aes\n" , __func__); priv->tfm =NULL ; goto fail; }
drivers/staging/rtl8192e/rtllib_crypt_tkip.c +27 -36
132 lines not on this page · raw message
drivers/staging/rtl8192e/rtllib_rx.c +3 -2
@@ -346,8 +346,9 @@ rtllib_rx_frame_decrypt_msdu(struct rtllib_device *ieee, struct sk_buff *skb, res = crypt->ops->decrypt_msdu (skb, keyidx, hdrlen, crypt->priv);atomic_dec (&crypt->refcnt);if (res <0 ) { -printk (KERN_DEBUG "%s: MSDU decryption/MIC verification failed (SA= %pM keyidx=%d)\n" , - ieee->dev->name, hdr->addr2, keyidx); +netdev_dbg (ieee->dev, +"MSDU decryption/MIC verification failed (SA= %pM keyidx=%d)\n" , + hdr->addr2, keyidx);return -1 ; }
Signature · 1 line
1.8.4.1
Re: [PATCH v3 20/33] staging: rtl8192e: Fix PREFER_PR_LEVEL warnings
Quoted 3 lines · Mateusz Kulikowski
Fix most of remaining
PREFER_PR_LEVELwarnings in rtllib. Replaceprintk()with netdev_* if possible, pr_* in other cases. All pr_* use__func__to easily trace message back to rtllib
It's more common to use %s: and not %s():
but it's generally even better not to use these
at all and use dynamic_debug to add the function
name when desired.
drivers/staging/rtl8192e/rtllib_crypt_ccmp.c
Quoted 1 line
drivers/staging/rtl8192e/rtllib_crypt_ccmp.c +0
-0
[]
drivers/staging/rtl8192e/rtllib_crypt_tkip.c
Quoted 11 lines
drivers/staging/rtl8192e/rtllib_crypt_ccmp.c +1
-1@@ -69,7 +69,7 @@ static void *rtllib_ccmp_init(int key_idx) priv->tfm = (void *)crypto_alloc_cipher ("aes" ,0 ,CRYPTO_ALG_ASYNC );if (IS_ERR (priv->tfm)) { -pr_debug ("rtllib_crypt_ccmp: could not allocate crypto API aes\n" ); +pr_debug ("%s(): could not allocate crypto API aes\n" , __func__); priv->tfm =NULL ; goto fail; }drivers/staging/rtl8192e/rtllib_crypt_tkip.c +0
-0
[]
drivers/staging/rtl8192e/rtllib_crypt_tkip.c static int rtllib_michael_mic_verify(struct sk_buff *skb, int keyidx, · line 628
Quoted 13 lines
drivers/staging/rtl8192e/rtllib_crypt_tkip.c +3
-6@@ -630,12 +623,10 @@ static int rtllib_michael_mic_verify(struct sk_buff *skb, int keyidx,struct rtllib_hdr_4addr *hdr; hdr = (struct rtllib_hdr_4addr *) skb->data; -printk (KERN_DEBUG -"%s: Michael MIC verification failed for MSDU from %pM keyidx=%d\n" , - skb->dev ? skb->dev->name :"N/A" , hdr->addr2, - keyidx); -printk (KERN_DEBUG "%d\n" , -memcmp (mic, skb->data + skb->len -8 ,8 ) !=0 ); +pr_debug ("%s: Michael MIC verification failed for MSDU from %pM keyidx=%d\n" , + skb->dev ? skb->dev->name :"N/A" , hdr->addr2, + keyidx);
Not that it's necessary, but are this and below
missing __func__?
drivers/staging/rtl8192e/rtllib_rx.c
Quoted 1 line
drivers/staging/rtl8192e/rtllib_rx.c +0
-0
[]
Quoted 12 lines
drivers/staging/rtl8192e/rtllib_rx.c +3
-2@@ -346,8 +346,9 @@ rtllib_rx_frame_decrypt_msdu(struct rtllib_device *ieee, struct sk_buff *skb, res = crypt->ops->decrypt_msdu (skb, keyidx, hdrlen, crypt->priv);atomic_dec (&crypt->refcnt);if (res <0 ) { -printk (KERN_DEBUG "%s: MSDU decryption/MIC verification failed (SA= %pM keyidx=%d)\n" , - ieee->dev->name, hdr->addr2, keyidx); +netdev_dbg (ieee->dev, +"MSDU decryption/MIC verification failed (SA= %pM keyidx=%d)\n" , + hdr->addr2, keyidx);return -1 ; }
Re: [PATCH v3 20/33] staging: rtl8192e: Fix PREFER_PR_LEVEL warnings
Quoted 9 lines · Joe Perches
Quoted 3 lines · Mateusz Kulikowski
Fix most of remaining
PREFER_PR_LEVELwarnings in rtllib. Replaceprintk()with netdev_* if possible, pr_* in other cases. All pr_* use__func__to easily trace message back to rtllibIt's more common to use %s: and not %s():
but it's generally even better not to use these
at all and usedynamic_debugto add the function
name when desired.
I wasn't aware of that - thanks for the tip.
In that case I'll throw away function names in all _dbg messages for v4.
Quoted 1 line
Quoted 1 line
drivers/staging/rtl8192e/rtllib_crypt_ccmp.c +0
-0
(...)
Quoted 5 lines
Quoted 5 lines
drivers/staging/rtl8192e/rtllib_crypt_ccmp.c +0
-4hdr = (struct rtllib_hdr_4addr *) skb->data; -printk (KERN_DEBUG -"%s: Michael MIC verification failed for MSDU from %pM keyidx=%d\n" , - skb->dev ? skb->dev->name :"N/A" , hdr->addr2, - keyidx);
Quoted 8 lines
drivers/staging/rtl8192e/rtllib_crypt_ccmp.c
Quoted 5 lines
drivers/staging/rtl8192e/rtllib_crypt_ccmp.c +3
-2-printk (KERN_DEBUG "%d\n" , -memcmp (mic, skb->data + skb->len -8 ,8 ) !=0 ); +pr_debug ("%s: Michael MIC verification failed for MSDU from %pM keyidx=%d\n" , + skb->dev ? skb->dev->name :"N/A" , hdr->addr2, + keyidx);Not that it's necessary, but are this and below
missing__func__?
It prints device name in an awkward way - I must missed this one during review as it is the place where netdev_dbg() should be used.
Will do it the right way in v4.
Regards,
Mateusz
PATCH v3 21/33 staging: rtl8192e: Fix LONG_LINE warnings
In reply to Mateusz KulikowskiFix most of simple LONG_LINE warnings. None of the changes should affect behaviour of code, so several modifications are included in this patch:
- Code is reindented where needed
- Local variable names are compacted (priv -> p)
- Unnecessary casts are removed
- Nested ifs are replaced with logical and
- a = b = c = d expressions are split
- Replace if/then series with clamp_t()
- Removed unneeded scopes
--- drivers/staging/rtl8192e/dot11d.h | 4 +- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 22 +-- .../staging/rtl8192e/rtl8192e/r8192E_firmware.c | 29 ++-- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 4 +- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 3 +- drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 191 +++++++++++++-------- drivers/staging/rtl8192e/rtl8192e/rtl_wx.c | 3 +- drivers/staging/rtl8192e/rtl819x_HTProc.c | 3 +- drivers/staging/rtl8192e/rtl819x_TSProc.c | 21 ++- drivers/staging/rtl8192e/rtllib_rx.c | 171 +++++++++++------- drivers/staging/rtl8192e/rtllib_softmac.c | 36 ++-- drivers/staging/rtl8192e/rtllib_tx.c | 41 ++--- 12 files changed, 314 insertions(+), 214 deletions(-)
drivers/staging/rtl8192e/dot11d.h +2 -2
@@ -74,8 +74,8 @@ static inline void cpMacAddr(unsigned char *des, unsigned char *src) (GET_DOT11D_INFO(__pIeeeDev)->CountryIeLen > 0)#define IS_EQUAL_CIE_SRC (__pIeeeDev, __pTa) \ - ether_addr_equal_unaligned(GET_DOT11D_INFO(__pIeeeDev)->CountryIeSrcAddr, \ - __pTa) + ether_addr_equal_unaligned( \ + GET_DOT11D_INFO(__pIeeeDev)->CountryIeSrcAddr, __pTa)#define UPDATE_CIE_SRC (__pIeeeDev, __pTa) \ cpMacAddr(GET_DOT11D_INFO(__pIeeeDev)->CountryIeSrcAddr, __pTa)
drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +11 -11
@@ -30,7 +30,8 @@#include "rtl_dm.h" #include "rtl_wx.h" -static int WDCAPARA_ADD [] = {EDCAPARA_BE ,EDCAPARA_BK ,EDCAPARA_VI ,EDCAPARA_VO }; +static int WDCAPARA_ADD [] = {EDCAPARA_BE ,EDCAPARA_BK ,EDCAPARA_VI , +EDCAPARA_VO };void rtl8192e_start_beacon (struct net_device *dev) {
@@ -187,22 +188,21 @@ void rtl8192e_SetHwReg(struct net_device *dev, u8 variable, u8 *val)u8 u1bAIFS;u32 u4bAcParam;u8 mode = priv->rtllib->mode; -struct rtllib_qos_parameters *qos_parameters = +struct rtllib_qos_parameters *qop = &priv->rtllib->current_network.qos_data.parameters; - u1bAIFS = qos_parameters->aifs[pAcParam] * + u1bAIFS = qop->aifs[pAcParam] * ((mode&(IEEE_G |IEEE_N_24G )) ?9 :20 ) + aSifsTime;dm_init_edca_turbo (dev); - u4bAcParam = (((le16_to_cpu ( - qos_parameters->tx_op_limit[pAcParam])) << -AC_PARAM_TXOP_LIMIT_OFFSET ) | - ((le16_to_cpu (qos_parameters->cw_max[pAcParam])) << -AC_PARAM_ECW_MAX_OFFSET ) | - ((le16_to_cpu (qos_parameters->cw_min[pAcParam])) << -AC_PARAM_ECW_MIN_OFFSET ) | - (((u32 )u1bAIFS) <<AC_PARAM_AIFS_OFFSET )); + u4bAcParam = (le16_to_cpu (qop->tx_op_limit[pAcParam]) << +AC_PARAM_TXOP_LIMIT_OFFSET ) | + ((le16_to_cpu (qop->cw_max[pAcParam])) << +AC_PARAM_ECW_MAX_OFFSET ) | + ((le16_to_cpu (qop->cw_min[pAcParam])) << +AC_PARAM_ECW_MIN_OFFSET ) | + (((u32 )u1bAIFS) <<AC_PARAM_AIFS_OFFSET );RT_TRACE (COMP_DBG ,"%s():HW_VAR_AC_PARAM eACI:%x:%x\n" , __func__, eACI, u4bAcParam);
drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c +14 -15
@@ -230,7 +230,7 @@ bool init_firmware(struct net_device *dev)u32 file_length =0 ;u8 *mapped_file =NULL ; -u8 init_step =0 ; +u8 i =0 ;enum opt_rst_type rst_opt =OPT_SYSTEM_RESET ;enum firmware_init_step starting_state =FW_INIT_STEP0_BOOT ;
@@ -250,10 +250,9 @@ bool init_firmware(struct net_device *dev) "PlatformInitFirmware: undefined firmware state\n"); } -for (init_step = starting_state; init_step <=FW_INIT_STEP2_DATA ; - init_step++) { +for (i = starting_state; i <=FW_INIT_STEP2_DATA ; i++) {if (rst_opt ==OPT_SYSTEM_RESET ) { -if (pfirmware->firmware_buf_size[init_step] ==0 ) { +if (pfirmware->firmware_buf_size[i] ==0 ) {const char *fw_name[3 ] = {RTL8192E_BOOT_IMG_FW , RTL8192E_MAIN_IMG_FW,
@@ -263,7 +262,7 @@ bool init_firmware(struct net_device *dev)int rc; rc =request_firmware (&fw_entry, - fw_name[init_step], + fw_name[i], &priv->pdev->dev);if (rc <0 ) { RT_TRACE(COMP_FIRMWARE,
@@ -271,24 +270,24 @@ bool init_firmware(struct net_device *dev) goto download_firmware_fail; }if (fw_entry->size > -sizeof (pfirmware->firmware_buf[init_step])) { +sizeof (pfirmware->firmware_buf[i])) {RT_TRACE (COMP_FIRMWARE ,"img file size exceed the container struct buffer fail!\n" ); goto download_firmware_fail; } -if (init_step !=FW_INIT_STEP1_MAIN ) { -memcpy (pfirmware->firmware_buf[init_step], +if (i !=FW_INIT_STEP1_MAIN ) { +memcpy (pfirmware->firmware_buf[i], fw_entry->data, fw_entry->size); - pfirmware->firmware_buf_size[init_step] = + pfirmware->firmware_buf_size[i] = fw_entry->size; }else { -memset (pfirmware->firmware_buf[init_step], +memset (pfirmware->firmware_buf[i],0 ,128 ); -memcpy (&pfirmware->firmware_buf[init_step][128 ], +memcpy (&pfirmware->firmware_buf[i][128 ], fw_entry->data, fw_entry->size); - pfirmware->firmware_buf_size[init_step] = + pfirmware->firmware_buf_size[i] = fw_entry->size +128 ; }
@@ -297,14 +296,14 @@ bool init_firmware(struct net_device *dev) } } - mapped_file = pfirmware->firmware_buf[init_step]; - file_length = pfirmware->firmware_buf_size[init_step]; + mapped_file = pfirmware->firmware_buf[i]; + file_length = pfirmware->firmware_buf_size[i]; rt_status =fw_download_code (dev, mapped_file, file_length);if (!rt_status) goto download_firmware_fail; -if (!firmware_check_ready (dev, init_step)) +if (!firmware_check_ready (dev, i)) goto download_firmware_fail; }
drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +2 -2
@@ -628,8 +628,8 @@ void rtl8192_phy_getTxPower(struct net_device *dev) priv->DefaultInitialGain[3 ] =read_nic_byte (dev, rOFDM0_XDAGCCore1);RT_TRACE (COMP_INIT ,"Default initial gain (c50=0x%x, c58=0x%x, c60=0x%x, c68=0x%x)\n" , - priv->DefaultInitialGain[0 ], priv->DefaultInitialGain[1 ], - priv->DefaultInitialGain[2 ], priv->DefaultInitialGain[3 ]); + priv->DefaultInitialGain[0 ], priv->DefaultInitialGain[1 ], + priv->DefaultInitialGain[2 ], priv->DefaultInitialGain[3 ]); priv->framesync =read_nic_byte (dev, rOFDM0_RxDetector3); priv->framesyncC34 =read_nic_dword (dev, rOFDM0_RxDetector2);
drivers/staging/rtl8192e/rtl8192e/rtl_core.c +1 -2
@@ -2068,8 +2068,7 @@ static short rtl8192_alloc_rx_desc_ring(struct net_device *dev)int i, rx_queue_idx;for (rx_queue_idx =0 ; rx_queue_idx <MAX_RX_QUEUE ; rx_queue_idx++) { - priv->rx_ring[rx_queue_idx] = -pci_zalloc_consistent (priv->pdev, + priv->rx_ring[rx_queue_idx] =pci_zalloc_consistent (priv->pdev,sizeof (*priv->rx_ring[rx_queue_idx]) * priv->rxringcount, &priv->rx_ring_dma[rx_queue_idx]); if (!priv->rx_ring[rx_queue_idx] ||
drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +116 -75
377 lines not on this page · raw message
drivers/staging/rtl8192e/rtl8192e/rtl_wx.c +2 -1
@@ -613,7 +613,8 @@ static int r8192_wx_set_nick(struct net_device *dev,if (wrqu->data.length >IW_ESSID_MAX_SIZE )return -E2BIG ;down (&priv->wx_sem); - wrqu->data.length =min_t (size_t, wrqu->data.length,sizeof (priv->nick)); + wrqu->data.length =min_t (size_t, wrqu->data.length, +sizeof (priv->nick));memset (priv->nick,0 ,sizeof (priv->nick));memcpy (priv->nick, extra, wrqu->data.length);up (&priv->wx_sem);
drivers/staging/rtl8192e/rtl819x_HTProc.c +2 -1
@@ -236,7 +236,8 @@ static bool HTIOTActIsDisableMCSTwoSpatialStream(struct rtllib_device *ieee)return false; } -static u8 HTIOTActIsDisableEDCATurbo (struct rtllib_device *ieee,u8 *PeerMacAddr) +static u8 HTIOTActIsDisableEDCATurbo (struct rtllib_device *ieee, +u8 *PeerMacAddr) {return false; }
drivers/staging/rtl8192e/rtl819x_TSProc.c +12 -9
@@ -49,8 +49,10 @@ static void RxPktPendingTimeout(unsigned long data)if (index ==0 ) pRxTs->RxIndicateSeq = pReorderEntry->SeqNum; -if (SN_LESS (pReorderEntry->SeqNum, pRxTs->RxIndicateSeq) || -SN_EQUAL (pReorderEntry->SeqNum, pRxTs->RxIndicateSeq)) { +if (SN_LESS (pReorderEntry->SeqNum, + pRxTs->RxIndicateSeq) || +SN_EQUAL (pReorderEntry->SeqNum, + pRxTs->RxIndicateSeq)) {list_del_init (&pReorderEntry->List); if (SN_EQUAL(pReorderEntry->SeqNum,
@@ -92,7 +94,8 @@ static void RxPktPendingTimeout(unsigned long data)if (bPktInBuf && (pRxTs->RxTimeoutIndicateSeq ==0xffff )) { pRxTs->RxTimeoutIndicateSeq = pRxTs->RxIndicateSeq;mod_timer (&pRxTs->RxPktPendingTimer, jiffies + -msecs_to_jiffies (ieee->pHTInfo->RxReorderPendingTime)); +msecs_to_jiffies (ieee->pHTInfo->RxReorderPendingTime) + ); }spin_unlock_irqrestore (&(ieee->reorder_spinlock), flags); }
@@ -269,10 +272,10 @@ static struct ts_common_info *SearchAdmitTRStream(struct rtllib_device *ieee,if (!search_dir[dir])continue ;list_for_each_entry (pRet, psearch_list, List) { -if (memcmp (pRet->Addr, Addr,6 ) ==0 ) -if (pRet->TSpec.f.TSInfo.field.ucTSID ==TID ) -if (pRet->TSpec.f.TSInfo.field.ucDirection == dir) -break ; +if (memcmp (pRet->Addr, Addr,6 ) ==0 && + pRet->TSpec.f.TSInfo.field.ucTSID ==TID && + pRet->TSpec.f.TSInfo.field.ucDirection == dir) +break ; }if (&pRet->List != psearch_list)
@@ -415,8 +418,8 @@ bool GetTs(struct rtllib_device *ieee, struct ts_common_info **ppTS,return false; } -static void RemoveTsEntry (struct rtllib_device *ieee,struct ts_common_info *pTs, -enum tr_select TxRxSelect) +static void RemoveTsEntry (struct rtllib_device *ieee, +struct ts_common_info *pTs,enum tr_select TxRxSelect) {del_timer_sync (&pTs->SetupTimer);del_timer_sync (&pTs->InactTimer);
drivers/staging/rtl8192e/rtllib_rx.c +109 -62
415 lines not on this page · raw message
drivers/staging/rtl8192e/rtllib_softmac.c +22 -14
@@ -272,9 +272,10 @@ inline void softmac_mgmt_xmit(struct sk_buff *skb, struct rtllib_device *ieee) ieee->seq_ctrl[0 ]++;/* check whether the managed packet queued greater than 5 */ -if (!ieee->check_nic_enough_desc (ieee->dev, tcb_desc->queue_index) || - (skb_queue_len (&ieee->skb_waitQ[tcb_desc->queue_index]) !=0 ) || - (ieee->queue_stop)) { +if (!ieee->check_nic_enough_desc (ieee->dev, + tcb_desc->queue_index) || +skb_queue_len (&ieee->skb_waitQ[tcb_desc->queue_index]) || + ieee->queue_stop) {/* insert the skb packet to the management queue * * as for the completion function, it does not need
@@ -1482,7 +1483,8 @@ static void rtllib_associate_step1(struct rtllib_device *ieee, u8 *daddr) } } -static void rtllib_auth_challenge (struct rtllib_device *ieee,u8 *challenge,int chlen) +static void rtllib_auth_challenge (struct rtllib_device *ieee,u8 *challenge, +int chlen) {u8 *c;struct sk_buff *skb;
@@ -1739,7 +1741,7 @@ inline void rtllib_softmac_new_net(struct rtllib_device *ieee,/* Join the network for the first time */ ieee->AsocRetryCount =0 ;if ((ieee->current_network.qos_data.supported ==1 ) && - ieee->current_network.bssht.bdSupportHT) + ieee->current_network.bssht.bdSupportHT)HTResetSelfAndSavePeerSetting (ieee, &(ieee->current_network));else
@@ -1754,14 +1756,19 @@ inline void rtllib_softmac_new_net(struct rtllib_device *ieee, &ieee->associate_procedure_wq, 0); }else {if (rtllib_is_54g (&ieee->current_network) && - (ieee->modulation &RTLLIB_OFDM_MODULATION )) { + (ieee->modulation & +RTLLIB_OFDM_MODULATION )) { ieee->rate =108 ; - ieee->SetWirelessMode (ieee->dev,IEEE_G ); -netdev_info (ieee->dev,"Using G rates\n" ); + ieee->SetWirelessMode (ieee->dev, +IEEE_G ); +netdev_info (ieee->dev, +"Using G rates\n" ); }else { ieee->rate =22 ; - ieee->SetWirelessMode (ieee->dev,IEEE_B ); -netdev_info (ieee->dev,"Using B rates\n" ); + ieee->SetWirelessMode (ieee->dev, +IEEE_B ); +netdev_info (ieee->dev, +"Using B rates\n" ); }memset (ieee->dot11HTOperationalRateSet,0 ,16 ); ieee->state =RTLLIB_LINKED ;
@@ -2023,7 +2030,7 @@ static short rtllib_sta_ps_sleep(struct rtllib_device *ieee, u64 *time)if (ieee->bAwakePktSent) { pPSC->LPSAwakeIntvl =1 ; }else { -u8 MaxPeriod =1 ; +u8 MaxPeriod =1 ;if (pPSC->LPSAwakeIntvl ==0 ) pPSC->LPSAwakeIntvl =1 ;
@@ -2194,7 +2201,8 @@ void rtllib_ps_tx_ack(struct rtllib_device *ieee, short success) }EXPORT_SYMBOL (rtllib_ps_tx_ack); -static void rtllib_process_action (struct rtllib_device *ieee,struct sk_buff *skb) +static void rtllib_process_action (struct rtllib_device *ieee, +struct sk_buff *skb) {struct rtllib_hdr_3addr *header = (struct rtllib_hdr_3addr *) skb->data;u8 *act =rtllib_get_payload ((struct rtllib_hdr *)header);
@@ -3674,8 +3682,8 @@ static void rtllib_MgntDisconnectIBSS(struct rtllib_device *rtllib) } -static void rtllib_MlmeDisassociateRequest (struct rtllib_device *rtllib,u8 *asSta, -u8 asRsn) +static void rtllib_MlmeDisassociateRequest (struct rtllib_device *rtllib, +u8 *asSta,u8 asRsn) {u8 i;u8 OpMode;
drivers/staging/rtl8192e/rtllib_tx.c +21 -20
54 lines not on this page · raw message
Signature · 1 line
1.8.4.1
PATCH v3 22/33 staging: rtl8192e: Fix LONG_LING in rtllib_parse_info_param()
In reply to Mateusz KulikowskiTake out MIFE_TYPE_HT_CAP processing into separate function - rtllib_parse_mfie_ht_cap()
--- drivers/staging/rtl8192e/rtllib_rx.c | 49 +++++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 20 deletions(-)
drivers/staging/rtl8192e/rtllib_rx.c +29 -20
@@ -1984,6 +1984,33 @@ static void rtllib_parse_mife_generic(struct rtllib_device *ieee, } } +static void rtllib_parse_mfie_ht_cap (struct rtllib_info_element *info_element, +struct rtllib_network *network, +u16 *tmp_htcap_len) +{ +struct bss_ht *ht = &network->bssht; + + *tmp_htcap_len =min_t (u8, info_element->len,MAX_IE_LEN ); +if (*tmp_htcap_len !=0 ) { + ht->bdHTSpecVer =HT_SPEC_VER_EWC ; + ht->bdHTCapLen =min_t (u16, *tmp_htcap_len, +sizeof (ht->bdHTCapBuf)); +memcpy (ht->bdHTCapBuf, info_element->data, ht->bdHTCapLen); + + ht->bdSupportHT = true; + ht->bdHT1R = ((((struct ht_capab_ele *) + ht->bdHTCapBuf))->MCS[1 ]) ==0 ; + + ht->bdBandWidth = (enum ht_channel_width ) + (((struct ht_capab_ele *) + (ht->bdHTCapBuf))->ChlWidth); + }else { + ht->bdSupportHT = false; + ht->bdHT1R = false; + ht->bdBandWidth =HT_CHANNEL_WIDTH_20 ; + } +} + int rtllib_parse_info_param(struct rtllib_device *ieee, struct rtllib_info_element *info_element, u16 length,
@@ -2165,27 +2192,9 @@ int rtllib_parse_info_param(struct rtllib_device *ieee,case MFIE_TYPE_HT_CAP :netdev_dbg (ieee->dev,"MFIE_TYPE_HT_CAP: %d bytes\n" , info_element->len); - tmp_htcap_len =min_t (u8, info_element->len,MAX_IE_LEN ); -if (tmp_htcap_len !=0 ) { - network->bssht.bdHTSpecVer =HT_SPEC_VER_EWC ; - network->bssht.bdHTCapLen = tmp_htcap_len >sizeof (network->bssht.bdHTCapBuf) ? -sizeof (network->bssht.bdHTCapBuf) : tmp_htcap_len; -memcpy (network->bssht.bdHTCapBuf, - info_element->data, - network->bssht.bdHTCapLen); - network->bssht.bdSupportHT = true; - network->bssht.bdHT1R = ((((struct ht_capab_ele *) - network->bssht.bdHTCapBuf))->MCS[1 ]) ==0 ; - - network->bssht.bdBandWidth = (enum ht_channel_width ) - (((struct ht_capab_ele *) - (network->bssht.bdHTCapBuf))->ChlWidth); - }else { - network->bssht.bdSupportHT = false; - network->bssht.bdHT1R = false; - network->bssht.bdBandWidth =HT_CHANNEL_WIDTH_20 ; - } +rtllib_parse_mfie_ht_cap (info_element, network, + &tmp_htcap_len);break ;
Signature · 1 line
1.8.4.1
PATCH v3 23/33 staging: rtl8192e: Remove unimplemented iwpriv handlers
In reply to Mateusz KulikowskiRemove the following private variables:
- force_mic_error - changes force_mic_error that is not used
- radio - changes sw_radio_on that is not used
- adhoc_peer_list - unimplemented
- firm_ver - unimplemented
--- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 1 - drivers/staging/rtl8192e/rtl8192e/rtl_core.h | 1 - drivers/staging/rtl8192e/rtl8192e/rtl_wx.c | 86 ++-------------------------- drivers/staging/rtl8192e/rtllib.h | 1 - 4 files changed, 4 insertions(+), 85 deletions(-)
drivers/staging/rtl8192e/rtl8192e/rtl_core.c +0 -1
@@ -1118,7 +1118,6 @@ static void rtl8192_init_priv_variable(struct net_device *dev) priv->bDriverIsGoingToUnload = false; priv->being_init_adapter = false; priv->initialized_at_probe = false; - priv->sw_radio_on = true; priv->bdisable_nic = false; priv->bfirst_init = false; priv->txringcount =64 ;
drivers/staging/rtl8192e/rtl8192e/rtl_core.h +0 -1
@@ -626,7 +626,6 @@ struct r8192_priv {u8 RegCWinMin;u8 keepAliveLevel; -bool sw_radio_on;bool bHwRadioOff;bool pwrdown;bool blinked_ingpio;
drivers/staging/rtl8192e/rtl8192e/rtl_wx.c +4 -82
125 lines not on this page · raw message
drivers/staging/rtl8192e/rtllib.h +0 -1
@@ -1904,7 +1904,6 @@ struct rtllib_device {u8 hwsec_active;bool is_silent_reset; -bool force_mic_error;bool is_roaming;bool ieee_up;bool cannot_notify;
Signature · 1 line
1.8.4.1
PATCH v3 24/33 staging: rtl8192e: Fix OOM_MESSAGE warnings
In reply to Mateusz KulikowskiRemove alloc failed messages where not needed to make checkpatch.pl happy.
--- drivers/staging/rtl8192e/rtl819x_BAProc.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/staging/rtl8192e/rtl819x_BAProc.c +2 -6
@@ -92,10 +92,8 @@ static struct sk_buff *rtllib_ADDBA(struct rtllib_device *ieee, u8 *Dst,return NULL ; } skb =dev_alloc_skb (len +sizeof (struct rtllib_hdr_3addr )); -if (skb ==NULL ) { -netdev_err (ieee->dev,"Can't alloc skb for ADDBA_REQ\n" ); +if (skb ==NULL )return NULL ; - }memset (skb->data,0 ,sizeof (struct rtllib_hdr_3addr ));
@@ -160,10 +158,8 @@ static struct sk_buff *rtllib_DELBA(struct rtllib_device *ieee, u8 *dst, DelbaParamSet.field.TID = pBA->BaParamSet.field.TID; skb =dev_alloc_skb (len +sizeof (struct rtllib_hdr_3addr )); -if (skb ==NULL ) { -netdev_err (ieee->dev,"Can't alloc skb for DELBA_REQ\n" ); +if (skb ==NULL )return NULL ; - }skb_reserve (skb, ieee->tx_headroom);
Signature · 1 line
1.8.4.1
PATCH v3 25/33 staging: rtl8192e: Remove unused rtl_crypto.h
In reply to Mateusz KulikowskiThis header is not used - remove it to make driver code smaller.
--- drivers/staging/rtl8192e/rtl8192e/rtl_crypto.h | 382 ------------------------- 1 file changed, 382 deletions(-) delete mode 100644 drivers/staging/rtl8192e/rtl8192e/rtl_crypto.h
drivers/staging/rtl8192e/rtl8192e/rtl_crypto.h deleted +0 -382
@@ -1,382 +0,0 @@ -/* -* Scatterlist Cryptographic API. -* -* Copyright (c) 2002 James Morris <[email protected]> -* Copyright (c) 2002 David S. Miller ([email protected]) -* -* Portions derived from Cryptoapi, by Alexander Kjeldaas <[email protected]> -* and Nettle, by Niels M鰈ler. -* -* This program is free software; you can redistribute it and/or modify it -* under the terms of the GNU General Public License as published by the Free -* Software Foundation; either version 2 of the License, or (at your option) -* any later version. -* -*/ -#ifndef _LINUX_CRYPTO_H -#define _LINUX_CRYPTO_H - -#include <linux/module.h> -#include <linux/kernel.h> -#include <linux/types.h> -#include <linux/list.h> -#include <linux/string.h> -#include <asm/page.h> -#include <linux/errno.h> - -#define crypto_register_alg crypto_register_alg_rsl -#define crypto_unregister_alg crypto_unregister_alg_rsl -#define crypto_alloc_tfm crypto_alloc_tfm_rsl -#define crypto_free_tfm crypto_free_tfm_rsl -#define crypto_alg_available crypto_alg_available_rsl - -/* -* Algorithm masks and types. -*/ -#define CRYPTO_ALG_TYPE_MASK 0x000000ff -#define CRYPTO_ALG_TYPE_CIPHER 0x00000001 -#define CRYPTO_ALG_TYPE_DIGEST 0x00000002 -#define CRYPTO_ALG_TYPE_COMPRESS 0x00000004 - -/* -* Transform masks and values (for crt_flags). -*/ -#define CRYPTO_TFM_MODE_MASK 0x000000ff -#define CRYPTO_TFM_REQ_MASK 0x000fff00 -#define CRYPTO_TFM_RES_MASK 0xfff00000 - -#define CRYPTO_TFM_MODE_ECB 0x00000001 -#define CRYPTO_TFM_MODE_CBC 0x00000002 -#define CRYPTO_TFM_MODE_CFB 0x00000004 -#define CRYPTO_TFM_MODE_CTR 0x00000008 - -#define CRYPTO_TFM_REQ_WEAK_KEY 0x00000100 -#define CRYPTO_TFM_RES_WEAK_KEY 0x00100000 -#define CRYPTO_TFM_RES_BAD_KEY_LEN 0x00200000 -#define CRYPTO_TFM_RES_BAD_KEY_SCHED 0x00400000 -#define CRYPTO_TFM_RES_BAD_BLOCK_LEN 0x00800000 -#define CRYPTO_TFM_RES_BAD_FLAGS 0x01000000 - -/* -* Miscellaneous stuff. -*/ -#define CRYPTO_UNSPEC 0 -#define CRYPTO_MAX_ALG_NAME 64 - -struct scatterlist ; - -/* -* Algorithms: modular crypto algorithm implementations, managed -* via crypto_register_alg() and crypto_unregister_alg(). -*/ -struct cipher_alg { -unsigned int cia_min_keysize; -unsigned int cia_max_keysize; -int (*cia_setkey)(void *ctx,const u8 *key, -unsigned int keylen,u32 *flags); -void (*cia_encrypt)(void *ctx,u8 *dst,const u8 *src); -void (*cia_decrypt)(void *ctx,u8 *dst,const u8 *src); -}; - -struct digest_alg { -unsigned int dia_digestsize; -void (*dia_init)(void *ctx); -void (*dia_update)(void *ctx,const u8 *data,unsigned int len); -void (*dia_final)(void *ctx,u8 *out); -int (*dia_setkey)(void *ctx,const u8 *key, -unsigned int keylen,u32 *flags); -}; - -struct compress_alg { -int (*coa_init)(void *ctx); -void (*coa_exit)(void *ctx); -int (*coa_compress)(void *ctx,const u8 *src,unsigned int slen, -u8 *dst,unsigned int *dlen); -int (*coa_decompress)(void *ctx,const u8 *src,unsigned int slen, -u8 *dst,unsigned int *dlen); -}; - -#define cra_cipher cra_u.cipher -#define cra_digest cra_u.digest -#define cra_compress cra_u.compress - -struct crypto_alg { -struct list_head cra_list; -u32 cra_flags; -unsigned int cra_blocksize; -unsigned int cra_ctxsize; -const char cra_name[CRYPTO_MAX_ALG_NAME ]; - -union { -struct cipher_alg cipher; -struct digest_alg digest; -struct compress_alg compress; - } cra_u; - -struct module *cra_module; -}; - -/* -* Algorithm registration interface. -*/ -int crypto_register_alg (struct crypto_alg *alg); -int crypto_unregister_alg (struct crypto_alg *alg); - -/* -* Algorithm query interface. -*/ -int crypto_alg_available (const char *name,u32 flags); - -/* -* Transforms: user-instantiated objects which encapsulate algorithms -* and core processing logic. Managed via crypto_alloc_tfm() and -* crypto_free_tfm(), as well as the various helpers below. -*/ -struct crypto_tfm ; - -struct cipher_tfm { -void *cit_iv; -unsigned int cit_ivsize; -u32 cit_mode; -int (*cit_setkey)(struct crypto_tfm *tfm, -const u8 *key,unsigned int keylen); -int (*cit_encrypt)(struct crypto_tfm *tfm, -struct scatterlist *dst, -struct scatterlist *src, -unsigned int nbytes); -int (*cit_encrypt_iv)(struct crypto_tfm *tfm, -struct scatterlist *dst, -struct scatterlist *src, -unsigned int nbytes,u8 *iv); -int (*cit_decrypt)(struct crypto_tfm *tfm, -struct scatterlist *dst, -struct scatterlist *src, -unsigned int nbytes); -int (*cit_decrypt_iv)(struct crypto_tfm *tfm, -struct scatterlist *dst, -struct scatterlist *src, -unsigned int nbytes,u8 *iv); -void (*cit_xor_block)(u8 *dst,const u8 *src); -}; - -struct digest_tfm { -void (*dit_init)(struct crypto_tfm *tfm); -void (*dit_update)(struct crypto_tfm *tfm, -struct scatterlist *sg,unsigned int nsg); -void (*dit_final)(struct crypto_tfm *tfm,u8 *out); -void (*dit_digest)(struct crypto_tfm *tfm,struct scatterlist *sg, -unsigned int nsg,u8 *out); -int (*dit_setkey)(struct crypto_tfm *tfm, -const u8 *key,unsigned int keylen); -}; - -struct compress_tfm { -int (*cot_compress)(struct crypto_tfm *tfm, -const u8 *src,unsigned int slen, -u8 *dst,unsigned int *dlen); -int (*cot_decompress)(struct crypto_tfm *tfm, -const u8 *src,unsigned int slen, -u8 *dst,unsigned int *dlen); -}; - -#define crt_cipher crt_u.cipher -#define crt_digest crt_u.digest -#define crt_compress crt_u.compress - -struct crypto_tfm { - -u32 crt_flags; - -union { -struct cipher_tfm cipher; -struct digest_tfm digest; -struct compress_tfm compress; - } crt_u; - -struct crypto_alg *__crt_alg; -}; - -/* -* Transform user interface. -*/ - -/* -* crypto_alloc_tfm() will first attempt to locate an already loaded algorithm. -* If that fails and the kernel supports dynamically loadable modules, it -* will then attempt to load a module of the same name or alias. A refcount -* is grabbed on the algorithm which is then associated with the new transform. -* -* crypto_free_tfm() frees up the transform and any associated resources, -* then drops the refcount on the associated algorithm. -*/ -struct crypto_tfm *crypto_alloc_tfm (const char *alg_name,u32 tfm_flags); -void crypto_free_tfm (struct crypto_tfm *tfm); - -/* -* Transform helpers which query the underlying algorithm. -*/ -static inline const char *crypto_tfm_alg_name (struct crypto_tfm *tfm) -{ -return tfm->__crt_alg->cra_name; -} - -static inline const char *crypto_tfm_alg_modname (struct crypto_tfm *tfm) -{ -struct crypto_alg *alg = tfm->__crt_alg; - -if (alg->cra_module) -return alg->cra_module->name; -else -return NULL ; -} - -static inline u32 crypto_tfm_alg_type (struct crypto_tfm *tfm) -{ -return tfm->__crt_alg->cra_flags &CRYPTO_ALG_TYPE_MASK ; -} - -static inline unsigned int crypto_tfm_alg_min_keysize (struct crypto_tfm *tfm) -{ -BUG_ON (crypto_tfm_alg_type (tfm) !=CRYPTO_ALG_TYPE_CIPHER ); -return tfm->__crt_alg->cra_cipher.cia_min_keysize; -} - -static inline unsigned int crypto_tfm_alg_max_keysize (struct crypto_tfm *tfm) -{ -BUG_ON (crypto_tfm_alg_type (tfm) !=CRYPTO_ALG_TYPE_CIPHER ); -return tfm->__crt_alg->cra_cipher.cia_max_keysize; -} - -static inline unsigned int crypto_tfm_alg_ivsize (struct crypto_tfm *tfm) -{ -BUG_ON (crypto_tfm_alg_type (tfm) !=CRYPTO_ALG_TYPE_CIPHER ); -return tfm->crt_cipher.cit_ivsize; -} - -static inline unsigned int crypto_tfm_alg_blocksize (struct crypto_tfm *tfm) -{ -return tfm->__crt_alg->cra_blocksize; -} - -static inline unsigned int crypto_tfm_alg_digestsize (struct crypto_tfm *tfm) -{ -BUG_ON (crypto_tfm_alg_type (tfm) !=CRYPTO_ALG_TYPE_DIGEST ); -return tfm->__crt_alg->cra_digest.dia_digestsize; -} - -/* -* API wrappers. -*/ -static inline void crypto_digest_init (struct crypto_tfm *tfm) -{ -BUG_ON (crypto_tfm_alg_type (tfm) !=CRYPTO_ALG_TYPE_DIGEST ); - tfm->crt_digest.dit_init (tfm); -} - -static inline void crypto_digest_update (struct crypto_tfm *tfm, -struct scatterlist *sg, -unsigned int nsg) -{ -BUG_ON (crypto_tfm_alg_type (tfm) !=CRYPTO_ALG_TYPE_DIGEST ); - tfm->crt_digest.dit_update (tfm, sg, nsg); -} - -static inline void crypto_digest_final (struct crypto_tfm *tfm,u8 *out) -{ -BUG_ON (crypto_tfm_alg_type (tfm) !=CRYPTO_ALG_TYPE_DIGEST ); - tfm->crt_digest.dit_final (tfm, out); -} - -static inline void crypto_digest_digest (struct crypto_tfm *tfm, -struct scatterlist *sg, -unsigned int nsg,u8 *out) -{ -BUG_ON (crypto_tfm_alg_type (tfm) !=CRYPTO_ALG_TYPE_DIGEST ); - tfm->crt_digest.dit_digest (tfm, sg, nsg, out); -} - -static inline int crypto_digest_setkey (struct crypto_tfm *tfm, -const u8 *key,unsigned int keylen) -{ -BUG_ON (crypto_tfm_alg_type (tfm) !=CRYPTO_ALG_TYPE_DIGEST ); -if (tfm->crt_digest.dit_setkey ==NULL ) -return -ENOSYS ; -return tfm->crt_digest.dit_setkey (tfm, key, keylen); -} - -static inline int crypto_cipher_setkey (struct crypto_tfm *tfm, -const u8 *key,unsigned int keylen) -{ -BUG_ON (crypto_tfm_alg_type (tfm) !=CRYPTO_ALG_TYPE_CIPHER ); -return tfm->crt_cipher.cit_setkey (tfm, key, keylen); -} - -static inline int crypto_cipher_encrypt (struct crypto_tfm *tfm, -struct scatterlist *dst, -struct scatterlist *src, -unsigned int nbytes) -{ -BUG_ON (crypto_tfm_alg_type (tfm) !=CRYPTO_ALG_TYPE_CIPHER ); -return tfm->crt_cipher.cit_encrypt (tfm, dst, src, nbytes); -} - -static inline int crypto_cipher_encrypt_iv (struct crypto_tfm *tfm, -struct scatterlist *dst, -struct scatterlist *src, -unsigned int nbytes,u8 *iv) -{ -BUG_ON (crypto_tfm_alg_type (tfm) !=CRYPTO_ALG_TYPE_CIPHER ); -BUG_ON (tfm->crt_cipher.cit_mode ==CRYPTO_TFM_MODE_ECB ); -return tfm->crt_cipher.cit_encrypt_iv (tfm, dst, src, nbytes, iv); -} - -static inline int crypto_cipher_decrypt (struct crypto_tfm *tfm, -struct scatterlist *dst, -struct scatterlist *src, -unsigned int nbytes) -{ -BUG_ON (crypto_tfm_alg_type (tfm) !=CRYPTO_ALG_TYPE_CIPHER ); -return tfm->crt_cipher.cit_decrypt (tfm, dst, src, nbytes); -} - -static inline int crypto_cipher_decrypt_iv (struct crypto_tfm *tfm, -struct scatterlist *dst, -struct scatterlist *src, -unsigned int nbytes,u8 *iv) -{ -BUG_ON (crypto_tfm_alg_type (tfm) !=CRYPTO_ALG_TYPE_CIPHER ); -BUG_ON (tfm->crt_cipher.cit_mode ==CRYPTO_TFM_MODE_ECB ); -return tfm->crt_cipher.cit_decrypt_iv (tfm, dst, src, nbytes, iv); -} - -static inline void crypto_cipher_set_iv (struct crypto_tfm *tfm, -const u8 *src,unsigned int len) -{ -BUG_ON (crypto_tfm_alg_type (tfm) !=CRYPTO_ALG_TYPE_CIPHER ); -memcpy (tfm->crt_cipher.cit_iv, src, len); -} - -static inline void crypto_cipher_get_iv (struct crypto_tfm *tfm, -u8 *dst,unsigned int len) -{ -BUG_ON (crypto_tfm_alg_type (tfm) !=CRYPTO_ALG_TYPE_CIPHER ); -memcpy (dst, tfm->crt_cipher.cit_iv, len); -} - -static inline int crypto_comp_compress (struct crypto_tfm *tfm, -const u8 *src,unsigned int slen, -u8 *dst,unsigned int *dlen) -{ -BUG_ON (crypto_tfm_alg_type (tfm) !=CRYPTO_ALG_TYPE_COMPRESS ); -return tfm->crt_compress.cot_compress (tfm, src, slen, dst, dlen); -} - -static inline int crypto_comp_decompress (struct crypto_tfm *tfm, -const u8 *src,unsigned int slen, -u8 *dst,unsigned int *dlen) -{ -BUG_ON (crypto_tfm_alg_type (tfm) !=CRYPTO_ALG_TYPE_COMPRESS ); -return tfm->crt_compress.cot_decompress (tfm, src, slen, dst, dlen); -} - -#endif /* _LINUX_CRYPTO_H */
Signature · 1 line
1.8.4.1
PATCH v3 26/33 staging: rtl8192e: Replace ?: with max_t
In reply to Mateusz KulikowskiImprove readability and make checkpatch happy.
--- drivers/staging/rtl8192e/rtllib_rx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8192e/rtllib_rx.c +1 -1
@@ -1689,7 +1689,7 @@ static int rtllib_qos_convert_ac_to_parameters(struct rtllib_qos_parameter_info qos_param->aifs[aci] = (ac_params->aci_aifsn) &0x0f ;/* WMM spec P.11: The minimum value for AIFSN shall be 2 */ - qos_param->aifs[aci] = (qos_param->aifs[aci] <2 ) ?2 : qos_param->aifs[aci]; + qos_param->aifs[aci] =max_t (u8, qos_param->aifs[aci],2 ); qos_param->cw_min[aci] =cpu_to_le16 (ac_params->ecw_min_max &0x0F );
Signature · 1 line
1.8.4.1
PATCH v3 27/33 staging: rtl8192e: Replace ?: with min_t
In reply to Mateusz KulikowskiReplace :? with min_t for readability. Remove check that is always false.
--- drivers/staging/rtl8192e/rtllib_softmac_wx.c | 8 +------- drivers/staging/rtl8192e/rtllib_wx.c | 3 +-- 2 files changed, 2 insertions(+), 9 deletions(-)
drivers/staging/rtl8192e/rtllib_softmac_wx.c +1 -7
@@ -454,13 +454,7 @@ int rtllib_wx_set_essid(struct rtllib_device *ieee, proto_started = ieee->proto_started; - len = (wrqu->essid.length <IW_ESSID_MAX_SIZE ) ? wrqu->essid.length : -IW_ESSID_MAX_SIZE ; - -if (len >IW_ESSID_MAX_SIZE ) { - ret = -E2BIG ; - goto out; - } + len =min_t (__u16, wrqu->essid.length,IW_ESSID_MAX_SIZE );if (ieee->iw_mode ==IW_MODE_MONITOR ) { ret =-1 ;
drivers/staging/rtl8192e/rtllib_wx.c +1 -2
@@ -851,8 +851,7 @@ int rtllib_wx_set_gen_ie(struct rtllib_device *ieee, u8 *ie, size_t len)if ((eid ==MFIE_TYPE_GENERIC ) && (!memcmp (&ie[2 ], wps_oui,4 ))) { - ieee->wps_ie_len = (len <MAX_WZC_IE_LEN ) ? (len) : - (MAX_WZC_IE_LEN ); + ieee->wps_ie_len =min_t (size_t, len,MAX_WZC_IE_LEN ); buf =kmemdup (ie, ieee->wps_ie_len,GFP_KERNEL );if (buf ==NULL )return -ENOMEM ;
Signature · 1 line
1.8.4.1
PATCH v3 28/33 staging: rtl8192e: Replace ?: with max
In reply to Mateusz KulikowskiWarninig is printed if precision is lost - it can't happen at moment as all get_key implementations return either -1 or small buffers.
--- drivers/staging/rtl8192e/rtllib_wx.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/staging/rtl8192e/rtllib_wx.c +4 -1
@@ -510,7 +510,10 @@ int rtllib_wx_get_encode(struct rtllib_device *ieee,return 0 ; } len = crypt->ops->get_key (keybuf,SCM_KEY_LEN ,NULL , crypt->priv); - erq->length = (len >=0 ? len :0 ); +if (len >U16_MAX ) +netdev_err (ieee->dev,"Too long key returned.\n" ); + + erq->length =max (len,0 ); erq->flags |=IW_ENCODE_ENABLED ;
Signature · 1 line
1.8.4.1
Re: [PATCH v3 28/33] staging: rtl8192e: Replace ?: with max
Quoted 13 lines · Mateusz Kulikowski
Warninig is printed if precision is lost - it can't happen at moment as all
get_keyimplementations return either -1 or small buffers.Signed-off-by Mateusz Kulikowski <[email protected]>--- drivers/staging/rtl8192e/rtllib_wx.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/staging/rtl8192e/rtllib_wx.c +0
-0
drivers/staging/rtl8192e/rtllib_wx.c int rtllib_wx_get_encode(struct rtllib_device *ieee, · line 514
Quoted 6 lines
drivers/staging/rtl8192e/rtllib_wx.c +2
-1@@ -510,7 +510,10 @@ int rtllib_wx_get_encode(struct rtllib_device *ieee,return 0 ; } len = crypt->ops->get_key (keybuf,SCM_KEY_LEN ,NULL , crypt->priv); - erq->length = (len >=0 ? len :0 ); +if (len >U16_MAX ) +netdev_err (ieee->dev,"Too long key returned.\n" );
Just delete the check if it can't happen or handle the error properly. Never printed messages can be annoying. Static checkers assume all conditions can happen so never true conditions are confusing. It wastes RAM.
regards,
dan carpenter
Re: [PATCH v3 28/33] staging: rtl8192e: Replace ?: with max
Quoted 1 line · Dan Carpenter
On Sat, May 09, 2015 at 11:19:16PM +0200, Mateusz Kulikowski wrote:
(...)
Quoted 9 lines
drivers/staging/rtl8192e/rtllib_wx.c int rtllib_wx_get_encode(struct rtllib_device *ieee, · line 514
Quoted 4 lines
drivers/staging/rtl8192e/rtllib_wx.c +2
-1len = crypt->ops->get_key (keybuf,SCM_KEY_LEN ,NULL , crypt->priv); - erq->length = (len >=0 ? len :0 ); +if (len >U16_MAX ) +netdev_err (ieee->dev,"Too long key returned.\n" );Just delete the check if it can't happen or handle the error properly. Never printed messages can be annoying. Static checkers assume all conditions can happen so never true conditions are confusing. It wastes RAM.
Ok, will do, thanks.
Regards,
Mateusz
PATCH v3 29/33 staging: rtl8192e: Remove unneeded RT_TRACE(COMP_ERR,...)
In reply to Mateusz KulikowskiThis messages are not needed, as failure is reported earlier in code.
--- drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c | 1 - drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c | 1 - 2 files changed, 2 deletions(-)
drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c +0 -1
@@ -239,7 +239,6 @@ bool phy_RF8256_Config_ParaFile(struct net_device *dev)return true; phy_RF8256_Config_ParaFile_Fail: -RT_TRACE (COMP_ERR ,"PHY Initialization failed\n" );return false; }
drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c +0 -1
@@ -171,7 +171,6 @@ static bool CPUcheck_firmware_ready(struct net_device *dev)return rt_status; CPUCheckFirmwareReady_Fail: -RT_TRACE (COMP_ERR ,"ERR in %s()\n" , __func__); rt_status = false;return rt_status;
Signature · 1 line
1.8.4.1
PATCH v3 30/33 staging: rtl8192e: rtl8192_phy_checkBBAndRF(): Don't check MAC
In reply to Mateusz KulikowskiThis function never supported checking of MAC block. Instead of printing several warnings - print it once and exit.
--- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +7 -5
@@ -504,13 +504,15 @@ bool rtl8192_phy_checkBBAndRF(struct net_device *dev, WriteAddr[HW90_BLOCK_RF ] =0x3 ;RT_TRACE (COMP_PHY ,"=======>%s(), CheckBlock:%d\n" , __func__, CheckBlock); + +if (CheckBlock ==HW90_BLOCK_MAC ) { +netdev_warn (dev,"%s(): No checks available for MAC block.\n" , + __func__); +return ret; + } +for (i =0 ; i < CheckTimes; i++) {switch (CheckBlock) { -case HW90_BLOCK_MAC : -RT_TRACE (COMP_ERR , -"PHY_CheckBBRFOK(): Never Write 0x100 here!" ); -break ; -case HW90_BLOCK_PHY0 :case HW90_BLOCK_PHY1 : write_nic_dword(dev, WriteAddr[CheckBlock],
Signature · 1 line
1.8.4.1
PATCH v3 31/33 staging: rtl8192e: Replace RT_TRACE(COMP_ERR, ...) with netdev_*
In reply to Mateusz Kulikowski- Use netdev_* with log level depending on how serious error is
- Rework some messages to be more readable
- Pass net_device where needed for pretty prints
--- drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c | 24 +++-- drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 31 ++++--- .../staging/rtl8192e/rtl8192e/r8192E_firmware.c | 13 +-- drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 100 ++++++++++----------- drivers/staging/rtl8192e/rtl8192e/rtl_cam.c | 18 ++-- drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 65 ++++++-------- drivers/staging/rtl8192e/rtl8192e/rtl_ps.c | 4 +- drivers/staging/rtl8192e/rtl8192e/rtl_wx.c | 14 ++- 8 files changed, 127 insertions(+), 142 deletions(-)
drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c +11 -13
@@ -47,8 +47,8 @@ void PHY_SetRF8256Bandwidth(struct net_device *dev, 0x0e, bMask12Bits, 0x021); }else { -RT_TRACE (COMP_ERR , -"PHY_SetRF8256Bandwidth(): unknown hardware version\n" ); +netdev_warn (dev,"%s(): Unknown HW version.\n" , + __func__); }break ;
@@ -66,16 +66,15 @@ void PHY_SetRF8256Bandwidth(struct net_device *dev, 0x0e, bMask12Bits, 0x0e1); }else { -RT_TRACE (COMP_ERR , -"PHY_SetRF8256Bandwidth(): unknown hardware version\n" ); +netdev_warn (dev,"%s(): Unknown HW version.\n" , + __func__); }break ;default : -RT_TRACE (COMP_ERR , -"PHY_SetRF8256Bandwidth(): unknown Bandwidth: %#X\n" , - Bandwidth); +netdev_err (dev,"%s(): Unknown bandwidth: %#X\n" , + __func__, Bandwidth);break ; }
@@ -139,9 +138,8 @@ bool phy_RF8256_Config_ParaFile(struct net_device *dev) rtStatus =rtl8192_phy_checkBBAndRF (dev,HW90_BLOCK_RF , (enum rf90_radio_path )eRFPath);if (!rtStatus) { -RT_TRACE (COMP_ERR , -"PHY_RF8256_Config():Check Radio[%d] Fail!!\n" , - eRFPath); +netdev_err (dev,"%s(): Failed to check RF Path %d.\n" , + __func__, eRFPath); goto phy_RF8256_Config_ParaFile_Fail; }
@@ -227,9 +225,9 @@ bool phy_RF8256_Config_ParaFile(struct net_device *dev) }if (ret) { -RT_TRACE (COMP_ERR , -"phy_RF8256_Config_ParaFile():Radio[%d] Fail!!" , - eRFPath); +netdev_err (dev, +"%s(): Failed to initialize RF Path %d.\n" , + __func__, eRFPath); goto phy_RF8256_Config_ParaFile_Fail; }
drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +15 -16
@@ -328,8 +328,8 @@ static void rtl8192_read_eeprom_info(struct net_device *dev) EEPROMId =eprom_read (dev,0 );if (EEPROMId !=RTL8190_EEPROM_ID ) { -RT_TRACE (COMP_ERR ,"EEPROM ID is invalid:%x, %x\n" , - EEPROMId,RTL8190_EEPROM_ID ); +netdev_err (dev,"%s(): Invalid EEPROM ID: %x\n" , __func__, + EEPROMId); priv->AutoloadFailFlag = true; }else { priv->AutoloadFailFlag = false;
@@ -738,9 +738,8 @@ start:else if (priv->pFirmware->firmware_status ==FW_STATUS_5_READY ) ulRegRead |=CPU_GEN_FIRMWARE_RESET ;else -RT_TRACE (COMP_ERR , -"ERROR in %s(): undefined firmware state(%d)\n" , - __func__, priv->pFirmware->firmware_status); +netdev_err (dev,"%s(): undefined firmware state: %d.\n" , + __func__, priv->pFirmware->firmware_status);write_nic_dword (dev,CPU_GEN , ulRegRead);
@@ -756,7 +755,7 @@ start:RT_TRACE (COMP_INIT ,"BB Config Start!\n" ); rtStatus =rtl8192_BBConfig (dev);if (!rtStatus) { -RT_TRACE (COMP_ERR ,"BB Config failed\n" ); +netdev_warn (dev,"%s(): Failed to configure BB\n" , __func__);return rtStatus; }RT_TRACE (COMP_INIT ,"BB Config Finished!\n" );
@@ -770,8 +769,8 @@ start:else if (priv->LoopbackMode ==RTL819X_MAC_LOOPBACK ) ulRegRead |=CPU_CCK_LOOPBACK ;else -RT_TRACE (COMP_ERR , -"Serious error: wrong loopback mode setting\n" ); +netdev_err (dev,"%s: Invalid loopback mode setting.\n" , + __func__);write_nic_dword (dev,CPU_GEN , ulRegRead);
@@ -869,7 +868,7 @@ start:RT_TRACE (COMP_INIT ,"RF Config Started!\n" ); rtStatus =rtl8192_phy_RFConfig (dev);if (!rtStatus) { -RT_TRACE (COMP_ERR ,"RF Config failed\n" ); +netdev_info (dev,"RF Config failed\n" );return rtStatus; }RT_TRACE (COMP_INIT ,"RF Config Finished!\n" );
@@ -1139,7 +1138,8 @@ static u8 MRateToHwRate8190Pci(u8 rate)return ret; } -static u8 rtl8192_MapHwQueueToFirmwareQueue (u8 QueueID,u8 priority) +static u8 rtl8192_MapHwQueueToFirmwareQueue (struct net_device *dev,u8 QueueID, +u8 priority) {u8 QueueSelect =0x0 ;
@@ -1172,9 +1172,8 @@ static u8 rtl8192_MapHwQueueToFirmwareQueue(u8 QueueID, u8 priority) QueueSelect =QSLT_HIGH ;break ;default : -RT_TRACE (COMP_ERR , -"TransmitTCB(): Impossible Queue Selection: %d\n" , - QueueID); +netdev_warn (dev,"%s(): Impossible Queue Selection: %d\n" , + __func__, QueueID);break ; }return QueueSelect;
@@ -1198,7 +1197,7 @@ void rtl8192_tx_fill_desc(struct net_device *dev, struct tx_desc *pdesc, cb_desc);if (pci_dma_mapping_error (priv->pdev, mapping)) -RT_TRACE (COMP_ERR ,"DMA Mapping error\n" ); +netdev_err (dev,"%s(): DMA Mapping error\n" , __func__);if (cb_desc->bAMPDUEnable) { pTxFwInfo->AllowAggregation =1 ; pTxFwInfo->RxMF = cb_desc->ampdu_factor;
@@ -1274,7 +1273,7 @@ void rtl8192_tx_fill_desc(struct net_device *dev, struct tx_desc *pdesc, pdesc->PktId =0x0 ; - pdesc->QueueSelect =rtl8192_MapHwQueueToFirmwareQueue ( + pdesc->QueueSelect =rtl8192_MapHwQueueToFirmwareQueue (dev, cb_desc->queue_index, cb_desc->priority); pdesc->TxFWInfoSize =sizeof (struct tx_fwinfo_8190pci );
@@ -1298,7 +1297,7 @@ void rtl8192_tx_fill_cmd_desc(struct net_device *dev, PCI_DMA_TODEVICE);if (pci_dma_mapping_error (priv->pdev, mapping)) -RT_TRACE (COMP_ERR ,"DMA Mapping error\n" ); +netdev_err (dev,"%s(): DMA Mapping error\n" , __func__);memset (entry,0 ,12 ); entry->LINIP = cb_desc->bLastIniPkt; entry->FirstSeg =1 ;
drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c +7 -6
@@ -116,7 +116,7 @@ static bool CPUcheck_maincodeok_turnonCPU(struct net_device *dev) }if (!(CPU_status&CPU_GEN_PUT_CODE_OK )) { -RT_TRACE (COMP_ERR ,"Download Firmware: Put code fail!\n" ); +netdev_err (dev,"Firmware download failed.\n" ); goto CPUCheckMainCodeOKAndTurnOnCPU_Fail; }else {RT_TRACE (COMP_FIRMWARE ,"Download Firmware: Put code ok!\n" );
@@ -135,15 +135,16 @@ static bool CPUcheck_maincodeok_turnonCPU(struct net_device *dev)mdelay (2 ); } -if (!(CPU_status&CPU_GEN_BOOT_RDY )) +if (!(CPU_status&CPU_GEN_BOOT_RDY )) { +netdev_err (dev,"Firmware boot failed.\n" ); goto CPUCheckMainCodeOKAndTurnOnCPU_Fail; -else -RT_TRACE (COMP_FIRMWARE ,"Download Firmware: Boot ready!\n" ); + } + +RT_TRACE (COMP_FIRMWARE ,"Download Firmware: Boot ready!\n" );return rt_status; CPUCheckMainCodeOKAndTurnOnCPU_Fail: -RT_TRACE (COMP_ERR ,"ERR in %s()\n" , __func__); rt_status = false;return rt_status; }
@@ -310,7 +311,7 @@ bool init_firmware(struct net_device *dev)return rt_status; download_firmware_fail: -RT_TRACE (COMP_ERR ,"ERR in %s()\n" , __func__); +netdev_err (dev,"%s: Failed to initialize firmware.\n" , __func__); rt_status = false;return rt_status;
drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c +48 -52
255 lines not on this page · raw message
drivers/staging/rtl8192e/rtl8192e/rtl_cam.c +9 -9
@@ -113,8 +113,8 @@ void setKey(struct net_device *dev, u8 EntryNo, u8 KeyIndex, u16 KeyType,if (priv->rtllib->PowerSaveControl.bInactivePs) {if (rtState == eRfOff) {if (priv->rtllib->RfOffReason >RF_CHANGE_BY_IPS ) { -RT_TRACE (COMP_ERR ,"%s(): RF is OFF.\n" , - __func__); +netdev_warn (dev,"%s(): RF is OFF.\n" , + __func__);return ; }down (&priv->rtllib->ips_sem);
@@ -124,7 +124,7 @@ void setKey(struct net_device *dev, u8 EntryNo, u8 KeyIndex, u16 KeyType, } priv->rtllib->is_set_key = true;if (EntryNo >=TOTAL_CAM_ENTRY ) -RT_TRACE (COMP_ERR ,"cam entry exceeds in setKey()\n" ); +netdev_info (dev,"%s(): Invalid CAM entry\n" , __func__); RT_TRACE(COMP_SEC, "====>to setKey(), dev:%p, EntryNo:%d, KeyIndex:%d,KeyType:%d, MacAddr %pM\n",
@@ -243,9 +243,9 @@ void CamRestoreAllEntry(struct net_device *dev) (u32 *)(&priv->rtllib->swcamtable[0 ].key_buf[0 ]) ); }else { -RT_TRACE (COMP_ERR , -"===>%s():ERR!! ADHOC TKIP ,but 0 entry is have no data\n" , - __func__); +netdev_warn (dev, +"%s(): ADHOC TKIP: missing key entry.\n" , + __func__);return ; } }
@@ -267,9 +267,9 @@ void CamRestoreAllEntry(struct net_device *dev)CAM_CONST_ADDR [0 ],0 , (u32 *)(&priv->rtllib->swcamtable[0].key_buf[0])); }else { -RT_TRACE (COMP_ERR , -"===>%s():ERR!! ADHOC CCMP ,but 0 entry is have no data\n" , - __func__); +netdev_warn (dev, +"%s(): ADHOC CCMP: missing key entry.\n" , + __func__);return ; } }
drivers/staging/rtl8192e/rtl8192e/rtl_core.c +29 -36
173 lines not on this page · raw message
drivers/staging/rtl8192e/rtl8192e/rtl_ps.c +2 -2
@@ -199,8 +199,8 @@ void rtllib_ips_leave_wq(struct net_device *dev)if (priv->rtllib->PowerSaveControl.bInactivePs) {if (rtState == eRfOff) {if (priv->rtllib->RfOffReason >RF_CHANGE_BY_IPS ) { -RT_TRACE (COMP_ERR ,"%s(): RF is OFF.\n" , - __func__); +netdev_warn (dev,"%s(): RF is OFF.\n" , + __func__);return ; } netdev_info(dev, "=========>%s(): IPSLeave\n",
drivers/staging/rtl8192e/rtl8192e/rtl_wx.c +6 -8
@@ -116,9 +116,8 @@ static int r8192_wx_set_power(struct net_device *dev,struct r8192_priv *priv =rtllib_priv (dev);if (priv->bHwRadioOff) { -RT_TRACE (COMP_ERR , -"%s():Hw is Radio Off, we can't set Power,return\n" , - __func__); +netdev_warn (dev,"%s(): Can't set Power: Radio is Off.\n" , + __func__);return 0 ; }down (&priv->wx_sem);
@@ -278,8 +277,8 @@ static int r8192_wx_set_mode(struct net_device *dev, struct iw_request_info *a,if (rtState == eRfOff) {if (priv->rtllib->RfOffReason >RF_CHANGE_BY_IPS ) { -RT_TRACE (COMP_ERR ,"%s(): RF is OFF.\n" , - __func__); +netdev_warn (dev,"%s(): RF is OFF.\n" , + __func__);up (&priv->wx_sem);return -1 ; }
@@ -438,9 +437,8 @@ static int r8192_wx_set_scan(struct net_device *dev, struct iw_request_info *a,if (rtState == eRfOff) {if (priv->rtllib->RfOffReason >RF_CHANGE_BY_IPS ) { -RT_TRACE (COMP_ERR , -"%s(): RF is OFF.\n" , - __func__); +netdev_warn (dev,"%s(): RF is OFF.\n" , + __func__);up (&priv->wx_sem);return -1 ; }
Signature · 1 line
1.8.4.1
PATCH v3 32/33 staging: rtl8192e: Fix trivial LONG_LINE errors
In reply to Mateusz KulikowskiReindent lines to make checkpatch happy.
--- drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 83 +++++++++++++++++++----------- drivers/staging/rtl8192e/rtllib_rx.c | 18 ++++--- 2 files changed, 65 insertions(+), 36 deletions(-)
drivers/staging/rtl8192e/rtl8192e/rtl_dm.c +53 -30
@@ -403,16 +403,16 @@ static void dm_check_rate_adaptive(struct net_device *dev) ((bshort_gi_enabled) ?BIT31 :0 );if (pra->ratr_state ==DM_RATR_STA_HIGH ) { - HighRSSIThreshForRA = pra->high2low_rssi_thresh_for_ra; - LowRSSIThreshForRA = (priv->CurrentChannelBW !=HT_CHANNEL_WIDTH_20 ) ? + HighRSSIThreshForRA = pra->high2low_rssi_thresh_for_ra; + LowRSSIThreshForRA = (priv->CurrentChannelBW !=HT_CHANNEL_WIDTH_20 ) ? (pra->low_rssi_thresh_for_ra40M) : (pra->low_rssi_thresh_for_ra20M); }else if (pra->ratr_state ==DM_RATR_STA_LOW ) { - HighRSSIThreshForRA = pra->high_rssi_thresh_for_ra; - LowRSSIThreshForRA = (priv->CurrentChannelBW !=HT_CHANNEL_WIDTH_20 ) ? + HighRSSIThreshForRA = pra->high_rssi_thresh_for_ra; + LowRSSIThreshForRA = (priv->CurrentChannelBW !=HT_CHANNEL_WIDTH_20 ) ? (pra->low2high_rssi_thresh_for_ra40M) : (pra->low2high_rssi_thresh_for_ra20M); }else { - HighRSSIThreshForRA = pra->high_rssi_thresh_for_ra; - LowRSSIThreshForRA = (priv->CurrentChannelBW !=HT_CHANNEL_WIDTH_20 ) ? + HighRSSIThreshForRA = pra->high_rssi_thresh_for_ra; + LowRSSIThreshForRA = (priv->CurrentChannelBW !=HT_CHANNEL_WIDTH_20 ) ? (pra->low_rssi_thresh_for_ra40M) : (pra->low_rssi_thresh_for_ra20M); }
@@ -749,7 +749,8 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev)"Avg_TSSI_Meas_from_driver = %d\n" , Avg_TSSI_Meas_from_driver); TSSI_13dBm = priv->TSSI_13dBm; -RT_TRACE (COMP_POWER_TRACKING ,"TSSI_13dBm = %d\n" , TSSI_13dBm); +RT_TRACE (COMP_POWER_TRACKING ,"TSSI_13dBm = %d\n" , + TSSI_13dBm);if (Avg_TSSI_Meas_from_driver > TSSI_13dBm) delta = Avg_TSSI_Meas_from_driver - TSSI_13dBm;
@@ -828,11 +829,13 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev)"priv->CCKPresentAttentuation = %d\n" , priv->CCKPresentAttentuation); -if (priv->CCKPresentAttentuation_difference <=-12 || priv->CCKPresentAttentuation_difference >=24 ) { +if (priv->CCKPresentAttentuation_difference <=-12 || + priv->CCKPresentAttentuation_difference >=24 ) { priv->rtllib->bdynamic_txpower_enable = true;write_nic_byte (dev, Pw_Track_Flag,0 );write_nic_byte (dev, FW_Busy_Flag,0 ); -RT_TRACE (COMP_POWER_TRACKING ,"tx power track--->limited\n" ); +RT_TRACE (COMP_POWER_TRACKING , +"tx power track--->limited\n" );return ; }
@@ -1233,18 +1236,28 @@ static void dm_bb_initialgain_restore(struct net_device *dev)return ;rtl8192_setBBreg (dev,UFWP , bMaskByte1,0x8 ); -rtl8192_setBBreg (dev, rOFDM0_XAAGCCore1, bit_mask, (u32 )priv->initgain_backup.xaagccore1); -rtl8192_setBBreg (dev, rOFDM0_XBAGCCore1, bit_mask, (u32 )priv->initgain_backup.xbagccore1); -rtl8192_setBBreg (dev, rOFDM0_XCAGCCore1, bit_mask, (u32 )priv->initgain_backup.xcagccore1); -rtl8192_setBBreg (dev, rOFDM0_XDAGCCore1, bit_mask, (u32 )priv->initgain_backup.xdagccore1); +rtl8192_setBBreg (dev, rOFDM0_XAAGCCore1, bit_mask, + (u32 )priv->initgain_backup.xaagccore1); +rtl8192_setBBreg (dev, rOFDM0_XBAGCCore1, bit_mask, + (u32 )priv->initgain_backup.xbagccore1); +rtl8192_setBBreg (dev, rOFDM0_XCAGCCore1, bit_mask, + (u32 )priv->initgain_backup.xcagccore1); +rtl8192_setBBreg (dev, rOFDM0_XDAGCCore1, bit_mask, + (u32 )priv->initgain_backup.xdagccore1); bit_mask = bMaskByte2; -rtl8192_setBBreg (dev, rCCK0_CCA, bit_mask, (u32 )priv->initgain_backup.cca); - -RT_TRACE (COMP_DIG ,"dm_BBInitialGainRestore 0xc50 is %x\n" , priv->initgain_backup.xaagccore1); -RT_TRACE (COMP_DIG ,"dm_BBInitialGainRestore 0xc58 is %x\n" , priv->initgain_backup.xbagccore1); -RT_TRACE (COMP_DIG ,"dm_BBInitialGainRestore 0xc60 is %x\n" , priv->initgain_backup.xcagccore1); -RT_TRACE (COMP_DIG ,"dm_BBInitialGainRestore 0xc68 is %x\n" , priv->initgain_backup.xdagccore1); -RT_TRACE (COMP_DIG ,"dm_BBInitialGainRestore 0xa0a is %x\n" , priv->initgain_backup.cca); +rtl8192_setBBreg (dev, rCCK0_CCA, bit_mask, + (u32 )priv->initgain_backup.cca); + +RT_TRACE (COMP_DIG ,"dm_BBInitialGainRestore 0xc50 is %x\n" , + priv->initgain_backup.xaagccore1); +RT_TRACE (COMP_DIG ,"dm_BBInitialGainRestore 0xc58 is %x\n" , + priv->initgain_backup.xbagccore1); +RT_TRACE (COMP_DIG ,"dm_BBInitialGainRestore 0xc60 is %x\n" , + priv->initgain_backup.xcagccore1); +RT_TRACE (COMP_DIG ,"dm_BBInitialGainRestore 0xc68 is %x\n" , + priv->initgain_backup.xdagccore1); +RT_TRACE (COMP_DIG ,"dm_BBInitialGainRestore 0xa0a is %x\n" , + priv->initgain_backup.cca);rtl8192_setBBreg (dev,UFWP , bMaskByte1,0x1 ); }
@@ -1277,11 +1290,16 @@ static void dm_bb_initialgain_backup(struct net_device *dev) bit_mask = bMaskByte2; priv->initgain_backup.cca = (u8 )rtl8192_QueryBBReg (dev, rCCK0_CCA, bit_mask); -RT_TRACE (COMP_DIG ,"BBInitialGainBackup 0xc50 is %x\n" , priv->initgain_backup.xaagccore1); -RT_TRACE (COMP_DIG ,"BBInitialGainBackup 0xc58 is %x\n" , priv->initgain_backup.xbagccore1); -RT_TRACE (COMP_DIG ,"BBInitialGainBackup 0xc60 is %x\n" , priv->initgain_backup.xcagccore1); -RT_TRACE (COMP_DIG ,"BBInitialGainBackup 0xc68 is %x\n" , priv->initgain_backup.xdagccore1); -RT_TRACE (COMP_DIG ,"BBInitialGainBackup 0xa0a is %x\n" , priv->initgain_backup.cca); +RT_TRACE (COMP_DIG ,"BBInitialGainBackup 0xc50 is %x\n" , + priv->initgain_backup.xaagccore1); +RT_TRACE (COMP_DIG ,"BBInitialGainBackup 0xc58 is %x\n" , + priv->initgain_backup.xbagccore1); +RT_TRACE (COMP_DIG ,"BBInitialGainBackup 0xc60 is %x\n" , + priv->initgain_backup.xcagccore1); +RT_TRACE (COMP_DIG ,"BBInitialGainBackup 0xc68 is %x\n" , + priv->initgain_backup.xdagccore1); +RT_TRACE (COMP_DIG ,"BBInitialGainBackup 0xa0a is %x\n" , + priv->initgain_backup.cca); }
@@ -1798,10 +1816,12 @@ static void dm_check_edca_turbo(struct net_device *dev)if (!priv->bis_cur_rdlstate || !priv->bcurrent_turbo_EDCA) {if (priv->rtllib->mode ==WIRELESS_MODE_G ) -write_nic_dword (dev,EDCAPARA_BE , +write_nic_dword (dev, +EDCAPARA_BE , edca_setting_DL_GMode[pHTInfo->IOTPeer]);else -write_nic_dword (dev,EDCAPARA_BE , +write_nic_dword (dev, +EDCAPARA_BE , edca_setting_DL[pHTInfo->IOTPeer]); priv->bis_cur_rdlstate = true; }
@@ -1809,12 +1829,15 @@ static void dm_check_edca_turbo(struct net_device *dev) priv->bcurrent_turbo_EDCA = true; }else {if (curRxOkCnt >4 *curTxOkCnt) { -if (!priv->bis_cur_rdlstate || !priv->bcurrent_turbo_EDCA) { +if (!priv->bis_cur_rdlstate || + !priv->bcurrent_turbo_EDCA) {if (priv->rtllib->mode ==WIRELESS_MODE_G ) -write_nic_dword (dev,EDCAPARA_BE , +write_nic_dword (dev, +EDCAPARA_BE , edca_setting_DL_GMode[pHTInfo->IOTPeer]);else -write_nic_dword (dev,EDCAPARA_BE , +write_nic_dword (dev, +EDCAPARA_BE , edca_setting_DL[pHTInfo->IOTPeer]); priv->bis_cur_rdlstate = true; }
drivers/staging/rtl8192e/rtllib_rx.c +12 -6
@@ -1260,14 +1260,16 @@ static void rtllib_rx_indicate_pkt_legacy(struct rtllib_device *ieee,struct sk_buff *sub_skb = rxb->subframes[i];if (sub_skb) { -/* convert hdr + possible LLC headers into Ethernet header */ +/* convert hdr + possible LLC headers +* into Ethernet header +*/ ethertype = (sub_skb->data[6 ] <<8 ) | sub_skb->data[7 ];if (sub_skb->len >=8 && ((memcmp (sub_skb->data, rfc1042_header,SNAP_SIZE ) ==0 && ethertype !=ETH_P_AARP && ethertype !=ETH_P_IPX ) ||memcmp (sub_skb->data, bridge_tunnel_header,SNAP_SIZE ) ==0 )) { -/* remove RFC1042 or Bridge-Tunnel encapsulation and -* replace EtherType +/* remove RFC1042 or Bridge-Tunnel encapsulation +* and replace EtherType */ skb_pull (sub_skb,SNAP_SIZE ); ether_addr_copy(skb_push(sub_skb, ETH_ALEN),
@@ -1276,7 +1278,9 @@ static void rtllib_rx_indicate_pkt_legacy(struct rtllib_device *ieee, dst); }else {u16 len; -/* Leave Ethernet header part of hdr and full payload */ +/* Leave Ethernet header part of hdr +* and full payload +*/ len = sub_skb->len;memcpy (skb_push (sub_skb,2 ), &len,2 ); ether_addr_copy(skb_push(sub_skb, ETH_ALEN),
@@ -1297,7 +1301,8 @@ static void rtllib_rx_indicate_pkt_legacy(struct rtllib_device *ieee, sub_skb->dev = dev; sub_skb->dev->stats.rx_packets++; sub_skb->dev->stats.rx_bytes += sub_skb->len; - sub_skb->ip_summed =CHECKSUM_NONE ;/* 802.11 crc not sufficient */ +/* 802.11 crc not sufficient */ + sub_skb->ip_summed =CHECKSUM_NONE ;netif_rx (sub_skb); } }
@@ -1839,7 +1844,8 @@ static void rtllib_parse_mife_generic(struct rtllib_device *ieee, info_element->data[1 ] ==0x90 && info_element->data[2 ] ==0x4c && info_element->data[3] == 0x033) { - *tmp_htcap_len =min_t (u8, info_element->len,MAX_IE_LEN ); + *tmp_htcap_len =min_t (u8, info_element->len, +MAX_IE_LEN );if (*tmp_htcap_len !=0 ) { network->bssht.bdHTSpecVer =HT_SPEC_VER_EWC ; network->bssht.bdHTCapLen =min_t (u16, *tmp_htcap_len,sizeof (network->bssht.bdHTCapBuf));
Signature · 1 line
1.8.4.1
PATCH v3 33/33 staging: rtl8192e: rtl8192E_suspend(): Fix WOL reporting
In reply to Mateusz KulikowskiWOL capability was reported in an awkward way - print it nicely.
--- drivers/staging/rtl8192e/rtl8192e/rtl_pm.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/staging/rtl8192e/rtl8192e/rtl_pm.c +2 -4
@@ -57,10 +57,8 @@ int rtl8192E_suspend(struct pci_dev *pdev, pm_message_t state)write_nic_byte (dev, MacBlkCtrl,0xa ); } out_pci_suspend: -netdev_info (dev,"r8192E support WOL call??????????????????????\n" ); -if (priv->rtllib->bSupportRemoteWakeUp) -RT_TRACE (COMP_POWER , -"r8192E support WOL call!!!!!!!!!!!!!!!!!!.\n" ); +netdev_info (dev,"WOL is %s\n" , priv->rtllib->bSupportRemoteWakeUp ? +"Supported" :"Not supported" );pci_save_state (pdev);pci_disable_device (pdev); pci_enable_wake(pdev, pci_choose_state(pdev, state),
Signature · 1 line
1.8.4.1