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

Function test_attempt_single

dpdk/app/test/test_pdcp.c:1166–1233  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1164}
1165
1166static int
1167test_attempt_single(struct pdcp_test_conf *t_conf)
1168{
1169 struct rte_mbuf *mbuf, **out_mb = NULL;
1170 struct rte_pdcp_entity *pdcp_entity;
1171 uint16_t nb_success, nb_err;
1172 int ret = 0, nb_max_out_mb;
1173
1174 pdcp_entity = test_entity_create(t_conf, &ret);
1175 if (pdcp_entity == NULL)
1176 goto exit;
1177
1178 /* Allocate buffer for holding mbufs returned */
1179
1180 /* Max packets that can be cached in entity + burst size */
1181 nb_max_out_mb = pdcp_entity->max_pkt_cache + 1;
1182 out_mb = rte_malloc(NULL, nb_max_out_mb * sizeof(uintptr_t), 0);
1183 if (out_mb == NULL) {
1184 RTE_LOG(ERR, USER1, "Could not allocate buffer for holding out_mb buffers\n");
1185 ret = -ENOMEM;
1186 goto entity_release;
1187 }
1188
1189 mbuf = mbuf_from_data_create(t_conf->input, t_conf->input_len);
1190 if (mbuf == NULL) {
1191 ret = -ENOMEM;
1192 goto entity_release;
1193 }
1194
1195#ifdef VEC_DUMP
1196 printf("Adjusted vector:\n");
1197 rte_pktmbuf_dump(stdout, mbuf, t_conf->input_len);
1198#endif
1199
1200 nb_success = test_process_packets(pdcp_entity, t_conf->entity.dev_id, &mbuf, 1, out_mb,
1201 &nb_err);
1202 if (nb_success != 1 || nb_err != 0) {
1203 RTE_LOG(ERR, USER1, "Could not process PDCP packet\n");
1204 ret = TEST_FAILED;
1205 goto mbuf_free;
1206 }
1207
1208 /* If expected output provided - verify, else - store for future use */
1209 if (t_conf->output_len) {
1210 ret = pdcp_known_vec_verify(mbuf, t_conf->output, t_conf->output_len);
1211 if (ret)
1212 goto mbuf_free;
1213 } else {
1214 ret = pktmbuf_read_into(mbuf, t_conf->output, RTE_PDCP_CTRL_PDU_SIZE_MAX);
1215 if (ret)
1216 goto mbuf_free;
1217 t_conf->output_len = mbuf->pkt_len;
1218 }
1219
1220 ret = rte_pdcp_entity_suspend(pdcp_entity, out_mb);
1221 if (ret) {
1222 RTE_LOG(DEBUG, USER1, "Could not suspend PDCP entity\n");
1223 goto mbuf_free;

Callers 4

test_sn_range_typeFunction · 0.85
test_combinedFunction · 0.85

Calls 12

test_entity_createFunction · 0.85
rte_mallocFunction · 0.85
mbuf_from_data_createFunction · 0.85
rte_pktmbuf_dumpFunction · 0.85
test_process_packetsFunction · 0.85
pdcp_known_vec_verifyFunction · 0.85
pktmbuf_read_intoFunction · 0.85
rte_pdcp_entity_suspendFunction · 0.85
rte_pktmbuf_freeFunction · 0.85
rte_pdcp_entity_releaseFunction · 0.85
rte_freeFunction · 0.85
printfFunction · 0.50

Tested by

no test coverage detected