forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/drivers/net/wireless/ralink/rt2x00/rt2x00mac.c
....@@ -1,19 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com>
34 <http://rt2x00.serialmonkey.com>
45
5
- This program is free software; you can redistribute it and/or modify
6
- it under the terms of the GNU General Public License as published by
7
- the Free Software Foundation; either version 2 of the License, or
8
- (at your option) any later version.
9
-
10
- This program is distributed in the hope that it will be useful,
11
- but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- GNU General Public License for more details.
14
-
15
- You should have received a copy of the GNU General Public License
16
- along with this program; if not, see <http://www.gnu.org/licenses/>.
176 */
187
198 /*
....@@ -176,6 +165,15 @@
176165 if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags))
177166 return 0;
178167
168
+ if (test_bit(DEVICE_STATE_STARTED, &rt2x00dev->flags)) {
169
+ /*
170
+ * This is special case for ieee80211_restart_hw(), otherwise
171
+ * mac80211 never call start() two times in row without stop();
172
+ */
173
+ set_bit(DEVICE_STATE_RESET, &rt2x00dev->flags);
174
+ rt2x00dev->ops->lib->pre_reset_hw(rt2x00dev);
175
+ rt2x00lib_stop(rt2x00dev);
176
+ }
179177 return rt2x00lib_start(rt2x00dev);
180178 }
181179 EXPORT_SYMBOL_GPL(rt2x00mac_start);
....@@ -190,6 +188,17 @@
190188 rt2x00lib_stop(rt2x00dev);
191189 }
192190 EXPORT_SYMBOL_GPL(rt2x00mac_stop);
191
+
192
+void
193
+rt2x00mac_reconfig_complete(struct ieee80211_hw *hw,
194
+ enum ieee80211_reconfig_type reconfig_type)
195
+{
196
+ struct rt2x00_dev *rt2x00dev = hw->priv;
197
+
198
+ if (reconfig_type == IEEE80211_RECONFIG_TYPE_RESTART)
199
+ clear_bit(DEVICE_STATE_RESET, &rt2x00dev->flags);
200
+}
201
+EXPORT_SYMBOL_GPL(rt2x00mac_reconfig_complete);
193202
194203 int rt2x00mac_add_interface(struct ieee80211_hw *hw,
195204 struct ieee80211_vif *vif)
....@@ -459,7 +468,8 @@
459468 if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags))
460469 return 0;
461470
462
- if (!rt2x00_has_cap_hw_crypto(rt2x00dev))
471
+ /* The hardware can't do MFP */
472
+ if (!rt2x00_has_cap_hw_crypto(rt2x00dev) || (sta && sta->mfp))
463473 return -EOPNOTSUPP;
464474
465475 /*
....@@ -710,8 +720,12 @@
710720 if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags))
711721 return;
712722
723
+ set_bit(DEVICE_STATE_FLUSHING, &rt2x00dev->flags);
724
+
713725 tx_queue_for_each(rt2x00dev, queue)
714726 rt2x00queue_flush_queue(queue, drop);
727
+
728
+ clear_bit(DEVICE_STATE_FLUSHING, &rt2x00dev->flags);
715729 }
716730 EXPORT_SYMBOL_GPL(rt2x00mac_flush);
717731