From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 87DC97EAF for ; Wed, 22 Oct 2014 02:53:50 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP; 21 Oct 2014 18:02:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.04,766,1406617200"; d="scan'208";a="609014615" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by fmsmga001.fm.intel.com with ESMTP; 21 Oct 2014 18:02:01 -0700 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id s9M11voK025088; Wed, 22 Oct 2014 09:01:57 +0800 Received: from shecgisg004.sh.intel.com (localhost [127.0.0.1]) by shecgisg004.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id s9M11tu6011240; Wed, 22 Oct 2014 09:01:57 +0800 Received: (from wujingji@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id s9M11tG8011236; Wed, 22 Oct 2014 09:01:55 +0800 From: Jingjing Wu To: dev@dpdk.org Date: Wed, 22 Oct 2014 09:01:10 +0800 Message-Id: <1413939687-11177-5-git-send-email-jingjing.wu@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1413939687-11177-1-git-send-email-jingjing.wu@intel.com> References: <1411711418-12881-1-git-send-email-jingjing.wu@intel.com> <1413939687-11177-1-git-send-email-jingjing.wu@intel.com> Subject: [dpdk-dev] [PATCH v4 04/21] ethdev: define structures for adding/deleting flow director X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2014 00:53:51 -0000 define structures to add or delete flow director filter Signed-off-by: Jingjing Wu --- lib/librte_ether/rte_eth_ctrl.h | 160 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 160 insertions(+) diff --git a/lib/librte_ether/rte_eth_ctrl.h b/lib/librte_ether/rte_eth_ctrl.h index df21ac6..3efdaae 100644 --- a/lib/librte_ether/rte_eth_ctrl.h +++ b/lib/librte_ether/rte_eth_ctrl.h @@ -51,6 +51,7 @@ extern "C" { */ enum rte_filter_type { RTE_ETH_FILTER_NONE = 0, + RTE_ETH_FILTER_FDIR, RTE_ETH_FILTER_MAX }; @@ -71,6 +72,165 @@ enum rte_filter_op { RTE_ETH_FILTER_OP_MAX }; +/** + * Define all structures for Flow Director Filter type corresponding with specific operations. + */ + +/** + * flow type + */ +enum rte_eth_flow_type { + RTE_ETH_FLOW_TYPE_NONE = 0x0, + RTE_ETH_FLOW_TYPE_UDPV4, + RTE_ETH_FLOW_TYPE_TCPV4, + RTE_ETH_FLOW_TYPE_SCTPV4, + RTE_ETH_FLOW_TYPE_IPV4_OTHER, + RTE_ETH_FLOW_TYPE_UDPV6, + RTE_ETH_FLOW_TYPE_TCPV6, + RTE_ETH_FLOW_TYPE_SCTPV6, + RTE_ETH_FLOW_TYPE_IPV6_OTHER, +}; + +/** + * A structure used to define the input for IPV4 UDP flow + */ +struct rte_eth_udpv4_flow { + uint32_t src_ip; /**< IPv4 source address to match. */ + uint32_t dst_ip; /**< IPv4 destination address to match. */ + uint16_t src_port; /**< UDP Source port to match. */ + uint16_t dst_port; /**< UDP Destination port to match. */ +}; + +/** + * A structure used to define the input for IPV4 TCP flow + */ +struct rte_eth_tcpv4_flow { + uint32_t src_ip; /**< IPv4 source address to match. */ + uint32_t dst_ip; /**< IPv4 destination address to match. */ + uint16_t src_port; /**< TCP Source port to match. */ + uint16_t dst_port; /**< TCP Destination port to match. */ +}; + +/** + * A structure used to define the input for IPV4 SCTP flow + */ +struct rte_eth_sctpv4_flow { + uint32_t src_ip; /**< IPv4 source address to match. */ + uint32_t dst_ip; /**< IPv4 destination address to match. */ + uint32_t verify_tag; /**< verify tag to match */ +}; + +/** + * A structure used to define the input for IPV4 flow + */ +struct rte_eth_ipv4_flow { + uint32_t src_ip; /**< IPv4 source address to match. */ + uint32_t dst_ip; /**< IPv4 destination address to match. */ +}; + +/** + * A structure used to define the input for IPV6 UDP flow + */ +struct rte_eth_udpv6_flow { + uint32_t src_ip[4]; /**< IPv6 source address to match. */ + uint32_t dst_ip[4]; /**< IPv6 destination address to match. */ + uint16_t src_port; /**< UDP Source port to match. */ + uint16_t dst_port; /**< UDP Destination port to match. */ +}; + +/** + * A structure used to define the input for IPV6 TCP flow + */ +struct rte_eth_tcpv6_flow { + uint32_t src_ip[4]; /**< IPv6 source address to match. */ + uint32_t dst_ip[4]; /**< IPv6 destination address to match. */ + uint16_t src_port; /**< TCP Source port to match. */ + uint16_t dst_port; /**< TCP Destination port to match. */ +}; + +/** + * A structure used to define the input for IPV6 SCTP flow + */ +struct rte_eth_sctpv6_flow { + uint32_t src_ip[4]; /**< IPv6 source address to match. */ + uint32_t dst_ip[4]; /**< IPv6 destination address to match. */ + uint32_t verify_tag; /**< verify tag to match */ +}; + +/** + * A structure used to define the input for IPV6 flow + */ +struct rte_eth_ipv6_flow { + uint32_t src_ip[4]; /**< IPv6 source address to match. */ + uint32_t dst_ip[4]; /**< IPv6 destination address to match. */ +}; + +/** + * An union contains the inputs for all types of flow + */ +union rte_eth_fdir_flow { + struct rte_eth_udpv4_flow udp4_flow; + struct rte_eth_tcpv4_flow tcp4_flow; + struct rte_eth_sctpv4_flow sctp4_flow; + struct rte_eth_ipv4_flow ip4_flow; + struct rte_eth_udpv6_flow udp6_flow; + struct rte_eth_tcpv6_flow tcp6_flow; + struct rte_eth_sctpv6_flow sctp6_flow; + struct rte_eth_ipv6_flow ip6_flow; +}; + +#define RTE_ETH_FDIR_MAX_FLEXWORD_LEN 8 +/** + * A structure used to contain extend input of flow + */ +struct rte_eth_fdir_flow_ext { + uint16_t vlan_tci; + uint8_t num_flexwords; /**< number of flexwords */ + uint16_t flexwords[RTE_ETH_FDIR_MAX_FLEXWORD_LEN]; + uint16_t dest_id; /**< destination vsi or pool id*/ +}; + +/** + * A structure used to define the input for an flow director filter entry + */ +struct rte_eth_fdir_input { + enum rte_eth_flow_type flow_type; /**< type of flow */ + union rte_eth_fdir_flow flow; /**< specific flow structure */ + struct rte_eth_fdir_flow_ext flow_ext; /**< specific flow info */ +}; + +/** + * Flow director report status + */ +enum rte_eth_fdir_status { + RTE_ETH_FDIR_NO_REPORT_STATUS = 0, /**< no report FDIR. */ + RTE_ETH_FDIR_REPORT_FD_ID, /**< only report FD ID. */ + RTE_ETH_FDIR_REPORT_FD_ID_FLEX_4, /**< report FD ID and 4 flex bytes. */ + RTE_ETH_FDIR_REPORT_FLEX_8, /**< report 8 flex bytes. */ +}; + +/** + * A structure used to define an action when match FDIR packet filter. + */ +struct rte_eth_fdir_action { + uint16_t rx_queue; /**< queue assigned to if fdir match. */ + uint16_t cnt_idx; /**< statistic counter index */ + uint8_t drop; /**< accept or reject */ + uint8_t flex_off; /**< offset used define words to report */ + enum rte_eth_fdir_status report_status; /**< status report option */ +}; + +/** + * A structure used to define the flow director filter entry by filter_ctl API + * to support RTE_ETH_FILTER_FDIR with RTE_ETH_FILTER_ADD and + * RTE_ETH_FILTER_DELETE operations. + */ +struct rte_eth_fdir_filter { + uint32_t soft_id; /**< id */ + struct rte_eth_fdir_input input; /**< input set */ + struct rte_eth_fdir_action action; /**< action taken when match */ +}; + #ifdef __cplusplus } #endif -- 1.8.1.4