7f83738b46
0001 ~ 0014 patches are for virtual channel and PMD 0015 is the iavf fdir framework 0016 ~ 0017 are for the iavf fidr driver Type: feature Signed-off-by: Chenmin Sun <chenmin.sun@intel.com> Change-Id: I38e69ca0065a71cc6ba0b44ef7c7db51193a0899
239 lines
7.6 KiB
Diff
239 lines
7.6 KiB
Diff
From 5e4e6320a3c306b277d71a1811cf616fc2a6de93 Mon Sep 17 00:00:00 2001
|
|
From: Chenmin Sun <chenmin.sun@intel.com>
|
|
Date: Fri, 17 Apr 2020 05:53:35 +0800
|
|
Subject: [DPDK 16/17] common/iavf: add flow director support in virtual
|
|
channel
|
|
|
|
Adds new ops and structures to support VF to add/delete/validate/
|
|
query flow director.
|
|
|
|
ADD and VALIDATE FDIR share one ops: VIRTCHNL_OP_ADD_FDIR_FILTER.
|
|
VF sends this request to PF by filling out the related field in
|
|
virtchnl_fdir_add. If the rule is created successfully, PF
|
|
will return flow id and program status to VF. If the rule is
|
|
validated successfully, the PF will only return program status
|
|
to VF.
|
|
|
|
DELETE FDIR uses ops: VIRTCHNL_OP_DEL_FDIR_FILTER.
|
|
VF sends this request to PF by filling out the related field in
|
|
virtchnl_fdir_del. If the rule is deleted successfully, PF
|
|
will return program status to VF.
|
|
|
|
Query FDIR uses ops: VIRTCHNL_OP_QUERY_FDIR_FILTER.
|
|
VF sends this request to PF by filling out the related field in
|
|
virtchnl_fdir_query. If the request is successfully done by PF,
|
|
PF will return program status and query info to VF.
|
|
|
|
Signed-off-by: Simei Su <simei.su@intel.com>
|
|
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
|
|
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
|
|
Signed-off-by: Chenmin Sun <chenmin.sun@intel.com>
|
|
---
|
|
drivers/common/iavf/virtchnl.h | 162 +++++++++++++++++++++++++++++++++
|
|
1 file changed, 162 insertions(+)
|
|
|
|
diff --git a/drivers/common/iavf/virtchnl.h b/drivers/common/iavf/virtchnl.h
|
|
index 667762643..4dbf9c1c2 100644
|
|
--- a/drivers/common/iavf/virtchnl.h
|
|
+++ b/drivers/common/iavf/virtchnl.h
|
|
@@ -134,6 +134,9 @@ enum virtchnl_ops {
|
|
VIRTCHNL_OP_DCF_GET_VSI_MAP = 42,
|
|
VIRTCHNL_OP_DCF_GET_PKG_INFO = 43,
|
|
VIRTCHNL_OP_GET_SUPPORTED_RXDIDS = 44,
|
|
+ VIRTCHNL_OP_ADD_FDIR_FILTER = 47,
|
|
+ VIRTCHNL_OP_DEL_FDIR_FILTER = 48,
|
|
+ VIRTCHNL_OP_QUERY_FDIR_FILTER = 49,
|
|
};
|
|
|
|
/* These macros are used to generate compilation errors if a structure/union
|
|
@@ -249,6 +252,7 @@ VIRTCHNL_CHECK_STRUCT_LEN(16, virtchnl_vsi_resource);
|
|
#define VIRTCHNL_VF_OFFLOAD_ADQ_V2 0X01000000
|
|
#define VIRTCHNL_VF_OFFLOAD_USO 0X02000000
|
|
#define VIRTCHNL_VF_OFFLOAD_RX_FLEX_DESC 0X04000000
|
|
+#define VIRTCHNL_VF_OFFLOAD_FDIR_PF 0X10000000
|
|
/* 0X80000000 is reserved */
|
|
|
|
/* Define below the capability flags that are not offloads */
|
|
@@ -629,6 +633,11 @@ enum virtchnl_action {
|
|
/* action types */
|
|
VIRTCHNL_ACTION_DROP = 0,
|
|
VIRTCHNL_ACTION_TC_REDIRECT,
|
|
+ VIRTCHNL_ACTION_PASSTHRU,
|
|
+ VIRTCHNL_ACTION_QUEUE,
|
|
+ VIRTCHNL_ACTION_Q_REGION,
|
|
+ VIRTCHNL_ACTION_MARK,
|
|
+ VIRTCHNL_ACTION_COUNT,
|
|
};
|
|
|
|
enum virtchnl_flow_type {
|
|
@@ -925,6 +934,150 @@ struct virtchnl_proto_hdrs {
|
|
|
|
VIRTCHNL_CHECK_STRUCT_LEN(2312, virtchnl_proto_hdrs);
|
|
|
|
+/* action configuration for FDIR */
|
|
+struct virtchnl_filter_action {
|
|
+ enum virtchnl_action type;
|
|
+ union {
|
|
+ /* used for queue and qgroup action */
|
|
+ struct {
|
|
+ u16 index;
|
|
+ u8 region;
|
|
+ } queue;
|
|
+ /* used for count action */
|
|
+ struct {
|
|
+ /* share counter ID with other flow rules */
|
|
+ u8 shared;
|
|
+ u32 id; /* counter ID */
|
|
+ } count;
|
|
+ /* used for mark action */
|
|
+ u32 mark_id;
|
|
+ u8 reserve[32];
|
|
+ } act_conf;
|
|
+};
|
|
+
|
|
+VIRTCHNL_CHECK_STRUCT_LEN(36, virtchnl_filter_action);
|
|
+
|
|
+#define VIRTCHNL_MAX_NUM_ACTIONS 8
|
|
+
|
|
+struct virtchnl_filter_action_set {
|
|
+ /* action number must be less then VIRTCHNL_MAX_NUM_ACTIONS */
|
|
+ int count;
|
|
+ struct virtchnl_filter_action actions[VIRTCHNL_MAX_NUM_ACTIONS];
|
|
+};
|
|
+
|
|
+VIRTCHNL_CHECK_STRUCT_LEN(292, virtchnl_filter_action_set);
|
|
+
|
|
+/* pattern and action for FDIR rule */
|
|
+struct virtchnl_fdir_rule {
|
|
+ struct virtchnl_proto_hdrs proto_hdrs;
|
|
+ struct virtchnl_filter_action_set action_set;
|
|
+};
|
|
+
|
|
+VIRTCHNL_CHECK_STRUCT_LEN(2604, virtchnl_fdir_rule);
|
|
+
|
|
+/* query information to retrieve fdir rule counters.
|
|
+ * PF will fill out this structure to reset counter.
|
|
+ */
|
|
+struct virtchnl_fdir_query_info {
|
|
+ u32 match_packets_valid:1;
|
|
+ u32 match_bytes_valid:1;
|
|
+ u32 reserved:30; /* Reserved, must be zero. */
|
|
+ u32 pad;
|
|
+ u64 matched_packets; /* Number of packets for this rule. */
|
|
+ u64 matched_bytes; /* Number of bytes through this rule. */
|
|
+};
|
|
+
|
|
+VIRTCHNL_CHECK_STRUCT_LEN(24, virtchnl_fdir_query_info);
|
|
+
|
|
+/* Status returned to VF after VF requests FDIR commands
|
|
+ * VIRTCHNL_FDIR_SUCCESS
|
|
+ * VF FDIR related request is successfully done by PF
|
|
+ * The request can be OP_ADD/DEL/QUERY_FDIR_FILTER.
|
|
+ *
|
|
+ * VIRTCHNL_FDIR_FAILURE_RULE_NORESOURCE
|
|
+ * OP_ADD_FDIR_FILTER request is failed due to no Hardware resource.
|
|
+ *
|
|
+ * VIRTCHNL_FDIR_FAILURE_RULE_EXIST
|
|
+ * OP_ADD_FDIR_FILTER request is failed due to the rule is already existed.
|
|
+ *
|
|
+ * VIRTCHNL_FDIR_FAILURE_RULE_CONFLICT
|
|
+ * OP_ADD_FDIR_FILTER request is failed due to conflict with existing rule.
|
|
+ *
|
|
+ * VIRTCHNL_FDIR_FAILURE_RULE_NONEXIST
|
|
+ * OP_DEL_FDIR_FILTER request is failed due to this rule doesn't exist.
|
|
+ *
|
|
+ * VIRTCHNL_FDIR_FAILURE_RULE_INVALID
|
|
+ * OP_ADD_FDIR_FILTER request is failed due to parameters validation
|
|
+ * or HW doesn't support.
|
|
+ *
|
|
+ * VIRTCHNL_FDIR_FAILURE_RULE_TIMEOUT
|
|
+ * OP_ADD/DEL_FDIR_FILTER request is failed due to timing out
|
|
+ * for programming.
|
|
+ *
|
|
+ * VIRTCHNL_FDIR_FAILURE_QUERY_INVALID
|
|
+ * OP_QUERY_FDIR_FILTER request is failed due to parameters validation,
|
|
+ * for example, VF query counter of a rule who has no counter action.
|
|
+ */
|
|
+enum virtchnl_fdir_prgm_status {
|
|
+ VIRTCHNL_FDIR_SUCCESS = 0,
|
|
+ VIRTCHNL_FDIR_FAILURE_RULE_NORESOURCE,
|
|
+ VIRTCHNL_FDIR_FAILURE_RULE_EXIST,
|
|
+ VIRTCHNL_FDIR_FAILURE_RULE_CONFLICT,
|
|
+ VIRTCHNL_FDIR_FAILURE_RULE_NONEXIST,
|
|
+ VIRTCHNL_FDIR_FAILURE_RULE_INVALID,
|
|
+ VIRTCHNL_FDIR_FAILURE_RULE_TIMEOUT,
|
|
+ VIRTCHNL_FDIR_FAILURE_QUERY_INVALID,
|
|
+};
|
|
+
|
|
+/* VIRTCHNL_OP_ADD_FDIR_FILTER
|
|
+ * VF sends this request to PF by filling out vsi_id,
|
|
+ * validate_only and rule_cfg. PF will return flow_id
|
|
+ * if the request is successfully done and return add_status to VF.
|
|
+ */
|
|
+struct virtchnl_fdir_add {
|
|
+ u16 vsi_id; /* INPUT */
|
|
+ /*
|
|
+ * 1 for validating a fdir rule, 0 for creating a fdir rule.
|
|
+ * Validate and create share one ops: VIRTCHNL_OP_ADD_FDIR_FILTER.
|
|
+ */
|
|
+ u16 validate_only; /* INPUT */
|
|
+ u32 flow_id; /* OUTPUT */
|
|
+ struct virtchnl_fdir_rule rule_cfg; /* INPUT */
|
|
+ enum virtchnl_fdir_prgm_status status; /* OUTPUT */
|
|
+};
|
|
+
|
|
+VIRTCHNL_CHECK_STRUCT_LEN(2616, virtchnl_fdir_add);
|
|
+
|
|
+/* VIRTCHNL_OP_DEL_FDIR_FILTER
|
|
+ * VF sends this request to PF by filling out vsi_id
|
|
+ * and flow_id. PF will return del_status to VF.
|
|
+ */
|
|
+struct virtchnl_fdir_del {
|
|
+ u16 vsi_id; /* INPUT */
|
|
+ u16 pad;
|
|
+ u32 flow_id; /* INPUT */
|
|
+ enum virtchnl_fdir_prgm_status status; /* OUTPUT */
|
|
+};
|
|
+
|
|
+VIRTCHNL_CHECK_STRUCT_LEN(12, virtchnl_fdir_del);
|
|
+
|
|
+/* VIRTCHNL_OP_QUERY_FDIR_FILTER
|
|
+ * VF sends this request to PF by filling out vsi_id,
|
|
+ * flow_id and reset_counter. PF will return query_info
|
|
+ * and query_status to VF.
|
|
+ */
|
|
+struct virtchnl_fdir_query {
|
|
+ u16 vsi_id; /* INPUT */
|
|
+ u16 pad1[3];
|
|
+ u32 flow_id; /* INPUT */
|
|
+ u32 reset_counter:1; /* INPUT */
|
|
+ struct virtchnl_fdir_query_info query_info; /* OUTPUT */
|
|
+ enum virtchnl_fdir_prgm_status status; /* OUTPUT */
|
|
+ u32 pad2;
|
|
+};
|
|
+
|
|
+VIRTCHNL_CHECK_STRUCT_LEN(48, virtchnl_fdir_query);
|
|
+
|
|
/**
|
|
* virtchnl_vc_validate_vf_msg
|
|
* @ver: Virtchnl version info
|
|
@@ -1110,6 +1263,15 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,
|
|
* so the valid length keeps the default value 0.
|
|
*/
|
|
break;
|
|
+ case VIRTCHNL_OP_ADD_FDIR_FILTER:
|
|
+ valid_len = sizeof(struct virtchnl_fdir_add);
|
|
+ break;
|
|
+ case VIRTCHNL_OP_DEL_FDIR_FILTER:
|
|
+ valid_len = sizeof(struct virtchnl_fdir_del);
|
|
+ break;
|
|
+ case VIRTCHNL_OP_QUERY_FDIR_FILTER:
|
|
+ valid_len = sizeof(struct virtchnl_fdir_query);
|
|
+ break;
|
|
/* These are always errors coming from the VF. */
|
|
case VIRTCHNL_OP_EVENT:
|
|
case VIRTCHNL_OP_UNKNOWN:
|
|
--
|
|
2.17.1
|
|
|