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

Function iflib_if_transmit

freebsd/net/iflib.c:4072–4150  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4070}
4071
4072static int
4073iflib_if_transmit(if_t ifp, struct mbuf *m)
4074{
4075 if_ctx_t ctx = if_getsoftc(ifp);
4076
4077 iflib_txq_t txq;
4078 int err, qidx;
4079 int abdicate = ctx->ifc_sysctl_tx_abdicate;
4080
4081 if (__predict_false((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0 || !LINK_ACTIVE(ctx))) {
4082 DBG_COUNTER_INC(tx_frees);
4083 m_freem(m);
4084 return (ENETDOWN);
4085 }
4086
4087 MPASS(m->m_nextpkt == NULL);
4088 /* ALTQ-enabled interfaces always use queue 0. */
4089 qidx = 0;
4090 if ((NTXQSETS(ctx) > 1) && M_HASHTYPE_GET(m) && !ALTQ_IS_ENABLED(&ifp->if_snd))
4091 qidx = QIDX(ctx, m);
4092 /*
4093 * XXX calculate buf_ring based on flowid (divvy up bits?)
4094 */
4095 txq = &ctx->ifc_txqs[qidx];
4096
4097#ifdef DRIVER_BACKPRESSURE
4098 if (txq->ift_closed) {
4099 while (m != NULL) {
4100 next = m->m_nextpkt;
4101 m->m_nextpkt = NULL;
4102 m_freem(m);
4103 DBG_COUNTER_INC(tx_frees);
4104 m = next;
4105 }
4106 return (ENOBUFS);
4107 }
4108#endif
4109#ifdef notyet
4110 qidx = count = 0;
4111 mp = marr;
4112 next = m;
4113 do {
4114 count++;
4115 next = next->m_nextpkt;
4116 } while (next != NULL);
4117
4118 if (count > nitems(marr))
4119 if ((mp = malloc(count*sizeof(struct mbuf *), M_IFLIB, M_NOWAIT)) == NULL) {
4120 /* XXX check nextpkt */
4121 m_freem(m);
4122 /* XXX simplify for now */
4123 DBG_COUNTER_INC(tx_frees);
4124 return (ENOBUFS);
4125 }
4126 for (next = m, i = 0; next != NULL; i++) {
4127 mp[i] = next;
4128 next = next->m_nextpkt;
4129 mp[i]->m_nextpkt = NULL;

Callers 2

iflib_altq_if_startFunction · 0.85
iflib_altq_if_transmitFunction · 0.85

Calls 5

if_getsoftcFunction · 0.85
mallocFunction · 0.85
ifmp_ring_enqueueFunction · 0.85
ifmp_ring_check_drainageFunction · 0.85
m_freemFunction · 0.50

Tested by

no test coverage detected