Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp4014170ybz; Mon, 4 May 2020 14:05:38 -0700 (PDT) X-Google-Smtp-Source: APiQypIaGhw8ScGhhPMjidiHbv7vJumc9XCcZjHcG+tRZbIuhALuEKCzd2521XoqUTK/4jK3fCqp X-Received: by 2002:aa7:d408:: with SMTP id z8mr3220811edq.83.1588626338490; Mon, 04 May 2020 14:05:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588626338; cv=none; d=google.com; s=arc-20160816; b=cNnSpQC+j+h1OZqe9tQeJ76QZINojQ2GKSFUpEFroEInth08d3N+r6KHS3SgPeAdZ+ 95mky8Gj7p08Jn0fcVM28kF28gBwSG771lep/Jd3vxOf5c7K1MndTPLbWNEJcTq1O8+W Z8EXUU6VKmjvx5l+Ff0Ea+RwYlE8MABmEXB6rS3URLbj93tpDIk+72ilXQgA5h/uURUs ZBRghFTXi8UMTT7yx0AhlU0ydvAWLMbafqrKWSU/0Nb/FeUeI5V5eGXPOp5AOcZflar2 M4dJi3cETRcqOgij7ZSl6uoZIA8Dtwd8MToRIeL2JJLxVzsyI0m3BOGNDPg4vhmljb0d /msA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=n0gWd/LKEKfbFqunt27R8+2BYVGb8cKLklv+je6aFbk=; b=gSZYLeSI9lGbJeLx/mImySzn5H53dCPhI6+JGDlCbAIVXrNIwUgHphgl7fLicrbtwM YMqOMqbJEUBalY8sjXoXj9GtmU3W7ltpFjtJLZT2cn3s4k7PtdgYcS/6QUypwyCOJivt 1BbJDge1J6GzooEpgPd8CLaSP9KA9iPdVe5JZpgocBrtCakzr9pYmYsQYo3TjJ/m3Y0J YfP1JvfH/LzoxgMGPP4/RZutwJwCPAiLQcAleU7+HaHQzlomZHGagpdbPHNNozHoZr1C J6aYlVG6Ew5t54nqehbCzbhe6F1BjjIbMdCQk29e1Pb7mDJfHrLAP9xNFz0wPAYzjaLV FkvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=LmR4y6bU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a11si110493edx.62.2020.05.04.14.05.01; Mon, 04 May 2020 14:05:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=LmR4y6bU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728039AbgEDVDT (ORCPT + 99 others); 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-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