cperf_mbuf_create(struct rte_mempool *mempool,
uint32_t segment_sz,
uint32_t segments_nb,
- const struct cperf_options *options,
- const struct cperf_test_vector *test_vector)
+ const struct cperf_options *options)
{
struct rte_mbuf *mbuf;
uint8_t *mbuf_data;
- uint8_t *test_data =
- (options->cipher_op == RTE_CRYPTO_CIPHER_OP_ENCRYPT) ?
- test_vector->plaintext.data :
- test_vector->ciphertext.data;
uint32_t remaining_bytes = options->max_buffer_size;
mbuf = rte_pktmbuf_alloc(mempool);
if (mbuf_data == NULL)
goto error;
- if (options->max_buffer_size <= segment_sz) {
- memcpy(mbuf_data, test_data, options->max_buffer_size);
- test_data += options->max_buffer_size;
+ if (options->max_buffer_size <= segment_sz)
remaining_bytes = 0;
- } else {
- memcpy(mbuf_data, test_data, segment_sz);
- test_data += segment_sz;
+ else
remaining_bytes -= segment_sz;
- }
+
segments_nb--;
while (remaining_bytes) {
if (mbuf_data == NULL)
goto error;
- if (remaining_bytes <= segment_sz) {
- memcpy(mbuf_data, test_data, remaining_bytes);
+ if (remaining_bytes <= segment_sz)
remaining_bytes = 0;
- test_data += remaining_bytes;
- } else {
- memcpy(mbuf_data, test_data, segment_sz);
+ else
remaining_bytes -= segment_sz;
- test_data += segment_sz;
- }
+
segments_nb--;
}
*pkt_mbuf_pool_in,
options->segment_sz,
segments_nb,
- options, test_vector);
+ options);
if ((*mbufs_in)[mbuf_idx] == NULL)
return -1;
}
for (mbuf_idx = 0; mbuf_idx < options->pool_sz; mbuf_idx++) {
(*mbufs_out)[mbuf_idx] = cperf_mbuf_create(
*pkt_mbuf_pool_out, max_size,
- 1, options, test_vector);
+ 1, options);
if ((*mbufs_out)[mbuf_idx] == NULL)
return -1;
}