36 str, xd->
port_id, rv, rte_strerror (rv));
54 if (xd->
flags & DPDK_DEVICE_FLAG_ADMIN_UP)
61 if (xd->
pmd == VNET_DPDK_PMD_I40E)
63 if ((xd->
flags & DPDK_DEVICE_FLAG_RX_FLOW_OFFLOAD) != 0)
64 xd->
port_conf.fdir_conf.mode = RTE_FDIR_MODE_PERFECT;
66 xd->
port_conf.fdir_conf.mode = RTE_FDIR_MODE_NONE;
88 rte_eth_tx_queue_setup (xd->
port_id, j,
103 u16 socket_id = rte_lcore_to_socket_id (lcore);
113 rte_eth_rx_queue_setup (xd->
port_id, j,
129 if (xd->
flags & DPDK_DEVICE_FLAG_ADMIN_UP)
138 xd->
flags |= DPDK_DEVICE_FLAG_PMD_INIT_FAIL;
147 if (xd->
flags & DPDK_DEVICE_FLAG_PMD_INIT_FAIL)
150 rv = rte_eth_dev_start (xd->
port_id);
160 rte_eth_dev_default_mac_addr_set (xd->
port_id,
161 (
struct ether_addr *)
167 if (xd->
flags & DPDK_DEVICE_FLAG_PROMISC)
168 rte_eth_promiscuous_enable (xd->
port_id);
170 rte_eth_promiscuous_disable (xd->
port_id);
172 rte_eth_allmulticast_enable (xd->
port_id);
174 if (xd->
pmd == VNET_DPDK_PMD_BOND)
177 int nlink = rte_eth_bond_slaves_get (xd->
port_id, slink, 16);
181 rte_eth_allmulticast_enable (dpdk_port);
192 if (xd->
flags & DPDK_DEVICE_FLAG_PMD_INIT_FAIL)
195 rte_eth_allmulticast_disable (xd->
port_id);
196 rte_eth_dev_stop (xd->
port_id);
199 if (xd->
pmd == VNET_DPDK_PMD_BOND)
202 int nlink = rte_eth_bond_slaves_get (xd->
port_id, slink, 16);
206 rte_eth_dev_stop (dpdk_port);
225 uword event_type, *event_data = 0;
234 for (i = 0; i <
vec_len (event_data); i++)
236 dpdk_port = event_data[
i];
253 .name =
"send-garp-na-process",
265 (vm, send_garp_na_proc_node.index,
SEND_GARP_NA, *dpdk_port);
270 enum rte_eth_event_type type,
void *param)
272 struct rte_eth_link link;
275 RTE_SET_USED (param);
276 if (type != RTE_ETH_EVENT_INTR_LSC)
278 dpdk_log_info (
"Unknown event %d received for port %d", type, port_id);
282 rte_eth_link_get_nowait (port_id, &link);
283 u8 link_up = link.link_status;
285 if (xd->flags & DPDK_DEVICE_FLAG_BOND_SLAVE)
287 uword bd_port = xd->bond_port;
288 int bd_mode = rte_eth_bond_mode_get (bd_port);
290 "slave of port %d BondEthernet%d in mode %d",
291 port_id, (link_up) ?
"UP" :
"DOWN",
292 bd_port, xd->bond_instance_num, bd_mode);
293 if (bd_mode == BONDING_MODE_ACTIVE_BACKUP)
300 xd->flags |= DPDK_DEVICE_FLAG_BOND_SLAVE_UP;
302 xd->flags &= ~DPDK_DEVICE_FLAG_BOND_SLAVE_UP;
308 port_id, (
unsigned) link.link_speed,
309 (link.link_duplex == ETH_LINK_FULL_DUPLEX) ?
310 "full-duplex" :
"half-duplex");
320 enum rte_eth_event_type type,
322 void *ret_param __attribute__ ((unused)))
clib_error_t * vnet_hw_interface_set_flags(vnet_main_t *vnm, u32 hw_if_index, u32 flags)
void vl_api_force_rpc_call_main_thread(void *fp, u8 *data, u32 data_length)
static uword * vlib_process_wait_for_event(vlib_main_t *vm)
vnet_main_t * vnet_get_main(void)
static f64 vlib_time_now(vlib_main_t *vm)
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)
void send_ip6_na(vlib_main_t *vm, u32 sw_if_index)
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
static uword vlib_process_suspend(vlib_main_t *vm, f64 dt)
Suspend a vlib cooperative multi-tasking thread for a period of time.
static uword vlib_process_get_events(vlib_main_t *vm, uword **data_vector)
Return the first event type which has occurred and a vector of per-event data of that type...
#define clib_error_return(e, args...)
void dpdk_device_setup(dpdk_device_t *xd)
struct rte_eth_conf port_conf
static uword send_garp_na_process(vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f)
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)
static void vlib_process_signal_event(vlib_main_t *vm, uword node_index, uword type_opaque, uword data)
static void garp_na_proc_callback(uword *dpdk_port)
#define dpdk_log_info(...)
void send_ip4_garp(vlib_main_t *vm, u32 sw_if_index)
#define VLIB_REGISTER_NODE(x,...)
static_always_inline uword vlib_get_thread_index(void)
#define dpdk_log_err(...)
static vlib_node_registration_t send_garp_na_proc_node
(constructor) VLIB_REGISTER_NODE (send_garp_na_proc_node)
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
struct rte_mempool ** pktmbuf_pools
void dpdk_update_link_state(dpdk_device_t *xd, f64 now)
static vlib_main_t * vlib_get_main(void)
struct _vlib_node_registration vlib_node_registration_t
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
#define VNET_SW_INTERFACE_FLAG_ERROR
#define clib_error_free(e)
#define CLIB_CACHE_LINE_BYTES
enum @389 dpdk_send_garp_na_process_event_t
u8 * buffer_pool_for_queue
CLIB vectors are ubiquitous dynamically resized arrays with by user defined "headers".