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

Function setup_test_string

dpdk/app/test/test_cryptodev.c:152–175  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

150 const uint16_t tag_size);
151
152static struct rte_mbuf *
153setup_test_string(struct rte_mempool *mpool,
154 const char *string, size_t len, uint8_t blocksize)
155{
156 struct rte_mbuf *m = rte_pktmbuf_alloc(mpool);
157 size_t t_len = len - (blocksize ? (len % blocksize) : 0);
158
159 if (m) {
160 char *dst;
161
162 memset(m->buf_addr, 0, m->buf_len);
163 dst = rte_pktmbuf_append(m, t_len);
164 if (!dst) {
165 rte_pktmbuf_free(m);
166 return NULL;
167 }
168 if (string != NULL)
169 rte_memcpy(dst, string, t_len);
170 else
171 memset(dst, 0, t_len);
172 }
173
174 return m;
175}
176
177/* Get number of bytes in X bits (rounding up) */
178static uint32_t

Calls 5

rte_pktmbuf_allocFunction · 0.85
memsetFunction · 0.85
rte_pktmbuf_appendFunction · 0.85
rte_pktmbuf_freeFunction · 0.85
rte_memcpyFunction · 0.50

Tested by

no test coverage detected