This discussion is intended to be a “network stack independent” discussion.
Thus, all components refer to the generic one (e.g
Network Device representation
I would like to open a discussion regarding how to represent a network device and what’s the role of the network interfaces.
For a long time we have been using
netdev as a “network device descriptor”, as
well as a “network device interface”. An example of the former if the
module that stores the index and device type in the
netdev_t structure or the
fact that we can “identify” a network device driver by a
netdev_t pointer. An example
of the latter is controlling the network device via
recv, get, set, isr).
Since the Radio HAL and SubMAC got merged, there’s intentionally no common interface for PHY/transceiver (as explained during the PHY/MAC rework breakout session of the summit). Also, netdev is not a mandatory dependency anymore.
There are still some reasons to have a generic way to represent a network device.
E.g see this discussion
regarding where to store index and device type). So far we have being using
for that purpose, but we are slowly starting to have sort of duplicated descriptors
netdev_t) or mixed semantics.
So, the question is, do we need a common representation/interface for network devices? If so, I see 2 options (that are not necessarilly mutually exclusive).
- We can use
netif_tdescriptor to indirectly identify a network device. This is similar to Linux (e.g
ipcommand requires an interface). We also keep doing this indirectly with the
ifconfigcommand in RIOT, althogh it’s hardcoded to GNRC netif. But we could extend this principle to
netif_tso it’s always possible to associate one
netif_tto a specific device. Note that there are already lists of
netif_t(see netif_register), so we could already iterate the network interface to get a specific device. Note that this takes into consideration that there might be
netifs without a device (e.g virtual interfaces)
- We can define a common network descriptor (e.g
netdev_t, but we should be very careful with mixing interface and descriptor semantics). In this case, we can provide a list/array of “network descriptors” that get the original device back. This means all network device driver interfaces (e.g IEEE 802.15.4 Radio HAL) would inherit from this common device descriptor.
What are your thoughts on this topic?