raw_tx_packet sample stops working

Hi!

We're evaluating the nRF7002 with its DK. As part of that I'm trying to run the sample in ncs/sdk/v3.0.2/nrf/samples/wifi/raw_tx_packet. I build it with:
`west build -b nrf7002dk/nrf5340/cpuapp -- -DCONFIG_RAW_TX_PKT_SAMPLE_NON_CONNECTED_MODE=y -DCONFIG_RAW_TX_PKT_SAMPLE_TX_MODE_CONTINUOUS=y -DCONFIG_RAW_TX_PKT_SAMPLE_INTER_FRAME_DELAY_MS=10`.

That works fine. The board sends out the beacon packets and with a modified version of the monitoring sample, I can see them being received by a second card. (You should perhaps have a sample to receive these packets among the samples...).

I then recompile it by with 4 ms inter-frame delay. Then it works for a short while, then it starts logging:
```
[09:27:59.068,054] <err> net_ctx: Failed to allocate net_pkt
[09:27:59.068,084] <err> raw_tx_packet: Unable to send beacon frame: No buffer space available
[09:28:00.069,244] <err> net_ctx: Failed to allocate net_pkt
[09:28:00.069,274] <err> raw_tx_packet: Unable to send beacon frame: No buffer space available
[09:28:01.070,526] <err> net_ctx: Failed to allocate net_pkt
[09:28:01.070,556] <err> raw_tx_packet: Unable to send beacon frame: No buffer space available
[09:28:02.071,746] <err> net_ctx: Failed to allocate net_pkt
[09:28:02.071,807] <err> raw_tx_packet: Unable to send beacon frame: No buffer space available
```

It is line 2482 in `zephyr/subsys/net/ip/net_context.c` that logs the "Failed to allocate net_pkt" messages.

Once this has happened, it doesn't send packets anymore until I reset the card. I guess there is some other place where it tries to allocate memory, fails and doesn't log it as part of the packet processing so it can never empty the queue.

We've also tried setting the CONFIG_RAW_TX_PKT_SAMPLE_RATE_VALUECONFIG_RAW_TX_PKT_SAMPLE_RATE_FLAGS and CONFIG_RAW_TX_PKT_SAMPLE_QUEUE_NUM to 4, 3, 3. Then we should have enough bandwidth and also our packets shouldn't so often be blocked by other wi-fi traffic in the air, but it doesn't seem to change anything.

Is there a working sample somewhere that can be used to measure the possible sending rates with raw packet injection?

  • Hi, 

    I then recompile it by with 4 ms inter-frame delay. Then it works for a short while, then it starts logging:

    I tested building with this command, but cannot reproduce the issue. 

    west build -p -b nrf7002dk/nrf5340/cpuapp nrf/samples/wifi/raw_tx_packet -- -DCONFIG_RAW_TX_PKT_SAMPLE_NON_CONNECTED_MODE=y -DCONFIG_RAW_TX_PKT_SAMPLE_TX_MODE_CONTINUOUS=y -DCONFIG_RAW_TX_PKT_SAMPLE_INTER_FRAME_DELAY_MS=4

    Could you try to erase the DK before programming(west flash --recover)?

    Regards,
    Amanda H.

  • That's strange. I removed the build dir, built it with your command line from above and flashed it with recover.
    Got the same result:
    ```
    [00:00:00.493,438] <inf> wifi_nrf: Configuring SLEEP CTRL GPIO control register

    *** Booting nRF Connect SDK v3.0.2-89ba1294ac9b ***
    *** Using Zephyr OS v4.0.99-f791c49f492c ***
    [00:00:00.518,707] <inf> net_config: Initializing network
    [00:00:00.518,707] <inf> net_config: Waiting interface 1 (0x200011f0) to be up...
    [00:00:00.518,890] <inf> net_config: IPv4 address: 192.168.1.99
    [00:00:00.518,920] <inf> net_config: Running dhcpv4 client...
    [00:00:00.520,202] <inf> wifi_supplicant: wpa_supplicant initialized
    [00:00:00.522,033] <inf> raw_tx_packet: TX Injection mode enabled
    [00:00:00.526,306] <inf> raw_tx_packet: Wi-Fi channel set to 1
    [00:00:00.526,397] <inf> raw_tx_packet: Sending raw tx packets continuously
    [00:01:22.612,640] <err> net_ctx: Failed to allocate net_pkt
    [00:01:22.612,701] <err> raw_tx_packet: Unable to send beacon frame: No buffer space available
    [00:01:23.616,912] <err> net_ctx: Failed to allocate net_pkt
    [00:01:23.616,943] <err> raw_tx_packet: Unable to send beacon frame: No buffer space available
    ```

    Sometimes it happens faster, sometimes slower. I'd guess if the radio channel is used when it tries to send the packets, it happens faster.

Related