Skip to content

Commit

Permalink
Minor interrupt handler improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
jpaali committed Dec 20, 2024
1 parent e1308cf commit 348f1a0
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions arch/risc-v/src/mpfs/mpfs_ethernet.c
Original file line number Diff line number Diff line change
Expand Up @@ -969,8 +969,6 @@ static void mpfs_interrupt_work(void *arg)

net_lock();
isr = *priv->queue[queue].int_status;
rsr = mac_getreg(priv, RECEIVE_STATUS);
tsr = mac_getreg(priv, TRANSMIT_STATUS);

ninfo("isr: %08" PRIx32 "\n", isr);

Expand All @@ -983,6 +981,8 @@ static void mpfs_interrupt_work(void *arg)
* one to this bit.
*/

tsr = mac_getreg(priv, TRANSMIT_STATUS);

if (tsr != 0)
{
ninfo("TX tsr=0x%X\n", tsr);
Expand Down Expand Up @@ -1077,6 +1077,8 @@ static void mpfs_interrupt_work(void *arg)
* in memory. This indication is cleared by writing a one to this bit.
*/

rsr = mac_getreg(priv, RECEIVE_STATUS);

if (rsr != 0)
{
uint32_t rx_error = 0;
Expand Down Expand Up @@ -1125,6 +1127,14 @@ static void mpfs_interrupt_work(void *arg)
}
else if ((rsr & RECEIVE_STATUS_FRAME_RECEIVED) != 0)
{
if ((isr & GEM_INT_RECEIVE_COMPLETE) != 0)
{
/* Reset RX watchdog here if was not done in interrupt handler */

wd_start(&priv->rxtimeout, MPFS_RXTIMEOUT,
mpfs_timeout_expiry, (wdparm_t)priv);
}

/* Handle the received packet only in case there are no RX errors */

mpfs_receive(priv, queue);
Expand Down

0 comments on commit 348f1a0

Please sign in to comment.