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.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS,URIBL_BLOCKED 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 22AEEC282CB for ; Tue, 5 Feb 2019 18:22:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E570F2083B for ; Tue, 5 Feb 2019 18:22:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gBGd9bBo" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729664AbfBESWM (ORCPT ); Tue, 5 Feb 2019 13:22:12 -0500 Received: from mail-pl1-f196.google.com ([209.85.214.196]:37422 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725921AbfBESWM (ORCPT ); Tue, 5 Feb 2019 13:22:12 -0500 Received: by mail-pl1-f196.google.com with SMTP id b5so1857601plr.4 for ; Tue, 05 Feb 2019 10:22:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=wgCYoHaKyrG57RcKJ9K56GlhqoFXF2b6yXu5h0pN5zg=; b=gBGd9bBoJB1X/5ig3o2M6R/C6ljQZJ0HK0VDvRtv+pc0RW0XVgaJrm799ZE6aTQd3W AfnaqbWyWITIa5+zL0mEBa9jfUtJuC6U7K/Nm5Owh/9Hvg9L2rK4Zut/Z63wECUFIRr1 uGVrxROd9Ods29WfnAo20RMg6G5ILAIzddhzJCeEpaoACtvOKzAGZNTr3fDjZDJeVw/4 9m+4O9u91hbmUpOld9qoZXAwnTuD6H+sEH0JFV3E9hgdksycakcVx3apcaX+BC696vyM MYQW+gpo8E9rA7l3nPEaYOcHfeI+JuzsCQUVz/DI0jP+YzLaVmR99GQEMZTX77ZSJq77 yX8g== 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-transfer-encoding :content-language; bh=wgCYoHaKyrG57RcKJ9K56GlhqoFXF2b6yXu5h0pN5zg=; b=YrJGQ5P2qIy5WpR87CaLh7/4ocLZ9FyYxz+RZ1ZWkhL0uM68b0JO1FsI6pkGMpfzs4 EEyLppzE9aLcK7jM6qeUMWG8u3F9ftcjT0Usbcjm7qY/wsNwrTKixvtL1ECxFO6HeeHR N9Ts4Oo7MrR2sEfemhh36Ld0XjlaH9h+WaFGwjXW0ngvrPZsAAQQdp8tPM7nmd9T7cx8 yglLj70FjQA8xEpNc9GWOTpB6gwqrRP//Vdabk+4Ppmk7ylntQi23qp629xNNhl9fwHC FxIZRLooTJbEnRyyS7rkGVs8iNPmt3Nq2TGe4rPe0yjtjzgR4quVSKUF8buLdCiTiTsy IpOA== X-Gm-Message-State: AHQUAubEyoVGlroq6S44viKEwOX9/q7pIvT/2GKYki9vuu3mOSlBbjP7 shK8evxBqGJc+AI4Qvrc71Y= X-Google-Smtp-Source: AHgI3IY/A2ZqK+tGrOZmAIY7IRvheFXTLP50E68lMrQlBX9eG5lU/SpzoD5wJn9NzolqxyKf/FMaAQ== X-Received: by 2002:a17:902:6b09:: with SMTP id o9mr6420543plk.208.1549390931658; Tue, 05 Feb 2019 10:22:11 -0800 (PST) Received: from [192.168.0.16] ([97.115.131.42]) by smtp.gmail.com with ESMTPSA id 15sm6226417pfs.113.2019.02.05.10.22.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Feb 2019 10:22:10 -0800 (PST) Subject: Re: [ovs-dev] [PATCH net-next V2 1/1] openvswitch: Declare ovs key structures using macros To: Eli Britstein , David Miller , "yihung.wei@gmail.com" Cc: "dev@openvswitch.org" , "netdev@vger.kernel.org" , "simon.horman@netronome.com" References: <20190203091217.8459-1-elibr@mellanox.com> <20190204.120727.1732794761205124286.davem@davemloft.net> <4f57a34c-55a3-ea39-b9cc-2e1dbebc99c1@mellanox.com> From: Gregory Rose Message-ID: Date: Tue, 5 Feb 2019 10:22:09 -0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.5.0 MIME-Version: 1.0 In-Reply-To: <4f57a34c-55a3-ea39-b9cc-2e1dbebc99c1@mellanox.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On 2/5/2019 4:02 AM, Eli Britstein wrote: > On 2/4/2019 10:07 PM, David Miller wrote: >> From: Yi-Hung Wei >> Date: Mon, 4 Feb 2019 10:47:18 -0800 >> >>> For example, to see how 'struct ovs_key_ipv6' is defined, now we need >>> to trace how OVS_KEY_IPV6_FIELDS is defined, and how OVS_KEY_FIELD_ARR >>> and OVS_KEY_FIELD defined. I think it makes the header file to be >>> more complicated. >> I completely agree. >> >> Unless this is totally unavoidable, I do not want to apply a patch >> which makes reading and auditing the networking code more difficult. > This technique is discussed for example in > https://stackoverflow.com/questions/6635851/real-world-use-of-x-macros, > and I found existing examples of using it in the kernel tree: > > __BPF_FUNC_MAPPER in commit ebb676daa1a34 ("bpf: Print function name in > addition to function id") > > __AAL_STAT_ITEMS and __SONET_ITEMS in commit 607ca46e97a1b ("UAPI: > (Scripted) Disintegrate include/linux"), the successor of commit > 1da177e4c3f4 ("Linux-2.6.12-rc2"). I didn't dig deeper to the past. > > I can agree it makes that H file a bit more complicated, but for sure > less than ## macros that are widely used. > > However, I think the alternatives of generating such defines by some > scripts, or having the fields in more than one place are even worse, so > it is a kind of unavoidable. Why is using a script to generate defines for the requirements of your application or driver so bad?  Your patch turns openvswitch.h into some hardly readable code - using a script and having a machine output the macros your application or driver needs seems like a much better alternative to me. - Greg > > Please reconsider regarding applying this patch. > > _______________________________________________ > dev mailing list > dev@openvswitch.org > https://mail.openvswitch.org/mailman/listinfo/ovs-dev