Skip to content

Commit b00adf6

Browse files
jukkarnashif
authored andcommitted
net: tcp2: Re-order connection struct fields
Order the fields in connection struct so that they use minimal amount of memory. Signed-off-by: Jukka Rissanen <[email protected]>
1 parent ff2aff3 commit b00adf6

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

subsys/net/ip/tcp2_priv.h

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -179,32 +179,32 @@ struct tcp_options {
179179
struct tcp { /* TCP connection */
180180
sys_snode_t next;
181181
struct net_context *context;
182-
struct k_mutex lock;
182+
struct net_pkt *send_data;
183+
struct net_if *iface;
183184
void *recv_user_data;
184-
enum tcp_state state;
185-
uint32_t seq;
186-
uint32_t ack;
187-
union tcp_endpoint src;
188-
union tcp_endpoint dst;
189-
uint16_t recv_win;
190-
uint16_t send_win;
185+
sys_slist_t send_queue;
186+
net_tcp_accept_cb_t accept_cb;
187+
struct k_mutex lock;
188+
struct k_sem connect_sem; /* semaphore for blocking connect */
191189
struct tcp_options recv_options;
192190
struct k_delayed_work send_timer;
193-
sys_slist_t send_queue;
194191
struct k_delayed_work send_data_timer;
195-
struct net_pkt *send_data;
192+
struct k_delayed_work timewait_timer;
193+
union tcp_endpoint src;
194+
union tcp_endpoint dst;
196195
size_t send_data_total;
197-
uint8_t send_data_retries;
198-
int unacked_len;
199-
enum tcp_data_mode data_mode;
200-
bool in_retransmission;
201196
size_t send_retries;
202-
struct k_delayed_work timewait_timer;
203-
struct net_if *iface;
204-
struct k_sem connect_sem; /* semaphore for blocking connect */
205-
bool in_connect;
206-
net_tcp_accept_cb_t accept_cb;
197+
int unacked_len;
207198
atomic_t ref_count;
199+
enum tcp_state state;
200+
enum tcp_data_mode data_mode;
201+
uint32_t seq;
202+
uint32_t ack;
203+
uint16_t recv_win;
204+
uint16_t send_win;
205+
uint8_t send_data_retries;
206+
bool in_retransmission : 1;
207+
bool in_connect : 1;
208208
};
209209

210210
#define _flags(_fl, _op, _mask, _cond) \

0 commit comments

Comments
 (0)