int main () { int sq, eq, q[50], Max = 50; initialise_queue(&sq, &eq); add_to_queue(q, &sq, &eq, Max, 1); add_to_queue(q, &sq, &eq, Max, 2); add_to_queue(q, &sq, &eq, Max, 3); add_to_queue(q, &sq, &eq, Max, 4); print(q, &sq, &eq); pop_queue(&sq, &eq, Max); print(q, &sq, &eq); printf("\n%d", queue_front(q, &sq)); }
static __rte_always_inline int create_link_opdl(struct opdl_evdev *device, uint32_t index) { int err = 0; if (device->q_md[index + 1].type != OPDL_Q_TYPE_SINGLE_LINK) { /* async queue with regular * queue following it */ /* create a new opdl ring */ err = create_opdl(device); if (!err) { /* create an initial * dummy queue for new opdl */ initialise_queue(device, OPDL_Q_POS_START, -1); } else { err = -EINVAL; } } else { PMD_DRV_LOG(ERR, "DEV_ID:[%02d] : " "queue %u, two consecutive" " SINGLE_LINK queues, not allowed", opdl_pmd_dev_id(device), index); err = -EINVAL; } return err; }
int create_queues_and_rings(struct rte_eventdev *dev) { int err = 0; struct opdl_evdev *device = opdl_pmd_priv(dev); device->nb_queues = 0; if (device->nb_ports != device->max_port_nb) { PMD_DRV_LOG(ERR, "Number ports setup:%u NOT EQUAL to max port" " number:%u for this device", device->nb_ports, device->max_port_nb); err = -1; } if (!err) { /* We will have at least one opdl so create it now */ err = create_opdl(device); } if (!err) { /* Create 1st "dummy" queue */ initialise_queue(device, OPDL_Q_POS_START, -1); uint32_t i; for (i = 0; i < device->nb_q_md; i++) { /* Check */ if (!device->q_md[i].setup) { PMD_DRV_LOG(ERR, "DEV_ID:[%02d] : " "queue meta data slot %u" " not setup - FAILING", dev->data->dev_id, i); err = -EINVAL; break; } else if (device->q_md[i].type != OPDL_Q_TYPE_SINGLE_LINK) { if (!device->q_md[i + 1].setup) { /* Create a simple ORDERED/ATOMIC * queue at the end */ initialise_queue(device, OPDL_Q_POS_END, i); } else { /* Create a simple ORDERED/ATOMIC * queue in the middle */ initialise_queue(device, OPDL_Q_POS_MIDDLE, i); } } else if (device->q_md[i].type == OPDL_Q_TYPE_SINGLE_LINK) { /* create last queue for this opdl */ initialise_queue(device, OPDL_Q_POS_END, i); err = create_link_opdl(device, i); if (err) break; } } } if (err) destroy_queues_and_rings(dev); return err; }