[PATCH] Replace the OOSEQ max bytes and pbufs constants with functions.

Some systems need to take into account an RX buffer pool size when
advising an appropriate number of RX pbufs to queue on the ooseq
list. For some systems there is a practical hard limit beyond which
the rx pool becomes exhausted blocking reception of further buffers
until some are freed.

It also helps to be able to consider the available dynamic memory when
advising an appropriate maximum number of bytes to buffer on the ooseq
list.

These decisions can also benefit from knowing the number already
allocated on a particular pcb, so the ooseq tcp segement is passed to
these functions. For example, if the system only wants to allow the
total number of rx pbufs queued on all the ooseq lists to grow by one
and a pcb already has two then it can return three for this call, but
might return one for another call - supporting a greedy allocation
strategy.

Signed-off-by: goldsimon <goldsimon@gmx.de>
This commit is contained in:
Our Air Quality
2017-09-21 10:36:21 +02:00
committed by goldsimon
parent 7dcc407c53
commit dbd726959c
2 changed files with 56 additions and 14 deletions

View File

@@ -1300,21 +1300,51 @@
#endif
/**
* TCP_OOSEQ_MAX_BYTES: The maximum number of bytes queued on ooseq per pcb.
* Default is 0 (no limit). Only valid for TCP_QUEUE_OOSEQ==1.
* TCP_OOSEQ_MAX_BYTES: The default maximum number of bytes queued on ooseq per
* pcb if TCP_OOSEQ_BYTES_LIMIT is not defined. Default is 0 (no limit).
* Only valid for TCP_QUEUE_OOSEQ==1.
*/
#if !defined TCP_OOSEQ_MAX_BYTES || defined __DOXYGEN__
#define TCP_OOSEQ_MAX_BYTES 0
#endif
/**
* TCP_OOSEQ_MAX_PBUFS: The maximum number of pbufs queued on ooseq per pcb.
* Default is 0 (no limit). Only valid for TCP_QUEUE_OOSEQ==1.
* TCP_OOSEQ_BYTES_LIMIT(pcb): Return the maximum number of bytes to be queued
* on ooseq per pcb, given the pcb. Only valid for TCP_QUEUE_OOSEQ==1 &&
* TCP_OOSEQ_MAX_BYTES==1.
* Use this to override TCP_OOSEQ_MAX_BYTES to a dynamic value per pcb.
*/
#if !defined TCP_OOSEQ_BYTES_LIMIT
#if TCP_OOSEQ_MAX_BYTES
#define TCP_OOSEQ_BYTES_LIMIT(pcb) TCP_OOSEQ_MAX_BYTES
#elif defined __DOXYGEN__
#define TCP_OOSEQ_BYTES_LIMIT(pcb)
#endif
#endif
/**
* TCP_OOSEQ_MAX_PBUFS: The default maximum number of pbufs queued on ooseq per
* pcb if TCP_OOSEQ_BYTES_LIMIT is not defined. Default is 0 (no limit).
* Only valid for TCP_QUEUE_OOSEQ==1.
*/
#if !defined TCP_OOSEQ_MAX_PBUFS || defined __DOXYGEN__
#define TCP_OOSEQ_MAX_PBUFS 0
#endif
/**
* TCP_OOSEQ_PBUFS_LIMIT(pcb): Return the maximum number of pbufs to be queued
* on ooseq per pcb, given the pcb. Only valid for TCP_QUEUE_OOSEQ==1 &&
* TCP_OOSEQ_MAX_PBUFS==1.
* Use this to override TCP_OOSEQ_MAX_PBUFS to a dynamic value per pcb.
*/
#if !defined TCP_OOSEQ_PBUFS_LIMIT
#if TCP_OOSEQ_MAX_PBUFS
#define TCP_OOSEQ_PBUFS_LIMIT(pcb) TCP_OOSEQ_MAX_PBUFS
#elif defined __DOXYGEN__
#define TCP_OOSEQ_PBUFS_LIMIT(pcb)
#endif
#endif
/**
* TCP_LISTEN_BACKLOG: Enable the backlog option for tcp listen pcb.
*/