Skip to content

Commit

Permalink
netdev/upper: Fix wrong CPU when RSS is disabled
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
wengzhe authored and xiaoxiang781216 committed Dec 28, 2024
1 parent 498c594 commit c331bb9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/net/netdev_upperhalf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 &&
Expand Down

0 comments on commit c331bb9

Please sign in to comment.