net: Remove legacy TCP stack

Remove legacy TCP stack as it is replaced by the new TCP2 stack.
The TCP2 stack has been the default stack since 2.4 release.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit is contained in:
Jukka Rissanen 2021-01-28 14:55:45 +02:00 committed by Anas Nashif
commit 0af89fc4ec
14 changed files with 34 additions and 5318 deletions

View file

@ -249,11 +249,6 @@ __net_socket struct net_context {
net_pkt_get_pool_func_t data_pool; net_pkt_get_pool_func_t data_pool;
#endif /* CONFIG_NET_CONTEXT_NET_PKT_POOL */ #endif /* CONFIG_NET_CONTEXT_NET_PKT_POOL */
#if defined(CONFIG_NET_TCP1)
/** TCP connection information */
struct net_tcp *tcp;
#endif /* CONFIG_NET_TCP1 */
#if defined(CONFIG_NET_TCP2) #if defined(CONFIG_NET_TCP2)
/** TCP connection information */ /** TCP connection information */
void *tcp; void *tcp;

View file

@ -132,13 +132,9 @@ struct net_pkt {
struct net_linkaddr lladdr_src; struct net_linkaddr lladdr_src;
struct net_linkaddr lladdr_dst; struct net_linkaddr lladdr_dst;
#if defined(CONFIG_NET_TCP1) || defined(CONFIG_NET_TCP2) #if defined(CONFIG_NET_TCP2)
union { /** Allow placing the packet into sys_slist_t */
sys_snode_t sent_list; sys_snode_t next;
/** Allow placing the packet into sys_slist_t */
sys_snode_t next;
};
#endif #endif
uint8_t ip_hdr_len; /* pre-filled in order to avoid func call */ uint8_t ip_hdr_len; /* pre-filled in order to avoid func call */

View file

@ -1,12 +0,0 @@
# Overlay for experimental TCP
CONFIG_NET_TCP=y
CONFIG_NET_TCP2=y
CONFIG_MAIN_STACK_SIZE=2048
CONFIG_NET_TX_STACK_SIZE=8192
CONFIG_NET_RX_STACK_SIZE=8192
CONFIG_HEAP_MEM_POOL_SIZE=8192
CONFIG_STACK_CANARIES=y

View file

@ -17,7 +17,6 @@ CONFIG_NET_CONFIG_MY_IPV6_ADDR="2001:db8::1"
CONFIG_NET_CONFIG_PEER_IPV6_ADDR="2001:db8::2" CONFIG_NET_CONFIG_PEER_IPV6_ADDR="2001:db8::2"
CONFIG_NET_TCP=y CONFIG_NET_TCP=y
CONFIG_NET_TCP2=y
CONFIG_HEAP_MEM_POOL_SIZE=8192 CONFIG_HEAP_MEM_POOL_SIZE=8192

View file

@ -33,7 +33,6 @@ zephyr_library_sources_ifdef(CONFIG_NET_IPV6_MLD ipv6_mld.c)
zephyr_library_sources_ifdef(CONFIG_NET_IPV6_FRAGMENT ipv6_fragment.c) zephyr_library_sources_ifdef(CONFIG_NET_IPV6_FRAGMENT ipv6_fragment.c)
zephyr_library_sources_ifdef(CONFIG_NET_ROUTE route.c) zephyr_library_sources_ifdef(CONFIG_NET_ROUTE route.c)
zephyr_library_sources_ifdef(CONFIG_NET_STATISTICS net_stats.c) zephyr_library_sources_ifdef(CONFIG_NET_STATISTICS net_stats.c)
zephyr_library_sources_ifdef(CONFIG_NET_TCP1 connection.c tcp.c)
zephyr_library_sources_ifdef(CONFIG_NET_TCP2 connection.c tcp2.c) zephyr_library_sources_ifdef(CONFIG_NET_TCP2 connection.c tcp2.c)
zephyr_library_sources_ifdef(CONFIG_NET_TEST_PROTOCOL tp.c) zephyr_library_sources_ifdef(CONFIG_NET_TEST_PROTOCOL tp.c)
zephyr_library_sources_ifdef(CONFIG_NET_TRICKLE trickle.c) zephyr_library_sources_ifdef(CONFIG_NET_TRICKLE trickle.c)

View file

@ -336,17 +336,6 @@ config NET_TCP_BACKLOG_SIZE
The number of simultaneous TCP connection attempts, i.e. outstanding The number of simultaneous TCP connection attempts, i.e. outstanding
TCP connections waiting for initial ACK. TCP connections waiting for initial ACK.
config NET_TCP_AUTO_ACCEPT
bool "Auto accept incoming TCP data"
depends on NET_TCP
help
Automatically accept incoming TCP data packet to the valid
connection even if the application has not yet called accept().
This speeds up incoming data processing and is done like in Linux.
Drawback is that we allocate data for the incoming packets even if
the application has not yet accepted the connection. If the peer
sends lot of packets, we might run out of memory in this case.
config NET_TCP_TIME_WAIT_DELAY config NET_TCP_TIME_WAIT_DELAY
int "How long to wait in TIME_WAIT state (in milliseconds)" int "How long to wait in TIME_WAIT state (in milliseconds)"
depends on NET_TCP depends on NET_TCP
@ -449,26 +438,10 @@ config NET_TCP_ISN_RFC6528
RFC 6528 chapter 3. https://tools.ietf.org/html/rfc6528 RFC 6528 chapter 3. https://tools.ietf.org/html/rfc6528
If this is not set, then sys_rand32_get() is used for ISN value. If this is not set, then sys_rand32_get() is used for ISN value.
choice
prompt "Select TCP stack"
depends on NET_TCP
default NET_TCP2
help
Select the TCP stack implementation to use.
config NET_TCP2 config NET_TCP2
bool "New TCP stack" bool
help default y
Enable new TCP stack for Zephyr 2.4 depends on NET_TCP
config NET_TCP1
bool "Legacy TCP stack (DEPRECATED)"
help
The legacy TCP stack that has been in use since Zephyr 1.0.
The legacy TCP stack is deprecated and you should use the new TCP
stack instead. The legacy TCP stack will be removed in 2.6 release.
endchoice
config NET_TEST_PROTOCOL config NET_TEST_PROTOCOL
bool "Enable JSON based test protocol (UDP)" bool "Enable JSON based test protocol (UDP)"

View file

@ -34,6 +34,7 @@ LOG_MODULE_REGISTER(net_shell, LOG_LEVEL_DBG);
#if defined(CONFIG_NET_TCP) #if defined(CONFIG_NET_TCP)
#include "tcp_internal.h" #include "tcp_internal.h"
#include <sys/slist.h>
#endif #endif
#include "ipv6.h" #include "ipv6.h"
@ -1329,81 +1330,6 @@ struct tcp2_detail_info {
}; };
#endif #endif
#if defined(CONFIG_NET_TCP1) && \
(defined(CONFIG_NET_OFFLOAD) || defined(CONFIG_NET_NATIVE))
static void tcp_cb(struct net_tcp *tcp, void *user_data)
{
struct net_shell_user_data *data = user_data;
const struct shell *shell = data->shell;
int *count = data->user_data;
uint16_t recv_mss = net_tcp_get_recv_mss(tcp);
PR("%p %p %5u %5u %10u %10u %5u %s\n",
tcp, tcp->context,
ntohs(net_sin6_ptr(&tcp->context->local)->sin6_port),
ntohs(net_sin6(&tcp->context->remote)->sin6_port),
tcp->send_seq, tcp->send_ack, recv_mss,
net_tcp_state_str(net_tcp_get_state(tcp)));
(*count)++;
}
#if CONFIG_NET_TCP_LOG_LEVEL >= LOG_LEVEL_DBG
static void tcp_sent_list_cb(struct net_tcp *tcp, void *user_data)
{
struct net_shell_user_data *data = user_data;
const struct shell *shell = data->shell;
int *printed = data->user_data;
struct net_pkt *pkt;
struct net_pkt *tmp;
if (sys_slist_is_empty(&tcp->sent_list)) {
return;
}
if (!*printed) {
PR("\nTCP packets waiting ACK:\n");
PR("TCP net_pkt[ref/totlen]->net_buf[ref/len]..."
"\n");
}
PR("%p ", tcp);
SYS_SLIST_FOR_EACH_CONTAINER_SAFE(&tcp->sent_list, pkt, tmp,
sent_list) {
struct net_buf *frag = pkt->frags;
if (!*printed) {
PR("%p[%d/%zd]", pkt, atomic_get(&pkt->atomic_ref),
net_pkt_get_len(pkt));
*printed = true;
} else {
PR(" %p[%d/%zd]",
pkt, atomic_get(&pkt->atomic_ref),
net_pkt_get_len(pkt));
}
if (frag) {
PR("->");
}
while (frag) {
PR("%p[%d/%d]", frag, frag->ref, frag->len);
frag = frag->frags;
if (frag) {
PR("->");
}
}
PR("\n");
}
*printed = true;
}
#endif /* CONFIG_NET_TCP_LOG_LEVEL >= LOG_LEVEL_DBG */
#endif /* TCP1 */
#if defined(CONFIG_NET_TCP2) && \ #if defined(CONFIG_NET_TCP2) && \
(defined(CONFIG_NET_OFFLOAD) || defined(CONFIG_NET_NATIVE)) (defined(CONFIG_NET_OFFLOAD) || defined(CONFIG_NET_NATIVE))
static void tcp_cb(struct tcp *conn, void *user_data) static void tcp_cb(struct tcp *conn, void *user_data)
@ -1430,7 +1356,7 @@ static void tcp_sent_list_cb(struct tcp *conn, void *user_data)
const struct shell *shell = data->shell; const struct shell *shell = data->shell;
struct tcp2_detail_info *details = data->user_data; struct tcp2_detail_info *details = data->user_data;
struct net_pkt *pkt; struct net_pkt *pkt;
struct net_pkt *tmp; sys_snode_t *node;
if (conn->state != TCP_LISTEN) { if (conn->state != TCP_LISTEN) {
if (!details->printed_details) { if (!details->printed_details) {
@ -1460,34 +1386,38 @@ static void tcp_sent_list_cb(struct tcp *conn, void *user_data)
PR("%p ", conn); PR("%p ", conn);
SYS_SLIST_FOR_EACH_CONTAINER_SAFE(&conn->send_queue, pkt, tmp, node = sys_slist_peek_head(&conn->send_queue);
sent_list) { if (node) {
struct net_buf *frag = pkt->frags; pkt = CONTAINER_OF(node, struct net_pkt, next);
if (pkt) {
struct net_buf *frag = pkt->frags;
if (!details->printed_send_queue_header) { if (!details->printed_send_queue_header) {
PR("%p[%d/%zd]", pkt, atomic_get(&pkt->atomic_ref), PR("%p[%d/%zd]", pkt,
net_pkt_get_len(pkt)); atomic_get(&pkt->atomic_ref),
details->printed_send_queue_header = true; net_pkt_get_len(pkt));
} else { details->printed_send_queue_header = true;
PR(" %p[%d/%zd]", } else {
pkt, atomic_get(&pkt->atomic_ref), PR(" %p[%d/%zd]",
net_pkt_get_len(pkt)); pkt, atomic_get(&pkt->atomic_ref),
} net_pkt_get_len(pkt));
}
if (frag) {
PR("->");
}
while (frag) {
PR("%p[%d/%d]", frag, frag->ref, frag->len);
frag = frag->frags;
if (frag) { if (frag) {
PR("->"); PR("->");
} }
}
PR("\n"); while (frag) {
PR("%p[%d/%d]", frag, frag->ref, frag->len);
frag = frag->frags;
if (frag) {
PR("->");
}
}
PR("\n");
}
} }
details->printed_send_queue_header = true; details->printed_send_queue_header = true;

File diff suppressed because it is too large Load diff

View file

@ -27,495 +27,6 @@
extern "C" { extern "C" {
#endif #endif
/* Some of the stuff here is only for legacy TCP stack */
#if defined(CONFIG_NET_TCP1)
/** Is this TCP context/socket used or not */
#define NET_TCP_IN_USE BIT(0)
/* BIT(1), BIT(2) are unused and available */
/** Is the socket shutdown for read/write */
#define NET_TCP_IS_SHUTDOWN BIT(3)
/** A retransmitted packet has been sent and not yet ack'd */
#define NET_TCP_RETRYING BIT(4)
/** MSS option has been set already */
#define NET_TCP_RECV_MSS_SET BIT(5)
/*
* TCP connection states
*/
enum net_tcp_state {
NET_TCP_CLOSED = 0,
NET_TCP_LISTEN,
NET_TCP_SYN_SENT,
NET_TCP_SYN_RCVD,
NET_TCP_ESTABLISHED,
NET_TCP_CLOSE_WAIT,
NET_TCP_LAST_ACK,
NET_TCP_FIN_WAIT_1,
NET_TCP_FIN_WAIT_2,
NET_TCP_TIME_WAIT,
NET_TCP_CLOSING,
};
/* TCP packet types */
#define NET_TCP_FIN 0x01
#define NET_TCP_SYN 0x02
#define NET_TCP_RST 0x04
#define NET_TCP_PSH 0x08
#define NET_TCP_ACK 0x10
#define NET_TCP_URG 0x20
#define NET_TCP_CTL 0x3f
#define NET_TCP_FLAGS(hdr) (hdr->flags & NET_TCP_CTL)
/* Length of TCP header, including options */
/* "offset": 4-bit field in high nibble, units of dwords */
#define NET_TCP_HDR_LEN(hdr) (4 * ((hdr)->offset >> 4))
/* RFC 1122 4.2.2.6 "If an MSS option is not received at connection
* setup, TCP MUST assume a default send MSS of 536"
*/
#define NET_TCP_DEFAULT_MSS 536
/* TCP max window size */
#define NET_TCP_MAX_WIN (4 * 1024)
/* Maximal value of the sequence number */
#define NET_TCP_MAX_SEQ 0xffffffff
/* TCP Option codes */
#define NET_TCP_END_OPT 0
#define NET_TCP_NOP_OPT 1
#define NET_TCP_MSS_OPT 2
#define NET_TCP_WINDOW_SCALE_OPT 3
/* TCP Option sizes */
#define NET_TCP_END_SIZE 1
#define NET_TCP_NOP_SIZE 1
#define NET_TCP_MSS_SIZE 4
#define NET_TCP_WINDOW_SCALE_SIZE 3
/** Parsed TCP option values for net_tcp_parse_opts() */
struct net_tcp_options {
uint16_t mss;
};
/* Max received bytes to buffer internally */
#define NET_TCP_BUF_MAX_LEN 1280
/* Max segment lifetime, in seconds */
#define NET_TCP_MAX_SEG_LIFETIME 60
struct net_context;
struct net_tcp {
/** Network context back pointer. */
struct net_context *context;
/** Cookie pointer passed to net_context_recv() */
void *recv_user_data;
/** ACK message timer */
struct k_delayed_work ack_timer;
/** Timer for doing active close in case the peer FIN is lost. */
struct k_delayed_work fin_timer;
/** Retransmit timer */
struct k_delayed_work retry_timer;
/** TIME_WAIT timer */
struct k_delayed_work timewait_timer;
/** List pointer used for TCP retransmit buffering */
sys_slist_t sent_list;
/** Current sequence number. */
uint32_t send_seq;
/** Acknowledgment number to send in next packet. */
uint32_t send_ack;
/** Last ACK value sent */
uint32_t sent_ack;
/** Accept callback to be called when the connection has been
* established.
*/
net_tcp_accept_cb_t accept_cb;
/**
* Semaphore to signal TCP connection completion
*/
struct k_sem connect_wait;
/**
* Current TCP receive window for our side
*/
uint16_t recv_wnd;
/**
* Send MSS for the peer
*/
uint16_t send_mss;
/** Current retransmit period */
uint32_t retry_timeout_shift : 5;
/** Flags for the TCP */
uint32_t flags : 8;
/** Current TCP state */
uint32_t state : 4;
/* An outbound FIN packet has been sent */
uint32_t fin_sent : 1;
/* An inbound FIN packet has been received */
uint32_t fin_rcvd : 1;
/** Remaining bits in this uint32_t */
uint32_t _padding : 13;
};
typedef void (*net_tcp_cb_t)(struct net_tcp *tcp, void *user_data);
static inline bool net_tcp_is_used(struct net_tcp *tcp)
{
NET_ASSERT(tcp);
return tcp->flags & NET_TCP_IN_USE;
}
/**
* @brief Register a callback to be called when TCP packet
* is received corresponding to received packet.
*
* @param family Protocol family
* @param remote_addr Remote address of the connection end point.
* @param local_addr Local address of the connection end point.
* @param remote_port Remote port of the connection end point.
* @param local_port Local port of the connection end point.
* @param cb Callback to be called
* @param user_data User data supplied by caller.
* @param handle TCP handle that can be used when unregistering
*
* @return Return 0 if the registration succeed, <0 otherwise.
*/
static inline int net_tcp_register(uint8_t family,
const struct sockaddr *remote_addr,
const struct sockaddr *local_addr,
uint16_t remote_port,
uint16_t local_port,
net_conn_cb_t cb,
void *user_data,
struct net_conn_handle **handle)
{
return net_conn_register(IPPROTO_TCP, family, remote_addr, local_addr,
remote_port, local_port, cb, user_data,
handle);
}
/**
* @brief Unregister TCP handler.
*
* @param handle Handle from registering.
*
* @return Return 0 if the unregistration succeed, <0 otherwise.
*/
static inline int net_tcp_unregister(struct net_conn_handle *handle)
{
return net_conn_unregister(handle);
}
/*
* @brief Generate initial TCP sequence number
*
* @return Return a random TCP sequence number
*/
static inline uint32_t tcp_init_isn(void)
{
/* Randomise initial seq number */
return sys_rand32_get();
}
const char *net_tcp_state_str(enum net_tcp_state state);
#if defined(CONFIG_NET_NATIVE_TCP)
void net_tcp_change_state(struct net_tcp *tcp, enum net_tcp_state new_state);
#else
#define net_tcp_change_state(...)
#endif
/**
* @brief Allocate TCP connection context.
*
* @param context Pointer to net_context that is tied to this TCP
* context.
*
* @return Pointer TCP connection context. NULL if no available
* context can be found.
*/
#if defined(CONFIG_NET_NATIVE_TCP)
struct net_tcp *net_tcp_alloc(struct net_context *context);
#else
static inline struct net_tcp *net_tcp_alloc(struct net_context *context)
{
ARG_UNUSED(context);
return NULL;
}
#endif
/**
* @brief Release TCP connection context.
*
* @param tcp Pointer to net_tcp context.
*
* @return 0 if ok, < 0 if error
*/
#if defined(CONFIG_NET_NATIVE_TCP)
int net_tcp_release(struct net_tcp *tcp);
#else
static inline int net_tcp_release(struct net_tcp *tcp)
{
ARG_UNUSED(tcp);
return 0;
}
#endif
/**
* @brief Send a TCP segment without any data. The returned buffer
* is a ready made packet that can be sent via net_send_data()
* function.
*
* @param tcp TCP context
* @param flags TCP flags
* @param options Pointer TCP options, NULL if no options.
* @param optlen Length of the options.
* @param local Source address, or NULL to use the local address of
* the TCP context
* @param remote Peer address
* @param send_pkt Full IP + TCP header that is to be sent.
*
* @return 0 if ok, < 0 if error
*/
#if defined(CONFIG_NET_NATIVE_TCP)
int net_tcp_prepare_segment(struct net_tcp *tcp, uint8_t flags,
void *options, size_t optlen,
const struct sockaddr_ptr *local,
const struct sockaddr *remote,
struct net_pkt **send_pkt);
#else
static inline int net_tcp_prepare_segment(struct net_tcp *tcp, uint8_t flags,
void *options, size_t optlen,
const struct sockaddr_ptr *local,
const struct sockaddr *remote,
struct net_pkt **send_pkt)
{
ARG_UNUSED(tcp);
ARG_UNUSED(flags);
ARG_UNUSED(options);
ARG_UNUSED(optlen);
ARG_UNUSED(local);
ARG_UNUSED(remote);
ARG_UNUSED(send_pkt);
return 0;
}
#endif
/**
* @brief Prepare a TCP ACK message that can be send to peer.
*
* @param tcp TCP context
* @param remote Peer address
* @param pkt Network buffer
*
* @return 0 if ok, < 0 if error
*/
#if defined(CONFIG_NET_NATIVE_TCP)
int net_tcp_prepare_ack(struct net_tcp *tcp, const struct sockaddr *remote,
struct net_pkt **pkt);
#else
static inline int net_tcp_prepare_ack(struct net_tcp *tcp,
const struct sockaddr *remote,
struct net_pkt **pkt)
{
ARG_UNUSED(tcp);
ARG_UNUSED(remote);
ARG_UNUSED(pkt);
return 0;
}
#endif
/**
* @brief Prepare a TCP RST message that can be send to peer.
*
* @param tcp TCP context
* @param local Source address
* @param remote Peer address
* @param pkt Network buffer
*
* @return 0 if ok, < 0 if error
*/
#if defined(CONFIG_NET_NATIVE_TCP)
int net_tcp_prepare_reset(struct net_tcp *tcp,
const struct sockaddr *local,
const struct sockaddr *remote,
struct net_pkt **pkt);
#else
static inline int net_tcp_prepare_reset(struct net_tcp *tcp,
const struct sockaddr *remote,
struct net_pkt **pkt)
{
ARG_UNUSED(tcp);
ARG_UNUSED(remote);
ARG_UNUSED(pkt);
return 0;
}
#endif
/**
* @brief Go through all the TCP connections and call callback
* for each of them.
*
* @param cb User supplied callback function to call.
* @param user_data User specified data.
*/
#if defined(CONFIG_NET_NATIVE_TCP)
void net_tcp_foreach(net_tcp_cb_t cb, void *user_data);
#else
static inline void net_tcp_foreach(net_tcp_cb_t cb, void *user_data)
{
ARG_UNUSED(cb);
ARG_UNUSED(user_data);
}
#endif
/**
* @brief Sends one TCP packet initialized with the _prepare_*()
* family of functions.
*
* @param pkt Packet
*/
#if defined(CONFIG_NET_NATIVE_TCP)
int net_tcp_send_pkt(struct net_pkt *pkt);
#else
static inline int net_tcp_send_pkt(struct net_pkt *pkt)
{
ARG_UNUSED(pkt);
return 0;
}
#endif
/**
* @brief Handle a received TCP ACK
*
* @param cts Context
* @param seq Received ACK sequence number
* @return False if ACK sequence number is invalid, true otherwise
*/
#if defined(CONFIG_NET_NATIVE_TCP)
bool net_tcp_ack_received(struct net_context *ctx, uint32_t ack);
#else
static inline bool net_tcp_ack_received(struct net_context *ctx, uint32_t ack)
{
ARG_UNUSED(ctx);
ARG_UNUSED(ack);
return false;
}
#endif
/**
* @brief Calculates and returns the MSS for a given TCP context
*
* @param tcp TCP context
*
* @return Maximum Segment Size
*/
#if defined(CONFIG_NET_NATIVE_TCP)
uint16_t net_tcp_get_recv_mss(const struct net_tcp *tcp);
#else
static inline uint16_t net_tcp_get_recv_mss(const struct net_tcp *tcp)
{
ARG_UNUSED(tcp);
return 0;
}
#endif
/**
* @brief Returns the receive window for a given TCP context
*
* @param tcp TCP context
*
* @return Current TCP receive window
*/
#if defined(CONFIG_NET_NATIVE_TCP)
uint32_t net_tcp_get_recv_wnd(const struct net_tcp *tcp);
#else
static inline uint32_t net_tcp_get_recv_wnd(const struct net_tcp *tcp)
{
ARG_UNUSED(tcp);
return 0;
}
#endif
/**
* @brief Obtains the state for a TCP context
*
* @param tcp TCP context
*/
#if defined(CONFIG_NET_NATIVE_TCP)
static inline enum net_tcp_state net_tcp_get_state(const struct net_tcp *tcp)
{
return (enum net_tcp_state)tcp->state;
}
#else
static inline enum net_tcp_state net_tcp_get_state(const struct net_tcp *tcp)
{
ARG_UNUSED(tcp);
return NET_TCP_CLOSED;
}
#endif
/**
* @brief Check if the sequence number is valid i.e., it is inside the window.
*
* @param tcp TCP context
* @param tcp_hdr TCP header pointer
*
* @return true if network packet sequence number is valid, false otherwise
*/
#if defined(CONFIG_NET_NATIVE_TCP)
bool net_tcp_validate_seq(struct net_tcp *tcp, struct net_tcp_hdr *tcp_hdr);
#else
static inline bool net_tcp_validate_seq(struct net_tcp *tcp,
struct net_tcp_hdr *tcp_hdr)
{
ARG_UNUSED(tcp);
ARG_UNUSED(tcp_hdr);
return false;
}
#endif
/**
* @brief Parse TCP options from network packet.
*
* Parse TCP options, returning MSS value (as that the only one we
* handle so far).
*
* @param pkt Network packet
* @param opt_totlen Total length of options to parse
* @param opts Pointer to TCP options structure. (Each option is updated
* only if present, so the structure must be initialized with the default
* values.)
*
* @return 0 if no error, <0 in case of error
*/
int net_tcp_parse_opts(struct net_pkt *pkt, int opt_totlen,
struct net_tcp_options *opts);
#else /* TCP1 vs TCP2 */
/* TCP2 specific stuff */
#include "tcp2_priv.h" #include "tcp2_priv.h"
@ -573,8 +84,6 @@ static inline void net_tcp_foreach(net_tcp_cb_t cb, void *user_data)
} }
#endif #endif
#endif /* CONFIG_NET_TCP1 vs TCP2 */
/** /**
* @brief Initialize TCP parts of a context * @brief Initialize TCP parts of a context
* *

View file

@ -1,9 +0,0 @@
# SPDX-License-Identifier: Apache-2.0
cmake_minimum_required(VERSION 3.13.1)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(tcp)
target_include_directories(app PRIVATE ${ZEPHYR_BASE}/subsys/net/ip)
FILE(GLOB app_sources src/*.c)
target_sources(app PRIVATE ${app_sources})

View file

@ -1,28 +0,0 @@
CONFIG_TEST=y
CONFIG_NETWORKING=y
CONFIG_NET_TEST=y
CONFIG_NET_L2_DUMMY=y
CONFIG_NET_TCP=y
CONFIG_NET_MAX_CONN=64
CONFIG_NET_IPV6=y
CONFIG_NET_IPV4=y
CONFIG_NET_BUF=y
CONFIG_MAIN_STACK_SIZE=2048
CONFIG_NET_PKT_RX_COUNT=20
CONFIG_NET_PKT_TX_COUNT=20
CONFIG_NET_BUF_RX_COUNT=20
CONFIG_NET_BUF_TX_COUNT=20
CONFIG_NET_MAX_CONTEXTS=20
CONFIG_NET_LOG=y
CONFIG_ENTROPY_GENERATOR=y
CONFIG_TEST_RANDOM_GENERATOR=y
CONFIG_NET_IF_MAX_IPV6_COUNT=2
CONFIG_NET_IF_MAX_IPV4_COUNT=2
CONFIG_NET_IF_UNICAST_IPV6_ADDR_COUNT=5
CONFIG_NET_IF_UNICAST_IPV4_ADDR_COUNT=3
CONFIG_NET_IF_MCAST_IPV6_ADDR_COUNT=2
CONFIG_NET_IPV6_ND=n
CONFIG_NET_IPV6_DAD=n
CONFIG_NET_IPV6_NBR_CACHE=n
CONFIG_NET_IPV6_MLD=n
CONFIG_NET_TCP_CHECKSUM=n

File diff suppressed because it is too large Load diff

View file

@ -1,5 +0,0 @@
tests:
net.tcp.simple:
depends_on: netif
tags: net tcp
filter: CONFIG_NET_TCP1

View file

@ -4,7 +4,6 @@ CONFIG_NET_TEST=y
CONFIG_NET_L2_DUMMY=y CONFIG_NET_L2_DUMMY=y
CONFIG_NET_TCP=y CONFIG_NET_TCP=y
CONFIG_NET_TCP2=y
CONFIG_NET_MAX_CONN=64 CONFIG_NET_MAX_CONN=64
CONFIG_NET_IPV6=y CONFIG_NET_IPV6=y
CONFIG_NET_IPV4=y CONFIG_NET_IPV4=y