Skip to content

Commit 286de7d

Browse files
wengzhexiaoxiang781216
authored andcommitted
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]>
1 parent 233e175 commit 286de7d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/net/netdev_upperhalf.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,11 @@ static inline void netdev_upper_queue_work(FAR struct net_driver_s *dev)
754754
FAR struct netdev_upperhalf_s *upper = dev->d_private;
755755

756756
#ifdef CONFIG_NETDEV_WORK_THREAD
757+
# ifdef CONFIG_NETDEV_RSS
757758
int cpu = this_cpu();
759+
# else
760+
const int cpu = 0;
761+
# endif
758762
int semcount;
759763

760764
if (nxsem_get_value(&upper->sem[cpu], &semcount) == OK &&

0 commit comments

Comments
 (0)