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=-7.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, 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 B5413C282C3 for ; Thu, 24 Jan 2019 14:22:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8411F218A2 for ; Thu, 24 Jan 2019 14:22:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="KDMgQjKy" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728187AbfAXOWL (ORCPT ); Thu, 24 Jan 2019 09:22:11 -0500 Received: from mail-ed1-f66.google.com ([209.85.208.66]:47029 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727694AbfAXOWL (ORCPT ); Thu, 24 Jan 2019 09:22:11 -0500 Received: by mail-ed1-f66.google.com with SMTP id o10so4675434edt.13 for ; Thu, 24 Jan 2019 06:22:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ZQZ+QuVl7uMfljS/t5uMBlxlx5WHKFauJfyA0KO0VlU=; b=KDMgQjKyR3AcPMZ79kY6PkZWZzN05FMPd/isv6Ny0NzWBDkcDKgpbiJpNvqhRvAD4N XEDKcM2rJj0uQ44mn3i+RZwhMh9l3pQtH+h1Y4PehRV0n8GdxSSJ9RgLADCU38dzhCb1 ByxeBRLEfENOphIM+2xMDDgmwTsFAIGMWP2d+Fr7zyhfIHcoTgjG41pT7/MIALtfSYNK AnQ0XI0H4U03REltMWM1Z6EbB9LfMlofdGk6XfFrkzkSLY7UUI7B80Rei8qOnTMwi0Zr 7i0RkxNsA+af8XTkan8j1D6EPJPs4ZYib1ZEFgd8h5IIjyg4xtqBapPUoCsZgA0gUp4t Z4cA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ZQZ+QuVl7uMfljS/t5uMBlxlx5WHKFauJfyA0KO0VlU=; b=scvDncktc8kyuG5aRCH9j61gggvVHloWlkfna2VDnYSc4o93EMy/0jVmu/VDi8XaKh aJxJyZfnB3VmWG7nUDfAu4YRaUou6BV7LHm/yVCJP67K0gEbUAtByHAfEz6nl7YhyD63 cqXNbzyPX+ia5paajZZQE18f3RqwtE++dtBRcgEPMChECFTe7HcqlnhxwBXQxbBJYMS9 sQzBb/FEIlxpz2ItgyviZaMKarez0Dh8JvmSQqDRlAvqDtiJ8QjSo9y2nMjBVxwunEJt ejdScHBiQJUKTA1bse0QPUYGpkq/qKkZha8iDylUTyDUfTZr6pZp6ePFynCez0b3sXWZ Sozg== X-Gm-Message-State: AJcUukfWUyUL1vLoPAR7lwXRneoqrKDBpdMQPA2zeFepKc5fNQGz7M4T lwrSrXgE44r8/EmToj6j8YxpWHf+QEyF2iQ0t1Szag== X-Google-Smtp-Source: ALg8bN44Z6f6exwCr15OQcl62EkU/m0KDU/+7oaOZn2RtcyGKgmYxGeSs+KxeOHraFVYIkreZXt96hhRBuiTQNuRMOY= X-Received: by 2002:a17:906:d0c6:: with SMTP id bq6-v6mr5821658ejb.99.1548339728931; Thu, 24 Jan 2019 06:22:08 -0800 (PST) MIME-Version: 1.0 References: <20190114131841.1932-1-maximmi@mellanox.com> <20190114131841.1932-4-maximmi@mellanox.com> In-Reply-To: From: Willem de Bruijn Date: Thu, 24 Jan 2019 09:21:32 -0500 Message-ID: Subject: Re: [PATCH 3/7] net/ethernet: Add parse_protocol header_ops support To: Maxim Mikityanskiy Cc: "David S. Miller" , Saeed Mahameed , Willem de Bruijn , Jason Wang , Eric Dumazet , "netdev@vger.kernel.org" , Eran Ben Elisha , Tariq Toukan Content-Type: text/plain; charset="UTF-8" Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Thu, Jan 24, 2019 at 4:48 AM Maxim Mikityanskiy wrote: > > > -----Original Message----- > > From: Willem de Bruijn > > Sent: 23 January, 2019 16:15 > > To: Maxim Mikityanskiy > > Cc: David S. Miller ; Saeed Mahameed > > ; Willem de Bruijn ; Jason Wang > > ; Eric Dumazet ; > > netdev@vger.kernel.org; Eran Ben Elisha ; Tariq Toukan > > > > Subject: Re: [PATCH 3/7] net/ethernet: Add parse_protocol header_ops support > > > > On Mon, Jan 14, 2019 at 8:21 AM Maxim Mikityanskiy > > wrote: > > > > > > The previous commit introduced parse_protocol callback which should > > > extract the protocol number from the L2 header. Make all Ethernet > > > devices support it. > > > > > > Signed-off-by: Maxim Mikityanskiy > > > --- > > > include/linux/etherdevice.h | 1 + > > > net/ethernet/eth.c | 13 +++++++++++++ > > > 2 files changed, 14 insertions(+) > > > > > > diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h > > > index 2c0af7b00715..e2f3b21cd72a 100644 > > > --- a/include/linux/etherdevice.h > > > +++ b/include/linux/etherdevice.h > > > @@ -44,6 +44,7 @@ int eth_header_cache(const struct neighbour *neigh, > > struct hh_cache *hh, > > > __be16 type); > > > void eth_header_cache_update(struct hh_cache *hh, const struct net_device > > *dev, > > > const unsigned char *haddr); > > > +__be16 eth_header_parse_protocol(const struct sk_buff *skb); > > > > Does not need to be exposed in the header file or exported. > > Are you sure? All the other Ethernet header_ops callbacks are exported > and declared in the header. I'm not sure about the reason why it is done > in such a way, but my guess is that it will be useful if some driver > decides to replace one callback in header_ops but to use the default > ones for the rest of callbacks. I don't exactly follow this. But I think that many are exported because Ethernet is so common that of these are also called directly instead of through header_ops. Looking at other header_ops implementations, or other such callback structs, shows many examples where the members are static local functions. > If the default callbacks were not > accessible externally, it wouldn't be possible. So, I'm following the > existing pattern here, and there are reasons for that. What do you think > about it?