tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: struct ifnet and ifaddr handling [was: Re: Making global variables of if.c MPSAFE]



On Mon, Nov 17, 2014 at 7:03 PM, Ryota Ozaki <ozaki-r%netbsd.org@localhost> wrote:
> - http://www.netbsd.org/~ozaki-r/psz-ifnet.diff

IFNET_RENTER();
IFNET_FOREACH() {
        if->if_watchdog();
}
IFNET_REXIT();

This is not safe; if_watchdog() may resend packets, too slow operation
to do in critical section.

I think you need to allocate a global array if_watchdog_t
**if_slowtimo_watchdog, like ifindex2ifnet, which grows and can store
pointers of if_watchdog of all interfaces, and do:

IFNET_RENTER();
i = 0;
IFNET_FOREACH() {
        if_slowtimo_watchdog[i++] = if->if_watchdog;
}
IFNET_REXIT();
for (j = 0; j < i; j++) {
        (*(if_slowtimo_watchdog[j]))();
}


Home | Main Index | Thread Index | Old Index