| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * This file is part of wl1271 |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2009-2010 Nokia Corporation |
|---|
| 5 | 6 | * |
|---|
| 6 | 7 | * 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 | | - * |
|---|
| 22 | 8 | */ |
|---|
| 23 | 9 | |
|---|
| 24 | 10 | #include <linux/module.h> |
|---|
| .. | .. |
|---|
| 839 | 825 | * |
|---|
| 840 | 826 | * @wl: wl struct |
|---|
| 841 | 827 | * @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 |
|---|
| 843 | 829 | * @answer: is answer needed |
|---|
| 844 | 830 | */ |
|---|
| 845 | 831 | int wl1271_cmd_test(struct wl1271 *wl, void *buf, size_t buf_len, u8 answer) |
|---|
| .. | .. |
|---|
| 869 | 855 | * @wl: wl struct |
|---|
| 870 | 856 | * @id: acx id |
|---|
| 871 | 857 | * @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 |
|---|
| 873 | 860 | */ |
|---|
| 874 | 861 | int wl1271_cmd_interrogate(struct wl1271 *wl, u16 id, void *buf, |
|---|
| 875 | 862 | size_t cmd_len, size_t res_len) |
|---|
| .. | .. |
|---|
| 1094 | 1081 | out: |
|---|
| 1095 | 1082 | dev_kfree_skb(skb); |
|---|
| 1096 | 1083 | if (ret) |
|---|
| 1097 | | - wl1271_warning("cmd buld null data failed %d", ret); |
|---|
| 1084 | + wl1271_warning("cmd build null data failed %d", ret); |
|---|
| 1098 | 1085 | |
|---|
| 1099 | 1086 | return ret; |
|---|
| 1100 | 1087 | |
|---|
| .. | .. |
|---|
| 1427 | 1414 | ret = wl1271_cmd_send(wl, CMD_SET_KEYS, cmd, sizeof(*cmd), 0); |
|---|
| 1428 | 1415 | if (ret < 0) { |
|---|
| 1429 | 1416 | wl1271_warning("could not set keys"); |
|---|
| 1430 | | - goto out; |
|---|
| 1417 | + goto out; |
|---|
| 1431 | 1418 | } |
|---|
| 1432 | 1419 | |
|---|
| 1433 | 1420 | out: |
|---|
| .. | .. |
|---|
| 1443 | 1430 | int wl1271_cmd_set_ap_key(struct wl1271 *wl, struct wl12xx_vif *wlvif, |
|---|
| 1444 | 1431 | u16 action, u8 id, u8 key_type, |
|---|
| 1445 | 1432 | 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) |
|---|
| 1447 | 1434 | { |
|---|
| 1448 | 1435 | struct wl1271_cmd_set_keys *cmd; |
|---|
| 1449 | 1436 | int ret = 0; |
|---|
| .. | .. |
|---|
| 1458 | 1445 | lid_type = WEP_DEFAULT_LID_TYPE; |
|---|
| 1459 | 1446 | else |
|---|
| 1460 | 1447 | lid_type = BROADCAST_LID_TYPE; |
|---|
| 1461 | | - } else { |
|---|
| 1448 | + } else if (is_pairwise) { |
|---|
| 1462 | 1449 | lid_type = UNICAST_LID_TYPE; |
|---|
| 1450 | + } else { |
|---|
| 1451 | + lid_type = BROADCAST_LID_TYPE; |
|---|
| 1463 | 1452 | } |
|---|
| 1464 | 1453 | |
|---|
| 1465 | 1454 | wl1271_debug(DEBUG_CRYPT, "ap key action: %d id: %d lid: %d type: %d" |
|---|
| .. | .. |
|---|
| 1700 | 1689 | ch_bit_idx = wlcore_get_reg_conf_ch_idx(band, channel); |
|---|
| 1701 | 1690 | |
|---|
| 1702 | 1691 | 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); |
|---|
| 1704 | 1693 | } |
|---|
| 1705 | 1694 | |
|---|
| 1706 | 1695 | int wlcore_cmd_regdomain_config_locked(struct wl1271 *wl) |
|---|
| 1707 | 1696 | { |
|---|
| 1708 | 1697 | struct wl12xx_cmd_regdomain_dfs_config *cmd = NULL; |
|---|
| 1709 | 1698 | int ret = 0, i, b, ch_bit_idx; |
|---|
| 1710 | | - u32 tmp_ch_bitmap[2]; |
|---|
| 1699 | + __le32 tmp_ch_bitmap[2] __aligned(sizeof(unsigned long)); |
|---|
| 1711 | 1700 | struct wiphy *wiphy = wl->hw->wiphy; |
|---|
| 1712 | 1701 | struct ieee80211_supported_band *band; |
|---|
| 1713 | 1702 | bool timeout = false; |
|---|
| .. | .. |
|---|
| 1717 | 1706 | |
|---|
| 1718 | 1707 | wl1271_debug(DEBUG_CMD, "cmd reg domain config"); |
|---|
| 1719 | 1708 | |
|---|
| 1720 | | - memset(tmp_ch_bitmap, 0, sizeof(tmp_ch_bitmap)); |
|---|
| 1709 | + memcpy(tmp_ch_bitmap, wl->reg_ch_conf_pending, sizeof(tmp_ch_bitmap)); |
|---|
| 1721 | 1710 | |
|---|
| 1722 | 1711 | for (b = NL80211_BAND_2GHZ; b <= NL80211_BAND_5GHZ; b++) { |
|---|
| 1723 | 1712 | band = wiphy->bands[b]; |
|---|
| .. | .. |
|---|
| 1738 | 1727 | if (ch_bit_idx < 0) |
|---|
| 1739 | 1728 | continue; |
|---|
| 1740 | 1729 | |
|---|
| 1741 | | - set_bit(ch_bit_idx, (long *)tmp_ch_bitmap); |
|---|
| 1730 | + __set_bit_le(ch_bit_idx, (long *)tmp_ch_bitmap); |
|---|
| 1742 | 1731 | } |
|---|
| 1743 | 1732 | } |
|---|
| 1744 | | - |
|---|
| 1745 | | - tmp_ch_bitmap[0] |= wl->reg_ch_conf_pending[0]; |
|---|
| 1746 | | - tmp_ch_bitmap[1] |= wl->reg_ch_conf_pending[1]; |
|---|
| 1747 | 1733 | |
|---|
| 1748 | 1734 | if (!memcmp(tmp_ch_bitmap, wl->reg_ch_conf_last, sizeof(tmp_ch_bitmap))) |
|---|
| 1749 | 1735 | goto out; |
|---|
| .. | .. |
|---|
| 1754 | 1740 | goto out; |
|---|
| 1755 | 1741 | } |
|---|
| 1756 | 1742 | |
|---|
| 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]; |
|---|
| 1759 | 1745 | cmd->dfs_region = wl->dfs_region; |
|---|
| 1760 | 1746 | |
|---|
| 1761 | 1747 | wl1271_debug(DEBUG_CMD, |
|---|