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

Function ff_txring_enqueue

lib/ff_memory.c:173–189  ·  view source on GitHub ↗

* if mbuf has num segment in all, Dev's sw_ring will use num descriptions. ff_txring also use num segments as below: * <--- num-1 ---->|ptr| head | * ---------------------------------------------- * | 0 | 0 | ..............| 0 | p | XXX | *----------------------------------------------- *************************/

Source from the content-addressed store, hash-verified

171*-----------------------------------------------
172*************************/
173static inline int ff_txring_enqueue(struct mbuf_txring* q, void *p, int seg_num)
174{
175 int i = 0;
176 for ( i=0; i<seg_num-1; i++){
177 if ( q->m_table[q->head] ){
178 ff_mbuf_free(q->m_table[q->head]);
179 q->m_table[q->head] = NULL;
180 }
181 Head_INC(q->head);
182 }
183 if ( q->m_table[q->head] )
184 ff_mbuf_free(q->m_table[q->head]);
185 q->m_table[q->head] = p;
186 Head_INC(q->head);
187
188 return 0;
189}
190
191// pop out from head-1 .
192static inline int ff_txring_pop(struct mbuf_txring* q, int num)

Callers 1

ff_enq_tx_bsdmbufFunction · 0.85

Calls 1

ff_mbuf_freeFunction · 0.85

Tested by

no test coverage detected