Cleanup packetbuf: use rime attributes and addresses only when rime is enabled. Saves 32 byte per queuebuf in the non-rime case.

This commit is contained in:
Simon Duquennoy 2014-12-01 15:17:00 +01:00
parent 415506c3f6
commit bd4233a953
5 changed files with 23 additions and 6 deletions

View File

@ -283,7 +283,7 @@ output_sniffer(int mac_status)
add_packet_stats(OUTPUT);
}
/*---------------------------------------------------------------------------*/
#if ! NETSTACK_CONF_WITH_IPV6
#if NETSTACK_CONF_WITH_RIME
static void
sniffprint(char *prefix, int seqno)
{
@ -347,7 +347,7 @@ powertrace_printsniff(powertrace_onoff_t onoff)
break;
}
}
#endif
#endif /* NETSTACK_CONF_WITH_RIME */
/*---------------------------------------------------------------------------*/
RIME_SNIFFER(powersniff, input_sniffer, output_sniffer);
/*---------------------------------------------------------------------------*/

View File

@ -260,7 +260,9 @@ uip_over_mesh_send(void)
an underlying power-saving MAC layer knows that it should be
waiting for an ACK. */
if(BUF->proto == UIP_PROTO_TCP) {
#if NETSTACK_CONF_WITH_RIME
packetbuf_set_attr(PACKETBUF_ATTR_ERELIABLE, 1);
#endif /* NETSTACK_CONF_WITH_RIME */
packetbuf_set_attr(PACKETBUF_ATTR_RELIABLE, 1);
/* packetbuf_set_attr(PACKETBUF_ATTR_PACKET_TYPE, PACKETBUF_ATTR_PACKET_TYPE_STREAM);*/
}

View File

@ -546,8 +546,11 @@ send_packet(mac_callback_t mac_callback, void *mac_callback_ptr,
packetbuf_addr(PACKETBUF_ADDR_RECEIVER)->u8[1]);
#endif /* NETSTACK_CONF_WITH_IPV6 */
}
is_reliable = packetbuf_attr(PACKETBUF_ATTR_RELIABLE) ||
packetbuf_attr(PACKETBUF_ATTR_ERELIABLE);
is_reliable = packetbuf_attr(PACKETBUF_ATTR_RELIABLE)
#if NETSTACK_CONF_WITH_RIME
|| packetbuf_attr(PACKETBUF_ATTR_ERELIABLE)
#endif /* NETSTACK_CONF_WITH_RIME */
;
if(!packetbuf_attr(PACKETBUF_ATTR_IS_CREATED_AND_SECURED)) {
packetbuf_set_attr(PACKETBUF_ATTR_MAC_ACK, 1);

View File

@ -625,7 +625,9 @@ send_packet(void)
that will need an upper layer ACK (as signified by the
PACKETBUF_ATTR_RELIABLE packet attribute), we keep the radio on. */
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_PACKET_TYPE_STREAM)) {
on(); /* Wait for ACK packet */

View File

@ -354,9 +354,11 @@ enum {
PACKETBUF_ATTR_RELIABLE,
PACKETBUF_ATTR_PACKET_ID,
PACKETBUF_ATTR_PACKET_TYPE,
#if NETSTACK_CONF_WITH_RIME
PACKETBUF_ATTR_REXMIT,
PACKETBUF_ATTR_MAX_REXMIT,
PACKETBUF_ATTR_NUM_REXMIT,
#endif /* NETSTACK_CONF_WITH_RIME */
PACKETBUF_ATTR_PENDING,
PACKETBUF_ATTR_FRAME_TYPE,
#if LLSEC802154_SECURITY_LEVEL
@ -371,18 +373,22 @@ enum {
#endif /* LLSEC802154_SECURITY_LEVEL */
/* Scope 2 attributes: used between end-to-end nodes. */
#if NETSTACK_CONF_WITH_RIME
PACKETBUF_ATTR_HOPS,
PACKETBUF_ATTR_TTL,
PACKETBUF_ATTR_EPACKET_ID,
PACKETBUF_ATTR_EPACKET_TYPE,
PACKETBUF_ATTR_ERELIABLE,
#endif /* NETSTACK_CONF_WITH_RIME */
/* These must be last */
PACKETBUF_ADDR_SENDER,
PACKETBUF_ADDR_RECEIVER,
#if NETSTACK_CONF_WITH_RIME
PACKETBUF_ADDR_ESENDER,
PACKETBUF_ADDR_ERECEIVER,
#endif /* NETSTACK_CONF_WITH_RIME */
PACKETBUF_ATTR_MAX
};
@ -404,7 +410,11 @@ enum {
};
#endif /* LLSEC802154_USES_EXPLICIT_KEYS */
#if NETSTACK_CONF_WITH_RIME
#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_ADDR_FIRST PACKETBUF_ADDR_SENDER