These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / drivers / staging / rtl8192e / rtl819x_TSProc.c
index 7d77d05..2c8a526 100644 (file)
@@ -6,10 +6,6 @@
  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
  * more details.
  *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
- *
  * The full GNU General Public License is included in this distribution in the
  * file called LICENSE.
  *
@@ -49,8 +45,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,
@@ -58,9 +56,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++;
@@ -78,8 +76,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;
@@ -91,7 +90,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);
 }
@@ -104,13 +104,12 @@ 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)
 {
-       memset(pTsCommonInfo->Addr, 0, 6);
+       eth_zero_addr(pTsCommonInfo->Addr);
        memset(&pTsCommonInfo->TSpec, 0, sizeof(union tspec_body));
        memset(&pTsCommonInfo->TClass, 0, sizeof(union qos_tclas)*TCLAS_NUM);
        pTsCommonInfo->TClasProc = 0;
@@ -144,29 +143,29 @@ 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);
 
        for (count = 0; count < TOTAL_TS_NUM; count++) {
                pTxTS->num = count;
-               _setup_timer(&pTxTS->TsCommonInfo.SetupTimer,
+               setup_timer(&pTxTS->TsCommonInfo.SetupTimer,
                            TsSetupTimeOut,
                            (unsigned long) pTxTS);
 
-               _setup_timer(&pTxTS->TsCommonInfo.InactTimer,
+               setup_timer(&pTxTS->TsCommonInfo.InactTimer,
                            TsInactTimeout,
                            (unsigned long) pTxTS);
 
-               _setup_timer(&pTxTS->TsAddBaTimer,
+               setup_timer(&pTxTS->TsAddBaTimer,
                            TsAddBaProcess,
                            (unsigned long) pTxTS);
 
-               _setup_timer(&pTxTS->TxPendingBARecord.Timer,
+               setup_timer(&pTxTS->TxPendingBARecord.Timer,
                            BaSetupTimeOut,
                            (unsigned long) pTxTS);
-               _setup_timer(&pTxTS->TxAdmittedBARecord.Timer,
+               setup_timer(&pTxTS->TxAdmittedBARecord.Timer,
                            TxBaInactTimeout,
                            (unsigned long) pTxTS);
 
@@ -183,19 +182,19 @@ void TSInitialize(struct rtllib_device *ieee)
                pRxTS->num = count;
                INIT_LIST_HEAD(&pRxTS->RxPendingPktList);
 
-               _setup_timer(&pRxTS->TsCommonInfo.SetupTimer,
+               setup_timer(&pRxTS->TsCommonInfo.SetupTimer,
                            TsSetupTimeOut,
                            (unsigned long) pRxTS);
 
-               _setup_timer(&pRxTS->TsCommonInfo.InactTimer,
+               setup_timer(&pRxTS->TsCommonInfo.InactTimer,
                            TsInactTimeout,
                            (unsigned long) pRxTS);
 
-               _setup_timer(&pRxTS->RxAdmittedBARecord.Timer,
+               setup_timer(&pRxTS->RxAdmittedBARecord.Timer,
                            RxBaInactTimeout,
                            (unsigned long) pRxTS);
 
-               _setup_timer(&pRxTS->RxPktPendingTimer,
+               setup_timer(&pRxTS->RxPktPendingTimer,
                            RxPktPendingTimeout,
                            (unsigned long) pRxTS);
 
@@ -269,10 +268,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)
@@ -318,17 +317,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;
                }
 
@@ -357,8 +354,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;
        }
 
@@ -374,7 +370,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);
@@ -393,9 +388,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;
@@ -413,14 +408,14 @@ 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;
 }
 
-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);
@@ -437,9 +432,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;
@@ -539,16 +533,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");
 }