Skip to content

Commit

Permalink
Using MIPS_GCC_PREFIX as a path and prefix for gcc/as/ld.
Browse files Browse the repository at this point in the history
Fully disable TCP tracing when TCPDEBUG option not present.
NFS option cleanup.
  • Loading branch information
Sergey committed Apr 28, 2014
1 parent 030bc65 commit b38aad7
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 54 deletions.
16 changes: 8 additions & 8 deletions share/mk-pic32/bsd.lib.mk
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,18 @@ LDCROSS?= -mips32r2 -EL -nostdlib
nroff -man ${.IMPSRC} > ${.TARGET}

.c.o:
${MIPS_TOOLCHAIN}${CC} ${CCROSS} ${CFLAGS} -c ${.IMPSRC}
${MIPS_GCC_PREFIX}${CC} ${CCROSS} ${CFLAGS} -c ${.IMPSRC}

.c.po:
${MIPS_TOOLCHAIN}${CC} ${CCROSS} -p ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
${MIPS_GCC_PREFIX}${CC} ${CCROSS} -p ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET}

.s.o:
${CPP} -E ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} | \
${MIPS_TOOLCHAIN}${AS} -o ${.TARGET}
${MIPS_GCC_PREFIX}${AS} -o ${.TARGET}

.s.po:
${CPP} -E -DPROF ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} | \
${MIPS_TOOLCHAIN}${AS} -o ${.TARGET}
${MIPS_GCC_PREFIX}${AS} -o ${.TARGET}

MANALL= ${MAN1} ${MAN2} ${MAN3} ${MAN4} ${MAN5} ${MAN6} ${MAN7} ${MAN8}
manpages: ${MANALL}
Expand All @@ -61,15 +61,15 @@ OBJS+= ${SRCS:R:S/$/.o/g}
lib${LIB}.a:: ${OBJS}
@echo building standard ${LIB} library
@rm -f lib${LIB}.a
@${MIPS_TOOLCHAIN}${AR} cTq lib${LIB}.a `lorder ${OBJS} | tsort` ${LDADD}
${MIPS_TOOLCHAIN}ranlib lib${LIB}.a
@${MIPS_GCC_PREFIX}${AR} cTq lib${LIB}.a `lorder ${OBJS} | tsort` ${LDADD}
${MIPS_GCC_PREFIX}ranlib lib${LIB}.a

POBJS+= ${OBJS:.o=.po}
lib${LIB}_p.a:: ${POBJS}
@echo building profiled ${LIB} library
@rm -f lib${LIB}_p.a
@${MIPS_TOOLCHAIN}${AR} cTq lib${LIB}_p.a `lorder ${POBJS} | tsort` ${LDADD}
${MIPS_TOOLCHAIN}ranlib lib${LIB}_p.a
@${MIPS_GCC_PREFIX}${AR} cTq lib${LIB}_p.a `lorder ${POBJS} | tsort` ${LDADD}
${MIPS_GCC_PREFIX}ranlib lib${LIB}_p.a

llib-l${LIB}.ln: ${SRCS}
${LINT} -C${LIB} ${CFLAGS} ${.ALLSRC:M*.c}
Expand Down
10 changes: 5 additions & 5 deletions sys/mips/conf/Makefile.pic32
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@

# DEBUG is set to -g by config if debugging is requested (config -g).
# PROF is set to -pg by config if profiling is requested (config -p).
AS= ${MIPS_TOOLCHAIN}as ${DEBUG}
CC= ${MIPS_TOOLCHAIN}gcc ${DEBUG} -fno-builtin
AS= ${MIPS_GCC_PREFIX}as ${DEBUG}
CC= ${MIPS_GCC_PREFIX}gcc ${DEBUG} -fno-builtin
LOCALCC= gcc -m32 ${DEBUG}
CPP= cpp
LD= ${MIPS_TOOLCHAIN}gcc
LD= ${MIPS_GCC_PREFIX}gcc
LDFLAGS= -nostdlib -T $A/pic32/bootloader-max32.ld -Wl,-Map=unix.map
SIZE= ${MIPS_TOOLCHAIN}size
SIZE= ${MIPS_GCC_PREFIX}size

# source tree is located via $S relative to the compilation directory
S= ../..
Expand Down Expand Up @@ -66,7 +66,7 @@ SYSTEM_DEP= Makefile ${SYSTEM_OBJ} $S/libkern/libkern.a
SYSTEM_LD_HEAD= rm -f $@
SYSTEM_LD= -@echo ${LD} ${LDFLAGS} '$${SYSTEM_OBJ}' vers.o -L$S/libkern -lkern -o vmunix; \
${LD} ${LDFLAGS} ${SYSTEM_OBJ} vers.o -L$S/libkern -lkern -o vmunix
SYSTEM_LD_TAIL= chmod 755 $@; ${SIZE} $@
SYSTEM_LD_TAIL= ${SIZE} $@

%LOAD

Expand Down
8 changes: 4 additions & 4 deletions sys/mips/conf/Makefile.pmax
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@

# DEBUG is set to -g by config if debugging is requested (config -g).
# PROF is set to -pg by config if profiling is requested (config -p).
AS= ${MIPS_TOOLCHAIN}as ${DEBUG}
CC= ${MIPS_TOOLCHAIN}gcc ${DEBUG} -fno-builtin
AS= ${MIPS_GCC_PREFIX}as ${DEBUG}
CC= ${MIPS_GCC_PREFIX}gcc ${DEBUG} -fno-builtin
LOCALCC= gcc -m32 ${DEBUG}
CPP= cpp
LD= ${MIPS_TOOLCHAIN}gcc
LD= ${MIPS_GCC_PREFIX}gcc
LDFLAGS= -nostdlib -T $A/pmax/pmax.ld -Wl,-Map=unix.map
SIZE= ${MIPS_TOOLCHAIN}size
SIZE= ${MIPS_GCC_PREFIX}size

# source tree is located via $S relative to the compilation directory
S= ../..
Expand Down
12 changes: 7 additions & 5 deletions sys/netinet/tcp_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
#define TCPSTATES
#define TCPTIMERS
#define TANAMES
#endif

#include <sys/param.h>
#include <sys/systm.h>
Expand All @@ -65,9 +64,12 @@
#include <netinet/tcpip.h>
#include <netinet/tcp_debug.h>

#ifdef TCPDEBUG
#define TCP_NDEBUG 100
struct tcp_debug tcp_debug[TCP_NDEBUG];
int tcp_debx;

int tcpconsdebug = 0;
#endif

/*
* Tcp debug routines
*/
Expand Down Expand Up @@ -97,7 +99,7 @@ tcp_trace(act, ostate, tp, ti, req)
else
bzero((caddr_t)&td->td_ti, sizeof (*ti));
td->td_req = req;
#ifdef TCPDEBUG

if (tcpconsdebug == 0)
return;
if (tp)
Expand Down Expand Up @@ -155,5 +157,5 @@ tcp_trace(act, ostate, tp, ti, req)
tp->snd_max);
printf("\tsnd_(wl1,wl2,wnd) (%x,%x,%x)\n",
tp->snd_wl1, tp->snd_wl2, tp->snd_wnd);
#endif /* TCPDEBUG */
}
#endif /* TCPDEBUG */
4 changes: 0 additions & 4 deletions sys/netinet/tcp_debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,3 @@ struct tcp_debug {
char *tanames[] =
{ "input", "output", "user", "respond", "drop" };
#endif

#define TCP_NDEBUG 100
struct tcp_debug tcp_debug[TCP_NDEBUG];
int tcp_debx;
37 changes: 20 additions & 17 deletions sys/netinet/tcp_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ tcp_input(m, iphlen)
}
optlen = off - sizeof (struct tcphdr);
optp = mtod(m, u_char *) + sizeof (struct tcpiphdr);
/*
/*
* Do quick retrieval of timestamp options ("options
* prediction?"). If timestamp is the only option and it's
* formatted as recommended in RFC 1323 appendix A, we
Expand Down Expand Up @@ -341,7 +341,7 @@ tcp_input(m, iphlen)
goto dropwithreset;
if (tp->t_state == TCPS_CLOSED)
goto drop;

/* Unscale the window into a 32-bit value. */
if ((tiflags & TH_SYN) == 0)
tiwin = ti->ti_win << tp->snd_scale;
Expand Down Expand Up @@ -413,7 +413,7 @@ tcp_input(m, iphlen)
tcp_dooptions(tp, optp, optlen, ti,
&ts_present, &ts_val, &ts_ecr);

/*
/*
* Header prediction: check for the two common cases
* of a uni-directional data xfer. If the packet has
* no control flags, is in-sequence, the window didn't
Expand All @@ -434,7 +434,7 @@ tcp_input(m, iphlen)
tiwin && tiwin == tp->snd_wnd &&
tp->snd_nxt == tp->snd_max) {

/*
/*
* If last ACK falls within this segment's sequence numbers,
* record the timestamp.
*/
Expand Down Expand Up @@ -685,10 +685,10 @@ tcp_input(m, iphlen)
/*
* States other than LISTEN or SYN_SENT.
* First check timestamp, if present.
* Then check that at least some bytes of segment are within
* Then check that at least some bytes of segment are within
* receive window. If segment begins before rcv_nxt,
* drop leading data (and SYN); if nothing left, just ack.
*
*
* RFC 1323 PAWS: If we have a timestamp reply on this segment
* and it's less than ts_recent, drop it.
*/
Expand Down Expand Up @@ -722,7 +722,7 @@ tcp_input(m, iphlen)
if (tiflags & TH_SYN) {
tiflags &= ~TH_SYN;
ti->ti_seq++;
if (ti->ti_urp > 1)
if (ti->ti_urp > 1)
ti->ti_urp--;
else
tiflags &= ~TH_URG;
Expand Down Expand Up @@ -884,7 +884,7 @@ tcp_input(m, iphlen)
*/
if ((tiflags & TH_ACK) == 0)
goto drop;

/*
* Ack processing.
*/
Expand Down Expand Up @@ -950,7 +950,7 @@ tcp_input(m, iphlen)
* the new ssthresh).
*
* Dup acks mean that packets have left the
* network (they're now cached at the receiver)
* network (they're now cached at the receiver)
* so bump cwnd by the amount in the receiver
* to keep a constant cwnd packets in the
* network.
Expand Down Expand Up @@ -1161,14 +1161,14 @@ tcp_input(m, iphlen)
* If this segment advances the known urgent pointer,
* then mark the data stream. This should not happen
* in CLOSE_WAIT, CLOSING, LAST_ACK or TIME_WAIT STATES since
* a FIN has been received from the remote side.
* a FIN has been received from the remote side.
* In these states we ignore the URG.
*
* According to RFC961 (Assigned Protocols),
* the urgent pointer points to the last octet
* of urgent data. We continue, however,
* to consider it to indicate the first octet
* of data past the urgent section as the original
* of data past the urgent section as the original
* spec states (in one of two places).
*/
if (SEQ_GT(ti->ti_seq+ti->ti_urp, tp->rcv_up)) {
Expand Down Expand Up @@ -1255,7 +1255,7 @@ tcp_input(m, iphlen)

/*
* In FIN_WAIT_2 state enter the TIME_WAIT state,
* starting the time-wait timer, turning off the other
* starting the time-wait timer, turning off the other
* standard timers.
*/
case TCPS_FIN_WAIT_2:
Expand All @@ -1273,9 +1273,10 @@ tcp_input(m, iphlen)
break;
}
}
#ifdef TCPDEBUG
if (so->so_options & SO_DEBUG)
tcp_trace(TA_INPUT, ostate, tp, &tcp_saveti, 0);

#endif
/*
* Return any desired output.
*/
Expand Down Expand Up @@ -1321,8 +1322,10 @@ tcp_input(m, iphlen)
/*
* Drop space held by incoming segment and return.
*/
#ifdef TCPDEBUG
if (tp && (tp->t_inpcb->inp_socket->so_options & SO_DEBUG))
tcp_trace(TA_DROP, ostate, tp, &tcp_saveti, 0);
#endif
m_freem(m);
/* destroy temporarily created socket */
if (dropsocket)
Expand Down Expand Up @@ -1387,7 +1390,7 @@ tcp_dooptions(tp, cp, cnt, ti, ts_present, ts_val, ts_ecr)
bcopy((char *)cp + 6, (char *) ts_ecr, sizeof(*ts_ecr));
NTOHL(*ts_ecr);

/*
/*
* A timestamp received in a SYN makes
* it ok to send timestamp requests and replies.
*/
Expand All @@ -1414,7 +1417,7 @@ tcp_pulloutofband(so, ti, m)
register struct mbuf *m;
{
int cnt = ti->ti_urp - 1;

while (cnt >= 0) {
if (m->m_len > cnt) {
char *cp = mtod(m, caddr_t) + cnt;
Expand Down Expand Up @@ -1473,7 +1476,7 @@ tcp_xmit_timer(tp, rtt)
if ((tp->t_rttvar += delta) <= 0)
tp->t_rttvar = 1;
} else {
/*
/*
* No rtt measurement yet - use the unsmoothed rtt.
* Set the variance to half the rtt (so our first
* retransmit happens at 3*rtt).
Expand All @@ -1497,7 +1500,7 @@ tcp_xmit_timer(tp, rtt)
*/
TCPT_RANGESET(tp->t_rxtcur, TCP_REXMTVAL(tp),
tp->t_rttmin, TCPTV_REXMTMAX);

/*
* We received an ack for a packet that wasn't retransmitted;
* it is probably safe to discard any error indications we've
Expand Down
19 changes: 10 additions & 9 deletions sys/netinet/tcp_output.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ tcp_output(tp)
* window, then want to send a window update to peer.
*/
if (win > 0) {
/*
/*
* "adv" is the amount we can increase the window,
* taking into account that we are limited by
* TCP_MAXWIN << tp->rcv_scale.
Expand Down Expand Up @@ -280,7 +280,7 @@ tcp_output(tp)
mss = htons((u_short) tcp_mss(tp, 0));
bcopy((caddr_t)&mss, (caddr_t)(opt + 2), sizeof(mss));
optlen = 4;

if ((tp->t_flags & TF_REQ_SCALE) &&
((flags & TH_ACK) == 0 ||
(tp->t_flags & TF_RCVD_SCALE))) {
Expand All @@ -293,9 +293,9 @@ tcp_output(tp)
}
}
}

/*
* Send a timestamp and echo-reply if this is a SYN and our side
* Send a timestamp and echo-reply if this is a SYN and our side
* wants to use timestamps (TF_REQ_TSTMP is set) or both our side
* and our peer have sent timestamps in our SYN's.
*/
Expand All @@ -304,7 +304,7 @@ tcp_output(tp)
((flags & (TH_SYN|TH_ACK)) == TH_SYN ||
(tp->t_flags & TF_RCVD_TSTMP))) {
u_long *lp = (u_long *)(opt + optlen);

/* Form timestamp option as shown in appendix A of RFC 1323. */
*lp++ = htonl(TCPOPT_TSTAMP_HDR);
*lp++ = htonl(tcp_now);
Expand All @@ -313,7 +313,7 @@ tcp_output(tp)
}

hdrlen += optlen;

/*
* Adjust data length if insertion of options will
* bump the packet length beyond the t_maxseg length.
Expand Down Expand Up @@ -414,7 +414,7 @@ tcp_output(tp)
* window for use in delaying messages about window sizes.
* If resending a FIN, be sure not to use a new sequence number.
*/
if (flags & TH_FIN && tp->t_flags & TF_SENTFIN &&
if (flags & TH_FIN && tp->t_flags & TF_SENTFIN &&
tp->snd_nxt == tp->snd_max)
tp->snd_nxt--;
/*
Expand Down Expand Up @@ -527,9 +527,10 @@ tcp_output(tp)
/*
* Trace.
*/
#ifdef TCPDEBUG
if (so->so_options & SO_DEBUG)
tcp_trace(TA_OUTPUT, tp->t_state, tp, ti, 0);

#endif
/*
* Fill in IP length and desired time to live and
* send to IP level. There should be a better way
Expand All @@ -550,7 +551,7 @@ tcp_output(tp)
error = ip_output(m, tp->t_inpcb->inp_options, &tp->t_inpcb->inp_route,
so->so_options & SO_DONTROUTE, 0);
#else
error = ip_output(m, (struct mbuf *)0, &tp->t_inpcb->inp_route,
error = ip_output(m, (struct mbuf *)0, &tp->t_inpcb->inp_route,
so->so_options & SO_DONTROUTE);
#endif
}
Expand Down
2 changes: 2 additions & 0 deletions sys/netinet/tcp_usrreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -339,8 +339,10 @@ tcp_usrreq(so, req, m, nam, control)
default:
panic("tcp_usrreq");
}
#ifdef TCPDEBUG
if (tp && (so->so_options & SO_DEBUG))
tcp_trace(TA_USER, ostate, tp, (struct tcpiphdr *)0, req);
#endif
splx(s);
return (error);
}
Expand Down
3 changes: 1 addition & 2 deletions sys/vm/vnode_pager.c
Original file line number Diff line number Diff line change
Expand Up @@ -465,8 +465,7 @@ vnode_pager_uncache(vp)
if (vp->v_type != VREG || (pager = (vm_pager_t)vp->v_vmdata) == NULL)
return (TRUE);
#ifdef DEBUG
#include "nfs.h"
#if NNFS > 0
#ifdef NFS
if (!VOP_ISLOCKED(vp)) {
extern int (**nfsv2_vnodeop_p)();

Expand Down

0 comments on commit b38aad7

Please sign in to comment.