#include
#include
#include
#define MAX_NUM_BUFS 1024
#define BUF_SIZE 2048
int main() {
struct rte_mempool *mp;
const char *mp_name = "my_mempool";
unsigned int num_bufs = MAX_NUM_BUFS;
unsigned int buf_size = BUF_SIZE;
int socket_id = SOCKET_ID_ANY;
mp = rte_mempool_create(mp_name, num_bufs, buf_size, 0, 0, NULL, NULL, NULL, NULL, socket_id, 0);
if (mp == NULL) {
printf("Failed to create mempool\n");
return -1;
}
printf("Mempool created successfully\n");
void *buf;
buf = rte_mempool_get(mp);
if (buf == NULL) {
printf("Failed to get buffer from mempool\n");
return -1;
}
rte_mempool_put(mp, buf);
rte_mempool_free(mp);
return 0;
}
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43