mm/iob: iob_navail() was returning the number of free IOB chain queue entries, not the number of free IOBs. Completely misnamed.
This commit is contained in:
parent
a680553f35
commit
76eec53e4f
|
@ -195,7 +195,17 @@ FAR struct iob_s *iob_tryalloc(bool throttled);
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
int iob_navail(void);
|
||||
int iob_navail(bool throttled);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: iob_quentry_navail
|
||||
*
|
||||
* Description:
|
||||
* Return the number of available IOB chains.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int iob_quentry_navail(void);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: iob_free
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <semaphore.h>
|
||||
#include <assert.h>
|
||||
#include <debug.h>
|
||||
|
@ -148,7 +149,7 @@ FAR struct iob_s *iob_free(FAR struct iob_s *iob)
|
|||
* for an IOB.
|
||||
*/
|
||||
|
||||
if (iob_navail() > 0)
|
||||
if (iob_navail(false) > 0)
|
||||
{
|
||||
/* Signal any threads that have requested a signal notification
|
||||
* when an IOB becomes available.
|
||||
|
|
|
@ -39,6 +39,8 @@
|
|||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <nuttx/semaphore.h>
|
||||
#include <nuttx/mm/iob.h>
|
||||
|
||||
|
@ -56,17 +58,62 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
int iob_navail(void)
|
||||
int iob_navail(bool throttled)
|
||||
{
|
||||
int navail = 0;
|
||||
int ret;
|
||||
|
||||
#if CONFIG_IOB_NCHAINS > 0
|
||||
ret = nxsem_getvalue(&g_qentry_sem, &navail);
|
||||
#if CONFIG_IOB_NBUFFERS > 0
|
||||
/* Get the value of the IOB counting semaphores */
|
||||
|
||||
ret = nxsem_getvalue(&g_iob_sem, &navail);
|
||||
if (ret >= 0)
|
||||
{
|
||||
ret = navail;
|
||||
|
||||
#if CONFIG_IOB_THROTTLE > 0
|
||||
/* Subtract the throttle value is so requested */
|
||||
|
||||
if (throttled)
|
||||
{
|
||||
ret -= CONFIG_IOB_THROTTLE;
|
||||
if (ret < 0)
|
||||
{
|
||||
ret = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#else
|
||||
ret = navail;
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: iob_quentry_navail
|
||||
*
|
||||
* Description:
|
||||
* Return the number of available IOB chains.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int iob_quentry_navail(void)
|
||||
{
|
||||
int navail = 0;
|
||||
int ret;
|
||||
|
||||
#if CONFIG_IOB_NCHAINS > 0
|
||||
/* Get the value of the IOB chain qentry counting semaphores */
|
||||
|
||||
ret = nxsem_getvalue(&g_qentry_sem, &navail);
|
||||
if (ret >= 0)
|
||||
{
|
||||
ret = navail;
|
||||
}
|
||||
|
||||
#else
|
||||
ret = navail;
|
||||
#endif
|
||||
|
|
|
@ -86,9 +86,11 @@ int iob_notifier_setup(int qid, worker_t worker, FAR void *arg)
|
|||
|
||||
/* If there are already free IOBs, then return zero without setting up the
|
||||
* notification.
|
||||
*
|
||||
* REVISIT: The 'throttled' argument should not always be 'false'.
|
||||
*/
|
||||
|
||||
if (iob_navail() > 0)
|
||||
if (iob_navail(false) > 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#incldue <stdbool.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <net/if.h>
|
||||
|
@ -109,7 +110,7 @@ uint16_t tcp_get_recvwindow(FAR struct net_driver_s *dev)
|
|||
* availability.
|
||||
*/
|
||||
|
||||
navail = iob_navail();
|
||||
navail = iob_navail(true);
|
||||
|
||||
/* Are the read-ahead allocations throttled? If so, then not all of these
|
||||
* IOBs are available for read-ahead buffering.
|
||||
|
|
Loading…
Reference in New Issue