From e06d282190d99f999b890405da28f39cd5dcdffb Mon Sep 17 00:00:00 2001 From: Adam Sampson Date: Sat, 11 Aug 2018 15:35:23 +0100 Subject: [PATCH] WIP: Strip out a lot of tracing. --- src/system/ether.1 | 74 +++++----------------------------------------- src/system/tcp.275 | 49 ++---------------------------- 2 files changed, 10 insertions(+), 113 deletions(-) diff --git a/src/system/ether.1 b/src/system/ether.1 index 68a69eee..773a68a9 100644 --- a/src/system/ether.1 +++ b/src/system/ether.1 @@ -98,12 +98,10 @@ BBLK ETHRX: MOVEI TT,ETHHBF ;Unpack Ethernet header into ETHHBF HRL TT,R BLTUB TT, - BUG INFO,[RX packet length ],OCT,I,[ ptr ],OCT,R SUBI I,%NEH"LENGTH ;I now contains data length ADDI R,%NEH"WORDS ;R points to data LDB A,[%NEH"TYPE+ETHHBF] - ;BUG INFO,[etype=],OCT,A CAIN A,%NETYP"IP JRST ETHRXI CAIN A,%NETYP"ARP @@ -113,8 +111,7 @@ ETHRX: MOVEI TT,ETHHBF ;Unpack Ethernet header into ETHHBF ;Process an ARP packet. ; -ETHRXA: ;BUG INFO,[ARP length ],OCT,I - CAIGE I,%NEAH"LENGTH ;Check size first +ETHRXA: CAIGE I,%NEAH"LENGTH ;Check size first JRST ETHRAS MOVEI TT,ETHABF ;Unpack packet into ETHABF @@ -137,14 +134,12 @@ ETHRXA: ;BUG INFO,[ARP length ],OCT,I LSH A,16. LDB B,[%NEAH"SPA1+ETHABF] IOR A,B - ;BUG INFO,[ARP source addr ],OCT,A ;FIXME "Search the ARP table for X" should be a routine MOVE E,ETHATS ;Is the IP address in the table already? SOS E ETHRX1: JUMPL E,ETHRX2 ;Any more entries to check? LDB B,[%NEAT"PA+ETHAT(E)] - ;BUG INFO,[ARP table entry ],OCT,E,[ of ],OCT,ETHATS,[ is ],OCT,B CAMN A,B ;Match? JRST ETHRX3 ; Yes - update it SOJA E,ETHRX1 ;Prev entry @@ -162,10 +157,8 @@ ETHRX3: DPB A,[%NEAT"PA+ETHAT(E)] ;Store IP address LDB D,[%NEAH"SHA2+ETHABF] DPB C,[%NEAT"HA01+ETHAT(E)] ;Store MAC DPB D,[%NEAT"HA2+ETHAT(E)] - BUG INFO,[Set ARP table entry ],OCT,E,[ to ip ],OCT,A,[ mac ],OCT,C,[ ],OCT,D LDB E,[%NEAH"OP+ETHABF] ;Get op - ;BUG INFO,[ARP op ],OCT,E CAIE E,%NEAOP"REQ ;Is this a request? POPJ P, ;No - nothing more to do @@ -173,7 +166,6 @@ ETHRX3: DPB A,[%NEAT"PA+ETHAT(E)] ;Store IP address CAME B,[ETHUS] ;Is it our address? POPJ P, ;No - nothing more to do - ;BUG INFO,[ARP reply] MOVEI E,%NEAOP"REPLY ;Construct reply packet DPB E,[%NEAH"OP+ETHABF] DPB A,[%NEAH"TPA+ETHABF] ;Set sender PA as target PA @@ -217,12 +209,10 @@ ETHRXI: PUSH P,Q ;IP can clobber all of these... ADDI A,3 LSH A,-2 MOVE C,A - ;BUG INFO,[IP ipgipt A=],OCT,A PUSHJ P,IPGIPT ;Get IP buffer -> A=datagram struct JRST ETHRX5 ; No buffers MOVE B,PK.BUF(A) ;IPGIPT does return this, but in BLKI form... - BUG INFO,[IP rx allocated A=],OCT,A,[ B=],OCT,B HRL B,R ADDI C,-1(B) BLTUB B,(C) ;Copy packet @@ -232,8 +222,6 @@ ETHRXI: PUSH P,Q ;IP can clobber all of these... SETZM J ;Host table index of address (not used) PUSHJ P,IPRDGM - ;BUG INFO,[IP rdgm done] - ETHRX5: POP P,H POP P,W POP P,R @@ -256,7 +244,6 @@ ETHTXI: ; Search the ARP table for the destination address. MOVE C,PK.DST(A) - BUG INFO,[ethtxi A=],OCT,A,[ dest=],OCT,C ;FIXME would this loop (and at ETHRX1) be simpler with AOBJN? MOVE E,ETHATS @@ -317,7 +304,6 @@ ETHTX3: ;Found MAC in ARP table ; Found the destination address in the ARP table. Send it! LDB C,[%NEAT"HA01+ETHAT(E)] LDB D,[%NEAT"HA2+ETHAT(E)] - BUG INFO,[found MAC in ARP table ],OCT,C,[ ],OCT,D MOVE E,C LSH C,16. DPB C,[%NEH"DMAC0+ETHHBF] @@ -356,10 +342,8 @@ ETHTX5: POP P,T ;Skip-returns on success; normal return on failure. ; ;FIXME IFN UNAP,... -ETHTX: BUG INFO,[ethtx ptr ],OCT,R,[ len ],OCT,I - PUSHJ P,UNAFF ;Find a free transmit buffer +ETHTX: PUSHJ P,UNAFF ;Find a free transmit buffer POPJ P, ;None left. Fail. - ;BUG INFO,[ethtx buf ],OCT,B,[ desc ],OCT,D,[ len ],OCT,I MOVE TT,B ;Convert header HRLI TT,ETHHBF @@ -373,11 +357,9 @@ ETHTX: BUG INFO,[ethtx ptr ],OCT,R,[ len ],OCT,I LSH A,-2 ADD A,B MOVE C,TT ;XXX - ;BUG INFO,[ethtx data bltbu tt ],OCT,C,[ a ],OCT,A BLTBU TT,(A) ADDI I,%NEH"LENGTH-%NEH"PAD ;Add length of header - BUG INFO,[ethtx end desc ],OCT,D,[ len ],OCT,I AOS (P) ;Success - skip return JRST UNATX ;Transmit it @@ -428,32 +410,6 @@ UNPGHK: BLOCK 2000*%UNNPG BBLK -;BUG INFO the UNA's registers. -UNREGS: PUSH P,A - PUSH P,B - PUSH P,C - PUSH P,D - IORDI A,%UNR0 - IORDI B,%UNR1 - IORDI C,%UNR2 - IORDI D,%UNR3 - BUG INFO,[UNA PCSR0=],OCT,A,[ PCSR1=],OCT,B,[ PCSR2=],OCT,C,[ PCSR3=],OCT,D - POP P,D -UNR3: POP P,C - POP P,B - POP P,A - POPJ P, - -;BUG INFO the PCB. -UNDPCB: PUSH P,A - PUSH P,B - PUSH P,C - MOVE A,UNPAGS - MOVE B,0(A) - MOVE C,1(A) - BUG INFO,[UNA PCB:],OCT,B,[ ],OCT,C - JRST UNR3 - ;Initialise the DEUNA. ; UNAINI: MOVEI D,%UNNPG-1 @@ -522,7 +478,6 @@ IFE 0,[ MOVEM TT,0(A) MOVEI A,%UNCMD"GETCMD PUSHJ P,UNACMD - PUSHJ P,UNDPCB ;Show results MOVEI TT,ETHHBF ;Unpack MAC address into ETHHBF HRL TT,UNPAGS BLTUB TT,ETHHBF+1 @@ -531,10 +486,8 @@ IFE 0,[ LSH A,16. ILDB B,TT IOR A,B - ;BUG INFO,[my MAC 01 =],OCT,A DPB A,[%NEAT"HA01+ETHME] ILDB A,TT - ;BUG INFO,[my MAC 2 =],OCT,A DPB A,[%NEAT"HA2+ETHME] ;Set up transmit and receive rings @@ -558,19 +511,16 @@ UNAIN2: MOVE TT,C ;Work out index into UNPAGS/UNPAGU ADDI A,1000 HRRM A,UNTXRP(C) ;Data pointer MOVE A,UNTXRP(C) - ;BUG INFO,[ring],OCT,C,[ptr],OCT,A MOVSI A,%UNBSZ ;SLEN (only used for recv) HRR A,B ;SEGB low bits MOVEM A,0(D) - ;BUG INFO,[t/rdr ],OCT,C,[ at ],OCT,D,[ 0/1 = ],OCT,A LSH B,-16. ;SEGB high bits CAIL C,%UNNTB ;in the receive ring? IORI B,%UNTD"OWN ; yes - give this buffer to DEUNA HRLZS B ;zero other flags MOVEM B,1(D) - ;BUG INFO,[t/rdr ],OCT,C,[ at ],OCT,D,[ 2/3 = ],OCT,B ADDI D,2 ;Next descriptor AOS C ;Next buffer @@ -588,21 +538,18 @@ UNAIN2: MOVE TT,C ;Work out index into UNPAGS/UNPAGU LSH B,-16. IOR A,B ;TDRB high bits MOVEM A,0(D) ;Store word 0/1 - ;BUG INFO,[rdf 0/1 =],OCT,A MOVSI A,%UNNTB ;TRLEN HLRZ B,UNPAGU ;Get Unibus address of RDR ADDI B,%UNRDR HRR A,B ;RDRB low bits MOVEM A,1(D) ;Store word 2/3 - ;BUG INFO,[rdf 2/3 =],OCT,A LSH B,-16. ;RDRB high bits IORI B,<4_8> ;RELEN HRLZS B IORI B,%UNNRB ;RRLEN MOVEM B,2(D) ;Store word 4/5 - ;BUG INFO,[rdf 4/5 =],OCT,B MOVEI A,%UNCMD"GETCMD PUSHJ P,UNACMD @@ -611,8 +558,8 @@ UNAIN2: MOVE TT,C ;Work out index into UNPAGS/UNPAGU MOVEI A,%UNCMD"START PUSHJ P,UNACMD - BUG INFO,[DEUNA setup done] - MOVEI A,CPOPJ ;Reset UNADNI behaviour + ; We don't need to do anything special on interrupts any more. + MOVEI A,CPOPJ MOVEM A,UNADNI POPJ P, @@ -655,7 +602,6 @@ UNABRK: 0 JSR UTCSAV IORDI H,%UNR0 ;Read status - ;BUG INFO,[DEUNA interrupt, PCSR0=],OCT,H,[ UNADNI=],OCT,UNADNI TRNE H,%UN0"SERI+%UN0"PCEI+%UN0"FATL+%UN0"USCI BUG HALT,[DEUNA error, PCSR0=],OCT,H ;FIXME do something better! @@ -696,7 +642,6 @@ UNARX1: HRRZ A,W ;Wrap index around HRRZ I,UNRXRP(W) ;XXX unibus MOVE Q,1(J) ;Is there a packet in this buffer? (OWN=0) - BUG INFO,[rx check buffer J=],OCT,J,[ unibus ],OCT,I,[ flags Q=],OCT,Q TLNE Q,%UNTD"OWN JRST [ SKIPGE UNRXRI ;No. First empty buffer we've found? HRRZM W,UNRXRI ; Yes, start here next time @@ -714,11 +659,9 @@ UNARX1: HRRZ A,W ;Wrap index around SUBI I,4 ;Ignore CRC at end PUSHJ P,ETHRX - BUG INFO,[rx after ethrx buffer J=],OCT,J,[ flags Q=],OCT,Q - -UNARX3: TLO Q,%UNTD"OWN ;Set OWN=1 to mark as free +UNARX3: + TLO Q,%UNTD"OWN ;Set OWN=1 to mark as free MOVEM Q,1(J) - BUG INFO,[rx set own=1 for ],OCT,J SKIPE UNARCB ;Have we had an RCB interrupt? JRST [ SETZM UNARCB ;Yes. Tell the DEUNA there's a free buffer now. @@ -752,7 +695,6 @@ UNAFF1: HRRZ A,E ;Wrap index around HLRZ D,UNTXRP(E) ;Descriptor MOVE A,1(D) ;Is this buffer free? (OWN=0) - ;BUG INFO,[unaff checking slot ],OCT,E,[ status ],OCT,A TLNE A,%UNTD"OWN JRST [ AOBJN E,UNAFF1 ;Try the next one POPJ P,] ;No buffers free. @@ -761,7 +703,6 @@ UNAFF1: HRRZ A,E ;Wrap index around AOS UNTXRI ; (Doesn't matter if it wraps.) HRRZ B,UNTXRP(E) ;Buffer - ;BUG INFO,[unaff found free buffer ],OCT,E,[ desc ],OCT,D,[ buff ],OCT,B AOS (P) ;Skip return POPJ P, @@ -769,8 +710,7 @@ UNAFF1: HRRZ A,E ;Wrap index around ;Descriptor in D, data length in bytes in I. ;Clobbers A. ; -UNATX: ;BUG INFO,[unatx desc ],OCT,D,[ length ],OCT,I - HRLM I,0(D) ;Set SLEN +UNATX: HRLM I,0(D) ;Set SLEN MOVSI A,%UNTD"OWN+%UNTD"STF+%UNTD"ENF IORM A,1(D) ;Set flags diff --git a/src/system/tcp.275 b/src/system/tcp.275 index c9cc1fec..1cb2afbd 100755 --- a/src/system/tcp.275 +++ b/src/system/tcp.275 @@ -1094,13 +1094,6 @@ SUBTTL TCP Main Program Output TCPW: MOVEI A,CHRKT METER("TCP: syscal out") HLRZ I,(R) ; Get TCB index from IOCHNM wd - PUSH P,D - PUSH P,E - MOVE D,XBORTL(I) - UMOVE E,(C) ;XXX user's count - BUG INFO,[tcpw TCB index=],OCT,I,[ count=],OCT,E,[ rtq len=],OCT,D - POP P,E - POP P,D ; Verify state, do misc setup for writing, lock segment. CONO PI,NETOFF @@ -2066,7 +2059,6 @@ SUBTTL TCP Input Interrupt Level %TSIFL==4 ; Bad seq, flush after handling RST/ACK/URG TCPIS: METER("TCP: Segs rcvd") - BUG INFO,[tcpis] SKIPN TCPUP ; Unless TCP claims to be up, JRST TSIFL ; Throw it away, no TCP yet, sigh. @@ -2074,7 +2066,6 @@ TCPIS: METER("TCP: Segs rcvd") ; checksumming it (sigh!). TT gets total # bytes in TCP segment. CALL THCKSI ; Get checksum in A for segment LDB B,[TH$CKS (H)] ; Get segment's checksum - BUG INFO,[tcpis csum=],OCT,B,[ exp=],OCT,A CAME A,B ; Should match. JRST TSIF01 ; Failed, go bump err count and flush it. LDB T,[TH$THL (H)] ; Find TCP header length in words @@ -2104,7 +2095,6 @@ TSI02: CAMN A,XBPORT(I) ; Loop til we find it CAME B,XBHOST(I) TSI03: AOBJN I,TSI02 JUMPL I,TSI05 ; Jump if found existing connection - BUG INFO,[tsi03 no existing conn] JRST TSISQ ; Jump if no existing connection. TSI04: SKIPE XBSTAT(I) ; Found "closed" connection???? @@ -2118,7 +2108,6 @@ TSI04: SKIPE XBSTAT(I) ; Found "closed" connection???? TSI05: DPB I,[PK$TCB (R)] ; Store TCB index in packet info MOVEM J,XBNADR(I) ; Save host-table idx of addr this seg is from. HRRZ J,XBSTAT(I) ; Get connection state - BUG INFO,[tcpis conn exists, TCB index=],OCT,I,[ state=],OCT,J CAIL J,.XSTOT ; Highest possible state. BUG HALT,[TCP: Bad conn state] METER("TCP: IS all states") @@ -2140,7 +2129,6 @@ TSI05: DPB I,[PK$TCB (R)] ; Store TCB index in packet info ; end of seg is out of window. It should simply ; expand the window! LDB D,[TH$SEQ (H)] ; Get sequence number - BUG INFO,[tcpis seq number=],OCT,D JUMPG TT,TSI10 ; Jump if data present. JUMPL TT,TSIF03 ; No data. Jump if error (neg data!) @@ -2313,10 +2301,7 @@ TSI53: LDB A,[TH$ACK (H)] ; Get ACK field ; Handle ACK while in open state (also other receive-OK states) TSI54: LDB A,[TH$ACK (H)] ; Get ACK field - MOVE B,XBSNXT(I) ;XXX - BUG INFO,[tsi54 nxt (=<)],OCT,B MOVE B,XBSUNA(I) ; Need one CMPSEQ arg in AC - BUG INFO,[tsi54 ack in open state ACK=],OCT,A,[ una (=<)],OCT,B ; Test: snd.una =< seg.ack =< snd.nxt ; If seg.ack < snd.una, go to TSI60 and ignore the ACK. ; If seg.ack > snd.nxt, go to TSISAK to drop segment (ACKing) @@ -2324,7 +2309,6 @@ TSI54: LDB A,[TH$ACK (H)] ; Get ACK field ; ACK is fine. Update SND.UNA and clean up retransmit queue. TSI54X: MOVEM A,XBSUNA(I) ; Update snd.una - BUG INFO,[tsi54x ack fine] ; Must check retransmit queue slowly to find right place to flush, ; if any. @@ -2438,8 +2422,7 @@ TSI57: CAIN J,.XSOPN ; Skip other checks if state is OPEN (normal) ; Check the URG bit. The only states which get to this ; point are OPEN, FIN-WAIT-1, and FIN-WAIT-2. -TSI60: BUG INFO,[tsi60 check urg bits=],OCT,E - TLNN E,(TC%URG) ; Segment has urgent pointer set? +TSI60: TLNN E,(TC%URG) ; Segment has urgent pointer set? JRST TSI70 ; Nope, on to next step. LDB A,[TH$UP (H)] ; Get SEG.UP (urgent ptr from segment) @@ -2452,7 +2435,6 @@ TSI70: TRNE E,%TSIFL ; If segment being flushed after ACK/URG, JRST TSIF70 ; flush it now! LDB A,[PK$TDL (R)] ; Find # bytes of real data in segment - BUG INFO,[tsi70 data bytes=],OCT,A JUMPLE A,TSI80 ; If none, no text processing. TLNE E,(TC%FIN) ; Check that # bytes data == seg.len @@ -2615,42 +2597,30 @@ XSMTRS: OFFSET -. TSIF01: METER("TCP: ISeg cksm errs ") - BUG INFO,[fls cksm err] JRST TSIFL TSIF02: METER("TCP: IS zero port/addr") - BUG INFO,[fls zero port] JRST TSIFL TSIF03: METER("TCP: IS fl neg data") - BUG INFO,[fls neg data] JRST TSIFL ;TSIF10: ; Flush this later (retain til get new .METER LIST) METER("TCP: IS fls Seq # err") - BUG INFO,[fls seq # err] JRST TSIFL TSIF50: METER("TCP: IS fls Seq no ACK ") - BUG INFO,[fls seq no ack] JRST TSIFL TSIF55: METER("TCP: IS fls CLO & FIN not ACKed") - BUG INFO,[fls clo fna] JRST TSIFL TSIF56: METER("TCP: IS fls CLA & FIN not ACKed") - BUG INFO,[fls cla fna] JRST TSIFL TSIF70: METER("TCP: IS fls seqerr processed A/U/R") - BUG INFO,[fls seqerr] JRST TSISNE ; Go respond with ACK TSIF80: METER("TCP: IS fls FINchk state") - BUG INFO,[fls finchk] JRST TSIFL TSIF2A: METER("TCP: IS fls random RST") - BUG INFO,[fls random rst] JRST TSIFL TSIF2B: METER("TCP: IS fls Fresh SYN already on SYNQ") - BUG INFO,[fls fresh syn] JRST TSIFL TSIF90: METER("TCP: IS fls processed seg") - BUG INFO,[fls processed] JRST TSIFL ; Come here to flush the datagram/segment and return. @@ -2691,8 +2661,7 @@ TSOACK: MOVSI T,(TC%ACK) ; Send an ACK immediately ; (1) see if it matches any wild listens; if so, process. ; (2) see if it's OK to start up a server for it; if so, process. -TSISQ: BUG INFO,[tsisq flags=],OCT,E - TLNE E,(TC%RST) ; If it has RST set, +TSISQ: TLNE E,(TC%RST) ; If it has RST set, JRST TSIF2A ; Go drop it quietly. TLNE E,(TC%ACK) ; If ACK, can't be a valid request either JRST TSISAR ; Go send a RST in response (with SEQ=SEG.ACK) @@ -3246,10 +3215,6 @@ TSOSND: MOVSI T,(TC%ACK) ; Simple data segment ; IP$PTC - Protocol number (needn't set, assumes %PTCTC always) TSOSN: METER("TCP: Out segs") - PUSH P,A - MOVE A,TT - BUG INFO,[tsosn index=],OCT,I,[ sending bytes=],OCT,A - POP P,A AND T,[TH%CTL] ; Ensure non-flag bits are flushed. MOVE A,T ANDCAB A,XBSTAT(I) ; Turn off these request bits @@ -3325,10 +3290,6 @@ TSOSN2: LDB A,[PK$TDO (R)] ; Bytes of header ADD TT,XBSNXT(I) ; Get new SND.NXT TLZ TT,%MOD32 MOVEM TT,XBSNXT(I) - PUSH P,A - MOVE A,TT - BUG INFO,[tsosn new snd.nxt=],OCT,A - POP P,A SKIPN XBORTT(I) ; Retrans timeout already set? JRST [ MOVE A,TIME ADD A,TCPTMO ; Make it 5 sec for now. @@ -3341,11 +3302,7 @@ TSOSN2: LDB A,[PK$TDO (R)] ; Bytes of header CALL PKQPL(PK.TCP) ; Put on TCP retrans queue AOS XBORTL(I) ; Bump count of segs on queue -TSOSN8: PUSH P,A - MOVE A,XBORTL(I) - BUG INFO,[tsosn8 sending index=],OCT,I,[ rtq len=],OCT,A - POP P,A - CALL IPKSND ; Put on IP output queue +TSOSN8: CALL IPKSND ; Put on IP output queue RET SUBTTL TCP Retransmit and Timeout