aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2020-09-11 14:10:35 +0200
committerAndrew Yourtchenko <ayourtch@gmail.com>2020-09-16 12:45:49 +0000
commitfb66fcf3fb7de414534650b3fce9627fefbe6a13 (patch)
tree75dcc9f47031189e9e1399b0d426f12f47f5f3fc /src/plugins
parent4b952f85bd24c8dfe72d3173f6bfbb27f67c2e2c (diff)
avf: change promisc mode from the avf process node
Avoid situations where promisc mode is chaged while avf process is suspended in the middle of adminq operation. Type: fix Change-Id: Ia1fc6551e83218b5938630ad3a15d4f3f0ceceff Signed-off-by: Damjan Marion <damarion@cisco.com> (cherry picked from commit 160a2a9a8c5c4e054dcc0e8ebeb3de7654718582)
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/avf/avf.h2
-rw-r--r--src/plugins/avf/device.c31
2 files changed, 26 insertions, 7 deletions
diff --git a/src/plugins/avf/avf.h b/src/plugins/avf/avf.h
index c4c0c13ebb9..43741dcad83 100644
--- a/src/plugins/avf/avf.h
+++ b/src/plugins/avf/avf.h
@@ -202,6 +202,8 @@ typedef enum
AVF_PROCESS_EVENT_START = 1,
AVF_PROCESS_EVENT_DELETE_IF = 2,
AVF_PROCESS_EVENT_AQ_INT = 3,
+ AVF_PROCESS_EVENT_SET_PROMISC_ENABLE = 4,
+ AVF_PROCESS_EVENT_SET_PROMISC_DISABLE = 5,
} avf_process_event_t;
typedef struct
diff --git a/src/plugins/avf/device.c b/src/plugins/avf/device.c
index 8b6451e8998..2b4801e2c81 100644
--- a/src/plugins/avf/device.c
+++ b/src/plugins/avf/device.c
@@ -1163,7 +1163,6 @@ avf_flag_change (vnet_main_t * vnm, vnet_hw_interface_t * hw, u32 flags)
{
vlib_main_t *vm = vlib_get_main ();
avf_device_t *ad = avf_get_device (hw->dev_instance);
- clib_error_t *error;
u8 promisc_enabled;
switch (flags)
@@ -1179,13 +1178,12 @@ avf_flag_change (vnet_main_t * vnm, vnet_hw_interface_t * hw, u32 flags)
}
promisc_enabled = ((ad->flags & AVF_DEVICE_F_PROMISC) != 0);
- if ((error = avf_config_promisc_mode (vm, ad, promisc_enabled)))
- {
- avf_log_err (ad, "%s: %U", format_clib_error, error);
- clib_error_free (error);
- return ~0;
- }
+ vlib_process_signal_event (vm, avf_process_node.index,
+ promisc_enabled ?
+ AVF_PROCESS_EVENT_SET_PROMISC_ENABLE :
+ AVF_PROCESS_EVENT_SET_PROMISC_DISABLE,
+ hw->dev_instance);
return 0;
}
@@ -1230,6 +1228,25 @@ avf_process (vlib_main_t * vm, vlib_node_runtime_t * rt, vlib_frame_t * f)
case AVF_PROCESS_EVENT_AQ_INT:
irq = 1;
break;
+ case AVF_PROCESS_EVENT_SET_PROMISC_ENABLE:
+ case AVF_PROCESS_EVENT_SET_PROMISC_DISABLE:
+ for (int i = 0; i < vec_len (event_data); i++)
+ {
+ avf_device_t *ad = avf_get_device (event_data[i]);
+ clib_error_t *err;
+ int is_enable = 0;
+
+ if (event_type == AVF_PROCESS_EVENT_SET_PROMISC_ENABLE)
+ is_enable = 1;
+
+ if ((err = avf_config_promisc_mode (vm, ad, is_enable)))
+ {
+ avf_log_err (ad, "%s: %U", format_clib_error, err);
+ clib_error_free (err);
+ }
+ }
+ break;
+
default:
ASSERT (0);
}