Commit Graph

1297 Commits

Author SHA1 Message Date
Malcolm Priestley 3466a8c15b staging: vt6656: Fix warning: unused variable vnt_frame_time
In commit 61bb798767
("staging: vt6656: vnt_get_rtscts_rsvtime_le replace with rts/cts duration.")
not quite all of the code was removed.

Remove unused vnt_frame_time variable.

Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/5096f399-03e7-77e1-b334-947aabc44d14@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-05-27 12:23:11 +02:00
Malcolm Priestley 5f46e3cde5 staging: vt6656: Move vnt_tx_usb_header to vnt_tx_context
Move the USB element out of vnt_tx_packet and vnt_beacon_xmit to
vnt_tx_context with sk_buff passed in parameters with the data now
between skb->data and skb->len.

The vnt_tx_usb header is moved from vnt_tx_buffer to usbpipe.h with the
size added to extra_tx_headroom the largest possible size.

The CONTEXT enums types are aligned with usb ones and CONTEXT_MGMT_PACKET
is removed and is never be used.

The skb_push in vnt_tx_packet is now only ever used with
vnt_get_hdr_size with variables tx_bytes and tx_header_size removed.

buf_len in vnt_usb_send_context is no longer used and replaced with
urb->actual_length in vnt_tx_context_complete.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/aa6257eb-1758-4e75-ab39-2a15ff6ffa7c@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-05-27 12:23:10 +02:00
Malcolm Priestley 7077256b52 staging: vt6656: vnt_tx_packet use skb_clone to preserve sk_buff.
The sk_buff needs to preserved for copying to various parts
of context and passing back to mac80211

clone sk_buff in context so to continue to writing to orginal
sk_buff data area to send in vnt_tx_context.

dev_kfree_skb the context on error or dev_kfree_skb the
orignal when done. The error handling continues as before.

Only one place in function needs to change from
ieee80211_get_hdrlen_from_skb to ieee80211_hdrlen(hdr) which
is already to pointing to correct position.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/b87e8cc1-f584-989d-830b-609d712f08c7@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-05-27 12:23:10 +02:00
Malcolm Priestley a069cd178f staging: vt6656: Fix vnt_tx_usb_header static checker warning
drivers/staging/vt6656/rxtx.c:729 vnt_beacon_xmit()
warn: struct type mismatch 'vnt_beacon_buffer vs vnt_tx_usb_header'

Since the only part of vnt_beacon_buffer is used remove and
replace it with vnt_tx_usb_header.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/9818e564-81f6-a683-caa0-69423fded401@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-05-27 10:16:33 +02:00
Malcolm Priestley 1dfb74b1ea staging: vt6656: move key frag controls to vnt_fill_txkey
vnt_fill_txkey now has access to tx_buffer move cipher frag controls

The icv_len is the only thing needed from hw_key in vnt_tx_packet.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/bb91b159-387a-005b-f614-c541de128c40@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-05-22 11:02:28 +02:00
Malcolm Priestley dc6490b0c5 staging: vt6656: Move calling point of vnt_fill_txkey.
Change vnt_fill_txkey to return true if mic_hdr is needed and
change calling point at where it is to be placed.

tx_buffer is already in tx_context.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/f08a6f07-a77e-0b8e-cb05-505a1f995683@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-05-22 11:02:28 +02:00
Malcolm Priestley 4f1b5df420 staging: vt6656: Move tx_key inside vnt_fill_txkey.
tx_key can be got directly from info.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/1b964a6c-5cf7-e675-cf53-3a632acc0be9@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-05-22 11:02:28 +02:00
Malcolm Priestley f79c9fa340 staging: vt6656: move tx_body_size/payload_len to skb->len
both variables can be removed and replaced with skb->len.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/12e96cb5-a2a5-de3c-ebe7-ca5a4e2b5594@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-05-22 11:02:27 +02:00
Malcolm Priestley cf51f55311 staging: vt6656: Move key_buffer inside vnt_fill_txkey.
Use vnt_tx_fifo_head to point directly at tx_key removing key_buffer.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/3631f327-1386-90a2-ba9a-bb62617f3c66@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-05-22 11:02:27 +02:00
Malcolm Priestley e76d9db0cb staging: vt6656: rxtx use ieee80211_tx_info for rts/cts control
Use the control for rts/cts exhanges replacing need_rts and use_cts_prot for
packet type PK_TYPE_11GB / PK_TYPE_11GA

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/1b21b3db-b9ef-c167-8f88-b32646ba5a19@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-05-22 11:02:27 +02:00
Malcolm Priestley 017af521a7 staging: vt6656: use ieee80211_tx_info to replace need_mic
Use the info->control.hw_key to replace need mic which is only
present when info->control.hw_key->cipher == WLAN_CIPHER_SUITE_CCMP.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/e8969f47-ffc7-6eb6-9f3c-72b06970c1b8@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-05-22 11:02:27 +02:00
Malcolm Priestley 272c25c62e staging: vt6656: Move vnt_mic_hdr pointers to vnt_fill_txkey
mic_hdr has three possible locations ieee80211_tx_info can controls
these with control.use_cts_prot for rts or cts exchange or otherwise
the rts/data position.

Removing double pointer.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/6420a6ae-82eb-f794-fa7c-bac419222ad6@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-05-22 11:02:26 +02:00
Malcolm Priestley a0b44f1422 staging: vt6656: rxtx remove unused need_ack
need_ack is no longer used by driver remove it.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/f19dfbde-23a6-ba79-d988-576d2e3bcf62@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-05-22 11:02:26 +02:00
Malcolm Priestley 461aac1cbc staging: vt6656: remove ieee80211_hdr from vnt_usb_send_context.
It is only used in one place were it can be pointed to at skb->data.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/556fab01-aa1e-154e-149e-c04feeb76efa@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-05-22 11:02:26 +02:00
Malcolm Priestley cf5ffd22e4 staging: vt6656: use usb_anchor for tx queue.
Use usb_anchor to track tx submitted urbs and initialize the
urb as needed in vnt_tx_context.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/077f42f8-4f7f-adc4-5a14-955165cef9f1@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-05-19 16:17:19 +02:00
Malcolm Priestley 9786f8b2f7 staging: vt6656: vnt_usb_send_context remove variable data.
A limit is also placed in vnt_tx_context of MAX_TOTAL_SIZE_WITH_ALL_HEADERS
limiting size.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/9416e1a8-bd72-ffb1-5366-78361d053907@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-05-19 16:17:18 +02:00
Malcolm Priestley 9deca1e3e2 staging: vt6656: vnt_beacon_xmit use extra_tx_headroom.
Create room for vnt_tx_short_buf_head in sk_buff and vnt_tx_usb_header.

The struct ieee80211_mgmt is not longer in the header and is at
the initial skb->data point.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/5f00d319-9242-65b2-d100-dcfe9b0e32be@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-05-19 16:17:18 +02:00
Malcolm Priestley abfd23743d staging: vt6656: Use sk_buff buffer for tx header
mac80211 can provide space for the driver to put a tx header on
the skb buffer instead coping the entire frame on to a local
buffer with the header.

To use this extra_tx_headroom must be set in mac80211 with the largest
possible header which is struct vnt_tx_buffer.

The driver has 8 possible combinations of tx header size which
are found in vnt_get_hdr_size replacing vnt_mac_hdr_pos.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/7b967bfc-1d4b-4b45-efab-d54f16cca226@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-05-19 16:17:18 +02:00
Matej Dujava 3abbab5132 staging: vt6656: vt6655: removing unused macros definition Makefiles
This patch is removing definition of CFLAGS in Makefile of vt6656 and
vt6655, as those are defining macros that are not used. This will remove
undef of one macro from vt6655/device_main.c, as it is only undef and it is
not used anywhere else, so it is safe to remove it.

Macros are removed from vt665x/Makefile and vt6655/device_main.c.

Signed-off-by: Matej Dujava <mdujava@kocurkovo.cz>
Link: https://lore.kernel.org/r/1589397351-24655-2-git-send-email-mdujava@kocurkovo.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-05-15 15:49:13 +02:00
Oscar Carter 8a01032e02 staging: vt6656: Remove logically dead code
In the start of the "vnt_rf_set_txpower" function the "power" variable
is set at most to VNT_RF_MAX_POWER (hex = 0x3f, dec = 63). Then, in the
switch statement there are four comparisons with the "power" variable
against AL7230_PWR_IDX_LEN (dec = 64), VT3226_PWR_IDX_LEN (dec = 64),
VT3342_PWR_IDX_LEN (dec = 64). Due to all the commented comparisons are
to check if the "power" variable is "greater than or equal" to 64, this
never happens. So, remove the logically dead code.

Also, remove all the defines that are no longer required.

Addresses-Coverity-ID: 1230228 ("Logically dead code")
Fixes: f53d9f12c5 ("staging: vt6656: rf.c additional power.")
Signed-off-by: Oscar Carter <oscar.carter@gmx.com>
Link: https://lore.kernel.org/r/20200510090950.7633-1-oscar.carter@gmx.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-05-13 13:58:44 +02:00
Malcolm Priestley 9a6f87704a staging: vt6656: remove difs / sifs adjustments.
Now mac89211 is doing frame timing in rxtx these vendor adjustments need
to be removed.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/034e445c-b245-52c4-c855-431b9783bcff@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-05-13 13:53:58 +02:00
Malcolm Priestley 61bb798767 staging: vt6656: vnt_get_rtscts_rsvtime_le replace with rts/cts duration.
rsvtime is the time needed in firmware to process the received
frame time in firmware so they can be the same as vnt_get_rts_duration
or vnt_get_cts_duration where appropriate.

The rts_rrv_time are now all the same timing in vnt_rxtx_rts.

So vnt_get_rtscts_rsvtime_le and and vnt_get_frame_time are no longer
required.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/4c0fe356-7e08-bf66-58b7-5ab683ba9536@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-05-13 13:53:58 +02:00
Malcolm Priestley 8e7128f63d staging: vt6656: Split RTS and CTS Duration functions
split vnt_get_rtscts_duration_le into vnt_get_rts_duration and
vnt_get_cts_duration.

The duration's are all the same in vnt_rxtx_rts_g_head.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/d2983161-7935-48ce-c0ca-a26ebafa3997@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-05-13 13:53:57 +02:00
Malcolm Priestley 7a83f73645 staging: vt6656: vnt_get_rtscts_duration_le use ieee80211_ctstoself_duration
use the mac80211 ieee80211_ctstoself_duration for CTS to self frames.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/f12b3d71-eb61-340b-e473-83509d9bc38a@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-05-13 13:53:57 +02:00
Malcolm Priestley 57b4b0e68d staging: vt6656: vnt_rxtx_rsvtime_le16 to use ieee80211_generic_frame_duration.
ieee80211_generic_frame_duration is the mac80211 equivalent to
vnt_get_rsvtime use this to get our frame time.

There is a change where there is rrv_time_a and rrv_time_b
the frame duration is always the same so both are equal.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/acff7fcc-0add-652b-7d07-22001b641257@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-05-13 13:53:54 +02:00
Malcolm Priestley c5de40e58f staging: vt6656: vnt_get_rtscts_duration_le use ieee80211_rts_duration
use the mac80211 ieee80211_rts_duration for RTS frames.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/377a4cc3-cfe3-91aa-cf71-1063f311426a@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-05-13 13:53:07 +02:00
Oscar Carter 2e11cc1ab7 staging: vt6656: Use const for read only data
Use const for the arrays that are used as "read only". Also, modify the
prototype of vnt_control_out_blocks() function to use a pointer to a
const type.

The vnt_vt3184_al2230 array can't be converted to const as it's modified
later.

Then in the vnt_vt3184_init() function use two types of pointers (to
const type and to no const type) to avoid the compiler warning:

assignment discards 'const' qualifiers from pointer target type

This way decrease the .data section and increase the .rodata section
limiting the surface attack.

Before this change:
-------------------

drivers/staging/vt6656/baseband.o  :
section              size   addr
.text                1278      0
.data                 576      0
.bss                    0      0
.rodata               319      0
.comment               45      0
.note.GNU-stack         0      0
.note.gnu.property     32      0
Total                2250

After this change:
------------------

drivers/staging/vt6656/baseband.o  :
section              size   addr
.text                1278      0
.data                 256      0
.bss                    0      0
.rodata               640      0
.comment               45      0
.note.GNU-stack         0      0
.note.gnu.property     32      0
Total                2251

Signed-off-by: Oscar Carter <oscar.carter@gmx.com>
Link: https://lore.kernel.org/r/20200504171414.11307-1-oscar.carter@gmx.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-05-05 12:33:00 +02:00
Malcolm Priestley d95c8695e0 staging: vt6656: refactor power save operation
At present the power save wake uses the listening interval and
the slow path to wake up.

The following using a beacon interval of 100 and
listen interval of 5.

The TBTT set at 100 wake-up sequence;
100 TBTT wake-up set to listen interval.
200 TBTT
300 TBTT
400 TBTT --> call vnt_next_tbtt_wakeup on slow path
	Beacon heard and passed through at the approx 500 interval.
500 TBTT
600 TBTT wake-up set to listen interval

The TBTT set at 500 wake-up sequence and always listen flagged on;
100 No TBTT
200 No TBTT
300 No TBTT
400 No TBTT
500 TBTT - beacon heard and passed through
600 No TBTT

A further enhancement because the TBTT is more precise
the dtim_period can be used instead.

When Power save is off the TBTT continues to run at the listen
interval but all the other beacons are passed.

The code in vnt_int_process_data is no longer required.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/5a188bd8-7049-8063-f24d-96768ce9a6ed@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-05-05 12:28:00 +02:00
Malcolm Priestley 986da7debb staging: vt6656: Return on isr0 when zero.
When isr0 is zero there is nothing more todo so return and
pull following code in.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/8dccc74d-d0bb-e8e7-df81-dfd81e3fd7d8@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-05-05 12:28:00 +02:00
Malcolm Priestley 3ce6b741bc staging: vt6656: use struct wiphy retry short and long settings.
Remove driver options for short and long retry and use the ones
set by user in wiphy.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/fbb8da09-ee46-2249-ff29-daaaff1a64e6@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-05-05 12:28:00 +02:00
Malcolm Priestley f4269d4862 staging: vt6656: return all key calls to mac80211 stack.
vnt_mac_set_keyentry can return USB calls so return them to
mac80211.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/f1be8ba0-9513-55cb-de9d-dcd4341e5b78@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-05-05 12:27:59 +02:00
Malcolm Priestley ddaa877f2d staging: vt6656 remove vnt_mac_disable_keyentry calls
It is not necessary to disable all the keys mac80211 will
have removed any existing keys that were used.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/844df68d-08e2-7672-524f-42b918e300c1@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-05-05 12:27:59 +02:00
Malcolm Priestley 41f1efcb4a staging: vt6656: vnt_set_keymode simplify key modes.
Unused macros and onfly_latch are removed and others contain
to actual key_type value is or-ed with key_mode.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/0eb6f5bb-f756-ab1d-5b63-db9b0dc422da@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-05-05 12:26:44 +02:00
Oscar Carter ae22020487 staging: vt6656: Refactor the vnt_rf_table_download function
Create a constant array of struct vnt_table_info type elements with the
necessary info (address and length) about all the rf tables for every rf
type.

In every case of the "switch" statement replace the hardcoded info about
these tables with and index to the new constant array. Moreover, use
this array index to extract the necessary info in every call to the
vnt_control_out_* functions.

Check if this index has been set and return without error otherwise.
So, avoid the execution of code that previously did nothing due to
lengths with values of zero for some rf types.

Also remove all the variables that are now unused.

This way reduce the stack footprint, and make the code more clear.

Signed-off-by: Oscar Carter <oscar.carter@gmx.com>
Link: https://lore.kernel.org/r/20200429153838.7216-1-oscar.carter@gmx.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-05-05 12:26:44 +02:00
Oscar Carter 91387f5eb9 staging: vt6656: Refactor the vnt_set_bss_mode function
Remove all the duplicate code in the "if, else if, else" statements as
all the branches in every "if" are almost the same. The only difference
between branches is some value. So, use variables instead of repeat
code.

Also, remove the unnecessary casting to u8 type because the
"priv->bb_type" variable is already an u8 tpe.

Signed-off-by: Oscar Carter <oscar.carter@gmx.com>
Link: https://lore.kernel.org/r/20200429152307.5871-3-oscar.carter@gmx.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-05-05 12:26:43 +02:00
Oscar Carter 35452e1061 staging: vt6656: Check the return values in vnt_set_bss_mode function
Check the return value of all the functions that return zero if
successful or a negative error code on failure inside the function
vnt_set_bss_mode.

Also, remove the unnecessary variable initialization as this variable is
set a few lines later.

Signed-off-by: Oscar Carter <oscar.carter@gmx.com>
Link: https://lore.kernel.org/r/20200429152307.5871-2-oscar.carter@gmx.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-05-05 12:26:43 +02:00
Oscar Carter 10b674be0a staging: vt6656: Remove duplicate code in vnt_rf_table_download
Replace three while loops with three calls to the vnt_control_out_blocks
function. This way avoid repeat a functionality that already exists.

Also remove the variables that now are not used.

Signed-off-by: Oscar Carter <oscar.carter@gmx.com>
Link: https://lore.kernel.org/r/20200425151747.8199-4-oscar.carter@gmx.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-28 14:26:29 +02:00
Oscar Carter d78b62c3ea staging: vt6656: Use return instead of goto
Replace the "goto" statements with a direct "return ret" as the jump
label only returns the ret variable.

Also, remove the unnecessary variable initialization because the ret
variable is set a few lines later.

Signed-off-by: Oscar Carter <oscar.carter@gmx.com>
Link: https://lore.kernel.org/r/20200425151747.8199-3-oscar.carter@gmx.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-28 14:26:29 +02:00
Oscar Carter 8a5baa66b0 staging: vt6656: Remove the local variable "array"
Remove the local variable "array" and all the memcpy function calls
because this copy operation from different arrays to this variable is
unnecessary.

The vnt_control_out function already does a kmemdup copy of its const
char *buffer argument and this was made unnecessary by:

commit 12ecd24ef9
("staging: vt6656: use off stack for out buffer USB transfers.")
Author: Malcolm Priestley <tvboxspy@gmail.com>
Date:   Sat Apr 22 11:14:57 2017 +0100

    staging: vt6656: use off stack for out buffer USB transfers.

    Since 4.9 mandated USB buffers be heap allocated this causes the driver
    to fail.

    Since there is a wide range of buffer sizes use kmemdup to create
    allocated buffer.

So, the same result can be achieved using the arrays directly.

Signed-off-by: Oscar Carter <oscar.carter@gmx.com>
Link: https://lore.kernel.org/r/20200425151747.8199-2-oscar.carter@gmx.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-28 14:26:29 +02:00
Malcolm Priestley 9075e3180e staging: vt6656: Remove preamble_type setting from vnt_tx_packet.
preamble_type is set in vnt_bss_info_changed no need to set it
here.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/04874ae5-0859-7cb5-619a-ac96a207be5d@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-28 14:25:26 +02:00
Malcolm Priestley 7d1a8c9849 staging: vt6656: Remove set short time in vnt_init_registers.
The short time is set in vnt_bss_info_changed no need to set it
here.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/a2bfc4f5-3f7f-3718-6056-2907a004477f@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-28 14:25:26 +02:00
Malcolm Priestley ea0c2a6214 staging: vt6656: rxtx: remove duration_id and void returns.
duration_id is not used by driver anymore so remove the returns
and set all functions in patch to void.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/04a9c19f-c374-c175-6e46-d1bfbab2f42e@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-28 14:19:13 +02:00
Oscar Carter 345f2d84dd staging: vt6656: Add formula to the vnt_rf_addpower function
Use a formula to calculate the return value of the vnt_rf_addpower
function instead of the "if" statement with literal values for every
case.

Signed-off-by: Oscar Carter <oscar.carter@gmx.com>
Link: https://lore.kernel.org/r/20200425141514.5528-1-oscar.carter@gmx.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-28 14:19:13 +02:00
Oscar Carter f5e5e3024c staging: vt6656: Remove functions' documentation
Remove the functions' documentation as the names of the functions are
clear enought. Also, the actual documentation it's not correct in all
cases.

Signed-off-by: Oscar Carter <oscar.carter@gmx.com>
Link: https://lore.kernel.org/r/20200425134257.4502-3-oscar.carter@gmx.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-28 14:16:50 +02:00
Oscar Carter 81969fd8ab staging: vt6656: Check the return value of vnt_control_out_* calls
Check the return value of vnt_control_out_* function calls. When
necessary modify the function prototype to be able to return the new
checked error code.

It's safe to modify all the function prototypes without fix the call
because the only change is the return value from void to int. If before
the call didn't check the return value, now neither.

Signed-off-by: Oscar Carter <oscar.carter@gmx.com>
Link: https://lore.kernel.org/r/20200425134257.4502-2-oscar.carter@gmx.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-28 14:16:49 +02:00
Greg Kroah-Hartman e8014d83f6 Merge 5.7-rc3 into staging-next
We need the staging fixes in here too, and this resolves a merge issue
with the vt6656 driver.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-27 12:20:40 +02:00
Malcolm Priestley 664ba51802 staging: vt6656: Fix calling conditions of vnt_set_bss_mode
vnt_set_bss_mode needs to be called on all changes to BSS_CHANGED_BASIC_RATES,
BSS_CHANGED_ERP_PREAMBLE and BSS_CHANGED_ERP_SLOT

Remove all other calls and vnt_update_ifs which is called in vnt_set_bss_mode.

Fixes an issue that preamble mode is not being updated correctly.

Fixes: c12603576e ("staging: vt6656: Only call vnt_set_bss_mode on basic rates change.")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/44110801-6234-50d8-c583-9388f04b486c@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-23 13:47:34 +02:00
Malcolm Priestley 0b59f10b1d staging: vt6656: Fix pairwise key entry save.
The problem is that the group key was saved as VNT_KEY_DEFAULTKEY
was over written by the VNT_KEY_GROUP_ADDRESS index.

mac80211 could not clear the mac_addr in the default key.

The VNT_KEY_DEFAULTKEY is not necesscary so remove it and set as
VNT_KEY_GROUP_ADDRESS.

mac80211 can clear any key using vnt_mac_disable_keyentry.

Fixes: f9ef05ce13 ("staging: vt6656: Fix pairwise key for non station modes")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/da2f7e7f-1658-1320-6eee-0f55770ca391@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-23 13:44:32 +02:00
Malcolm Priestley 09057742af staging: vt6656: Fix drivers TBTT timing counter.
The drivers TBTT counter is not synchronized with mac80211 timestamp.

Reorder the functions and use vnt_update_next_tbtt to do the final
synchronize.

Fixes: c15158797d ("staging: vt6656: implement TSF counter")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/375d0b25-e8bc-c8f7-9b10-6cc705d486ee@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-23 13:43:55 +02:00
Malcolm Priestley 0f8240bfc0 staging: vt6656: Don't set RCR_MULTICAST or RCR_BROADCAST by default.
mac80211/users control whether multicast is on or off don't enable it by default.

Fixes an issue when multicast/broadcast is always on allowing other beacons through
in power save.

Fixes: db8f37fa33 ("staging: vt6656: mac80211 conversion: main_usb add functions...")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Link: https://lore.kernel.org/r/2c24c33d-68c4-f343-bd62-105422418eac@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-23 13:43:38 +02:00