diff options
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/af_xdp/device.c | 15 | ||||
-rw-r--r-- | src/plugins/avf/device.c | 12 | ||||
-rw-r--r-- | src/plugins/dpdk/device/init.c | 12 | ||||
-rw-r--r-- | src/plugins/geneve/geneve.c | 15 | ||||
-rw-r--r-- | src/plugins/marvell/pp2/pp2.c | 16 | ||||
-rw-r--r-- | src/plugins/memif/memif.c | 11 | ||||
-rw-r--r-- | src/plugins/rdma/device.c | 12 | ||||
-rw-r--r-- | src/plugins/unittest/bier_test.c | 45 | ||||
-rw-r--r-- | src/plugins/unittest/fib_test.c | 26 | ||||
-rw-r--r-- | src/plugins/unittest/mfib_test.c | 51 | ||||
-rw-r--r-- | src/plugins/vmxnet3/vmxnet3.c | 17 |
11 files changed, 111 insertions, 121 deletions
diff --git a/src/plugins/af_xdp/device.c b/src/plugins/af_xdp/device.c index c45e873f662..4aa36d95dd5 100644 --- a/src/plugins/af_xdp/device.c +++ b/src/plugins/af_xdp/device.c @@ -505,6 +505,7 @@ af_xdp_create_if (vlib_main_t * vm, af_xdp_create_if_args_t * args) { vnet_main_t *vnm = vnet_get_main (); vlib_thread_main_t *tm = vlib_get_thread_main (); + vnet_eth_interface_registration_t eir = {}; af_xdp_main_t *am = &af_xdp_main; af_xdp_device_t *ad; vnet_sw_interface_t *sw; @@ -646,15 +647,11 @@ af_xdp_create_if (vlib_main_t * vm, af_xdp_create_if_args_t * args) ethernet_mac_address_generate (ad->hwaddr); /* create interface */ - if (ethernet_register_interface (vnm, af_xdp_device_class.index, - ad->dev_instance, ad->hwaddr, - &ad->hw_if_index, af_xdp_flag_change)) - { - args->rv = VNET_API_ERROR_INVALID_INTERFACE; - args->error = - clib_error_return (0, "ethernet_register_interface() failed"); - goto err2; - } + eir.dev_class_index = af_xdp_device_class.index; + eir.dev_instance = ad->dev_instance; + eir.address = ad->hwaddr; + eir.cb.flag_change = af_xdp_flag_change; + ad->hw_if_index = vnet_eth_register_interface (vnm, &eir); sw = vnet_get_hw_sw_interface (vnm, ad->hw_if_index); args->sw_if_index = ad->sw_if_index = sw->sw_if_index; diff --git a/src/plugins/avf/device.c b/src/plugins/avf/device.c index 627ead6f4e5..df6d12881a5 100644 --- a/src/plugins/avf/device.c +++ b/src/plugins/avf/device.c @@ -1589,6 +1589,7 @@ void avf_create_if (vlib_main_t * vm, avf_create_if_args_t * args) { vnet_main_t *vnm = vnet_get_main (); + vnet_eth_interface_registration_t eir = {}; avf_main_t *am = &avf_main; avf_device_t *ad, **adp; vlib_pci_dev_handle_t h; @@ -1722,12 +1723,11 @@ avf_create_if (vlib_main_t * vm, avf_create_if_args_t * args) goto error; /* create interface */ - error = ethernet_register_interface (vnm, avf_device_class.index, - ad->dev_instance, ad->hwaddr, - &ad->hw_if_index, avf_flag_change); - - if (error) - goto error; + eir.dev_class_index = avf_device_class.index; + eir.dev_instance = ad->dev_instance; + eir.address = ad->hwaddr; + eir.cb.flag_change = avf_flag_change; + ad->hw_if_index = vnet_eth_register_interface (vnm, &eir); ethernet_set_flags (vnm, ad->hw_if_index, ETHERNET_INTERFACE_FLAG_DEFAULT_L3); diff --git a/src/plugins/dpdk/device/init.c b/src/plugins/dpdk/device/init.c index d30c08c28fd..8a466a0169f 100644 --- a/src/plugins/dpdk/device/init.c +++ b/src/plugins/dpdk/device/init.c @@ -176,7 +176,6 @@ dpdk_lib_init (dpdk_main_t * dm) vnet_main_t *vnm = vnet_get_main (); u32 nports; u16 port_id; - clib_error_t *error; vlib_main_t *vm = vlib_get_main (); vlib_thread_main_t *tm = vlib_get_thread_main (); vnet_device_main_t *vdm = &vnet_device_main; @@ -226,6 +225,7 @@ dpdk_lib_init (dpdk_main_t * dm) struct rte_vmbus_device *vmbus_dev; dpdk_portid_t next_port_id; dpdk_device_config_t *devconf = 0; + vnet_eth_interface_registration_t eir = {}; vlib_pci_addr_t pci_addr; vlib_vmbus_addr_t vmbus_addr; uword *p = 0; @@ -650,11 +650,11 @@ dpdk_lib_init (dpdk_main_t * dm) /* assign interface to input thread */ int q; - error = ethernet_register_interface ( - vnm, dpdk_device_class.index, xd->device_index, - /* ethernet address */ addr, &xd->hw_if_index, dpdk_flag_change); - if (error) - return error; + eir.dev_class_index = dpdk_device_class.index; + eir.dev_instance = xd->device_index; + eir.address = addr; + eir.cb.flag_change = dpdk_flag_change; + xd->hw_if_index = vnet_eth_register_interface (vnm, &eir); sw = vnet_get_hw_sw_interface (vnm, xd->hw_if_index); xd->sw_if_index = sw->sw_if_index; diff --git a/src/plugins/geneve/geneve.c b/src/plugins/geneve/geneve.c index 81c96c1c42e..bc0ad58672a 100644 --- a/src/plugins/geneve/geneve.c +++ b/src/plugins/geneve/geneve.c @@ -425,18 +425,15 @@ int vnet_geneve_add_del_tunnel vnet_hw_interface_t *hi; if (a->l3_mode) { + vnet_eth_interface_registration_t eir = {}; u32 t_idx = t - vxm->tunnels; u8 address[6] = { 0xd0, 0x0b, 0xee, 0xd0, (u8) (t_idx >> 8), (u8) t_idx }; - clib_error_t *error = - ethernet_register_interface (vnm, geneve_device_class.index, - t_idx, - address, &hw_if_index, 0); - if (error) - { - clib_error_report (error); - return VNET_API_ERROR_INVALID_REGISTRATION; - } + + eir.dev_class_index = geneve_device_class.index; + eir.dev_instance = t_idx; + eir.address = address; + hw_if_index = vnet_eth_register_interface (vnm, &eir); } else { diff --git a/src/plugins/marvell/pp2/pp2.c b/src/plugins/marvell/pp2/pp2.c index dfe5c157018..071fb5d9d66 100644 --- a/src/plugins/marvell/pp2/pp2.c +++ b/src/plugins/marvell/pp2/pp2.c @@ -178,6 +178,7 @@ mrvl_pp2_create_if (mrvl_pp2_create_if_args_t * args) vlib_main_t *vm = vlib_get_main (); vnet_main_t *vnm = vnet_get_main (); vlib_thread_main_t *tm = vlib_get_thread_main (); + vnet_eth_interface_registration_t eir = {}; mrvl_pp2_main_t *ppm = &mrvl_pp2_main; struct pp2_bpool_params bpool_params = { 0 }; struct pp2_ppio_params ppio_params = { 0 }; @@ -282,16 +283,11 @@ mrvl_pp2_create_if (mrvl_pp2_create_if_args_t * args) goto error; } - args->error = ethernet_register_interface (vnm, mrvl_pp2_device_class.index, - ppif->dev_instance, - mac_addr, - &ppif->hw_if_index, - mrvl_pp2_eth_flag_change); - if (args->error) - { - args->rv = VNET_API_ERROR_INVALID_REGISTRATION; - goto error; - } + eir.dev_class_index = mrvl_pp2_device_class.index; + eir.dev_instance = ppif->dev_instance; + eir.address = mac_addr; + eir.cb.flag_change = mrvl_pp2_eth_flag_change; + ppif->hw_if_index = vnet_eth_register_interface (vnm, &eir); sw = vnet_get_hw_sw_interface (vnm, ppif->hw_if_index); ppif->sw_if_index = sw->sw_if_index; diff --git a/src/plugins/memif/memif.c b/src/plugins/memif/memif.c index d7b82ceee5e..5da73621536 100644 --- a/src/plugins/memif/memif.c +++ b/src/plugins/memif/memif.c @@ -897,6 +897,7 @@ memif_create_if (vlib_main_t * vm, memif_create_if_args_t * args) memif_main_t *mm = &memif_main; vlib_thread_main_t *tm = vlib_get_thread_main (); vnet_main_t *vnm = vnet_get_main (); + vnet_eth_interface_registration_t eir = {}; memif_if_t *mif = 0; vnet_sw_interface_t *sw; clib_error_t *error = 0; @@ -1011,10 +1012,12 @@ memif_create_if (vlib_main_t * vm, memif_create_if_args_t * args) args->hw_addr[0] = 2; args->hw_addr[1] = 0xfe; } - error = ethernet_register_interface (vnm, memif_device_class.index, - mif->dev_instance, args->hw_addr, - &mif->hw_if_index, - memif_eth_flag_change); + + eir.dev_class_index = memif_device_class.index; + eir.dev_instance = mif->dev_instance; + eir.address = args->hw_addr; + eir.cb.flag_change = memif_eth_flag_change; + mif->hw_if_index = vnet_eth_register_interface (vnm, &eir); } else if (mif->mode == MEMIF_INTERFACE_MODE_IP) { diff --git a/src/plugins/rdma/device.c b/src/plugins/rdma/device.c index 3ea8e44b3e7..cad5fdb541f 100644 --- a/src/plugins/rdma/device.c +++ b/src/plugins/rdma/device.c @@ -355,17 +355,19 @@ rdma_async_event_cleanup (rdma_device_t * rd) static clib_error_t * rdma_register_interface (vnet_main_t * vnm, rdma_device_t * rd) { - clib_error_t *err = - ethernet_register_interface (vnm, rdma_device_class.index, - rd->dev_instance, rd->hwaddr.bytes, - &rd->hw_if_index, rdma_flag_change); + vnet_eth_interface_registration_t eir = {}; + eir.dev_class_index = rdma_device_class.index; + eir.dev_instance = rd->dev_instance; + eir.address = rd->hwaddr.bytes; + eir.cb.flag_change = rdma_flag_change; + rd->hw_if_index = vnet_eth_register_interface (vnm, &eir); /* Indicate ability to support L3 DMAC filtering and * initialize interface to L3 non-promisc mode */ vnet_hw_if_set_caps (vnm, rd->hw_if_index, VNET_HW_IF_CAP_MAC_FILTER); ethernet_set_flags (vnm, rd->hw_if_index, ETHERNET_INTERFACE_FLAG_DEFAULT_L3); - return err; + return 0; } static void diff --git a/src/plugins/unittest/bier_test.c b/src/plugins/unittest/bier_test.c index 7f7439d8590..924c9212929 100644 --- a/src/plugins/unittest/bier_test.c +++ b/src/plugins/unittest/bier_test.c @@ -118,28 +118,29 @@ bier_test_mk_intf (u32 ninterfaces) for (i = 0; i < ninterfaces; i++) { - hw_address[5] = i; - - error = ethernet_register_interface(vnet_get_main(), - test_interface_device_class.index, - i /* instance */, - hw_address, - &tm->hw_if_indicies[i], - /* flag change */ 0); - - error = vnet_hw_interface_set_flags(vnet_get_main(), - tm->hw_if_indicies[i], - VNET_HW_INTERFACE_FLAG_LINK_UP); - BIER_TEST((NULL == error), "ADD interface %d", i); - - tm->hw[i] = vnet_get_hw_interface(vnet_get_main(), - tm->hw_if_indicies[i]); - ip4_main.fib_index_by_sw_if_index[tm->hw[i]->sw_if_index] = 0; - ip6_main.fib_index_by_sw_if_index[tm->hw[i]->sw_if_index] = 0; - error = vnet_sw_interface_set_flags(vnet_get_main(), - tm->hw[i]->sw_if_index, - VNET_SW_INTERFACE_FLAG_ADMIN_UP); - BIER_TEST((NULL == error), "UP interface %d", i); + vnet_eth_interface_registration_t eir = {}; + vnet_main_t *vnm = vnet_get_main (); + + hw_address[5] = i; + + eir.dev_class_index = test_interface_device_class.index; + eir.dev_instance = i; + eir.address = hw_address; + tm->hw_if_indicies[i] = vnet_eth_register_interface (vnm, &eir); + + error = + vnet_hw_interface_set_flags (vnet_get_main (), tm->hw_if_indicies[i], + VNET_HW_INTERFACE_FLAG_LINK_UP); + BIER_TEST ((NULL == error), "ADD interface %d", i); + + tm->hw[i] = + vnet_get_hw_interface (vnet_get_main (), tm->hw_if_indicies[i]); + ip4_main.fib_index_by_sw_if_index[tm->hw[i]->sw_if_index] = 0; + ip6_main.fib_index_by_sw_if_index[tm->hw[i]->sw_if_index] = 0; + error = + vnet_sw_interface_set_flags (vnet_get_main (), tm->hw[i]->sw_if_index, + VNET_SW_INTERFACE_FLAG_ADMIN_UP); + BIER_TEST ((NULL == error), "UP interface %d", i); } /* * re-eval after the inevitable realloc diff --git a/src/plugins/unittest/fib_test.c b/src/plugins/unittest/fib_test.c index 3166e649bfe..2261a9d28d0 100644 --- a/src/plugins/unittest/fib_test.c +++ b/src/plugins/unittest/fib_test.c @@ -142,16 +142,15 @@ fib_test_mk_intf (u32 ninterfaces) for (i = 0; i < ninterfaces; i++) { - hw_address[5] = i; + vnet_eth_interface_registration_t eir = {}; + vnet_main_t *vnm = vnet_get_main(); - error = ethernet_register_interface(vnet_get_main(), - test_interface_device_class.index, - i /* instance */, - hw_address, - &tm->hw_if_indicies[i], - /* flag change */ 0); + hw_address[5] = i; - FIB_TEST((NULL == error), "ADD interface %d", i); + eir.dev_class_index = test_interface_device_class.index; + eir.dev_instance = i; + eir.address = hw_address; + tm->hw_if_indicies[i] = vnet_eth_register_interface (vnm, &eir); error = vnet_hw_interface_set_flags(vnet_get_main(), tm->hw_if_indicies[i], @@ -5169,12 +5168,11 @@ fib_test_v6 (void) /* * Add the interface back. routes stay unresolved. */ - error = ethernet_register_interface(vnet_get_main(), - test_interface_device_class.index, - 0 /* instance */, - hw_address, - &tm->hw_if_indicies[0], - /* flag change */ 0); + vnet_eth_interface_registration_t eir = {}; + eir.dev_class_index = test_interface_device_class.index; + eir.dev_instance = 0; + eir.address = hw_address; + tm->hw_if_indicies[0] = vnet_eth_register_interface (vnet_get_main(), &eir); fei = fib_table_lookup_exact_match(fib_index, &pfx_2001_b_s_64); FIB_TEST(load_balance_is_drop(fib_entry_contribute_ip_forwarding(fei)), diff --git a/src/plugins/unittest/mfib_test.c b/src/plugins/unittest/mfib_test.c index 1fb4361e793..5cf821fb5f9 100644 --- a/src/plugins/unittest/mfib_test.c +++ b/src/plugins/unittest/mfib_test.c @@ -123,32 +123,31 @@ mfib_test_mk_intf (u32 ninterfaces) for (i = 0; i < ninterfaces; i++) { - hw_address[5] = i; - - error = ethernet_register_interface(vnet_get_main(), - test_interface_device_class.index, - i /* instance */, - hw_address, - &tm->hw_if_indicies[i], - /* flag change */ 0); - - MFIB_TEST((NULL == error), "ADD interface %d", i); - - error = vnet_hw_interface_set_flags(vnet_get_main(), - tm->hw_if_indicies[i], - VNET_HW_INTERFACE_FLAG_LINK_UP); - tm->hw[i] = vnet_get_hw_interface(vnet_get_main(), - tm->hw_if_indicies[i]); - ip4_main.fib_index_by_sw_if_index[tm->hw[i]->sw_if_index] = 0; - ip6_main.fib_index_by_sw_if_index[tm->hw[i]->sw_if_index] = 0; - - ip4_main.mfib_index_by_sw_if_index[tm->hw[i]->sw_if_index] = 0; - ip6_main.mfib_index_by_sw_if_index[tm->hw[i]->sw_if_index] = 0; - - error = vnet_sw_interface_set_flags(vnet_get_main(), - tm->hw[i]->sw_if_index, - VNET_SW_INTERFACE_FLAG_ADMIN_UP); - MFIB_TEST((NULL == error), "UP interface %d", i); + vnet_eth_interface_registration_t eir = {}; + vnet_main_t *vnm = vnet_get_main (); + + hw_address[5] = i; + + eir.dev_class_index = test_interface_device_class.index; + eir.dev_instance = i; + eir.address = hw_address; + tm->hw_if_indicies[i] = vnet_eth_register_interface (vnm, &eir); + + error = + vnet_hw_interface_set_flags (vnet_get_main (), tm->hw_if_indicies[i], + VNET_HW_INTERFACE_FLAG_LINK_UP); + tm->hw[i] = + vnet_get_hw_interface (vnet_get_main (), tm->hw_if_indicies[i]); + ip4_main.fib_index_by_sw_if_index[tm->hw[i]->sw_if_index] = 0; + ip6_main.fib_index_by_sw_if_index[tm->hw[i]->sw_if_index] = 0; + + ip4_main.mfib_index_by_sw_if_index[tm->hw[i]->sw_if_index] = 0; + ip6_main.mfib_index_by_sw_if_index[tm->hw[i]->sw_if_index] = 0; + + error = + vnet_sw_interface_set_flags (vnet_get_main (), tm->hw[i]->sw_if_index, + VNET_SW_INTERFACE_FLAG_ADMIN_UP); + MFIB_TEST ((NULL == error), "UP interface %d", i); } /* * re-eval after the inevitable realloc diff --git a/src/plugins/vmxnet3/vmxnet3.c b/src/plugins/vmxnet3/vmxnet3.c index 8059d03c595..edd0b4f4f75 100644 --- a/src/plugins/vmxnet3/vmxnet3.c +++ b/src/plugins/vmxnet3/vmxnet3.c @@ -617,6 +617,8 @@ vmxnet3_create_if (vlib_main_t * vm, vmxnet3_create_if_args_t * args) { vnet_main_t *vnm = vnet_get_main (); vmxnet3_main_t *vmxm = &vmxnet3_main; + vnet_eth_interface_registration_t eir = {}; + vmxnet3_device_t *vd; vlib_pci_dev_handle_t h; clib_error_t *error = 0; @@ -802,16 +804,11 @@ vmxnet3_create_if (vlib_main_t * vm, vmxnet3_create_if_args_t * args) } /* create interface */ - error = ethernet_register_interface (vnm, vmxnet3_device_class.index, - vd->dev_instance, vd->mac_addr, - &vd->hw_if_index, vmxnet3_flag_change); - - if (error) - { - vmxnet3_log_error (vd, - "error encountered on ethernet register interface"); - goto error; - } + eir.dev_class_index = vmxnet3_device_class.index; + eir.dev_instance = vd->dev_instance; + eir.address = vd->mac_addr; + eir.cb.flag_change = vmxnet3_flag_change; + vd->hw_if_index = vnet_eth_register_interface (vnm, &eir); vnet_sw_interface_t *sw = vnet_get_hw_sw_interface (vnm, vd->hw_if_index); vd->sw_if_index = sw->sw_if_index; |