File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -476,20 +476,19 @@ static struct io_zcrx_ifq *io_zcrx_ifq_alloc(struct io_ring_ctx *ctx)
476476
477477 ifq -> if_rxq = -1 ;
478478 ifq -> ctx = ctx ;
479- spin_lock_init (& ifq -> lock );
480479 spin_lock_init (& ifq -> rq_lock );
481480 mutex_init (& ifq -> pp_lock );
482481 return ifq ;
483482}
484483
485484static void io_zcrx_drop_netdev (struct io_zcrx_ifq * ifq )
486485{
487- spin_lock ( & ifq -> lock );
488- if ( ifq -> netdev ) {
489- netdev_put ( ifq -> netdev , & ifq -> netdev_tracker );
490- ifq -> netdev = NULL ;
491- }
492- spin_unlock ( & ifq -> lock ) ;
486+ guard ( mutex )( & ifq -> pp_lock );
487+
488+ if (! ifq -> netdev )
489+ return ;
490+ netdev_put ( ifq -> netdev , & ifq -> netdev_tracker );
491+ ifq -> netdev = NULL ;
493492}
494493
495494static void io_close_queue (struct io_zcrx_ifq * ifq )
@@ -504,11 +503,11 @@ static void io_close_queue(struct io_zcrx_ifq *ifq)
504503 if (ifq -> if_rxq == -1 )
505504 return ;
506505
507- spin_lock ( & ifq -> lock );
508- netdev = ifq -> netdev ;
509- netdev_tracker = ifq -> netdev_tracker ;
510- ifq -> netdev = NULL ;
511- spin_unlock ( & ifq -> lock );
506+ scoped_guard ( mutex , & ifq -> pp_lock ) {
507+ netdev = ifq -> netdev ;
508+ netdev_tracker = ifq -> netdev_tracker ;
509+ ifq -> netdev = NULL ;
510+ }
512511
513512 if (netdev ) {
514513 net_mp_close_rxq (netdev , ifq -> if_rxq , & p );
Original file line number Diff line number Diff line change @@ -53,7 +53,6 @@ struct io_zcrx_ifq {
5353 struct device * dev ;
5454 struct net_device * netdev ;
5555 netdevice_tracker netdev_tracker ;
56- spinlock_t lock ;
5756
5857 /*
5958 * Page pool and net configuration lock, can be taken deeper in the
You can’t perform that action at this time.
0 commit comments