BigW Consortium Gitlab

Commit 8dc7346f by David Clark

Updated blocked queue writer to set flag. When rd offset is updated

inside interrupt handler worker flag is checked before calling the notify blocked writer fcn. Inside notify blocked write fcn the blocked writer flag is unset if writer is no longer blocked.
parent 8cfbdb4e
...@@ -64,7 +64,7 @@ int mt7697_irq_run(struct mt7697q_info *qinfo) ...@@ -64,7 +64,7 @@ int mt7697_irq_run(struct mt7697q_info *qinfo)
goto cleanup; goto cleanup;
} }
} }
else { else if (mt7697q_blocked_writer(qs)) {
WARN_ON(!qs->notify_tx_fcn); WARN_ON(!qs->notify_tx_fcn);
ret = qs->notify_tx_fcn(qs->priv, mt7697q_get_free_words(qs)); ret = qs->notify_tx_fcn(qs->priv, mt7697q_get_free_words(qs));
if (ret < 0) { if (ret < 0) {
......
...@@ -324,6 +324,11 @@ cleanup: ...@@ -324,6 +324,11 @@ cleanup:
return ret; return ret;
} }
__inline int mt7697q_blocked_writer(const struct mt7697q_spec *qs)
{
return atomic_read(&qs->qinfo->blocked_writer);
}
int mt7697q_proc_data(struct mt7697q_spec *qsS2M) int mt7697q_proc_data(struct mt7697q_spec *qsS2M)
{ {
size_t avail; size_t avail;
...@@ -440,6 +445,14 @@ cleanup: ...@@ -440,6 +445,14 @@ cleanup:
return ret; return ret;
} }
__inline void mt7697q_unblock_writer(void *hndl)
{
struct mt7697q_spec *qs = (struct mt7697q_spec*)hndl;
atomic_set(&qs->qinfo->blocked_writer, false);
}
EXPORT_SYMBOL(mt7697q_unblock_writer);
int mt7697q_wr_unused(void *tx_hndl, void* rx_hndl) int mt7697q_wr_unused(void *tx_hndl, void* rx_hndl)
{ {
struct mt7697q_spec *qsM2S = (struct mt7697q_spec*)tx_hndl; struct mt7697q_spec *qsM2S = (struct mt7697q_spec*)tx_hndl;
...@@ -584,6 +597,7 @@ int mt7697q_init(u8 tx_ch, u8 rx_ch, void *priv, notify_tx_hndlr notify_tx_fcn, ...@@ -584,6 +597,7 @@ int mt7697q_init(u8 tx_ch, u8 rx_ch, void *priv, notify_tx_hndlr notify_tx_fcn,
qsTx->ch = tx_ch; qsTx->ch = tx_ch;
qsTx->priv = priv; qsTx->priv = priv;
qsTx->notify_tx_fcn = notify_tx_fcn; qsTx->notify_tx_fcn = notify_tx_fcn;
atomic_set(&qsTx->qinfo->blocked_writer, false);
*tx_hndl = qsTx; *tx_hndl = qsTx;
qsRx = &qinfo->queues[rx_ch]; qsRx = &qinfo->queues[rx_ch];
...@@ -749,6 +763,7 @@ size_t mt7697q_write(void *hndl, const u32 *buff, size_t num) ...@@ -749,6 +763,7 @@ size_t mt7697q_write(void *hndl, const u32 *buff, size_t num)
if (avail < num) { if (avail < num) {
dev_dbg(qs->qinfo->dev, "%s(): queue avail(%u < %u)\n", dev_dbg(qs->qinfo->dev, "%s(): queue avail(%u < %u)\n",
__func__, avail, num); __func__, avail, num);
atomic_set(&qs->qinfo->blocked_writer, true);
ret = -EAGAIN; ret = -EAGAIN;
goto cleanup; goto cleanup;
} }
......
...@@ -67,6 +67,7 @@ struct mt7697q_info { ...@@ -67,6 +67,7 @@ struct mt7697q_info {
struct work_struct irq_work; struct work_struct irq_work;
struct delayed_work irq_delayed_work; struct delayed_work irq_delayed_work;
atomic_t blocked_writer;
int irq; int irq;
u8 s2m_mbox; u8 s2m_mbox;
bool slave_busy; bool slave_busy;
...@@ -76,6 +77,7 @@ void mt7697_irq_delayed_work(struct work_struct*); ...@@ -76,6 +77,7 @@ void mt7697_irq_delayed_work(struct work_struct*);
void mt7697_irq_work(struct work_struct*); void mt7697_irq_work(struct work_struct*);
irqreturn_t mt7697_isr(int, void*); irqreturn_t mt7697_isr(int, void*);
int mt7697q_blocked_writer(const struct mt7697q_spec*);
size_t mt7697q_get_free_words(const struct mt7697q_spec*); size_t mt7697q_get_free_words(const struct mt7697q_spec*);
int mt7697q_proc_data(struct mt7697q_spec*); int mt7697q_proc_data(struct mt7697q_spec*);
int mt7697q_get_s2m_mbx(struct mt7697q_info*, u8*); int mt7697q_get_s2m_mbx(struct mt7697q_info*, u8*);
......
...@@ -93,6 +93,7 @@ int mt7697q_init(u8, u8, void*, notify_tx_hndlr, rx_hndlr, void**, void**); ...@@ -93,6 +93,7 @@ int mt7697q_init(u8, u8, void*, notify_tx_hndlr, rx_hndlr, void**, void**);
int mt7697q_wr_reset(void*, void*); int mt7697q_wr_reset(void*, void*);
int mt7697q_wr_unused(void*, void*); int mt7697q_wr_unused(void*, void*);
size_t mt7697q_read(void*, u32*, size_t); size_t mt7697q_read(void*, u32*, size_t);
void mt7697q_unblock_writer(void*);
size_t mt7697q_write(void*, const u32*, size_t); size_t mt7697q_write(void*, const u32*, size_t);
#endif #endif
...@@ -28,6 +28,7 @@ int mt7697_notify_tx(void* priv, u32 free) ...@@ -28,6 +28,7 @@ int mt7697_notify_tx(void* priv, u32 free)
struct mt7697_tx_pkt *tx_pkt = list_entry(&cfg->tx_skb_list, struct mt7697_tx_pkt *tx_pkt = list_entry(&cfg->tx_skb_list,
struct mt7697_tx_pkt, next); struct mt7697_tx_pkt, next);
if (tx_pkt->skb->len >= free) { if (tx_pkt->skb->len >= free) {
mt7697q_unblock_writer(cfg->txq_hdl);
ret = queue_work(cfg->tx_workq, &cfg->tx_work); ret = queue_work(cfg->tx_workq, &cfg->tx_work);
if (ret < 0) { if (ret < 0) {
dev_err(cfg->dev, "%s(): queue_work() failed(%d)\n", dev_err(cfg->dev, "%s(): queue_work() failed(%d)\n",
......
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