From fe58453891932b6e42539b9971ec882c24140153 Mon Sep 17 00:00:00 2001 From: Dag-Erling Smørgrav Date: Tue, 8 Apr 2003 14:25:47 +0000 Subject: Introduce an M_ASSERTPKTHDR() macro which performs the very common task of asserting that an mbuf has a packet header. Use it instead of hand- rolled versions wherever applicable. Submitted by: Hiten Pandya --- sys/dev/snc/dp83932.c | 4 +--- sys/dev/vx/if_vx.c | 7 ++----- 2 files changed, 3 insertions(+), 8 deletions(-) (limited to 'sys/dev') diff --git a/sys/dev/snc/dp83932.c b/sys/dev/snc/dp83932.c index f0ebae15aeeb..58966eac6803 100644 --- a/sys/dev/snc/dp83932.c +++ b/sys/dev/snc/dp83932.c @@ -345,9 +345,7 @@ outloop: return; /* We need the header for m_pkthdr.len. */ - if ((m->m_flags & M_PKTHDR) == 0) - panic("%s: sncstart: no header mbuf", - device_get_nameunit(sc->sc_dev)); + M_ASSERTPKTHDR(m); /* * If bpf is listening on this interface, let it diff --git a/sys/dev/vx/if_vx.c b/sys/dev/vx/if_vx.c index 143a821e57dd..3106de04e64d 100644 --- a/sys/dev/vx/if_vx.c +++ b/sys/dev/vx/if_vx.c @@ -400,12 +400,9 @@ vxstart(ifp) startagain: /* Sneak a peek at the next packet */ m = ifp->if_snd.ifq_head; - if (m == NULL) { - return; - } + /* We need to use m->m_pkthdr.len, so require the header */ - if ((m->m_flags & M_PKTHDR) == 0) - panic("vxstart: no header mbuf"); + M_ASSERTPKTHDR(m); len = m->m_pkthdr.len; pad = (4 - len) & 3; -- cgit v1.3