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
|
* Name: iob_free
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
|
|
||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
#include <semaphore.h>
|
#include <semaphore.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
@ -148,7 +149,7 @@ FAR struct iob_s *iob_free(FAR struct iob_s *iob)
|
||||||
* for an IOB.
|
* for an IOB.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (iob_navail() > 0)
|
if (iob_navail(false) > 0)
|
||||||
{
|
{
|
||||||
/* Signal any threads that have requested a signal notification
|
/* Signal any threads that have requested a signal notification
|
||||||
* when an IOB becomes available.
|
* when an IOB becomes available.
|
||||||
|
|
|
@ -39,6 +39,8 @@
|
||||||
|
|
||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
#include <nuttx/semaphore.h>
|
#include <nuttx/semaphore.h>
|
||||||
#include <nuttx/mm/iob.h>
|
#include <nuttx/mm/iob.h>
|
||||||
|
|
||||||
|
@ -56,17 +58,62 @@
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int iob_navail(void)
|
int iob_navail(bool throttled)
|
||||||
{
|
{
|
||||||
int navail = 0;
|
int navail = 0;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
#if CONFIG_IOB_NCHAINS > 0
|
#if CONFIG_IOB_NBUFFERS > 0
|
||||||
ret = nxsem_getvalue(&g_qentry_sem, &navail);
|
/* Get the value of the IOB counting semaphores */
|
||||||
|
|
||||||
|
ret = nxsem_getvalue(&g_iob_sem, &navail);
|
||||||
if (ret >= 0)
|
if (ret >= 0)
|
||||||
{
|
{
|
||||||
ret = navail;
|
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
|
#else
|
||||||
ret = navail;
|
ret = navail;
|
||||||
#endif
|
#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
|
/* If there are already free IOBs, then return zero without setting up the
|
||||||
* notification.
|
* notification.
|
||||||
|
*
|
||||||
|
* REVISIT: The 'throttled' argument should not always be 'false'.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (iob_navail() > 0)
|
if (iob_navail(false) > 0)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#incldue <stdbool.h>
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
#include <net/if.h>
|
#include <net/if.h>
|
||||||
|
@ -109,7 +110,7 @@ uint16_t tcp_get_recvwindow(FAR struct net_driver_s *dev)
|
||||||
* availability.
|
* availability.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
navail = iob_navail();
|
navail = iob_navail(true);
|
||||||
|
|
||||||
/* Are the read-ahead allocations throttled? If so, then not all of these
|
/* Are the read-ahead allocations throttled? If so, then not all of these
|
||||||
* IOBs are available for read-ahead buffering.
|
* IOBs are available for read-ahead buffering.
|
||||||
|
|
Loading…
Reference in New Issue