| 3187 | } |
| 3188 | |
| 3189 | static int |
| 3190 | worker_loopback(struct test *t, uint8_t disable_implicit_release) |
| 3191 | { |
| 3192 | /* use a single producer core, and a worker core to see what happens |
| 3193 | * if the worker loops packets back multiple times |
| 3194 | */ |
| 3195 | struct test_event_dev_stats stats; |
| 3196 | uint64_t print_cycles = 0, cycles = 0; |
| 3197 | uint64_t tx_pkts = 0; |
| 3198 | int err; |
| 3199 | int w_lcore, p_lcore; |
| 3200 | |
| 3201 | static const struct rte_mbuf_dynfield counter_dynfield_desc = { |
| 3202 | .name = "rte_event_sw_dynfield_selftest_counter", |
| 3203 | .size = sizeof(counter_dynfield_t), |
| 3204 | .align = __alignof__(counter_dynfield_t), |
| 3205 | }; |
| 3206 | counter_dynfield_offset = |
| 3207 | rte_mbuf_dynfield_register(&counter_dynfield_desc); |
| 3208 | if (counter_dynfield_offset < 0) { |
| 3209 | printf("Error registering mbuf field\n"); |
| 3210 | return -rte_errno; |
| 3211 | } |
| 3212 | |
| 3213 | if (init(t, 8, 2) < 0 || |
| 3214 | create_atomic_qids(t, 8) < 0) { |
| 3215 | printf("%d: Error initializing device\n", __LINE__); |
| 3216 | return -1; |
| 3217 | } |
| 3218 | |
| 3219 | /* RX with low max events */ |
| 3220 | static struct rte_event_port_conf conf = { |
| 3221 | .dequeue_depth = 32, |
| 3222 | .enqueue_depth = 64, |
| 3223 | }; |
| 3224 | /* beware: this cannot be initialized in the static above as it would |
| 3225 | * only be initialized once - and this needs to be set for multiple runs |
| 3226 | */ |
| 3227 | conf.new_event_threshold = 512; |
| 3228 | conf.event_port_cfg = disable_implicit_release ? |
| 3229 | RTE_EVENT_PORT_CFG_DISABLE_IMPL_REL : 0; |
| 3230 | |
| 3231 | if (rte_event_port_setup(evdev, 0, &conf) < 0) { |
| 3232 | printf("Error setting up RX port\n"); |
| 3233 | return -1; |
| 3234 | } |
| 3235 | t->port[0] = 0; |
| 3236 | /* TX with higher max events */ |
| 3237 | conf.new_event_threshold = 4096; |
| 3238 | if (rte_event_port_setup(evdev, 1, &conf) < 0) { |
| 3239 | printf("Error setting up TX port\n"); |
| 3240 | return -1; |
| 3241 | } |
| 3242 | t->port[1] = 1; |
| 3243 | |
| 3244 | /* CQ mapping to QID */ |
| 3245 | err = rte_event_port_link(evdev, t->port[1], NULL, NULL, 0); |
| 3246 | if (err != 8) { /* should have mapped all queues*/ |
no test coverage detected