PERFORCE change 128431 for review
Kip Macy
kmacy at FreeBSD.org
Wed Oct 31 15:20:07 PDT 2007
http://perforce.freebsd.org/chv.cgi?CH=128431
Change 128431 by kmacy at kmacy:storage:toestack on 2007/10/31 22:19:17
- add sanity checks to write immediate
- make sure rx_offload gets called for non-tunnelled packets
Affected files ...
.. //depot/projects/toestack/sys/dev/cxgb/cxgb_sge.c#8 edit
Differences ...
==== //depot/projects/toestack/sys/dev/cxgb/cxgb_sge.c#8 (text+ko) ====
@@ -1501,6 +1501,11 @@
struct work_request_hdr *from = mtod(m, struct work_request_hdr *);
struct work_request_hdr *to = (struct work_request_hdr *)d;
+ if (len > WR_LEN)
+ panic("len too big %d\n", len);
+ if (len < sizeof(*from))
+ panic("len too small %d", len);
+
memcpy(&to[1], &from[1], len - sizeof(*from));
to->wr_hi = from->wr_hi | htonl(F_WR_SOP | F_WR_EOP |
V_WR_BCNTLFLT(len & 7));
@@ -1508,6 +1513,8 @@
to->wr_lo = from->wr_lo | htonl(V_WR_GEN(gen) |
V_WR_LEN((len + 7) / 8));
wr_gen2(d, gen);
+
+ printf("m_freeing %p\n", m);
m_freem(m);
}
@@ -1617,13 +1624,14 @@
if (__predict_false(ret)) {
if (ret == 1) {
mtx_unlock(&q->lock);
+ printf("no desc available\n");
+
return (-1);
}
goto again;
}
-
write_imm(&q->desc[q->pidx], m, m->m_len, q->gen);
-
+
q->in_use++;
if (++q->pidx >= q->size) {
q->pidx = 0;
@@ -2017,7 +2025,9 @@
struct mbuf *m_vec[TX_CLEAN_MAX_DESC];
bus_dma_segment_t segs[TX_MAX_SEGS];
int cleaned;
- struct tx_sw_desc *stx = &q->sdesc[q->pidx];
+ struct tx_sw_desc *stx;
+
+ stx = &q->sdesc[q->pidx];
mtx_lock(&q->lock);
if ((ret = busdma_map_mbufs(&m, q, stx, segs, &nsegs)) != 0) {
@@ -2174,7 +2184,7 @@
adapter_t *adap = tdev2adap(tdev);
struct sge_qset *qs = &adap->sge.qs[queue_set(m)];
- if (__predict_false(is_ctrl_pkt(m)))
+ if (__predict_false(is_ctrl_pkt(m)))
return ctrl_xmit(adap, &qs->txq[TXQ_CTRL], m);
return ofld_xmit(adap, &qs->txq[TXQ_OFLD], m);
@@ -2205,9 +2215,9 @@
struct mbuf *m, struct mbuf *rx_gather[],
unsigned int gather_idx)
{
+
rq->offload_pkts++;
m->m_pkthdr.header = mtod(m, void *);
-
rx_gather[gather_idx++] = m;
if (gather_idx == RX_BUNDLE_SIZE) {
cxgb_ofld_recv(tdev, rx_gather, RX_BUNDLE_SIZE);
@@ -2788,7 +2798,8 @@
}
#else
struct mbuf *m = NULL;
-
+
+ DPRINTF("IMM DATA VALID opcode=0x%x rspq->cidx=%d\n", r->rss_hdr.opcode, rspq->cidx);
if (rspq->rspq_mbuf == NULL)
rspq->rspq_mbuf = m_gethdr(M_DONTWAIT, MT_DATA);
else
@@ -2802,11 +2813,13 @@
budget_left--;
break;
}
- if (get_imm_packet(adap, r, rspq->rspq_mbuf, m, flags))
+ if (get_imm_packet(adap, r, rspq->rspq_mbuf, m, flags)) {
+ eop = 1;
+ rspq->imm_data++;
goto skip;
- eop = 1;
+ }
+
#endif
- rspq->imm_data++;
} else if (r->len_cq) {
int drop_thresh = eth ? SGE_RX_DROP_THRES : 0;
@@ -2850,26 +2863,26 @@
refill_rspq(adap, rspq, rspq->credits);
rspq->credits = 0;
}
-
- if (eop) {
+ DPRINTF("eth=%d eop=%d flags=0x%x\n", eth, eop, flags);
+
+ if (!eth && eop) {
+ rspq->rspq_mh.mh_head->m_pkthdr.csum_data = rss_csum;
+ /*
+ * XXX size mismatch
+ */
+ m_set_priority(rspq->rspq_mh.mh_head, rss_hash);
+
+ ngathered = rx_offload(&adap->tdev, rspq,
+ rspq->rspq_mh.mh_head, offload_mbufs, ngathered);
+ rspq->rspq_mh.mh_head = NULL;
+ } else if (eth && eop) {
prefetch(mtod(rspq->rspq_mh.mh_head, uint8_t *));
prefetch(mtod(rspq->rspq_mh.mh_head, uint8_t *) + L1_CACHE_BYTES);
- if (eth) {
- t3_rx_eth_lro(adap, rspq, rspq->rspq_mh.mh_head, ethpad,
- rss_hash, rss_csum, lro);
+ t3_rx_eth_lro(adap, rspq, rspq->rspq_mh.mh_head, ethpad,
+ rss_hash, rss_csum, lro);
rspq->rspq_mh.mh_head = NULL;
- } else {
- rspq->rspq_mh.mh_head->m_pkthdr.csum_data = rss_csum;
- /*
- * XXX size mismatch
- */
- m_set_priority(rspq->rspq_mh.mh_head, rss_hash);
-
- ngathered = rx_offload(&adap->tdev, rspq,
- rspq->rspq_mh.mh_head, offload_mbufs, ngathered);
- }
}
__refill_fl_lt(adap, &qs->fl[0], 32);
More information about the p4-projects
mailing list