35 str, xd->
port_id, rv, rte_strerror (rv));
47 struct rte_eth_dev_info dev_info;
57 if (xd->
flags & DPDK_DEVICE_FLAG_ADMIN_UP)
64 if (xd->
pmd == VNET_DPDK_PMD_I40E)
66 if ((xd->
flags & DPDK_DEVICE_FLAG_RX_FLOW_OFFLOAD) != 0)
67 xd->
port_conf.fdir_conf.mode = RTE_FDIR_MODE_PERFECT;
69 xd->
port_conf.fdir_conf.mode = RTE_FDIR_MODE_NONE;
72 rte_eth_dev_info_get (xd->
port_id, &dev_info);
74 bitmap = xd->
port_conf.txmode.offloads & ~dev_info.tx_offload_capa;
77 dpdk_log_warn (
"unsupported tx offloads requested on port %u: %U",
82 bitmap = xd->
port_conf.rxmode.offloads & ~dev_info.rx_offload_capa;
85 dpdk_log_warn (
"unsupported rx offloads requested on port %u: %U",
110 rte_eth_tx_queue_setup (xd->
port_id, j,
128 u16 socket_id = rte_lcore_to_socket_id (lcore);
139 SOCKET_ID_ANY, 0, mp);
152 if (xd->
flags & DPDK_DEVICE_FLAG_ADMIN_UP)
161 xd->
flags |= DPDK_DEVICE_FLAG_PMD_INIT_FAIL;
170 if (xd->
flags & DPDK_DEVICE_FLAG_PMD_INIT_FAIL)
173 rv = rte_eth_dev_start (xd->
port_id);
182 rv = rte_eth_dev_default_mac_addr_set (xd->
port_id,
188 if (xd->
flags & DPDK_DEVICE_FLAG_PROMISC)
189 rte_eth_promiscuous_enable (xd->
port_id);
191 rte_eth_promiscuous_disable (xd->
port_id);
193 rte_eth_allmulticast_enable (xd->
port_id);
202 if (xd->
flags & DPDK_DEVICE_FLAG_PMD_INIT_FAIL)
205 rte_eth_allmulticast_disable (xd->
port_id);
206 rte_eth_dev_stop (xd->
port_id);
217 enum rte_eth_event_type type,
void *param)
219 struct rte_eth_link link;
221 RTE_SET_USED (param);
222 if (type != RTE_ETH_EVENT_INTR_LSC)
224 dpdk_log_info (
"Unknown event %d received for port %d", type, port_id);
228 rte_eth_link_get_nowait (port_id, &link);
229 u8 link_up = link.link_status;
232 port_id, (
unsigned) link.link_speed,
233 (link.link_duplex == ETH_LINK_FULL_DUPLEX) ?
234 "full-duplex" :
"half-duplex");
243 enum rte_eth_event_type type,
245 void *ret_param __attribute__ ((unused)))
251 struct rte_pci_device *
254 const struct rte_bus *
bus;
256 bus = rte_bus_find_by_device (info->device);
257 if (bus && !strcmp (bus->name,
"pci"))
258 return RTE_DEV_TO_PCI (info->device);
format_function_t format_dpdk_tx_offload_caps
void vl_api_force_rpc_call_main_thread(void *fp, u8 *data, u32 data_length)
vnet_main_t * vnet_get_main(void)
static_always_inline vlib_buffer_pool_t * vlib_get_buffer_pool(vlib_main_t *vm, u8 buffer_pool_index)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
struct rte_pci_device * dpdk_get_pci_device(const struct rte_eth_dev_info *info)
static vnet_hw_interface_t * vnet_get_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
static vnet_sw_interface_t * vnet_get_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
int dpdk_port_state_callback(dpdk_portid_t port_id, enum rte_eth_event_type type, void *param, void *ret_param)
#define vec_validate_aligned(V, I, A)
Make sure vector is long enough for given index (no header, specified alignment)
clib_error_t * vnet_hw_interface_set_flags(vnet_main_t *vnm, u32 hw_if_index, vnet_hw_interface_flags_t flags)
#define dpdk_log_warn(...)
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
#define clib_error_return(e, args...)
void dpdk_device_setup(dpdk_device_t *xd)
struct rte_eth_conf port_conf
static void clib_spinlock_init(clib_spinlock_t *p)
struct rte_eth_txconf tx_conf
vlib_worker_thread_t * vlib_worker_threads
void dpdk_device_start(dpdk_device_t *xd)
static_always_inline uword vnet_get_device_input_thread_index(vnet_main_t *vnm, u32 hw_if_index, u16 queue_id)
vnet_sw_interface_flags_t flags
dpdk_tx_queue_t * tx_queues
#define dpdk_log_info(...)
static_always_inline uword vlib_get_thread_index(void)
#define dpdk_log_err(...)
static int dpdk_port_state_callback_inline(dpdk_portid_t port_id, enum rte_eth_event_type type, void *param)
void dpdk_device_stop(dpdk_device_t *xd)
void dpdk_device_error(dpdk_device_t *xd, char *str, int rv)
format_function_t format_dpdk_device_name
static vlib_main_t * vlib_get_main(void)
#define vec_elt(v, i)
Get vector value at index i.
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
format_function_t format_dpdk_rx_offload_caps
#define clib_error_free(e)
static vlib_thread_main_t * vlib_get_thread_main()
dpdk_rx_queue_t * rx_queues
struct rte_mempool ** dpdk_mempool_by_buffer_pool_index
#define CLIB_CACHE_LINE_BYTES
static u8 vlib_buffer_pool_get_default_for_numa(vlib_main_t *vm, u32 numa_node)
CLIB vectors are ubiquitous dynamically resized arrays with by user defined "headers".