1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

gnrc/tcp : Move GNRC_TCP_RCV_BUFFERS to 'CONFIG_'

This commit is contained in:
Akshai M 2020-05-14 16:31:28 +05:30
parent e8b13ab44d
commit 648247592c
4 changed files with 7 additions and 7 deletions

View File

@ -150,7 +150,7 @@ int gnrc_tcp_open_active(gnrc_tcp_tcb_t *tcb, const gnrc_tcp_ep_t *remote,
* or the address in @p local is invalid.
* @return -EISCONN if TCB is already in use.
* @return -ENOMEM if the receive buffer for the TCB could not be allocated.
* Hint: Increase "GNRC_TCP_RCV_BUFFERS".
* Hint: Increase "CONFIG_GNRC_TCP_RCV_BUFFERS".
*/
int gnrc_tcp_open_passive(gnrc_tcp_tcb_t *tcb, const gnrc_tcp_ep_t *local);

View File

@ -96,8 +96,8 @@ extern "C" {
* This value determines how many parallel TCP connections can be active at the
* same time.
*/
#ifndef GNRC_TCP_RCV_BUFFERS
#define GNRC_TCP_RCV_BUFFERS (1U)
#ifndef CONFIG_GNRC_TCP_RCV_BUFFERS
#define CONFIG_GNRC_TCP_RCV_BUFFERS (1U)
#endif
/**

View File

@ -33,7 +33,7 @@ void _rcvbuf_init(void)
{
DEBUG("gnrc_tcp_rcvbuf.c : _rcvbuf_init() : entry\n");
mutex_init(&(_static_buf.lock));
for (size_t i = 0; i < GNRC_TCP_RCV_BUFFERS; ++i) {
for (size_t i = 0; i < CONFIG_GNRC_TCP_RCV_BUFFERS; ++i) {
_static_buf.entries[i].used = 0;
}
}
@ -49,7 +49,7 @@ static void* _rcvbuf_alloc(void)
void *result = NULL;
DEBUG("gnrc_tcp_rcvbuf.c : _rcvbuf_alloc() : Entry\n");
mutex_lock(&(_static_buf.lock));
for (size_t i = 0; i < GNRC_TCP_RCV_BUFFERS; ++i) {
for (size_t i = 0; i < CONFIG_GNRC_TCP_RCV_BUFFERS; ++i) {
if (_static_buf.entries[i].used == 0) {
_static_buf.entries[i].used = 1;
result = (void *)(_static_buf.entries[i].buffer);
@ -69,7 +69,7 @@ static void _rcvbuf_free(void * const buf)
{
DEBUG("gnrc_tcp_rcvbuf.c : _rcvbuf_free() : Entry\n");
mutex_lock(&(_static_buf.lock));
for (size_t i = 0; i < GNRC_TCP_RCV_BUFFERS; ++i) {
for (size_t i = 0; i < CONFIG_GNRC_TCP_RCV_BUFFERS; ++i) {
if ((_static_buf.entries[i].used == 1) && (buf == _static_buf.entries[i].buffer)) {
_static_buf.entries[i].used = 0;
}

View File

@ -42,7 +42,7 @@ typedef struct rcvbuf_entry {
*/
typedef struct rcvbuf {
mutex_t lock; /**< Lock for allocation synchronization */
rcvbuf_entry_t entries[GNRC_TCP_RCV_BUFFERS]; /**< Maintained receive buffers */
rcvbuf_entry_t entries[CONFIG_GNRC_TCP_RCV_BUFFERS]; /**< Maintained receive buffers */
} rcvbuf_t;
/**