[net v1] net: wwan: t7xx: Fix napi rx poll issue

Jinjian Song jinjian.song at fibocom.com
Tue May 20 00:05:34 PDT 2025


>On Fri, 16 May 2025 15:30:38 +0800 Jinjian Song wrote:
>> It seems that a judgment is made every time ccmni_inst[x] is used in the driver,
>> and the synchronization on the 2 way might have been done when NAPI triggers
>> polling by napi_schedule and when WWAN trigger dellink. 
>
>Synchronization is about ensuring that the condition validating
>by the if() remains true for as long as necessary.
>You need to wrap the read with READ_ONCE() and write with WRITE_ONCE().
>The rest if fine because netdev unregister sync against NAPIs in flight.
>

Hi Jakub,
  I think I got your point.
  I can use the atomic_t usage in struct t7xx_ccmni to synchronization.
  
  static void t7xx_ccmni_wwan_dellink(...) {

  [...]

  if (WARN_ON(ctlb->ccmni_inst[if_id] != ccmni))
    return;

  unregister_netdevice(dev);

  //Add here use this variable(ccmnii->usage) to synchronization

  if (atomic_read(&ccmni->usage) == 0)
     ccmni == NULL;

  }

  How about this modify?

Thanks.

Jinjian,
Best Regards.



More information about the Linux-mediatek mailing list