This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 286de7df01 netdev/upper: Fix wrong CPU when RSS is disabled
286de7df01 is described below
commit 286de7df0120a7250ffc642d3dc77909b0daae7e
Author: Zhe Weng <[email protected]>
AuthorDate: Tue Dec 24 20:14:20 2024 +0800
netdev/upper: Fix wrong CPU when RSS is disabled
When `CONFIG_NETDEV_RSS` is disabled, `NETDEV_THREAD_COUNT` will be 1,
and we should not access `upper->sem[cpu]` with `cpu > 0`.
Signed-off-by: Zhe Weng <[email protected]>
---
drivers/net/netdev_upperhalf.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/net/netdev_upperhalf.c b/drivers/net/netdev_upperhalf.c
index 98d8f0bf88..ec51c71b10 100644
--- a/drivers/net/netdev_upperhalf.c
+++ b/drivers/net/netdev_upperhalf.c
@@ -754,7 +754,11 @@ static inline void netdev_upper_queue_work(FAR struct
net_driver_s *dev)
FAR struct netdev_upperhalf_s *upper = dev->d_private;
#ifdef CONFIG_NETDEV_WORK_THREAD
+# ifdef CONFIG_NETDEV_RSS
int cpu = this_cpu();
+# else
+ const int cpu = 0;
+# endif
int semcount;
if (nxsem_get_value(&upper->sem[cpu], &semcount) == OK &&