On 03/11/15(Tue) 16:17, David Gwynne wrote:
> ml_purge returns how many mbufs they freed, so we can decrement the
> la_hold_total with that instead of inside an ml_dequeue/m_freem
> loop.
> 
> ok?

ok mpi@

> 
> Index: netinet/if_ether.c
> ===================================================================
> RCS file: /cvs/src/sys/netinet/if_ether.c,v
> retrieving revision 1.182
> diff -u -p -r1.182 if_ether.c
> --- netinet/if_ether.c        2 Nov 2015 15:05:23 -0000       1.182
> +++ netinet/if_ether.c        3 Nov 2015 06:15:03 -0000
> @@ -141,7 +141,6 @@ arp_rtrequest(struct ifnet *ifp, int req
>       struct sockaddr *gate = rt->rt_gateway;
>       struct llinfo_arp *la = (struct llinfo_arp *)rt->rt_llinfo;
>       struct ifaddr *ifa;
> -     struct mbuf *m;
>  
>       if (!arpinit_done) {
>               static struct timeout arptimer_to;
> @@ -243,10 +242,7 @@ arp_rtrequest(struct ifnet *ifp, int req
>               LIST_REMOVE(la, la_list);
>               rt->rt_llinfo = 0;
>               rt->rt_flags &= ~RTF_LLINFO;
> -             while ((m = ml_dequeue(&la->la_ml)) != NULL) {
> -                     la_hold_total--;
> -                     m_freem(m);
> -             }
> +             la_hold_total -= ml_purge(&la->la_ml);
>               pool_put(&arp_pool, la);
>       }
>  }
> @@ -395,10 +391,7 @@ arpresolve(struct ifnet *ifp, struct rte
>               ml_enqueue(&la->la_ml, m);
>               la_hold_total++;
>       } else {
> -             while ((mh = ml_dequeue(&la->la_ml)) != NULL) {
> -                     la_hold_total--;
> -                     m_freem(mh);
> -             }
> +             la_hold_total -= ml_purge(&la->la_ml);
>               m_freem(m);
>       }
>  
> @@ -431,10 +424,7 @@ arpresolve(struct ifnet *ifp, struct rte
>                               rt->rt_flags |= RTF_REJECT;
>                               rt->rt_expire += arpt_down;
>                               la->la_asked = 0;
> -                             while ((mh = ml_dequeue(&la->la_ml)) != NULL) {
> -                                     la_hold_total--;
> -                                     m_freem(mh);
> -                             }
> +                             la_hold_total -= ml_purge(&la->la_ml);
>                       }
>               }
>       }

Reply via email to