Skip to content

Conversation

miri64
Copy link
Member

@miri64 miri64 commented Jul 25, 2017

IEEE 802.15.4 support for gnrc_netif2.

Requires #7370.

This PR is part of the network layer remodelling effort:
PR dependencies

@miri64 miri64 added GNRC Area: network Area: Networking State: waiting for other PR State: The PR requires another PR to be merged first labels Jul 25, 2017
@miri64 miri64 requested a review from aabadie July 25, 2017 19:11
miri64 added a commit to miri64/RIOT that referenced this pull request Jul 27, 2017
@miri64 miri64 force-pushed the gnrc_netif2/feat/ieee802154 branch from 763d0b5 to 3f26117 Compare July 30, 2017 18:43
miri64 added a commit to miri64/RIOT that referenced this pull request Jul 31, 2017
@miri64 miri64 force-pushed the gnrc_netif2/feat/ieee802154 branch from 3f26117 to eab9e4d Compare August 1, 2017 14:13
miri64 added a commit to miri64/RIOT that referenced this pull request Aug 1, 2017
@miri64 miri64 force-pushed the gnrc_netif2/feat/ieee802154 branch from eab9e4d to c73b6d7 Compare August 21, 2017 10:50
miri64 added a commit to miri64/RIOT that referenced this pull request Aug 21, 2017
@miri64
Copy link
Member Author

miri64 commented Aug 21, 2017

Rebased to current master and current dependencies

@miri64 miri64 force-pushed the gnrc_netif2/feat/ieee802154 branch 2 times, most recently from 91c1c27 to fbadffe Compare August 21, 2017 11:15
@miri64
Copy link
Member Author

miri64 commented Aug 21, 2017

(also adapted for changes in #7370)

@miri64
Copy link
Member Author

miri64 commented Oct 10, 2017

Rebased to and adapted for changes in master and dependencies

miri64 added a commit to miri64/RIOT that referenced this pull request Oct 10, 2017
@miri64 miri64 force-pushed the gnrc_netif2/feat/ieee802154 branch from d3a314a to a190862 Compare October 10, 2017 09:45
@miri64
Copy link
Member Author

miri64 commented Oct 10, 2017

Rebased to current master, no longer waiting for other PR

@miri64 miri64 added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed State: waiting for other PR State: The PR requires another PR to be merged first labels Oct 10, 2017
miri64 added a commit to miri64/RIOT that referenced this pull request Oct 10, 2017
@bergzand
Copy link
Member

I couldn't find anything comment worthy here. Changes between the old gnrc_netdev_ieee802154.c and gnrc_netif2_ieee802154.c look good to me.

@miri64
Copy link
Member Author

miri64 commented Oct 10, 2017

@kaspar030 made some comments about my usage of LOG_ERROR() in #7410. I will remove them here and in the other PRs.

if ((dst_len < 0) || (src_len < 0)) {
DEBUG("_make_netif_hdr: unable to get addresses\n");
return NULL;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a valid reason this should happen at runtime or could we go with an assert here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, if the address mode field in the network received mhr is of an unexpected value (not 2 or 3) the functions above return a negative value.

size_t n, src_len, dst_len;
uint8_t mhr[IEEE802154_MAX_HDR_LEN];
uint8_t flags = (uint8_t)(state->flags & NETDEV_IEEE802154_SEND_MASK);
le_uint16_t dev_pan = byteorder_btols(byteorder_htons(state->pan));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the idea behind this double-swap?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Getting it from host byte order to definitely little-endian (ideally it is optimized to 0-1 swaps).

if (pkt == NULL) {
DEBUG("_send_ieee802154: pkt was NULL\n");
return -EINVAL;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assert?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The other (and gnrc_netdev equivalents) don't do that as well, so there might be a reason to not do it.

}
netif_hdr = pkt->data;
/* prepare destination address */
if (netif_hdr->flags & /* If any of these flags is set so this is correct */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand the comment.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed

Copy link
Member Author

@miri64 miri64 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Not an excuse, but) most of this was just copy-pasta'd from the already reviewed gnrc_netdev's IEEE 802.15.4 glue-code

if ((dst_len < 0) || (src_len < 0)) {
DEBUG("_make_netif_hdr: unable to get addresses\n");
return NULL;
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, if the address mode field in the network received mhr is of an unexpected value (not 2 or 3) the functions above return a negative value.

size_t n, src_len, dst_len;
uint8_t mhr[IEEE802154_MAX_HDR_LEN];
uint8_t flags = (uint8_t)(state->flags & NETDEV_IEEE802154_SEND_MASK);
le_uint16_t dev_pan = byteorder_btols(byteorder_htons(state->pan));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Getting it from host byte order to definitely little-endian (ideally it is optimized to 0-1 swaps).

if (pkt == NULL) {
DEBUG("_send_ieee802154: pkt was NULL\n");
return -EINVAL;
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The other (and gnrc_netdev equivalents) don't do that as well, so there might be a reason to not do it.

}
netif_hdr = pkt->data;
/* prepare destination address */
if (netif_hdr->flags & /* If any of these flags is set so this is correct */
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed

@miri64 miri64 force-pushed the gnrc_netif2/feat/ieee802154 branch from 6e97db1 to 9f9737d Compare October 10, 2017 21:12
@smlng smlng merged commit af616ac into RIOT-OS:master Oct 10, 2017
@smlng
Copy link
Member

smlng commented Oct 10, 2017

ACK & GO

@miri64 miri64 deleted the gnrc_netif2/feat/ieee802154 branch October 10, 2017 21:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: network Area: Networking CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants