Skip to content

Commit 5ac2461

Browse files
jukkarnashif
authored andcommitted
doc: net: Fix L2 documentation
Use proper link to Zephyr source files. Fix rendering of special options like NET_OK, NET_DROP and NET_CONTINUE. Add reference links to network technologies documents. Signed-off-by: Jukka Rissanen <[email protected]>
1 parent 1ed18b8 commit 5ac2461

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

doc/reference/networking/net_l2.rst

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ Overview
1212

1313
The L2 stack is designed to hide the whole networking link-layer part
1414
and the related device drivers from the upper network stack. This is made
15-
through a :c:type:`struct net_if` declared in :zephyr_file:`include/net/net_if.h`.
15+
through a :c:type:`struct net_if` declared in
16+
:zephyr_file:`include/net/net_if.h`.
1617

1718
The upper layers are unaware of implementation details beyond the net_if
1819
object and the generic API provided by the L2 layer in
@@ -22,9 +23,11 @@ Only the L2 layer can talk to the device driver, linked to the net_if
2223
object. The L2 layer dictates the API provided by the device driver,
2324
specific for that device, and optimized for working together.
2425

25-
Currently, there are L2 layers for Ethernet, IEEE 802.15.4 Soft-MAC,
26-
Bluetooth IPSP, CANBUS, OpenThread, WiFi and a dummy one, which is a generic
27-
layer example that can be used as a template for writing a new one.
26+
Currently, there are L2 layers for :ref:`Ethernet <ethernet_interface>`,
27+
:ref:`IEEE 802.15.4 Soft-MAC <ieee802154_interface>`,
28+
:ref:`Bluetooth IPSP <bluetooth-ipsp-sample>`, :ref:`CANBUS <can_interface>`,
29+
:ref:`OpenThread <thread_protocol_interface>`, WiFi, and a dummy layer
30+
example that can be used as a template for writing a new one.
2831

2932
L2 layer API
3033
************
@@ -42,8 +45,8 @@ more details. The generic L2 API has these functions:
4245
buffer along to the L2 stack's ``recv()`` function for handling.
4346
The L2 stack does what it needs to do with the packet, for example, parsing
4447
the link layer header, or handling link-layer only packets. The ``recv()``
45-
function will return NET_DROP in case of an erroneous packet,
46-
NET_OK if the packet was fully consumed by the L2, or NET_CONTINUE
48+
function will return ``NET_DROP`` in case of an erroneous packet,
49+
``NET_OK`` if the packet was fully consumed by the L2, or ``NET_CONTINUE``
4750
if the network stack should then handle it.
4851

4952
- ``send()``: Similar to receive function, the network stack will call this
@@ -53,7 +56,7 @@ more details. The generic L2 API has these functions:
5356
error code if there was a failure sending the network packet.
5457

5558
- ``enable()``: This function is used to enable/disable traffic over a network
56-
interface. The function returns <0 if error and >=0 if no error.
59+
interface. The function returns ``<0`` if error and ``>=0`` if no error.
5760

5861
- ``get_flags()``: This function will return the capabilities of an L2 driver,
5962
for example whether the L2 supports multicast or promiscuous mode.
@@ -66,8 +69,8 @@ basis. Please refer to :ref:`device_drivers`.
6669

6770
There are, however, two differences:
6871

69-
- the driver_api pointer must point to a valid :c:type:`struct
70-
net_if_api` pointer.
72+
- The driver_api pointer must point to a valid :c:type:`struct net_if_api`
73+
pointer.
7174

7275
- The network device driver must use ``NET_DEVICE_INIT_INSTANCE()``
7376
or ``ETH_NET_DEVICE_INIT()`` for Ethernet devices. These
@@ -117,8 +120,8 @@ here as well. There are two specific differences however:
117120
ieee802154_radio_api`, which overloads :c:type:`struct
118121
net_if_api`. This is because 802.15.4 L2 needs more from the device
119122
driver than just ``send()`` and ``recv()`` functions. This dedicated API is
120-
declared in :zephyr_file:`include/net/ieee802154_radio.h`. Each and every IEEE
121-
802.15.4 device driver must provide a valid pointer on such
123+
declared in :zephyr_file:`include/net/ieee802154_radio.h`. Each and every
124+
IEEE 802.15.4 device driver must provide a valid pointer on such
122125
relevantly filled-in API structure.
123126

124127
- Sending a packet is slightly different than in Ethernet. IEEE 802.15.4 sends

0 commit comments

Comments
 (0)