| 1072 | } |
| 1073 | |
| 1074 | static struct sa_ctx * |
| 1075 | sa_create(const char *name, int32_t socket_id, uint32_t nb_sa) |
| 1076 | { |
| 1077 | char s[PATH_MAX]; |
| 1078 | struct sa_ctx *sa_ctx; |
| 1079 | uint32_t mz_size; |
| 1080 | const struct rte_memzone *mz; |
| 1081 | |
| 1082 | snprintf(s, sizeof(s), "%s_%u", name, socket_id); |
| 1083 | |
| 1084 | /* Create SA context */ |
| 1085 | printf("Creating SA context with %u maximum entries on socket %d\n", |
| 1086 | nb_sa, socket_id); |
| 1087 | |
| 1088 | mz_size = sizeof(struct ipsec_xf) * nb_sa; |
| 1089 | mz = rte_memzone_reserve(s, mz_size, socket_id, |
| 1090 | RTE_MEMZONE_1GB | RTE_MEMZONE_SIZE_HINT_ONLY); |
| 1091 | if (mz == NULL) { |
| 1092 | printf("Failed to allocate SA XFORM memory\n"); |
| 1093 | rte_errno = ENOMEM; |
| 1094 | return NULL; |
| 1095 | } |
| 1096 | |
| 1097 | sa_ctx = rte_zmalloc(NULL, sizeof(struct sa_ctx) + |
| 1098 | sizeof(struct ipsec_sa) * nb_sa, RTE_CACHE_LINE_SIZE); |
| 1099 | |
| 1100 | if (sa_ctx == NULL) { |
| 1101 | printf("Failed to allocate SA CTX memory\n"); |
| 1102 | rte_errno = ENOMEM; |
| 1103 | rte_memzone_free(mz); |
| 1104 | return NULL; |
| 1105 | } |
| 1106 | |
| 1107 | sa_ctx->xf = (struct ipsec_xf *)mz->addr; |
| 1108 | sa_ctx->nb_sa = nb_sa; |
| 1109 | |
| 1110 | return sa_ctx; |
| 1111 | } |
| 1112 | |
| 1113 | static int |
| 1114 | check_eth_dev_caps(uint16_t portid, uint32_t inbound, uint32_t tso) |
no test coverage detected