mirror of
https://github.com/apache/nuttx.git
synced 2026-06-07 17:33:08 +08:00
Squashed commit of the following:
Author: Gregory Nutt <gnutt@nuttx.org> Run all .h and .c files modified in last PR through nxstyle. Author: Xiang Xiao <xiaoxiang@xiaomi.com> Net cleanup (#17) * Fix the semaphore usage issue found in tcp/udp 1. The count semaphore need disable priority inheritance 2. Loop again if net_lockedwait return -EINTR 3. Call nxsem_trywait to avoid the race condition 4. Call nxsem_post instead of sem_post * Put the work notifier into free list to avoid the heap fragment in the long run. Since the allocation strategy is encapsulated internally, we can even refine the implementation later. * Network stack shouldn't allocate memory in the poll implementation to avoid the heap fragment in the long run, other modification include: 1. Select MM_IOB automatically since ICMP[v6] socket can't work without the read ahead buffer 2. Remove the net lock since xxx_callback_free already do the same thing 3. TCP/UDP poll should work even the read ahead buffer isn't enabled at all * Add NET_ prefix for UDP_NOTIFIER and TCP_NOTIFIER option to align with other UDP/TCP option convention * Remove the unused _SF_[IDLE|ACCEPT|SEND|RECV|MASK] flags since there are code to set/clear these flags, but nobody check them.
This commit is contained in:
@@ -309,36 +309,6 @@ struct work_notifier_s
|
||||
worker_t worker; /* The worker function to schedule */
|
||||
};
|
||||
|
||||
/* This structure describes one notification list entry. It is cast-
|
||||
* compatible with struct work_notifier_s. This structure is an allocated
|
||||
* container for the user notification data. It is allocated because it
|
||||
* must persist until the work is executed and must be freed using
|
||||
* kmm_free() by the work.
|
||||
*
|
||||
* With the work notification is scheduled, the work function will receive
|
||||
* the allocated instance of struct work_notifier_entry_s as its input
|
||||
* argument. When it completes the notification operation, the work function
|
||||
* is responsible for freeing that instance.
|
||||
*/
|
||||
|
||||
struct work_notifier_entry_s
|
||||
{
|
||||
/* This must appear at the beginning of the structure. A reference to
|
||||
* the struct work_notifier_entry_s instance must be cast-compatible with
|
||||
* struct dq_entry_s.
|
||||
*/
|
||||
|
||||
struct work_s work; /* Used for scheduling the work */
|
||||
|
||||
/* User notification information */
|
||||
|
||||
struct work_notifier_s info; /* The notification info */
|
||||
|
||||
/* Additional payload needed to manage the notification */
|
||||
|
||||
int16_t key; /* Unique ID for the notification */
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
Reference in New Issue
Block a user