summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authormlaier <mlaier@FreeBSD.org>2004-06-15 23:57:42 +0000
committermlaier <mlaier@FreeBSD.org>2004-06-15 23:57:42 +0000
commit02300f227ffc4cadfc19d925b489f443132b1376 (patch)
treed5efbd7578982ffd4278b8857f7acb6969a2ffa2 /sys
parentefc9e973bf86814f88bf2b016d7b3d6d866fb32d (diff)
downloadFreeBSD-src-02300f227ffc4cadfc19d925b489f443132b1376.zip
FreeBSD-src-02300f227ffc4cadfc19d925b489f443132b1376.tar.gz
Replace IF_HANDOFF with new IFQ_HANDOFF to enqueue with ALTQ once enabled on
the respective drivers.
Diffstat (limited to 'sys')
-rw-r--r--sys/net/bridge.c7
-rw-r--r--sys/net/if_arcsubr.c5
-rw-r--r--sys/net/if_ef.c4
-rw-r--r--sys/net/if_ethersubr.c4
-rw-r--r--sys/net/if_fddisubr.c6
-rw-r--r--sys/net/if_fwsubr.c6
-rw-r--r--sys/net/if_iso88025subr.c5
-rw-r--r--sys/net/if_sl.c13
-rw-r--r--sys/net/if_spppsubr.c15
-rw-r--r--sys/net/if_tun.c5
-rw-r--r--sys/net/if_vlan.c4
11 files changed, 45 insertions, 29 deletions
diff --git a/sys/net/bridge.c b/sys/net/bridge.c
index 3b16a89..b6583a9 100644
--- a/sys/net/bridge.c
+++ b/sys/net/bridge.c
@@ -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 @@ forward:
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 @@ forward:
} 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++;
diff --git a/sys/net/if_arcsubr.c b/sys/net/if_arcsubr.c
index e1bf2db..a4a487e 100644
--- a/sys/net/if_arcsubr.c
+++ b/sys/net/if_arcsubr.c
@@ -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);
diff --git a/sys/net/if_ef.c b/sys/net/if_ef.c
index 05b0ff6..23741d1 100644
--- a/sys/net/if_ef.c
+++ b/sys/net/if_ef.c
@@ -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;
}
diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c
index 6da30d24..073eafb 100644
--- a/sys/net/if_ethersubr.c
+++ b/sys/net/if_ethersubr.c
@@ -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);
}
/*
diff --git a/sys/net/if_fddisubr.c b/sys/net/if_fddisubr.c
index 47bf0c3..a38c1cc 100644
--- a/sys/net/if_fddisubr.c
+++ b/sys/net/if_fddisubr.c
@@ -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:
diff --git a/sys/net/if_fwsubr.c b/sys/net/if_fwsubr.c
index 42f26e6..7232583 100644
--- a/sys/net/if_fwsubr.c
+++ b/sys/net/if_fwsubr.c
@@ -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);
diff --git a/sys/net/if_iso88025subr.c b/sys/net/if_iso88025subr.c
index a34f929..dfe31e2 100644
--- a/sys/net/if_iso88025subr.c
+++ b/sys/net/if_iso88025subr.c
@@ -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);
diff --git a/sys/net/if_sl.c b/sys/net/if_sl.c
index bc35341..5037742 100644
--- a/sys/net/if_sl.c
+++ b/sys/net/if_sl.c
@@ -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);
}
diff --git a/sys/net/if_spppsubr.c b/sys/net/if_spppsubr.c
index 66b6412..d086f14 100644
--- a/sys/net/if_spppsubr.c
+++ b/sys/net/if_spppsubr.c
@@ -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);
diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c
index 65618a5..90eafeb 100644
--- a/sys/net/if_tun.c
+++ b/sys/net/if_tun.c
@@ -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);
}
diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c
index 0290042..f9c22d2 100644
--- a/sys/net/if_vlan.c
+++ b/sys/net/if_vlan.c
@@ -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++;
OpenPOWER on IntegriCloud