From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0078.outbound.protection.outlook.com [104.47.0.78]) by dpdk.org (Postfix) with ESMTP id 401D11B2D8 for ; Thu, 18 Jan 2018 14:38:41 +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=Gssxd212BANK9SpHbUe0r9zdkAvmLBXJtqjnhCaqPFo=; b=YA/w0rHXaypkPCKkNKQGKsXpN7q1NIiGgoxrn+mn5QoFKrh4AV93P1lDY191APhccwmm2tq2v27suJgkxJU4pbZkwSA2WMVUKRPCi2WWwqFeQAF5As/AyDifnxFNOcrZw6vYgKx4uw9QGAY56eMhTJv7CDTNFBIcKQQTNfI1qYw= Received: from mellanox.com (37.142.13.130) by VI1PR0502MB3886.eurprd05.prod.outlook.com (2603:10a6:803:c::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.407.7; Thu, 18 Jan 2018 13:38:37 +0000 From: Ophir Munk To: dev@dpdk.org, Pascal Mazon Cc: Thomas Monjalon , Olga Shern , Ophir Munk Date: Thu, 18 Jan 2018 13:38:11 +0000 Message-Id: <1516282691-29698-7-git-send-email-ophirmu@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1516282691-29698-1-git-send-email-ophirmu@mellanox.com> References: <1515692751-25257-1-git-send-email-ophirmu@mellanox.com> <1516282691-29698-1-git-send-email-ophirmu@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: VI1PR0802CA0042.eurprd08.prod.outlook.com (2603:10a6:800:a9::28) To VI1PR0502MB3886.eurprd05.prod.outlook.com (2603:10a6:803:c::11) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: d8231937-b81d-453f-005b-08d55e78c769 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:VI1PR0502MB3886; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0502MB3886; 3:SbEqhWjR2h+Hctdk+830ozotVYPIGHGG6C4tjHssWHTffZudE81JLqoW7wO9bwUb88XpFHNtT5NwNLZMOXMLx0Aj+h3sDGSwYhbCJZ3B2ILJOna633pekjTR3OgmROmjTMz4z0Js23pSzzeBKXlDeEVo7iTX8Op8HMhWtg/LG8uPW8rmGzdcMnvtGcf92a6t6i/m7X0Zi+qINbLWuxNt/yU7SVws3UZu/e0CxPt+0OzUjp3JEseT5ofg1ru+UtZk; 25:jaMiGwuO8QjxNfDsledG6s8Y8lNrjreIQveynoT5Ogo939vactSIEGafX/uOKUvSXoVQwdn82W5goL2oV1A8tfuO4FABLPv5mtkyDEIc/3M79uy7Ein1ecfOgisgTdBhsQCzjBBQgZtA8RhWyJfTIXl16y/K4ppVg3R2iu8FVNhdmSJmPOZdCwrwIiPlSvboLt558vwiDE8DVMBbBpM76jxDrR7Dd5krzuDuEWbHB6qN/qazDjSArrJhm1GVYtSQk3vO3qxjW+faJozrziIf7gtjQ/TQpHyvDCBFAWC8ds2ilIunx1ghu4uuldJOjpBxf1MUk1LscIM4mbdV6huCrg==; 31:ZohJNHWPZ77Sg17hUMW9PH8PtdJGPFFQMvBfgMEhx3O1Z2ekLBxgWW3E1Kr2yvYRFEHqn+nd/v14M3Qql7EDkcIsqG7UUZD/tWD60SpBbPRPRaB6xkb0SXABdekZQgvpKByGAwDSJ3xe5k4rL8rHMNOfnJxuZv8Ttdf16alm9jMHJlMDV6HkRl4+czLdVZCDPEeSH930KLy2XUB5pG3tUIe2iWmq8SBzK7d9z5eoO+I= X-MS-TrafficTypeDiagnostic: VI1PR0502MB3886: Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ophirmu@mellanox.com; X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; VI1PR0502MB3886; 20:5LuSpdGKcCC1tHym5FJbOoMuGMhKFE+nJtbofQheuco2rEePtS1HtZWmHnBX3KeuNmKK+TJwKyRcOfwaAeWviDp6M1Bh4Ojj6GcU2TUvFNL+vgmgx+T52kN8sCHn9D6CcNtHkE1eif4yxuVvRRcGT89l8bW6GN6V2R5BBMLauyAwxrl4/C/gzi7H46nK2WaY02DbvqJpdQBZtOIF2iXWGqH9tqBfzqD43q6UrqzarIyh0ensdXcHBbmFSWdeAxnIgldib9jiDMJSFheiO3xII67wfVDZwODWORnITTR1NfKkcsAovYhV9K2/QrTV2D3ldy6G9au14SkCcmZhIOc278HbRUiP0R+7do3m9TbMkNHDpjJgnb19aOSBXRoev988uykycJ9HA3zE3CtwxMHYNm39k5Kt6nBqBhF0CwF2XBDnRiXIdMzw7qzJ5ZRx1s6/90sWpe1nnz9hdWuW/EmM8ZnpbKShZg+fSND5AnnjMFg8zgbg58umMunpicTnVcRj; 4:91FHG95vkcCXmGy32kzJExD11prKPMSgp3XD7+Sy6wHf4xULuG5sGK2ho9xHlljVQksk8+YxMcLnm0Imck2po/Vf3SUcEtkXSG/kSQjtYadGRdsN0qYaDXsMPcAPh0bvwfzxfDEymVCG4vaqgzUDHGH/6DE265lzjCy5OCtGfRukIASMzIUc8/uzrvrJBNNlhkFR0xvYhJlH0oy6szXKhcvis86anZetettEbGo5dtl1UId9E8+EjMqwfGl/tvlQnXY5Gf9i4yMuW6J/5TbnKQ== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(5005006)(8121501046)(3231023)(2400062)(944501161)(3002001)(10201501046)(93006095)(93001095)(6055026)(6041268)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(6072148)(201708071742011); SRVR:VI1PR0502MB3886; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:VI1PR0502MB3886; X-Forefront-PRVS: 05568D1FF7 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(346002)(39380400002)(376002)(396003)(366004)(39860400002)(189003)(199004)(48376002)(33026002)(305945005)(6116002)(478600001)(3846002)(106356001)(66066001)(50466002)(7736002)(8676002)(81166006)(21086003)(8936002)(97736004)(16526018)(4720700003)(68736007)(6666003)(51416003)(7696005)(52116002)(81156014)(4326008)(36756003)(50226002)(26005)(69596002)(105586002)(53936002)(5660300001)(25786009)(59450400001)(386003)(316002)(47776003)(76176011)(2906002)(55016002)(2950100002)(54906003)(86362001)(16586007)(107886003)(6916009)(21314002); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0502MB3886; 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; VI1PR0502MB3886; 23:ac8T5bCh03t/7T8ojQNKtgjZWYMq68AIHwLnWS7?= =?us-ascii?Q?Rca3JJtHY1xMBDHaCVlBbJBbFVjAV1vy+/AD3mPNQIAQLNcpJM5KYf13ci/w?= =?us-ascii?Q?gvSMBNR52Uilt6ViM79xUyhruqiLcoB0UqmEx9ogDcKAhTHEMBsMxP+mgIVH?= =?us-ascii?Q?UFje/tHKsru8lkDSPMCGvGU5w5imS2JfFyNq7fJ9532ApKo44cW3aSCY5oSN?= =?us-ascii?Q?cmtMBWE+a4PktmpKJ7onFG2MfWT9etMmAFIs7JvkTF2E5zhTQeYkJIMF4AaK?= =?us-ascii?Q?K/Yz/OYCd6Limb0QugFEdjx9dSIFvXOVk1wn60o3csO8uOryzOlUpcoA68L7?= =?us-ascii?Q?IsKlb1lA4IJfQq4NoghypeLXBtV8hJy1Rcc9QiD/sB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m6A=3D?= X-Microsoft-Exchange-Diagnostics: 1; VI1PR0502MB3886; 6:/+hrbr8DYjmOJA5L7wd/03LeQziYiH5miWjGGRoRcPircSKXKykbLwyLerIv6+xQdbzNKef2EW4JaLjwHWqM3hVOb1LU6TBcccxHBbeh2hTslEAOVJwRv7CONwI96KPB5f61bWZNcaT8GQO7RTW0O58LXkpSjVUrjwLdwhzM7OY+AjRk4stQJQE15c5+iHR4zJHz8U3j7rrPPfj1jfu14SA6L4YflAdz24UP7QzSkY4pPT1QPAf97MEr6TfbqC2mK6lTCH5ubdxNJKMo6VlHnjUaIFI2Jppuj/VuWvP3RvdMxUuPY5JFfdan/rl1wYmU8IEGJrCJRtrBz/9LiSPG/4nMAYRUoVHAs62iZcgF4P8=; 5:cmgdhrVLx4mN7ldjExfO/d8kdSTabjQ2Hd6fp/wrkmsFeh0j/UfaWZh61k+Ez4KUFPZdw23FwIynGu/Vco6HqrOtmmYJpvmsjcVaavZx99qk1h7Y1pQuAWlsb+TGZNa9eUNzixhHosPrEXhFUhPQwgM/T5FLKYpYlooFr1cM44s=; 24:jaGCETZLbWu99a0iH5ZxlkYryikVSOn3+K9utAiOOarGduUtnni68VuWHwSMku/yIlNkzpyPoczp/CZ7hUulFbFOwL0/AbgwVl8yTl/WUDU=; 7:Yw/YE9e6QqOTfWHG1hCMWp6U2cY6tZ3c3z6d4sbHSfNg0m6lYhH0MXsAGu5shBxTNEWmZdE3IWdEn/SfX5+tmeFLCBBlqgXsl2cp3137BZpoJgUAGy2jvQr+A5SArrTzSIZxusZcnPQSvQ925FPIRTch3w2V7QsixYGy1KesceBMIA4R54IcdbC0xQOUlOiSHQ8aZC4JxtUAwzylnahVed+mw1nXoTTmz5/RCZ23l6X3d+AcHrH4TgoPvsTpJzw+ SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jan 2018 13:38:37.1645 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d8231937-b81d-453f-005b-08d55e78c769 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0502MB3886 Subject: [dpdk-dev] [PATCH v5 6/6] doc: detail new tap RSS feature in guides 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, 18 Jan 2018 13:38:41 -0000 Signed-off-by: Ophir Munk --- doc/guides/nics/tap.rst | 60 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/doc/guides/nics/tap.rst b/doc/guides/nics/tap.rst index 04086b1..dc6f834 100644 --- a/doc/guides/nics/tap.rst +++ b/doc/guides/nics/tap.rst @@ -132,6 +132,7 @@ Supported actions: - DROP - QUEUE - PASSTHRU +- RSS It is generally not possible to provide a "last" item. However, if the "last" item, once masked, is identical to the masked spec, then it is supported. @@ -161,6 +162,11 @@ Drop UDP packets in vlan 3:: testpmd> flow create 0 priority 3 ingress pattern eth / vlan vid is 3 / \ ipv4 proto is 17 / end actions drop / end +Distribute IPv4 TCP packets using RSS to a given MAC address over queues 0-3:: + + testpmd> flow create 0 priority 4 ingress pattern eth dst is 0a:0b:0c:0d:0e:0f \ + / ipv4 / tcp / end actions rss queues 0 1 2 3 end / end + Example ------- @@ -213,3 +219,57 @@ traffic is being looped back. You can use ``set all size XXX`` to change the size of the packets after you stop the traffic. Use pktgen ``help`` command to see a list of all commands. You can also use the ``-f`` option to load commands at startup in command line or Lua script in pktgen. + +RSS specifics +------------- +Packet distribution in TAP is done by the kernel which has a default +distribution. This feature is adding RSS distribution based on eBPF code. +The default eBPF code calculates RSS hash based on Toeplitz algorithm for +a fixed RSS key. It is calculated on fixed packet offsets. For IPv4 and IPv6 it +is calculated over src/dst addresses (8 or 32 bytes for IPv4 or IPv6 +respectively) and src/dst TCP/UDP ports (4 bytes). + +The RSS algorithm is written in file ``tap_bpf_program.c`` which +does not take part in TAP PMD compilation. Instead this file is compiled +in advance to eBPF object file. The eBPF object file is then parsed and +translated into eBPF byte code in the format of C arrays of eBPF +instructions. The C array of eBPF instructions is part of TAP PMD tree and +is taking part in TAP PMD compilation. At run time the C arrays are uploaded to +the kernel via BPF system calls and the RSS hash is calculated by the +kernel. + +It is possible to support different RSS hash algorithms by updating file +``tap_bpf_program.c`` In order to add a new RSS hash algorithm follow these +steps: + +1. Write the new RSS implementation in file ``tap_bpf_program.c`` + +BPF programs which are uploaded to the kernel correspond to +C functions under different ELF sections. + +2. Install ``LLVM`` library and ``clang`` compiler versions 3.7 and above + +3. Compile ``tap_bpf_program.c`` via ``LLVM`` into an object file:: + + clang -O2 -emit-llvm -c tap_bpf_program.c -o - | llc -march=bpf \ + -filetype=obj -o + + +4. Use a tool that receives two parameters: an eBPF object file and a section +name, and prints out the section as a C array of eBPF instructions. +Embed the C array in your TAP PMD tree. + +The C arrays are uploaded to the kernel using BPF system calls. + +``tc`` (traffic control) is a well known user space utility program used to +configure the Linux kernel packet scheduler. It is usually packaged as +part of the ``iproute2`` package. +Since commit 11c39b5e9 ("tc: add eBPF support to f_bpf") ``tc`` can be used +to uploads eBPF code to the kernel and can be patched in order to print the +C arrays of eBPF instructions just before calling the BPF system call. +Please refer to ``iproute2`` package file ``lib/bpf.c`` function +``bpf_prog_load()``. + +An example utility for eBPF instruction generation in the format of C arrays will +be added in next releases + -- 2.7.4