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 9977B7E9E for ; Thu, 30 Oct 2014 08:18:15 +0100 (CET) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga102.fm.intel.com with ESMTP; 30 Oct 2014 00:27:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,862,1389772800"; d="scan'208";a="408318319" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by FMSMGA003.fm.intel.com with ESMTP; 30 Oct 2014 00:19:02 -0700 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id s9U7R7ZW007026; Thu, 30 Oct 2014 15:27:07 +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 s9U7R5wx007535; Thu, 30 Oct 2014 15:27:07 +0800 Received: (from wujingji@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id s9U7R59C007531; Thu, 30 Oct 2014 15:27:05 +0800 From: Jingjing Wu To: dev@dpdk.org Date: Thu, 30 Oct 2014 15:26:29 +0800 Message-Id: <1414654006-7472-5-git-send-email-jingjing.wu@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1414654006-7472-1-git-send-email-jingjing.wu@intel.com> References: <1413939687-11177-1-git-send-email-jingjing.wu@intel.com> <1414654006-7472-1-git-send-email-jingjing.wu@intel.com> Subject: [dpdk-dev] [PATCH v5 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: Thu, 30 Oct 2014 07:18:16 -0000 New structures are defined to add or delete flow director filter Signed-off-by: Jingjing Wu --- lib/librte_ether/rte_eth_ctrl.h | 171 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 171 insertions(+) diff --git a/lib/librte_ether/rte_eth_ctrl.h b/lib/librte_ether/rte_eth_ctrl.h index b4ab731..77b784e 100644 --- a/lib/librte_ether/rte_eth_ctrl.h +++ b/lib/librte_ether/rte_eth_ctrl.h @@ -52,6 +52,7 @@ extern "C" { enum rte_filter_type { RTE_ETH_FILTER_NONE = 0, RTE_ETH_FILTER_TUNNEL, + RTE_ETH_FILTER_FDIR, RTE_ETH_FILTER_MAX }; @@ -132,6 +133,176 @@ struct rte_eth_tunnel_filter_conf { uint16_t queue_id; /** < queue number. */ }; +/** + * 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]; + /**< It is filled by the flexible payload to match. Each word is in little endian. */ + uint16_t dest_id; + /**< Destination vsi or pool id. 0 indicates PF by default.*/ +}; + +/** + * A structure used to define the input for a 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; + /**< Flow fields to match, dependent on flow_type */ + struct rte_eth_fdir_flow_ext flow_ext; + /**< Additional fields to match */ +}; + +/** + * Flow director report status + * It defines what will be reported if fdir entry is matched. + */ +enum rte_eth_fdir_status { + RTE_ETH_FDIR_NO_REPORT_STATUS = 0, /**< Report nothing. */ + RTE_ETH_FDIR_REPORT_ID, /**< Only report FD ID. */ + RTE_ETH_FDIR_REPORT_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 in hardware. If set to 0, default counter will + be used for all flow director entries on each device. */ + uint8_t drop; /**< Accept or reject */ + enum rte_eth_fdir_status report_status; /**< Status report option */ + uint8_t flex_off; + /**< If report_status is RTE_ETH_FDIR_REPORT_ID_FLEX_4 or + RTE_ETH_FDIR_REPORT_FLEX_8, flex_off specifies where the reported + flex bytes start from in flexible payload. */ +}; + +/** + * A structure used to define the flow director filter entry by filter_ctrl API + * It supports 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, an unique value is required when deal with fdir entry */ + 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