Description
Following the rework of #12688, we have a problem of consistency in CSMA-CA and CCA when calling send functions.
The IEEE802.15.4 standard specifies that all packets (except ACKs and Beacons) must be sent using CSMA.
Consider the following diagram of the CSMA procedure. The green blocks are the entry points of different mechanisms:

Let's define the green blocks in the diagram with these functions:
- : "CSMA Send":
ieee802154_send_csma_ca, send using the CSMA-CA procedure.
- "Transmit":
ieee802154_transmit, Transmit a raw frame without any kind of channel activity detection.
- "CCA Send":
ieee802154_send_cca, send using CCA procedure.
- "CCA":
ieee802154_cca, perform a Clear Channel Assessment.
So, in order to have a compliant IEEE802.15.4 layer:
- The
ieee802154_send_csma_ca function is always needed, regardless of the source of CSMA (hardware or software).
- If the radio doesn't support retransmissions, the
ieee802154_transmit function is needed in order to send ACK packets
- If the radio doesn't support hardware CSMA-CA the
ieee802154_send_cca function is needed, regardless of the source of CCA send (hardware or software)
- If the radio doesn't provide any caps, all functions are needed.
Here is a summary:
+-------------------------+----------------+------+-----+------+
| Function \ HW cap | CSMA + Retrans | CSMA | CCA | None |
+-------------------------+----------------+------+-----+------+
| ieee802154_send_csma_ca | x | x | x | x |
+-------------------------+----------------+------+-----+------+
| ieee802154_transmit | - | x | x | x |
+-------------------------+----------------+------+-----+------+
| ieee802154_send_cca | - | - | x | x |
+-------------------------+----------------+------+-----+------+
| ieee802154_cca | - | - | - | x |
+-------------------------+----------------+------+-----+------+
The problem is, calling dev->driver->send has an undefined behavior depending on the driver and configuration:
- In at86rf2xx radios it behaves as
ieee802154_send_csma_ca, unless NETOPT_CSMA is disabled (in that case it will behave as ieee802154_send_cca).
- In nRF52 radios, it behaves as a plain send function (
ieee802154_transmit).
- In Kinetis radios, it usually behaves as
ieee802154_cca_send.
This explains why there's a QoS degradation in GNRC when comparing nRF52xx with at86rf2xx.
I'm not including hw retransmissions here, but there's a similar problem.
Also, some modules might not work OK when using different radios (openthread, csma_sender, etc).
Proposal
Implement the proposed functions.
We already have ieee802154_send_csma_ca and ieee802154_send_cca "out of the box" using the csma_sender module (event with HW caps discovery using NETOPT_AUTOCCA and NETOPT_CSMA). We might need to adjust the csma_sender module a little bit because for some radios it might not work (calling ieee802154_send_cca using at86rf2xx radios will have a strange behavior).
Then, we can explicitly call each "send" function (plain, cca and csma) where needed. E.g since we are only sending data packets in gnrc_netif_ieee802154, we should already use the csma_sender function there.
We can use radio caps to check if a feature is implemented in hardware (so no need to call the software procedure). We can also add compile time optimzations (e.g we are not interested in compiling software CSMA if only at86rf2xx radios are used)
Description
Following the rework of #12688, we have a problem of consistency in CSMA-CA and CCA when calling
sendfunctions.The IEEE802.15.4 standard specifies that all packets (except ACKs and Beacons) must be sent using CSMA.
Consider the following diagram of the CSMA procedure. The green blocks are the entry points of different mechanisms:

Let's define the green blocks in the diagram with these functions:
ieee802154_send_csma_ca, send using the CSMA-CA procedure.ieee802154_transmit, Transmit a raw frame without any kind of channel activity detection.ieee802154_send_cca, send using CCA procedure.ieee802154_cca, perform a Clear Channel Assessment.So, in order to have a compliant IEEE802.15.4 layer:
ieee802154_send_csma_cafunction is always needed, regardless of the source of CSMA (hardware or software).ieee802154_transmitfunction is needed in order to send ACK packetsieee802154_send_ccafunction is needed, regardless of the source of CCA send (hardware or software)Here is a summary:
The problem is, calling
dev->driver->sendhas an undefined behavior depending on the driver and configuration:ieee802154_send_csma_ca, unless NETOPT_CSMA is disabled (in that case it will behave asieee802154_send_cca).ieee802154_transmit).ieee802154_cca_send.This explains why there's a QoS degradation in GNRC when comparing nRF52xx with at86rf2xx.
I'm not including hw retransmissions here, but there's a similar problem.
Also, some modules might not work OK when using different radios (openthread, csma_sender, etc).
Proposal
Implement the proposed functions.
We already have
ieee802154_send_csma_caandieee802154_send_cca"out of the box" using thecsma_sendermodule (event with HW caps discovery using NETOPT_AUTOCCA and NETOPT_CSMA). We might need to adjust thecsma_sendermodule a little bit because for some radios it might not work (callingieee802154_send_ccausing at86rf2xx radios will have a strange behavior).Then, we can explicitly call each "send" function (plain, cca and csma) where needed. E.g since we are only sending data packets in
gnrc_netif_ieee802154, we should already use thecsma_senderfunction there.We can use radio caps to check if a feature is implemented in hardware (so no need to call the software procedure). We can also add compile time optimzations (e.g we are not interested in compiling software CSMA if only at86rf2xx radios are used)