Skip to content

Commit f0db877

Browse files
tgorochowiknashif
authored andcommitted
eth: eth_mcux: wait in send for the packet to be sent [REVERT ME]
Wait in the send callback for the packet to be actually sent. After this change, only one TX packet will be handled at once. This is needed because of the way the TX packets are currently handled in L2 after this PR: #12563 This is similar to what #13167 did for the SAM GMAC on SAM E-70. Without this, packet time-stamping does not work with the current stack. This commit is minimalistic on purpose to make it easily revertible when the network stack is able to properly handle DMA drivers for TX packets again. Signed-off-by: Tomasz Gorochowik <[email protected]>
1 parent e44011b commit f0db877

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

drivers/ethernet/Kconfig.mcux

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ config ETH_MCUX_TX_BUFFERS
4646
int "Number of MCUX TX buffers"
4747
depends on ETH_MCUX
4848
default 1
49-
range 1 16
49+
range 1 1
5050
help
5151
Set the number of TX buffers provided to the MCUX driver.
5252

drivers/ethernet/eth_mcux.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -497,8 +497,6 @@ static int eth_tx(struct device *dev, struct net_pkt *pkt)
497497
bool timestamped_frame;
498498
#endif
499499

500-
k_sem_take(&context->tx_buf_sem, K_FOREVER);
501-
502500
/* As context->frame_buf is shared resource used by both eth_tx
503501
* and eth_rx, we need to protect it with irq_lock.
504502
*/
@@ -546,6 +544,8 @@ static int eth_tx(struct device *dev, struct net_pkt *pkt)
546544
return -1;
547545
}
548546

547+
k_sem_take(&context->tx_buf_sem, K_FOREVER);
548+
549549
return 0;
550550
}
551551

@@ -795,7 +795,7 @@ static int eth_0_init(struct device *dev)
795795
#endif
796796

797797
k_sem_init(&context->tx_buf_sem,
798-
CONFIG_ETH_MCUX_TX_BUFFERS, CONFIG_ETH_MCUX_TX_BUFFERS);
798+
0, CONFIG_ETH_MCUX_TX_BUFFERS);
799799
k_work_init(&context->phy_work, eth_mcux_phy_work);
800800
k_delayed_work_init(&context->delayed_phy_work,
801801
eth_mcux_delayed_phy_work);

0 commit comments

Comments
 (0)