forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/drivers/net/wireless/ti/wlcore/cmd.c
....@@ -1,24 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * This file is part of wl1271
34 *
45 * Copyright (C) 2009-2010 Nokia Corporation
56 *
67 * Contact: Luciano Coelho <luciano.coelho@nokia.com>
7
- *
8
- * This program is free software; you can redistribute it and/or
9
- * modify it under the terms of the GNU General Public License
10
- * version 2 as published by the Free Software Foundation.
11
- *
12
- * This program is distributed in the hope that it will be useful, but
13
- * WITHOUT ANY WARRANTY; without even the implied warranty of
14
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
- * General Public License for more details.
16
- *
17
- * You should have received a copy of the GNU General Public License
18
- * along with this program; if not, write to the Free Software
19
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20
- * 02110-1301 USA
21
- *
228 */
239
2410 #include <linux/module.h>
....@@ -839,7 +825,7 @@
839825 *
840826 * @wl: wl struct
841827 * @buf: buffer containing the command, with all headers, must work with dma
842
- * @len: length of the buffer
828
+ * @buf_len: length of the buffer
843829 * @answer: is answer needed
844830 */
845831 int wl1271_cmd_test(struct wl1271 *wl, void *buf, size_t buf_len, u8 answer)
....@@ -869,7 +855,8 @@
869855 * @wl: wl struct
870856 * @id: acx id
871857 * @buf: buffer for the response, including all headers, must work with dma
872
- * @len: length of buf
858
+ * @cmd_len: length of command
859
+ * @res_len: length of payload
873860 */
874861 int wl1271_cmd_interrogate(struct wl1271 *wl, u16 id, void *buf,
875862 size_t cmd_len, size_t res_len)
....@@ -1094,7 +1081,7 @@
10941081 out:
10951082 dev_kfree_skb(skb);
10961083 if (ret)
1097
- wl1271_warning("cmd buld null data failed %d", ret);
1084
+ wl1271_warning("cmd build null data failed %d", ret);
10981085
10991086 return ret;
11001087
....@@ -1427,7 +1414,7 @@
14271414 ret = wl1271_cmd_send(wl, CMD_SET_KEYS, cmd, sizeof(*cmd), 0);
14281415 if (ret < 0) {
14291416 wl1271_warning("could not set keys");
1430
- goto out;
1417
+ goto out;
14311418 }
14321419
14331420 out:
....@@ -1443,7 +1430,7 @@
14431430 int wl1271_cmd_set_ap_key(struct wl1271 *wl, struct wl12xx_vif *wlvif,
14441431 u16 action, u8 id, u8 key_type,
14451432 u8 key_size, const u8 *key, u8 hlid, u32 tx_seq_32,
1446
- u16 tx_seq_16)
1433
+ u16 tx_seq_16, bool is_pairwise)
14471434 {
14481435 struct wl1271_cmd_set_keys *cmd;
14491436 int ret = 0;
....@@ -1458,8 +1445,10 @@
14581445 lid_type = WEP_DEFAULT_LID_TYPE;
14591446 else
14601447 lid_type = BROADCAST_LID_TYPE;
1461
- } else {
1448
+ } else if (is_pairwise) {
14621449 lid_type = UNICAST_LID_TYPE;
1450
+ } else {
1451
+ lid_type = BROADCAST_LID_TYPE;
14631452 }
14641453
14651454 wl1271_debug(DEBUG_CRYPT, "ap key action: %d id: %d lid: %d type: %d"
....@@ -1700,14 +1689,14 @@
17001689 ch_bit_idx = wlcore_get_reg_conf_ch_idx(band, channel);
17011690
17021691 if (ch_bit_idx >= 0 && ch_bit_idx <= WL1271_MAX_CHANNELS)
1703
- set_bit(ch_bit_idx, (long *)wl->reg_ch_conf_pending);
1692
+ __set_bit_le(ch_bit_idx, (long *)wl->reg_ch_conf_pending);
17041693 }
17051694
17061695 int wlcore_cmd_regdomain_config_locked(struct wl1271 *wl)
17071696 {
17081697 struct wl12xx_cmd_regdomain_dfs_config *cmd = NULL;
17091698 int ret = 0, i, b, ch_bit_idx;
1710
- u32 tmp_ch_bitmap[2];
1699
+ __le32 tmp_ch_bitmap[2] __aligned(sizeof(unsigned long));
17111700 struct wiphy *wiphy = wl->hw->wiphy;
17121701 struct ieee80211_supported_band *band;
17131702 bool timeout = false;
....@@ -1717,7 +1706,7 @@
17171706
17181707 wl1271_debug(DEBUG_CMD, "cmd reg domain config");
17191708
1720
- memset(tmp_ch_bitmap, 0, sizeof(tmp_ch_bitmap));
1709
+ memcpy(tmp_ch_bitmap, wl->reg_ch_conf_pending, sizeof(tmp_ch_bitmap));
17211710
17221711 for (b = NL80211_BAND_2GHZ; b <= NL80211_BAND_5GHZ; b++) {
17231712 band = wiphy->bands[b];
....@@ -1738,12 +1727,9 @@
17381727 if (ch_bit_idx < 0)
17391728 continue;
17401729
1741
- set_bit(ch_bit_idx, (long *)tmp_ch_bitmap);
1730
+ __set_bit_le(ch_bit_idx, (long *)tmp_ch_bitmap);
17421731 }
17431732 }
1744
-
1745
- tmp_ch_bitmap[0] |= wl->reg_ch_conf_pending[0];
1746
- tmp_ch_bitmap[1] |= wl->reg_ch_conf_pending[1];
17471733
17481734 if (!memcmp(tmp_ch_bitmap, wl->reg_ch_conf_last, sizeof(tmp_ch_bitmap)))
17491735 goto out;
....@@ -1754,8 +1740,8 @@
17541740 goto out;
17551741 }
17561742
1757
- cmd->ch_bit_map1 = cpu_to_le32(tmp_ch_bitmap[0]);
1758
- cmd->ch_bit_map2 = cpu_to_le32(tmp_ch_bitmap[1]);
1743
+ cmd->ch_bit_map1 = tmp_ch_bitmap[0];
1744
+ cmd->ch_bit_map2 = tmp_ch_bitmap[1];
17591745 cmd->dfs_region = wl->dfs_region;
17601746
17611747 wl1271_debug(DEBUG_CMD,