-
Notifications
You must be signed in to change notification settings - Fork 2.1k
sys/net/gnrc/netif: hold packets after tx_sync split #21855
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Lukas-Luger
wants to merge
8
commits into
RIOT-OS:master
Choose a base branch
from
Lukas-Luger:pr/legacy-tx_sync
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+115
−5
Open
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
9759f16
tests/net: add tx_sync test for legacy netdevs
Lukas-Luger cc2ef9a
sys/net/gnrc/netif: fix tx_sync by holding after split
Lukas-Luger a071c78
fixup! tests/net: add tx_sync test for legacy netdevs
Lukas-Luger e7bb10b
Update tests/net/gnrc_legacy_tx_sync/main.c
Lukas-Luger 56d8994
Update tests/net/gnrc_legacy_tx_sync/main.c
Lukas-Luger aa9b090
fixup! tests/net: add tx_sync test for legacy netdevs
Lukas-Luger 877b99e
fixup! tests/net: add tx_sync test for legacy netdevs
Lukas-Luger f19ce28
fixup! tests/net: add tx_sync test for legacy netdevs
Lukas-Luger File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| include ../Makefile.net_common | ||
|
|
||
| USEMODULE += netdev_default | ||
| USEMODULE += auto_init_gnrc_netif | ||
| USEMODULE += gnrc_tx_sync | ||
| USEMODULE += gnrc_netif_pktq | ||
| USEMODULE += nrfmin | ||
| USEMODULE += ztimer_sec | ||
|
|
||
| include $(RIOTBASE)/Makefile.include | ||
|
|
||
| CFLAGS += -DDEBUG_ASSERT_VERBOSE=1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,94 @@ | ||
| /* | ||
| * Copyright (C) 2025 Technische Universität Dresden | ||
| * | ||
| * This file is subject to the terms and conditions of the GNU Lesser | ||
| * General Public License v2.1. See the file LICENSE in the top level | ||
| * directory for more details. | ||
| */ | ||
|
|
||
| /** | ||
| * @{ | ||
| * | ||
| * @file | ||
| * @brief Text application for gnrc_legacy_tx_sync | ||
| * | ||
| * @author Lukas Luger <[email protected]> | ||
| * | ||
| * @} | ||
| */ | ||
|
|
||
| #include <stdio.h> | ||
|
|
||
| #include "net/af.h" | ||
| #include "net/gnrc/pktbuf.h" | ||
| #include "net/gnrc/tx_sync.h" | ||
| #include "net/gnrc.h" | ||
| #include "ztimer.h" | ||
| #include "thread.h" | ||
|
|
||
| static char result_thread_stack[THREAD_STACKSIZE_MAIN]; | ||
|
|
||
| static const char test_msg[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTU" | ||
| "VWXYZ0123456789.,:;!?@#$%^&*()[]{}-_=+/<>`~\'\"" | ||
| "\\"; | ||
|
|
||
| void *result_thread(void *arg) | ||
| { | ||
| (void)arg; | ||
| /* Only receiving one message ever */ | ||
| msg_t msg; | ||
| msg_receive(&msg); | ||
| if (msg.content.value) { | ||
| puts("TEST PASSED"); | ||
| } | ||
| else { | ||
| puts("TEST FAILED"); | ||
| } | ||
| return NULL; | ||
| } | ||
|
|
||
| int main(void) | ||
| { | ||
| puts( | ||
| "Test application for gnrc_legacy_tx_sync\n" | ||
| "========================================\n" | ||
| "\n" | ||
| "This application sends a single message over the nrfmin netdev.\n" | ||
| "Other legacy netdevs can be used by changing the board and using\n" | ||
| "a different driver. Note: RIOT will sometimes choose the\n" | ||
| "netdev_ieee802154_submac as default driver which is not legacy.\n" | ||
| "tx_sync will only fail if gnrc_netif_pktq is used with a legacy driver.\n" | ||
| "If tx_sync does not finish in one second, the test will fail.\n" | ||
| ); | ||
|
|
||
| msg_t error_msg = { .content.value = 0 }; | ||
| msg_t success_msg = { .content.value = 1 }; | ||
|
|
||
| /* Preparing the gnrc message */ | ||
| gnrc_netif_t *netif = gnrc_netif_iter(NULL); | ||
| gnrc_pktsnip_t *pkt = gnrc_pktbuf_add(NULL, test_msg, sizeof(test_msg), | ||
| GNRC_NETTYPE_UNDEF); | ||
| gnrc_tx_sync_t tx_sync; | ||
| gnrc_tx_sync_append(pkt, &tx_sync); | ||
|
|
||
| /* Starting the result thread */ | ||
| pid_t pid = thread_create(result_thread_stack, sizeof(result_thread_stack), | ||
| THREAD_PRIORITY_MAIN - 1, 0, result_thread, NULL, | ||
| "result_thread"); | ||
|
|
||
| /* Set timeout message in case tx sync fails */ | ||
| ztimer_t timer; | ||
| ztimer_set_msg(ZTIMER_SEC, &timer, 1, &error_msg, pid); | ||
|
|
||
| /* Sending and waiting */ | ||
| gnrc_netapi_send(netif->pid, pkt); | ||
| gnrc_tx_sync(&tx_sync); | ||
|
|
||
| /* Cancel error message and send success message */ | ||
| if (ztimer_remove(ZTIMER_SEC, &timer)) { | ||
| /* Successfully removed error message, not too late to send success */ | ||
| msg_send(&success_msg, pid); | ||
| } | ||
|
|
||
| return 0; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| #!/usr/bin/env python3 | ||
|
|
||
| # Copyright (C) 2025 Technische Universität Dresden | ||
| # | ||
| # This file is subject to the terms and conditions of the GNU Lesser | ||
| # General Public License v2.1. See the file LICENSE in the top level | ||
| # directory for more details. | ||
|
|
||
| # @author Lukas Luger <[email protected]> | ||
|
|
||
| import sys | ||
| from testrunner import run | ||
|
|
||
|
|
||
| def testfunc(child): | ||
| child.expect("TEST PASSED", timeout=2) | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| sys.exit(run(testfunc)) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.