On 04/06/19(Tue) 01:37, Alexandr Nedvedicky wrote:
> Hello,
> 
> diff below is just cosmetic change, which has no impact on current
> functionality, because there is just single network task to deliver packets to
> IP stack. I just want to push this small change to tree to minimize delta
> between current and my experimental branch.

But why is it fine?  Is it because the read version of the netlock is
enough to protect the packet processing path?  Or is it because it
guarantees that no ioctl will be executed in the meantime?  And why do
we need that?  To parallelise the packet processing path?

ok mpi@ :)

> --------8<---------------8<---------------8<------------------8<--------
> diff --git a/sys/net/if.c b/sys/net/if.c
> index e355f44e80d..15b5f94f188 100644
> --- a/sys/net/if.c
> +++ b/sys/net/if.c
> @@ -976,14 +976,14 @@ if_netisr(void *unused)
>  {
>       int n, t = 0;
>  
> -     NET_LOCK();
> +     NET_RLOCK();
>  
>       while ((n = netisr) != 0) {
>               /* Like sched_pause() but with a rwlock dance. */
>               if (curcpu()->ci_schedstate.spc_schedflags & SPCF_SHOULDYIELD) {
> -                     NET_UNLOCK();
> +                     NET_RUNLOCK();
>                       yield();
> -                     NET_LOCK();
> +                     NET_RLOCK();
>               }
>  
>               atomic_clearbits_int(&netisr, n);
> @@ -1044,7 +1044,7 @@ if_netisr(void *unused)
>       }
>  #endif
>  
> -     NET_UNLOCK();
> +     NET_RUNLOCK();
>  }
>  
>  void
> 

Reply via email to