From 4857f5fbbc95def5402ca6176dc605cf9e698519 Mon Sep 17 00:00:00 2001 From: "George V. Neville-Neil" Date: Mon, 18 Nov 2013 22:58:14 +0000 Subject: [PATCH] Allow ethernet drivers to pass in packets connected via the nextpkt pointer. Handling packets in this way allows drivers to amortize work during packet reception. Submitted by: Vijay Singh Sponsored by: NetApp --- sys/net/if_ethersubr.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index c4a9125c9f4..04b94defc95 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -708,13 +708,25 @@ static void ether_input(struct ifnet *ifp, struct mbuf *m) { - /* - * We will rely on rcvif being set properly in the deferred context, - * so assert it is correct here. - */ - KASSERT(m->m_pkthdr.rcvif == ifp, ("%s: ifnet mismatch", __func__)); + struct mbuf *mn; - netisr_dispatch(NETISR_ETHER, m); + /* + * The drivers are allowed to pass in a chain of packets linked with + * m_nextpkt. We split them up into separate packets here and pass + * them up. This allows the drivers to amortize the receive lock. + */ + while (m) { + mn = m->m_nextpkt; + m->m_nextpkt = NULL; + + /* + * We will rely on rcvif being set properly in the deferred context, + * so assert it is correct here. + */ + KASSERT(m->m_pkthdr.rcvif == ifp, ("%s: ifnet mismatch", __func__)); + netisr_dispatch(NETISR_ETHER, m); + m = mn; + } } /*