PERFORCE change 128544 for review
Kip Macy
kmacy at FreeBSD.org
Fri Nov 2 21:18:15 PDT 2007
http://perforce.freebsd.org/chv.cgi?CH=128544
Change 128544 by kmacy at kmacy:storage:toestack on 2007/11/03 04:17:41
get write_ofld_wr into working order
add hack to avoid double free
Affected files ...
.. //depot/projects/toestack/sys/dev/cxgb/cxgb_sge.c#11 edit
Differences ...
==== //depot/projects/toestack/sys/dev/cxgb/cxgb_sge.c#11 (text+ko) ====
@@ -1097,6 +1097,22 @@
#endif
}
+#if 0
+static int print_wr = 0;
+static __inline void
+do_print_wr(struct tx_desc *d, int flits)
+{
+ int i = 0;
+
+ if (print_wr)
+ while (flits--) {
+ printf("flit[%d]: 0x%016lx\n", i, d->flit[i]);
+ i++;
+ }
+}
+#endif
+
+
/**
* write_wr_hdr_sgl - write a WR header and, optionally, SGL
* @ndesc: number of Tx descriptors spanned by the SGL
@@ -1131,6 +1147,7 @@
V_WR_GEN(txqs->gen)) | wr_lo;
/* XXX gen? */
wr_gen2(txd, txqs->gen);
+
} else {
unsigned int ogen = txqs->gen;
const uint64_t *fp = (const uint64_t *)sgl;
@@ -1450,9 +1467,14 @@
to->wr_lo = from->wr_lo | htonl(V_WR_GEN(gen) |
V_WR_LEN((len + 7) / 8));
wr_gen2(d, gen);
+
+ /*
+ * This check is a hack we should really fix the logic so
+ * that this can't happen
+ */
+ if (m->m_type != MT_DONTFREE)
+ m_freem(m);
- printf("write_imm m_freeing %p\n", m);
- m_freem(m);
}
/**
@@ -1551,6 +1573,8 @@
return 0;
}
+ kdb_backtrace();
+
wrp->wr_hi |= htonl(F_WR_SOP | F_WR_EOP);
wrp->wr_lo = htonl(V_WR_TID(q->token));
@@ -1896,31 +1920,31 @@
struct tx_desc *d = &q->desc[pidx];
struct txq_state txqs;
- if (immediate(m)) {
- q->sdesc[pidx].mi.mi_base = NULL;
+ if (immediate(m) && segs == NULL) {
write_imm(d, m, m->m_len, gen);
return;
}
/* Only TX_DATA builds SGLs */
-
from = mtod(m, struct work_request_hdr *);
- memcpy(&d->flit[1], &from[1],
- (uint8_t *)m->m_pkthdr.header - mtod(m, uint8_t *) - sizeof(*from));
+ memcpy(&d->flit[1], &from[1], m->m_len - sizeof(*from));
- flits = ((uint8_t *)m->m_pkthdr.header - mtod(m, uint8_t *)) / 8;
+ flits = m->m_len / 8;
sgp = (ndesc == 1) ? (struct sg_ent *)&d->flit[flits] : sgl;
make_sgl(sgp, segs, nsegs);
sgl_flits = sgl_len(nsegs);
- txqs.gen = q->gen;
- txqs.pidx = q->pidx;
- txqs.compl = (q->unacked & 8) << (S_WR_COMPL - 3);
+ txqs.gen = gen;
+ txqs.pidx = pidx;
+ txqs.compl = 0;
+
write_wr_hdr_sgl(ndesc, d, &txqs, q, sgl, flits, sgl_flits,
from->wr_hi, from->wr_lo);
}
+
+
/**
* calc_tx_descs_ofld - calculate # of Tx descriptors for an offload packet
* @m: the packet
More information about the p4-projects
mailing list