Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp572733lqm; Wed, 1 May 2024 09:08:40 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUWGOHSdbOs8gXxLz209h1P9hGNfi4e1OOyySQoVT3f9+mxP4nDYaaBNd7Q1ORodQiBryvrAVExBxRTsOfRKFtnmILgDtkYfrH00Dy8qQ== X-Google-Smtp-Source: AGHT+IE8TTs0XUJvFI7Is628etOE94AoGh2PYdFlhBNToTO3AB1VdfaLMYIODlTyZd6MDe4XvvZG X-Received: by 2002:ad4:5ca7:0:b0:6a0:c8ac:de5 with SMTP id q7-20020ad45ca7000000b006a0c8ac0de5mr3217900qvh.32.1714579719984; Wed, 01 May 2024 09:08:39 -0700 (PDT) Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id q8-20020a05621419e800b006a0c9dab09csi8383344qvc.184.2024.05.01.09.08.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 May 2024 09:08:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-165542-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@kernel.org header.s=k20201202 header.b=pOTfPEIL; arc=fail (body hash mismatch); spf=pass (google.com: domain of linux-kernel+bounces-165542-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-165542-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id B13E61C21014 for ; Wed, 1 May 2024 16:08:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8EEF313049E; Wed, 1 May 2024 16:08:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="pOTfPEIL" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B2E534CE1F; Wed, 1 May 2024 16:08:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714579692; cv=none; b=C8hRYiy7WNuf0YDuev8KM/eWbKTiKCc2JhTFFJs6pfXXaZKQ5DLSMpZsMVPRHPA9gfmHH60Dj+2Z1ZBk5MEA/MH1gbJUuzY6t2GZmdSgsP7+todtUaSkBRPkMfI3unjHA/Rqyl+4qzd3aH57ZL7Mk+BBVXdYlCMj2jTV8XTZ3hs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714579692; c=relaxed/simple; bh=Iey2iVH1MIhrk7WU5n9kwLcgqdG/28gxVMTeDEIBfOU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=uRPnVZN4pQhUnOJXZGBVJmYkjKuSVafJDZQkf/4KghXaUrgtuoaSZWoV61g0zxDd12lA8ZZOUp0lHrBmMujObZKGpIT9nMSJbIZ0L27AAXVjJIYZXSPDGOEG5b7CrkxZbxP/g2W+mXVeUA5iZhYyImkSn9XjX+yv20be/Y1h92Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=pOTfPEIL; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 09CCCC113CC; Wed, 1 May 2024 16:08:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714579692; bh=Iey2iVH1MIhrk7WU5n9kwLcgqdG/28gxVMTeDEIBfOU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=pOTfPEILul9GgwLwVzI08ADSnYF3WZ7Yn7KJxwHjapMUQm7fmgWUnyZkmX58hOCut Qk88ysylEyLMUFMdH7RASGzWCNTCBxEK/Pe5C0xhPwgZdn3a98FdKbCE/UNXUHae54 99pO5crWIscgPmcFff1NW7kIcZiJ5FGbtlKXSvcoSqqXl+RdsHaF0jGtl5rCF4R5Gm 25hdTp+iBC+lPsIo5O57Kh/JZBhTuuxBA/O3930KRca3l+DdxObHvfxVq5tQ8X0jCX jUTNFZvkq3UEhIpfvm0WYiFqonjxvaN4DF4maSCGPVGplL722OK5c+FoyucpQ1Epv8 T1u8Ud8afbvqQ== Date: Wed, 1 May 2024 17:06:37 +0100 From: Simon Horman To: Geetha sowjanya Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kuba@kernel.org, davem@davemloft.net, pabeni@redhat.com, edumazet@google.com, sgoutham@marvell.com, sbhatta@marvell.com, hkelam@marvell.com Subject: Re: [net-next PATCH v3 2/9] octeontx2-pf: RVU representor driver Message-ID: <20240501160637.GW2575892@kernel.org> References: <20240428105312.9731-1-gakula@marvell.com> <20240428105312.9731-3-gakula@marvell.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240428105312.9731-3-gakula@marvell.com> On Sun, Apr 28, 2024 at 04:23:05PM +0530, Geetha sowjanya wrote: > This patch adds basic driver for the RVU representor. > Driver on probe does pci specific initialization and does hw > resources configuration. > Introduces RVU_ESWITCH kernel config to enable/disable > this driver. Representor and NIC shares the code but representors > netdev support subset of NIC functionality. Hence "otx2_rep_dev" > api helps to skip the features initialization that are not supported > by the representors. > > Signed-off-by: Geetha sowjanya .. > +static int rvu_rep_probe(struct pci_dev *pdev, const struct pci_device_id *id) > +{ > + struct device *dev = &pdev->dev; > + struct otx2_nic *priv; > + struct otx2_hw *hw; > + int err; > + > + err = pcim_enable_device(pdev); > + if (err) { > + dev_err(dev, "Failed to enable PCI device\n"); > + return err; > + } > + > + err = pci_request_regions(pdev, DRV_NAME); > + if (err) { > + dev_err(dev, "PCI request regions failed 0x%x\n", err); > + return err; > + } > + > + err = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(48)); > + if (err) { > + dev_err(dev, "DMA mask config failed, abort\n"); > + goto err_release_regions; > + } > + > + pci_set_master(pdev); > + > + priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); > + if (!priv) > + goto err_release_regions; Hi Geetha, This goto will result in the function returning err. But err is 0 here. Perhaps it should be set to -ENOMEM? Flagged by Smatch. > + > + pci_set_drvdata(pdev, priv); > + priv->pdev = pdev; > + priv->dev = dev; > + priv->flags |= OTX2_FLAG_INTF_DOWN; > + priv->flags |= OTX2_FLAG_REP_MODE_ENABLED; > + > + hw = &priv->hw; > + hw->pdev = pdev; > + hw->max_queues = OTX2_MAX_CQ_CNT; > + hw->rbuf_len = OTX2_DEFAULT_RBUF_LEN; > + hw->xqe_size = 128; > + > + err = otx2_init_rsrc(pdev, priv); > + if (err) > + goto err_release_regions; > + > + err = rvu_get_rep_cnt(priv); > + if (err) > + goto err_detach_rsrc; > + > + err = rvu_rep_rsrc_init(priv); > + if (err) > + goto err_detach_rsrc; > + > + return 0; > + > +err_detach_rsrc: > + if (priv->hw.lmt_info) > + free_percpu(priv->hw.lmt_info); > + if (test_bit(CN10K_LMTST, &priv->hw.cap_flag)) > + qmem_free(priv->dev, priv->dync_lmt); > + otx2_detach_resources(&priv->mbox); > + otx2_disable_mbox_intr(priv); > + otx2_pfaf_mbox_destroy(priv); > + pci_free_irq_vectors(pdev); > +err_release_regions: > + pci_set_drvdata(pdev, NULL); > + pci_release_regions(pdev); > + return err; > +} ..