int ret = 0;
struct lbs_private *priv = dev->priv;
- lbs_deb_enter(LBS_DEB_NET);
+ lbs_deb_enter(LBS_DEB_TX);
if (priv->dnld_sent || priv->adapter->TxLockFlag) {
priv->stats.tx_dropped++;
if (lbs_process_tx(priv, skb) == 0)
dev->trans_start = jiffies;
done:
- lbs_deb_leave_args(LBS_DEB_NET, "ret %d", ret);
+ lbs_deb_leave_args(LBS_DEB_TX, "ret %d", ret);
return ret;
}
struct lbs_private *priv = dev->priv;
int ret;
- lbs_deb_enter(LBS_DEB_NET);
+ lbs_deb_enter(LBS_DEB_TX);
if (priv->adapter->monitormode != LBS_MONITOR_OFF) {
netif_stop_queue(dev);
UNSET_MESH_FRAME(skb);
ret = lbs_hard_start_xmit(skb, dev);
- lbs_deb_leave_args(LBS_DEB_NET, "ret %d", ret);
+ lbs_deb_leave_args(LBS_DEB_TX, "ret %d", ret);
return ret;
}
lbs_deb_leave(LBS_DEB_TX);
}
+void lbs_host_to_card_done(struct lbs_private *priv)
+{
+ struct lbs_adapter *adapter = priv->adapter;
+
+ priv->dnld_sent = DNLD_RES_RECEIVED;
+
+ /* Wake main thread if commands are pending */
+ if (!adapter->cur_cmd)
+ wake_up_interruptible(&priv->waitq);
+
+ if (priv->dev && adapter->connect_status == LBS_CONNECTED)
+ netif_wake_queue(priv->dev);
+
+ if (priv->mesh_dev && adapter->mesh_connect_status == LBS_CONNECTED)
+ netif_wake_queue(priv->mesh_dev);
+}
+EXPORT_SYMBOL_GPL(lbs_host_to_card_done);
+
/**
* @brief This function returns the network statistics
*
init_waitqueue_entry(&wait, current);
set_freezable();
+
for (;;) {
- lbs_deb_thread( "main-thread 111: intcounter=%d "
- "currenttxskb=%p dnld_sent=%d\n",
- adapter->intcounter,
- adapter->currenttxskb, priv->dnld_sent);
+ lbs_deb_thread( "main-thread 111: intcounter=%d currenttxskb=%p dnld_sent=%d\n",
+ adapter->intcounter, adapter->currenttxskb, priv->dnld_sent);
add_wait_queue(&priv->waitq, &wait);
set_current_state(TASK_INTERRUPTIBLE);
spin_lock_irq(&adapter->driver_lock);
+
if ((adapter->psstate == PS_STATE_SLEEP) ||
- (!adapter->intcounter
- && (priv->dnld_sent || adapter->cur_cmd ||
- list_empty(&adapter->cmdpendingq)))) {
- lbs_deb_thread(
- "main-thread sleeping... Conn=%d IntC=%d PS_mode=%d PS_State=%d\n",
- adapter->connect_status, adapter->intcounter,
- adapter->psmode, adapter->psstate);
+ (!adapter->intcounter && (priv->dnld_sent || adapter->cur_cmd || list_empty(&adapter->cmdpendingq)))) {
+ lbs_deb_thread("main-thread sleeping... Conn=%d IntC=%d PS_mode=%d PS_State=%d\n",
+ adapter->connect_status, adapter->intcounter,
+ adapter->psmode, adapter->psstate);
spin_unlock_irq(&adapter->driver_lock);
schedule();
} else
spin_unlock_irq(&adapter->driver_lock);
- lbs_deb_thread(
- "main-thread 222 (waking up): intcounter=%d currenttxskb=%p "
- "dnld_sent=%d\n", adapter->intcounter,
- adapter->currenttxskb, priv->dnld_sent);
+ lbs_deb_thread("main-thread 222 (waking up): intcounter=%d currenttxskb=%p dnld_sent=%d\n",
+ adapter->intcounter, adapter->currenttxskb, priv->dnld_sent);
set_current_state(TASK_RUNNING);
remove_wait_queue(&priv->waitq, &wait);
try_to_freeze();
- lbs_deb_thread("main-thread 333: intcounter=%d currenttxskb=%p "
- "dnld_sent=%d\n",
- adapter->intcounter,
- adapter->currenttxskb, priv->dnld_sent);
+ lbs_deb_thread("main-thread 333: intcounter=%d currenttxskb=%p dnld_sent=%d\n",
+ adapter->intcounter, adapter->currenttxskb, priv->dnld_sent);
- if (kthread_should_stop()
- || adapter->surpriseremoved) {
- lbs_deb_thread(
- "main-thread: break from main thread: surpriseremoved=0x%x\n",
- adapter->surpriseremoved);
+ if (kthread_should_stop() || adapter->surpriseremoved) {
+ lbs_deb_thread("main-thread: break from main thread: surpriseremoved=0x%x\n",
+ adapter->surpriseremoved);
break;
}
spin_lock_irq(&adapter->driver_lock);
+
if (adapter->intcounter) {
u8 int_status;
+
adapter->intcounter = 0;
int_status = priv->hw_get_int_status(priv, &ireg);
if (int_status) {
- lbs_deb_thread(
- "main-thread: reading HOST_INT_STATUS_REG failed\n");
+ lbs_deb_thread("main-thread: reading HOST_INT_STATUS_REG failed\n");
spin_unlock_irq(&adapter->driver_lock);
continue;
}
adapter->hisregcpy |= ireg;
}
- lbs_deb_thread("main-thread 444: intcounter=%d currenttxskb=%p "
- "dnld_sent=%d\n",
- adapter->intcounter,
- adapter->currenttxskb, priv->dnld_sent);
+ lbs_deb_thread("main-thread 444: intcounter=%d currenttxskb=%p dnld_sent=%d\n",
+ adapter->intcounter, adapter->currenttxskb, priv->dnld_sent);
/* command response? */
if (adapter->hisregcpy & MRVDRV_CMD_UPLD_RDY) {
adapter->hisregcpy &= ~MRVDRV_CARDEVENT;
if (priv->hw_read_event_cause(priv)) {
- lbs_pr_alert(
- "main-thread: hw_read_event_cause failed\n");
+ lbs_pr_alert("main-thread: hw_read_event_cause failed\n");
spin_unlock_irq(&adapter->driver_lock);
continue;
}
spin_unlock_irq(&adapter->driver_lock);
/* Check if we need to confirm Sleep Request received previously */
- if (adapter->psstate == PS_STATE_PRE_SLEEP) {
- if (!priv->dnld_sent && !adapter->cur_cmd) {
- if (adapter->connect_status ==
- LBS_CONNECTED) {
- lbs_deb_thread(
- "main_thread: PRE_SLEEP--intcounter=%d currenttxskb=%p "
- "dnld_sent=%d cur_cmd=%p, confirm now\n",
- adapter->intcounter,
- adapter->currenttxskb,
- priv->dnld_sent,
- adapter->cur_cmd);
-
- lbs_ps_confirm_sleep(priv,
- (u16) adapter->psmode);
- } else {
- /* workaround for firmware sending
- * deauth/linkloss event immediately
- * after sleep request, remove this
- * after firmware fixes it
- */
- adapter->psstate = PS_STATE_AWAKE;
- lbs_pr_alert(
- "main-thread: ignore PS_SleepConfirm in non-connected state\n");
- }
+ if (adapter->psstate == PS_STATE_PRE_SLEEP &&
+ !priv->dnld_sent && !adapter->cur_cmd) {
+ if (adapter->connect_status == LBS_CONNECTED) {
+ lbs_deb_thread("main_thread: PRE_SLEEP--intcounter=%d currenttxskb=%p dnld_sent=%d cur_cmd=%p, confirm now\n",
+ adapter->intcounter, adapter->currenttxskb, priv->dnld_sent, adapter->cur_cmd);
+
+ lbs_ps_confirm_sleep(priv, (u16) adapter->psmode);
+ } else {
+ /* workaround for firmware sending
+ * deauth/linkloss event immediately
+ * after sleep request; remove this
+ * after firmware fixes it
+ */
+ adapter->psstate = PS_STATE_AWAKE;
+ lbs_pr_alert("main-thread: ignore PS_SleepConfirm in non-connected state\n");
}
}
/* Wake-up command waiters which can't sleep in
* lbs_prepare_and_send_command
*/
- if (!adapter->nr_cmd_pending)
+ if (!list_empty(&adapter->cmdpendingq))
wake_up_all(&adapter->cmd_pending);
lbs_tx_runqueue(priv);
}
del_timer(&adapter->command_timer);
- adapter->nr_cmd_pending = 0;
wake_up_all(&adapter->cmd_pending);
lbs_deb_leave(LBS_DEB_THREAD);
priv->mesh_autostart_enabled = 0;
}
- /* Set the boot2 version in firmware */
- ret = lbs_prepare_and_send_command(priv, CMD_SET_BOOT2_VER,
- 0, CMD_OPTION_WAITFORRSP, 0, NULL);
-
ret = 0;
done:
lbs_deb_leave_args(LBS_DEB_FW, "ret %d", ret);
spin_lock_init(&adapter->driver_lock);
init_waitqueue_head(&adapter->cmd_pending);
- adapter->nr_cmd_pending = 0;
/* Allocate the command buffers */
if (lbs_allocate_cmd_buffer(priv)) {