mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-18 12:52:44 +01:00
gnrc/tcp : Move GNRC_TCP_MSS to 'CONFIG_'
This commit is contained in:
parent
d0145292aa
commit
e8b13ab44d
@ -68,11 +68,11 @@ extern "C" {
|
|||||||
/**
|
/**
|
||||||
* @brief Maximum Segment Size (MSS).
|
* @brief Maximum Segment Size (MSS).
|
||||||
*/
|
*/
|
||||||
#ifndef GNRC_TCP_MSS
|
#ifndef CONFIG_GNRC_TCP_MSS
|
||||||
#ifdef MODULE_GNRC_IPV6
|
#ifdef MODULE_GNRC_IPV6
|
||||||
#define GNRC_TCP_MSS (1220U) /**< If IPv6 is used. Get MSS = 1280 - IPv6 Hdr - TCP Hdr = 1220 */
|
#define CONFIG_GNRC_TCP_MSS (1220U) /**< If IPv6 is used. Get MSS = 1280 - IPv6 Hdr - TCP Hdr = 1220 */
|
||||||
#else
|
#else
|
||||||
#define GNRC_TCP_MSS (576U) /**< Default MSS */
|
#define CONFIG_GNRC_TCP_MSS (576U) /**< Default MSS */
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -87,7 +87,7 @@ extern "C" {
|
|||||||
* @brief Default receive window size
|
* @brief Default receive window size
|
||||||
*/
|
*/
|
||||||
#ifndef GNRC_TCP_DEFAULT_WINDOW
|
#ifndef GNRC_TCP_DEFAULT_WINDOW
|
||||||
#define GNRC_TCP_DEFAULT_WINDOW (GNRC_TCP_MSS * CONFIG_GNRC_TCP_MSS_MULTIPLICATOR)
|
#define GNRC_TCP_DEFAULT_WINDOW (CONFIG_GNRC_TCP_MSS * CONFIG_GNRC_TCP_MSS_MULTIPLICATOR)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -272,7 +272,7 @@ static int _fsm_call_send(gnrc_tcp_tcb_t *tcb, void *buf, size_t len)
|
|||||||
/* Check if window is open and all packets were transmitted */
|
/* Check if window is open and all packets were transmitted */
|
||||||
if (payload > 0 && tcb->snd_wnd > 0 && tcb->pkt_retransmit == NULL) {
|
if (payload > 0 && tcb->snd_wnd > 0 && tcb->pkt_retransmit == NULL) {
|
||||||
/* Calculate segment size */
|
/* Calculate segment size */
|
||||||
payload = (payload < GNRC_TCP_MSS) ? payload : GNRC_TCP_MSS;
|
payload = (payload < CONFIG_GNRC_TCP_MSS) ? payload : CONFIG_GNRC_TCP_MSS;
|
||||||
payload = (payload < tcb->mss) ? payload : tcb->mss;
|
payload = (payload < tcb->mss) ? payload : tcb->mss;
|
||||||
payload = (payload < len) ? payload : len;
|
payload = (payload < len) ? payload : len;
|
||||||
|
|
||||||
@ -307,8 +307,8 @@ static int _fsm_call_recv(gnrc_tcp_tcb_t *tcb, void *buf, size_t len)
|
|||||||
/* Read data into 'buf' up to 'len' bytes from receive buffer */
|
/* Read data into 'buf' up to 'len' bytes from receive buffer */
|
||||||
size_t rcvd = ringbuffer_get(&(tcb->rcv_buf), buf, len);
|
size_t rcvd = ringbuffer_get(&(tcb->rcv_buf), buf, len);
|
||||||
|
|
||||||
/* If receive buffer can store more than GNRC_TCP_MSS: open window to available buffer size */
|
/* If receive buffer can store more than CONFIG_GNRC_TCP_MSS: open window to available buffer size */
|
||||||
if (ringbuffer_get_free(&tcb->rcv_buf) >= GNRC_TCP_MSS) {
|
if (ringbuffer_get_free(&tcb->rcv_buf) >= CONFIG_GNRC_TCP_MSS) {
|
||||||
tcb->rcv_wnd = ringbuffer_get_free(&(tcb->rcv_buf));
|
tcb->rcv_wnd = ringbuffer_get_free(&(tcb->rcv_buf));
|
||||||
|
|
||||||
/* Send ACK to anounce window update */
|
/* Send ACK to anounce window update */
|
||||||
|
@ -201,7 +201,7 @@ int _pkt_build(gnrc_tcp_tcb_t *tcb, gnrc_pktsnip_t **out_pkt, uint16_t *seq_con,
|
|||||||
|
|
||||||
/* If SYN flag is set: Add MSS option */
|
/* If SYN flag is set: Add MSS option */
|
||||||
if (ctl & MSK_SYN) {
|
if (ctl & MSK_SYN) {
|
||||||
network_uint32_t mss_option = byteorder_htonl(_option_build_mss(GNRC_TCP_MSS));
|
network_uint32_t mss_option = byteorder_htonl(_option_build_mss(CONFIG_GNRC_TCP_MSS));
|
||||||
memcpy(opt_ptr, &mss_option, sizeof(mss_option));
|
memcpy(opt_ptr, &mss_option, sizeof(mss_option));
|
||||||
}
|
}
|
||||||
/* Increase opt_ptr and decrease opt_left, if other options are added */
|
/* Increase opt_ptr and decrease opt_left, if other options are added */
|
||||||
|
Loading…
Reference in New Issue
Block a user