Skip to content

IEEE802.15.4: Unify CSMA-CA,CCA and send in all radios #13173

Description

@jia200x

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:
CSMA

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)

Metadata

Metadata

Labels

Area: networkArea: NetworkingType: new featureThe issue requests / The PR implemements a new feature for RIOT

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions