diff --git a/include/nuttx/mm/iob.h b/include/nuttx/mm/iob.h index ac0b260d76..86150e9cf8 100644 --- a/include/nuttx/mm/iob.h +++ b/include/nuttx/mm/iob.h @@ -213,10 +213,11 @@ FAR struct iob_s *iob_free(FAR struct iob_s *iob); * * Description: * Set up to perform a callback to the worker function when an IOB is - * available. The worker function will execute on the high priority + * available. The worker function will execute on the selected priority * worker thread. * * Input Parameters: + * qid - Selects work queue. Must be HPWORK or LPWORK. * worker - The worker function to execute on the high priority work queue * when the event occurs. * arg - A user-defined argument that will be available to the worker @@ -235,7 +236,7 @@ FAR struct iob_s *iob_free(FAR struct iob_s *iob); ****************************************************************************/ #ifdef CONFIG_IOB_NOTIFIER -int iob_notifier_setup(worker_t worker, FAR void *arg); +int iob_notifier_setup(int qid, worker_t worker, FAR void *arg); #endif /**************************************************************************** diff --git a/include/nuttx/wqueue.h b/include/nuttx/wqueue.h index 26cd92ea31..7e176e07fa 100644 --- a/include/nuttx/wqueue.h +++ b/include/nuttx/wqueue.h @@ -296,7 +296,7 @@ enum work_evtype_e struct work_notifier_s { uint8_t evtype; /* See enum work_evtype_e */ - uint8_t wqueue; /* The work queue to use: HPWORK or LPWORK */ + uint8_t qid; /* The work queue to use: HPWORK or LPWORK */ FAR void *qualifier; /* Event qualifier value */ FAR void *arg; /* User-defined worker function argument */ worker_t worker; /* The worker function to schedule */ diff --git a/mm/iob/iob_notifier.c b/mm/iob/iob_notifier.c index 51e56b9d8e..397eb4f04e 100644 --- a/mm/iob/iob_notifier.c +++ b/mm/iob/iob_notifier.c @@ -58,10 +58,11 @@ * * Description: * Set up to perform a callback to the worker function when an IOB is - * available. The worker function will execute on the high priority + * available. The worker function will execute on the selected priority * worker thread. * * Input Parameters: + * qid - Selects work queue. Must be HPWORK or LPWORK. * worker - The worker function to execute on the high priority work queue * when the event occurs. * arg - A user-defined argument that will be available to the worker @@ -77,7 +78,7 @@ * ****************************************************************************/ -int iob_notifier_setup(worker_t worker, FAR void *arg) +int iob_notifier_setup(int qid, worker_t worker, FAR void *arg) { struct work_notifier_s info; @@ -95,7 +96,7 @@ int iob_notifier_setup(worker_t worker, FAR void *arg) /* Otherwise, this is just a simple wrapper around work_notifer_setup(). */ info.evtype = WORK_IOB_AVAIL; - info.wqueue = HPWORK; + info.qid = qid; info.qualifier = NULL; info.arg = arg; info.worker = worker; diff --git a/net/netdev/netdown_notifier.c b/net/netdev/netdown_notifier.c index 8e1025a50d..dbfcc8563e 100644 --- a/net/netdev/netdown_notifier.c +++ b/net/netdev/netdown_notifier.c @@ -98,7 +98,7 @@ int netdown_notifier_setup(worker_t worker, FAR struct net_driver_s *dev, /* Otherwise, this is just a simple wrapper around work_notifer_setup(). */ info.evtype = WORK_NET_DOWN; - info.wqueue = LPWORK; + info.qid = LPWORK; info.qualifier = dev; info.arg = arg; info.worker = worker; diff --git a/net/tcp/tcp_notifier.c b/net/tcp/tcp_notifier.c index 9b8bad4bd4..ccf63a4171 100644 --- a/net/tcp/tcp_notifier.c +++ b/net/tcp/tcp_notifier.c @@ -100,7 +100,7 @@ int tcp_readahead_notifier_setup(worker_t worker, /* Otherwise, this is just a simple wrapper around work_notifer_setup(). */ info.evtype = WORK_TCP_READAHEAD; - info.wqueue = LPWORK; + info.qid = LPWORK; info.qualifier = conn; info.arg = arg; info.worker = worker; @@ -151,7 +151,7 @@ int tcp_readahead_disconnect_setup(worker_t worker, /* Otherwise, this is just a simple wrapper around work_notifer_setup(). */ info.evtype = WORK_TCP_DISCONNECT; - info.wqueue = LPWORK; + info.qid = LPWORK; info.qualifier = conn; info.arg = arg; info.worker = worker; diff --git a/net/udp/udp.h b/net/udp/udp.h index f6139b84c7..07353810c4 100644 --- a/net/udp/udp.h +++ b/net/udp/udp.h @@ -653,23 +653,22 @@ int udp_pollteardown(FAR struct socket *psock, FAR struct pollfd *fds); * Description: * Set up to perform a callback to the worker function when an UDP data * is added to the read-ahead buffer. The worker function will execute - * on the high priority worker thread. + * on the low priority worker thread. * * Input Parameters: - * worker - The worker function to execute on the high priority work - * queue when data is available in the UDP readahead buffer. + * worker - The worker function to execute on the low priority work + * queue when data is available in the UDP read-ahead buffer. * conn - The UDP connection where read-ahead data is needed. * arg - A user-defined argument that will be available to the worker * function when it runs. * * Returned Value: - * > 0 - The signal notification is in place. The returned value is a - * key that may be used later in a call to - * udp_notifier_teardown(). - * == 0 - There is already buffered read-ahead data. No signal - * notification will be provided. - * < 0 - An unexpected error occurred and no signal will be sent. The - * returned value is a negated errno value that indicates the + * > 0 - The notification is in place. The returned value is a key that + * may be used later in a call to udp_notifier_teardown(). + * == 0 - There is already buffered read-ahead data. No notification + * will be provided. + * < 0 - An unexpected error occurred and no notification will occur. + * The returned value is a negated errno value that indicates the * nature of the failure. * ****************************************************************************/ @@ -686,7 +685,7 @@ int udp_notifier_setup(worker_t worker, FAR struct udp_conn_s *conn, * Eliminate a UDP read-ahead notification previously setup by * udp_notifier_setup(). This function should only be called if the * notification should be aborted prior to the notification. The - * notification will automatically be torn down after the signal is sent. + * notification will automatically be torn down after the notification. * * Input Parameters: * key - The key value returned from a previous call to @@ -706,7 +705,7 @@ int udp_notifier_teardown(int key); * Name: udp_notifier_signal * * Description: - * Read-ahead data has been buffered. Signal all threads waiting for + * Read-ahead data has been buffered. Notify all threads waiting for * read-ahead data to become available. * * When read-ahead data becomes available, *all* of the workers waiting diff --git a/net/udp/udp_notifier.c b/net/udp/udp_notifier.c index 98a04a20d5..63cfd4e122 100644 --- a/net/udp/udp_notifier.c +++ b/net/udp/udp_notifier.c @@ -59,22 +59,21 @@ * Description: * Set up to perform a callback to the worker function when an UDP data * is added to the read-ahead buffer. The worker function will execute - * on the high priority worker thread. + * on the low priority worker thread. * * Input Parameters: - * worker - The worker function to execute on the high priority work - * queue when data is available in the UDP readahead buffer. + * worker - The worker function to execute on the low priority work + * queue when data is available in the UDP read-ahead buffer. * conn - The UDP connection where read-ahead data is needed. * arg - A user-defined argument that will be available to the worker * function when it runs. * * Returned Value: - * > 0 - The signal notification is in place. The returned value is a - * key that may be used later in a call to - * udp_notifier_teardown(). - * == 0 - There is already buffered read-ahead data. No signal - * notification will be provided. - * < 0 - An unexpected error occurred and no signal will be sent. The + * > 0 - The notification is in place. The returned value is a key that + * may be used later in a call to udp_notifier_teardown(). + * == 0 - There is already buffered read-ahead data. No notification + * will be provided. + * < 0 - An unexpected error occurred and notification will occur. The * returned value is a negated errno value that indicates the * nature of the failure. * @@ -99,6 +98,7 @@ int udp_notifier_setup(worker_t worker, FAR struct udp_conn_s *conn, /* Otherwise, this is just a simple wrapper around work_notifer_setup(). */ info.evtype = WORK_UDP_READAHEAD; + info.qid = LPWORK; info.qualifier = conn; info.arg = arg; info.worker = worker; @@ -113,7 +113,7 @@ int udp_notifier_setup(worker_t worker, FAR struct udp_conn_s *conn, * Eliminate a UDP read-ahead notification previously setup by * udp_notifier_setup(). This function should only be called if the * notification should be aborted prior to the notification. The - * notification will automatically be torn down after the signal is sent. + * notification will automatically be torn down after the notification. * * Input Parameters: * key - The key value returned from a previous call to @@ -136,7 +136,7 @@ int udp_notifier_teardown(int key) * Name: udp_notifier_signal * * Description: - * Read-ahead data has been buffered. Signal all threads waiting for + * Read-ahead data has been buffered. Notify all threads waiting for * read-ahead data to become available. * * When read-ahead data becomes available, *all* of the workers waiting diff --git a/sched/Kconfig b/sched/Kconfig index 2a7807eca1..4e6329855b 100644 --- a/sched/Kconfig +++ b/sched/Kconfig @@ -1511,7 +1511,7 @@ config SCHED_LPNTHREADS config SCHED_LPWORKPRIORITY int "Low priority worker thread priority" - default 50 + default 100 ---help--- The minimum execution priority of the lower priority worker thread. @@ -1520,7 +1520,7 @@ config SCHED_LPWORKPRIORITY priority, of course, but has the added advantage that it supports "priority inheritance" (if PRIORITY_INHERITANCE is also selected): The priority of the lower priority worker thread can then be - adjusted to match the highest priority client. Default: 50 + adjusted to match the highest priority client. Default: 100 NOTE: This priority inheritance feature is not automatic. The lower priority worker thread will always a fixed priority unless diff --git a/sched/wqueue/kwork_notifier.c b/sched/wqueue/kwork_notifier.c index 6d631acfab..7a3c898e53 100644 --- a/sched/wqueue/kwork_notifier.c +++ b/sched/wqueue/kwork_notifier.c @@ -203,7 +203,7 @@ int work_notifier_setup(FAR struct work_notifier_s *info) int ret; DEBUGASSERT(info != NULL && info->worker != NULL); - DEBUGASSERT(info->wqueue == HPWORK && info->wqueue == LPWORK); + DEBUGASSERT(info->qid == HPWORK && info->qid == LPWORK); /* Get exclusive access to the notifier data structures */ @@ -395,7 +395,7 @@ void work_notifier_signal(enum work_evtype_e evtype, /* Schedule the work */ - (void)work_queue(info->wqueue, ¬ifier->work, info->worker, + (void)work_queue(info->qid, ¬ifier->work, info->worker, info, 0); } else