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=-6.0 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_PASS,USER_AGENT_NEOMUTT 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 B16BAC282C4 for ; Mon, 4 Feb 2019 12:48:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 401132087C for ; Mon, 4 Feb 2019 12:48:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=netronome-com.20150623.gappssmtp.com header.i=@netronome-com.20150623.gappssmtp.com header.b="hV6KNPZl" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730974AbfBDMsM (ORCPT ); Mon, 4 Feb 2019 07:48:12 -0500 Received: from mail-lj1-f195.google.com ([209.85.208.195]:35327 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729308AbfBDMsL (ORCPT ); Mon, 4 Feb 2019 07:48:11 -0500 Received: by mail-lj1-f195.google.com with SMTP id x85-v6so11456033ljb.2 for ; Mon, 04 Feb 2019 04:48:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netronome-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=8zUwC5YzxZwbh46Ad1CUKgoZ/DOc23WqK0oO5Xy2Nco=; b=hV6KNPZl0qePKmS5BV6ymbd4nYBEqjl4uzFoqbjshviYu0HjFrro2wAMwgsY/1ag8H moBdpzRZ6JlaMm9p3ilaXretPRUPeeTHjUWhZ/6QjzZaJi2dU7bfUGplnx4erVxhakMz ZdgD8Z50UVKdvjfRX1IqTHucEHo02ddW9tF/1LbnW8K9VdcMTt/vab0p6yDNbwSy5lee qsuIFQ2EyRiajwLiLie7H+pP5nI6r7nObeU5J3NKtM0BZCOIKrp8cDBW3BKUYUU6CYru MY51k3EOxUwdvYIqSK7mcD6Wm0ha0peV0YzE56/xAbnP07BKeO0iPRdPum5avnmyE7aa /NyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=8zUwC5YzxZwbh46Ad1CUKgoZ/DOc23WqK0oO5Xy2Nco=; b=Ps3qvCDLLivrwrQRVCRvZ6afkjRGtybUFT0Di4Heul67jbOPIfVxgrf7yW8OGgGyU3 MV5dM3dCvdS0CNPT2BOcXH5kNmZgdjG+BBG0dyy9Q/b1N88zHWxY0Lrskk1jLVq5jixT cu+O4Rr9RzYyRlGu0iuB+swKstx9t0bg8IfjdhA+iEB/92Ud9Orxvt5UgFxHK21JcBOl mIxrcvgDjLEbM4EfG1oyQZfZZJih8vgO9W7vSNEiLiM9tWacZkDMofD2k+2d51INElRa hU7Q389sJ16pZeNklFA+z9ZGEOrxW1Y0HE19d9+b6Dr48bFtoOEGUWUSNkvAQ3kEY4rO TJhw== X-Gm-Message-State: AJcUukfKEIHVQRSwUc2XjAeVHAcxA8XljzRQZ2+e2TgY6dG/KZVECoOW EY+egI62LAwhIoV95fUeO2vg3g== X-Google-Smtp-Source: ALg8bN6+2kUHFGaOpRA8WhB13gSpsNIBMhZgUmWOFl/Fl+OcPI69ET63647wT1OdyHQEz81kLyYeEg== X-Received: by 2002:a2e:3803:: with SMTP id f3-v6mr40045635lja.169.1549284489561; Mon, 04 Feb 2019 04:48:09 -0800 (PST) Received: from netronome.com ([62.119.166.9]) by smtp.gmail.com with ESMTPSA id v9sm3070916lfg.15.2019.02.04.04.48.06 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Feb 2019 04:48:08 -0800 (PST) Date: Mon, 4 Feb 2019 13:48:05 +0100 From: Simon Horman To: Paul Blakey Cc: Marcelo Leitner , Guy Shattah , Aaron Conole , John Hurley , Justin Pettit , Gregory Rose , Eelco Chaudron , Flavio Leitner , Florian Westphal , Jiri Pirko , Rashid Khan , Sushil Kulkarni , Andy Gospodarek , Roi Dayan , Yossi Kuperman , Or Gerlitz , Rony Efraim , "davem@davemloft.net" , "netdev@vger.kernel.org" Subject: Re: [RFC PATCH net-next 1/6 v2] net/sched: Introduce act_ct Message-ID: <20190204124804.thbjjwypnoyb2xbx@netronome.com> References: <1548748926-23822-2-git-send-email-paulb@mellanox.com> <20190201132335.GP10660@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org [Repost without HTML; sorry about that] On Sun, Feb 03, 2019 at 08:26:23AM +0000, Paul Blakey wrote: > > > On 01/02/2019 15:23, Marcelo Leitner wrote: > > On Tue, Jan 29, 2019 at 10:02:01AM +0200, Paul Blakey wrote: > > ... > >> diff --git a/include/uapi/linux/tc_act/tc_ct.h b/include/uapi/linux/tc_act/tc_ct.h > >> new file mode 100644 > >> index 0000000..6dbd771 > >> --- /dev/null > >> +++ b/include/uapi/linux/tc_act/tc_ct.h > >> @@ -0,0 +1,29 @@ > >> +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ > >> +#ifndef __UAPI_TC_CT_H > >> +#define __UAPI_TC_CT_H > >> + > >> +#include > >> +#include > >> + > >> +#define TCA_ACT_CT 18 > >> + > >> +struct tc_ct { > >> + tc_gen; > >> + __u16 zone; > >> + __u32 labels[4]; > >> + __u32 labels_mask[4]; > >> + __u32 mark; > >> + __u32 mark_mask; > >> + bool commit; > > > > This is one of the points that our implementations differs. You used a > > struct and wrapped it into TCA_CT_PARMS attribute, while I broke it up > > into several attributes. > > > > cls_flower and act_bpf, for example, doesn't use structs, but others > > do. > > > > Both have pros and cons and I imagine this topic probably was already > > discussed but I'm not aware of a recommendation. Do we have one? > > I guess flower uses a netlink attribute per key attribute because > a lot of time, most of them won't be used, and you would send less. > we can have ct, ct + snat, ct + dnat, zone and mark.... a lot of this > won't be used sometimes. > > Also you can't add nested attributes to the struct easily. > > Also netlink attributes can be tested for existence, while a struct > would need a special non valid value, or another field to specify which > fields are used. > > both are hard to test if a requested attribute was ignored, besides > checking the netlink echo or dumping the action back. if for example a > older kernel module and newer userspace uses a attribute above > enum TCA_CT_MAX (struct attributes also don't have max len, in nla_parse). > > > All in all, I think mostly netlink attributes would be better. +1 I believe that Flower uses more attributes because its regarded as being more flexible and that benefit outweighs the extra cost - f.e. the netlink messages would tend to be a bit larger if a struct was used. > > > > >> +}; > >> + > >> +enum { > >> + TCA_CT_UNSPEC, > >> + TCA_CT_PARMS, > >> + TCA_CT_TM, > >> + TCA_CT_PAD, > >> + __TCA_CT_MAX > >> +}; > >> +#define TCA_CT_MAX (__TCA_CT_MAX - 1) > >> + > >> +#endif /* __UAPI_TC_CT_H */ > > ... > >