Commit d2e864f1 authored by Lukasz Majewski's avatar Lukasz Majewski Committed by Carles Cufi
Browse files

drivers: ethernet: lan865x: Don't wait on semaphore if no memory for pkt



With the current approach, the driver prevents from TX transmission
when waiting on timeout (standard 100ms) for available memory to be
able to allocate memory for RX packet.

It is safe to just protect the part of reading chunks. In that way
pending TX transmission can be performed.

Signed-off-by: default avatarLukasz Majewski <lukma@denx.de>
parent 8df98793
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -395,14 +395,13 @@ static void lan865x_read_chunks(const struct device *dev)
	struct net_pkt *pkt;
	int ret;

	k_sem_take(&ctx->tx_rx_sem, K_FOREVER);
	pkt = net_pkt_rx_alloc(K_MSEC(cfg->timeout));
	if (!pkt) {
		k_sem_give(&ctx->tx_rx_sem);
		LOG_ERR("OA RX: Could not allocate packet!");
		return;
	}

	k_sem_take(&ctx->tx_rx_sem, K_FOREVER);
	ret = oa_tc6_read_chunks(tc6, pkt);
	if (ret < 0) {
		eth_stats_update_errors_rx(ctx->iface);