Branch data Line data Source code
1 : : /* SPDX-License-Identifier: BSD-3-Clause 2 : : * Copyright(c) 2020 Intel Corporation 3 : : */ 4 : : 5 : : #include <eal_export.h> 6 : : #include <rte_eventdev.h> 7 : : #include <eventdev_pmd.h> 8 : : 9 : : #include "rte_pmd_dlb2.h" 10 : : #include "dlb2_priv.h" 11 : : #include "dlb2_inline_fns.h" 12 : : 13 : : RTE_EXPORT_EXPERIMENTAL_SYMBOL(rte_pmd_dlb2_set_token_pop_mode, 20.11) 14 : : int 15 : 0 : rte_pmd_dlb2_set_token_pop_mode(uint8_t dev_id, 16 : : uint8_t port_id, 17 : : enum dlb2_token_pop_mode mode) 18 : : { 19 : : struct dlb2_eventdev *dlb2; 20 : : struct rte_eventdev *dev; 21 : : 22 [ # # ]: 0 : RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL); 23 : : dev = &rte_eventdevs[dev_id]; 24 : : 25 : : dlb2 = dlb2_pmd_priv(dev); 26 : : 27 [ # # ]: 0 : if (mode >= NUM_TOKEN_POP_MODES) 28 : : return -EINVAL; 29 : : 30 : : /* The event device must be configured, but not yet started */ 31 [ # # # # ]: 0 : if (!dlb2->configured || dlb2->run_state != DLB2_RUN_STATE_STOPPED) 32 : : return -EINVAL; 33 : : 34 : : /* The token pop mode must be set before configuring the port */ 35 [ # # # # ]: 0 : if (port_id >= dlb2->num_ports || dlb2->ev_ports[port_id].setup_done) 36 : : return -EINVAL; 37 : : 38 : 0 : dlb2->ev_ports[port_id].qm_port.token_pop_mode = mode; 39 : : 40 : 0 : return 0; 41 : : }