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

net: added generic network interface header format #2449

Merged
merged 1 commit into from
Mar 3, 2015

Conversation

haukepetersen
Copy link
Contributor

This is a first approach to a generic link layer header that can be used throughout the network stack.

The basic idea is create a link layer header format, that all link layers understand and that contains the data from link layers, that upper protocols might be interested in.

I am not too happy with this implementation yet, maybe somebody has a better idea how to deal with varying address sizes?

@haukepetersen haukepetersen added NSTF Discussion: RFC The issue/PR is used as a discussion starting point about the item of the issue/PR Area: network Area: Networking labels Feb 12, 2015
uint8_t addr_len; /**< link layer address length in byte */
uint8_t rssi; /**< rssi of received packet (optional) */
uint8_t lqi; /**< lqi of received packet (optional) */
uint8_t options; /**< any optional options */
Copy link
Member

Choose a reason for hiding this comment

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

"optional options" ;)

Copy link
Member

Choose a reason for hiding this comment

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

(Seriously - what is this supposed to be?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

that is open for discussion, there 8-bit left in the struct to fill (so it aligns), so I thought some options field might be a good idea...

@OlegHahm
Copy link
Member

I don't fully understand the purpose of this PR. Why should any layer apart from IP/network layer be interested in the link layer header? Even for the network layer I'm not sure, where it would be needed.

@miri64
Copy link
Member

miri64 commented Feb 13, 2015

I don't fully understand the purpose of this PR

The purpose is to unify the very heterogeneous link layer headers with a simpler, but common, header format. The drivers translate it then to the format they need / they translate it from their format to the common one.

Why should any layer apart from IP/network layer be interested in the link layer header?

Routing needs sometimes information for their metrics (see #2449 (comment)) + according to @cgundogan their are TCP extensions that use link-layer information.

Even for the network layer I'm not sure, where it would be needed.

Uhm, ARP/NDP needs to now the link layer addresses?

@miri64
Copy link
Member

miri64 commented Feb 13, 2015

Just stumbled upon this: can you rename this module l2hdr (for layer 2 header)? Otherwise it can get very confusing in IP with LL either meaning link-local or link layer.

@OlegHahm
Copy link
Member

Routing needs sometimes information for their metrics (see #2449 (comment)) + according to @cgundogan their are TCP extensions that use link-layer information.

As far as I see it, the required information (e.g. RSSI or ETX) are rather PHY layer information. They are usually not part of a link layer header. I complete agree that it makes sense to provide this data to upper layers or routing, but I would not put them into a link-layer header.

Uhm, ARP/NDP needs to now the link layer addresses?

To my understanding (and at least Wikipedia agrees) ARP and NDP are not part of the network layer.

Maybe the general problem is more a terminology problem. This PR seems to provide information like the one that is currently handled by sys/include/radio/types.h and I would vote split it accordingly into link-layer and radio/PHY data structs.

@miri64
Copy link
Member

miri64 commented Feb 13, 2015

Just stumbled upon this: can you rename this module l2hdr (for layer 2 header)? Otherwise it can get very confusing in IP with LL either meaning link-local or link layer.

We also would then have a really easy scheme to refer to the different layers in abbreviations:

  • link layer: l2
  • network layer: l3
  • transport layer: l4
  • application layer: l7

@miri64
Copy link
Member

miri64 commented Feb 13, 2015

Maybe the general problem is more a terminology problem. This PR seems to provide information like the one that is currently handled by sys/include/radio/types.h and I would vote split it accordingly into link-layer and radio/PHY data structs.

And why not KISS and unify this into one header?

@miri64
Copy link
Member

miri64 commented Feb 13, 2015

To my understanding (and at least Wikipedia agrees) ARP and NDP are not part of the network layer.

Yes, but at least NDP is controlled by a network layer protocol (ICMPv6). That means, that the network layer needs this information to have any kind of network resolution.

@OlegHahm
Copy link
Member

I would argue that ICMP is not pure network layer protocol (since it uses IP for transport), but that's not the point. I'm not against unifying this information, but strongly against putting all into a structure called link-layer header.

@miri64 miri64 mentioned this pull request Feb 13, 2015
uint8_t rssi; /**< rssi of received packet (optional) */
uint8_t lqi; /**< lqi of received packet (optional) */
uint8_t options; /**< any optional options */
} llhdr_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 we need to put the PID for the link-layer interface in here to. While implementing IPv6 I wondered how else a routing protocol might get those to put them in the FIB. Do they need it anyway? @cgundogan @Lotterleben @benpicco or @fnack?

Copy link
Member

Choose a reason for hiding this comment

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

At least for multi-interface support in NHDP and OLSRv2 which are working atop of IPv6 it is necessary that the protocols can determine on which interface a packet was received on. I haven't looked into the whole new network stack structure yet, so I can't assess whether this is the right struct to save this information but generally the information has to be available somewhere for network layer protocols.

@haukepetersen haukepetersen changed the title net: added generic link layer header format net: added generic network interface header format Feb 18, 2015
@haukepetersen
Copy link
Contributor Author

I agree that link layer header wasn't maybe the best name for this -> I renamed it to interface header for now, somebody has a better idea?

Anyway: The notion behind this PR is, that we need a generic way to speak with link-layers/network interfaces of different type - and this is done through this proposed header format. For sending out data the link layer addresses are given to the link layer using this header. When receiving data, the link layer addresses and additionally all information that is interesting for upper layers is bundled into this header, so it can be accessed generically from layers above (without having them to know any specifics of the underlying link layer technologies...).

@haukepetersen
Copy link
Contributor Author

and some more fixes...

@OlegHahm
Copy link
Member

I would argue that things like RSSI values are part of any header.

@haukepetersen
Copy link
Contributor Author

true, not in a conventional sense. But how would you make this data available to upper layers in a clean way?

@OlegHahm
Copy link
Member

Maybe calling the struct something like radio_data_t or packet_info_t and set a pointer in the link layer header?

@haukepetersen
Copy link
Contributor Author

just makes stuff more complicated by introducing additional de-referencing... remember this data is allocated in the packet buffer and every new element in the pktsnip-chain introduces addtional overhead...

@OlegHahm
Copy link
Member

Then the question is strict layering vs. efficiency, I guess.

@miri64
Copy link
Member

miri64 commented Feb 19, 2015

I agree that link layer header wasn't maybe the best name for this -> I renamed it to interface header for now, somebody has a better idea?

In general I like the connection to interfaces for the name, but for consistency I would name it ng_netif_hdr and even make it a submodule of ng_netif (as I did e.g. with ng_ipv6 and ng_ipv6_addr)

@haukepetersen
Copy link
Contributor Author

@authmillenon: I think that would make sense. But I probably won't get to it before next week...

@haukepetersen
Copy link
Contributor Author

renamed it to ng_netif_hdr_* and made is sub-module to netif. What do you think?

@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 Mar 3, 2015
@miri64
Copy link
Member

miri64 commented Mar 3, 2015

From me that would be ACK, but I don't want to brush over @OlegHahm's head ;-)

* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
*/

#ifndef IFHDR_H_
Copy link
Member

Choose a reason for hiding this comment

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

Arghs: one last minute thing: %s/IFHDR/NG_NETIF_HDR/g ;-)

@haukepetersen
Copy link
Contributor Author

addressed comments.


/**
* @defgroup ng_netif_hdr Generic network interface header
* @{
Copy link
Member

Choose a reason for hiding this comment

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

I did not want the @ingroup ng_netif to go :(

@haukepetersen
Copy link
Contributor Author

addresses more comments.

@OlegHahm
Copy link
Member

OlegHahm commented Mar 3, 2015

ACK - squash please

@haukepetersen
Copy link
Contributor Author

squashed and go.

haukepetersen added a commit that referenced this pull request Mar 3, 2015
net: added generic network interface header format
@haukepetersen haukepetersen merged commit 4b9eaa9 into RIOT-OS:master Mar 3, 2015
@haukepetersen haukepetersen deleted the ng_llhdr branch March 3, 2015 21:01
@miri64 miri64 mentioned this pull request Mar 4, 2015
36 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: network Area: Networking CI: needs squashing Commits in this PR need to be squashed; If set, CI systems will mark this PR as unmergable Discussion: RFC The issue/PR is used as a discussion starting point about the item of the issue/PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants