Lines Matching +full:rx +full:- +full:delay +full:- +full:ps
1 // SPDX-License-Identifier: GPL-2.0
9 #include <linux/delay.h>
18 * lbs_mac_event_disconnected - handles disconnect event. It
19 * reports disconnect to upper layer, clean tx/rx packets,
33 if (priv->connect_status != LBS_CONNECTED) in lbs_mac_event_disconnected()
37 * Cisco AP sends EAP failure and de-auth in less than 0.5 ms. in lbs_mac_event_disconnected()
42 if (priv->wdev->iftype == NL80211_IFTYPE_STATION) in lbs_mac_event_disconnected()
46 netif_stop_queue(priv->dev); in lbs_mac_event_disconnected()
47 netif_carrier_off(priv->dev); in lbs_mac_event_disconnected()
49 /* Free Tx and Rx packets */ in lbs_mac_event_disconnected()
50 spin_lock_irqsave(&priv->driver_lock, flags); in lbs_mac_event_disconnected()
51 kfree_skb(priv->currenttxskb); in lbs_mac_event_disconnected()
52 priv->currenttxskb = NULL; in lbs_mac_event_disconnected()
53 priv->tx_pending_len = 0; in lbs_mac_event_disconnected()
54 spin_unlock_irqrestore(&priv->driver_lock, flags); in lbs_mac_event_disconnected()
56 priv->connect_status = LBS_DISCONNECTED; in lbs_mac_event_disconnected()
58 if (priv->psstate != PS_STATE_FULL_POWER) { in lbs_mac_event_disconnected()
59 /* make firmware to exit PS mode */ in lbs_mac_event_disconnected()
60 lbs_deb_cmd("disconnected, so exit PS mode\n"); in lbs_mac_event_disconnected()
73 mutex_lock(&priv->lock); in lbs_process_command_response()
74 spin_lock_irqsave(&priv->driver_lock, flags); in lbs_process_command_response()
76 if (!priv->cur_cmd) { in lbs_process_command_response()
78 ret = -1; in lbs_process_command_response()
79 spin_unlock_irqrestore(&priv->driver_lock, flags); in lbs_process_command_response()
84 curcmd = le16_to_cpu(priv->cur_cmd->cmdbuf->command); in lbs_process_command_response()
85 respcmd = le16_to_cpu(resp->command); in lbs_process_command_response()
86 result = le16_to_cpu(resp->result); in lbs_process_command_response()
89 respcmd, le16_to_cpu(resp->seqnum), len); in lbs_process_command_response()
92 if (resp->seqnum != priv->cur_cmd->cmdbuf->seqnum) { in lbs_process_command_response()
93 netdev_info(priv->dev, in lbs_process_command_response()
95 le16_to_cpu(resp->seqnum), in lbs_process_command_response()
96 le16_to_cpu(priv->cur_cmd->cmdbuf->seqnum)); in lbs_process_command_response()
97 spin_unlock_irqrestore(&priv->driver_lock, flags); in lbs_process_command_response()
98 ret = -1; in lbs_process_command_response()
103 netdev_info(priv->dev, "Invalid CMD_RESP %x to command %x!\n", in lbs_process_command_response()
105 spin_unlock_irqrestore(&priv->driver_lock, flags); in lbs_process_command_response()
106 ret = -1; in lbs_process_command_response()
110 if (resp->result == cpu_to_le16(0x0004)) { in lbs_process_command_response()
111 /* 0x0004 means -EAGAIN. Drop the response, let it time out in lbs_process_command_response()
113 netdev_info(priv->dev, in lbs_process_command_response()
115 le16_to_cpu(resp->command)); in lbs_process_command_response()
116 spin_unlock_irqrestore(&priv->driver_lock, flags); in lbs_process_command_response()
117 ret = -1; in lbs_process_command_response()
122 del_timer(&priv->command_timer); in lbs_process_command_response()
123 priv->cmd_timed_out = 0; in lbs_process_command_response()
130 u16 action = le16_to_cpu(psmode->action); in lbs_process_command_response()
137 lbs_deb_host("CMD_RESP: PS command failed with 0x%x\n", in lbs_process_command_response()
140 * We should not re-try enter-ps command in in lbs_process_command_response()
141 * ad-hoc mode. It takes place in in lbs_process_command_response()
144 if (priv->wdev->iftype == NL80211_IFTYPE_MONITOR && in lbs_process_command_response()
146 priv->psmode = LBS802_11POWERMODECAM; in lbs_process_command_response()
148 priv->needtowakeup = 0; in lbs_process_command_response()
149 priv->psstate = PS_STATE_AWAKE; in lbs_process_command_response()
152 if (priv->connect_status != LBS_CONNECTED) { in lbs_process_command_response()
160 spin_unlock_irqrestore(&priv->driver_lock, flags); in lbs_process_command_response()
161 mutex_unlock(&priv->lock); in lbs_process_command_response()
164 mutex_lock(&priv->lock); in lbs_process_command_response()
165 spin_lock_irqsave(&priv->driver_lock, flags); in lbs_process_command_response()
168 priv->needtowakeup = 0; in lbs_process_command_response()
169 priv->psstate = PS_STATE_FULL_POWER; in lbs_process_command_response()
172 lbs_deb_host("CMD_RESP: PS action 0x%X\n", action); in lbs_process_command_response()
175 __lbs_complete_command(priv, priv->cur_cmd, result); in lbs_process_command_response()
176 spin_unlock_irqrestore(&priv->driver_lock, flags); in lbs_process_command_response()
196 __lbs_complete_command(priv, priv->cur_cmd, result); in lbs_process_command_response()
197 spin_unlock_irqrestore(&priv->driver_lock, flags); in lbs_process_command_response()
199 ret = -1; in lbs_process_command_response()
203 spin_unlock_irqrestore(&priv->driver_lock, flags); in lbs_process_command_response()
205 if (priv->cur_cmd && priv->cur_cmd->callback) { in lbs_process_command_response()
206 ret = priv->cur_cmd->callback(priv, priv->cur_cmd->callback_arg, in lbs_process_command_response()
210 spin_lock_irqsave(&priv->driver_lock, flags); in lbs_process_command_response()
212 if (priv->cur_cmd) { in lbs_process_command_response()
214 __lbs_complete_command(priv, priv->cur_cmd, result); in lbs_process_command_response()
216 spin_unlock_irqrestore(&priv->driver_lock, flags); in lbs_process_command_response()
219 mutex_unlock(&priv->lock); in lbs_process_command_response()
248 lbs_deb_cmd("EVENT: ps sleep\n"); in lbs_process_event()
250 /* handle unexpected PS SLEEP event */ in lbs_process_event()
251 if (priv->psstate == PS_STATE_FULL_POWER) { in lbs_process_event()
256 if (!list_empty(&priv->cmdpendingq)) { in lbs_process_event()
260 priv->psstate = PS_STATE_PRE_SLEEP; in lbs_process_event()
268 if (priv->reset_deep_sleep_wakeup) in lbs_process_event()
269 priv->reset_deep_sleep_wakeup(priv); in lbs_process_event()
270 priv->is_deep_sleep = 0; in lbs_process_event()
273 priv->is_host_sleep_activated = 0; in lbs_process_event()
274 wake_up_interruptible(&priv->host_sleep_q); in lbs_process_event()
278 if (priv->reset_deep_sleep_wakeup) in lbs_process_event()
279 priv->reset_deep_sleep_wakeup(priv); in lbs_process_event()
281 priv->is_deep_sleep = 0; in lbs_process_event()
282 priv->wakeup_dev_required = 0; in lbs_process_event()
283 wake_up_interruptible(&priv->ds_awake_q); in lbs_process_event()
287 lbs_deb_cmd("EVENT: ps awake\n"); in lbs_process_event()
288 /* handle unexpected PS AWAKE event */ in lbs_process_event()
289 if (priv->psstate == PS_STATE_FULL_POWER) { in lbs_process_event()
291 "EVENT: In FULL POWER mode - ignore PS AWAKE\n"); in lbs_process_event()
295 priv->psstate = PS_STATE_AWAKE; in lbs_process_event()
297 if (priv->needtowakeup) { in lbs_process_event()
301 * priv->needtowakeup will be set to FALSE in lbs_process_event()
329 netdev_alert(priv->dev, "EVENT: rssi low\n"); in lbs_process_event()
332 netdev_alert(priv->dev, "EVENT: snr low\n"); in lbs_process_event()
335 netdev_alert(priv->dev, "EVENT: max fail\n"); in lbs_process_event()
338 netdev_alert(priv->dev, "EVENT: rssi high\n"); in lbs_process_event()
341 netdev_alert(priv->dev, "EVENT: snr high\n"); in lbs_process_event()
346 netdev_info(priv->dev, "EVENT: MESH_AUTO_STARTED (ignoring)\n"); in lbs_process_event()
350 netdev_alert(priv->dev, "EVENT: unknown event id %d\n", event); in lbs_process_event()