mirror of
https://github.com/apache/nuttx.git
synced 2026-05-21 04:52:02 +08:00
Squashed commit of the following:
sched/wqueue/kwork_notifier.c: Redesign some data structures. struct works_s must appear at the beginning of the notifier entry structure. That is because it contains the work queue indices. This solves a harfault issue.
net/tcp/tcp_netpoll.c: tcp_iob_work() needs to free the allocated argument when it is finished.
net/tcp/tcp_send_buffered.c: Extend psock_tcp_cansend() so that it also requires that at least on IOB is also avaialble.
mm/iob: iob_navail() was returning the number of free IOB chain queue entries, not the number of free IOBs. Completely misnamed.
net/tcp/tcp_netpoll.c: Add logic to receive notifications when IOBs are freed (Needs CONFIG_NET_TCP_WRITE_BUFFERS and CONFIG_IOB_NOTIFIER). At present, does nothing because the logic in in psock_tcp_cansend() does not check for the availability of IOBs. That will change.
This commit is contained in:
+35
-1
@@ -291,7 +291,11 @@ enum work_evtype_e
|
||||
WORK_UDP_READAHEAD /* Notify that TCP read-ahead data is available */
|
||||
};
|
||||
|
||||
/* This structure describes one notification */
|
||||
/* This structure describes one notification and is provided as input to
|
||||
* to work_notifier_setup(). This input is copied by work_notifier_setup()
|
||||
* into an allocated instance of struct work_notifier_entry_s and need not
|
||||
* persist on the caller's side.
|
||||
*/
|
||||
|
||||
struct work_notifier_s
|
||||
{
|
||||
@@ -302,6 +306,36 @@ 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