Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nettype: intial import #2397

Merged
merged 1 commit into from
Feb 10, 2015
Merged

nettype: intial import #2397

merged 1 commit into from
Feb 10, 2015

Conversation

miri64
Copy link
Member

@miri64 miri64 commented Feb 6, 2015

Type to define protocols

@miri64 miri64 added this to the Network Stack Task Force milestone Feb 6, 2015
@miri64 miri64 added NSTF Impact: minor The PR is small in size and might only require a quick look of a knowledgeable reviewer Area: network Area: Networking labels Feb 6, 2015
@miri64
Copy link
Member Author

miri64 commented Feb 6, 2015

Please do not merge yet. I realized there are still some minor issues to this header. :D

@haukepetersen haukepetersen self-assigned this Feb 6, 2015
@haukepetersen
Copy link
Contributor

Does it make sense to put the ng header already into sys/include/net/.. as there is nothing in this place at this point anyway?

@miri64
Copy link
Member Author

miri64 commented Feb 6, 2015

I thought it might be clearer for newcomers to the new network stack to give a clear "this is where the new stuff is" ;-).

@miri64 miri64 added the CI: needs squashing Commits in this PR need to be squashed; If set, CI systems will mark this PR as unmergable label Feb 6, 2015
@miri64
Copy link
Member Author

miri64 commented Feb 6, 2015

Ready for review :-)

@miri64 miri64 force-pushed the nettype/feat/initial branch from 9e4e57b to 065b6b3 Compare February 6, 2015 17:50
@haukepetersen
Copy link
Contributor

still think that starting now to put stuff into sys/include/net is already a good idea...

To the PR: I think it would make sense to take the changes to pkt.h out of this PR as I would say they are unrelated -> I would opt for making these changes when you (re)commit the pktsnip.h file

* @note Expand at will.
*/
typedef struct {
NG_NETTYPE_UNDEF = 0, /**< Protocol is undefined */
Copy link
Contributor

Choose a reason for hiding this comment

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

if we really use these protocol number as array offset, I would not include this value.

Copy link
Member Author

Choose a reason for hiding this comment

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

This can also be done by doing type - 1 internally. I'd rather have some fallback value for testing etc.

@OlegHahm
Copy link
Member

OlegHahm commented Feb 6, 2015

What's the purpose of these types? Where should they be used?

NG_NETTYPE_IEEE802154, /**< Protocol is IEEE 802.15.4 */
#endif
#ifdef MODULE_NG_SIXLOWPAN
NG_NETTYPE_SIXLOWPAN, /**< Protocol is 6LoWPAN */
Copy link
Member

Choose a reason for hiding this comment

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

Hm, I would not call 6LoWPAN a link layer protocol.

Copy link
Member Author

Choose a reason for hiding this comment

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

Me neither. But in our stack it would take the place of a link layer protocol, since it sits behind a network interface of the IPv6 layer.

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 get this. In the envisioned stack I'm theoretically able to put as many threads/modules/layers as I want (in case I have enough memory) between two OSI layers. I would either drop the substructuring at all or make a new subsection for adaptation layers.

Copy link
Member Author

Choose a reason for hiding this comment

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

+--------------+
|     IPv6     |
|  IF   |  IF  |
+--------------+
    ^       ^
 netapi   netapi
    v       v
+-----+  +-----+
| MAC |  | 6LP |
|     |  +-----+
|     |     ^
|     |   netapi
|     |     v
|     |  +-----+
|     |  | MAC |
+-----+  +-----+
|radio|  |radio|
+-----+  +-----+

Does it make anymore sense to you now?

Copy link
Member Author

Choose a reason for hiding this comment

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

Putting 6LoWPAN between anything other than IPv6 and a MAC is non-sensical

Copy link
Member

Choose a reason for hiding this comment

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

Does it make anymore sense to you now?

No. I still disagree calling 6LoWPAN a link layer protocol. That's simply wrong for me.

Copy link
Member Author

Choose a reason for hiding this comment

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

I can take it out of the group, but I thought the implementation would be easier to find then, since it would also reside in sys/net/link_layer (if not their, where else)?

Copy link
Member

Choose a reason for hiding this comment

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

Either create a new folder name something like "adaption_layer" or leave it in network layer.

Copy link
Member

Choose a reason for hiding this comment

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

I'm in favor of putting/leaving it in the network layer.

@miri64
Copy link
Member Author

miri64 commented Feb 6, 2015

Is replacement for pkt_proto_t and in older versions netdev_proto_t. They are also used to identify protocols in the netreg.

@OlegHahm OlegHahm added NSTF and removed NSTF labels Feb 6, 2015
#endif
#ifdef MODULE_NG_ICMPV6
NG_NETTYPE_ICMPV6, /**< Protocol is ICMPv6 */
NG_NETTYPE_ICMPV6_ECHO, /**< Protocol is ICMPv6, echo reply/request */
Copy link
Member

Choose a reason for hiding this comment

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

Does it really make sense for upper layers to register for an echo reply?

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, for example a ping application, or a application if the tests result are as expected in these things.

Copy link
Member

Choose a reason for hiding this comment

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

Sorry, I meant echo request.

Copy link
Member Author

Choose a reason for hiding this comment

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

Goes the same for the Plugtests

@haukepetersen
Copy link
Contributor

I think it would make sense to PR the interface for netreg as soon as possible, so this PR can be put into context - it might help for clarification!

*
* @note Expand at will.
*/
typedef struct {
Copy link
Member

Choose a reason for hiding this comment

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

Why is this not an enum? Can this actually compile this way as a struct def?

Copy link
Member Author

Choose a reason for hiding this comment

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

You're right! Will fix this

@miri64
Copy link
Member Author

miri64 commented Feb 7, 2015

@cgundogan sure, if someone implements a version of those protocols that utilizes netapi we can add them. I only added the stuff we decided to implement for now.

@miri64 miri64 mentioned this pull request Feb 7, 2015
@miri64
Copy link
Member Author

miri64 commented Feb 7, 2015

@haukepetersen done: #2404

@miri64
Copy link
Member Author

miri64 commented Feb 7, 2015

Fixed @cgundogan comment

@miri64 miri64 mentioned this pull request Feb 7, 2015
@miri64
Copy link
Member Author

miri64 commented Feb 7, 2015

Removed the ICMPv6 subtypes. Registration can be done doing e.g.

netreg_register(NETTYPE_ICMPV6, ipv6_pid, ICMPV6_TYPE_RPL, rpl_pid);

@miri64 miri64 mentioned this pull request Feb 8, 2015
36 tasks
* @name Link Layer
*/
#ifdef MODULE_NG_IEEE802154
NG_NETTYPE_IEEE802154, /**< Protocol is IEEE 802.15.4 */
Copy link
Contributor

Choose a reason for hiding this comment

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

as discussed today, in my opinion we can drop this option, as link layers should register independent of their protocol

@haukepetersen
Copy link
Contributor

looks good to me (except the 15.4 entry in the list). ack when fixed.

@miri64
Copy link
Member Author

miri64 commented Feb 9, 2015

Addressed @haukepetersen's comments.

@cgundogan
Copy link
Member

@authmillenon

Removed the ICMPv6 subtypes. Registration can be done doing e.g.

netreg_register(NETTYPE_ICMPV6, ipv6_pid, ICMPV6_TYPE_RPL, rpl_pid);
  1. Where would be / is ICMPV6_TYPE_RPL defined?
  2. Why is NG_NETTYPE_AODV defined and not NG_NETTYPE_RPL?

EDIT: I understand that you removed the ICMPv6 subtypes a commit earlier, but why did you not remove the NG_NETTYPE_AODV?

@haukepetersen
Copy link
Contributor

@cgundogan: RPL is missing indeed, but as the code states: everyone who adds a new protocol should just add it to this list. As I understood it, the current list includes just some randomly selected protocols to show how this file is supposed to work - but it is not complete, so adding e.g. RPL, TCP, etc, has to be done whenever those implementations are added...

@cgundogan
Copy link
Member

@haukepetersen Well, for the sake of completeness, I would like to see the RPL NETTYPE also in this PR - both, because it is an existing module in RIOT and to prevent further time consuming questions in a later phase

@haukepetersen
Copy link
Contributor

fine with me. @authmillenon, could you add at least RPL and TCP to this list?

@miri64
Copy link
Member Author

miri64 commented Feb 10, 2015

For RPL the idea was to do it via demux context (as described) so a NETTYPE_RPL is not needed.

  1. Where would be / is ICMPV6_TYPE_RPL defined?

Where ever the values for the ICMPv6 type field will be defined.

  1. Why is NG_NETTYPE_AODV defined and not NG_NETTYPE_RPL?

Because AODV uses its own package format, while RPL utilizes ICMPv6. AODV will be demultiplexed in the IP thread's dultiplexer (as ICMPv6, UDP, TCP, etc.), while RPL will be demultiplexed in the ICMPv6 module. @haukepetersen and I talked about this dual nature that you basically have two ways now to register to a protocol yesterday, but come to the conclusion, that this is the most memory-saving one, while also being flexible.

As for TCP, I can re-add it.

@cgundogan
Copy link
Member

@authmillenon I am not sure if this is relevant here, but data-plane packets (udp, tcp ..) can and most probably will be annotated later with an IPv6-Hop-By-Hop extension header with RPL information (https://tools.ietf.org/html/rfc6553). These packets, regardless of their transport layer, need to interact with RPL in some way.

@miri64
Copy link
Member Author

miri64 commented Feb 10, 2015

@cgundogan then RPL can also register via netreg_register(NETTYPE_IPV6, IPV6_EXT_HOP_BY_HOP, rpl_pid) ;).

@cgundogan
Copy link
Member

@authmillenon I am still not convinced.. AODV can also use netreg_register(NETTYPE_UDP, AODV_ROUTE_REQUEST, aodv_pid) and similar with AODV_ROUTE_REPLY and _ERROR.

All AODV messages are sent to port 654 using UDP. (https://www.ietf.org/rfc/rfc3561.txt)

@haukepetersen
Copy link
Contributor

True, AODV utilizes UDP, so there is actually no reason to include it into this list.

For RPL @authmillenon is right, it registers for certain types of next-headers and ICMP messages, so there is also no reason to include RPL in this list.

@miri64
Copy link
Member Author

miri64 commented Feb 10, 2015

Done

@haukepetersen
Copy link
Contributor

thx. I have nothing to add: ACK (merge at will once Travis is happy)

@miri64 miri64 force-pushed the nettype/feat/initial branch from 851be09 to 9d36c05 Compare February 10, 2015 12:33
@miri64
Copy link
Member Author

miri64 commented Feb 10, 2015

Squashed

@cgundogan cgundogan removed the CI: needs squashing Commits in this PR need to be squashed; If set, CI systems will mark this PR as unmergable label Feb 10, 2015
@cgundogan
Copy link
Member

me gusta, let's wait for travis and then merge

miri64 added a commit that referenced this pull request Feb 10, 2015
@miri64 miri64 merged commit e5e1d0d into RIOT-OS:master Feb 10, 2015
@miri64 miri64 deleted the nettype/feat/initial branch February 10, 2015 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: network Area: Networking Impact: minor The PR is small in size and might only require a quick look of a knowledgeable reviewer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants