Skip to content

Conversation

kaspar030
Copy link
Contributor

@kaspar030 kaspar030 commented Jan 11, 2018

Contribution description

netdev used to use struct iovec for its send function. While being the standard for scatter/gather IO (well, we had to add the header as newlib doesn't support it), it is a little clumsy to use, as usually the size of the needed array is not known in stacked environments like a network stack.

This PR introduces "iolists", which are basically a linked list of IO vectors, not unlike GNRC's pktsnips.
netdev is changed to use iolists.

gnrc_pktsnip_t is rearranged so its beginning matches iolist_t, so pktsnips can be directly handed to netdev's send() function.

This is WIP, only netdev_tap and at86rf2xx has been adapted, and only gnrc_ethernet and gnrc_ieee802154.

Issues/PRs references

Probably solves bullet point #2 of #6299.

Testing checklist

  • cc2538_rf
  • netdev_tap
  • socket_zep
  • nrfmin
  • at86rf2xx
  • cc1100
  • cc2420
  • enc28j60
  • encx24j600
  • ethos
  • kw2xrf
  • mrf24j40
  • slipdev
  • sx127x
  • w5100
  • xbee
  • emb6
  • lwip
  • openthread
  • semtech-loramac
  • gomach
  • lwmac

@kaspar030 kaspar030 added Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation Area: network Area: Networking State: WIP State: The PR is still work-in-progress and its code is not in its final presentable form yet Discussion: RFC The issue/PR is used as a discussion starting point about the item of the issue/PR GNRC labels Jan 11, 2018
@@ -106,10 +106,11 @@ typedef struct gnrc_pktsnip {
*
* @internal
*/
unsigned int users;
Copy link
Member

Choose a reason for hiding this comment

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

Maybe move the doc for the field as well ;-)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yup :) done

@@ -106,10 +106,11 @@ typedef struct gnrc_pktsnip {
*
* @internal
*/
unsigned int users;
/* the first three fields *MUST* be identical to iolist_t! */
Copy link
Member

Choose a reason for hiding this comment

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

I think you can group fields with @{ @} as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hm, I thought this to be an implementation detail, thus the comment is not doxygen (/*).

@kaspar030
Copy link
Contributor Author

  • updated pkt unittests, and added some checking whether the structs match
  • added some doc do pkt.h explaining the similarities

@kaspar030 kaspar030 added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Jan 18, 2018
@kaspar030 kaspar030 force-pushed the introduce_iolists branch 3 times, most recently from c6915b7 to 9a39582 Compare January 18, 2018 17:42
@kaspar030 kaspar030 changed the title WIP: Introduce iolists net: Introduce iolists Jan 18, 2018
@kaspar030 kaspar030 removed Discussion: RFC The issue/PR is used as a discussion starting point about the item of the issue/PR State: WIP State: The PR is still work-in-progress and its code is not in its final presentable form yet labels Jan 18, 2018
@kaspar030 kaspar030 force-pushed the introduce_iolists branch 2 times, most recently from 3955e58 to 154a882 Compare January 18, 2018 20:37
@kaspar030 kaspar030 added the Impact: major The PR changes a significant part of the code base. It should be reviewed carefully label Jan 18, 2018
@kaspar030
Copy link
Contributor Author

  • ready for review
  • marked major as this touches all netdev drivers and many gnrc components

I don't think this should go into the release, but I'd like to merge it early after as it goes stale rather quick...

@kaspar030
Copy link
Contributor Author

Help with testing different drivers is much appretiated! If a ping goes through correctly, it should be fine to check a box. ;)

*/

/**
* @defgroup sys_util iolist scatter / gather IO
Copy link
Contributor

Choose a reason for hiding this comment

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

why not sys_iolist ?

Copy link
Contributor

@aabadie aabadie Feb 2, 2018

Choose a reason for hiding this comment

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

or sys_util_iolist

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

@aabadie
Copy link
Contributor

aabadie commented Jan 18, 2018

I can test the LoRa related stuff (sx127x and loramac) but not before next week.

Copy link
Contributor

@aabadie aabadie left a comment

Choose a reason for hiding this comment

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

I tested it with RN2483 and SX1276 (LoRaWAN) and it works. I briefly tested with XBee and it works (only ifconfig but no send/receive).

@aabadie
Copy link
Contributor

aabadie commented Feb 2, 2018

This PR is very nice, I think it should be merged soon since it touches many parts of the code and we are at the very beginning of a new release cycle.

@miri64
Copy link
Member

miri64 commented Feb 2, 2018

I tested it with RN2483 and SX1276 (LoRaWAN) and it works.

Can you please update the list above.

I briefly tested with XBee and it works (only ifconfig but no send/receive).

Since this is touching the send method you can't really call this a test, since ifconfig just uses get/set.

@aabadie
Copy link
Contributor

aabadie commented Feb 2, 2018

@aabadie aabadie closed this Feb 2, 2018
@aabadie aabadie reopened this Feb 2, 2018
@bergzand
Copy link
Member

And identical method used for testing tests/lwmac, txtsnd also works for that test.

@kaspar030
Copy link
Contributor Author

And identical method used for testing tests/lwmac, txtsnd also works for that test.

Nice! btw, feel free to check the boxes. I find it quite satisfying. ;)

@bergzand
Copy link
Member

And last one for today: openthread also verified by reproducing the steps described in tests/openthread/README.md.

@bergzand
Copy link
Member

enc28j60 tested and works. 2 more to go!

@kaspar030
Copy link
Contributor Author

I propose merging as is, so it doesn't get stale and maybe more testing.
Noone seems to have a w5100 around, cc1100 is mor or less broken in master anyways, and only one of the 20+ adapted modules had an issue, so I think the chance that w5100 is broken is slim

@miri64 @bergzand What do you think?

@kaspar030 kaspar030 force-pushed the introduce_iolists branch from 75a71bf to c4b1fa6 Compare March 6, 2018 13:01
@kaspar030
Copy link
Contributor Author

I took the liberty to rebase and squash.

@miri64
Copy link
Member

miri64 commented Mar 6, 2018

I propose merging as is, so it doesn't get stale and maybe more testing.
Noone seems to have a w5100 around, cc1100 is mor or less broken in master anyways, and only one of the 20+ adapted modules had an issue, so I think the chance that w5100 is broken is slim

@miri64 @bergzand What do you think?

Agreed.

@kaspar030
Copy link
Contributor Author

@bergzand I think your comments have been addressed?

Copy link
Member

@bergzand bergzand left a comment

Choose a reason for hiding this comment

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

ACK. Note that I only tested the code, I haven't done an in depth review of the code.

@bergzand
Copy link
Member

bergzand commented Mar 6, 2018

I propose merging as is, so it doesn't get stale and maybe more testing.
Noone seems to have a w5100 around, cc1100 is mor or less broken in master anyways, and only one of the 20+ adapted modules had an issue, so I think the chance that w5100 is broken is slim

@miri64 @bergzand What do you think?

+1

If there is nobody using the w5100 anymore, maybe it is better to phase it out. But that is something for a different discussion.

@aabadie
Copy link
Contributor

aabadie commented Mar 7, 2018

If there is nobody using the w5100 anymore

Looking at the driver authorship, the initial contribution is from @haukepetersen. Maybe he knows where to find the hardware for testing ?

@kaspar030
Copy link
Contributor Author

Thanks a lot for the help with testing!

&go.

@kaspar030 kaspar030 merged commit d025de3 into RIOT-OS:master Mar 7, 2018
@kaspar030 kaspar030 deleted the introduce_iolists branch March 7, 2018 08:56
@bergzand
Copy link
Member

bergzand commented Mar 7, 2018

🎉

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 Impact: major The PR changes a significant part of the code base. It should be reviewed carefully Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants