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

Function test_reorder_set_seqn

dpdk/app/test/test_reorder.c:420–486  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

418}
419
420static int
421test_reorder_set_seqn(void)
422{
423 struct rte_mempool *p = test_params->p;
424 struct rte_reorder_buffer *b = NULL;
425 const unsigned int num_bufs = 7;
426 const unsigned int size = 4;
427 unsigned int i;
428 int ret = 0;
429
430 struct rte_mbuf *bufs[num_bufs];
431
432 /* This would create a reorder buffer instance consisting of:
433 * reorder_seq = 0
434 * ready_buf: RB[size] = {NULL, NULL, NULL, NULL}
435 * order_buf: OB[size] = {NULL, NULL, NULL, NULL}
436 */
437 b = rte_reorder_create("test_min_seqn_set", rte_socket_id(), size);
438 TEST_ASSERT_NOT_NULL(b, "Failed to create reorder buffer");
439
440 for (i = 0; i < num_bufs; i++) {
441 bufs[i] = rte_pktmbuf_alloc(p);
442 if (bufs[i] == NULL) {
443 printf("Packet allocation failed\n");
444 goto exit;
445 }
446 *rte_reorder_seqn(bufs[i]) = i;
447 }
448
449 ret = rte_reorder_min_seqn_set(b, 5);
450 if (ret != 0) {
451 printf("%s:%d: Error in setting min sequence number\n", __func__, __LINE__);
452 ret = -1;
453 goto exit;
454 }
455
456 ret = rte_reorder_insert(b, bufs[0]);
457 if (ret >= 0) {
458 printf("%s:%d: Insertion with value less the min seq number\n", __func__, __LINE__);
459 ret = -1;
460 goto exit;
461 }
462
463 ret = rte_reorder_insert(b, bufs[5]);
464 if (ret != 0) {
465 printf("%s:%d: Error inserting packet with valid seqn\n", __func__, __LINE__);
466 ret = -1;
467 goto exit;
468 }
469 bufs[5] = NULL;
470
471 ret = rte_reorder_min_seqn_set(b, 0);
472 if (ret >= 0) {
473 printf("%s:%d: Error in setting min sequence number with non-empty buffer\n",
474 __func__, __LINE__);
475 ret = -1;
476 goto exit;
477 }

Callers

nothing calls this directly

Calls 8

rte_reorder_createFunction · 0.85
rte_socket_idFunction · 0.85
rte_pktmbuf_allocFunction · 0.85
rte_reorder_min_seqn_setFunction · 0.85
rte_reorder_insertFunction · 0.85
rte_reorder_freeFunction · 0.85
rte_pktmbuf_freeFunction · 0.85
printfFunction · 0.50

Tested by

no test coverage detected