Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp985926pxb; Fri, 22 Apr 2022 16:01:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyi7g6pDKivnC8Vt7Pkb6tc4mpXg3q7zaaFoKVONMzMQZDmsaihg5yPYAmYlGyT6xcoJ5PF X-Received: by 2002:a17:902:6ac7:b0:150:24d6:b2ee with SMTP id i7-20020a1709026ac700b0015024d6b2eemr6946483plt.168.1650668501655; Fri, 22 Apr 2022 16:01:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650668501; cv=none; d=google.com; s=arc-20160816; b=EPUhgBviz78lxr/+MCDMFh6zDQTcffKKu1c7U3mgz5KcrdluaXS91ZI2QSLAOoWaCT 15cGwpSbquMFhS953NuKgE2J/hBJ7MsVMAieUM28sUI0uCqBD8hI9t45XlHnYrJ2VKyp dsYiNwGZWPGbnyKxGFihxEQWH7eSrJ1eFTcd2mueHNQymEWdFWLn0F5+l3a42GLiR6i+ Ke3Fvh7J5mtHOA7gJmLwiXjou9F6D3/+lcB1vD2pGk46MzLPkykhA2euX3J/+cUh5TM0 ERTn73MsROJxi96/W5sJ/EAy/TRtIreQMChJkD9rwyS/GzBcQgdg5pNRM7hqFwRY2EdI UCwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=IJ9Mu/aUYM3vuD5oQcui/J0/WhPDdyFZPtdQU+Ga/QI=; b=DH7Ow7PT6q3vin2u2Ss0g9n4IQ4B5ExnIlcOOVa6x4aZjuOh2DKzZaLBDsTrGSJKf6 F/6oFY5CS6faw7JIE0sC0noIGzqIH0uddH4k3eXUWBy5N7YvtAz/IqrHHA/qCOf7XUGw 55uQvpgmUGY8ywDoKATJXW1kUEg9AHh12QOEMlzY0At6ql0HfPlxuY0B9E1R4wwQuGxt bF9b5z9WF5iwUrxKWbKToCDNW458L/7eIiPUT0jEiOBBBPKn5yikOczZ8K8cyEbNlhZD cMzBqke5gBVfYNoce7kUgjL7n03iYIt0ibc41qMPZiBehCWbIu0AQ3PKseALOnUK9Jei 4TDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=T1tOkSyy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id cd5-20020a056a00420500b0050ce9b55afdsi3178651pfb.188.2022.04.22.16.01.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 16:01:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=T1tOkSyy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D9C9E2B2180; Fri, 22 Apr 2022 14:23:17 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229956AbiDVV0H (ORCPT + 99 others); Fri, 22 Apr 2022 17:26:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229680AbiDVV0F (ORCPT ); Fri, 22 Apr 2022 17:26:05 -0400 Received: from vps0.lunn.ch (vps0.lunn.ch [185.16.172.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3444825CA09; Fri, 22 Apr 2022 13:22:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=IJ9Mu/aUYM3vuD5oQcui/J0/WhPDdyFZPtdQU+Ga/QI=; b=T1tOkSyynfaYwEC/xaB+p6az3Z XtQ2o1NqRu4SayBGALcPLXyZykVvU5An2x8p6KxswgnsA7y9ZqXOckyg10qAdYaxD1v/tTnx308tr 3W0frA8HsyBxGGYZJ3dC1060Ed0pognN1wfkuOy5+1/JWKY9TF19h+gO4BQyUbykPAwM=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1nhzkl-00H2Uf-Si; Fri, 22 Apr 2022 22:19:43 +0200 Date: Fri, 22 Apr 2022 22:19:43 +0200 From: Andrew Lunn To: Maxime Chevallier Cc: davem@davemloft.net, Rob Herring , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, thomas.petazzoni@bootlin.com, Florian Fainelli , Heiner Kallweit , Russell King , linux-arm-kernel@lists.infradead.org, Vladimir Oltean , Luka Perkov , Robert Marko Subject: Re: [PATCH net-next 1/5] net: ipqess: introduce the Qualcomm IPQESS driver Message-ID: References: <20220422180305.301882-1-maxime.chevallier@bootlin.com> <20220422180305.301882-2-maxime.chevallier@bootlin.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220422180305.301882-2-maxime.chevallier@bootlin.com> X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > +static int ipqess_axi_probe(struct platform_device *pdev) > +{ > + struct device_node *np = pdev->dev.of_node; > + struct net_device *netdev; > + phy_interface_t phy_mode; > + struct resource *res; > + struct ipqess *ess; > + int i, err = 0; > + > + netdev = devm_alloc_etherdev_mqs(&pdev->dev, sizeof(struct ipqess), > + IPQESS_NETDEV_QUEUES, > + IPQESS_NETDEV_QUEUES); > + if (!netdev) > + return -ENOMEM; > + > + ess = netdev_priv(netdev); > + ess->netdev = netdev; > + ess->pdev = pdev; > + spin_lock_init(&ess->stats_lock); > + SET_NETDEV_DEV(netdev, &pdev->dev); > + platform_set_drvdata(pdev, netdev); .... > + > + ipqess_set_ethtool_ops(netdev); > + > + err = register_netdev(netdev); > + if (err) > + goto err_out; Before register_netdev() even returns, your devices can be in use, the open callback called and packets sent. This is particularly true for NFS root. Which means any setup done after this is probably wrong. > + > + err = ipqess_hw_init(ess); > + if (err) > + goto err_out; > + > + for (i = 0; i < IPQESS_NETDEV_QUEUES; i++) { > + int qid; > + > + netif_tx_napi_add(netdev, &ess->tx_ring[i].napi_tx, > + ipqess_tx_napi, 64); > + netif_napi_add(netdev, > + &ess->rx_ring[i].napi_rx, > + ipqess_rx_napi, 64); > + > + qid = ess->tx_ring[i].idx; > + err = devm_request_irq(&ess->netdev->dev, ess->tx_irq[qid], > + ipqess_interrupt_tx, 0, > + ess->tx_irq_names[qid], > + &ess->tx_ring[i]); > + if (err) > + goto err_out; > + > + qid = ess->rx_ring[i].idx; > + err = devm_request_irq(&ess->netdev->dev, ess->rx_irq[qid], > + ipqess_interrupt_rx, 0, > + ess->rx_irq_names[qid], > + &ess->rx_ring[i]); > + if (err) > + goto err_out; > + } All this should probably go before netdev_register(). > +static int ipqess_get_strset_count(struct net_device *netdev, int sset) > +{ > + switch (sset) { > + case ETH_SS_STATS: > + return ARRAY_SIZE(ipqess_stats); > + default: > + netdev_dbg(netdev, "%s: Invalid string set", __func__); Unsupported would be better than invalid. > + return -EOPNOTSUPP; > + } > +} Andrew