summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorChenmin Sun <chenmin.sun@intel.com>2020-11-19 22:58:08 +0800
committerDamjan Marion <dmarion@me.com>2021-03-25 15:56:59 +0000
commitc2d30ade27b2b6e75b33724ff198c1fb3f4e71ff (patch)
tree73c42888d5844169fabf243fdfd491d56757e3f1 /src/plugins
parent7df43dc2ce887a253383a311da72e3430e91d01e (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')
-rw-r--r--src/plugins/avf/avf.h12
-rw-r--r--src/plugins/avf/device.c36
-rw-r--r--src/plugins/avf/virtchnl.h75
3 files changed, 86 insertions, 37 deletions
diff --git a/src/plugins/avf/avf.h b/src/plugins/avf/avf.h
index 23cc36c4882..53e1275ea62 100644
--- a/src/plugins/avf/avf.h
+++ b/src/plugins/avf/avf.h
@@ -246,6 +246,7 @@ typedef enum
{
AVF_PROCESS_REQ_ADD_DEL_ETH_ADDR = 1,
AVF_PROCESS_REQ_CONFIG_PROMISC_MDDE = 2,
+ AVF_PROCESS_REQ_PROGRAM_FLOW = 3,
} avf_process_req_type_t;
typedef struct
@@ -255,6 +256,13 @@ typedef struct
u32 calling_process_index;
u8 eth_addr[6];
int is_add, is_enable;
+
+ /* below parameters are used for 'program flow' event */
+ u8 *rule;
+ u32 rule_len;
+ u8 *program_status;
+ u32 status_len;
+
clib_error_t *error;
} avf_process_req_t;
@@ -303,6 +311,10 @@ extern vlib_node_registration_t avf_input_node;
extern vlib_node_registration_t avf_process_node;
extern vnet_device_class_t avf_device_class;
+clib_error_t *avf_program_flow (u32 dev_instance, int is_add, u8 *rule,
+ u32 rule_len, u8 *program_status,
+ u32 status_len);
+
/* format.c */
format_function_t format_avf_device;
format_function_t format_avf_device_name;
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,) =
{
diff --git a/src/plugins/avf/virtchnl.h b/src/plugins/avf/virtchnl.h
index 1657c027e70..32d2ea00a6f 100644
--- a/src/plugins/avf/virtchnl.h
+++ b/src/plugins/avf/virtchnl.h
@@ -62,43 +62,44 @@ enum
#define AVF_AQ_F_EI (1 << 14)
#define AVF_AQ_F_FE (1 << 15)
-
-#define foreach_virtchnl_op \
- _(0, UNKNOWN) \
- _(1, VERSION) \
- _(2, RESET_VF) \
- _(3, GET_VF_RESOURCES) \
- _(4, CONFIG_TX_QUEUE) \
- _(5, CONFIG_RX_QUEUE) \
- _(6, CONFIG_VSI_QUEUES) \
- _(7, CONFIG_IRQ_MAP) \
- _(8, ENABLE_QUEUES) \
- _(9, DISABLE_QUEUES) \
- _(10, ADD_ETH_ADDR) \
- _(11, DEL_ETH_ADDR) \
- _(12, ADD_VLAN) \
- _(13, DEL_VLAN) \
- _(14, CONFIG_PROMISCUOUS_MODE) \
- _(15, GET_STATS) \
- _(16, RSVD) \
- _(17, EVENT) \
- _(18, UNDEF_18) \
- _(19, UNDEF_19) \
- _(20, IWARP) \
- _(21, CONFIG_IWARP_IRQ_MAP) \
- _(22, RELEASE_IWARP_IRQ_MAP) \
- _(23, CONFIG_RSS_KEY) \
- _(24, CONFIG_RSS_LUT) \
- _(25, GET_RSS_HENA_CAPS) \
- _(26, SET_RSS_HENA) \
- _(27, ENABLE_VLAN_STRIPPING) \
- _(28, DISABLE_VLAN_STRIPPING) \
- _(29, REQUEST_QUEUES) \
- _(30, ENABLE_CHANNELS) \
- _(31, DISABLE_CHANNELS) \
- _(32, ADD_CLOUD_FILTER) \
- _(33, DEL_CLOUD_FILTER)
-
+#define foreach_virtchnl_op \
+ _ (0, UNKNOWN) \
+ _ (1, VERSION) \
+ _ (2, RESET_VF) \
+ _ (3, GET_VF_RESOURCES) \
+ _ (4, CONFIG_TX_QUEUE) \
+ _ (5, CONFIG_RX_QUEUE) \
+ _ (6, CONFIG_VSI_QUEUES) \
+ _ (7, CONFIG_IRQ_MAP) \
+ _ (8, ENABLE_QUEUES) \
+ _ (9, DISABLE_QUEUES) \
+ _ (10, ADD_ETH_ADDR) \
+ _ (11, DEL_ETH_ADDR) \
+ _ (12, ADD_VLAN) \
+ _ (13, DEL_VLAN) \
+ _ (14, CONFIG_PROMISCUOUS_MODE) \
+ _ (15, GET_STATS) \
+ _ (16, RSVD) \
+ _ (17, EVENT) \
+ _ (18, UNDEF_18) \
+ _ (19, UNDEF_19) \
+ _ (20, IWARP) \
+ _ (21, CONFIG_IWARP_IRQ_MAP) \
+ _ (22, RELEASE_IWARP_IRQ_MAP) \
+ _ (23, CONFIG_RSS_KEY) \
+ _ (24, CONFIG_RSS_LUT) \
+ _ (25, GET_RSS_HENA_CAPS) \
+ _ (26, SET_RSS_HENA) \
+ _ (27, ENABLE_VLAN_STRIPPING) \
+ _ (28, DISABLE_VLAN_STRIPPING) \
+ _ (29, REQUEST_QUEUES) \
+ _ (30, ENABLE_CHANNELS) \
+ _ (31, DISABLE_CHANNELS) \
+ _ (32, ADD_CLOUD_FILTER) \
+ _ (33, DEL_CLOUD_FILTER) \
+ _ (47, ADD_FDIR_FILTER) \
+ _ (48, DEL_FDIR_FILTER) \
+ _ (49, QUERY_FDIR_FILTER)
typedef enum
{