diff options
Diffstat (limited to 'vnet')
-rw-r--r-- | vnet/vnet/devices/dpdk/device.c | 34 | ||||
-rw-r--r-- | vnet/vnet/devices/dpdk/dpdk.h | 5 | ||||
-rw-r--r-- | vnet/vnet/plugin/p1.c | 4 |
3 files changed, 42 insertions, 1 deletions
diff --git a/vnet/vnet/devices/dpdk/device.c b/vnet/vnet/devices/dpdk/device.c index d68c5abb4f0..a93e9f4cf82 100644 --- a/vnet/vnet/devices/dpdk/device.c +++ b/vnet/vnet/devices/dpdk/device.c @@ -43,6 +43,40 @@ static char * dpdk_tx_func_error_strings[] = { #undef _ }; +clib_error_t * +dpdk_set_mac_address (vnet_hw_interface_t * hi, char * address) +{ + int error; + dpdk_main_t * dm = &dpdk_main; + dpdk_device_t * xd = vec_elt_at_index (dm->devices, hi->dev_instance); + + error=rte_eth_dev_default_mac_addr_set(xd->device_index, + (struct ether_addr *) address); + + if (error) { + return clib_error_return (0, "mac address set failed: %d", error); + } else { + return NULL; + } +} + +clib_error_t * +dpdk_set_mc_filter (vnet_hw_interface_t * hi, + struct ether_addr mc_addr_vec[], int naddr) +{ + int error; + dpdk_main_t * dm = &dpdk_main; + dpdk_device_t * xd = vec_elt_at_index (dm->devices, hi->dev_instance); + + error=rte_eth_dev_set_mc_addr_list(xd->device_index, mc_addr_vec, naddr); + + if (error) { + return clib_error_return (0, "mc addr list failed: %d", error); + } else { + return NULL; + } +} + static struct rte_mbuf * dpdk_replicate_packet_mb (vlib_buffer_t * b) { vlib_main_t * vm = vlib_get_main(); diff --git a/vnet/vnet/devices/dpdk/dpdk.h b/vnet/vnet/devices/dpdk/dpdk.h index b35425c2668..e90f4030ce9 100644 --- a/vnet/vnet/devices/dpdk/dpdk.h +++ b/vnet/vnet/devices/dpdk/dpdk.h @@ -424,6 +424,11 @@ void vnet_buffer_needs_dpdk_mb (vlib_buffer_t * b); void dpdk_set_next_node (dpdk_rx_next_t, char *); +clib_error_t * dpdk_set_mac_address (vnet_hw_interface_t * hi, char * address); + +clib_error_t * dpdk_set_mc_filter (vnet_hw_interface_t * hi, + struct ether_addr mc_addr_vec[], int naddr); + typedef void (*dpdk_io_thread_callback_t) (vlib_main_t *vm); void dpdk_io_thread (vlib_worker_thread_t * w, diff --git a/vnet/vnet/plugin/p1.c b/vnet/vnet/plugin/p1.c index b93ce375f8f..69f8f5c056a 100644 --- a/vnet/vnet/plugin/p1.c +++ b/vnet/vnet/plugin/p1.c @@ -110,7 +110,9 @@ _(rte_malloc_virt2phy) \ _(rte_eal_get_configuration) \ _(post_sw_interface_set_flags) \ _(dpdk_get_admin_up_down_in_progress) \ -_(efd_config) +_(efd_config) \ +_(dpdk_set_mac_address) \ +_(dpdk_set_mc_filter) #else #define foreach_dpdk_plugin_reference #endif |