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=-3.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no 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 8F965C4363D for ; Fri, 2 Oct 2020 09:07:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 32C8320672 for ; Fri, 2 Oct 2020 09:07:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726282AbgJBJHW convert rfc822-to-8bit (ORCPT ); Fri, 2 Oct 2020 05:07:22 -0400 Received: from us-smtp-delivery-44.mimecast.com ([207.211.30.44]:41365 "EHLO us-smtp-delivery-44.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725993AbgJBJHW (ORCPT ); Fri, 2 Oct 2020 05:07:22 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-595-_R0Z6NCAP1-zqcVdsmLQ3A-1; Fri, 02 Oct 2020 05:07:15 -0400 X-MC-Unique: _R0Z6NCAP1-zqcVdsmLQ3A-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CA7EC1DDF1; Fri, 2 Oct 2020 09:07:12 +0000 (UTC) Received: from bistromath.localdomain (ovpn-115-83.ams2.redhat.com [10.36.115.83]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D298B5C1D0; Fri, 2 Oct 2020 09:07:08 +0000 (UTC) Date: Fri, 2 Oct 2020 11:07:03 +0200 From: Sabrina Dubroca To: Stephen Hemminger Cc: netdev@vger.kernel.org, Nicolas Dichtel , Marek Lindner , Simon Wunderlich , Antonio Quartulli , Sven Eckelmann , b.a.t.m.a.n@lists.open-mesh.org, Roopa Prabhu , Nikolay Aleksandrov Subject: Re: [PATCH net 00/12] net: iflink and link-netnsid fixes Message-ID: <20201002090703.GD3565727@bistromath.localdomain> References: <20201001142538.03f28397@hermes.local> MIME-Version: 1.0 In-Reply-To: <20201001142538.03f28397@hermes.local> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=sd@queasysnail.net X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: queasysnail.net Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 2020-10-01, 14:25:38 -0700, Stephen Hemminger wrote: > On Thu, 1 Oct 2020 09:59:24 +0200 > Sabrina Dubroca wrote: > > > In a lot of places, we use this kind of comparison to detect if a > > device has a lower link: > > > > dev->ifindex != dev_get_iflink(dev) > > > Since this is a common operation, it would be good to add a new > helper function in netdevice.h > > In your patch set, you are copying the same code snippet which > seems to indicate that it should be a helper. > > Something like: > > static inline bool netdev_has_link(const struct net_device *dev) > { > const struct net_device_ops *ops = dev->netdev_ops; > > return ops && ops->ndo_get_iflink; > } Good idea, I'll add that in v2. -- Sabrina