Skip to content

Commit 747fdb1

Browse files
akifsaglamsabhiram
authored andcommitted
bugfix:: disable interrupts beginning of ISR (#15)
* bugfix:: disable interrupts beginning of ISR * In case of net_pkt_write failure, make sure to skip passing the pkt to upper layers
1 parent 17acdb7 commit 747fdb1

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/ethernet/eth_lowRISC.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,8 @@ static void lr_isr(struct device *dev)
209209
struct net_pkt *pkt = NULL;
210210
uint16_t vlan_tag = NET_VLAN_TAG_UNSPEC;
211211

212+
lr_eth_disable_irq(priv);
213+
212214
if ((n = lr_eth_recv_size(priv)) > 0)
213215
{
214216

@@ -219,14 +221,15 @@ static void lr_isr(struct device *dev)
219221
goto out;
220222
}
221223

222-
assert(lr_eth_recv(priv, priv->rxb, n) == n);
224+
lr_eth_recv(priv, priv->rxb, n);
223225

224226
hexdump(priv->rxb, n, "%zd byte(s)", n);
225227

226228
if (net_pkt_write(pkt, priv->rxb, n)) {
227229
LOG_ERR("Out of memory for received frame");
228230
net_pkt_unref(pkt);
229231
pkt = NULL;
232+
goto out;
230233
}
231234
net_recv_data(get_iface(priv, vlan_tag), pkt);
232235
}

0 commit comments

Comments
 (0)