Exemple #1
0
static int
hset(Aoedev *d, Frame *f, Aoehdr *h, int cmd)
{
	int i;
	Devlink *l;

	l = pickdevlink(d);
	i = pickea(l);
	if(i == -1){
		downdev(d, "resend fails; no netlink/ea");
		return -1;
	}
	if(f->srb && sys->ticks - f->srb->ticksent > Srbtimeout){
		eventlog("%æ: srb timeout\n", d);
		frameerror(d, f, Etimedout);
		return -1;
	}
	memmove(h->dst, l->eatab[i], Eaddrlen);
	memmove(h->src, l->nl->ea, sizeof h->src);
	hnputs(h->type, Aoetype);
	h->verflag = Aoever << 4;
	h->error = 0;
	hnputs(h->major, d->major);
	h->minor = d->minor;
	h->cmd = cmd;

	hnputl(h->tag, f->tag = newtag(d));
	f->dl = l;
	f->nl = l->nl;
	f->eaidx = i;
	f->ticksent = sys->ticks;

	return f->tag;
}
Exemple #2
0
static int
hset(Aoedev *d, Frame *f, Aoehdr *h, int cmd)
{
	int i;
	Devlink *l;

	if(f->srb && MACHP(0)->ticks - f->srb->ticksent > Maxreqticks){
		eventlog("%æ: srb timeout\n", d);
		if(cmd == ACata && f->srb && Nofail(d, s))
			f->srb->ticksent = MACHP(0)->ticks;
		else
			frameerror(d, f, Etimedout);
		return -1;
	}
	l = pickdevlink(d);
	i = pickea(l);
	if(i == -1){
		if(cmd != ACata || f->srb == nil || !Nofail(d, s))
			downdev(d, "resend fails; no netlink/ea");
		return -1;
	}
	memmove(h->dst, l->eatab[i], Eaddrlen);
	memmove(h->src, l->nl->ea, sizeof h->src);
	hnputs(h->type, Aoetype);
	h->verflag = Aoever << 4;
	h->error = 0;
	hnputs(h->major, d->major);
	h->minor = d->minor;
	h->cmd = cmd;

	hnputl(h->tag, f->tag = newtag(d));
	f->dl = l;
	f->nl = l->nl;
	f->eaidx = i;
	f->ticksent = MACHP(0)->ticks;

	return f->tag;
}