Skip to content

drivers: NXP ENET: fix for issue mutex called from ISR #89443

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions drivers/ethernet/eth_nxp_enet.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,15 +164,16 @@ static inline void ts_register_tx_event(const struct device *dev,

if (pkt && atomic_get(&pkt->atomic_ref) > 0) {
if (eth_get_ptp_data(net_pkt_iface(pkt), pkt) && frameinfo->isTsAvail) {
k_mutex_lock(data->ptp.ptp_mutex, K_FOREVER);

/* Timestamp is written to packet in ISR.
* Semaphore ensures sequential execution of writing
* the timestamp here and subsequently reading the timestamp
* after waiting for the semaphore in eth_wait_for_ptp_ts().
*/
pkt->timestamp.nanosecond = frameinfo->timeStamp.nanosecond;
pkt->timestamp.second = frameinfo->timeStamp.second;

net_if_add_tx_timestamp(pkt);
k_sem_give(&data->ptp.ptp_ts_sem);

k_mutex_unlock(data->ptp.ptp_mutex);
}
net_pkt_unref(pkt);
}
Expand Down