netdev/upper: Fix wrong CPU when RSS is disabled
Some checks failed
Build Documentation / build-html (push) Has been cancelled

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 <wengzhe@xiaomi.com>
This commit is contained in:
Zhe Weng 2024-12-24 20:14:20 +08:00 committed by Xiang Xiao
parent 233e175f28
commit 286de7df01

View file

@ -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; FAR struct netdev_upperhalf_s *upper = dev->d_private;
#ifdef CONFIG_NETDEV_WORK_THREAD #ifdef CONFIG_NETDEV_WORK_THREAD
# ifdef CONFIG_NETDEV_RSS
int cpu = this_cpu(); int cpu = this_cpu();
# else
const int cpu = 0;
# endif
int semcount; int semcount;
if (nxsem_get_value(&upper->sem[cpu], &semcount) == OK && if (nxsem_get_value(&upper->sem[cpu], &semcount) == OK &&