Skip to content

Commit d20a7b5

Browse files
committed
fixup! fixup! gnrc/netapi/netnotify: ACK notify event directly
Gate with `IS_USED(MODULE_GNRC_NETAPI_NOTIFY)`.
1 parent e263d97 commit d20a7b5

3 files changed

Lines changed: 22 additions & 18 deletions

File tree

pkg/nimble/netif/nimble_netif.c

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,6 @@ static void _on_data(nimble_netif_conn_t *conn, struct ble_l2cap_event *event)
332332
ble_l2cap_recv_ready(event->receive.chan, rxb);
333333
}
334334

335-
#ifdef MODULE_GNRC_IPV6
336335
/**
337336
* @brief Sends a netapi notification for a connection event.
338337
*
@@ -351,7 +350,6 @@ static inline void _dispatch_connection_event(netapi_notify_t notify, uint8_t *a
351350
gnrc_netapi_notify(GNRC_NETTYPE_L2_DISCOVERY, GNRC_NETREG_DEMUX_CTX_ALL,
352351
notify, &event, sizeof(netapi_notify_l2_connection_t));
353352
}
354-
#endif /* MODULE_GNRC_IPV6 */
355353

356354
static int _on_l2cap_client_evt(struct ble_l2cap_event *event, void *arg)
357355
{
@@ -371,9 +369,9 @@ static int _on_l2cap_client_evt(struct ble_l2cap_event *event, void *arg)
371369
conn->state |= NIMBLE_NETIF_L2CAP_CLIENT;
372370
conn->state &= ~NIMBLE_NETIF_CONNECTING;
373371
_notify(handle, NIMBLE_NETIF_CONNECTED_MASTER, conn->addr);
374-
#ifdef MODULE_GNRC_IPV6
372+
#if IS_USED(MODULE_GNRC_NETAPI_NOTIFY)
375373
_dispatch_connection_event(NETAPI_NOTIFY_L2_NEIGH_CONNECTED, conn->addr);
376-
#endif /* MODULE_GNRC_IPV6 */
374+
#endif /* MODULE_GNRC_NETAPI_NOTIFY */
377375
break;
378376
case BLE_L2CAP_EVENT_COC_DISCONNECTED:
379377
assert(conn->state & NIMBLE_NETIF_L2CAP_CLIENT);
@@ -429,9 +427,9 @@ static int _on_l2cap_server_evt(struct ble_l2cap_event *event, void *arg)
429427
}
430428

431429
_notify(handle, NIMBLE_NETIF_CONNECTED_SLAVE, conn->addr);
432-
#ifdef MODULE_GNRC_IPV6
430+
#if IS_USED(MODULE_GNRC_NETAPI_NOTIFY)
433431
_dispatch_connection_event(NETAPI_NOTIFY_L2_NEIGH_CONNECTED, conn->addr);
434-
#endif /* MODULE_GNRC_IPV6 */
432+
#endif /* MODULE_GNRC_NETAPI_NOTIFY */
435433
break;
436434
case BLE_L2CAP_EVENT_COC_DISCONNECTED:
437435
conn = nimble_netif_conn_from_gaphandle(event->disconnect.conn_handle);
@@ -526,9 +524,9 @@ static int _on_gap_master_evt(struct ble_gap_event *event, void *arg)
526524
nimble_netif_conn_free(handle, addr);
527525
thread_flags_set(_netif_thread, FLAG_TX_NOTCONN);
528526
_notify(handle, type, addr);
529-
#ifdef MODULE_GNRC_IPV6
527+
#if IS_USED(MODULE_GNRC_NETAPI_NOTIFY)
530528
_dispatch_connection_event(NETAPI_NOTIFY_L2_NEIGH_DISCONNECTED, addr);
531-
#endif /* MODULE_GNRC_IPV6 */
529+
#endif /* MODULE_GNRC_NETAPI_NOTIFY */
532530
break;
533531
}
534532
case BLE_GAP_EVENT_CONN_UPDATE:
@@ -573,9 +571,9 @@ static int _on_gap_slave_evt(struct ble_gap_event *event, void *arg)
573571
nimble_netif_conn_free(handle, addr);
574572
thread_flags_set(_netif_thread, FLAG_TX_NOTCONN);
575573
_notify(handle, type, addr);
576-
#ifdef MODULE_GNRC_IPV6
574+
#if IS_USED(MODULE_GNRC_NETAPI_NOTIFY)
577575
_dispatch_connection_event(NETAPI_NOTIFY_L2_NEIGH_DISCONNECTED, addr);
578-
#endif /* MODULE_GNRC_IPV6 */
576+
#endif /* MODULE_GNRC_NETAPI_NOTIFY */
579577
break;
580578
}
581579
case BLE_GAP_EVENT_CONN_UPDATE:

sys/net/gnrc/network_layer/ipv6/gnrc_ipv6.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,6 @@ static void _dispatch_next_header(gnrc_pktsnip_t *pkt, unsigned nh,
172172
}
173173
}
174174

175-
#ifdef MODULE_NIMBLE_NETIF
176175
/**
177176
* @brief Find entry in NIB neighbor cache.
178177
*
@@ -271,7 +270,6 @@ static inline void _netapi_notify_event(gnrc_netapi_notify_t *notify)
271270
break;
272271
}
273272
}
274-
#endif /* MODULE_NIMBLE_NETIF */
275273

276274
static void *_event_loop(void *args)
277275
{
@@ -280,11 +278,11 @@ static void *_event_loop(void *args)
280278
/* Register entry for messages in IPv6 context. */
281279
gnrc_netreg_entry_t me_ipv6_reg = GNRC_NETREG_ENTRY_INIT_PID(GNRC_NETREG_DEMUX_CTX_ALL,
282280
thread_getpid());
283-
#ifdef MODULE_NIMBLE_NETIF
281+
#if IS_USED(MODULE_GNRC_NETAPI_NOTIFY)
284282
/* Register entry for messages in L2 discovery context. */
285283
gnrc_netreg_entry_t me_discovery_reg = GNRC_NETREG_ENTRY_INIT_PID(GNRC_NETREG_DEMUX_CTX_ALL,
286284
thread_getpid());
287-
#endif /* MODULE_NIMBLE_NETIF */
285+
#endif /* MODULE_GNRC_NETAPI_NOTIFY */
288286

289287
(void)args;
290288
msg_init_queue(_msg_q, GNRC_IPV6_MSG_QUEUE_SIZE);
@@ -297,10 +295,10 @@ static void *_event_loop(void *args)
297295
/* Register interest in all IPv6 packets. */
298296
gnrc_netreg_register(GNRC_NETTYPE_IPV6, &me_ipv6_reg);
299297

300-
#ifdef MODULE_NIMBLE_NETIF
298+
#if IS_USED(MODULE_GNRC_NETAPI_NOTIFY)
301299
/* Register interest in L2 neighbor discovery info. */
302300
gnrc_netreg_register(GNRC_NETTYPE_L2_DISCOVERY, &me_discovery_reg);
303-
#endif /* MODULE_NIMBLE_NETIF */
301+
#endif /* MODULE_GNRC_NETAPI_NOTIFY */
304302

305303
/* preinitialize ACK */
306304
reply.type = GNRC_NETAPI_MSG_TYPE_ACK;
@@ -327,12 +325,12 @@ static void *_event_loop(void *args)
327325
reply.content.value = -ENOTSUP;
328326
msg_reply(&msg, &reply);
329327
break;
330-
#ifdef MODULE_NIMBLE_NETIF
328+
#if IS_USED(MODULE_GNRC_NETAPI_NOTIFY)
331329
case GNRC_NETAPI_MSG_TYPE_NOTIFY:
332330
DEBUG("ipv6: GNRC_NETAPI_MSG_TYPE_NOTIFY received\n");
333331
_netapi_notify_event(msg.content.ptr);
334332
break;
335-
#endif /* MODULE_NIMBLE_NETIF */
333+
#endif /* MODULE_GNRC_NETAPI_NOTIFY */
336334

337335
#ifdef MODULE_GNRC_IPV6_EXT_FRAG
338336
case GNRC_IPV6_EXT_FRAG_RBUF_GC:

sys/net/gnrc/routing/rpl/gnrc_rpl.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,12 @@ static xtimer_t _lt_timer;
5959
static msg_t _lt_msg = { .type = GNRC_RPL_MSG_TYPE_LIFETIME_UPDATE };
6060
#endif
6161
static msg_t _msg_q[GNRC_RPL_MSG_QUEUE_SIZE];
62+
6263
static gnrc_netreg_entry_t _me_icmpv6_reg;
64+
#if IS_USED(MODULE_GNRC_NETAPI_NOTIFY)
6365
static gnrc_netreg_entry_t _me_routing_reg;
66+
#endif /* MODULE_GNRC_NETAPI_NOTIFY*/
67+
6468
static mutex_t _inst_id_mutex = MUTEX_INIT;
6569
static uint8_t _instance_id;
6670

@@ -107,10 +111,12 @@ kernel_pid_t gnrc_rpl_init(kernel_pid_t if_pid)
107111
_me_icmpv6_reg.target.pid = gnrc_rpl_pid;
108112
gnrc_netreg_register(GNRC_NETTYPE_ICMPV6, &_me_icmpv6_reg);
109113

114+
#if IS_USED(MODULE_GNRC_NETAPI_NOTIFY)
110115
/* Register interest in L3 routing info. */
111116
_me_routing_reg.demux_ctx = GNRC_NETREG_DEMUX_CTX_ALL;
112117
_me_routing_reg.target.pid = gnrc_rpl_pid;
113118
gnrc_netreg_register(GNRC_NETTYPE_L3_ROUTING, &_me_routing_reg);
119+
#endif /* MODULE_GNRC_NETAPI_NOTIFY*/
114120

115121
gnrc_rpl_of_manager_init();
116122
evtimer_init_msg(&gnrc_rpl_evtimer);
@@ -407,10 +413,12 @@ static void *_event_loop(void *args)
407413
reply.content.value = -ENOTSUP;
408414
msg_reply(&msg, &reply);
409415
break;
416+
#if IS_USED(MODULE_GNRC_NETAPI_NOTIFY)
410417
case GNRC_NETAPI_MSG_TYPE_NOTIFY:
411418
DEBUG("RPL: GNRC_NETAPI_MSG_TYPE_NOTIFY received\n");
412419
_netapi_notify_event(msg.content.ptr);
413420
break;
421+
#endif /* MODULE_GNRC_NETAPI_NOTIFY */
414422
default:
415423
break;
416424
}

0 commit comments

Comments
 (0)