Merge pull request #890 from simonduq/cleanup-packetbuf
Cleanup packetbuf: use rime attributes and addresses only when rime is e...
This commit is contained in:
commit
ce914b3173
|
@ -283,7 +283,7 @@ output_sniffer(int mac_status)
|
||||||
add_packet_stats(OUTPUT);
|
add_packet_stats(OUTPUT);
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
#if ! NETSTACK_CONF_WITH_IPV6
|
#if NETSTACK_CONF_WITH_RIME
|
||||||
static void
|
static void
|
||||||
sniffprint(char *prefix, int seqno)
|
sniffprint(char *prefix, int seqno)
|
||||||
{
|
{
|
||||||
|
@ -347,7 +347,7 @@ powertrace_printsniff(powertrace_onoff_t onoff)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* NETSTACK_CONF_WITH_RIME */
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
RIME_SNIFFER(powersniff, input_sniffer, output_sniffer);
|
RIME_SNIFFER(powersniff, input_sniffer, output_sniffer);
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
|
@ -260,7 +260,9 @@ uip_over_mesh_send(void)
|
||||||
an underlying power-saving MAC layer knows that it should be
|
an underlying power-saving MAC layer knows that it should be
|
||||||
waiting for an ACK. */
|
waiting for an ACK. */
|
||||||
if(BUF->proto == UIP_PROTO_TCP) {
|
if(BUF->proto == UIP_PROTO_TCP) {
|
||||||
|
#if NETSTACK_CONF_WITH_RIME
|
||||||
packetbuf_set_attr(PACKETBUF_ATTR_ERELIABLE, 1);
|
packetbuf_set_attr(PACKETBUF_ATTR_ERELIABLE, 1);
|
||||||
|
#endif /* NETSTACK_CONF_WITH_RIME */
|
||||||
packetbuf_set_attr(PACKETBUF_ATTR_RELIABLE, 1);
|
packetbuf_set_attr(PACKETBUF_ATTR_RELIABLE, 1);
|
||||||
/* packetbuf_set_attr(PACKETBUF_ATTR_PACKET_TYPE, PACKETBUF_ATTR_PACKET_TYPE_STREAM);*/
|
/* packetbuf_set_attr(PACKETBUF_ATTR_PACKET_TYPE, PACKETBUF_ATTR_PACKET_TYPE_STREAM);*/
|
||||||
}
|
}
|
||||||
|
|
|
@ -546,8 +546,11 @@ send_packet(mac_callback_t mac_callback, void *mac_callback_ptr,
|
||||||
packetbuf_addr(PACKETBUF_ADDR_RECEIVER)->u8[1]);
|
packetbuf_addr(PACKETBUF_ADDR_RECEIVER)->u8[1]);
|
||||||
#endif /* NETSTACK_CONF_WITH_IPV6 */
|
#endif /* NETSTACK_CONF_WITH_IPV6 */
|
||||||
}
|
}
|
||||||
is_reliable = packetbuf_attr(PACKETBUF_ATTR_RELIABLE) ||
|
is_reliable = packetbuf_attr(PACKETBUF_ATTR_RELIABLE)
|
||||||
packetbuf_attr(PACKETBUF_ATTR_ERELIABLE);
|
#if NETSTACK_CONF_WITH_RIME
|
||||||
|
|| packetbuf_attr(PACKETBUF_ATTR_ERELIABLE)
|
||||||
|
#endif /* NETSTACK_CONF_WITH_RIME */
|
||||||
|
;
|
||||||
|
|
||||||
if(!packetbuf_attr(PACKETBUF_ATTR_IS_CREATED_AND_SECURED)) {
|
if(!packetbuf_attr(PACKETBUF_ATTR_IS_CREATED_AND_SECURED)) {
|
||||||
packetbuf_set_attr(PACKETBUF_ATTR_MAC_ACK, 1);
|
packetbuf_set_attr(PACKETBUF_ATTR_MAC_ACK, 1);
|
||||||
|
|
|
@ -625,7 +625,9 @@ send_packet(void)
|
||||||
that will need an upper layer ACK (as signified by the
|
that will need an upper layer ACK (as signified by the
|
||||||
PACKETBUF_ATTR_RELIABLE packet attribute), we keep the radio on. */
|
PACKETBUF_ATTR_RELIABLE packet attribute), we keep the radio on. */
|
||||||
if(got_strobe_ack && (packetbuf_attr(PACKETBUF_ATTR_RELIABLE) ||
|
if(got_strobe_ack && (packetbuf_attr(PACKETBUF_ATTR_RELIABLE) ||
|
||||||
packetbuf_attr(PACKETBUF_ATTR_ERELIABLE) ||
|
#if NETSTACK_CONF_WITH_RIME
|
||||||
|
packetbuf_attr(PACKETBUF_ATTR_ERELIABLE) ||
|
||||||
|
#endif /* NETSTACK_CONF_WITH_RIME */
|
||||||
packetbuf_attr(PACKETBUF_ATTR_PACKET_TYPE) ==
|
packetbuf_attr(PACKETBUF_ATTR_PACKET_TYPE) ==
|
||||||
PACKETBUF_ATTR_PACKET_TYPE_STREAM)) {
|
PACKETBUF_ATTR_PACKET_TYPE_STREAM)) {
|
||||||
on(); /* Wait for ACK packet */
|
on(); /* Wait for ACK packet */
|
||||||
|
|
|
@ -354,9 +354,11 @@ enum {
|
||||||
PACKETBUF_ATTR_RELIABLE,
|
PACKETBUF_ATTR_RELIABLE,
|
||||||
PACKETBUF_ATTR_PACKET_ID,
|
PACKETBUF_ATTR_PACKET_ID,
|
||||||
PACKETBUF_ATTR_PACKET_TYPE,
|
PACKETBUF_ATTR_PACKET_TYPE,
|
||||||
|
#if NETSTACK_CONF_WITH_RIME
|
||||||
PACKETBUF_ATTR_REXMIT,
|
PACKETBUF_ATTR_REXMIT,
|
||||||
PACKETBUF_ATTR_MAX_REXMIT,
|
PACKETBUF_ATTR_MAX_REXMIT,
|
||||||
PACKETBUF_ATTR_NUM_REXMIT,
|
PACKETBUF_ATTR_NUM_REXMIT,
|
||||||
|
#endif /* NETSTACK_CONF_WITH_RIME */
|
||||||
PACKETBUF_ATTR_PENDING,
|
PACKETBUF_ATTR_PENDING,
|
||||||
PACKETBUF_ATTR_FRAME_TYPE,
|
PACKETBUF_ATTR_FRAME_TYPE,
|
||||||
#if LLSEC802154_SECURITY_LEVEL
|
#if LLSEC802154_SECURITY_LEVEL
|
||||||
|
@ -371,18 +373,22 @@ enum {
|
||||||
#endif /* LLSEC802154_SECURITY_LEVEL */
|
#endif /* LLSEC802154_SECURITY_LEVEL */
|
||||||
|
|
||||||
/* Scope 2 attributes: used between end-to-end nodes. */
|
/* Scope 2 attributes: used between end-to-end nodes. */
|
||||||
|
#if NETSTACK_CONF_WITH_RIME
|
||||||
PACKETBUF_ATTR_HOPS,
|
PACKETBUF_ATTR_HOPS,
|
||||||
PACKETBUF_ATTR_TTL,
|
PACKETBUF_ATTR_TTL,
|
||||||
PACKETBUF_ATTR_EPACKET_ID,
|
PACKETBUF_ATTR_EPACKET_ID,
|
||||||
PACKETBUF_ATTR_EPACKET_TYPE,
|
PACKETBUF_ATTR_EPACKET_TYPE,
|
||||||
PACKETBUF_ATTR_ERELIABLE,
|
PACKETBUF_ATTR_ERELIABLE,
|
||||||
|
#endif /* NETSTACK_CONF_WITH_RIME */
|
||||||
|
|
||||||
/* These must be last */
|
/* These must be last */
|
||||||
PACKETBUF_ADDR_SENDER,
|
PACKETBUF_ADDR_SENDER,
|
||||||
PACKETBUF_ADDR_RECEIVER,
|
PACKETBUF_ADDR_RECEIVER,
|
||||||
|
#if NETSTACK_CONF_WITH_RIME
|
||||||
PACKETBUF_ADDR_ESENDER,
|
PACKETBUF_ADDR_ESENDER,
|
||||||
PACKETBUF_ADDR_ERECEIVER,
|
PACKETBUF_ADDR_ERECEIVER,
|
||||||
|
#endif /* NETSTACK_CONF_WITH_RIME */
|
||||||
|
|
||||||
PACKETBUF_ATTR_MAX
|
PACKETBUF_ATTR_MAX
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -404,7 +410,11 @@ enum {
|
||||||
};
|
};
|
||||||
#endif /* LLSEC802154_USES_EXPLICIT_KEYS */
|
#endif /* LLSEC802154_USES_EXPLICIT_KEYS */
|
||||||
|
|
||||||
|
#if NETSTACK_CONF_WITH_RIME
|
||||||
#define PACKETBUF_NUM_ADDRS 4
|
#define PACKETBUF_NUM_ADDRS 4
|
||||||
|
#else /* NETSTACK_CONF_WITH_RIME */
|
||||||
|
#define PACKETBUF_NUM_ADDRS 2
|
||||||
|
#endif /* NETSTACK_CONF_WITH_RIME */
|
||||||
#define PACKETBUF_NUM_ATTRS (PACKETBUF_ATTR_MAX - PACKETBUF_NUM_ADDRS)
|
#define PACKETBUF_NUM_ATTRS (PACKETBUF_ATTR_MAX - PACKETBUF_NUM_ADDRS)
|
||||||
#define PACKETBUF_ADDR_FIRST PACKETBUF_ADDR_SENDER
|
#define PACKETBUF_ADDR_FIRST PACKETBUF_ADDR_SENDER
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue