From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0089.outbound.protection.outlook.com [104.47.2.89]) by dpdk.org (Postfix) with ESMTP id 402AD1041 for ; Sat, 24 Feb 2018 23:36:44 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=GYtbUFYrmtn+7mdqBolWDwK53fcoGpL3HdGTwFQCLTI=; b=kTmNgoRA0qE2YcY7LnaXiitgsAVwI8l9a9jQJQE7lvESqspnhHMa85MrjrCUXg0nDqQOy2IWI2vsBOdJKMxE9d9jzya3MIiw8SPaA5VaekUWjWB0PwcVFXjos0luwfUSYzI7o1YOdx3pjRt23UwRnAA01cxf43+Jvqx4DGr+6eQ= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ophirmu@mellanox.com; Received: from mellanox.com (37.142.13.130) by AM0PR0502MB3875.eurprd05.prod.outlook.com (2603:10a6:208:20::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.527.15; Sat, 24 Feb 2018 22:36:40 +0000 From: Ophir Munk To: dev@dpdk.org, Adrien Mazarguil Cc: Thomas Monjalon , Olga Shern , Ophir Munk , Moti Haimovsky Date: Sat, 24 Feb 2018 22:36:23 +0000 Message-Id: <1519511783-18928-1-git-send-email-ophirmu@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1518072954-19082-1-git-send-email-ophirmu@mellanox.com> References: <1518072954-19082-1-git-send-email-ophirmu@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: VI1PR08CA0085.eurprd08.prod.outlook.com (2603:10a6:800:d3::11) To AM0PR0502MB3875.eurprd05.prod.outlook.com (2603:10a6:208:20::17) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 8aa8d8a8-6e76-4b6c-e6e1-08d57bd7137e X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:AM0PR0502MB3875; X-Microsoft-Exchange-Diagnostics: 1; AM0PR0502MB3875; 3:heXAfgkeXGGbEwjLyq/kQ66iKFAxxj0KI+eyKcoq10lBv79F/p+hJxw+VGwmqa4EW/bYMYTEKpmnjM+dtuCYa9x87qQPNBJ3Eink2sYrjJAgKv0Zcj3s29ZRgHYdQZwUeA+PNw7QCgqwroZKoql6RrC5p7JBGca8GOSQvC8bKyRdu7TVlUgaa5aDL4HPmPDAF/s2nN+/KORZOzmrqSCDj6GgedaqK+1U5FCiIoO+r7zjvzZBwI5RXJXUGWMmPw3m; 25:OpFtGOYlFAXdGjkiJSpdPu+VYrjI7Ks036jelL9LFTcPkJw4Itcl0S6GfCyLjk3nYnnry8U4k07Cw77rJ7VitP9ywwfs0MG9xxZNTjg1hXIIrAyb9hnp3/A9N0ndYV7fE0SwL4HHIfeywqIXf7U3u3WO2CIhPiukkbpHW0IinofeLETLtPWsKZ+nWjFDBdFN2HyN5IlC93wfH6E8pUlae86CHXI8KjunYAWG9Z35HJ99WIu3a2rVZJjpH509v6QI9aNBP86x6oNj/ndPJ0rPUrbf38SUj8/+vR/gLspNbuFBzTFU+sB5Gip24uQ2dB7QQUFNi4UvjFgAZZ3wrFDkVQ==; 31:WyVzwKKExw3MxvEegc3s8IBt0ntyGpzKINBn8QdFGp+fJN0bgKnrKHAOx1B110f7yPwtr7pEEgRQCoyv2uzKpln8OvwgEGQRuEIXiIj5jsX59vC4D2XUhrW0lk2XJhyPTcjYXBbilSg1Bsmo22e2otOsRHGOwAD5tE1RXVrTgBqFdeFQ8c98GxT2TgHCxo7Vd0+ZIdbRqgOrpTv/t6kEyd1q8w6VnBh9dg3C4jcjss4= X-MS-TrafficTypeDiagnostic: AM0PR0502MB3875: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; AM0PR0502MB3875; 20:bIzSe4/VUV490PnIOvmeoBfaMWKEItuEfUHxpfqpQ9WAhyOgHSG+uJWPnD4lMAPjRlr+97/KhmQQ1z7JW19Qme9GAychavHMbIRvUr/f0lwARZkR4NaKnhn0gDFrK6RilOYuY5Hy3WDq0hAny8nZfdX3txo5ZeOdGiXJeNLg/mDNxPd3rPfnzlhmEzwMS6RoHqujxTQp+sQikgyCY419I95KMKleICbAj7TiSXLlc7+DONPvrkntSRYsacl0nxUK8AA3W2NSBLurfMChLr4uTl90YHmtlPUzllKjHjMwlrs6UHJIgtm0dRRdlEBgOlNataFetNttNN2YQR2RbWAB2X8gFn00a2yeSq4Xt9H+uzQz8PgM2P4lexihJ+XMUd0FWYJb1BKZgxZWPr3sYv08lpqLW0rEM6NV1Py2HNh8msD5jxj7KeXptYnr1rJGtPByfM9yrNUH8GC08XNLjZWcXAncnmx5s7eEWi3y0tpfhJbtV+HXOQocX8JYXBVm9CBK; 4:z7sD8Ic/0eky2Q/aJwSmuD+NHsnX7dUkyDYvK0Ub/A/u70ie6m8FDgDeMliUJrqleU/HAoFqY+fHMcgdktPgeYhFwuyU35zq3y7x96mvMHt8IyLmKuGAiCmMiRHIoCTBucwDFJyl8wl7bgFfVq5fPmkHgSUy+Vheh9Kkw9tdkRShKNp86EMSDte+5wsLIHrCpPW01MRZKEMB+WQBhta6m5y12F7sGRVr8ggmrNKAa9Mw9lYpgCEfg+Ii3RJzKCGBmtv7Pl61Rd1kkaimhFngRw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040501)(2401047)(5005006)(8121501046)(3002001)(93006095)(93001095)(3231220)(944501161)(52105095)(10201501046)(6055026)(6041288)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123564045)(20161123560045)(20161123558120)(6072148)(201708071742011); SRVR:AM0PR0502MB3875; BCL:0; PCL:0; RULEID:; SRVR:AM0PR0502MB3875; X-Forefront-PRVS: 0593E261C4 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(396003)(39860400002)(39380400002)(346002)(376002)(189003)(199004)(68736007)(16526019)(186003)(26005)(7110500001)(386003)(36756003)(59450400001)(15650500001)(2420400007)(97736004)(6306002)(50466002)(4720700003)(55016002)(6116002)(3846002)(6666003)(48376002)(2950100002)(6916009)(2906002)(10710500007)(53936002)(478600001)(21086003)(50226002)(8936002)(69596002)(966005)(33026002)(81166006)(81156014)(8676002)(53376002)(107886003)(4326008)(25786009)(5660300001)(105586002)(7736002)(106356001)(54906003)(305945005)(47776003)(575784001)(86362001)(51416003)(7696005)(76176011)(52116002)(316002)(16586007)(66066001); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR0502MB3875; H:mellanox.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM0PR0502MB3875; 23:hq5hizrqfnXch5eTVdRXIKMKxnOTUTCigA57ufU?= =?us-ascii?Q?4KshTPLu7yiCElu8YO5HIkhziNGfY6PtY+NhoiQ/fBcj8GqwpipL/3RkyUXQ?= =?us-ascii?Q?KCXN4IDfoRxDG7Ac4y+Bjj1QsEh24rk+8GXN5byBuhL5SKHYFG5lZ7OJicud?= =?us-ascii?Q?Ljm4jefAA8OVzrTJaa8/qcp1FwJ4MTgmGYwOmcjvUd/OZLuEy3rWLGxP9CHv?= =?us-ascii?Q?0jdzdWAvzpmfaqyrB0mTMV2pmLbHVe9XPBnqnH+6RgcYsLBDiRu3II9nAnsS?= =?us-ascii?Q?Df5HCGv9mjNQTfyrAfXC/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TuAehRg/bkRMYZikQGY4rzkXqJlcWUcLf9/NyT3FN5h+eLsD2d7VIimeVX7/WEFraZX+fXxfcGP/NBjVH/RdscexkdNwiiPeq77Co/EZXRJvfmF+USxt1S7Y9bMxgy8fLFil4JfpHCaqKMdSlgbvcvHTzoyrkc/puZPNMj3SWYaKm/moFI/eJ8LnHe4GwO/em+lg5MesYMyV8SKr0dE SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Feb 2018 22:36:40.7124 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8aa8d8a8-6e76-4b6c-e6e1-08d57bd7137e X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR0502MB3875 Subject: [dpdk-dev] [PATCH v2] doc: update mlx4 flow limitations 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: Sat, 24 Feb 2018 22:36:44 -0000 This patch updates mlx4 documentation with flow configuration limitations imposed by NIC hardware and PMD implementation Signed-off-by: Moti Haimovsky Signed-off-by: Ophir Munk --- v1: initial version (use testpmd examples) v2: enhance and add rte_flow examples doc/guides/nics/mlx4.rst | 383 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 383 insertions(+) diff --git a/doc/guides/nics/mlx4.rst b/doc/guides/nics/mlx4.rst index 98b9716..02cea79 100644 --- a/doc/guides/nics/mlx4.rst +++ b/doc/guides/nics/mlx4.rst @@ -515,3 +515,386 @@ devices managed by librte_pmd_mlx4. Port 3 Link Up - speed 40000 Mbps - full-duplex Done testpmd> + +Flow Limitations +---------------- + +- Flows are specified by rte_flow API (defined in **rte_flow.h**) which provides + a generic means to match specific traffic. Please refer to + http://dpdk.org/doc/guides/prog_guide/rte_flow.html +- testpmd application **(app/test-pmd/)** has a command line interface where + flows can be specified. These flows are translated by testpmd + to rte_flow calls. +- **drivers/net/mlx4/mlx4_flow.c** can be used as a reference to flow + limitations written in source code. + +General +~~~~~~~ + +.. code-block:: console + + struct rte_flow_attr { + uint32_t group; /**< Priority group. */ + uint32_t priority; /**< Priority level within group. */ + uint32_t ingress:1; /**< Rule applies to ingress traffic. */ + uint32_t egress:1; /**< Rule applies to egress traffic. */ + uint32_t reserved:30; /**< Reserved, must be zero. */ + } + + struct rte_flow_attr *attr; + +- No support for mlx4 group rte_flow + +.. code-block:: console + + if (attr->group) + print_err("groups are not supported"); + +- No support for mlx4 rte_flow priority above 0xfff + +.. code-block:: console + + if (attr->priority > 0xfff) + print_err("maximum priority level is 0xfff"); + +- No support for mlx4 rte_flow egress filters + +.. code-block:: console + + if (attr->egress) + print_err("egress is not supported"); + +- Must specify mlx4 rte_flow ingress filters + +.. code-block:: console + + if (!attr->ingress) + print_err("only ingress is supported"); + +Flow rules filters +~~~~~~~~~~~~~~~~~~ + +Flow rules filters can be validated using testpmd **flow validate** syntax. + +L2 (ETH) +^^^^^^^^ + +This section documents flow rules limitations related to RTE_FLOW_ITEM_TYPE_ETH. +It does not apply to an inner ETH used after VXLAN since mlx4 can't match those +yet. + +.. code-block:: console + + /** + * RTE_FLOW_ITEM_TYPE_ETH + * + * Matches an Ethernet header. + */ + struct rte_flow_item_eth { + struct ether_addr dst; /**< Destination MAC. */ + struct ether_addr src; /**< Source MAC. */ + rte_be16_t type; /**< EtherType. */ + }; + + struct rte_flow_item_eth *mask; + +- Can only use real destination MAC. +- EtherType is not taken into consideration. +- Source MAC is not taken into consideration and should be set to 0 + +.. code-block:: console + + /** + * Summarize all src adrresses + **/ + for (i = 0; i != sizeof(mask->src.addr_bytes); ++i) + sum_src += mask->src.addr_bytes[i]; + + if (sum_src) + print_err("mlx4 does not support source MAC matching"); + + +Using testpmd application - src mask must be 00:00:00:00:00:00 +otherwise the following command will fail. + +.. code-block:: console + + testpmd> flow validate 1 ingress pattern eth + src spec 00:16:3e:2b:e6:47 src mask FF:FF:FF:FF:FF:FF + / end actions drop / end + +- Supports only full mask. +- No support for partial masks, except in the specific case of matching + all multicast traffic (spec->dst and mask->dst equal to + 01:00:00:00:00:00). + +.. code-block:: console + + /** + * Summarize all dst adrresses + */ + for (i = 0; i != sizeof(mask->dst.addr_bytes); ++i) { + sum_dst += mask->dst.addr_bytes[i]; + + if (sum_dst != (0xffui8 * ETHER_ADDR_LEN)) + print_err("mlx4 does not support matching partial" + " Ethernet fields"); + } + +Using the following testpmd command with partial mask will fail. + +.. code-block:: console + + testpmd> flow validate 1 ingress pattern eth + src spec 00:16:3e:2b:e6:47 + dst spec 4A:11:6C:FA:60:D0 dst mask FF:00:FF:FF:FF:00 + / end actions drop / end + +- When configured to run in promiscuous or all-multicast modes does + not support additional rules + +.. code-block:: console + + if (flow->promisc || flow->allmulti) + print_err("mlx4 does not support additional matching" + " criteria combined with indiscriminate" + " matching on Ethernet headers"); + +- Does not support the explicit exclusion of all multicast traffic + +.. code-block:: console + + if (sum_dst == 1 && mask->dst.addr_bytes[0] == 1) + if (!(spec->dst.addr_bytes[0] & 1)) + print_err("mlx4 does not support the explicit" + " exclusion of all multicast traffic"); + +VLAN +^^^^ + +This section documents flow rules limitations related to +RTE_FLOW_ITEM_TYPE_VLAN. + +.. code-block:: console + + /** + * RTE_FLOW_ITEM_TYPE_VLAN + * + * Matches an 802.1Q/ad VLAN tag. + * + * This type normally follows either RTE_FLOW_ITEM_TYPE_ETH or + * RTE_FLOW_ITEM_TYPE_VLAN. + */ + struct rte_flow_item_vlan { + rte_be16_t tpid; /**< Tag protocol identifier. */ + rte_be16_t tci; /**< Tag control information. */ + }; + + struct rte_flow_item_vlan mask; + +- TCI VID must be specified + +.. code-block:: console + + if (!mask || !mask->tci) + print_err("mlx4 cannot match all VLAN traffic while excluding" + " non-VLAN traffic, TCI VID must be specified"); + +- Does not support partial VLAN TCI VID matching + +.. code-block:: console + + if (mask->tci != RTE_BE16(0x0fff)) + print_err("mlx4 does not support partial TCI VID matching"); + +L3 (IPv4) +^^^^^^^^^ + +This section documents flow rules limitations related to +RTE_FLOW_ITEM_TYPE_IPV4. + +.. code-block:: console + + /** + * RTE_FLOW_ITEM_TYPE_IPV4 + * + * Matches an IPv4 header. + * + * Note: IPv4 options are handled by dedicated pattern items. + */ + struct rte_flow_item_ipv4 { + struct ipv4_hdr hdr; /**< IPv4 header definition. */ + }; + + struct rte_flow_item_ipv4 *mask; + +- Prerequisites: must follow eth dst spec definition. +- Supports only zero or full one's source and destinatin masks. + +.. code-block:: console + + if (mask && + (uint32_t)(mask->hdr.src_addr + 1) > 1U || + (uint32_t)(mask->hdr.dst_addr + 1) > 1U)) + print_err("mlx4 does not support matching partial IPv4 fields"); + +Using the following testpmd command with ipv4 prefix 16 will fail. + +.. code-block:: console + + testpmd> flow validate 0 ingress pattern eth + src spec e4:1d:2d:2d:8d:22 + dst spec 00:15:5D:10:8D:00 dst mask FF:FF:FF:FF:FF:FF + / ipv4 src spec 144.144.92.0 src prefix 16 + / end actions drop / end + +L3 (IPv6) +^^^^^^^^^ + +mlx4 does not support IPv6 filters + +L4 UDP +^^^^^^ + +This section documents flow rules limitations related to RTE_FLOW_ITEM_TYPE_UDP. + +.. code-block:: console + + /** + * RTE_FLOW_ITEM_TYPE_UDP. + * + * Matches a UDP header. + */ + struct rte_flow_item_udp { + struct udp_hdr hdr; /**< UDP header definition. */ + }; + + struct rte_flow_item_udp mask; + +- Prerequisites - must follow eth dst followed by IPv4 specs +- Supports only zero or full source and destination ports masks. + +.. code-block:: console + + if (mask && + ((uint16_t)(mask->hdr.src_port + 1) > 1ui16 || + (uint16_t)(mask->hdr.dst_port + 1) > 1ui16)) + print_err("mlx4 does not support matching partial UDP fields"); + +L4 TCP +^^^^^^ + +This section documents flow rules limitations related to RTE_FLOW_ITEM_TYPE_TCP. + +.. code-block:: console + + /** + * RTE_FLOW_ITEM_TYPE_TCP. + * + * Matches a TCP header. + */ + struct rte_flow_item_tcp { + struct tcp_hdr hdr; /**< TCP header definition. */ + }; + + struct rte_flow_item_tcp *mask; + +- Prerequisites - must follow eth dst spec followed by IPv4 spec +- Supports only zero or full source and destination ports masks. + +.. code-block:: console + + if (mask && + ((uint16_t)(mask->hdr.src_port + 1) > 1ui16 || + (uint16_t)(mask->hdr.dst_port + 1) > 1ui16)) + print_err("mlx4 does not support matching partial TCP fields"); + +Flow actions +~~~~~~~~~~~~ + +RSS +^^^ + +RSS is performed on packets to spread them among several queues based on hash +function calculation and according to provided parameters. + +.. code-block:: console + + struct rte_eth_rss_conf { + uint8_t *rss_key; /**< If not NULL, 40-byte hash key. */ + uint8_t rss_key_len; /**< hash key length in bytes. */ + uint64_t rss_hf; /**< Hash functions to apply - see below. */ + }; + + struct rte_flow_action_rss { + const struct rte_eth_rss_conf *rss_conf; /**< RSS parameters. */ + uint16_t num; /**< Number of entries in queue[]. */ + uint16_t queue[]; /**< Queues indices to use. */ + }; + + struct rte_flow_action_rss *rss; + +- RSS hash is calculated on fixed packet fields including: L3 source and + destination addresses (ipv4 or ipv6) and L4 source and destination addresses + (upd or tcp ports) +- Every Rx queue can be specified only once in RSS action + +- Only power of two number of queues is supported + +.. code-block:: console + + if (!rte_is_power_of_2(rss->num)) + print_err("for RSS, mlx4 requires the number of" + " queues to be a power of two"); + +Using the following RSS action with three RSS ports (0 1 2) will fail. + +.. code-block:: console + + testpmd> flow create 0 ingress pattern eth dst is f4:52:14:7a:59:81 + / ipv4 / tcp / end actions rss queues 0 1 2 end / end + +- RSS hash key must be 40 characters + +.. code-block:: console + + if (rss_conf->rss_key_len != + sizeof(flow->rss->key)) + print_err("mlx4 supports exactly one RSS hash key" + " length: 40" + +- Packets must be distributed over consecutive queue indeces only + +.. code-block:: console + + for (i = 1; i < rss->num; ++i) + if (rss->queue[i] - rss->queue[i - 1] != 1) + break; + if (i != rss->num) + "mlx4 requires RSS contexts to use" + " consecutive queue indices only"); + +Using the following RSS action with non-consecutive ports (0 2) will fail. + +.. code-block:: console + + testpmd> flow create 0 ingress pattern eth dst is f4:52:14:7a:59:81 + / ipv4 / tcp / end actions rss queues 0 2 end / end + +- The first queue index specified in RSS context must be aligned + to context size + +.. code-block:: console + + if (rss->queue[0] % rss->num) + print_err("mlx4 requires the first queue of a RSS" + " context to be aligned on a multiple" + " of the context size"); + +Using the following RSS action with a fist queue index set as 1 - will fail. + +.. code-block:: console + + testpmd> flow create 0 ingress pattern eth dst is f4:52:14:7a:59:81 + / ipv4 / tcp / end actions rss queues 1 2 end / end + -- 2.7.4