Skip to content

Commit 713d8c8

Browse files
decsnynashif
authored andcommitted
drivers: nxp_enet: Fix tx error handling
The code path for error handling and timestamping in tx path was meant to be identical in function to old eth_mcux driver, but there is actually a discrepancy causing no error handling for timestamped frames, fix it. Signed-off-by: Declan Snyder <[email protected]> (cherry picked from commit b29190c)
1 parent 4c80635 commit 713d8c8

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

drivers/ethernet/nxp_enet/eth_nxp_enet.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -224,15 +224,16 @@ static int eth_nxp_enet_tx(const struct device *dev, struct net_pkt *pkt)
224224

225225
ret = ENET_SendFrame(data->base, &data->enet_handle, data->tx_frame_buf,
226226
total_len, RING_ID, frame_is_timestamped, pkt);
227-
if (ret == kStatus_Success) {
227+
228+
if (ret != kStatus_Success) {
229+
LOG_ERR("ENET_SendFrame error: %d", ret);
230+
ENET_ReclaimTxDescriptor(data->base, &data->enet_handle, RING_ID);
231+
ret = -EIO;
228232
goto exit;
229233
}
230234

231235
if (frame_is_timestamped) {
232236
eth_wait_for_ptp_ts(dev, pkt);
233-
} else {
234-
LOG_ERR("ENET_SendFrame error: %d", ret);
235-
ENET_ReclaimTxDescriptor(data->base, &data->enet_handle, RING_ID);
236237
}
237238

238239
exit:

0 commit comments

Comments
 (0)