Skip to content

Commit e8cede7

Browse files
Andrew Boiejukkar
authored andcommitted
net: fix references to stack buffers
The net_stack_analyze function wants to look at the stack buffer, but it is making assumptions on where this data is that are no longer valid. Change to use the proper APIs for referencing this. Signed-off-by: Andrew Boie <[email protected]>
1 parent edcf5f8 commit e8cede7

File tree

6 files changed

+18
-15
lines changed

6 files changed

+18
-15
lines changed

drivers/ieee802154/ieee802154_cc2520.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -688,8 +688,8 @@ static void cc2520_rx(int arg)
688688
}
689689

690690
net_analyze_stack("CC2520 Rx Fiber stack",
691-
(unsigned char *)cc2520->cc2520_rx_stack,
692-
CONFIG_IEEE802154_CC2520_RX_STACK_SIZE);
691+
K_THREAD_STACK_BUFFER(cc2520->cc2520_rx_stack),
692+
K_THREAD_STACK_SIZEOF(cc2520->cc2520_rx_stack));
693693
continue;
694694
flush:
695695
_cc2520_print_exceptions(cc2520);

drivers/ieee802154/ieee802154_mcr20a.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -591,8 +591,8 @@ static inline void mcr20a_rx(struct mcr20a_context *mcr20a, u8_t len)
591591
}
592592

593593
net_analyze_stack("MCR20A Rx Fiber stack",
594-
mcr20a->mcr20a_rx_stack,
595-
CONFIG_IEEE802154_MCR20A_RX_STACK_SIZE);
594+
K_THREAD_STACK_BUFFER(mcr20a->mcr20a_rx_stack),
595+
K_THREAD_STACK_SIZEOF(mcr20a->mcr20a_rx_stack));
596596
return;
597597
out:
598598
if (pkt) {

drivers/ieee802154/ieee802154_nrf5.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@ static void nrf5_rx_thread(void *arg1, void *arg2, void *arg3)
124124
}
125125

126126
net_analyze_stack("nRF5 rx stack",
127-
(unsigned char *)nrf5_radio->rx_stack,
128-
CONFIG_IEEE802154_NRF5_RX_STACK_SIZE);
127+
K_THREAD_STACK_BUFFER(nrf5_radio->rx_stack),
128+
K_THREAD_STACK_SIZEOF(nrf5_radio->rx_stack));
129129
continue;
130130

131131
out:

subsys/net/ip/net_core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ static void net_rx_thread(void)
165165

166166
pkt = k_fifo_get(&rx_queue, K_FOREVER);
167167

168-
net_analyze_stack("RX thread", rx_stack,
168+
net_analyze_stack("RX thread", K_THREAD_STACK_BUFFER(rx_stack),
169169
K_THREAD_STACK_SIZEOF(rx_stack));
170170

171171
#if defined(CONFIG_NET_STATISTICS) || defined(CONFIG_NET_DEBUG_CORE)

subsys/net/ip/net_mgmt.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,9 @@ static inline void mgmt_run_callbacks(struct mgmt_event_entry *mgmt_event)
157157
}
158158

159159
#ifdef CONFIG_NET_DEBUG_MGMT_EVENT_STACK
160-
net_analyze_stack("Net MGMT event stack", mgmt_stack,
161-
CONFIG_NET_MGMT_EVENT_STACK_SIZE);
160+
net_analyze_stack("Net MGMT event stack",
161+
K_THREAD_STACK_BUFFER(mgmt_stack),
162+
K_THREAD_STACK_SIZEOF(mgmt_stack));
162163
#endif
163164
}
164165

subsys/net/ip/net_shell.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1431,8 +1431,8 @@ int net_shell_cmd_route(int argc, char *argv[])
14311431
}
14321432

14331433
#if defined(CONFIG_INIT_STACKS)
1434-
extern char _main_stack[];
1435-
extern char _interrupt_stack[];
1434+
extern K_THREAD_STACK_DEFINE(_main_stack, CONFIG_MAIN_STACK_SIZE);
1435+
extern K_THREAD_STACK_DEFINE(_interrupt_stack, CONFIG_ISR_STACK_SIZE);
14361436
#endif
14371437

14381438
int net_shell_cmd_stacks(int argc, char *argv[])
@@ -1446,8 +1446,8 @@ int net_shell_cmd_stacks(int argc, char *argv[])
14461446
ARG_UNUSED(argv);
14471447

14481448
for (info = __net_stack_start; info != __net_stack_end; info++) {
1449-
net_analyze_stack_get_values(info->stack, info->size,
1450-
&pcnt, &unused);
1449+
net_analyze_stack_get_values(K_THREAD_STACK_BUFFER(info->stack),
1450+
info->size, &pcnt, &unused);
14511451

14521452
#if defined(CONFIG_INIT_STACKS)
14531453
printk("%s [%s] stack size %zu/%zu bytes unused %u usage"
@@ -1462,15 +1462,17 @@ int net_shell_cmd_stacks(int argc, char *argv[])
14621462
}
14631463

14641464
#if defined(CONFIG_INIT_STACKS)
1465-
net_analyze_stack_get_values(_main_stack, CONFIG_MAIN_STACK_SIZE,
1465+
net_analyze_stack_get_values(K_THREAD_STACK_BUFFER(_main_stack),
1466+
K_THREAD_STACK_SIZEOF(_main_stack),
14661467
&pcnt, &unused);
14671468
printk("%s [%s] stack size %d/%d bytes unused %u usage"
14681469
" %d/%d (%u %%)\n",
14691470
"main", "_main_stack", CONFIG_MAIN_STACK_SIZE,
14701471
CONFIG_MAIN_STACK_SIZE, unused,
14711472
CONFIG_MAIN_STACK_SIZE - unused, CONFIG_MAIN_STACK_SIZE, pcnt);
14721473

1473-
net_analyze_stack_get_values(_interrupt_stack, CONFIG_ISR_STACK_SIZE,
1474+
net_analyze_stack_get_values(K_THREAD_STACK_BUFFER(_interrupt_stack),
1475+
K_THREAD_STACK_SIZEOF(_interrupt_stack),
14741476
&pcnt, &unused);
14751477
printk("%s [%s] stack size %d/%d bytes unused %u usage"
14761478
" %d/%d (%u %%)\n",

0 commit comments

Comments
 (0)