Commit e00243fa authored by Lior David's avatar Lior David Committed by Kalle Valo

wil6210: infrastructure for multiple virtual interfaces

Simple infrastructure changes for supporting multiple
virtual interfaces (multiple VIFs).
It is still not possible to add new VIFs so the only VIF
belongs to the main interface.
Main changes:
1. Add MAC ID(mid) argument to wmi_send and wmi_call to
allow invoking WMI commands on different VIFs.
2. Similarly, in WMI event handler look at the mid reported
by FW and extract VIF structure (currently only for main
interface). All WMI event handlers operate on wil6210_vif
structure so they know on which VIF they were called.
3. Trivial changes to use wil6210_vif structure and MID
throughout the code.
4. Various changes to logging to report MID.

More complete multiple VIFs support will be added gradually
in next patches.
Signed-off-by: default avatarLior David <liord@codeaurora.org>
Signed-off-by: default avatarMaya Erez <merez@codeaurora.org>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 7bfe9e22
This diff is collapsed.
/* /*
* Copyright (c) 2013,2016 Qualcomm Atheros, Inc. * Copyright (c) 2013,2016 Qualcomm Atheros, Inc.
* Copyright (c) 2018, The Linux Foundation. All rights reserved.
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
...@@ -25,7 +26,7 @@ void __wil_err(struct wil6210_priv *wil, const char *fmt, ...) ...@@ -25,7 +26,7 @@ void __wil_err(struct wil6210_priv *wil, const char *fmt, ...)
va_start(args, fmt); va_start(args, fmt);
vaf.fmt = fmt; vaf.fmt = fmt;
vaf.va = &args; vaf.va = &args;
netdev_err(wil_to_ndev(wil), "%pV", &vaf); netdev_err(wil->main_ndev, "%pV", &vaf);
trace_wil6210_log_err(&vaf); trace_wil6210_log_err(&vaf);
va_end(args); va_end(args);
} }
...@@ -41,7 +42,7 @@ void __wil_err_ratelimited(struct wil6210_priv *wil, const char *fmt, ...) ...@@ -41,7 +42,7 @@ void __wil_err_ratelimited(struct wil6210_priv *wil, const char *fmt, ...)
va_start(args, fmt); va_start(args, fmt);
vaf.fmt = fmt; vaf.fmt = fmt;
vaf.va = &args; vaf.va = &args;
netdev_err(wil_to_ndev(wil), "%pV", &vaf); netdev_err(wil->main_ndev, "%pV", &vaf);
trace_wil6210_log_err(&vaf); trace_wil6210_log_err(&vaf);
va_end(args); va_end(args);
} }
...@@ -57,7 +58,7 @@ void wil_dbg_ratelimited(const struct wil6210_priv *wil, const char *fmt, ...) ...@@ -57,7 +58,7 @@ void wil_dbg_ratelimited(const struct wil6210_priv *wil, const char *fmt, ...)
va_start(args, fmt); va_start(args, fmt);
vaf.fmt = fmt; vaf.fmt = fmt;
vaf.va = &args; vaf.va = &args;
netdev_dbg(wil_to_ndev(wil), "%pV", &vaf); netdev_dbg(wil->main_ndev, "%pV", &vaf);
trace_wil6210_log_dbg(&vaf); trace_wil6210_log_dbg(&vaf);
va_end(args); va_end(args);
} }
...@@ -70,7 +71,7 @@ void __wil_info(struct wil6210_priv *wil, const char *fmt, ...) ...@@ -70,7 +71,7 @@ void __wil_info(struct wil6210_priv *wil, const char *fmt, ...)
va_start(args, fmt); va_start(args, fmt);
vaf.fmt = fmt; vaf.fmt = fmt;
vaf.va = &args; vaf.va = &args;
netdev_info(wil_to_ndev(wil), "%pV", &vaf); netdev_info(wil->main_ndev, "%pV", &vaf);
trace_wil6210_log_info(&vaf); trace_wil6210_log_info(&vaf);
va_end(args); va_end(args);
} }
......
/* /*
* Copyright (c) 2012-2017 Qualcomm Atheros, Inc. * Copyright (c) 2012-2017 Qualcomm Atheros, Inc.
* Copyright (c) 2018, The Linux Foundation. All rights reserved.
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
...@@ -621,7 +622,7 @@ static ssize_t wil_write_file_reset(struct file *file, const char __user *buf, ...@@ -621,7 +622,7 @@ static ssize_t wil_write_file_reset(struct file *file, const char __user *buf,
size_t len, loff_t *ppos) size_t len, loff_t *ppos)
{ {
struct wil6210_priv *wil = file->private_data; struct wil6210_priv *wil = file->private_data;
struct net_device *ndev = wil_to_ndev(wil); struct net_device *ndev = wil->main_ndev;
/** /**
* BUG: * BUG:
...@@ -716,27 +717,44 @@ static ssize_t wil_write_back(struct file *file, const char __user *buf, ...@@ -716,27 +717,44 @@ static ssize_t wil_write_back(struct file *file, const char __user *buf,
if (rc < 2) if (rc < 2)
return -EINVAL; return -EINVAL;
if (0 == strcmp(cmd, "add")) { if ((strcmp(cmd, "add") == 0) ||
if (rc < 3) { (strcmp(cmd, "del_tx") == 0)) {
wil_err(wil, "BACK: add require at least 2 params\n"); struct vring_tx_data *txdata;
if (p1 < 0 || p1 >= WIL6210_MAX_TX_RINGS) {
wil_err(wil, "BACK: invalid ring id %d\n", p1);
return -EINVAL; return -EINVAL;
} }
if (rc < 4) txdata = &wil->vring_tx_data[p1];
p3 = 0; if (strcmp(cmd, "add") == 0) {
wmi_addba(wil, p1, p2, p3); if (rc < 3) {
} else if (0 == strcmp(cmd, "del_tx")) { wil_err(wil, "BACK: add require at least 2 params\n");
if (rc < 3) return -EINVAL;
p2 = WLAN_REASON_QSTA_LEAVE_QBSS; }
wmi_delba_tx(wil, p1, p2); if (rc < 4)
} else if (0 == strcmp(cmd, "del_rx")) { p3 = 0;
wmi_addba(wil, txdata->mid, p1, p2, p3);
} else {
if (rc < 3)
p2 = WLAN_REASON_QSTA_LEAVE_QBSS;
wmi_delba_tx(wil, txdata->mid, p1, p2);
}
} else if (strcmp(cmd, "del_rx") == 0) {
struct wil_sta_info *sta;
if (rc < 3) { if (rc < 3) {
wil_err(wil, wil_err(wil,
"BACK: del_rx require at least 2 params\n"); "BACK: del_rx require at least 2 params\n");
return -EINVAL; return -EINVAL;
} }
if (p1 < 0 || p1 >= WIL6210_MAX_CID) {
wil_err(wil, "BACK: invalid CID %d\n", p1);
return -EINVAL;
}
if (rc < 4) if (rc < 4)
p3 = WLAN_REASON_QSTA_LEAVE_QBSS; p3 = WLAN_REASON_QSTA_LEAVE_QBSS;
wmi_delba_rx(wil, mk_cidxtid(p1, p2), p3); sta = &wil->sta[p1];
wmi_delba_rx(wil, sta->mid, mk_cidxtid(p1, p2), p3);
} else { } else {
wil_err(wil, "BACK: Unrecognized command \"%s\"\n", cmd); wil_err(wil, "BACK: Unrecognized command \"%s\"\n", cmd);
return -EINVAL; return -EINVAL;
...@@ -855,7 +873,7 @@ static ssize_t wil_write_file_txmgmt(struct file *file, const char __user *buf, ...@@ -855,7 +873,7 @@ static ssize_t wil_write_file_txmgmt(struct file *file, const char __user *buf,
{ {
struct wil6210_priv *wil = file->private_data; struct wil6210_priv *wil = file->private_data;
struct wiphy *wiphy = wil_to_wiphy(wil); struct wiphy *wiphy = wil_to_wiphy(wil);
struct wireless_dev *wdev = wil_to_wdev(wil); struct wireless_dev *wdev = wil->main_ndev->ieee80211_ptr;
struct cfg80211_mgmt_tx_params params; struct cfg80211_mgmt_tx_params params;
int rc; int rc;
void *frame; void *frame;
...@@ -890,6 +908,7 @@ static ssize_t wil_write_file_wmi(struct file *file, const char __user *buf, ...@@ -890,6 +908,7 @@ static ssize_t wil_write_file_wmi(struct file *file, const char __user *buf,
size_t len, loff_t *ppos) size_t len, loff_t *ppos)
{ {
struct wil6210_priv *wil = file->private_data; struct wil6210_priv *wil = file->private_data;
struct wil6210_vif *vif = ndev_to_vif(wil->main_ndev);
struct wmi_cmd_hdr *wmi; struct wmi_cmd_hdr *wmi;
void *cmd; void *cmd;
int cmdlen = len - sizeof(struct wmi_cmd_hdr); int cmdlen = len - sizeof(struct wmi_cmd_hdr);
...@@ -912,7 +931,7 @@ static ssize_t wil_write_file_wmi(struct file *file, const char __user *buf, ...@@ -912,7 +931,7 @@ static ssize_t wil_write_file_wmi(struct file *file, const char __user *buf,
cmd = (cmdlen > 0) ? &wmi[1] : NULL; cmd = (cmdlen > 0) ? &wmi[1] : NULL;
cmdid = le16_to_cpu(wmi->command_id); cmdid = le16_to_cpu(wmi->command_id);
rc1 = wmi_send(wil, cmdid, cmd, cmdlen); rc1 = wmi_send(wil, cmdid, vif->mid, cmd, cmdlen);
kfree(wmi); kfree(wmi);
wil_info(wil, "0x%04x[%d] -> %d\n", cmdid, cmdlen, rc1); wil_info(wil, "0x%04x[%d] -> %d\n", cmdid, cmdlen, rc1);
...@@ -1050,6 +1069,7 @@ static int wil_bf_debugfs_show(struct seq_file *s, void *data) ...@@ -1050,6 +1069,7 @@ static int wil_bf_debugfs_show(struct seq_file *s, void *data)
int rc; int rc;
int i; int i;
struct wil6210_priv *wil = s->private; struct wil6210_priv *wil = s->private;
struct wil6210_vif *vif = ndev_to_vif(wil->main_ndev);
struct wmi_notify_req_cmd cmd = { struct wmi_notify_req_cmd cmd = {
.interval_usec = 0, .interval_usec = 0,
}; };
...@@ -1062,7 +1082,8 @@ static int wil_bf_debugfs_show(struct seq_file *s, void *data) ...@@ -1062,7 +1082,8 @@ static int wil_bf_debugfs_show(struct seq_file *s, void *data)
u32 status; u32 status;
cmd.cid = i; cmd.cid = i;
rc = wmi_call(wil, WMI_NOTIFY_REQ_CMDID, &cmd, sizeof(cmd), rc = wmi_call(wil, WMI_NOTIFY_REQ_CMDID, vif->mid,
&cmd, sizeof(cmd),
WMI_NOTIFY_REQ_DONE_EVENTID, &reply, WMI_NOTIFY_REQ_DONE_EVENTID, &reply,
sizeof(reply), 20); sizeof(reply), 20);
/* if reply is all-0, ignore this CID */ /* if reply is all-0, ignore this CID */
...@@ -1155,7 +1176,7 @@ static const struct file_operations fops_temp = { ...@@ -1155,7 +1176,7 @@ static const struct file_operations fops_temp = {
static int wil_freq_debugfs_show(struct seq_file *s, void *data) static int wil_freq_debugfs_show(struct seq_file *s, void *data)
{ {
struct wil6210_priv *wil = s->private; struct wil6210_priv *wil = s->private;
struct wireless_dev *wdev = wil_to_wdev(wil); struct wireless_dev *wdev = wil->main_ndev->ieee80211_ptr;
u16 freq = wdev->chandef.chan ? wdev->chandef.chan->center_freq : 0; u16 freq = wdev->chandef.chan ? wdev->chandef.chan->center_freq : 0;
seq_printf(s, "Freq = %d\n", freq); seq_printf(s, "Freq = %d\n", freq);
...@@ -1180,6 +1201,7 @@ static int wil_link_debugfs_show(struct seq_file *s, void *data) ...@@ -1180,6 +1201,7 @@ static int wil_link_debugfs_show(struct seq_file *s, void *data)
{ {
struct wil6210_priv *wil = s->private; struct wil6210_priv *wil = s->private;
struct station_info sinfo; struct station_info sinfo;
struct wil6210_vif *vif = ndev_to_vif(wil->main_ndev);
int i, rc; int i, rc;
for (i = 0; i < ARRAY_SIZE(wil->sta); i++) { for (i = 0; i < ARRAY_SIZE(wil->sta); i++) {
...@@ -1200,7 +1222,7 @@ static int wil_link_debugfs_show(struct seq_file *s, void *data) ...@@ -1200,7 +1222,7 @@ static int wil_link_debugfs_show(struct seq_file *s, void *data)
seq_printf(s, "[%d] %pM %s\n", i, p->addr, status); seq_printf(s, "[%d] %pM %s\n", i, p->addr, status);
if (p->status == wil_sta_connected) { if (p->status == wil_sta_connected) {
rc = wil_cid_fill_sinfo(wil, i, &sinfo); rc = wil_cid_fill_sinfo(vif, i, &sinfo);
if (rc) if (rc)
return rc; return rc;
...@@ -1229,7 +1251,7 @@ static const struct file_operations fops_link = { ...@@ -1229,7 +1251,7 @@ static const struct file_operations fops_link = {
static int wil_info_debugfs_show(struct seq_file *s, void *data) static int wil_info_debugfs_show(struct seq_file *s, void *data)
{ {
struct wil6210_priv *wil = s->private; struct wil6210_priv *wil = s->private;
struct net_device *ndev = wil_to_ndev(wil); struct net_device *ndev = wil->main_ndev;
int is_ac = power_supply_is_system_supplied(); int is_ac = power_supply_is_system_supplied();
int rx = atomic_xchg(&wil->isr_count_rx, 0); int rx = atomic_xchg(&wil->isr_count_rx, 0);
int tx = atomic_xchg(&wil->isr_count_tx, 0); int tx = atomic_xchg(&wil->isr_count_tx, 0);
...@@ -1773,11 +1795,9 @@ static void wil6210_debugfs_init_isr(struct wil6210_priv *wil, ...@@ -1773,11 +1795,9 @@ static void wil6210_debugfs_init_isr(struct wil6210_priv *wil,
/* fields in struct wil6210_priv */ /* fields in struct wil6210_priv */
static const struct dbg_off dbg_wil_off[] = { static const struct dbg_off dbg_wil_off[] = {
WIL_FIELD(privacy, 0444, doff_u32),
WIL_FIELD(status[0], 0644, doff_ulong), WIL_FIELD(status[0], 0644, doff_ulong),
WIL_FIELD(hw_version, 0444, doff_x32), WIL_FIELD(hw_version, 0444, doff_x32),
WIL_FIELD(recovery_count, 0444, doff_u32), WIL_FIELD(recovery_count, 0444, doff_u32),
WIL_FIELD(ap_isolate, 0444, doff_u32),
WIL_FIELD(discovery_mode, 0644, doff_u8), WIL_FIELD(discovery_mode, 0644, doff_u8),
WIL_FIELD(chip_revision, 0444, doff_u8), WIL_FIELD(chip_revision, 0444, doff_u8),
WIL_FIELD(abft_len, 0644, doff_u8), WIL_FIELD(abft_len, 0644, doff_u8),
......
/* /*
* Copyright (c) 2014,2017 Qualcomm Atheros, Inc. * Copyright (c) 2014,2017 Qualcomm Atheros, Inc.
* Copyright (c) 2018, The Linux Foundation. All rights reserved.
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
...@@ -74,12 +75,13 @@ static int wil_ethtoolops_set_coalesce(struct net_device *ndev, ...@@ -74,12 +75,13 @@ static int wil_ethtoolops_set_coalesce(struct net_device *ndev,
struct ethtool_coalesce *cp) struct ethtool_coalesce *cp)
{ {
struct wil6210_priv *wil = ndev_to_wil(ndev); struct wil6210_priv *wil = ndev_to_wil(ndev);
struct wireless_dev *wdev = ndev->ieee80211_ptr;
int ret; int ret;
wil_dbg_misc(wil, "ethtoolops_set_coalesce: rx %d usec, tx %d usec\n", wil_dbg_misc(wil, "ethtoolops_set_coalesce: rx %d usec, tx %d usec\n",
cp->rx_coalesce_usecs, cp->tx_coalesce_usecs); cp->rx_coalesce_usecs, cp->tx_coalesce_usecs);
if (wil->wdev->iftype == NL80211_IFTYPE_MONITOR) { if (wdev->iftype == NL80211_IFTYPE_MONITOR) {
wil_dbg_misc(wil, "No IRQ coalescing in monitor mode\n"); wil_dbg_misc(wil, "No IRQ coalescing in monitor mode\n");
return -EINVAL; return -EINVAL;
} }
......
...@@ -188,12 +188,14 @@ void wil_unmask_irq(struct wil6210_priv *wil) ...@@ -188,12 +188,14 @@ void wil_unmask_irq(struct wil6210_priv *wil)
void wil_configure_interrupt_moderation(struct wil6210_priv *wil) void wil_configure_interrupt_moderation(struct wil6210_priv *wil)
{ {
struct wireless_dev *wdev = wil->main_ndev->ieee80211_ptr;
wil_dbg_irq(wil, "configure_interrupt_moderation\n"); wil_dbg_irq(wil, "configure_interrupt_moderation\n");
/* disable interrupt moderation for monitor /* disable interrupt moderation for monitor
* to get better timestamp precision * to get better timestamp precision
*/ */
if (wil->wdev->iftype == NL80211_IFTYPE_MONITOR) if (wdev->iftype == NL80211_IFTYPE_MONITOR)
return; return;
/* Disable and clear tx counter before (re)configuration */ /* Disable and clear tx counter before (re)configuration */
...@@ -340,7 +342,7 @@ static irqreturn_t wil6210_irq_tx(int irq, void *cookie) ...@@ -340,7 +342,7 @@ static irqreturn_t wil6210_irq_tx(int irq, void *cookie)
static void wil_notify_fw_error(struct wil6210_priv *wil) static void wil_notify_fw_error(struct wil6210_priv *wil)
{ {
struct device *dev = &wil_to_ndev(wil)->dev; struct device *dev = &wil->main_ndev->dev;
char *envp[3] = { char *envp[3] = {
[0] = "SOURCE=wil6210", [0] = "SOURCE=wil6210",
[1] = "EVENT=FW_ERROR", [1] = "EVENT=FW_ERROR",
......
This diff is collapsed.
...@@ -122,6 +122,85 @@ static void wil_dev_setup(struct net_device *dev) ...@@ -122,6 +122,85 @@ static void wil_dev_setup(struct net_device *dev)
dev->tx_queue_len = WIL_TX_Q_LEN_DEFAULT; dev->tx_queue_len = WIL_TX_Q_LEN_DEFAULT;
} }
static void wil_vif_deinit(struct wil6210_vif *vif)
{
del_timer_sync(&vif->scan_timer);
del_timer_sync(&vif->p2p.discovery_timer);
cancel_work_sync(&vif->disconnect_worker);
cancel_work_sync(&vif->p2p.discovery_expired_work);
cancel_work_sync(&vif->p2p.delayed_listen_work);
wil_probe_client_flush(vif);
cancel_work_sync(&vif->probe_client_worker);
}
void wil_vif_free(struct wil6210_vif *vif)
{
struct net_device *ndev = vif_to_ndev(vif);
wil_vif_deinit(vif);
free_netdev(ndev);
}
static void wil_ndev_destructor(struct net_device *ndev)
{
struct wil6210_vif *vif = ndev_to_vif(ndev);
wil_vif_deinit(vif);
}
static void wil_connect_timer_fn(struct timer_list *t)
{
struct wil6210_vif *vif = from_timer(vif, t, connect_timer);
struct wil6210_priv *wil = vif_to_wil(vif);
bool q;
wil_err(wil, "Connect timeout detected, disconnect station\n");
/* reschedule to thread context - disconnect won't
* run from atomic context.
* queue on wmi_wq to prevent race with connect event.
*/
q = queue_work(wil->wmi_wq, &vif->disconnect_worker);
wil_dbg_wmi(wil, "queue_work of disconnect_worker -> %d\n", q);
}
static void wil_scan_timer_fn(struct timer_list *t)
{
struct wil6210_vif *vif = from_timer(vif, t, scan_timer);
struct wil6210_priv *wil = vif_to_wil(vif);
clear_bit(wil_status_fwready, wil->status);
wil_err(wil, "Scan timeout detected, start fw error recovery\n");
wil_fw_error_recovery(wil);
}
static void wil_p2p_discovery_timer_fn(struct timer_list *t)
{
struct wil6210_vif *vif = from_timer(vif, t, p2p.discovery_timer);
struct wil6210_priv *wil = vif_to_wil(vif);
wil_dbg_misc(wil, "p2p_discovery_timer_fn\n");
schedule_work(&vif->p2p.discovery_expired_work);
}
static void wil_vif_init(struct wil6210_vif *vif)
{
vif->bcast_vring = -1;
mutex_init(&vif->probe_client_mutex);
timer_setup(&vif->connect_timer, wil_connect_timer_fn, 0);
timer_setup(&vif->scan_timer, wil_scan_timer_fn, 0);
timer_setup(&vif->p2p.discovery_timer, wil_p2p_discovery_timer_fn, 0);
INIT_WORK(&vif->probe_client_worker, wil_probe_client_worker);
INIT_WORK(&vif->disconnect_worker, wil_disconnect_worker);
INIT_WORK(&vif->p2p.delayed_listen_work, wil_p2p_delayed_listen_work);
INIT_LIST_HEAD(&vif->probe_client_pending);
}
struct wil6210_vif * struct wil6210_vif *
wil_vif_alloc(struct wil6210_priv *wil, const char *name, wil_vif_alloc(struct wil6210_priv *wil, const char *name,
unsigned char name_assign_type, enum nl80211_iftype iftype, unsigned char name_assign_type, enum nl80211_iftype iftype,
...@@ -138,10 +217,12 @@ wil_vif_alloc(struct wil6210_priv *wil, const char *name, ...@@ -138,10 +217,12 @@ wil_vif_alloc(struct wil6210_priv *wil, const char *name,
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
} }
if (mid == 0) if (mid == 0)
wil->ndev = ndev; wil->main_ndev = ndev;
vif = ndev_to_vif(ndev); vif = ndev_to_vif(ndev);
vif->ndev = ndev;
vif->wil = wil; vif->wil = wil;
vif->mid = mid; vif->mid = mid;
wil_vif_init(vif);
wdev = &vif->wdev; wdev = &vif->wdev;
wdev->wiphy = wil->wiphy; wdev->wiphy = wil->wiphy;
...@@ -163,7 +244,6 @@ wil_vif_alloc(struct wil6210_priv *wil, const char *name, ...@@ -163,7 +244,6 @@ wil_vif_alloc(struct wil6210_priv *wil, const char *name,
void *wil_if_alloc(struct device *dev) void *wil_if_alloc(struct device *dev)
{ {
struct wireless_dev *wdev;
struct wil6210_priv *wil; struct wil6210_priv *wil;
struct wil6210_vif *vif; struct wil6210_vif *vif;
int rc = 0; int rc = 0;
...@@ -190,9 +270,7 @@ void *wil_if_alloc(struct device *dev) ...@@ -190,9 +270,7 @@ void *wil_if_alloc(struct device *dev)
goto out_priv; goto out_priv;
} }
wdev = &vif->wdev; wil->radio_wdev = vif_to_wdev(vif);
wil->wdev = wdev;
wil->radio_wdev = wdev;
return wil; return wil;
...@@ -207,7 +285,7 @@ void *wil_if_alloc(struct device *dev) ...@@ -207,7 +285,7 @@ void *wil_if_alloc(struct device *dev)
void wil_if_free(struct wil6210_priv *wil) void wil_if_free(struct wil6210_priv *wil)
{ {
struct net_device *ndev = wil_to_ndev(wil); struct net_device *ndev = wil->main_ndev;
wil_dbg_misc(wil, "if_free\n"); wil_dbg_misc(wil, "if_free\n");
...@@ -216,7 +294,8 @@ void wil_if_free(struct wil6210_priv *wil) ...@@ -216,7 +294,8 @@ void wil_if_free(struct wil6210_priv *wil)
wil_priv_deinit(wil); wil_priv_deinit(wil);
wil_to_ndev(wil) = NULL; wil->main_ndev = NULL;
wil_ndev_destructor(ndev);
free_netdev(ndev); free_netdev(ndev);
wil_cfg80211_deinit(wil); wil_cfg80211_deinit(wil);
...@@ -224,9 +303,8 @@ void wil_if_free(struct wil6210_priv *wil) ...@@ -224,9 +303,8 @@ void wil_if_free(struct wil6210_priv *wil)
int wil_if_add(struct wil6210_priv *wil) int wil_if_add(struct wil6210_priv *wil)
{ {
struct wireless_dev *wdev = wil_to_wdev(wil);
struct wiphy *wiphy = wil->wiphy; struct wiphy *wiphy = wil->wiphy;
struct net_device *ndev = wil_to_ndev(wil); struct net_device *ndev = wil->main_ndev;
int rc; int rc;
wil_dbg_misc(wil, "entered"); wil_dbg_misc(wil, "entered");
...@@ -255,14 +333,14 @@ int wil_if_add(struct wil6210_priv *wil) ...@@ -255,14 +333,14 @@ int wil_if_add(struct wil6210_priv *wil)
return 0; return 0;
out_wiphy: out_wiphy:
wiphy_unregister(wdev->wiphy); wiphy_unregister(wiphy);
return rc; return rc;
} }
void wil_if_remove(struct wil6210_priv *wil) void wil_if_remove(struct wil6210_priv *wil)
{ {
struct net_device *ndev = wil_to_ndev(wil); struct net_device *ndev = wil->main_ndev;
struct wireless_dev *wdev = wil_to_wdev(wil); struct wireless_dev *wdev = ndev->ieee80211_ptr;
wil_dbg_misc(wil, "if_remove\n"); wil_dbg_misc(wil, "if_remove\n");
......
This diff is collapsed.
...@@ -425,7 +425,7 @@ static int wil6210_suspend(struct device *dev, bool is_runtime) ...@@ -425,7 +425,7 @@ static int wil6210_suspend(struct device *dev, bool is_runtime)
int rc = 0; int rc = 0;
struct pci_dev *pdev = to_pci_dev(dev); struct pci_dev *pdev = to_pci_dev(dev);
struct wil6210_priv *wil = pci_get_drvdata(pdev); struct wil6210_priv *wil = pci_get_drvdata(pdev);
struct net_device *ndev = wil_to_ndev(wil); struct net_device *ndev = wil->main_ndev;
bool keep_radio_on = ndev->flags & IFF_UP && bool keep_radio_on = ndev->flags & IFF_UP &&
wil->keep_radio_on_during_sleep; wil->keep_radio_on_during_sleep;
...@@ -457,7 +457,7 @@ static int wil6210_resume(struct device *dev, bool is_runtime) ...@@ -457,7 +457,7 @@ static int wil6210_resume(struct device *dev, bool is_runtime)
int rc = 0; int rc = 0;
struct pci_dev *pdev = to_pci_dev(dev); struct pci_dev *pdev = to_pci_dev(dev);
struct wil6210_priv *wil = pci_get_drvdata(pdev); struct wil6210_priv *wil = pci_get_drvdata(pdev);
struct net_device *ndev = wil_to_ndev(wil); struct net_device *ndev = wil->main_ndev;
bool keep_radio_on = ndev->flags & IFF_UP && bool keep_radio_on = ndev->flags & IFF_UP &&
wil->keep_radio_on_during_sleep; wil->keep_radio_on_during_sleep;
......
/* /*
* Copyright (c) 2014,2017 Qualcomm Atheros, Inc. * Copyright (c) 2014,2017 Qualcomm Atheros, Inc.
* Copyright (c) 2018, The Linux Foundation. All rights reserved.
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
...@@ -23,8 +24,8 @@ ...@@ -23,8 +24,8 @@
int wil_can_suspend(struct wil6210_priv *wil, bool is_runtime) int wil_can_suspend(struct wil6210_priv *wil, bool is_runtime)
{ {
int rc = 0; int rc = 0;
struct wireless_dev *wdev = wil->wdev; struct net_device *ndev = wil->main_ndev;
struct net_device *ndev = wil_to_ndev(wil); struct wireless_dev *wdev = ndev->ieee80211_ptr;
bool wmi_only = test_bit(WMI_FW_CAPABILITY_WMI_ONLY, bool wmi_only = test_bit(WMI_FW_CAPABILITY_WMI_ONLY,
wil->fw_capabilities); wil->fw_capabilities);
...@@ -258,7 +259,7 @@ static int wil_suspend_keep_radio_on(struct wil6210_priv *wil) ...@@ -258,7 +259,7 @@ static int wil_suspend_keep_radio_on(struct wil6210_priv *wil)
static int wil_suspend_radio_off(struct wil6210_priv *wil) static int wil_suspend_radio_off(struct wil6210_priv *wil)
{ {
int rc = 0; int rc = 0;
struct net_device *ndev = wil_to_ndev(wil); struct net_device *ndev = wil->main_ndev;
wil_dbg_pm(wil, "suspend radio off\n"); wil_dbg_pm(wil, "suspend radio off\n");
...@@ -306,7 +307,7 @@ static int wil_suspend_radio_off(struct wil6210_priv *wil) ...@@ -306,7 +307,7 @@ static int wil_suspend_radio_off(struct wil6210_priv *wil)
static int wil_resume_radio_off(struct wil6210_priv *wil) static int wil_resume_radio_off(struct wil6210_priv *wil)
{ {
int rc = 0; int rc = 0;
struct net_device *ndev = wil_to_ndev(wil); struct net_device *ndev = wil->main_ndev;
wil_dbg_pm(wil, "Enabling PCIe IRQ\n"); wil_dbg_pm(wil, "Enabling PCIe IRQ\n");
wil_enable_irq(wil); wil_enable_irq(wil);
......
/* /*
* Copyright (c) 2012-2015,2017 Qualcomm Atheros, Inc. * Copyright (c) 2012-2015,2017 Qualcomm Atheros, Inc.
* Copyright (c) 2018, The Linux Foundation. All rights reserved.
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
...@@ -53,6 +54,7 @@ void wil_pmc_alloc(struct wil6210_priv *wil, ...@@ -53,6 +54,7 @@ void wil_pmc_alloc(struct wil6210_priv *wil,
u32 i; u32 i;
struct pmc_ctx *pmc = &wil->pmc; struct pmc_ctx *pmc = &wil->pmc;
struct device *dev = wil_to_dev(wil); struct device *dev = wil_to_dev(wil);
struct wil6210_vif *vif = ndev_to_vif(wil->main_ndev);
struct wmi_pmc_cmd pmc_cmd = {0}; struct wmi_pmc_cmd pmc_cmd = {0};
int last_cmd_err = -ENOMEM; int last_cmd_err = -ENOMEM;
...@@ -186,6 +188,7 @@ void wil_pmc_alloc(struct wil6210_priv *wil, ...@@ -186,6 +188,7 @@ void wil_pmc_alloc(struct wil6210_priv *wil,
wil_dbg_misc(wil, "pmc_alloc: send WMI_PMC_CMD with ALLOCATE op\n"); wil_dbg_misc(wil, "pmc_alloc: send WMI_PMC_CMD with ALLOCATE op\n");
pmc->last_cmd_status = wmi_send(wil, pmc->last_cmd_status = wmi_send(wil,
WMI_PMC_CMDID, WMI_PMC_CMDID,
vif->mid,
&pmc_cmd, &pmc_cmd,
sizeof(pmc_cmd)); sizeof(pmc_cmd));
if (pmc->last_cmd_status) { if (pmc->last_cmd_status) {
...@@ -236,6 +239,7 @@ void wil_pmc_free(struct wil6210_priv *wil, int send_pmc_cmd) ...@@ -236,6 +239,7 @@ void wil_pmc_free(struct wil6210_priv *wil, int send_pmc_cmd)
{ {
struct pmc_ctx *pmc = &wil->pmc; struct pmc_ctx *pmc = &wil->pmc;
struct device *dev = wil_to_dev(wil); struct device *dev = wil_to_dev(wil);
struct wil6210_vif *vif = ndev_to_vif(wil->main_ndev);
struct wmi_pmc_cmd pmc_cmd = {0}; struct wmi_pmc_cmd pmc_cmd = {0};
mutex_lock(&pmc->lock); mutex_lock(&pmc->lock);
...@@ -254,8 +258,8 @@ void wil_pmc_free(struct wil6210_priv *wil, int send_pmc_cmd) ...@@ -254,8 +258,8 @@ void wil_pmc_free(struct wil6210_priv *wil, int send_pmc_cmd)
wil_dbg_misc(wil, "send WMI_PMC_CMD with RELEASE op\n"); wil_dbg_misc(wil, "send WMI_PMC_CMD with RELEASE op\n");
pmc_cmd.op = WMI_PMC_RELEASE; pmc_cmd.op = WMI_PMC_RELEASE;
pmc->last_cmd_status = pmc->last_cmd_status =
wmi_send(wil, WMI_PMC_CMDID, &pmc_cmd, wmi_send(wil, WMI_PMC_CMDID, vif->mid,
sizeof(pmc_cmd)); &pmc_cmd, sizeof(pmc_cmd));
if (pmc->last_cmd_status) { if (pmc->last_cmd_status) {
wil_err(wil, wil_err(wil,
"WMI_PMC_CMD with RELEASE op failed, status %d", "WMI_PMC_CMD with RELEASE op failed, status %d",
......
/* /*
* Copyright (c) 2014-2017 Qualcomm Atheros, Inc. * Copyright (c) 2014-2017 Qualcomm Atheros, Inc.
* Copyright (c) 2018, The Linux Foundation. All rights reserved.
* *
* Permission to use, copy, modify, and/or distribute this software for any * Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
...@@ -44,7 +45,7 @@ static void wil_release_reorder_frame(struct wil6210_priv *wil, ...@@ -44,7 +45,7 @@ static void wil_release_reorder_frame(struct wil6210_priv *wil,
struct wil_tid_ampdu_rx *r, struct wil_tid_ampdu_rx *r,
int index) int index)
{ {
struct net_device *ndev = wil_to_ndev(wil); struct net_device *ndev = wil->main_ndev;
struct sk_buff *skb = r->reorder_buf[index]; struct sk_buff *skb = r->reorder_buf[index];
if (!skb) if (!skb)
...@@ -93,7 +94,7 @@ static void wil_reorder_release(struct wil6210_priv *wil, ...@@ -93,7 +94,7 @@ static void wil_reorder_release(struct wil6210_priv *wil,
void wil_rx_reorder(struct wil6210_priv *wil, struct sk_buff *skb) void wil_rx_reorder(struct wil6210_priv *wil, struct sk_buff *skb)
__acquires(&sta->tid_rx_lock) __releases(&sta->tid_rx_lock) __acquires(&sta->tid_rx_lock) __releases(&sta->tid_rx_lock)
{ {
struct net_device *ndev = wil_to_ndev(wil); struct net_device *ndev = wil->main_ndev;
struct vring_rx_desc *d = wil_skb_rxdesc(skb); struct vring_rx_desc *d = wil_skb_rxdesc(skb);
int tid = wil_rxdesc_tid(d); int tid = wil_rxdesc_tid(d);
int cid = wil_rxdesc_cid(d); int cid = wil_rxdesc_cid(d);
...@@ -292,8 +293,8 @@ static u16 wil_agg_size(struct wil6210_priv *wil, u16 req_agg_wsize) ...@@ -292,8 +293,8 @@ static u16 wil_agg_size(struct wil6210_priv *wil, u16 req_agg_wsize)
} }
/* Block Ack - Rx side (recipient) */ /* Block Ack - Rx side (recipient) */
int wil_addba_rx_request(struct wil6210_priv *wil, u8 cidxtid, int wil_addba_rx_request(struct wil6210_priv *wil, u8 mid,
u8 dialog_token, __le16 ba_param_set, u8 cidxtid, u8 dialog_token, __le16 ba_param_set,
__le16 ba_timeout, __le16 ba_seq_ctrl) __le16 ba_timeout, __le16 ba_seq_ctrl)
__acquires(&sta->tid_rx_lock) __releases(&sta->tid_rx_lock) __acquires(&sta->tid_rx_lock) __releases(&sta->tid_rx_lock)
{ {
...@@ -354,7 +355,7 @@ __acquires(&sta->tid_rx_lock) __releases(&sta->tid_rx_lock) ...@@ -354,7 +355,7 @@ __acquires(&sta->tid_rx_lock) __releases(&sta->tid_rx_lock)
} }
} }
rc = wmi_addba_rx_resp(wil, cid, tid, dialog_token, status, rc = wmi_addba_rx_resp(wil, mid, cid, tid, dialog_token, status,
agg_amsdu, agg_wsize, agg_timeout); agg_amsdu, agg_wsize, agg_timeout);
if (rc || (status != WLAN_STATUS_SUCCESS)) { if (rc || (status != WLAN_STATUS_SUCCESS)) {
wil_err(wil, "do not apply ba, rc(%d), status(%d)\n", rc, wil_err(wil, "do not apply ba, rc(%d), status(%d)\n", rc,
...@@ -393,7 +394,7 @@ int wil_addba_tx_request(struct wil6210_priv *wil, u8 ringid, u16 wsize) ...@@ -393,7 +394,7 @@ int wil_addba_tx_request(struct wil6210_priv *wil, u8 ringid, u16 wsize)
goto out; goto out;
} }
txdata->addba_in_progress = true; txdata->addba_in_progress = true;
rc = wmi_addba(wil, ringid, agg_wsize, agg_timeout); rc = wmi_addba(wil, txdata->mid, ringid, agg_wsize, agg_timeout);
if (rc) { if (rc) {
wil_err(wil, "wmi_addba failed, rc (%d)", rc); wil_err(wil, "wmi_addba failed, rc (%d)", rc);
txdata->addba_in_progress = false; txdata->addba_in_progress = false;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment