CSMA: Do not parse twice/Acknowledge MAC command frames, too
This commit is contained in:
parent
e4dcba32c9
commit
74780d5962
@ -60,11 +60,7 @@ static void
|
|||||||
input_packet(void)
|
input_packet(void)
|
||||||
{
|
{
|
||||||
#if CSMA_SEND_SOFT_ACK
|
#if CSMA_SEND_SOFT_ACK
|
||||||
int original_datalen;
|
uint8_t ackdata[CSMA_ACK_LEN];
|
||||||
uint8_t *original_dataptr;
|
|
||||||
|
|
||||||
original_datalen = packetbuf_datalen();
|
|
||||||
original_dataptr = packetbuf_dataptr();
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(packetbuf_datalen() == CSMA_ACK_LEN) {
|
if(packetbuf_datalen() == CSMA_ACK_LEN) {
|
||||||
@ -91,20 +87,11 @@ input_packet(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if CSMA_SEND_SOFT_ACK
|
#if CSMA_SEND_SOFT_ACK
|
||||||
{
|
if(packetbuf_attr(PACKETBUF_ATTR_MAC_ACK)) {
|
||||||
frame802154_t info154;
|
ackdata[0] = FRAME802154_ACKFRAME;
|
||||||
frame802154_parse(original_dataptr, original_datalen, &info154);
|
ackdata[1] = 0;
|
||||||
if(info154.fcf.frame_type == FRAME802154_DATAFRAME &&
|
ackdata[2] = ((uint8_t *)packetbuf_hdrptr())[2];
|
||||||
info154.fcf.ack_required != 0 &&
|
NETSTACK_RADIO.send(ackdata, CSMA_ACK_LEN);
|
||||||
linkaddr_cmp((linkaddr_t *)&info154.dest_addr,
|
|
||||||
&linkaddr_node_addr)) {
|
|
||||||
uint8_t ackdata[CSMA_ACK_LEN] = {0, 0, 0};
|
|
||||||
|
|
||||||
ackdata[0] = FRAME802154_ACKFRAME;
|
|
||||||
ackdata[1] = 0;
|
|
||||||
ackdata[2] = info154.seq;
|
|
||||||
NETSTACK_RADIO.send(ackdata, CSMA_ACK_LEN);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif /* CSMA_SEND_SOFT_ACK */
|
#endif /* CSMA_SEND_SOFT_ACK */
|
||||||
if(!duplicate) {
|
if(!duplicate) {
|
||||||
|
@ -240,6 +240,7 @@ parse(void)
|
|||||||
|
|
||||||
if(hdr_len && packetbuf_hdrreduce(hdr_len)) {
|
if(hdr_len && packetbuf_hdrreduce(hdr_len)) {
|
||||||
packetbuf_set_attr(PACKETBUF_ATTR_FRAME_TYPE, frame.fcf.frame_type);
|
packetbuf_set_attr(PACKETBUF_ATTR_FRAME_TYPE, frame.fcf.frame_type);
|
||||||
|
packetbuf_set_attr(PACKETBUF_ATTR_MAC_ACK, frame.fcf.ack_required);
|
||||||
|
|
||||||
if(frame.fcf.dest_addr_mode) {
|
if(frame.fcf.dest_addr_mode) {
|
||||||
if(frame.dest_pid != frame802154_get_pan_id() &&
|
if(frame.dest_pid != frame802154_get_pan_id() &&
|
||||||
|
@ -87,6 +87,7 @@ parse(void)
|
|||||||
}
|
}
|
||||||
packetbuf_set_addr(PACKETBUF_ADDR_SENDER, (linkaddr_t *)&frame.src_addr);
|
packetbuf_set_addr(PACKETBUF_ADDR_SENDER, (linkaddr_t *)&frame.src_addr);
|
||||||
packetbuf_set_attr(PACKETBUF_ATTR_MAC_SEQNO, frame.seq);
|
packetbuf_set_attr(PACKETBUF_ATTR_MAC_SEQNO, frame.seq);
|
||||||
|
packetbuf_set_attr(PACKETBUF_ATTR_MAC_ACK, frame.fcf.ack_required);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user