1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2020 Intel Corporation
5 #include <rte_eventdev.h>
6 #include <eventdev_pmd.h>
8 #include "rte_pmd_dlb2.h"
10 #include "dlb2_inline_fns.h"
13 rte_pmd_dlb2_set_token_pop_mode(uint8_t dev_id,
15 enum dlb2_token_pop_mode mode)
17 struct dlb2_eventdev *dlb2;
18 struct rte_eventdev *dev;
20 RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
21 dev = &rte_eventdevs[dev_id];
23 dlb2 = dlb2_pmd_priv(dev);
25 if (mode >= NUM_TOKEN_POP_MODES)
28 /* The event device must be configured, but not yet started */
29 if (!dlb2->configured || dlb2->run_state != DLB2_RUN_STATE_STOPPED)
32 /* The token pop mode must be set before configuring the port */
33 if (port_id >= dlb2->num_ports || dlb2->ev_ports[port_id].setup_done)
36 dlb2->ev_ports[port_id].qm_port.token_pop_mode = mode;