openbsd_network: Add a real implementation of MCLGETL.

The old alias had a number of shortcomings which made it not match
OpenBSD and thus special-casing had to be used in drivers. The new
version should match OpenBSD's semantics precisely.
This commit is contained in:
Augustin Cavalier 2022-09-29 22:50:39 -04:00
parent 5613c37e66
commit 5b51027ca5
3 changed files with 9 additions and 9 deletions

View File

@ -5681,11 +5681,7 @@ iwx_send_cmd(struct iwx_softc *sc, struct iwx_host_cmd *hcmd)
err = EINVAL;
goto out;
}
#ifdef __FreeBSD_version
m = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, IWX_RBUF_SIZE);
#else
m = MCLGETL(NULL, M_DONTWAIT, totlen);
#endif
if (m == NULL) {
printf("%s: could not get fw cmd mbuf (%zd bytes)\n",
DEVNAME(sc), totlen);

View File

@ -6366,11 +6366,7 @@ iwm_send_cmd(struct iwm_softc *sc, struct iwm_host_cmd *hcmd)
err = EINVAL;
goto out;
}
#ifdef __FreeBSD_version
m = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, IWM_RBUF_SIZE);
#else
m = MCLGETL(NULL, M_DONTWAIT, totlen);
#endif
if (m == NULL) {
printf("%s: could not get fw cmd mbuf (%zd bytes)\n",
DEVNAME(sc), totlen);

View File

@ -27,8 +27,16 @@
#define MAXMCLBYTES MJUM16BYTES
#define MCLGETL m_cljget
static struct mbuf*
MCLGETL(struct mbuf* m, int how, int size)
{
if (m == NULL)
return m_get2(size, how, MT_DATA, M_PKTHDR);
m_cljget(m, how, size);
return m;
}
static int
m_dup_pkthdr_openbsd(struct mbuf* to, const struct mbuf* from, int how)