M ip/gre.c => ip/gre.c +1 -1
@@ 94,7 94,7 @@ grestate(Conv *c, char *state, int n)
static void
grecreate(Conv *c)
{
- c->rq = qopen(64*1024, 0, 0, c);
+ c->rq = qopen(64*1024, 1, 0, c);
c->wq = qopen(64*1024, 0, 0, 0);
}
M ip/icmp.c => ip/icmp.c +1 -1
@@ 120,7 120,7 @@ icmpstate(Conv *c, char *state, int n)
static void
icmpcreate(Conv *c)
{
- c->rq = qopen(64*1024, 0, 0, c);
+ c->rq = qopen(64*1024, 1, 0, c);
c->wq = qopen(64*1024, 0, 0, 0);
}
M ip/ipaux.c => ip/ipaux.c +4 -2
@@ 252,8 252,10 @@ isv4(uchar *ip)
void
v4tov6(uchar *v6, uchar *v4)
{
- memmove(v6, v4prefix, IPv4off);
- memmove(v6 + IPv4off, v4, IPv4addrlen);
+ v6[0] = *(ulong)v4prefix;
+ v6[1] = *(ulong)(v4prefix+4);
+ v6[2] = *(ulong)(v4prefix+8);
+ v6[3] = *(ulong)v4;
}
int
M ip/ipmux.c => ip/ipmux.c +1 -1
@@ 586,7 586,7 @@ ipmuxcreate(Conv *c)
{
Ipmuxrock *r;
- c->rq = qopen(64*1024, 0, 0, c);
+ c->rq = qopen(64*1024, 1, 0, c);
c->wq = qopen(64*1024, 0, 0, 0);
r = (Ipmuxrock*)(c->ptcl);
r->chain = nil;
M ip/tcp.c => ip/tcp.c +7 -8
@@ 332,10 332,10 @@ tcpstate(Conv *c, char *state, int n)
s = (Tcpctl*)(c->ptcl);
return snprint(state, n,
- "%s srtt %d mdev %d cwin %d swin %d rwin %d timer.start %d timer.count %d\n",
+ "%s srtt %d mdev %d cwin %d swin %d rwin %d timer.start %d timer.count %d rerecv %d\n",
tcpstates[s->state], s->srtt, s->mdev,
s->cwind, s->snd.wnd, s->rcv.wnd,
- s->timer.start, s->timer.count);
+ s->timer.start, s->timer.count, s->rerecv);
}
static int
@@ 484,7 484,7 @@ tcpacktimer(void *v)
static void
tcpcreate(Conv *c)
{
- c->rq = qopen(QMAX, 0, tcpacktimer, c);
+ c->rq = qopen(QMAX, -1, tcpacktimer, c);
c->wq = qopen(2*QMAX, 0, 0, 0);
}
@@ 770,7 770,7 @@ htontcp(Tcp *tcph, Block *data, Tcphdr *ph, Tcpctl *tcb)
}
else {
dlen = 0;
- data = allocb(hdrlen + TCP_PKT);
+ data = allocb(hdrlen + TCP_PKT + 64); /* the 64 pad is to meet mintu's */
if(data == nil)
return nil;
data->wp += hdrlen + TCP_PKT;
@@ 2137,7 2137,6 @@ int
tcptrim(Tcpctl *tcb, Tcp *seg, Block **bp, ushort *length)
{
ushort len;
- Block *nbp;
uchar accept;
int dupcnt, excess;
@@ 2197,9 2196,9 @@ tcptrim(Tcpctl *tcb, Tcp *seg, Block **bp, ushort *length)
if(excess > 0) {
tcb->rerecv += excess;
*length -= excess;
- nbp = copyblock(*bp, *length);
- freeblist(*bp);
- *bp = nbp;
+ *bp = trimblock(*bp, 0, *length);
+ if(*bp == nil)
+ panic("presotto is a boofhead");
seg->flags &= ~FIN;
}
return 0;
M pc/etherga620.c => pc/etherga620.c +4 -3
@@ 228,7 228,7 @@ enum { /* Host/NIC Interface ring sizes */
};
enum {
- NrsrHI = 128, /* Fill-level of Rsr (m.b. < Nrsr) */
+ NrsrHI = 256, /* (WAS 128) Fill-level of Rsr (m.b. < Nrsr) */
NrsrLO = 64, /* Level at which to top-up ring */
NrjrHI = 0, /* Fill-level of Rjr (m.b. < Nrjr) */
NrjrLO = 0, /* Level at which to top-up ring */
@@ 665,11 665,11 @@ ga620init(Ether* edev)
* These defaults are based on the tuning hints in the Alteon
* Host/NIC Software Interface Definition and example software.
*/
- csr32w(ctlr, Rct, 100);
+ csr32w(ctlr, Rct, 1000); /* was 100 */
csr32w(ctlr, Sct, 0);
csr32w(ctlr, St, 100000);
csr32w(ctlr, SmcBD, Nsr/4);
- csr32w(ctlr, RmcBD, 6);
+ csr32w(ctlr, RmcBD, 100); /* was 6 */
/*
* Enable DMA Assist Logic.
@@ 993,6 993,7 @@ ga620pnp(Ether* edev)
edev->irq = ctlr->pcidev->intl;
edev->tbdf = ctlr->pcidev->tbdf;
edev->mbps = 1000;
+ edev->oq = qopen(512*1024, 1, 0, 0);
/*
* Check if the adapter's station address is to be overridden.
M pc/etherwavelan.c => pc/etherwavelan.c +12 -2
@@ 152,6 152,7 @@ enum
WCmdMsk = 0x003f,
WCmdAccRd = 0x0021,
WCmdAccWr = 0x0121,
+ WCmdBusy = 0x8000,
WCmdTxFree = 0x000b|0x0100,
WR_Parm0 = 0x02,
WR_Parm1 = 0x04,
@@ 313,7 314,11 @@ w_cmd(Ctlr *ctlr, ushort cmd, ushort arg)
int i;
int rc;
+if(csr_ins(ctlr, WR_Cmd) & WCmdBusy)
+ print("busy\n");
csr_outs(ctlr, WR_Parm0, arg);
+ csr_outs(ctlr, WR_Parm1, 0);
+ csr_outs(ctlr, WR_Parm2, 0);
csr_outs(ctlr, WR_Cmd, cmd);
for (i = 0; i<WTmOut; i++){
rc = csr_ins(ctlr, WR_EvSts);
@@ 384,6 389,7 @@ w_outltv(Ctlr* ctlr, Wltv* l)
{
int i,len;
ushort *p;
+delay(100);
if (w_seek(ctlr,l->type,0,1))
return;
@@ 400,6 406,7 @@ static void
ltv_outs(Ctlr* ctlr, int type, ushort val)
{
Wltv l;
+delay(100);
l.type = type;
l.val = val;
@@ 424,6 431,7 @@ ltv_outstr(Ctlr* ctlr, int type, char *val)
{
Wltv l;
int len;
+delay(100);
len = strlen(val);
if(len > sizeof(l.s))
@@ 589,10 597,11 @@ w_enable(Ether* ether)
w_intdis(ctlr);
w_cmd(ctlr, WCmdDis, 0);
w_intdis(ctlr);
+delay(100);
if(w_cmd(ctlr, WCmdIni, 0))
return -1;
-
w_intdis(ctlr);
+
ltv_outs(ctlr, WTyp_Tick, 8);
ltv_outs(ctlr, WTyp_MaxLen, ctlr->maxlen);
ltv_outs(ctlr, WTyp_Ptype, ctlr->ptype);
@@ 1159,7 1168,7 @@ ctl(Ether* ether, void* buf, long n)
ctlr->keyid = key;
kp = &ctlr->key[key-1];
kp->len = strlen(cb->f[1]);
- if (kp->len > WKeyLen)
+// if (kp->len > WKeyLen)
kp->len = WKeyLen;
memset(kp->dat, 0, sizeof(kp->dat));
strncpy(kp->dat, cb->f[1], kp->len);
@@ 1361,6 1370,7 @@ reset(Ether* ether)
}
w_intdis(ctlr);
+delay(500);
if (w_cmd(ctlr,WCmdIni,0)){
print("#l%d: init failed\n", ether->ctlrno);
goto abort;
M pc/fns.h => pc/fns.h +6 -0
@@ 134,3 134,9 @@ ulong TK2MS(ulong); /* ticks to milliseconds */
#define PADDR(a) ((ulong)(a)&~KZERO)
#define dcflush(a, b)
+
+/*
+ * wrapper around memmove that causes kprof to credit caller for time
+ */
+// extern void *kpmemmove(void*, void*, long);
+// #define memmove kpmemmove
A pc/kpmemmove.c => pc/kpmemmove.c +21 -0
@@ 0,0 1,21 @@
+#include "u.h"
+#include "../port/lib.h"
+#include "mem.h"
+#include "dat.h"
+#include "fns.h"
+#include "../port/error.h"
+
+#undef memmove
+
+void *
+kpmemmove(void *s, void *d, long n)
+{
+ void *p;
+ if(up == nil)
+ return memmove(s, d, n);
+
+ up->kppc = getcallerpc(&s);
+ p = memmove(s, d, n);
+ up->kppc = 0;
+ return p;
+}
M pc/mp.c => pc/mp.c +14 -1
@@ 462,6 462,8 @@ mpstartap(Apic* apic)
void
mpinit(void)
{
+ int ncpu;
+ char *cp;
PCMP *pcmp;
uchar *e, *p;
Apic *apic, *bpapic;
@@ 562,11 564,22 @@ mpinit(void)
/*
* Initialise the application processors.
*/
+ if(cp = getconf("*ncpu")){
+ ncpu = strtol(cp, 0, 0);
+ if(ncpu < 1)
+ ncpu = 1;
+ }
+ else
+ ncpu = MaxAPICNO;
memmove((void*)APBOOTSTRAP, apbootstrap, sizeof(apbootstrap));
for(apic = mpapic; apic <= &mpapic[MaxAPICNO]; apic++){
+ if(ncpu <= 1)
+ break;
if((apic->flags & (PcmpBP|PcmpEN)) == PcmpEN
- && apic->type == PcmpPROCESSOR)
+ && apic->type == PcmpPROCESSOR){
mpstartap(apic);
+ ncpu--;
+ }
}
/*
M port/devkprof.c => port/devkprof.c +2 -1
@@ 41,7 41,8 @@ _kproftimer(ulong pc)
*/
if(pc>=(ulong)spllo && pc<=(ulong)spldone)
pc = m->splpc;
-
+ if(up && up->kppc)
+ pc = up->kppc;
kprof.buf[0] += TK2MS(1);
if(kprof.minpc<=pc && pc<kprof.maxpc){
pc -= kprof.minpc;
M port/portdat.h => port/portdat.h +1 -0
@@ 621,6 621,7 @@ struct Proc
* that last preempted it
*/
ulong qpc; /* pc calling last blocking qlock */
+ ulong kppc; /* kprof calling pc */
void *ureg; /* User registers for notes */
void *dbgreg; /* User registers for devproc */
M port/qio.c => port/qio.c +33 -8
@@ 55,6 55,7 @@ enum
Qmsg = (1<<1), /* message stream */
Qclosed = (1<<2),
Qflow = (1<<3),
+ Qcoalesce = (1<<4), /* coallesce packets on read */
Maxatomic = 32*1024,
};
@@ 749,7 750,12 @@ qopen(int limit, int msg, void (*kick)(void*), void *arg)
q->limit = q->inilim = limit;
q->kick = kick;
q->arg = arg;
- q->state = msg ? Qmsg : 0;
+ q->state = 0;
+ if(msg > 0)
+ q->state |= Qmsg;
+ else if(msg < 0)
+ q->state |= Qcoalesce;
+
q->state |= Qstarve;
q->eof = 0;
q->noblock = 0;
@@ 865,15 871,34 @@ long
qread(Queue *q, void *vp, int len)
{
Block *b;
+ int m;
+ uchar *p;
+ uchar *e;
- b = qbread(q, len);
- if(b == 0)
- return 0;
+ p = vp;
- len = BLEN(b);
- memmove(vp, b->rp, len);
- freeb(b);
- return len;
+ if((q->state & Qcoalesce) == 0){
+ b = qbread(q, len);
+ if(b == 0)
+ return 0;
+
+ m = BLEN(b);
+ memmove(p, b->rp, m);
+ freeb(b);
+ return m;
+ }
+
+ for(e = p + len; p < e; p += m){
+ b = qbread(q, e-p);
+ if(b == 0)
+ return 0;
+
+ m = BLEN(b);
+ memmove(p, b->rp, m);
+ freeb(b);
+ }
+
+ return p-(uchar*)vp;
}
static int
M port/taslock.c => port/taslock.c +2 -2
@@ 170,7 170,7 @@ unlock(Lock *l)
print("unlock of ilock: pc %lux, held by %lux\n", getcallerpc(&l), l->pc);
l->pc = 0;
l->key = 0;
- coherence();
+ //coherence();
}
void
@@ 186,7 186,7 @@ iunlock(Lock *l)
sr = l->sr;
l->pc = 0;
l->key = 0;
- coherence();
+ //coherence();
m->splpc = getcallerpc(&l);
splxpc(sr);