Replace IF_HANDOFF with new IFQ_HANDOFF to enqueue with ALTQ once enabled on

the respective drivers.
This commit is contained in:
Max Laier 2004-06-15 23:57:42 +00:00
parent a8774e396e
commit affc907d0c
11 changed files with 45 additions and 29 deletions

View File

@ -915,6 +915,7 @@ bdg_forward(struct mbuf *m0, struct ifnet *dst)
struct ifnet *src;
struct ifnet *ifp, *last;
int shared = bdg_copy; /* someone else is using the mbuf */
int error;
struct ifnet *real_dst = dst; /* real dst from ether_output */
struct ip_fw_args args;
struct ether_header save_eh;
@ -1131,7 +1132,8 @@ bdg_forward(struct mbuf *m0, struct ifnet *dst)
bdg_dropped++;
return m0; /* the original is still there... */
}
if (IF_HANDOFF(&last->if_snd, m, last))
IFQ_HANDOFF(last, m, error);
if (!error)
BDG_STAT(last, BDG_OUT);
else
bdg_dropped++;
@ -1155,7 +1157,8 @@ bdg_forward(struct mbuf *m0, struct ifnet *dst)
} else { /* consume original */
m = m0, m0 = NULL;
}
if (IF_HANDOFF(&last->if_snd, m, last))
IFQ_HANDOFF(last, m, error);
if (!error)
BDG_STAT(last, BDG_OUT);
else
bdg_dropped++;

View File

@ -238,10 +238,7 @@ arc_output(ifp, m, dst, rt0)
BPF_MTAP(ifp, m);
if (!IF_HANDOFF(&ifp->if_snd, m, ifp)) {
m = 0;
senderr(ENOBUFS);
}
IFQ_HANDOFF(ifp, m, error);
return (error);

View File

@ -215,6 +215,7 @@ ef_start(struct ifnet *ifp)
struct efnet *sc = (struct efnet*)ifp->if_softc;
struct ifnet *p;
struct mbuf *m;
int error;
ifp->if_flags |= IFF_OACTIVE;
p = sc->ef_ifp;
@ -225,7 +226,8 @@ ef_start(struct ifnet *ifp)
if (m == 0)
break;
BPF_MTAP(ifp, m);
if (! IF_HANDOFF(&p->if_snd, m, p)) {
IFQ_HANDOFF(p, m, error);
if (error) {
ifp->if_oerrors++;
continue;
}

View File

@ -337,6 +337,7 @@ int
ether_output_frame(struct ifnet *ifp, struct mbuf *m)
{
struct ip_fw *rule = ip_dn_claim_rule(m);
int error;
if (rule == NULL && BDG_ACTIVE(ifp)) {
/*
@ -364,7 +365,8 @@ ether_output_frame(struct ifnet *ifp, struct mbuf *m)
* Queue message on interface, update output statistics if
* successful, and start output if interface not yet active.
*/
return (IF_HANDOFF(&ifp->if_snd, m, ifp) ? 0 : ENOBUFS);
IFQ_HANDOFF(ifp, m, error);
return (error);
}
/*

View File

@ -334,8 +334,10 @@ fddi_output(ifp, m, dst, rt0)
}
}
if (! IF_HANDOFF(&ifp->if_snd, m, ifp))
senderr(ENOBUFS);
IFQ_HANDOFF(ifp, m, error);
if (error)
ifp->if_oerrors++;
return (error);
bad:

View File

@ -244,7 +244,8 @@ firewire_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
*/
enc->ul[0] = htonl(enc->ul[0]);
return (IF_HANDOFF(&ifp->if_snd, m, ifp) ? 0 : ENOBUFS);
IFQ_HANDOFF(ifp, m, error);
return (error);
} else {
/*
* Fragment the datagram, making sure to leave enough
@ -298,7 +299,8 @@ firewire_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
enc->ul[0] = htonl(enc->ul[0]);
enc->ul[1] = htonl(enc->ul[1]);
if (!IF_HANDOFF(&ifp->if_snd, m, ifp)) {
IFQ_HANDOFF(ifp, m, error);
if (error) {
if (mtail)
m_freem(mtail);
return (ENOBUFS);

View File

@ -430,9 +430,10 @@ iso88025_output(ifp, m, dst, rt0)
}
}
if (! IF_HANDOFF_ADJ(&ifp->if_snd, m, ifp, ISO88025_HDR_LEN + LLC_SNAPFRAMELEN) ) {
IFQ_HANDOFF_ADJ(ifp, m, ISO88025_HDR_LEN + LLC_SNAPFRAMELEN, error);
if (error) {
printf("iso88025_output: packet dropped QFULL.\n");
senderr(ENOBUFS);
ifp->if_oerrors++;
}
return (error);

View File

@ -549,8 +549,7 @@ sloutput(ifp, m, dst, rtp)
{
register struct sl_softc *sc = ifp->if_softc;
register struct ip *ip;
register struct ifqueue *ifq;
int s;
int s, error;
/*
* `Cannot happen' (see slioctl). Someday we will extend
@ -571,15 +570,17 @@ sloutput(ifp, m, dst, rtp)
m_freem(m);
return (EHOSTUNREACH);
}
ifq = (struct ifqueue *)&sc->sc_if.if_snd;
ip = mtod(m, struct ip *);
if (sc->sc_if.if_flags & SC_NOICMP && ip->ip_p == IPPROTO_ICMP) {
m_freem(m);
return (ENETRESET); /* XXX ? */
}
if (ip->ip_tos & IPTOS_LOWDELAY)
ifq = &sc->sc_fastq;
if (! IF_HANDOFF(ifq, m, NULL)) {
if (ip->ip_tos & IPTOS_LOWDELAY &&
!ALTQ_IS_ENABLED(&sc->sc_if.if_snd))
error = !(IF_HANDOFF(&sc->sc_fastq, m, NULL));
else
IFQ_HANDOFF(&sc->sc_if, m, error);
if (error) {
sc->sc_if.if_oerrors++;
return (ENOBUFS);
}

View File

@ -741,7 +741,7 @@ sppp_output(struct ifnet *ifp, struct mbuf *m,
struct sppp *sp = (struct sppp*) ifp;
struct ppp_header *h;
struct ifqueue *ifq = NULL;
int s, rv = 0;
int s, error, rv = 0;
int ipproto = PPP_IP;
int debug = ifp->if_flags & IFF_DEBUG;
@ -781,7 +781,6 @@ sppp_output(struct ifnet *ifp, struct mbuf *m,
s = splimp();
}
ifq = (struct ifqueue *)&ifp->if_snd;
#ifdef INET
if (dst->sa_family == AF_INET) {
/* XXX Check mbuf length here? */
@ -811,9 +810,11 @@ sppp_output(struct ifnet *ifp, struct mbuf *m,
/*
* Put low delay, telnet, rlogin and ftp control packets
* in front of the queue.
* in front of the queue or let ALTQ take care.
*/
if (_IF_QFULL(&sp->pp_fastq))
if (ALTQ_IS_ENABLED(&ifp->if_snd))
;
else if (_IF_QFULL(&sp->pp_fastq))
;
else if (ip->ip_tos & IPTOS_LOWDELAY)
ifq = &sp->pp_fastq;
@ -939,7 +940,11 @@ sppp_output(struct ifnet *ifp, struct mbuf *m,
* Queue message on interface, and start output if interface
* not yet active.
*/
if (! IF_HANDOFF_ADJ(ifq, m, ifp, 3)) {
if (ifq != NULL)
error = !(IF_HANDOFF_ADJ(ifq, m, ifp, 3));
else
IFQ_HANDOFF_ADJ(ifp, m, 3, error);
if (error) {
++ifp->if_oerrors;
splx (s);
return (rv? rv: ENOBUFS);

View File

@ -446,9 +446,7 @@ tunoutput(
{
struct tun_softc *tp = ifp->if_softc;
u_short cached_tun_flags;
#ifdef MAC
int error;
#endif
TUNDEBUG (ifp, "tunoutput\n");
@ -524,7 +522,8 @@ tunoutput(
}
}
if (! IF_HANDOFF(&ifp->if_snd, m0, ifp)) {
IFQ_HANDOFF(ifp, m0, error);
if (error) {
ifp->if_collisions++;
return (ENOBUFS);
}

View File

@ -309,6 +309,7 @@ vlan_start(struct ifnet *ifp)
struct ifnet *p;
struct ether_vlan_header *evl;
struct mbuf *m;
int error;
ifv = ifp->if_softc;
p = ifv->ifv_p;
@ -390,7 +391,8 @@ vlan_start(struct ifnet *ifp)
* Send it, precisely as ether_output() would have.
* We are already running at splimp.
*/
if (IF_HANDOFF(&p->if_snd, m, p))
IFQ_HANDOFF(p, m, error);
if (!error)
ifp->if_opackets++;
else
ifp->if_oerrors++;