diff options
author | Benoît Ganne <bganne@cisco.com> | 2019-08-12 11:44:20 +0200 |
---|---|---|
committer | Andrew Yourtchenko <ayourtch@gmail.com> | 2019-09-21 08:25:56 +0000 |
commit | ffdfe308b9e0d325d9275a22386b949d6f643d0b (patch) | |
tree | 5e75827c855a1a9cc7e911482cdc00bcb1637d60 /src/plugins/rdma/device.c | |
parent | 5564db85327fc1778152d00b159efd57784d357b (diff) |
rdma: add support for MAC changes
Type: feature
Change-Id: I5803b52d12e56f2ccc1316e89ece6f1c5898810a
Signed-off-by: Benoît Ganne <bganne@cisco.com>
(cherry picked from commit 0dcafcc505dccb9243c90c57a20295d4f0afce29)
Diffstat (limited to 'src/plugins/rdma/device.c')
-rw-r--r-- | src/plugins/rdma/device.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/plugins/rdma/device.c b/src/plugins/rdma/device.c index 0fddc3a3a5d..62dff21b060 100644 --- a/src/plugins/rdma/device.c +++ b/src/plugins/rdma/device.c @@ -153,6 +153,20 @@ rdma_dev_set_ucast (rdma_device_t * rd) return 0; } +static clib_error_t * +rdma_mac_change (vnet_hw_interface_t * hw, const u8 * old, const u8 * new) +{ + rdma_main_t *rm = &rdma_main; + rdma_device_t *rd = vec_elt_at_index (rm->devices, hw->dev_instance); + mac_address_from_bytes (&rd->hwaddr, new); + if (!(rd->flags & RDMA_DEVICE_F_PROMISC) && rdma_dev_set_ucast (rd)) + { + mac_address_from_bytes (&rd->hwaddr, old); + return clib_error_return_unix (0, "MAC update failed"); + } + return 0; +} + static u32 rdma_dev_change_mtu (rdma_device_t * rd) { @@ -735,7 +749,7 @@ static char *rdma_tx_func_error_strings[] = { }; /* *INDENT-OFF* */ -VNET_DEVICE_CLASS (rdma_device_class,) = +VNET_DEVICE_CLASS (rdma_device_class) = { .name = "RDMA interface", .format_device = format_rdma_device, @@ -744,6 +758,7 @@ VNET_DEVICE_CLASS (rdma_device_class,) = .rx_redirect_to_node = rdma_set_interface_next_node, .tx_function_n_errors = RDMA_TX_N_ERROR, .tx_function_error_strings = rdma_tx_func_error_strings, + .mac_addr_change_function = rdma_mac_change, }; /* *INDENT-ON* */ |