Skip to content

Commit f947439

Browse files
jukkarAnas Nashif
authored and
Anas Nashif
committed
net: Align the stack infos in net_stack linker section
There can be lot of traffic class threads and each will have their own stacks. This can trigger issue when traversing the stacks list in "net stacks" shell command. To overcome this issue, we need to align each net_stack_info struct by 32 bytes. This is the same issue that happened with net_if earlier. Signed-off-by: Jukka Rissanen <[email protected]>
1 parent c609bd8 commit f947439

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

include/net/net_core.h

+7-1
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,12 @@ int net_recv_data(struct net_if *iface, struct net_pkt *pkt);
105105
*/
106106
int net_send_data(struct net_pkt *pkt);
107107

108+
/*
109+
* The net_stack_info struct needs to be aligned to 32 byte boundary,
110+
* otherwise the __net_stack_end will point to wrong location and looping
111+
* through net_stack section will go wrong.
112+
* So this alignment is a workaround and should eventually be removed.
113+
*/
108114
struct net_stack_info {
109115
k_thread_stack_t *stack;
110116
const char *pretty_name;
@@ -113,7 +119,7 @@ struct net_stack_info {
113119
size_t size;
114120
int prio;
115121
int idx;
116-
};
122+
} __aligned(32);
117123

118124
#if defined(CONFIG_NET_SHELL)
119125
#define NET_STACK_GET_NAME(pretty, name, sfx) \

0 commit comments

Comments
 (0)