| 15 | #define EVENTDEV_NAME_DSW_PMD event_dsw |
| 16 | |
| 17 | static int |
| 18 | dsw_port_setup(struct rte_eventdev *dev, uint8_t port_id, |
| 19 | const struct rte_event_port_conf *conf) |
| 20 | { |
| 21 | struct dsw_evdev *dsw = dsw_pmd_priv(dev); |
| 22 | struct dsw_port *port; |
| 23 | struct rte_event_ring *in_ring; |
| 24 | struct rte_ring *ctl_in_ring; |
| 25 | char ring_name[RTE_RING_NAMESIZE]; |
| 26 | |
| 27 | port = &dsw->ports[port_id]; |
| 28 | |
| 29 | *port = (struct dsw_port) { |
| 30 | .id = port_id, |
| 31 | .dsw = dsw, |
| 32 | .dequeue_depth = conf->dequeue_depth, |
| 33 | .enqueue_depth = conf->enqueue_depth, |
| 34 | .new_event_threshold = conf->new_event_threshold |
| 35 | }; |
| 36 | |
| 37 | snprintf(ring_name, sizeof(ring_name), "dsw%d_p%u", dev->data->dev_id, |
| 38 | port_id); |
| 39 | |
| 40 | in_ring = rte_event_ring_create(ring_name, DSW_IN_RING_SIZE, |
| 41 | dev->data->socket_id, |
| 42 | RING_F_SC_DEQ|RING_F_EXACT_SZ); |
| 43 | |
| 44 | if (in_ring == NULL) |
| 45 | return -ENOMEM; |
| 46 | |
| 47 | snprintf(ring_name, sizeof(ring_name), "dswctl%d_p%u", |
| 48 | dev->data->dev_id, port_id); |
| 49 | |
| 50 | ctl_in_ring = rte_ring_create_elem(ring_name, |
| 51 | sizeof(struct dsw_ctl_msg), |
| 52 | DSW_CTL_IN_RING_SIZE, |
| 53 | dev->data->socket_id, |
| 54 | RING_F_SC_DEQ|RING_F_EXACT_SZ); |
| 55 | |
| 56 | if (ctl_in_ring == NULL) { |
| 57 | rte_event_ring_free(in_ring); |
| 58 | return -ENOMEM; |
| 59 | } |
| 60 | |
| 61 | port->in_ring = in_ring; |
| 62 | port->ctl_in_ring = ctl_in_ring; |
| 63 | |
| 64 | port->load_update_interval = |
| 65 | (DSW_LOAD_UPDATE_INTERVAL * rte_get_timer_hz()) / US_PER_S; |
| 66 | |
| 67 | port->migration_interval = |
| 68 | (DSW_MIGRATION_INTERVAL * rte_get_timer_hz()) / US_PER_S; |
| 69 | |
| 70 | dev->data->ports[port_id] = port; |
| 71 | |
| 72 | return 0; |
| 73 | } |
| 74 |
nothing calls this directly
no test coverage detected