tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: MCLGETI in if_msk.c
Hi Christos!
> Sent: Friday, October 27, 2017 at 1:58 PM
> From: "Christos Zoulas" <christos%astron.com@localhost>
> To: tech-kern%netbsd.org@localhost
> Subject: Re: MCLGETI in if_msk.c
>
[...]
>
> OpenBSD:
> m = MCLGETI(NULL, M_DONTWAIT, NULL, MCLBYTES);
> if (m == NULL)
> goto fail;
> NetBSD:
> MGETHDR(m, M_DONTWAIT, MT_DATA);
> if (m == NULL)
> goto fail;
> MCLGET(m, M_DONTWAIT);
> if (m->m_flags & M_EXT) == 0) {
> m_freem(m);
> goto fail;
> }
I didn't paste the whole OpenBSD code of rev. 1.72, but it is exactly:
MGETHDR(m, M_DONTWAIT, MT_DATA);
if (m == NULL)
return (ENOBUFS);
MCLGETI(m, M_DONTWAIT, &sc_if->arpcom.ac_if, sc_if->sk_pktlen);
if ((m->m_flags & M_EXT) == 0) {
m_freem(m);
return (ENOBUFS);
}
IIUC, I'll simply leave the MGETHDR part unchanged, and I'll replace the
MCLGETI call with the `MCLGET(m, M_DONTWAIT)' call you suggested.
> It is not such a big deal :-)
At a first glance, it seemed to the unexperienced me :D
> Or if you want to allocate a size other
> than MCLBYTES (I am not sure if that works, perhaps we need a different
> pool), use:
> _MCLGET(m, mcl_cache, size, M_DONTWAIT)
>
> It is ~trivial to add the macro in <sys/mbuf.h> and since we are porting
> too many OpenBSD drivers, perhaps we should. But this should be discussed
> in tech-net.
It can be surely considered. As a side note, I suggest that also the MCLGETI
declared twice in `src/sys/dev/ic/arn5008.c' and `src/sys/dev/ic/arn9003.c',
and also in `src/sys/dev/pci/if_iwn.c' can be re-arranged.
Thank you,
Rocky
>
> christos
>
>
Home |
Main Index |
Thread Index |
Old Index