forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/drivers/net/wireless/marvell/mwifiex/11n.c
....@@ -1,10 +1,10 @@
11 /*
2
- * Marvell Wireless LAN device driver: 802.11n
2
+ * NXP Wireless LAN device driver: 802.11n
33 *
4
- * Copyright (C) 2011-2014, Marvell International Ltd.
4
+ * Copyright 2011-2020 NXP
55 *
6
- * This software file (the "File") is distributed by Marvell International
7
- * Ltd. under the terms of the GNU General Public License Version 2, June 1991
6
+ * This software file (the "File") is distributed by NXP
7
+ * under the terms of the GNU General Public License Version 2, June 1991
88 * (the "License"). You may use, redistribute and/or modify this File in
99 * accordance with the terms and conditions of the License, a copy of which
1010 * is available by writing to the Free Software Foundation, Inc.,
....@@ -84,17 +84,15 @@
8484 enum mwifiex_ba_status ba_status)
8585 {
8686 struct mwifiex_tx_ba_stream_tbl *tx_ba_tsr_tbl;
87
- unsigned long flags;
8887
89
- spin_lock_irqsave(&priv->tx_ba_stream_tbl_lock, flags);
88
+ spin_lock_bh(&priv->tx_ba_stream_tbl_lock);
9089 list_for_each_entry(tx_ba_tsr_tbl, &priv->tx_ba_stream_tbl_ptr, list) {
9190 if (tx_ba_tsr_tbl->ba_status == ba_status) {
92
- spin_unlock_irqrestore(&priv->tx_ba_stream_tbl_lock,
93
- flags);
91
+ spin_unlock_bh(&priv->tx_ba_stream_tbl_lock);
9492 return tx_ba_tsr_tbl;
9593 }
9694 }
97
- spin_unlock_irqrestore(&priv->tx_ba_stream_tbl_lock, flags);
95
+ spin_unlock_bh(&priv->tx_ba_stream_tbl_lock);
9896 return NULL;
9997 }
10098
....@@ -516,13 +514,12 @@
516514 {
517515 int i;
518516 struct mwifiex_tx_ba_stream_tbl *del_tbl_ptr, *tmp_node;
519
- unsigned long flags;
520517
521
- spin_lock_irqsave(&priv->tx_ba_stream_tbl_lock, flags);
518
+ spin_lock_bh(&priv->tx_ba_stream_tbl_lock);
522519 list_for_each_entry_safe(del_tbl_ptr, tmp_node,
523520 &priv->tx_ba_stream_tbl_ptr, list)
524521 mwifiex_11n_delete_tx_ba_stream_tbl_entry(priv, del_tbl_ptr);
525
- spin_unlock_irqrestore(&priv->tx_ba_stream_tbl_lock, flags);
522
+ spin_unlock_bh(&priv->tx_ba_stream_tbl_lock);
526523
527524 INIT_LIST_HEAD(&priv->tx_ba_stream_tbl_ptr);
528525
....@@ -539,18 +536,16 @@
539536 mwifiex_get_ba_tbl(struct mwifiex_private *priv, int tid, u8 *ra)
540537 {
541538 struct mwifiex_tx_ba_stream_tbl *tx_ba_tsr_tbl;
542
- unsigned long flags;
543539
544
- spin_lock_irqsave(&priv->tx_ba_stream_tbl_lock, flags);
540
+ spin_lock_bh(&priv->tx_ba_stream_tbl_lock);
545541 list_for_each_entry(tx_ba_tsr_tbl, &priv->tx_ba_stream_tbl_ptr, list) {
546542 if (ether_addr_equal_unaligned(tx_ba_tsr_tbl->ra, ra) &&
547543 tx_ba_tsr_tbl->tid == tid) {
548
- spin_unlock_irqrestore(&priv->tx_ba_stream_tbl_lock,
549
- flags);
544
+ spin_unlock_bh(&priv->tx_ba_stream_tbl_lock);
550545 return tx_ba_tsr_tbl;
551546 }
552547 }
553
- spin_unlock_irqrestore(&priv->tx_ba_stream_tbl_lock, flags);
548
+ spin_unlock_bh(&priv->tx_ba_stream_tbl_lock);
554549 return NULL;
555550 }
556551
....@@ -563,7 +558,6 @@
563558 {
564559 struct mwifiex_tx_ba_stream_tbl *new_node;
565560 struct mwifiex_ra_list_tbl *ra_list;
566
- unsigned long flags;
567561 int tid_down;
568562
569563 if (!mwifiex_get_ba_tbl(priv, tid, ra)) {
....@@ -584,9 +578,9 @@
584578 new_node->ba_status = ba_status;
585579 memcpy(new_node->ra, ra, ETH_ALEN);
586580
587
- spin_lock_irqsave(&priv->tx_ba_stream_tbl_lock, flags);
581
+ spin_lock_bh(&priv->tx_ba_stream_tbl_lock);
588582 list_add_tail(&new_node->list, &priv->tx_ba_stream_tbl_ptr);
589
- spin_unlock_irqrestore(&priv->tx_ba_stream_tbl_lock, flags);
583
+ spin_unlock_bh(&priv->tx_ba_stream_tbl_lock);
590584 }
591585 }
592586
....@@ -599,7 +593,6 @@
599593 u32 tx_win_size = priv->add_ba_param.tx_win_size;
600594 static u8 dialog_tok;
601595 int ret;
602
- unsigned long flags;
603596 u16 block_ack_param_set;
604597
605598 mwifiex_dbg(priv->adapter, CMD, "cmd: %s: tid %d\n", __func__, tid);
....@@ -612,10 +605,10 @@
612605 memcmp(priv->cfg_bssid, peer_mac, ETH_ALEN)) {
613606 struct mwifiex_sta_node *sta_ptr;
614607
615
- spin_lock_irqsave(&priv->sta_list_spinlock, flags);
608
+ spin_lock_bh(&priv->sta_list_spinlock);
616609 sta_ptr = mwifiex_get_sta_entry(priv, peer_mac);
617610 if (!sta_ptr) {
618
- spin_unlock_irqrestore(&priv->sta_list_spinlock, flags);
611
+ spin_unlock_bh(&priv->sta_list_spinlock);
619612 mwifiex_dbg(priv->adapter, ERROR,
620613 "BA setup with unknown TDLS peer %pM!\n",
621614 peer_mac);
....@@ -623,7 +616,7 @@
623616 }
624617 if (sta_ptr->is_11ac_enabled)
625618 tx_win_size = MWIFIEX_11AC_STA_AMPDU_DEF_TXWINSIZE;
626
- spin_unlock_irqrestore(&priv->sta_list_spinlock, flags);
619
+ spin_unlock_bh(&priv->sta_list_spinlock);
627620 }
628621
629622 block_ack_param_set = (u16)((tid << BLOCKACKPARAM_TID_POS) |
....@@ -688,9 +681,8 @@
688681 void mwifiex_11n_delba(struct mwifiex_private *priv, int tid)
689682 {
690683 struct mwifiex_rx_reorder_tbl *rx_reor_tbl_ptr;
691
- unsigned long flags;
692684
693
- spin_lock_irqsave(&priv->rx_reorder_tbl_lock, flags);
685
+ spin_lock_bh(&priv->rx_reorder_tbl_lock);
694686 list_for_each_entry(rx_reor_tbl_ptr, &priv->rx_reorder_tbl_ptr, list) {
695687 if (rx_reor_tbl_ptr->tid == tid) {
696688 dev_dbg(priv->adapter->dev,
....@@ -701,7 +693,7 @@
701693 }
702694 }
703695 exit:
704
- spin_unlock_irqrestore(&priv->rx_reorder_tbl_lock, flags);
696
+ spin_unlock_bh(&priv->rx_reorder_tbl_lock);
705697 }
706698
707699 /*
....@@ -730,9 +722,8 @@
730722 struct mwifiex_ds_rx_reorder_tbl *rx_reo_tbl = buf;
731723 struct mwifiex_rx_reorder_tbl *rx_reorder_tbl_ptr;
732724 int count = 0;
733
- unsigned long flags;
734725
735
- spin_lock_irqsave(&priv->rx_reorder_tbl_lock, flags);
726
+ spin_lock_bh(&priv->rx_reorder_tbl_lock);
736727 list_for_each_entry(rx_reorder_tbl_ptr, &priv->rx_reorder_tbl_ptr,
737728 list) {
738729 rx_reo_tbl->tid = (u16) rx_reorder_tbl_ptr->tid;
....@@ -751,7 +742,7 @@
751742 if (count >= MWIFIEX_MAX_RX_BASTREAM_SUPPORTED)
752743 break;
753744 }
754
- spin_unlock_irqrestore(&priv->rx_reorder_tbl_lock, flags);
745
+ spin_unlock_bh(&priv->rx_reorder_tbl_lock);
755746
756747 return count;
757748 }
....@@ -765,9 +756,8 @@
765756 struct mwifiex_tx_ba_stream_tbl *tx_ba_tsr_tbl;
766757 struct mwifiex_ds_tx_ba_stream_tbl *rx_reo_tbl = buf;
767758 int count = 0;
768
- unsigned long flags;
769759
770
- spin_lock_irqsave(&priv->tx_ba_stream_tbl_lock, flags);
760
+ spin_lock_bh(&priv->tx_ba_stream_tbl_lock);
771761 list_for_each_entry(tx_ba_tsr_tbl, &priv->tx_ba_stream_tbl_ptr, list) {
772762 rx_reo_tbl->tid = (u16) tx_ba_tsr_tbl->tid;
773763 mwifiex_dbg(priv->adapter, DATA, "data: %s tid=%d\n",
....@@ -779,7 +769,7 @@
779769 if (count >= MWIFIEX_MAX_TX_BASTREAM_SUPPORTED)
780770 break;
781771 }
782
- spin_unlock_irqrestore(&priv->tx_ba_stream_tbl_lock, flags);
772
+ spin_unlock_bh(&priv->tx_ba_stream_tbl_lock);
783773
784774 return count;
785775 }
....@@ -791,16 +781,15 @@
791781 void mwifiex_del_tx_ba_stream_tbl_by_ra(struct mwifiex_private *priv, u8 *ra)
792782 {
793783 struct mwifiex_tx_ba_stream_tbl *tbl, *tmp;
794
- unsigned long flags;
795784
796785 if (!ra)
797786 return;
798787
799
- spin_lock_irqsave(&priv->tx_ba_stream_tbl_lock, flags);
788
+ spin_lock_bh(&priv->tx_ba_stream_tbl_lock);
800789 list_for_each_entry_safe(tbl, tmp, &priv->tx_ba_stream_tbl_ptr, list)
801790 if (!memcmp(tbl->ra, ra, ETH_ALEN))
802791 mwifiex_11n_delete_tx_ba_stream_tbl_entry(priv, tbl);
803
- spin_unlock_irqrestore(&priv->tx_ba_stream_tbl_lock, flags);
792
+ spin_unlock_bh(&priv->tx_ba_stream_tbl_lock);
804793
805794 return;
806795 }
....@@ -901,7 +890,7 @@
901890 */
902891 void mwifiex_update_ampdu_txwinsize(struct mwifiex_adapter *adapter)
903892 {
904
- u8 i;
893
+ u8 i, j;
905894 u32 tx_win_size;
906895 struct mwifiex_private *priv;
907896
....@@ -932,8 +921,8 @@
932921 if (tx_win_size != priv->add_ba_param.tx_win_size) {
933922 if (!priv->media_connected)
934923 continue;
935
- for (i = 0; i < MAX_NUM_TID; i++)
936
- mwifiex_send_delba_txbastream_tbl(priv, i);
924
+ for (j = 0; j < MAX_NUM_TID; j++)
925
+ mwifiex_send_delba_txbastream_tbl(priv, j);
937926 }
938927 }
939928 }