License cleanup: add SPDX GPL-2.0 license identifier to files with no license
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.
By default all files without license information are under the default
license of the kernel, which is GPL version 2.
Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier. The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.
This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.
How this work was done:
Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
- file had no licensing information it it.
- file was a */uapi/* one with no licensing information in it,
- file was a */uapi/* one with existing licensing information,
Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.
The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne. Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.
The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed. Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.
Criteria used to select files for SPDX license identifier tagging was:
- Files considered eligible had to be source code files.
- Make and config files were included as candidates if they contained >5
lines of source
- File already had some variant of a license header in it (even if <5
lines).
All documentation files were explicitly excluded.
The following heuristics were used to determine which SPDX license
identifiers to apply.
- when both scanners couldn't find any license traces, file was
considered to have no license information in it, and the top level
COPYING file license applied.
For non */uapi/* files that summary was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 11139
and resulted in the first patch in this series.
If that file was a */uapi/* path one, it was "GPL-2.0 WITH
Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 WITH Linux-syscall-note 930
and resulted in the second patch in this series.
- if a file had some form of licensing information in it, and was one
of the */uapi/* ones, it was denoted with the Linux-syscall-note if
any GPL family license was found in the file or had no licensing in
it (per prior point). Results summary:
SPDX license identifier # files
---------------------------------------------------|------
GPL-2.0 WITH Linux-syscall-note 270
GPL-2.0+ WITH Linux-syscall-note 169
((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21
((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17
LGPL-2.1+ WITH Linux-syscall-note 15
GPL-1.0+ WITH Linux-syscall-note 14
((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5
LGPL-2.0+ WITH Linux-syscall-note 4
LGPL-2.1 WITH Linux-syscall-note 3
((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3
((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1
and that resulted in the third patch in this series.
- when the two scanners agreed on the detected license(s), that became
the concluded license(s).
- when there was disagreement between the two scanners (one detected a
license but the other didn't, or they both detected different
licenses) a manual inspection of the file occurred.
- In most cases a manual inspection of the information in the file
resulted in a clear resolution of the license that should apply (and
which scanner probably needed to revisit its heuristics).
- When it was not immediately clear, the license identifier was
confirmed with lawyers working with the Linux Foundation.
- If there was any question as to the appropriate license identifier,
the file was flagged for further research and to be revisited later
in time.
In total, over 70 hours of logged manual review was done on the
spreadsheet to determine the SPDX license identifiers to apply to the
source files by Kate, Philippe, Thomas and, in some cases, confirmation
by lawyers working with the Linux Foundation.
Kate also obtained a third independent scan of the 4.13 code base from
FOSSology, and compared selected files where the other two scanners
disagreed against that SPDX file, to see if there was new insights. The
Windriver scanner is based on an older version of FOSSology in part, so
they are related.
Thomas did random spot checks in about 500 files from the spreadsheets
for the uapi headers and agreed with SPDX license identifier in the
files he inspected. For the non-uapi files Thomas did random spot checks
in about 15000 files.
In initial set of patches against 4.14-rc6, 3 files were found to have
copy/paste license identifier errors, and have been fixed to reflect the
correct identifier.
Additionally Philippe spent 10 hours this week doing a detailed manual
inspection and review of the 12,461 patched files from the initial patch
version early this week with:
- a full scancode scan run, collecting the matched texts, detected
license ids and scores
- reviewing anything where there was a license detected (about 500+
files) to ensure that the applied SPDX license was correct
- reviewing anything where there was no detection but the patch license
was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
SPDX license was correct
This produced a worksheet with 20 files needing minor correction. This
worksheet was then exported into 3 different .csv files for the
different types of files to be modified.
These .csv files were then reviewed by Greg. Thomas wrote a script to
parse the csv files and add the proper SPDX tag to the file, in the
format that the file expected. This script was further refined by Greg
based on the output to detect more types of files automatically and to
distinguish between header and source .c files (which need different
comment types.) Finally Greg ran the script using the .csv files to
generate the patches.
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-01 08:07:57 -06:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2009-11-03 02:17:11 -07:00
|
|
|
/******************************************************************************
|
2013-06-25 19:21:43 -06:00
|
|
|
*
|
|
|
|
* (c) Copyright 2008, RealTEK Technologies Inc. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Module: r819xusb_cmdpkt.c
|
|
|
|
* (RTL8190 TX/RX command packet handler Source C File)
|
|
|
|
*
|
|
|
|
* Note: The module is responsible for handling TX and RX command packet.
|
|
|
|
* 1. TX : Send set and query configuration command packet.
|
|
|
|
* 2. RX : Receive tx feedback, beacon state, query configuration
|
|
|
|
* command packet.
|
|
|
|
*
|
|
|
|
* Function:
|
|
|
|
*
|
|
|
|
* Export:
|
|
|
|
*
|
|
|
|
* Abbrev:
|
|
|
|
*
|
|
|
|
* History:
|
|
|
|
*
|
|
|
|
* Date Who Remark
|
|
|
|
* 05/06/2008 amy Create initial version porting from
|
|
|
|
* windows driver.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
2009-11-03 02:17:11 -07:00
|
|
|
#include "r8192U.h"
|
|
|
|
#include "r819xU_cmdpkt.h"
|
2013-06-25 19:21:43 -06:00
|
|
|
|
2013-06-25 19:21:42 -06:00
|
|
|
rt_status SendTxCommandPacket(struct net_device *dev, void *pData, u32 DataLen)
|
2009-11-03 02:17:11 -07:00
|
|
|
{
|
|
|
|
struct r8192_priv *priv = ieee80211_priv(dev);
|
|
|
|
struct sk_buff *skb;
|
2017-02-12 00:26:23 -07:00
|
|
|
struct cb_desc *tcb_desc;
|
2009-11-03 02:17:11 -07:00
|
|
|
|
2013-06-25 19:21:43 -06:00
|
|
|
/* Get TCB and local buffer from common pool.
|
2017-02-15 22:31:07 -07:00
|
|
|
* (It is shared by CmdQ, MgntQ, and USB coalesce DataQ)
|
|
|
|
*/
|
2009-11-03 02:17:11 -07:00
|
|
|
skb = dev_alloc_skb(USB_HWDESC_HEADER_LEN + DataLen + 4);
|
2013-09-20 09:11:27 -06:00
|
|
|
if (!skb)
|
|
|
|
return RT_STATUS_FAILURE;
|
2013-06-25 19:21:42 -06:00
|
|
|
memcpy((unsigned char *)(skb->cb), &dev, sizeof(dev));
|
2017-02-12 00:26:23 -07:00
|
|
|
tcb_desc = (struct cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE);
|
2009-11-03 02:17:11 -07:00
|
|
|
tcb_desc->queue_index = TXCMD_QUEUE;
|
|
|
|
tcb_desc->bCmdOrInit = DESC_PACKET_TYPE_NORMAL;
|
|
|
|
tcb_desc->bLastIniPkt = 0;
|
|
|
|
skb_reserve(skb, USB_HWDESC_HEADER_LEN);
|
2017-06-18 08:52:04 -06:00
|
|
|
skb_put_data(skb, pData, DataLen);
|
2013-06-25 19:21:42 -06:00
|
|
|
tcb_desc->txbuf_size = (u16)DataLen;
|
2009-11-03 02:17:11 -07:00
|
|
|
|
2013-06-25 19:21:42 -06:00
|
|
|
if (!priv->ieee80211->check_nic_enough_desc(dev, tcb_desc->queue_index) ||
|
2013-06-25 19:21:45 -06:00
|
|
|
(!skb_queue_empty(&priv->ieee80211->skb_waitQ[tcb_desc->queue_index])) ||
|
|
|
|
(priv->ieee80211->queue_stop)) {
|
|
|
|
RT_TRACE(COMP_FIRMWARE, "=== NULL packet ======> tx full!\n");
|
|
|
|
skb_queue_tail(&priv->ieee80211->skb_waitQ[tcb_desc->queue_index], skb);
|
|
|
|
} else {
|
|
|
|
priv->ieee80211->softmac_hard_start_xmit(skb, dev);
|
|
|
|
}
|
2009-11-03 02:17:11 -07:00
|
|
|
|
2014-05-26 08:08:50 -06:00
|
|
|
return RT_STATUS_SUCCESS;
|
2009-11-03 02:17:11 -07:00
|
|
|
}
|
|
|
|
|
2018-07-29 15:07:33 -06:00
|
|
|
static void cmpk_count_txstatistic(struct net_device *dev, struct cmd_pkt_tx_feedback *pstx_fb)
|
2009-11-03 02:17:11 -07:00
|
|
|
{
|
|
|
|
struct r8192_priv *priv = ieee80211_priv(dev);
|
|
|
|
#ifdef ENABLE_PS
|
|
|
|
RT_RF_POWER_STATE rtState;
|
|
|
|
|
2013-06-25 19:21:45 -06:00
|
|
|
pAdapter->HalFunc.GetHwRegHandler(pAdapter, HW_VAR_RF_STATE,
|
|
|
|
(pu1Byte)(&rtState));
|
2009-11-03 02:17:11 -07:00
|
|
|
|
2013-06-25 19:21:43 -06:00
|
|
|
/* When RF is off, we should not count the packet for hw/sw synchronize
|
2017-02-15 22:31:07 -07:00
|
|
|
* reason, ie. there may be a duration while sw switch is changed and
|
|
|
|
* hw switch is being changed.
|
|
|
|
*/
|
2009-11-03 02:17:11 -07:00
|
|
|
if (rtState == eRfOff)
|
|
|
|
return;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef TODO
|
2013-05-13 11:15:55 -06:00
|
|
|
if (pAdapter->bInHctTest)
|
2009-11-03 02:17:11 -07:00
|
|
|
return;
|
|
|
|
#endif
|
2013-06-25 19:21:43 -06:00
|
|
|
/* We can not know the packet length and transmit type:
|
2017-02-15 22:31:07 -07:00
|
|
|
* broadcast or uni or multicast. So the relative statistics
|
|
|
|
* must be collected in tx feedback info.
|
|
|
|
*/
|
2013-06-25 19:21:41 -06:00
|
|
|
if (pstx_fb->tok) {
|
2009-11-03 02:17:11 -07:00
|
|
|
priv->stats.txfeedbackok++;
|
|
|
|
priv->stats.txoktotal++;
|
|
|
|
priv->stats.txokbytestotal += pstx_fb->pkt_length;
|
|
|
|
priv->stats.txokinperiod++;
|
|
|
|
|
|
|
|
/* We can not make sure broadcast/multicast or unicast mode. */
|
2013-06-25 19:21:41 -06:00
|
|
|
if (pstx_fb->pkt_type == PACKET_MULTICAST) {
|
2009-11-03 02:17:11 -07:00
|
|
|
priv->stats.txmulticast++;
|
|
|
|
priv->stats.txbytesmulticast += pstx_fb->pkt_length;
|
2013-06-25 19:21:41 -06:00
|
|
|
} else if (pstx_fb->pkt_type == PACKET_BROADCAST) {
|
2009-11-03 02:17:11 -07:00
|
|
|
priv->stats.txbroadcast++;
|
|
|
|
priv->stats.txbytesbroadcast += pstx_fb->pkt_length;
|
2013-06-25 19:21:41 -06:00
|
|
|
} else {
|
2009-11-03 02:17:11 -07:00
|
|
|
priv->stats.txunicast++;
|
|
|
|
priv->stats.txbytesunicast += pstx_fb->pkt_length;
|
|
|
|
}
|
2013-06-25 19:21:41 -06:00
|
|
|
} else {
|
2009-11-03 02:17:11 -07:00
|
|
|
priv->stats.txfeedbackfail++;
|
|
|
|
priv->stats.txerrtotal++;
|
|
|
|
priv->stats.txerrbytestotal += pstx_fb->pkt_length;
|
|
|
|
|
|
|
|
/* We can not make sure broadcast/multicast or unicast mode. */
|
|
|
|
if (pstx_fb->pkt_type == PACKET_MULTICAST)
|
|
|
|
priv->stats.txerrmulticast++;
|
|
|
|
else if (pstx_fb->pkt_type == PACKET_BROADCAST)
|
|
|
|
priv->stats.txerrbroadcast++;
|
|
|
|
else
|
|
|
|
priv->stats.txerrunicast++;
|
|
|
|
}
|
|
|
|
|
|
|
|
priv->stats.txretrycount += pstx_fb->retry_cnt;
|
|
|
|
priv->stats.txfeedbackretry += pstx_fb->retry_cnt;
|
2013-06-25 19:21:43 -06:00
|
|
|
}
|
2009-11-03 02:17:11 -07:00
|
|
|
|
|
|
|
/*-----------------------------------------------------------------------------
|
|
|
|
* Function: cmpk_handle_tx_feedback()
|
|
|
|
*
|
|
|
|
* Overview: The function is responsible for extract the message inside TX
|
2013-06-25 19:21:43 -06:00
|
|
|
* feedbck message from firmware. It will contain dedicated info in
|
|
|
|
* ws-06-0063-rtl8190-command-packet-specification.
|
|
|
|
* Please refer to chapter "TX Feedback Element".
|
|
|
|
* We have to read 20 bytes in the command packet.
|
2009-11-03 02:17:11 -07:00
|
|
|
*
|
2013-06-25 19:21:43 -06:00
|
|
|
* Input: struct net_device *dev
|
|
|
|
* u8 *pmsg - Msg Ptr of the command packet.
|
2009-11-03 02:17:11 -07:00
|
|
|
*
|
|
|
|
* Output: NONE
|
|
|
|
*
|
|
|
|
* Return: NONE
|
|
|
|
*
|
|
|
|
* Revised History:
|
2013-06-25 19:21:43 -06:00
|
|
|
* When Who Remark
|
|
|
|
* 05/08/2008 amy Create Version 0 porting from windows code.
|
2009-11-03 02:17:11 -07:00
|
|
|
*
|
2017-02-15 22:31:07 -07:00
|
|
|
*---------------------------------------------------------------------------
|
|
|
|
*/
|
2013-06-25 19:21:42 -06:00
|
|
|
static void cmpk_handle_tx_feedback(struct net_device *dev, u8 *pmsg)
|
2009-11-03 02:17:11 -07:00
|
|
|
{
|
|
|
|
struct r8192_priv *priv = ieee80211_priv(dev);
|
2018-07-29 15:07:33 -06:00
|
|
|
struct cmd_pkt_tx_feedback rx_tx_fb;
|
2009-11-03 02:17:11 -07:00
|
|
|
|
|
|
|
priv->stats.txfeedback++;
|
|
|
|
|
|
|
|
/* 1. Extract TX feedback info from RFD to temp structure buffer. */
|
|
|
|
/* It seems that FW use big endian(MIPS) and DRV use little endian in
|
2017-02-15 22:31:07 -07:00
|
|
|
* windows OS. So we have to read the content byte by byte or transfer
|
|
|
|
* endian type before copy the message copy.
|
|
|
|
*/
|
2013-06-25 19:21:43 -06:00
|
|
|
/* Use pointer to transfer structure memory. */
|
2018-07-29 15:07:33 -06:00
|
|
|
memcpy((u8 *)&rx_tx_fb, pmsg, sizeof(struct cmd_pkt_tx_feedback));
|
2009-11-03 02:17:11 -07:00
|
|
|
/* 2. Use tx feedback info to count TX statistics. */
|
|
|
|
cmpk_count_txstatistic(dev, &rx_tx_fb);
|
2013-06-25 19:21:43 -06:00
|
|
|
/* Comment previous method for TX statistic function. */
|
2009-11-03 02:17:11 -07:00
|
|
|
/* Collect info TX feedback packet to fill TCB. */
|
|
|
|
/* We can not know the packet length and transmit type: broadcast or uni
|
2017-02-15 22:31:07 -07:00
|
|
|
* or multicast.
|
|
|
|
*/
|
2013-06-25 19:21:43 -06:00
|
|
|
}
|
2009-11-03 02:17:11 -07:00
|
|
|
|
2014-03-19 05:47:27 -06:00
|
|
|
static void cmdpkt_beacontimerinterrupt_819xusb(struct net_device *dev)
|
2009-11-03 02:17:11 -07:00
|
|
|
{
|
|
|
|
struct r8192_priv *priv = ieee80211_priv(dev);
|
|
|
|
u16 tx_rate;
|
2013-06-25 19:21:43 -06:00
|
|
|
/* 87B have to S/W beacon for DTM encryption_cmn. */
|
2013-06-25 19:21:42 -06:00
|
|
|
if (priv->ieee80211->current_network.mode == IEEE_A ||
|
2017-01-09 19:09:59 -07:00
|
|
|
priv->ieee80211->current_network.mode == IEEE_N_5G ||
|
|
|
|
(priv->ieee80211->current_network.mode == IEEE_N_24G &&
|
|
|
|
(!priv->ieee80211->pHTInfo->bCurSuppCCK))) {
|
2009-11-03 02:17:11 -07:00
|
|
|
tx_rate = 60;
|
|
|
|
DMESG("send beacon frame tx rate is 6Mbpm\n");
|
2013-06-25 19:21:41 -06:00
|
|
|
} else {
|
2013-06-25 19:21:42 -06:00
|
|
|
tx_rate = 10;
|
2009-11-03 02:17:11 -07:00
|
|
|
DMESG("send beacon frame tx rate is 1Mbpm\n");
|
|
|
|
}
|
|
|
|
|
2013-06-25 19:21:43 -06:00
|
|
|
rtl819xusb_beacon_tx(dev, tx_rate); /* HW Beacon */
|
2009-11-03 02:17:11 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/*-----------------------------------------------------------------------------
|
|
|
|
* Function: cmpk_handle_interrupt_status()
|
|
|
|
*
|
|
|
|
* Overview: The function is responsible for extract the message from
|
2013-06-25 19:21:43 -06:00
|
|
|
* firmware. It will contain dedicated info in
|
|
|
|
* ws-07-0063-v06-rtl819x-command-packet-specification-070315.doc.
|
|
|
|
* Please refer to chapter "Interrupt Status Element".
|
2009-11-03 02:17:11 -07:00
|
|
|
*
|
2013-06-25 19:21:43 -06:00
|
|
|
* Input: struct net_device *dev
|
|
|
|
* u8 *pmsg - Message Pointer of the command packet.
|
2009-11-03 02:17:11 -07:00
|
|
|
*
|
|
|
|
* Output: NONE
|
|
|
|
*
|
|
|
|
* Return: NONE
|
|
|
|
*
|
|
|
|
* Revised History:
|
2013-06-25 19:21:43 -06:00
|
|
|
* When Who Remark
|
|
|
|
* 05/12/2008 amy Add this for rtl8192 porting from windows code.
|
2009-11-03 02:17:11 -07:00
|
|
|
*
|
2017-02-15 22:31:07 -07:00
|
|
|
*---------------------------------------------------------------------------
|
|
|
|
*/
|
2013-06-25 19:21:42 -06:00
|
|
|
static void cmpk_handle_interrupt_status(struct net_device *dev, u8 *pmsg)
|
2009-11-03 02:17:11 -07:00
|
|
|
{
|
2018-07-29 15:07:37 -06:00
|
|
|
struct cmd_pkt_interrupt_status rx_intr_status; /* */
|
2009-11-03 02:17:11 -07:00
|
|
|
struct r8192_priv *priv = ieee80211_priv(dev);
|
|
|
|
|
|
|
|
DMESG("---> cmpk_Handle_Interrupt_Status()\n");
|
|
|
|
|
|
|
|
/* 1. Extract TX feedback info from RFD to temp structure buffer. */
|
|
|
|
/* It seems that FW use big endian(MIPS) and DRV use little endian in
|
2017-02-15 22:31:07 -07:00
|
|
|
* windows OS. So we have to read the content byte by byte or transfer
|
|
|
|
* endian type before copy the message copy.
|
|
|
|
*/
|
2009-11-03 02:17:11 -07:00
|
|
|
rx_intr_status.length = pmsg[1];
|
2018-07-29 15:07:37 -06:00
|
|
|
if (rx_intr_status.length != (sizeof(struct cmd_pkt_interrupt_status) - 2)) {
|
2009-11-03 02:17:11 -07:00
|
|
|
DMESG("cmpk_Handle_Interrupt_Status: wrong length!\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-06-25 19:21:43 -06:00
|
|
|
/* Statistics of beacon for ad-hoc mode. */
|
2013-06-25 19:21:42 -06:00
|
|
|
if (priv->ieee80211->iw_mode == IW_MODE_ADHOC) {
|
2013-06-25 19:21:43 -06:00
|
|
|
/* 2 maybe need endian transform? */
|
2009-11-03 02:17:11 -07:00
|
|
|
rx_intr_status.interrupt_status = *((u32 *)(pmsg + 4));
|
|
|
|
|
2013-06-25 19:21:45 -06:00
|
|
|
DMESG("interrupt status = 0x%x\n",
|
|
|
|
rx_intr_status.interrupt_status);
|
2009-11-03 02:17:11 -07:00
|
|
|
|
2018-07-25 16:16:23 -06:00
|
|
|
if (rx_intr_status.interrupt_status & ISR_TX_BCN_OK) {
|
2009-11-03 02:17:11 -07:00
|
|
|
priv->ieee80211->bibsscoordinator = true;
|
|
|
|
priv->stats.txbeaconokint++;
|
2018-07-25 16:16:25 -06:00
|
|
|
} else if (rx_intr_status.interrupt_status & ISR_TX_BCN_ERR) {
|
2009-11-03 02:17:11 -07:00
|
|
|
priv->ieee80211->bibsscoordinator = false;
|
|
|
|
priv->stats.txbeaconerr++;
|
|
|
|
}
|
|
|
|
|
2018-07-25 16:16:26 -06:00
|
|
|
if (rx_intr_status.interrupt_status & ISR_BCN_TIMER_INTR)
|
2009-11-03 02:17:11 -07:00
|
|
|
cmdpkt_beacontimerinterrupt_819xusb(dev);
|
|
|
|
}
|
|
|
|
|
2018-10-23 10:59:14 -06:00
|
|
|
/* Other information in interrupt status we need? */
|
2009-11-03 02:17:11 -07:00
|
|
|
|
|
|
|
DMESG("<---- cmpk_handle_interrupt_status()\n");
|
2013-06-25 19:21:43 -06:00
|
|
|
}
|
2009-11-03 02:17:11 -07:00
|
|
|
|
|
|
|
/*-----------------------------------------------------------------------------
|
|
|
|
* Function: cmpk_handle_query_config_rx()
|
|
|
|
*
|
|
|
|
* Overview: The function is responsible for extract the message from
|
2013-06-25 19:21:43 -06:00
|
|
|
* firmware. It will contain dedicated info in
|
|
|
|
* ws-06-0063-rtl8190-command-packet-specification. Please
|
|
|
|
* refer to chapter "Beacon State Element".
|
2009-11-03 02:17:11 -07:00
|
|
|
*
|
2013-06-25 19:21:43 -06:00
|
|
|
* Input: u8 *pmsg - Message Pointer of the command packet.
|
2009-11-03 02:17:11 -07:00
|
|
|
*
|
|
|
|
* Output: NONE
|
|
|
|
*
|
|
|
|
* Return: NONE
|
|
|
|
*
|
|
|
|
* Revised History:
|
2013-06-25 19:21:43 -06:00
|
|
|
* When Who Remark
|
|
|
|
* 05/12/2008 amy Create Version 0 porting from windows code.
|
2009-11-03 02:17:11 -07:00
|
|
|
*
|
2017-02-15 22:31:07 -07:00
|
|
|
*---------------------------------------------------------------------------
|
|
|
|
*/
|
2013-06-25 19:21:42 -06:00
|
|
|
static void cmpk_handle_query_config_rx(struct net_device *dev, u8 *pmsg)
|
2009-11-03 02:17:11 -07:00
|
|
|
{
|
2018-07-29 15:07:38 -06:00
|
|
|
struct cmpk_query_cfg rx_query_cfg;
|
2009-11-03 02:17:11 -07:00
|
|
|
|
|
|
|
/* 1. Extract TX feedback info from RFD to temp structure buffer. */
|
|
|
|
/* It seems that FW use big endian(MIPS) and DRV use little endian in
|
2017-02-15 22:31:07 -07:00
|
|
|
* windows OS. So we have to read the content byte by byte or transfer
|
|
|
|
* endian type before copy the message copy.
|
|
|
|
*/
|
2017-07-21 07:42:52 -06:00
|
|
|
rx_query_cfg.cfg_action = (pmsg[4] & 0x80) >> 7;
|
2012-12-05 13:40:18 -07:00
|
|
|
rx_query_cfg.cfg_type = (pmsg[4] & 0x60) >> 5;
|
|
|
|
rx_query_cfg.cfg_size = (pmsg[4] & 0x18) >> 3;
|
|
|
|
rx_query_cfg.cfg_page = (pmsg[6] & 0x0F) >> 0;
|
2013-06-25 19:21:42 -06:00
|
|
|
rx_query_cfg.cfg_offset = pmsg[7];
|
|
|
|
rx_query_cfg.value = (pmsg[8] << 24) | (pmsg[9] << 16) |
|
|
|
|
(pmsg[10] << 8) | (pmsg[11] << 0);
|
|
|
|
rx_query_cfg.mask = (pmsg[12] << 24) | (pmsg[13] << 16) |
|
|
|
|
(pmsg[14] << 8) | (pmsg[15] << 0);
|
2013-06-25 19:21:43 -06:00
|
|
|
}
|
2009-11-03 02:17:11 -07:00
|
|
|
|
|
|
|
/*-----------------------------------------------------------------------------
|
|
|
|
* Function: cmpk_count_tx_status()
|
|
|
|
*
|
|
|
|
* Overview: Count aggregated tx status from firmwar of one type rx command
|
2013-06-25 19:21:43 -06:00
|
|
|
* packet element id = RX_TX_STATUS.
|
2009-11-03 02:17:11 -07:00
|
|
|
*
|
2013-06-25 19:21:43 -06:00
|
|
|
* Input: NONE
|
2009-11-03 02:17:11 -07:00
|
|
|
*
|
2013-06-25 19:21:43 -06:00
|
|
|
* Output: NONE
|
2009-11-03 02:17:11 -07:00
|
|
|
*
|
2013-06-25 19:21:43 -06:00
|
|
|
* Return: NONE
|
2009-11-03 02:17:11 -07:00
|
|
|
*
|
|
|
|
* Revised History:
|
2013-06-25 19:21:43 -06:00
|
|
|
* When Who Remark
|
|
|
|
* 05/12/2008 amy Create Version 0 porting from windows code.
|
2009-11-03 02:17:11 -07:00
|
|
|
*
|
2017-02-15 22:31:07 -07:00
|
|
|
*---------------------------------------------------------------------------
|
|
|
|
*/
|
2013-06-25 19:21:42 -06:00
|
|
|
static void cmpk_count_tx_status(struct net_device *dev,
|
|
|
|
cmpk_tx_status_t *pstx_status)
|
2009-11-03 02:17:11 -07:00
|
|
|
{
|
|
|
|
struct r8192_priv *priv = ieee80211_priv(dev);
|
|
|
|
|
|
|
|
#ifdef ENABLE_PS
|
|
|
|
|
|
|
|
RT_RF_POWER_STATE rtstate;
|
|
|
|
|
2013-06-25 19:21:45 -06:00
|
|
|
pAdapter->HalFunc.GetHwRegHandler(pAdapter, HW_VAR_RF_STATE,
|
|
|
|
(pu1Byte)(&rtState));
|
2009-11-03 02:17:11 -07:00
|
|
|
|
2013-06-25 19:21:43 -06:00
|
|
|
/* When RF is off, we should not count the packet for hw/sw synchronize
|
2017-02-15 22:31:07 -07:00
|
|
|
* reason, ie. there may be a duration while sw switch is changed and
|
|
|
|
* hw switch is being changed.
|
|
|
|
*/
|
2009-11-03 02:17:11 -07:00
|
|
|
if (rtState == eRfOff)
|
|
|
|
return;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
priv->stats.txfeedbackok += pstx_status->txok;
|
|
|
|
priv->stats.txoktotal += pstx_status->txok;
|
|
|
|
|
|
|
|
priv->stats.txfeedbackfail += pstx_status->txfail;
|
|
|
|
priv->stats.txerrtotal += pstx_status->txfail;
|
|
|
|
|
2013-06-25 19:21:42 -06:00
|
|
|
priv->stats.txretrycount += pstx_status->txretry;
|
2009-11-03 02:17:11 -07:00
|
|
|
priv->stats.txfeedbackretry += pstx_status->txretry;
|
|
|
|
|
|
|
|
|
2013-06-25 19:21:42 -06:00
|
|
|
priv->stats.txmulticast += pstx_status->txmcok;
|
|
|
|
priv->stats.txbroadcast += pstx_status->txbcok;
|
2009-11-03 02:17:11 -07:00
|
|
|
priv->stats.txunicast += pstx_status->txucok;
|
|
|
|
|
|
|
|
priv->stats.txerrmulticast += pstx_status->txmcfail;
|
|
|
|
priv->stats.txerrbroadcast += pstx_status->txbcfail;
|
|
|
|
priv->stats.txerrunicast += pstx_status->txucfail;
|
|
|
|
|
|
|
|
priv->stats.txbytesmulticast += pstx_status->txmclength;
|
|
|
|
priv->stats.txbytesbroadcast += pstx_status->txbclength;
|
2013-06-25 19:21:42 -06:00
|
|
|
priv->stats.txbytesunicast += pstx_status->txuclength;
|
2009-11-03 02:17:11 -07:00
|
|
|
|
2013-06-25 19:21:42 -06:00
|
|
|
priv->stats.last_packet_rate = pstx_status->rate;
|
2013-06-25 19:21:43 -06:00
|
|
|
}
|
2009-11-03 02:17:11 -07:00
|
|
|
|
|
|
|
/*-----------------------------------------------------------------------------
|
|
|
|
* Function: cmpk_handle_tx_status()
|
|
|
|
*
|
|
|
|
* Overview: Firmware add a new tx feedback status to reduce rx command
|
2013-06-25 19:21:43 -06:00
|
|
|
* packet buffer operation load.
|
2009-11-03 02:17:11 -07:00
|
|
|
*
|
|
|
|
* Input: NONE
|
|
|
|
*
|
|
|
|
* Output: NONE
|
|
|
|
*
|
|
|
|
* Return: NONE
|
|
|
|
*
|
|
|
|
* Revised History:
|
2013-06-25 19:21:43 -06:00
|
|
|
* When Who Remark
|
|
|
|
* 05/12/2008 amy Create Version 0 porting from windows code.
|
2009-11-03 02:17:11 -07:00
|
|
|
*
|
2017-02-15 22:31:07 -07:00
|
|
|
*---------------------------------------------------------------------------
|
|
|
|
*/
|
2013-06-25 19:21:42 -06:00
|
|
|
static void cmpk_handle_tx_status(struct net_device *dev, u8 *pmsg)
|
2009-11-03 02:17:11 -07:00
|
|
|
{
|
2013-06-25 19:21:43 -06:00
|
|
|
cmpk_tx_status_t rx_tx_sts;
|
2009-11-03 02:17:11 -07:00
|
|
|
|
2013-05-11 08:22:20 -06:00
|
|
|
memcpy((void *)&rx_tx_sts, (void *)pmsg, sizeof(cmpk_tx_status_t));
|
2009-11-03 02:17:11 -07:00
|
|
|
/* 2. Use tx feedback info to count TX statistics. */
|
|
|
|
cmpk_count_tx_status(dev, &rx_tx_sts);
|
2013-06-25 19:21:43 -06:00
|
|
|
}
|
2009-11-03 02:17:11 -07:00
|
|
|
|
|
|
|
/*-----------------------------------------------------------------------------
|
|
|
|
* Function: cmpk_handle_tx_rate_history()
|
|
|
|
*
|
|
|
|
* Overview: Firmware add a new tx rate history
|
|
|
|
*
|
|
|
|
* Input: NONE
|
|
|
|
*
|
|
|
|
* Output: NONE
|
|
|
|
*
|
|
|
|
* Return: NONE
|
|
|
|
*
|
|
|
|
* Revised History:
|
2013-06-25 19:21:43 -06:00
|
|
|
* When Who Remark
|
|
|
|
* 05/12/2008 amy Create Version 0 porting from windows code.
|
2009-11-03 02:17:11 -07:00
|
|
|
*
|
2017-02-15 22:31:07 -07:00
|
|
|
*---------------------------------------------------------------------------
|
|
|
|
*/
|
2013-06-25 19:21:42 -06:00
|
|
|
static void cmpk_handle_tx_rate_history(struct net_device *dev, u8 *pmsg)
|
2009-11-03 02:17:11 -07:00
|
|
|
{
|
|
|
|
cmpk_tx_rahis_t *ptxrate;
|
2013-06-25 19:21:42 -06:00
|
|
|
u8 i, j;
|
|
|
|
u16 length = sizeof(cmpk_tx_rahis_t);
|
|
|
|
u32 *ptemp;
|
2009-11-03 02:17:11 -07:00
|
|
|
struct r8192_priv *priv = ieee80211_priv(dev);
|
|
|
|
|
|
|
|
#ifdef ENABLE_PS
|
2013-06-25 19:21:45 -06:00
|
|
|
pAdapter->HalFunc.GetHwRegHandler(pAdapter, HW_VAR_RF_STATE,
|
|
|
|
(pu1Byte)(&rtState));
|
2009-11-03 02:17:11 -07:00
|
|
|
|
2013-06-25 19:21:43 -06:00
|
|
|
/* When RF is off, we should not count the packet for hw/sw synchronize
|
2017-02-15 22:31:07 -07:00
|
|
|
* reason, ie. there may be a duration while sw switch is changed and
|
|
|
|
* hw switch is being changed.
|
|
|
|
*/
|
2009-11-03 02:17:11 -07:00
|
|
|
if (rtState == eRfOff)
|
|
|
|
return;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
ptemp = (u32 *)pmsg;
|
|
|
|
|
2013-06-25 19:21:43 -06:00
|
|
|
/* Do endian transfer to word alignment(16 bits) for windows system.
|
2017-02-15 22:31:07 -07:00
|
|
|
* You must do different endian transfer for linux and MAC OS
|
|
|
|
*/
|
2013-06-25 19:21:41 -06:00
|
|
|
for (i = 0; i < (length/4); i++) {
|
2009-11-03 02:17:11 -07:00
|
|
|
u16 temp1, temp2;
|
|
|
|
|
2013-06-25 19:21:42 -06:00
|
|
|
temp1 = ptemp[i] & 0x0000FFFF;
|
|
|
|
temp2 = ptemp[i] >> 16;
|
|
|
|
ptemp[i] = (temp1 << 16) | temp2;
|
2009-11-03 02:17:11 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
ptxrate = (cmpk_tx_rahis_t *)pmsg;
|
|
|
|
|
2013-06-25 19:21:42 -06:00
|
|
|
if (ptxrate == NULL)
|
2009-11-03 02:17:11 -07:00
|
|
|
return;
|
|
|
|
|
2013-06-25 19:21:41 -06:00
|
|
|
for (i = 0; i < 16; i++) {
|
2013-06-25 19:21:43 -06:00
|
|
|
/* Collect CCK rate packet num */
|
2009-11-03 02:17:11 -07:00
|
|
|
if (i < 4)
|
|
|
|
priv->stats.txrate.cck[i] += ptxrate->cck[i];
|
|
|
|
|
2013-06-25 19:21:43 -06:00
|
|
|
/* Collect OFDM rate packet num */
|
2013-06-25 19:21:42 -06:00
|
|
|
if (i < 8)
|
2009-11-03 02:17:11 -07:00
|
|
|
priv->stats.txrate.ofdm[i] += ptxrate->ofdm[i];
|
|
|
|
|
|
|
|
for (j = 0; j < 4; j++)
|
|
|
|
priv->stats.txrate.ht_mcs[j][i] += ptxrate->ht_mcs[j][i];
|
|
|
|
}
|
2013-06-25 19:21:43 -06:00
|
|
|
}
|
2009-11-03 02:17:11 -07:00
|
|
|
|
|
|
|
/*-----------------------------------------------------------------------------
|
|
|
|
* Function: cmpk_message_handle_rx()
|
|
|
|
*
|
|
|
|
* Overview: In the function, we will capture different RX command packet
|
2013-06-25 19:21:43 -06:00
|
|
|
* info. Every RX command packet element has different message
|
|
|
|
* length and meaning in content. We only support three type of RX
|
|
|
|
* command packet now. Please refer to document
|
|
|
|
* ws-06-0063-rtl8190-command-packet-specification.
|
2009-11-03 02:17:11 -07:00
|
|
|
*
|
|
|
|
* Input: NONE
|
|
|
|
*
|
|
|
|
* Output: NONE
|
|
|
|
*
|
|
|
|
* Return: NONE
|
|
|
|
*
|
|
|
|
* Revised History:
|
2013-06-25 19:21:43 -06:00
|
|
|
* When Who Remark
|
|
|
|
* 05/06/2008 amy Create Version 0 porting from windows code.
|
2009-11-03 02:17:11 -07:00
|
|
|
*
|
2017-02-15 22:31:07 -07:00
|
|
|
*---------------------------------------------------------------------------
|
|
|
|
*/
|
2013-10-16 14:53:32 -06:00
|
|
|
u32 cmpk_message_handle_rx(struct net_device *dev,
|
|
|
|
struct ieee80211_rx_stats *pstats)
|
2009-11-03 02:17:11 -07:00
|
|
|
{
|
|
|
|
int total_length;
|
|
|
|
u8 cmd_length, exe_cnt = 0;
|
|
|
|
u8 element_id;
|
|
|
|
u8 *pcmd_buff;
|
|
|
|
|
2017-03-04 10:40:59 -07:00
|
|
|
/* 0. Check inpt arguments. It is a command queue message or
|
2017-02-15 22:31:07 -07:00
|
|
|
* pointer is null.
|
|
|
|
*/
|
2013-06-25 19:21:42 -06:00
|
|
|
if (pstats == NULL)
|
2009-11-03 02:17:11 -07:00
|
|
|
return 0; /* This is not a command packet. */
|
|
|
|
|
|
|
|
/* 1. Read received command packet message length from RFD. */
|
|
|
|
total_length = pstats->Length;
|
|
|
|
|
|
|
|
/* 2. Read virtual address from RFD. */
|
|
|
|
pcmd_buff = pstats->virtual_address;
|
|
|
|
|
2012-04-30 08:41:36 -06:00
|
|
|
/* 3. Read command packet element id and length. */
|
2009-11-03 02:17:11 -07:00
|
|
|
element_id = pcmd_buff[0];
|
|
|
|
|
2012-04-30 08:41:36 -06:00
|
|
|
/* 4. Check every received command packet content according to different
|
2017-02-15 22:31:07 -07:00
|
|
|
* element type. Because FW may aggregate RX command packet to
|
|
|
|
* minimize transmit time between DRV and FW.
|
|
|
|
*/
|
2013-06-25 19:21:43 -06:00
|
|
|
/* Add a counter to prevent the lock in the loop from being held too
|
2017-02-15 22:31:07 -07:00
|
|
|
* long
|
|
|
|
*/
|
2013-06-25 19:21:41 -06:00
|
|
|
while (total_length > 0 && exe_cnt++ < 100) {
|
2013-06-25 19:21:43 -06:00
|
|
|
/* We support aggregation of different cmd in the same packet */
|
2009-11-03 02:17:11 -07:00
|
|
|
element_id = pcmd_buff[0];
|
|
|
|
|
2013-06-25 19:21:41 -06:00
|
|
|
switch (element_id) {
|
2013-06-25 19:21:45 -06:00
|
|
|
case RX_TX_FEEDBACK:
|
|
|
|
cmpk_handle_tx_feedback(dev, pcmd_buff);
|
|
|
|
cmd_length = CMPK_RX_TX_FB_SIZE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RX_INTERRUPT_STATUS:
|
|
|
|
cmpk_handle_interrupt_status(dev, pcmd_buff);
|
2018-07-29 15:07:37 -06:00
|
|
|
cmd_length = sizeof(struct cmd_pkt_interrupt_status);
|
2013-06-25 19:21:45 -06:00
|
|
|
break;
|
|
|
|
|
|
|
|
case BOTH_QUERY_CONFIG:
|
|
|
|
cmpk_handle_query_config_rx(dev, pcmd_buff);
|
|
|
|
cmd_length = CMPK_BOTH_QUERY_CONFIG_SIZE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RX_TX_STATUS:
|
|
|
|
cmpk_handle_tx_status(dev, pcmd_buff);
|
|
|
|
cmd_length = CMPK_RX_TX_STS_SIZE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RX_TX_PER_PKT_FEEDBACK:
|
|
|
|
/* You must at lease add a switch case element here,
|
2017-02-15 22:31:07 -07:00
|
|
|
* Otherwise, we will jump to default case.
|
|
|
|
*/
|
2013-06-25 19:21:45 -06:00
|
|
|
cmd_length = CMPK_RX_TX_FB_SIZE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RX_TX_RATE_HISTORY:
|
|
|
|
cmpk_handle_tx_rate_history(dev, pcmd_buff);
|
|
|
|
cmd_length = CMPK_TX_RAHIS_SIZE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
RT_TRACE(COMP_ERR, "---->%s():unknown CMD Element\n",
|
|
|
|
__func__);
|
|
|
|
return 1; /* This is a command packet. */
|
2009-11-03 02:17:11 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
total_length -= cmd_length;
|
|
|
|
pcmd_buff += cmd_length;
|
2013-06-25 19:21:40 -06:00
|
|
|
}
|
2009-11-03 02:17:11 -07:00
|
|
|
return 1; /* This is a command packet. */
|
2013-06-25 19:21:43 -06:00
|
|
|
}
|