diff options
author | Chenmin Sun <chenmin.sun@intel.com> | 2020-11-19 22:58:08 +0800 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2021-03-25 15:56:59 +0000 |
commit | c2d30ade27b2b6e75b33724ff198c1fb3f4e71ff (patch) | |
tree | 73c42888d5844169fabf243fdfd491d56757e3f1 /src/plugins/avf/device.c | |
parent | 7df43dc2ce887a253383a311da72e3430e91d01e (diff) |
avf: introduce program flow event
This patch introduces a 'program flow' virtchannel event.
The parameter is_add is used to identify adding or deleting the rule from avf
Type: improvement
Signed-off-by: Chenmin Sun <chenmin.sun@intel.com>
Change-Id: I1f5545ddc23e4494a25afa36ff601607405a8c3d
Diffstat (limited to 'src/plugins/avf/device.c')
-rw-r--r-- | src/plugins/avf/device.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/plugins/avf/device.c b/src/plugins/avf/device.c index aec7efaee6f..e4305251b23 100644 --- a/src/plugins/avf/device.c +++ b/src/plugins/avf/device.c @@ -1176,6 +1176,20 @@ error: vlib_log_err (avf_log.class, "%U", format_clib_error, ad->error); } +clib_error_t * +avf_op_program_flow (vlib_main_t *vm, avf_device_t *ad, int is_create, + u8 *rule, u32 rule_len, u8 *program_status, + u32 status_len) +{ + avf_log_debug (ad, "avf_op_program_flow: vsi_id %u is_create %u", ad->vsi_id, + is_create); + + return avf_send_to_pf (vm, ad, + is_create ? VIRTCHNL_OP_ADD_FDIR_FILTER : + VIRTCHNL_OP_DEL_FDIR_FILTER, + rule, rule_len, program_status, status_len); +} + static void avf_process_handle_request (vlib_main_t * vm, avf_process_req_t * req) { @@ -1186,6 +1200,10 @@ avf_process_handle_request (vlib_main_t * vm, avf_process_req_t * req) req->is_add); else if (req->type == AVF_PROCESS_REQ_CONFIG_PROMISC_MDDE) req->error = avf_op_config_promisc_mode (vm, ad, req->is_enable); + else if (req->type == AVF_PROCESS_REQ_PROGRAM_FLOW) + req->error = + avf_op_program_flow (vm, ad, req->is_add, req->rule, req->rule_len, + req->program_status, req->status_len); else clib_panic ("BUG: unknown avf proceess request type"); @@ -1793,6 +1811,24 @@ avf_clear_hw_interface_counters (u32 instance) &ad->eth_stats, sizeof (ad->eth_stats)); } +clib_error_t * +avf_program_flow (u32 dev_instance, int is_add, u8 *rule, u32 rule_len, + u8 *program_status, u32 status_len) +{ + vlib_main_t *vm = vlib_get_main (); + avf_process_req_t req; + + req.dev_instance = dev_instance; + req.type = AVF_PROCESS_REQ_PROGRAM_FLOW; + req.is_add = is_add; + req.rule = rule; + req.rule_len = rule_len; + req.program_status = program_status; + req.status_len = status_len; + + return avf_process_request (vm, &req); +} + /* *INDENT-OFF* */ VNET_DEVICE_CLASS (avf_device_class,) = { |