From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0658CC4360F for ; Thu, 14 Feb 2019 12:39:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B6F4E2229F for ; Thu, 14 Feb 2019 12:39:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=mojatatu-com.20150623.gappssmtp.com header.i=@mojatatu-com.20150623.gappssmtp.com header.b="Orh4AQJT" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390883AbfBNMjd (ORCPT ); Thu, 14 Feb 2019 07:39:33 -0500 Received: from mail-it1-f169.google.com ([209.85.166.169]:51567 "EHLO mail-it1-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732114AbfBNMjc (ORCPT ); Thu, 14 Feb 2019 07:39:32 -0500 Received: by mail-it1-f169.google.com with SMTP id y184so14617582itc.1 for ; Thu, 14 Feb 2019 04:39:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mojatatu-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=uQeZCVLklABz3UHtFeBxJHUJlR5QMHjo8GAtguOnnGY=; b=Orh4AQJTYeS0ZeoBZBllHVXTP+2KNzSkzqDLcNvly/bC6PfFjrztCAXdN/JnA2qu9Y cHOtftHBd4mUP/lFP1SSW49PPRGrkKr5U0r2jPKGcb8qDtSKwQTfyp1L2zTtuAH0gd7U Re5e2MaQaVxrLm+u9V9oxJzfpbt9w9KGauVEc5kwONi99xuMurkbsQtECL1LRY3z3dK1 d/69ts4UrOhiZna5YetBENQVU7f51X9iToRKoNskaHapd/p9sx1U3kDk7Zb3yQSdK6g/ t5UuujTN9GrvA6vM7Srm+DUKfjft9aFsXiYQ7JwYtpMeDn/Ibu5vlCuiQ56sukmmqreM z01g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=uQeZCVLklABz3UHtFeBxJHUJlR5QMHjo8GAtguOnnGY=; b=o7/3xBJe2g3qNAFnwFh4z0jzhZ/14NWyUqxlhulokM1UEZp8hAo2YDU0xDJtPs6WQo t6wlO3kO4I06hftW1zQgC2jmbKntuhEaW0fHWjvfinaYO2PpUNmJkpoTGhAzDX9RHRfJ 95wTneSQIjibdEcmcqjOjtW/+PvJNJMuhzLfBRlLjAE5CuKYHO5qbBc077+uJnLRNFRs NSWKPTnRMbCgxCZNs6jgy4qkhSd+2aIjDtUfBkL+iikqAFMiVGjyoSzil1FKPwJfiFSl ZT1Y3pWjMeq7Fa86Fx+waWZVHlB8gXZ5lJCp0JpzGFqX4bngPgaQSBkiDuHoIOL7HXhb mGBQ== X-Gm-Message-State: AHQUAuZfeXJ5HYFAGHzBCQ9sqcfIyaX3ChBiUUIkwmZlFpYFi+AYqqyF LYRAPW5q8a4puB8QP2iGamxJDw== X-Google-Smtp-Source: AHgI3Ibm4uh5Vm7LXDFOHiLngaUNKJNHU3cRSm0FjsUt1WJWwZwdCpqr+FdY0TYNd2FREXttASpwcw== X-Received: by 2002:a24:6993:: with SMTP id e141mr1743436itc.57.1550147971217; Thu, 14 Feb 2019 04:39:31 -0800 (PST) Received: from [10.0.0.135] (24-212-162-241.cable.teksavvy.com. [24.212.162.241]) by smtp.googlemail.com with ESMTPSA id t1sm857523ioc.45.2019.02.14.04.39.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Feb 2019 04:39:30 -0800 (PST) Subject: Re: TC stats / hw offload question To: Edward Cree , netdev Cc: Jiri Pirko , Cong Wang , Or Gerlitz , Andy Gospodarek , PJ Waskiewicz , Anjali Singhai Jain , Jakub Kicinski References: <26f0cfc9-3bef-8579-72cc-aa6c5ccecd43@solarflare.com> <4cb765dd-453f-3139-bce6-6e0b31167aec@mojatatu.com> <70d77198-42fd-838a-d352-2647e7cad4d6@solarflare.com> <561205a6-101b-c86b-e77d-6ebdcf31a56d@mojatatu.com> <11ab2dc0-ec39-18cd-d170-0d5f954198b9@solarflare.com> From: Jamal Hadi Salim Message-ID: <702dd5b7-c6ed-b669-8270-d44f5ff4fb30@mojatatu.com> Date: Thu, 14 Feb 2019 07:39:28 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.0 MIME-Version: 1.0 In-Reply-To: <11ab2dc0-ec39-18cd-d170-0d5f954198b9@solarflare.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On 2019-02-11 6:44 a.m., Edward Cree wrote: >> Hasnt been necessary thus far. >> Is your end goal to match and count? > My end goal is to implement TC offload in some hw we're designing >  here at Solarflare.  So I'm trying to determine what hardware is >  expected/required to do. > It might be possible to design our new hw so that we can attach a >  counter to every action, if that's what TC wants. It makes sense to have a counter on every action - even if it is for debugging purposes. The two most basic actions are "drop" or "accept". In TC speak the default action is "classid x:y" which typically is to select a queue or give the flow some identity (one should be able to use the same action on h/w ingress as well to select a rx DMA ring for example, but that seems uncommon). Note, your counters should also be shareable; example, count all the drops in one counter across multiple flows as in the following case where counter index 1 is used. tc flower match foo action drop index 1 tc flower match bar action drop index 1 > But since the >  other vendors don't seem to do that, I wondered if there was a >  reason, or if perhaps the counter resources (and PCI bw to read >  them) could be saved if all those separate counters aren't really >  needed. Probably nobody has paid attention or asked as you did. Will let the h/w folks speak for themselves. My understanding based on experience is counters are cheap. Most modern NICs and ASICs have a gazillion of them at their disposal. > Right now the design we are considering would only count >  packets as-matched, i.e. before any edits.  That's fine for encap >  — you can calculate the bytes correction in SW — but not for decap >  since in principle the length of the RXed outer headers could >  vary (e.g. you might have IP options there). > ok, so not much in terms of other types of actions. But for abstraction sake maybe use "flowid x:y" and have counters associated with that. Or even make this optional and only attach a counter if someone says "action ok" and allow them to specify the counter index (assuming you architecture has an indexed table of counters). cheers, jamal