From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 37D4D1B2BA for ; Thu, 21 Dec 2017 23:21:18 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Dec 2017 14:21:16 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,437,1508828400"; d="scan'208,217";a="186195147" Received: from irsmsx105.ger.corp.intel.com ([163.33.3.28]) by orsmga005.jf.intel.com with ESMTP; 21 Dec 2017 14:21:14 -0800 Received: from irsmsx155.ger.corp.intel.com (163.33.192.3) by irsmsx105.ger.corp.intel.com (163.33.3.28) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 21 Dec 2017 22:21:13 +0000 Received: from irsmsx102.ger.corp.intel.com ([169.254.2.180]) by irsmsx155.ger.corp.intel.com ([169.254.14.169]) with mapi id 14.03.0319.002; Thu, 21 Dec 2017 22:21:13 +0000 From: "Doherty, Declan" To: "dev@dpdk.org" Thread-Topic: [dpdk-dev][RFC] tunnel endpoint hw acceleration enablement Thread-Index: AdN6qTnlxEdgGpD8Qpa520sLsCebsA== Date: Thu, 21 Dec 2017 22:21:13 +0000 Message-ID: <345C63BAECC1AD42A2EC8C63AFFC3ADCC488E501@IRSMSX102.ger.corp.intel.com> Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYWQwOTMzNGItYzczZS00N2U5LWEzOTEtZjJlMDBkYTE1MjdjIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6InFURDlOQWtsZ3kyXC9Sd2pkcXBpWTB4eWdhREZJM0pZVGpubVVLNnBrSWY4PSJ9 x-ctpclassification: CTP_IC dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [163.33.239.181] MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: [dpdk-dev] [RFC] tunnel endpoint hw acceleration enablement X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Dec 2017 22:21:19 -0000 This RFC contains a proposal to add a new tunnel endpoint API to DPDK that = when used in conjunction with rte_flow enables the configuration of inline data path = encapsulation and decapsulation of tunnel endpoint network overlays on accelerated IO dev= ices. The proposed new API would provide for the creation, destruction, and monitoring of a tunnel endpoint in supporting hw, as well as capabilities A= PIs to allow the acceleration features to be discovered by applications. /** Tunnel Endpoint context, opaque structure */ struct rte_tep; enum rte_tep_type { RTE_TEP_TYPE_VXLAN =3D 1, /**< VXLAN Protocol */ RTE_TEP_TYPE_NVGRE, /**< NVGRE Protocol */ ... }; /** Tunnel Endpoint Attributes */ struct rte_tep_attr { enum rte_type_type type; /* other endpoint attributes here */ } /** * Create a tunnel end-point context as specified by the flow attribute and = pattern * * @param port_id Port identifier of Ethernet device. * @param attr Flow rule attributes. * @param pattern Pattern specification by list of rte_flow_items. * @return * - On success returns pointer to TEP context * - On failure returns NULL */ struct rte_tep *rte_tep_create(uint16_t port_id, struct rte_tep_attr *attr, struct rte_flow_it= em pattern[]) /** * Destroy an existing tunnel end-point context. All the end-points context * will be destroyed, so all active flows using tep should be freed before * destroying context. * @param port_id Port identifier of Ethernet device. * @param tep Tunnel endpoint context * @return * - On success returns 0 * - On failure returns 1 */ int rte_tep_destroy(uint16_t port_id, struct rte_tep *tep) /** * Get tunnel endpoint statistics * * @param port_id Port identifier of Ethernet device. * @param tep Tunnel endpoint context * @param stats Tunnel endpoint statistics * * @return * - On success returns 0 * - On failure returns 1 */ Int rte_tep_stats_get(uint16_t port_id, struct rte_tep *tep, struct rte_tep_stats *stats) /** * Get ports tunnel endpoint capabilities * * @param port_id Port identifier of Ethernet device. * @param capabilities Tunnel endpoint capabilities * * @return * - On success returns 0 * - On failure returns 1 */ int rte_tep_capabilities_get(uint16_t port_id, struct rte_tep_capabilities *capabilities) To direct traffic flows to hw terminated tunnel endpoint the rte_flow API i= s enhanced to add a new flow item type. This contains a pointer to the TEP context as well as the overlay flow id to which the traffic flow is associated. struct rte_flow_item_tep { struct rte_tep *tep; uint32_t flow_id; } Also 2 new generic actions types are added encapsulation and decapsulation. RTE_FLOW_ACTION_TYPE_ENCAP RTE_FLOW_ACTION_TYPE_DECAP struct rte_flow_action_encap { struct rte_flow_item *item; } struct rte_flow_action_decap { struct rte_flow_item *item; } The following section outlines the intended usage of the new APIs and then = how they are combined with the existing rte_flow APIs. Tunnel endpoints are created on logical ports which support the capability using rte_tep_create() using a combination of TEP attributes and rte_flow_items. In the example below a new IPv4 VxLAN endpoint is being def= ined. The attrs parameter sets the TEP type, and could be used for other possible attributes. struct rte_tep_attr attrs =3D { .type =3D RTE_TEP_TYPE_VXLAN }; The values for the headers which make up the tunnel endpointr are then defined using spec parameter in the rte flow items (IPv4, UDP and VxLAN in this case) struct rte_flow_item_ipv4 ipv4_item =3D { .hdr =3D { .src_addr =3D saddr, .dst_addr =3D daddr } }; struct rte_flow_item_udp udp_item =3D { .hdr =3D { .src_port =3D sport, .dst_port =3D dport } }; struct rte_flow_item_vxlan vxlan_item =3D { .flags =3D vxlan_flags }; struct rte_flow_item pattern[] =3D { { .type =3D RTE_FLOW_ITEM_TYPE_IPV4, .spec =3D &ipv4_item }, { .type =3D RTE_FLOW_ITEM_TYPE_UDP, .spec =3D &udp_item }, { .type =3D RTE_FLOW_ITEM_TYPE_VXLAN, .spec =3D &vxlan_item = }, { .type =3D RTE_FLOW_ITEM_TYPE_END } }; The tunnel endpoint can then be create on the port. Whether or not any hw configuration is required at this point would be hw dependent, but if not the context for the TEP is available for use in programming flow, so the application is not forced to redefine the TEP parameters on each flow addition. struct rte_tep *tep =3D rte_tep_create(port_id, &attrs, pattern); Once the tep context is created flows can then be directed to that endpoint= for processing. The following sections will outline how the author envisage flo= w programming will work and also how TEP acceleration can be combined with ot= her accelerations. Ingress TEP decapsulation, mark and forward to queue: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The flows definition for TEP decapsulation actions should specify the full outer packet to be matched at a minimum. The outer packet definition should match the tunnel definition in the tep context and the tep flow id. This example shows describes matching on the outer, marking the packet with the VXLAN VNI and directing to a specified queue of the port. Source Packet Decapsulate Outer Hdr / \ decap out= er crc / \ / = \ +-----+------+-----+-------+-----+------+-----+---------+-----+--------= ---+ | ETH | IPv4 | UDP | VxLAN | ETH | IPv4 | TCP | PAYLOAD | CRC | OUTER C= RC | +-----+------+-----+-------+-----+------+-----+---------+-----+--------= ---+ /* Flow Attributes/Items Definitions */ struct rte_flow_attr attr =3D { .ingress =3D 1 }; struct rte_flow_item_eth eth_item =3D { .src =3D s_addr, .dst =3D d_addr, .= type =3D ether_type }; struct rte_flow_item_tep tep_item =3D { .tep =3D tep, .id =3D vni }; struct rte_flow_item pattern[] =3D { { .type =3D RTE_FLOW_ITEM_TYPE_ETH, .spec =3D ð_item }, { .type =3D RTE_FLOW_ITEM_TYPE_TEP, .spec =3D &tep_item }, { .type =3D RTE_FLOW_ITEM_TYPE_END } }; /* Flow Actions Definitions */ struct rte_flow_action_decap decap_eth =3D { .type =3D RTE_FLOW_ITEM_TYPE_ETH, .item =3D { .src =3D s_addr, .dst =3D d_addr, .type =3D ethe= r_type } }; struct rte_flow_action_decap decap_tep =3D { .type =3D RTE_FLOW_ITEM_TYPE_TEP, .spec =3D &tep_item }; struct rte_flow_action_queue queue_action =3D { .index =3D qid }; struct rte_flow_action_port mark_action =3D { .index =3D vni }; struct rte_flow_action actions[] =3D { { .type =3D RTE_FLOW_ACTION_TYPE_DECAP, .conf =3D &decap_eth= }, { .type =3D RTE_FLOW_ACTION_TYPE_DECAP, .conf =3D &decap_tep= }, { .type =3D RTE_FLOW_ACTION_TYPE_MARK, .conf =3D &mark_actio= n }, { .type =3D RTE_FLOW_ACTION_TYPE_QUEUE, .conf =3D &queue_act= ion }, { .type =3D RTE_FLOW_ACTION_TYPE_END } }; /** VERY IMPORTANT NOTE **/ One of the core concepts of this proposal is that actions which modify the packet are defined in the order which they are to be processed. So first de= cap outer ethernet header, then the outer TEP headers. I think this is not only logical from a usability point of view, it should = also simplify the logic required in PMDs to parse the desired actions. struct rte_flow *flow =3D rte_flow_create(port_id, &attr, pattern, acti= ons, &err); The processed packets are delivered to specifed queue with mbuf metadata denoting marked flow id and with mbuf ol_flags PKT_RX_TEP_OFFLOAD set. +-----+------+-----+---------+-----+ | ETH | IPv4 | TCP | PAYLOAD | CRC | +-----+------+-----+---------+-----+ Ingress TEP decapsulation switch to port: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This is intended to represent how a TEP decapsulation could be configured in a switching offload case, it makes an assumption that there is a logical port representation for all ports on the hw switch in the DPDK application, but similar functionality could be achieved by specifying something like a VF ID of the device. Like the previous scenario the flows definition for TEP decapsulation actio= ns should specify the full outer packet to be matched at a minimum but also define the elements of the inner match to match against including masks if required. struct rte_flow_attr attr =3D { .ingress =3D 1 }; struct rte_flow_item pattern[] =3D { { .type =3D RTE_FLOW_ITEM_TYPE_ETH, .spec =3D &outer_eth_ite= m }, { .type =3D RTE_FLOW_ITEM_TYPE_TEP, .spec =3D &outer_tep_ite= m, .mask =3D &tep_mask }, { .type =3D RTE_FLOW_ITEM_TYPE_ETH, .spec =3D &inner_eth_ite= m, .mask =3D ð_mask } { .type =3D RTE_FLOW_ITEM_TYPE_IPv4, .spec =3D &inner_ipv4_i= tem, .mask =3D &ipv4_mask }, { .type =3D RTE_FLOW_ITEM_TYPE_TCP, .spec =3D &inner_tcp_ite= m, .mask =3D &tcp_mask }, { .type =3D RTE_FLOW_ITEM_TYPE_END } }; /* Flow Actions Definitions */ struct rte_flow_action_decap decap_eth =3D { .type =3D RTE_FLOW_ITEM_TYPE_ETH, .item =3D { .src =3D s_addr, .dst =3D d_addr, .type =3D ethe= r_type } }; struct rte_flow_action_decap decap_tep =3D { .type =3D RTE_FLOW_ITEM_TYPE_TEP, .item =3D &outer_tep_item }; struct rte_flow_action_port port_action =3D { .index =3D port_id }; struct rte_flow_action actions[] =3D { { .type =3D RTE_FLOW_ACTION_TYPE_DECAP, .conf =3D &decap_eth= }, { .type =3D RTE_FLOW_ACTION_TYPE_DECAP, .conf =3D &decap_tep= }, { .type =3D RTE_FLOW_ACTION_TYPE_PORT, .conf =3D &port_actio= n }, { .type =3D RTE_FLOW_ACTION_TYPE_END } }; struct rte_flow *flow =3D rte_flow_create(port_id, &attr, pattern, actions,= &err); This action will forward the decapsulated packets to another port of the sw= itch fabric but no information will on the tunnel or the fact that the packet wa= s decapsulated will be passed with it, thereby enable segregation of the infrastructure and Egress TEP encapsulation: ~~~~~~~~~~~~~~~~~~~~~~~~~ Encapulsation TEP actions require the flow definitions for the source packe= t and then the actions to do on that, this example shows a ipv4/tcp packet action. Source Packet +-----+------+-----+---------+-----+ | ETH | IPv4 | TCP | PAYLOAD | CRC | +-----+------+-----+---------+-----+ struct rte_flow_attr attr =3D { .egress =3D 1 }; struct rte_flow_item_eth eth_item =3D { .src =3D s_addr, .dst =3D d_addr, .= type =3D ether_type }; struct rte_flow_item_ipv4 ipv4_item =3D { .hdr =3D { .src_addr =3D src_addr= , .dst_addr =3D dst_addr } }; struct rte_flow_item_udp tcp_item =3D { .hdr =3D { .src_port =3D src_port, = .dst_port =3D dst_port } }; struct rte_flow_item pattern[] =3D { { .type =3D RTE_FLOW_ITEM_TYPE_ETH, .spec =3D ð_item }, { .type =3D RTE_FLOW_ITEM_TYPE_IPV4, .spec =3D &ipv4_item }, { .type =3D RTE_FLOW_ITEM_TYPE_TCP, .spec =3D &tcp_item }, { .type =3D RTE_FLOW_ITEM_TYPE_END } }; /* Flow Actions Definitions */ struct rte_flow_action_encap encap_eth =3D { .type =3D RTE_FLOW_ITEM_TYPE_ETH, .item =3D { .src =3D s_addr, .dst =3D d_addr, .type =3D ethe= r_type } }; struct rte_flow_action_encap encap_tep =3D { .type =3D RTE_FLOW_ITEM_TYPE_TEP, .item =3D { .tep =3D tep, .id =3D vni } }; struct rte_flow_action_mark port_action =3D { .index =3D port_id }; struct rte_flow_action actions[] =3D { { .type =3D RTE_FLOW_ACTION_TYPE_ENCAP, .conf =3D &encap_tep= }, { .type =3D RTE_FLOW_ACTION_TYPE_ENCAP, .conf =3D &encap_eth= }, { .type =3D RTE_FLOW_ACTION_TYPE_PORT, .conf =3D &port_actio= n }, { .type =3D RTE_FLOW_ACTION_TYPE_END } } struct rte_flow *flow =3D rte_flow_create(port_id, &attr, pattern, actions,= &err); encapsulating Outer Hdr / \ outer c= rc / \ / = \ +-----+------+-----+-------+-----+------+-----+---------+-----+--------= ---+ | ETH | IPv4 | UDP | VxLAN | ETH | IPv4 | TCP | PAYLOAD | CRC | OUTER C= RC | +-----+------+-----+-------+-----+------+-----+---------+-----+--------= ---+ Chaining multiple modification actions eg IPsec and TEP ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ For example the definition for full hw acceleration for an IPsec ESP/Transp= ort SA encapsulated in a vxlan tunnel would look something like: struct rte_flow_action actions[] =3D { { .type =3D RTE_FLOW_ACTION_TYPE_ENCAP, .conf =3D &encap_tep= }, { .type =3D RTE_FLOW_ACTION_TYPE_SECURITY, .conf =3D &sec_se= ssion }, { .type =3D RTE_FLOW_ACTION_TYPE_ENCAP, .conf =3D &encap_eth= }, { .type =3D RTE_FLOW_ACTION_TYPE_END } } 1. Source Packet +-----+------+-----+---------+-----+ | ETH | IPv4 | TCP | PAYLOAD | CRC | +-----+------+-----+---------+-----+ 2. First Action - Tunnel Endpoint Encapsulation +------+-----+-------+-----+------+-----+---------+-----+ | IPv4 | UDP | VxLAN | ETH | IPv4 | TCP | PAYLOAD | CRC | +------+-----+-------+-----+------+-----+---------+-----+ 3. Second Action - IPsec ESP/Transport Security Processing +------+-----+-----+-------+-----+------+-----+---------+-----+------= -------+ | IPv4 | ESP | ENCRYPTED PAYLOAD | ESP T= RAILER | +------+-----+-----+-------+-----+------+-----+---------+-----+------= -------+ 4. Third Action - Outer Ethernet Encapsulation +-----+------+-----+-----+-------+-----+------+-----+---------+-----+------= -------+-----------+ | ETH | IPv4 | ESP | ENCRYPTED PAYLOAD | ESP T= RAILER | OUTER CRC | +-----+------+-----+-----+-------+-----+------+-----+---------+-----+------= -------+-----------+ This example demonstrates the importance of making the interoperation of actions to be ordered, as in the above example, a security action can be defined on both the inner and outer packet by simply placing another security action at the beginning of the action list. It also demonstrates the rationale for not collapsing the Ethernet into the TEP definition as when you have multiple encapsulating actions, all could potentially be the place where the Ethernet header needs to be defined.