mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-10-18 14:49:54 +08:00
Update to FreeBSD head 2016-08-23
Git mirror commit 9fe7c416e6abb28b1398fd3e5687099846800cfd.
This commit is contained in:
@@ -107,6 +107,7 @@
|
||||
#include <machine/bus.h>
|
||||
|
||||
#include <net/if.h>
|
||||
#include <net/if_var.h>
|
||||
#include <net/if_types.h>
|
||||
#include <net/netisr.h>
|
||||
#include <net/route.h>
|
||||
@@ -918,7 +919,7 @@ pppsioctl(struct ifnet *ifp, ioctl_command_t cmd, caddr_t data)
|
||||
* Packet is placed in Information field of PPP frame.
|
||||
*/
|
||||
int
|
||||
pppoutput(struct ifnet *ifp, struct mbuf *m0, struct sockaddr *dst,
|
||||
pppoutput(struct ifnet *ifp, struct mbuf *m0, const struct sockaddr *dst,
|
||||
struct route *rtp)
|
||||
{
|
||||
register struct ppp_softc *sc = ifp->if_softc;
|
||||
@@ -987,7 +988,7 @@ pppoutput(struct ifnet *ifp, struct mbuf *m0, struct sockaddr *dst,
|
||||
* (This assumes M_LEADINGSPACE is always 0 for a cluster mbuf.)
|
||||
*/
|
||||
if (M_LEADINGSPACE(m0) < PPP_HDRLEN) {
|
||||
m0 = m_prepend(m0, PPP_HDRLEN, M_DONTWAIT);
|
||||
m0 = m_prepend(m0, PPP_HDRLEN, M_NOWAIT);
|
||||
if (m0 == 0) {
|
||||
error = ENOBUFS;
|
||||
goto bad;
|
||||
@@ -1063,9 +1064,9 @@ pppoutput(struct ifnet *ifp, struct mbuf *m0, struct sockaddr *dst,
|
||||
} else {
|
||||
ifq = (m0->m_flags & M_HIGHPRI)? &sc->sc_fastq: &ifp->if_snd;
|
||||
if (_IF_QFULL(ifq) && dst->sa_family != AF_UNSPEC) {
|
||||
IFQ_INC_DROPS(ifq);
|
||||
if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1);
|
||||
splx(s);
|
||||
sc->sc_ifp->if_oerrors++;
|
||||
if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
|
||||
sc->sc_stats.ppp_oerrors++;
|
||||
error = ENOBUFS;
|
||||
goto bad;
|
||||
@@ -1074,8 +1075,8 @@ pppoutput(struct ifnet *ifp, struct mbuf *m0, struct sockaddr *dst,
|
||||
(*sc->sc_start)(sc);
|
||||
}
|
||||
ifp->if_lastchange = ppp_time;
|
||||
ifp->if_opackets++;
|
||||
ifp->if_obytes += len;
|
||||
if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
|
||||
if_inc_counter(ifp, IFCOUNTER_OBYTES, len);
|
||||
|
||||
splx(s);
|
||||
return (0);
|
||||
@@ -1115,8 +1116,8 @@ ppp_requeue(struct ppp_softc *sc)
|
||||
m->m_nextpkt = NULL;
|
||||
ifq = (m->m_flags & M_HIGHPRI)? &sc->sc_fastq: &sc->sc_ifp->if_snd;
|
||||
if (_IF_QFULL(ifq)) {
|
||||
IFQ_INC_DROPS(ifq);
|
||||
sc->sc_ifp->if_oerrors++;
|
||||
if_inc_counter(sc->sc_ifp, IFCOUNTER_OQDROPS, 1);
|
||||
if_inc_counter(sc->sc_ifp, IFCOUNTER_OERRORS, 1);
|
||||
sc->sc_stats.ppp_oerrors++;
|
||||
} else
|
||||
IF_ENQUEUE(ifq, m);
|
||||
@@ -1517,13 +1518,13 @@ ppp_inproc(struct ppp_softc *sc, struct mbuf *m)
|
||||
}
|
||||
|
||||
/* Copy the PPP and IP headers into a new mbuf. */
|
||||
MGETHDR(mp, M_DONTWAIT, MT_DATA);
|
||||
MGETHDR(mp, M_NOWAIT, MT_DATA);
|
||||
if (mp == NULL)
|
||||
goto bad;
|
||||
mp->m_len = 0;
|
||||
mp->m_next = NULL;
|
||||
if (hlen + PPP_HDRLEN > MHLEN) {
|
||||
MCLGET(mp, M_DONTWAIT);
|
||||
MCLGET(mp, M_NOWAIT);
|
||||
if (M_TRAILINGSPACE(mp) < hlen + PPP_HDRLEN) {
|
||||
m_freem(mp);
|
||||
goto bad; /* lose if big headers and no clusters */
|
||||
@@ -1581,7 +1582,7 @@ ppp_inproc(struct ppp_softc *sc, struct mbuf *m)
|
||||
* whole cluster on it.
|
||||
*/
|
||||
if (ilen <= MHLEN && M_IS_CLUSTER(m)) {
|
||||
MGETHDR(mp, M_DONTWAIT, MT_DATA);
|
||||
MGETHDR(mp, M_NOWAIT, MT_DATA);
|
||||
if (mp != NULL) {
|
||||
m_copydata(m, 0, ilen, mtod(mp, caddr_t));
|
||||
/* instead of freeing - return cluster mbuf so it can be reused */
|
||||
@@ -1661,11 +1662,10 @@ ppp_inproc(struct ppp_softc *sc, struct mbuf *m)
|
||||
*/
|
||||
s = splimp();
|
||||
if (_IF_QFULL(inq)) {
|
||||
IFQ_INC_DROPS(inq);
|
||||
splx(s);
|
||||
if (sc->sc_flags & SC_DEBUG)
|
||||
printf("ppp%d: input queue full\n", ppp_unit(sc));
|
||||
ifp->if_iqdrops++;
|
||||
if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1);
|
||||
goto bad;
|
||||
}
|
||||
IF_ENQUEUE(inq, m);
|
||||
@@ -1674,8 +1674,8 @@ ppp_inproc(struct ppp_softc *sc, struct mbuf *m)
|
||||
break;
|
||||
}
|
||||
|
||||
ifp->if_ipackets++;
|
||||
ifp->if_ibytes += ilen;
|
||||
if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1);
|
||||
if_inc_counter(ifp, IFCOUNTER_IBYTES, ilen);
|
||||
microtime(&ppp_time);
|
||||
ifp->if_lastchange = ppp_time;
|
||||
|
||||
@@ -1687,7 +1687,7 @@ ppp_inproc(struct ppp_softc *sc, struct mbuf *m)
|
||||
|
||||
bad:
|
||||
m_freem(m);
|
||||
sc->sc_ifp->if_ierrors++;
|
||||
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
|
||||
sc->sc_stats.ppp_ierrors++;
|
||||
return mf;
|
||||
}
|
||||
|
@@ -131,8 +131,8 @@ struct ppp_softc {
|
||||
|
||||
struct ppp_softc *pppalloc(pid_t pid);
|
||||
void pppdealloc(struct ppp_softc *sc);
|
||||
int pppoutput(struct ifnet *, struct mbuf *,
|
||||
struct sockaddr *, struct route *);
|
||||
int pppoutput(struct ifnet *, struct mbuf *, const struct sockaddr *,
|
||||
struct route *);
|
||||
int pppioctl(struct ppp_softc *sc, ioctl_command_t cmd, caddr_t data,
|
||||
int flag, struct proc *p);
|
||||
struct mbuf *ppp_dequeue(struct ppp_softc *sc);
|
||||
|
@@ -377,14 +377,14 @@ pppwrite(struct rtems_termios_tty *tty, rtems_libio_rw_args_t *rw_args)
|
||||
struct mbuf **mp;
|
||||
|
||||
for (mp = &m0; maximum; mp = &m->m_next) {
|
||||
MGET(m, M_WAIT, MT_DATA);
|
||||
MGET(m, M_WAITOK, MT_DATA);
|
||||
if ((*mp = m) == NULL) {
|
||||
m_freem(m0);
|
||||
return (ENOBUFS);
|
||||
}
|
||||
m->m_len = 0;
|
||||
if (maximum >= MCLBYTES / 2) {
|
||||
MCLGET(m, M_DONTWAIT);
|
||||
MCLGET(m, M_NOWAIT);
|
||||
}
|
||||
len = M_TRAILINGSPACE(m);
|
||||
if (len > maximum) {
|
||||
@@ -683,11 +683,11 @@ pppgetm(struct ppp_softc *sc)
|
||||
mp = &sc->sc_m;
|
||||
for (len = sc->sc_mru + PPP_HDRLEN + PPP_FCSLEN; len > 0; ){
|
||||
if ((m = *mp) == NULL) {
|
||||
MGETHDR(m, M_DONTWAIT, MT_DATA);
|
||||
MGETHDR(m, M_NOWAIT, MT_DATA);
|
||||
if (m == NULL)
|
||||
break;
|
||||
*mp = m;
|
||||
MCLGET(m, M_DONTWAIT);
|
||||
MCLGET(m, M_NOWAIT);
|
||||
}
|
||||
len -= M_DATASIZE(m);
|
||||
mp = &m->m_next;
|
||||
@@ -708,8 +708,8 @@ pppallocmbuf(struct ppp_softc *sc, struct mbuf **mp)
|
||||
m = *mp;
|
||||
if ( m == NULL ) {
|
||||
/* get mbuf header */
|
||||
MGETHDR(m, M_WAIT, MT_DATA);
|
||||
MCLGET(m, M_WAIT);
|
||||
MGETHDR(m, M_WAITOK, MT_DATA);
|
||||
MCLGET(m, M_WAITOK);
|
||||
*mp = m;
|
||||
}
|
||||
|
||||
@@ -769,7 +769,7 @@ pppinput(int c, struct rtems_termios_tty *tp)
|
||||
sc->sc_flags |= SC_PKTLOST; /* note the dropped packet */
|
||||
if ((sc->sc_flags & (SC_FLUSH | SC_ESCAPED)) == 0){
|
||||
/* bad fcs error */
|
||||
sc->sc_ifp->if_ierrors++;
|
||||
if_inc_counter(sc->sc_ifp, IFCOUNTER_IERRORS, 1);
|
||||
sc->sc_stats.ppp_ierrors++;
|
||||
} else
|
||||
sc->sc_flags &= ~(SC_FLUSH | SC_ESCAPED);
|
||||
@@ -779,7 +779,7 @@ pppinput(int c, struct rtems_termios_tty *tp)
|
||||
if (ilen < PPP_HDRLEN + PPP_FCSLEN) {
|
||||
if (ilen) {
|
||||
/* too short error */
|
||||
sc->sc_ifp->if_ierrors++;
|
||||
if_inc_counter(sc->sc_ifp, IFCOUNTER_IERRORS, 1);
|
||||
sc->sc_stats.ppp_ierrors++;
|
||||
sc->sc_flags |= SC_PKTLOST;
|
||||
}
|
||||
@@ -898,7 +898,7 @@ pppinput(int c, struct rtems_termios_tty *tp)
|
||||
|
||||
flush:
|
||||
if (!(sc->sc_flags & SC_FLUSH)) {
|
||||
sc->sc_ifp->if_ierrors++;
|
||||
if_inc_counter(sc->sc_ifp, IFCOUNTER_IERRORS, 1);
|
||||
sc->sc_stats.ppp_ierrors++;
|
||||
sc->sc_flags |= SC_FLUSH;
|
||||
}
|
||||
|
Reference in New Issue
Block a user