Skip to content

Commit

Permalink
net: wireless: eswin: update eswin wifi driver for kernel 6.1
Browse files Browse the repository at this point in the history
update eswin wifi driver for kernel 6.1

Signed-off-by: ziv.xu <[email protected]>
  • Loading branch information
ziv.xu authored and MichaIng committed Sep 27, 2023
1 parent f5ce93f commit 6f724cf
Show file tree
Hide file tree
Showing 10 changed files with 70 additions and 33 deletions.
1 change: 1 addition & 0 deletions arch/riscv/configs/starfive_visionfive2_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ CONFIG_IWLDVM=y
CONFIG_IWLMVM=y
CONFIG_HOSTAP=y
# CONFIG_RTL_CARDS is not set
CONFIG_USB_WIFI_ECR6600U=y
CONFIG_AIC_WLAN_SUPPORT=y
CONFIG_AIC8800_WLAN_SUPPORT=m
CONFIG_AIC_LOADFW_SUPPORT=m
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/wireless/aic8800/aic8800_fdrv/rwnx_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -9361,7 +9361,7 @@ if((g_rwnx_plat->usbdev->chipid == PRODUCT_ID_AIC8801) ||
vif = rwnx_interface_add(rwnx_hw, "wlan%d", NET_NAME_UNKNOWN,
NL80211_IFTYPE_STATION, NULL);

vif = rwnx_interface_add(rwnx_hw, "wlan_ap%d", NET_NAME_UNKNOWN,
vif = rwnx_interface_add(rwnx_hw, "wlan-ap%d", NET_NAME_UNKNOWN,
NL80211_IFTYPE_AP, NULL);

#ifdef CONFIG_RWNX_MON_DATA
Expand Down
10 changes: 7 additions & 3 deletions drivers/net/wireless/eswin/ecrnx_compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@
#define regulatory_set_wiphy_regd_sync_rtnl regulatory_set_wiphy_regd_sync
#endif

#if LINUX_VERSION_CODE > KERNEL_VERSION(5, 11, 0)
#if LINUX_VERSION_CODE > KERNEL_VERSION(6, 1, 0)
#define cfg80211_ch_switch_started_notify(dev, chandef, count) \
cfg80211_ch_switch_started_notify(dev, chandef, count, 1)
cfg80211_ch_switch_started_notify(dev, chandef, count, 1, false)
#endif

#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 1, 0)
Expand All @@ -69,7 +69,11 @@
#define IEEE80211_HE_PHY_CAP9_NOMIMAL_PKT_PADDING_16US 0x80
#define IEEE80211_HE_PHY_CAP9_NOMIMAL_PKT_PADDING_RESERVED 0xc0
#define IEEE80211_HE_PHY_CAP9_NOMIMAL_PKT_PADDING_MASK 0xc0

#else
#define IEEE80211_HE_PHY_CAP9_NOMIMAL_PKT_PADDING_0US 0x00
#define IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_8US 0x1
#define IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_16US 0x2
#define IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_RESERVED 0x3
#endif // 5.1

#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0)
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/wireless/eswin/ecrnx_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*
****************************************************************************************
*/
#include <stdarg.h>
#include <linux/stdarg.h>
#include <linux/init.h>
#include "ecrnx_defs.h"
#include "eswin_utils.h"
Expand Down
3 changes: 2 additions & 1 deletion drivers/net/wireless/eswin/ecrnx_mod_params.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "ecrnx_cfgfile.h"
#include "reg_access.h"
#include "ecrnx_compat.h"
#include "fullmac/ecrnx_defs.h"

#ifdef CONFIG_ECRNX_SOFTMAC
#define COMMON_PARAM(name, default_softmac, default_fullmac) \
Expand Down Expand Up @@ -1167,7 +1168,7 @@ static void ecrnx_set_he_capa(struct ecrnx_hw *ecrnx_hw, struct wiphy *wiphy)
dcm_max_ru;
he_cap->he_cap_elem.phy_cap_info[9] |= IEEE80211_HE_PHY_CAP9_RX_FULL_BW_SU_USING_MU_WITH_COMP_SIGB |
IEEE80211_HE_PHY_CAP9_RX_FULL_BW_SU_USING_MU_WITH_NON_COMP_SIGB |
IEEE80211_HE_PHY_CAP9_NOMIMAL_PKT_PADDING_16US;
IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_16US;
#if 0
if (__MDM_VERSION(phy_vers) > 30) {
he_cap->he_cap_elem.phy_cap_info[6] |= IEEE80211_HE_PHY_CAP6_PARTIAL_BW_EXT_RANGE;
Expand Down
6 changes: 3 additions & 3 deletions drivers/net/wireless/eswin/ecrnx_msg_rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1071,9 +1071,9 @@ static inline int ecrnx_rx_sm_connect_ind(struct ecrnx_hw *ecrnx_hw,
struct cfg80211_roam_info info;
memset(&info, 0, sizeof(info));
if (ecrnx_vif->ch_index < NX_CHAN_CTXT_CNT)
info.channel = ecrnx_hw->chanctx_table[ecrnx_vif->ch_index].chan_def.chan;
info.bssid = (const u8 *)ind->bssid.array;
info.req_ie = req_ie;
info.links[0].channel = ecrnx_hw->chanctx_table[ecrnx_vif->ch_index].chan_def.chan;
info.links[0].bssid = (const u8 *)ind->bssid.array;
info.req_ie = req_ie;
info.req_ie_len = ind->assoc_req_ie_len;
info.resp_ie = rsp_ie;
info.resp_ie_len = ind->assoc_rsp_ie_len;
Expand Down
24 changes: 12 additions & 12 deletions drivers/net/wireless/eswin/ecrnx_msg_tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1723,7 +1723,7 @@ int ecrnx_send_me_sta_add(struct ecrnx_hw *ecrnx_hw, struct station_parameters *
const u8 *mac, u8 inst_nbr, struct me_sta_add_cfm *cfm)
{
struct me_sta_add_req *req;
u8 *ht_mcs = (u8 *)&params->ht_capa->mcs;
u8 *ht_mcs = (u8 *)&params->link_sta_params.ht_capa->mcs;
int i;

ECRNX_DBG(ECRNX_FN_ENTRY_STR);
Expand All @@ -1737,9 +1737,9 @@ int ecrnx_send_me_sta_add(struct ecrnx_hw *ecrnx_hw, struct station_parameters *
/* Set parameters for the MM_STA_ADD_REQ message */
memcpy(&(req->mac_addr.array[0]), mac, ETH_ALEN);

req->rate_set.length = params->supported_rates_len;
for (i = 0; i < params->supported_rates_len; i++)
req->rate_set.array[i] = params->supported_rates[i];
req->rate_set.length = params->link_sta_params.supported_rates_len;
for (i = 0; i < params->link_sta_params.supported_rates_len; i++)
req->rate_set.array[i] = params->link_sta_params.supported_rates[i];

req->flags = 0;

Expand All @@ -1749,8 +1749,8 @@ int ecrnx_send_me_sta_add(struct ecrnx_hw *ecrnx_hw, struct station_parameters *
}
#endif

if (params->ht_capa) {
const struct ieee80211_ht_cap *ht_capa = params->ht_capa;
if (params->link_sta_params.ht_capa) {
const struct ieee80211_ht_cap *ht_capa = params->link_sta_params.ht_capa;

req->flags |= STA_HT_CAPA;
req->ht_cap.ht_capa_info = cpu_to_le16(ht_capa->cap_info);
Expand All @@ -1762,8 +1762,8 @@ int ecrnx_send_me_sta_add(struct ecrnx_hw *ecrnx_hw, struct station_parameters *
req->ht_cap.asel_capa = ht_capa->antenna_selection_info;
}

if (params->vht_capa) {
const struct ieee80211_vht_cap *vht_capa = params->vht_capa;
if (params->link_sta_params.vht_capa) {
const struct ieee80211_vht_cap *vht_capa = params->link_sta_params.vht_capa;

req->flags |= STA_VHT_CAPA;
req->vht_cap.vht_capa_info = cpu_to_le32(vht_capa->vht_cap_info);
Expand All @@ -1774,8 +1774,8 @@ int ecrnx_send_me_sta_add(struct ecrnx_hw *ecrnx_hw, struct station_parameters *
}

#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0)) && defined(CONFIG_ECRNX_HE)
if (params->he_capa) {
const struct ieee80211_he_cap_elem *he_capa = params->he_capa;
if (params->link_sta_params.he_capa) {
const struct ieee80211_he_cap_elem *he_capa = params->link_sta_params.he_capa;
struct ieee80211_he_mcs_nss_supp *mcs_nss_supp =
(struct ieee80211_he_mcs_nss_supp *)(he_capa + 1);

Expand Down Expand Up @@ -1803,9 +1803,9 @@ int ecrnx_send_me_sta_add(struct ecrnx_hw *ecrnx_hw, struct station_parameters *
req->flags |= STA_MFP_CAPA;

#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)
if (params->opmode_notif_used) {
if (params->link_sta_params.opmode_notif_used) {
req->flags |= STA_OPMOD_NOTIF;
req->opmode = params->opmode_notif;
req->opmode = params->link_sta_params.opmode_notif;
}
#endif

Expand Down
3 changes: 2 additions & 1 deletion drivers/net/wireless/eswin/fullmac/ecrnx_debugfs_func.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ int ecrnx_cfg80211_dump_station(struct wiphy *wiphy, struct net_device *dev,
int idx, u8 *mac, struct station_info *sinfo);
int ecrnx_cfg80211_get_channel(struct wiphy *wiphy,
struct wireless_dev *wdev,
struct cfg80211_chan_def *chandef);
unsigned int link_id,
struct cfg80211_chan_def *chandef);
int ecrnx_log_level_get(LOG_CTL_ST *log);
int ecrnx_fw_log_level_set(u32 level, u32 dir);
bool ecrnx_log_host_enable(void);
Expand Down
6 changes: 6 additions & 0 deletions drivers/net/wireless/eswin/fullmac/ecrnx_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
#define ECRNX_RXSIZE 1024

#define CONFIG_ESWIN_RX_REORDER 1
#define IEEE80211_MAX_AMPDU_BUF IEEE80211_MAX_AMPDU_BUF_HE

#if defined(CONFIG_ECRNX_HE)
extern struct ieee80211_sta_he_cap ecrnx_he_cap;
Expand Down Expand Up @@ -990,6 +991,11 @@ struct ieee80211_sta_he_cap {
#define IEEE80211_HE_PHY_CAP9_NOMIMAL_PKT_PADDING_16US 0x80
#define IEEE80211_HE_PHY_CAP9_NOMIMAL_PKT_PADDING_RESERVED 0xc0
#define IEEE80211_HE_PHY_CAP9_NOMIMAL_PKT_PADDING_MASK 0xc0
#else
#define IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_0US 0x0
#define IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_8US 0x1
#define IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_16US 0x2
#define IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_RESERVED 0x3
#endif


Expand Down
46 changes: 35 additions & 11 deletions drivers/net/wireless/eswin/fullmac/ecrnx_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ static void ecrnx_csa_finish(struct work_struct *ws)
} else
ecrnx_txq_vif_stop(vif, ECRNX_TXQ_STOP_CHAN, ecrnx_hw);
spin_unlock_bh(&ecrnx_hw->cb_lock);
cfg80211_ch_switch_notify(vif->ndev, &csa->chandef);
cfg80211_ch_switch_notify(vif->ndev, &csa->chandef, 0);
mutex_unlock(&vif->wdev.mtx);
__release(&vif->wdev.mtx);
}
Expand Down Expand Up @@ -1190,8 +1190,11 @@ static struct wireless_dev *ecrnx_interface_add(struct ecrnx_hw *ecrnx_hw,
else
#endif
{
memcpy(ndev->dev_addr, ecrnx_hw->wiphy->perm_addr, ETH_ALEN);
ndev->dev_addr[5] ^= vif_idx;
unsigned char mac_addr[6];
memcpy(mac_addr, ecrnx_hw->wiphy->perm_addr, ETH_ALEN);
mac_addr[5] ^= vif_idx;
eth_hw_addr_set(ndev, mac_addr);
memcpy(vif->wdev.address, ndev->dev_addr, ETH_ALEN);
}

if (params) {
Expand Down Expand Up @@ -1319,7 +1322,7 @@ static int ecrnx_cfg80211_del_iface(struct wiphy *wiphy, struct wireless_dev *wd
return 0;
}

static int ecrnx_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *dev);
static int ecrnx_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *dev, unsigned int link_id);
static int ecrnx_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *dev,
u16 reason_code);

Expand All @@ -1344,7 +1347,7 @@ static int ecrnx_cfg80211_change_iface(struct wiphy *wiphy,
{
if((ECRNX_VIF_TYPE(vif) == NL80211_IFTYPE_AP) || (ECRNX_VIF_TYPE(vif) == NL80211_IFTYPE_P2P_GO))
{
ecrnx_cfg80211_stop_ap(wiphy, dev);
ecrnx_cfg80211_stop_ap(wiphy, dev, NULL);
}
else if((ECRNX_VIF_TYPE(vif) == NL80211_IFTYPE_STATION) || (ECRNX_VIF_TYPE(vif) == NL80211_IFTYPE_P2P_CLIENT))
{
Expand Down Expand Up @@ -1506,6 +1509,10 @@ static void ecrnx_cfg80211_abort_scan(struct wiphy *wiphy,
* when adding a group key.
*/
static int ecrnx_cfg80211_add_key(struct wiphy *wiphy, struct net_device *netdev,
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 0, 0)
int link_id,
#endif

u8 key_index, bool pairwise, const u8 *mac_addr,
struct key_params *params)
{
Expand Down Expand Up @@ -1603,6 +1610,10 @@ static int ecrnx_cfg80211_add_key(struct wiphy *wiphy, struct net_device *netdev
*
*/
static int ecrnx_cfg80211_get_key(struct wiphy *wiphy, struct net_device *netdev,
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 0, 0)
int link_id,
#endif

u8 key_index, bool pairwise, const u8 *mac_addr,
void *cookie,
void (*callback)(void *cookie, struct key_params*))
Expand All @@ -1618,6 +1629,10 @@ static int ecrnx_cfg80211_get_key(struct wiphy *wiphy, struct net_device *netdev
* and @key_index, return -ENOENT if the key doesn't exist.
*/
static int ecrnx_cfg80211_del_key(struct wiphy *wiphy, struct net_device *netdev,
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 0, 0)
int link_id,
#endif

u8 key_index, bool pairwise, const u8 *mac_addr)
{
struct ecrnx_hw *ecrnx_hw = wiphy_priv(wiphy);
Expand Down Expand Up @@ -1646,6 +1661,10 @@ static int ecrnx_cfg80211_del_key(struct wiphy *wiphy, struct net_device *netdev
*/
static int ecrnx_cfg80211_set_default_key(struct wiphy *wiphy,
struct net_device *netdev,
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 0, 0)
int link_id,
#endif

u8 key_index, bool unicast, bool multicast)
{
ECRNX_DBG(ECRNX_FN_ENTRY_STR);
Expand All @@ -1658,6 +1677,10 @@ static int ecrnx_cfg80211_set_default_key(struct wiphy *wiphy,
*/
static int ecrnx_cfg80211_set_default_mgmt_key(struct wiphy *wiphy,
struct net_device *netdev,
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 0, 0)
int link_id,
#endif

u8 key_index)
{
return 0;
Expand Down Expand Up @@ -1689,7 +1712,7 @@ static int ecrnx_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,
key_params.key_len = sme->key_len;
key_params.seq_len = 0;
key_params.cipher = sme->crypto.cipher_group;
ecrnx_cfg80211_add_key(wiphy, dev, sme->key_idx, false, NULL, &key_params);
ecrnx_cfg80211_add_key(wiphy, dev, NULL, sme->key_idx, false, NULL, &key_params);
}
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 17, 0)
else if ((sme->auth_type == NL80211_AUTHTYPE_SAE) &&
Expand Down Expand Up @@ -1808,8 +1831,8 @@ static int ecrnx_cfg80211_add_station(struct wiphy *wiphy, struct net_device *de
sta->vif_idx = ecrnx_vif->vif_index;
sta->vlan_idx = sta->vif_idx;
sta->qos = (params->sta_flags_set & BIT(NL80211_STA_FLAG_WME)) != 0;
sta->ht = params->ht_capa ? 1 : 0;
sta->vht = params->vht_capa ? 1 : 0;
sta->ht = params->link_sta_params.ht_capa ? 1 : 0;
sta->vht = params->link_sta_params.vht_capa ? 1 : 0;
sta->acm = 0;
sta->listen_interval = params->listen_interval;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0)
Expand Down Expand Up @@ -2054,8 +2077,8 @@ static int ecrnx_cfg80211_change_station(struct wiphy *wiphy, struct net_device
sta->vif_idx = ecrnx_vif->vif_index;
sta->vlan_idx = sta->vif_idx;
sta->qos = (params->sta_flags_set & BIT(NL80211_STA_FLAG_WME)) != 0;
sta->ht = params->ht_capa ? 1 : 0;
sta->vht = params->vht_capa ? 1 : 0;
sta->ht = params->link_sta_params.ht_capa ? 1 : 0;
sta->vht = params->link_sta_params.vht_capa ? 1 : 0;
sta->acm = 0;
for (tid = 0; tid < NX_NB_TXQ_PER_STA; tid++) {
int uapsd_bit = ecrnx_hwq2uapsd[ecrnx_tid2hwq[tid]];
Expand Down Expand Up @@ -2307,7 +2330,7 @@ static int ecrnx_cfg80211_change_beacon(struct wiphy *wiphy, struct net_device *
/**
* * @stop_ap: Stop being an AP, including stopping beaconing.
*/
static int ecrnx_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *dev)
static int ecrnx_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *dev, unsigned int link_id)
{
struct ecrnx_hw *ecrnx_hw = wiphy_priv(wiphy);
struct ecrnx_vif *ecrnx_vif = netdev_priv(dev);
Expand Down Expand Up @@ -2712,6 +2735,7 @@ static int ecrnx_cfg80211_dump_survey(struct wiphy *wiphy, struct net_device *ne
*/
int ecrnx_cfg80211_get_channel(struct wiphy *wiphy,
struct wireless_dev *wdev,
unsigned int link_id,
struct cfg80211_chan_def *chandef) {
struct ecrnx_hw *ecrnx_hw = wiphy_priv(wiphy);
struct ecrnx_vif *ecrnx_vif = container_of(wdev, struct ecrnx_vif, wdev);
Expand Down

0 comments on commit 6f724cf

Please sign in to comment.