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=-5.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 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 9450BC3A5A9 for ; Mon, 4 May 2020 21:03:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6FA3020707 for ; Mon, 4 May 2020 21:03:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="LmR4y6bU" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728059AbgEDVDT (ORCPT ); Mon, 4 May 2020 17:03:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726334AbgEDVDS (ORCPT ); Mon, 4 May 2020 17:03:18 -0400 Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0B51C061A0E; Mon, 4 May 2020 14:03:17 -0700 (PDT) Received: by mail-wr1-x441.google.com with SMTP id g13so152330wrb.8; Mon, 04 May 2020 14:03:17 -0700 (PDT) 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-language:content-transfer-encoding; bh=n0gWd/LKEKfbFqunt27R8+2BYVGb8cKLklv+je6aFbk=; b=LmR4y6bUzadG9TaDR2YViM86obTCNs5PL7ve0409Y2bFpIIpoy0SpP8Xbi84p1Hahm yPK/AA/H9XMFLgd/6lIpf0fCyuY6+bnvRIF0IR9keaEbYibbhINA226PjfFTCWtXQ+ss TiB0XRBVM/xs2Ifs+8TqYcqI+vVjpBkpTpngfbg+CkJTpNjtYDf+SxhXzVOHcqIllh4g oGZqUG247TO6j4PFV5OMt4imAoXNhzs7oaCdk2qA7Jn6h/OJkiqvyc74NdtJGs9Dtjc4 UlIkbPvknNXGwXTruZvhbqphUFfxL0Cs2hxF4kq/OuWqdjWB3zeY+QDQi+sXNsQeDEBX XWgw== 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=n0gWd/LKEKfbFqunt27R8+2BYVGb8cKLklv+je6aFbk=; b=kRqUDrOIwC+fImVC4u/bsSBY/AyRETk+z1jxi6zoWdWZ0aFd25VsSYQdAJqBW3v8Jw /GaTaCzHtUHW+CGEI+4prkFzV1PMdwmqosEcPQU0rT0GOfkHk+LizjIVJUwsnYCAm3Q5 EAIf4cmy6Xl+cWyYOxk1civ+zCp3wvyHz81CjnriEEMsxXLkS7413wEMfmzbKexo8wNz opsV++m1Cmi9spTGgCCeU8yVpxI4dLA10h4MhinFCFseXkxHvxt3pvOJwG4HIxEWMErK FMKwMKZMa07/maRyiUBJPxRtZx04aM+T41Gm/2gfYczUFAAWCoALAP6lAbg9/d9jojFT UJ8w== X-Gm-Message-State: AGi0PuaTa5PoLejnohZBcoaxPGzp1eRbf1+CsrU6eBy8UjBtd8xKrFso RcMjukeDici7gfoyAEITzafwlbHo X-Google-Smtp-Source: APiQypJzkKLT2kMEemfvan89ukp/i0ZeR5T1FDjZwlEnyqDg6E3kHj4mcha3VCheoZAMEd3nYVmSQg== X-Received: by 2002:a5d:650b:: with SMTP id x11mr982279wru.405.1588626196291; Mon, 04 May 2020 14:03:16 -0700 (PDT) Received: from [10.230.188.43] ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id y63sm259719wmg.21.2020.05.04.14.03.14 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 04 May 2020 14:03:15 -0700 (PDT) Subject: Re: [PATCH net] net: dsa: Do not leave DSA master with NULL netdev_ops To: Vladimir Oltean Cc: netdev , allen.pais@oracle.com, Andrew Lunn , Vivien Didelot , "David S. Miller" , Jakub Kicinski , open list References: <20200504201806.27192-1-f.fainelli@gmail.com> From: Florian Fainelli Message-ID: <9ed48660-8b43-6661-1794-aa6eedbed3cc@gmail.com> Date: Mon, 4 May 2020 14:03:12 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Firefox/68.0 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/4/2020 1:49 PM, Vladimir Oltean wrote: > On Mon, 4 May 2020 at 23:40, Florian Fainelli wrote: >> >> >> >> On 5/4/2020 1:34 PM, Vladimir Oltean wrote: >>> Hi Florian, >>> >>> On Mon, 4 May 2020 at 23:19, Florian Fainelli wrote: >>>> >>>> When ndo_get_phys_port_name() for the CPU port was added we introduced >>>> an early check for when the DSA master network device in >>>> dsa_master_ndo_setup() already implements ndo_get_phys_port_name(). When >>>> we perform the teardown operation in dsa_master_ndo_teardown() we would >>>> not be checking that cpu_dp->orig_ndo_ops was successfully allocated and >>>> non-NULL initialized. >>>> >>>> With network device drivers such as virtio_net, this leads to a NPD as >>>> soon as the DSA switch hanging off of it gets torn down because we are >>>> now assigning the virtio_net device's netdev_ops a NULL pointer. >>>> >>>> Fixes: da7b9e9b00d4 ("net: dsa: Add ndo_get_phys_port_name() for CPU port") >>>> Reported-by: Allen Pais >>>> Signed-off-by: Florian Fainelli >>>> --- >>> >>> The fix makes complete sense. >>> But on another note, if we don't overlay an ndo_get_phys_port_name if >>> the master already has one, doesn't that render the entire mechanism >>> of having a reliable way for user space to determine the CPU port >>> number pointless? >> >> For the CPU port I would consider ndo_get_phys_port_name() to be more >> best effort than an absolute need unlike the user facing ports, where >> this is necessary for a variety of actions (e.g.: determining >> queues/port numbers etc.) which is why there was no overlay being done >> in that case. There is not a good way to cascade the information other >> than do something like pX.Y and defining what the X and Y are, what do >> you think? >> -- >> Florian > > For the CPU/master port I am not actually sure who is the final > consumer of the ndo_get_phys_port_name, I thought it is simply > informational, with the observation that it may be unreliable in > transmitting that information over. > Speaking of which, if "informational" is the only purpose, could this > not be used? Yes, I had not considered devlink would expose that information, ndo_phys_port_name() is there now though and since it is exposed through sysfs so reverting would be an ABI breakage. > > devlink port | grep "flavour cpu" > pci/0000:00:00.5/4: type notset flavour cpu port 4 > spi/spi2.0/4: type notset flavour cpu port 4 > spi/spi2.1/4: type notset flavour cpu port 4 > > Thanks, > -Vladimir > -- Florian