Provide a direct entry point for IP input. This actually results

in a slight decrease in performance, but will lead to better
performance later.
This commit is contained in:
Garrett Wollman 1996-02-05 20:36:02 +00:00
parent 5eb1d25adb
commit c67b1d17da
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=13929
2 changed files with 34 additions and 26 deletions

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)in_var.h 8.2 (Berkeley) 1/9/95
* $Id: in_var.h,v 1.14 1996/01/03 20:24:33 wollman Exp $
* $Id: in_var.h,v 1.15 1996/01/09 08:26:07 davidg Exp $
*/
#ifndef _NETINET_IN_VAR_H_
@ -228,6 +228,7 @@ struct in_multi *in_addmulti __P((struct in_addr *, struct ifnet *));
void in_delmulti __P((struct in_multi *));
int in_control __P((struct socket *, u_long, caddr_t, struct ifnet *));
void in_rtqdrain __P((void));
void ip_input __P((struct mbuf *));
#endif /* KERNEL */

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)ip_input.c 8.2 (Berkeley) 1/4/94
* $Id: ip_input.c,v 1.33 1995/12/21 21:12:22 wollman Exp $
* $Id: ip_input.c,v 1.34 1996/01/05 20:46:53 wollman Exp $
*/
#include <sys/param.h>
@ -163,25 +163,14 @@ static struct route ipforward_rt;
* Ip input routine. Checksum and byte swap header. If fragmented
* try to reassemble. Process options. Pass to next level.
*/
static void
ipintr(void)
void
ip_input(struct mbuf *m)
{
register struct ip *ip;
register struct mbuf *m;
register struct ipq *fp;
register struct in_ifaddr *ia;
int hlen, s;
next:
/*
* Get next datagram off input queue and get IP header
* in first mbuf.
*/
s = splimp();
IF_DEQUEUE(&ipintrq, m);
splx(s);
if (m == 0)
return;
#ifdef DIAGNOSTIC
if ((m->m_flags & M_PKTHDR) == 0)
panic("ipintr no HDR");
@ -196,7 +185,7 @@ ipintr(void)
if (m->m_len < sizeof (struct ip) &&
(m = m_pullup(m, sizeof (struct ip))) == 0) {
ipstat.ips_toosmall++;
goto next;
return;
}
ip = mtod(m, struct ip *);
if (ip->ip_v != IPVERSION) {
@ -211,7 +200,7 @@ ipintr(void)
if (hlen > m->m_len) {
if ((m = m_pullup(m, hlen)) == 0) {
ipstat.ips_badhlen++;
goto next;
return;
}
ip = mtod(m, struct ip *);
}
@ -261,7 +250,7 @@ ipintr(void)
if (ip_fw_chk_ptr!=NULL)
if (!(*ip_fw_chk_ptr)(m,ip,m->m_pkthdr.rcvif,ip_fw_chain) ) {
goto next;
return;
}
/*
@ -272,7 +261,7 @@ ipintr(void)
*/
ip_nhops = 0; /* for source routed packets */
if (hlen > sizeof (struct ip) && ip_dooptions(m))
goto next;
return;
/* greedy RSVP, snatches any PATH packet of the RSVP protocol and no
* matter if it is destined to another node, or whether it is
@ -333,7 +322,7 @@ ipintr(void)
if (ip_mforward(ip, m->m_pkthdr.rcvif, m, 0) != 0) {
ipstat.ips_cantforward++;
m_freem(m);
goto next;
return;
}
ip->ip_id = ntohs(ip->ip_id);
@ -354,7 +343,7 @@ ipintr(void)
if (inm == NULL) {
ipstat.ips_cantforward++;
m_freem(m);
goto next;
return;
}
goto ours;
}
@ -371,7 +360,7 @@ ipintr(void)
m_freem(m);
} else
ip_forward(m, 0);
goto next;
return;
ours:
@ -396,7 +385,7 @@ ipintr(void)
if (m->m_flags & M_EXT) { /* XXX */
if ((m = m_pullup(m, sizeof (struct ip))) == 0) {
ipstat.ips_toosmall++;
goto next;
return;
}
ip = mtod(m, struct ip *);
}
@ -433,7 +422,7 @@ ipintr(void)
ipstat.ips_fragments++;
ip = ip_reass((struct ipasfrag *)ip, fp);
if (ip == 0)
goto next;
return;
ipstat.ips_reassembled++;
m = dtom(ip);
} else
@ -447,10 +436,28 @@ ipintr(void)
*/
ipstat.ips_delivered++;
(*inetsw[ip_protox[ip->ip_p]].pr_input)(m, hlen);
goto next;
return;
bad:
m_freem(m);
goto next;
}
/*
* IP software interrupt routine - to go away sometime soon
*/
static void
ipintr(void)
{
int s;
struct mbuf *m;
while(1) {
s = splimp();
IF_DEQUEUE(&ipintrq, m);
splx(s);
if (m == 0)
return;
ip_input(m);
}
}
NETISR_SET(NETISR_IP, ipintr);