MCPcopy Create free account
hub / github.com/F-Stack/f-stack / iflib_encap

Function iflib_encap

freebsd/net/iflib.c:3388–3599  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3386}
3387
3388static int
3389iflib_encap(iflib_txq_t txq, struct mbuf **m_headp)
3390{
3391 if_ctx_t ctx;
3392 if_shared_ctx_t sctx;
3393 if_softc_ctx_t scctx;
3394 bus_dma_tag_t buf_tag;
3395 bus_dma_segment_t *segs;
3396 struct mbuf *m_head, **ifsd_m;
3397 void *next_txd;
3398 bus_dmamap_t map;
3399 struct if_pkt_info pi;
3400 int remap = 0;
3401 int err, nsegs, ndesc, max_segs, pidx, cidx, next, ntxd;
3402
3403 ctx = txq->ift_ctx;
3404 sctx = ctx->ifc_sctx;
3405 scctx = &ctx->ifc_softc_ctx;
3406 segs = txq->ift_segs;
3407 ntxd = txq->ift_size;
3408 m_head = *m_headp;
3409 map = NULL;
3410
3411 /*
3412 * If we're doing TSO the next descriptor to clean may be quite far ahead
3413 */
3414 cidx = txq->ift_cidx;
3415 pidx = txq->ift_pidx;
3416 if (ctx->ifc_flags & IFC_PREFETCH) {
3417 next = (cidx + CACHE_PTR_INCREMENT) & (ntxd-1);
3418 if (!(ctx->ifc_flags & IFLIB_HAS_TXCQ)) {
3419 next_txd = calc_next_txd(txq, cidx, 0);
3420 prefetch(next_txd);
3421 }
3422
3423 /* prefetch the next cache line of mbuf pointers and flags */
3424 prefetch(&txq->ift_sds.ifsd_m[next]);
3425 prefetch(&txq->ift_sds.ifsd_map[next]);
3426 next = (cidx + CACHE_LINE_SIZE) & (ntxd-1);
3427 }
3428 map = txq->ift_sds.ifsd_map[pidx];
3429 ifsd_m = txq->ift_sds.ifsd_m;
3430
3431 if (m_head->m_pkthdr.csum_flags & CSUM_TSO) {
3432 buf_tag = txq->ift_tso_buf_tag;
3433 max_segs = scctx->isc_tx_tso_segments_max;
3434 map = txq->ift_sds.ifsd_tso_map[pidx];
3435 MPASS(buf_tag != NULL);
3436 MPASS(max_segs > 0);
3437 } else {
3438 buf_tag = txq->ift_buf_tag;
3439 max_segs = scctx->isc_tx_nsegments;
3440 map = txq->ift_sds.ifsd_map[pidx];
3441 }
3442 if ((sctx->isc_flags & IFLIB_NEED_ETHER_PAD) &&
3443 __predict_false(m_head->m_pkthdr.len < scctx->isc_min_frame_size)) {
3444 err = iflib_ether_pad(ctx->ifc_dev, m_headp, scctx->isc_min_frame_size);
3445 if (err) {

Callers 2

iflib_txq_drainFunction · 0.85
iflib_debugnet_transmitFunction · 0.85

Calls 13

calc_next_txdFunction · 0.85
prefetchFunction · 0.85
iflib_ether_padFunction · 0.85
pkt_info_zeroFunction · 0.85
iflib_parse_headerFunction · 0.85
bus_dmamap_load_mbuf_sgFunction · 0.85
m_collapseFunction · 0.85
m_defragFunction · 0.85
print_pktFunction · 0.85
iflib_remove_mbufFunction · 0.85
m_freemFunction · 0.50
bus_dmamap_unloadFunction · 0.50

Tested by

no test coverage detected