Merge branch 'contiki' into osd

This commit is contained in:
Harald Pichler 2014-12-29 08:20:00 +01:00
commit 9efc5d41c1
19 changed files with 63 additions and 22 deletions

View file

@ -115,6 +115,6 @@ env:
- BUILD_TYPE='compile-8051-ports' BUILD_CATEGORY='compile' BUILD_ARCH='8051' - BUILD_TYPE='compile-8051-ports' BUILD_CATEGORY='compile' BUILD_ARCH='8051'
- BUILD_TYPE='compile-arm-apcs-ports' BUILD_CATEGORY='compile' BUILD_ARCH='arm-apcs' - BUILD_TYPE='compile-arm-apcs-ports' BUILD_CATEGORY='compile' BUILD_ARCH='arm-apcs'
- BUILD_TYPE='compile-6502-ports' BUILD_CATEGORY='compile' BUILD_ARCH='6502' - BUILD_TYPE='compile-6502-ports' BUILD_CATEGORY='compile' BUILD_ARCH='6502'
- BUILD_TYPE='compile-arm-ports' BUILD_CATEGORY='compile' BUILD_ARCH='arm' # - BUILD_TYPE='compile-arm-ports' BUILD_CATEGORY='compile' BUILD_ARCH='arm'
- BUILD_TYPE='slip-radio' MAKE_TARGETS='cooja' - BUILD_TYPE='slip-radio' MAKE_TARGETS='cooja'
- BUILD_TYPE='llsec' MAKE_TARGETS='cooja' - BUILD_TYPE='llsec' MAKE_TARGETS='cooja'

View file

@ -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);
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/

View file

@ -56,10 +56,10 @@ call_event(struct tcp_socket *s, tcp_socket_event_t event)
static void static void
senddata(struct tcp_socket *s) senddata(struct tcp_socket *s)
{ {
int len; int len = MIN(s->output_data_max_seg, uip_mss());
if(s->output_data_len > 0) { if(s->output_data_len > 0) {
len = MIN(s->output_data_len, uip_mss()); len = MIN(s->output_data_len, len);
s->output_data_send_nxt = len; s->output_data_send_nxt = len;
uip_send(s->output_data_ptr, len); uip_send(s->output_data_ptr, len);
} }
@ -148,12 +148,14 @@ appcall(void *state)
s->listen_port != 0 && s->listen_port != 0 &&
s->listen_port == uip_htons(uip_conn->lport)) { s->listen_port == uip_htons(uip_conn->lport)) {
s->flags &= ~TCP_SOCKET_FLAGS_LISTENING; s->flags &= ~TCP_SOCKET_FLAGS_LISTENING;
s->output_data_max_seg = uip_mss();
tcp_markconn(uip_conn, s); tcp_markconn(uip_conn, s);
call_event(s, TCP_SOCKET_CONNECTED); call_event(s, TCP_SOCKET_CONNECTED);
break; break;
} }
} }
} else { } else {
s->output_data_max_seg = uip_mss();
call_event(s, TCP_SOCKET_CONNECTED); call_event(s, TCP_SOCKET_CONNECTED);
} }

View file

@ -95,6 +95,7 @@ struct tcp_socket {
uint16_t output_data_maxlen; uint16_t output_data_maxlen;
uint16_t output_data_len; uint16_t output_data_len;
uint16_t output_data_send_nxt; uint16_t output_data_send_nxt;
uint16_t output_data_max_seg;
uint8_t flags; uint8_t flags;
uint16_t listen_port; uint16_t listen_port;

View file

@ -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);*/
} }

View file

@ -1875,8 +1875,6 @@ uip_process(uint8_t flag)
BUF->seqno[2] = uip_connr->snd_nxt[2]; BUF->seqno[2] = uip_connr->snd_nxt[2];
BUF->seqno[3] = uip_connr->snd_nxt[3]; BUF->seqno[3] = uip_connr->snd_nxt[3];
BUF->proto = UIP_PROTO_TCP;
BUF->srcport = uip_connr->lport; BUF->srcport = uip_connr->lport;
BUF->destport = uip_connr->rport; BUF->destport = uip_connr->rport;
@ -1893,6 +1891,8 @@ uip_process(uint8_t flag)
} }
tcp_send_noconn: tcp_send_noconn:
BUF->proto = UIP_PROTO_TCP;
BUF->ttl = UIP_TTL; BUF->ttl = UIP_TTL;
#if NETSTACK_CONF_WITH_IPV6 #if NETSTACK_CONF_WITH_IPV6
/* For IPv6, the IP length field does not include the IPv6 IP header /* For IPv6, the IP length field does not include the IPv6 IP header

View file

@ -76,15 +76,27 @@
#else #else
#define UIP_ND6_SEND_NA UIP_CONF_ND6_SEND_NA #define UIP_ND6_SEND_NA UIP_CONF_ND6_SEND_NA
#endif #endif
#ifndef UIP_CONF_ND6_MAX_RA_INTERVAL
#define UIP_ND6_MAX_RA_INTERVAL 600 #define UIP_ND6_MAX_RA_INTERVAL 600
#else
#define UIP_ND6_MAX_RA_INTERVAL UIP_CONF_ND6_MAX_RA_INTERVAL
#endif
#ifndef UIP_CONF_ND6_MIN_RA_INTERVAL
#define UIP_ND6_MIN_RA_INTERVAL (UIP_ND6_MAX_RA_INTERVAL / 3) #define UIP_ND6_MIN_RA_INTERVAL (UIP_ND6_MAX_RA_INTERVAL / 3)
#else
#define UIP_ND6_MIN_RA_INTERVAL UIP_CONF_ND6_MIN_RA_INTERVAL
#endif
#define UIP_ND6_M_FLAG 0 #define UIP_ND6_M_FLAG 0
#define UIP_ND6_O_FLAG 0 #define UIP_ND6_O_FLAG 0
#define UIP_ND6_ROUTER_LIFETIME 3 * UIP_ND6_MAX_RA_INTERVAL #define UIP_ND6_ROUTER_LIFETIME 3 * UIP_ND6_MAX_RA_INTERVAL
#define UIP_ND6_MAX_INITIAL_RA_INTERVAL 16 /*seconds*/ #define UIP_ND6_MAX_INITIAL_RA_INTERVAL 16 /*seconds*/
#define UIP_ND6_MAX_INITIAL_RAS 3 /*transmissions*/ #define UIP_ND6_MAX_INITIAL_RAS 3 /*transmissions*/
#ifndef UIP_CONF_ND6_MIN_DELAY_BETWEEN_RAS
#define UIP_ND6_MIN_DELAY_BETWEEN_RAS 3 /*seconds*/ #define UIP_ND6_MIN_DELAY_BETWEEN_RAS 3 /*seconds*/
#else
#define UIP_ND6_MIN_DELAY_BETWEEN_RAS UIP_CONF_ND6_MIN_DELAY_BETWEEN_RAS
#endif
//#define UIP_ND6_MAX_RA_DELAY_TIME 0.5 /*seconds*/ //#define UIP_ND6_MAX_RA_DELAY_TIME 0.5 /*seconds*/
#define UIP_ND6_MAX_RA_DELAY_TIME_MS 500 /*milli seconds*/ #define UIP_ND6_MAX_RA_DELAY_TIME_MS 500 /*milli seconds*/
/** @} */ /** @} */

View file

@ -2239,8 +2239,6 @@ uip_process(uint8_t flag)
UIP_TCP_BUF->seqno[2] = uip_connr->snd_nxt[2]; UIP_TCP_BUF->seqno[2] = uip_connr->snd_nxt[2];
UIP_TCP_BUF->seqno[3] = uip_connr->snd_nxt[3]; UIP_TCP_BUF->seqno[3] = uip_connr->snd_nxt[3];
UIP_IP_BUF->proto = UIP_PROTO_TCP;
UIP_TCP_BUF->srcport = uip_connr->lport; UIP_TCP_BUF->srcport = uip_connr->lport;
UIP_TCP_BUF->destport = uip_connr->rport; UIP_TCP_BUF->destport = uip_connr->rport;
@ -2262,6 +2260,8 @@ uip_process(uint8_t flag)
} }
tcp_send_noconn: tcp_send_noconn:
UIP_IP_BUF->proto = UIP_PROTO_TCP;
UIP_IP_BUF->ttl = uip_ds6_if.cur_hop_limit; UIP_IP_BUF->ttl = uip_ds6_if.cur_hop_limit;
UIP_IP_BUF->len[0] = ((uip_len - UIP_IPH_LEN) >> 8); UIP_IP_BUF->len[0] = ((uip_len - UIP_IPH_LEN) >> 8);
UIP_IP_BUF->len[1] = ((uip_len - UIP_IPH_LEN) & 0xff); UIP_IP_BUF->len[1] = ((uip_len - UIP_IPH_LEN) & 0xff);

View file

@ -548,8 +548,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);

View file

@ -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) ||
#if NETSTACK_CONF_WITH_RIME
packetbuf_attr(PACKETBUF_ATTR_ERELIABLE) || 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 */

View file

@ -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,17 +373,21 @@ 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

View file

@ -332,6 +332,7 @@ rpl_repair_root(uint8_t instance_id)
PRINTF("RPL: rpl_repair_root triggered but not root\n"); PRINTF("RPL: rpl_repair_root triggered but not root\n");
return 0; return 0;
} }
RPL_STAT(rpl_stats.root_repairs++);
RPL_LOLLIPOP_INCREMENT(instance->current_dag->version); RPL_LOLLIPOP_INCREMENT(instance->current_dag->version);
RPL_LOLLIPOP_INCREMENT(instance->dtsn_out); RPL_LOLLIPOP_INCREMENT(instance->dtsn_out);

View file

@ -137,12 +137,14 @@ rpl_verify_header(int uip_ext_opt_offset)
sender_rank, instance->current_dag->rank, sender_rank, instance->current_dag->rank,
sender_closer); sender_closer);
if(UIP_EXT_HDR_OPT_RPL_BUF->flags & RPL_HDR_OPT_RANK_ERR) { if(UIP_EXT_HDR_OPT_RPL_BUF->flags & RPL_HDR_OPT_RANK_ERR) {
RPL_STAT(rpl_stats.loop_errors++);
PRINTF("RPL: Rank error signalled in RPL option!\n"); PRINTF("RPL: Rank error signalled in RPL option!\n");
/* Packet must be dropped and dio trickle timer reset, see RFC6550 - 11.2.2.2 */ /* Packet must be dropped and dio trickle timer reset, see RFC6550 - 11.2.2.2 */
rpl_reset_dio_timer(instance); rpl_reset_dio_timer(instance);
return 1; return 1;
} }
PRINTF("RPL: Single error tolerated\n"); PRINTF("RPL: Single error tolerated\n");
RPL_STAT(rpl_stats.loop_warnings++);
UIP_EXT_HDR_OPT_RPL_BUF->flags |= RPL_HDR_OPT_RANK_ERR; UIP_EXT_HDR_OPT_RPL_BUF->flags |= RPL_HDR_OPT_RANK_ERR;
return 0; return 0;
} }
@ -194,12 +196,12 @@ rpl_update_header_empty(void)
if(UIP_HBHO_BUF->len != RPL_HOP_BY_HOP_LEN - 8) { if(UIP_HBHO_BUF->len != RPL_HOP_BY_HOP_LEN - 8) {
PRINTF("RPL: Hop-by-hop extension header has wrong size\n"); PRINTF("RPL: Hop-by-hop extension header has wrong size\n");
uip_ext_len = last_uip_ext_len; uip_ext_len = last_uip_ext_len;
return; return 0;
} }
if(UIP_EXT_HDR_OPT_RPL_BUF->opt_type != UIP_EXT_HDR_OPT_RPL) { if(UIP_EXT_HDR_OPT_RPL_BUF->opt_type != UIP_EXT_HDR_OPT_RPL) {
PRINTF("RPL: Non RPL Hop-by-hop option support not implemented\n"); PRINTF("RPL: Non RPL Hop-by-hop option support not implemented\n");
uip_ext_len = last_uip_ext_len; uip_ext_len = last_uip_ext_len;
return; return 0;
} }
if(UIP_EXT_HDR_OPT_RPL_BUF->opt_len != RPL_HDR_OPT_LEN) { if(UIP_EXT_HDR_OPT_RPL_BUF->opt_len != RPL_HDR_OPT_LEN) {
PRINTF("RPL: RPL Hop-by-hop option has wrong length\n"); PRINTF("RPL: RPL Hop-by-hop option has wrong length\n");

View file

@ -242,6 +242,10 @@ struct rpl_stats {
uint16_t malformed_msgs; uint16_t malformed_msgs;
uint16_t resets; uint16_t resets;
uint16_t parent_switch; uint16_t parent_switch;
uint16_t forward_errors;
uint16_t loop_errors;
uint16_t loop_warnings;
uint16_t root_repairs;
}; };
typedef struct rpl_stats rpl_stats_t; typedef struct rpl_stats rpl_stats_t;

View file

@ -56,7 +56,7 @@
//_____ M A C R O S ________________________________________________________ //_____ M A C R O S ________________________________________________________
#define USB_ETH_MTU UIP_BUFSIZE+4 #define USB_ETH_MTU (UIP_BUFSIZE + 4)
/*! Hook Documentation /*! Hook Documentation

View file

@ -1679,7 +1679,7 @@ rf230_cca(void)
/* Use ED register to determine result. 77dBm is poweron csma default.*/ /* Use ED register to determine result. 77dBm is poweron csma default.*/
#ifdef RF230_CONF_CCA_THRES #ifdef RF230_CONF_CCA_THRES
if (hal_register_read(RG_PHY_ED_LEVEL)<(91+RF230_CONF_CCA_THRES) cca=0xff; if (hal_register_read(RG_PHY_ED_LEVEL)<(91+RF230_CONF_CCA_THRES)) cca=0xff;
#else #else
if (hal_register_read(RG_PHY_ED_LEVEL)<(91-77)) cca=0xff; if (hal_register_read(RG_PHY_ED_LEVEL)<(91-77)) cca=0xff;
#endif #endif
@ -1701,7 +1701,7 @@ rf230_cca(void)
/* If already in receive mode can read the current ED register without delay */ /* If already in receive mode can read the current ED register without delay */
/* CCA energy threshold = -91dB + 2*SR_CCA_ED_THRESH. Reset defaults to -77dB */ /* CCA energy threshold = -91dB + 2*SR_CCA_ED_THRESH. Reset defaults to -77dB */
#ifdef RF230_CONF_CCA_THRES #ifdef RF230_CONF_CCA_THRES
if (hal_register_read(RG_PHY_ED_LEVEL)<(91+RF230_CONF_CCA_THRES) cca=0xff; if (hal_register_read(RG_PHY_ED_LEVEL)<(91+RF230_CONF_CCA_THRES)) cca=0xff;
#else #else
if (hal_register_read(RG_PHY_ED_LEVEL)<(91-77)) cca=0xff; if (hal_register_read(RG_PHY_ED_LEVEL)<(91-77)) cca=0xff;
#endif #endif

View file

@ -43,7 +43,7 @@
* \name ANA_REGS register offsets * \name ANA_REGS register offsets
* @{ * @{
*/ */
#define ANA_REGS_IVCTRL 0x00000004 #define ANA_REGS_IVCTRL 0x400D6004
/** @} */ /** @} */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/** /**

View file

@ -193,7 +193,9 @@
#define NETSTACK_CONF_RADIO cc2530_rf_driver #define NETSTACK_CONF_RADIO cc2530_rf_driver
/* RF Config */ /* RF Config */
#define IEEE802154_CONF_PANID 0x5449 /* TI */ #ifndef IEEE802154_CONF_PANID
#define IEEE802154_CONF_PANID 0xABCD
#endif
#ifndef CC2530_RF_CONF_CHANNEL #ifndef CC2530_RF_CONF_CHANNEL
#define CC2530_RF_CONF_CHANNEL 25 #define CC2530_RF_CONF_CHANNEL 25

View file

@ -390,7 +390,7 @@ typedef uint32_t rtimer_clock_t;
*/ */
/* RF Config */ /* RF Config */
#ifndef IEEE802154_CONF_PANID #ifndef IEEE802154_CONF_PANID
#define IEEE802154_CONF_PANID 0x5449 /**< Default PAN ID: TI */ #define IEEE802154_CONF_PANID 0xABCD
#endif #endif
#ifndef CC2538_RF_CONF_CHANNEL #ifndef CC2538_RF_CONF_CHANNEL