net: mgmt: Refactor because of timeout overhaul
Convert to use k_timeout_t Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit is contained in:
parent
08d532489c
commit
38dd9bc299
4 changed files with 11 additions and 13 deletions
|
@ -244,8 +244,7 @@ static inline void net_mgmt_event_notify(u32_t mgmt_event, struct net_if *iface)
|
||||||
* event might bring along. NULL otherwise.
|
* event might bring along. NULL otherwise.
|
||||||
* @param info_length tells how long the info memory area is. Only valid if
|
* @param info_length tells how long the info memory area is. Only valid if
|
||||||
* the info is not NULL.
|
* the info is not NULL.
|
||||||
* @param timeout a delay in milliseconds. K_FOREVER can be used to wait
|
* @param timeout A timeout delay. K_FOREVER can be used to wait indefinitely.
|
||||||
* indefinitely.
|
|
||||||
*
|
*
|
||||||
* @return 0 on success, a negative error code otherwise. -ETIMEDOUT will
|
* @return 0 on success, a negative error code otherwise. -ETIMEDOUT will
|
||||||
* be specifically returned if the timeout kick-in instead of an
|
* be specifically returned if the timeout kick-in instead of an
|
||||||
|
@ -257,14 +256,14 @@ int net_mgmt_event_wait(u32_t mgmt_event_mask,
|
||||||
struct net_if **iface,
|
struct net_if **iface,
|
||||||
const void **info,
|
const void **info,
|
||||||
size_t *info_length,
|
size_t *info_length,
|
||||||
int timeout);
|
k_timeout_t timeout);
|
||||||
#else
|
#else
|
||||||
static inline int net_mgmt_event_wait(u32_t mgmt_event_mask,
|
static inline int net_mgmt_event_wait(u32_t mgmt_event_mask,
|
||||||
u32_t *raised_event,
|
u32_t *raised_event,
|
||||||
struct net_if **iface,
|
struct net_if **iface,
|
||||||
const void **info,
|
const void **info,
|
||||||
size_t *info_length,
|
size_t *info_length,
|
||||||
int timeout)
|
k_timeout_t timeout)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -283,8 +282,7 @@ static inline int net_mgmt_event_wait(u32_t mgmt_event_mask,
|
||||||
* event might bring along. NULL otherwise.
|
* event might bring along. NULL otherwise.
|
||||||
* @param info_length tells how long the info memory area is. Only valid if
|
* @param info_length tells how long the info memory area is. Only valid if
|
||||||
* the info is not NULL.
|
* the info is not NULL.
|
||||||
* @param timeout a delay in milliseconds. K_FOREVER can be used to wait
|
* @param timeout A timeout delay. K_FOREVER can be used to wait indefinitely.
|
||||||
* indefinitely.
|
|
||||||
*
|
*
|
||||||
* @return 0 on success, a negative error code otherwise. -ETIMEDOUT will
|
* @return 0 on success, a negative error code otherwise. -ETIMEDOUT will
|
||||||
* be specifically returned if the timeout kick-in instead of an
|
* be specifically returned if the timeout kick-in instead of an
|
||||||
|
@ -296,14 +294,14 @@ int net_mgmt_event_wait_on_iface(struct net_if *iface,
|
||||||
u32_t *raised_event,
|
u32_t *raised_event,
|
||||||
const void **info,
|
const void **info,
|
||||||
size_t *info_length,
|
size_t *info_length,
|
||||||
int timeout);
|
k_timeout_t timeout);
|
||||||
#else
|
#else
|
||||||
static inline int net_mgmt_event_wait_on_iface(struct net_if *iface,
|
static inline int net_mgmt_event_wait_on_iface(struct net_if *iface,
|
||||||
u32_t mgmt_event_mask,
|
u32_t mgmt_event_mask,
|
||||||
u32_t *raised_event,
|
u32_t *raised_event,
|
||||||
const void **info,
|
const void **info,
|
||||||
size_t *info_length,
|
size_t *info_length,
|
||||||
int timeout)
|
k_timeout_t timeout)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -261,7 +261,7 @@ static int mgmt_event_wait_call(struct net_if *iface,
|
||||||
struct net_if **event_iface,
|
struct net_if **event_iface,
|
||||||
const void **info,
|
const void **info,
|
||||||
size_t *info_length,
|
size_t *info_length,
|
||||||
int timeout)
|
k_timeout_t timeout)
|
||||||
{
|
{
|
||||||
struct mgmt_event_wait sync_data = {
|
struct mgmt_event_wait sync_data = {
|
||||||
.sync_call = Z_SEM_INITIALIZER(sync_data.sync_call, 0, 1),
|
.sync_call = Z_SEM_INITIALIZER(sync_data.sync_call, 0, 1),
|
||||||
|
@ -353,7 +353,7 @@ int net_mgmt_event_wait(u32_t mgmt_event_mask,
|
||||||
struct net_if **iface,
|
struct net_if **iface,
|
||||||
const void **info,
|
const void **info,
|
||||||
size_t *info_length,
|
size_t *info_length,
|
||||||
int timeout)
|
k_timeout_t timeout)
|
||||||
{
|
{
|
||||||
return mgmt_event_wait_call(NULL, mgmt_event_mask,
|
return mgmt_event_wait_call(NULL, mgmt_event_mask,
|
||||||
raised_event, iface, info, info_length,
|
raised_event, iface, info, info_length,
|
||||||
|
@ -365,7 +365,7 @@ int net_mgmt_event_wait_on_iface(struct net_if *iface,
|
||||||
u32_t *raised_event,
|
u32_t *raised_event,
|
||||||
const void **info,
|
const void **info,
|
||||||
size_t *info_length,
|
size_t *info_length,
|
||||||
int timeout)
|
k_timeout_t timeout)
|
||||||
{
|
{
|
||||||
NET_ASSERT(NET_MGMT_ON_IFACE(mgmt_event_mask));
|
NET_ASSERT(NET_MGMT_ON_IFACE(mgmt_event_mask));
|
||||||
NET_ASSERT(iface);
|
NET_ASSERT(iface);
|
||||||
|
|
|
@ -29,7 +29,7 @@ LOG_MODULE_REGISTER(net_test, CONFIG_NET_MGMT_EVENT_LOG_LEVEL);
|
||||||
/* Notifier infra */
|
/* Notifier infra */
|
||||||
static u32_t event2throw;
|
static u32_t event2throw;
|
||||||
static u32_t throw_times;
|
static u32_t throw_times;
|
||||||
static int throw_sleep;
|
static k_timeout_t throw_sleep;
|
||||||
static bool with_info;
|
static bool with_info;
|
||||||
static K_THREAD_STACK_DEFINE(thrower_stack, 512 + CONFIG_TEST_EXTRA_STACKSIZE);
|
static K_THREAD_STACK_DEFINE(thrower_stack, 512 + CONFIG_TEST_EXTRA_STACKSIZE);
|
||||||
static struct k_thread thrower_thread_data;
|
static struct k_thread thrower_thread_data;
|
||||||
|
|
|
@ -327,7 +327,7 @@ static void trigger_events(void)
|
||||||
|
|
||||||
K_THREAD_DEFINE(trigger_events_thread_id, STACK_SIZE,
|
K_THREAD_DEFINE(trigger_events_thread_id, STACK_SIZE,
|
||||||
trigger_events, NULL, NULL, NULL,
|
trigger_events, NULL, NULL, NULL,
|
||||||
THREAD_PRIORITY, 0, K_FOREVER);
|
THREAD_PRIORITY, 0, -1);
|
||||||
|
|
||||||
static char *get_ip_addr(char *ipaddr, size_t len, sa_family_t family,
|
static char *get_ip_addr(char *ipaddr, size_t len, sa_family_t family,
|
||||||
struct net_mgmt_msghdr *hdr)
|
struct net_mgmt_msghdr *hdr)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue