lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] Two lwIP threads working fine on one core but giving er


From: address@hidden
Subject: Re: [lwip-users] Two lwIP threads working fine on one core but giving error on two separate cores
Date: Tue, 17 Aug 2021 20:37:46 +0200
User-agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0

Am 26.07.2021 um 14:31 schrieb Ibtisam Tariq:
> Hi,
>
> I am creating an app by integrating lwIP with DPDK. I am using
> socket-level APIs. For receiving packets from the interface and
> processing, there are two threads.
> Thread-1: Receiving packets from the interface, call pbuf_alloc to
> transfer packet data into pbuf and then call netif->input.
> Thread-2: lwIP core thread: tcpip_thread.
>
> If I run both threads on one core, they work fine. But if I run both on
> separate cores using pthread_setaffinity_np() it gives an error after ~5
> minutes. The error is :
> /Assertion "memp sanity" failed at line 389 in
> ../lwip/contrib/../src/core/memp.c /

Sorry for taking so long to answer this, but I hope the answer still helps:

I suspect that the sys_arch_protect/unprotect macros are not correctly
set up for multiprocessing. For a single core, the default behaviour is
to lock interrupts and therefore to prevent a task switch (as we don't
call OS functions leading to a task switch in locked sections).

When you have multiple CPUs, multiple threads can run concurrently on
your system. That means locking interrupts is not enough and you will
have to convert sys_arch_protect/unprotect to lock by using a mutex.

Regards,
Simon



reply via email to

[Prev in Thread] Current Thread [Next in Thread]