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 Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2434EC8303F for ; Thu, 28 Aug 2025 10:40:46 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id D806B60B29; Thu, 28 Aug 2025 10:40:45 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 5KPyYAMKofZf; Thu, 28 Aug 2025 10:40:44 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.166.142; helo=lists1.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org F04E860BBE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1756377644; bh=/sqTPAhGuwTYFXfsuiKw4m1Tn0kTsx3MzexPL5jVVYY=; h=Date:From:To:Cc:References:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=VQGsdgVn5fkys+ts0iUWrhEZQqfoxeeVKc8zGHATF6Ju9L1tY8JXQLnBcKny8vlGC 3kgi6lfIcyyCJ5FH80ap8tU84l2pBlpH38OnqSkwNHwYMchIJPAYeX4wGw+hsqhG+t k4cg23AD+nj9U3BeYD/TdbL7qAGw3TtIOFA+qRiJ0Puf03RupL8WhdiR55iX8y5rto tky6X6Ywa30XetYwLK2EOBSamXjPHnCfdkYv/WZQw7476kyaKbUNbkgOlrNery5CPh sn4DiBeIGSdJ8tgAv+MDtDausnBqvGMDxD/8iG9sz1zC1BRCN9E+19o95pB2kST+hv JmlKYU+l+ptzQ== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp3.osuosl.org (Postfix) with ESMTP id F04E860BBE; Thu, 28 Aug 2025 10:40:43 +0000 (UTC) Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) by lists1.osuosl.org (Postfix) with ESMTP id 9D61517D for ; Thu, 28 Aug 2025 10:40:42 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 81F9A813DC for ; Thu, 28 Aug 2025 10:40:42 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id W_qO9YSPUS0s for ; Thu, 28 Aug 2025 10:40:41 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2600:3c04:e001:324:0:1991:8:25; helo=tor.source.kernel.org; envelope-from=horms@kernel.org; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp1.osuosl.org 9F1F98142A DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 9F1F98142A Received: from tor.source.kernel.org (tor.source.kernel.org [IPv6:2600:3c04:e001:324:0:1991:8:25]) by smtp1.osuosl.org (Postfix) with ESMTPS id 9F1F98142A for ; Thu, 28 Aug 2025 10:40:41 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by tor.source.kernel.org (Postfix) with ESMTP id 5054C601BB; Thu, 28 Aug 2025 10:40:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C80CAC4CEEB; Thu, 28 Aug 2025 10:40:38 +0000 (UTC) Date: Thu, 28 Aug 2025 11:40:36 +0100 From: Simon Horman To: Pavan Kumar Linga Cc: intel-wired-lan@lists.osuosl.org, madhu.chittim@intel.com, netdev@vger.kernel.org, Sridhar Samudrala Message-ID: <20250828104036.GA10519@horms.kernel.org> References: <20250826172845.265142-1-pavan.kumar.linga@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20250826172845.265142-1-pavan.kumar.linga@intel.com> X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1756377640; bh=NwR50ZpM6+Ymc6dkl0+mc9OsZhEF6EybCCscmIk+Dzo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=b/MrN/V9C+XQmfWdIPZiTK9ah1S1Zvix6O9zkq3Qk26i/Wna/kqG9XOV+7+c7Wc9n JOaIkR3bmfJ0nePmMaaodHhqeCe+bzLayOWcV/yN7bzttvT2ekqaA8euLSU9xVRBpg ASE0RGmdG/2Lw7YAcyeunohVxv0bsNNnWqgIodTSFLiCWvgeNYOaT9lijWiI9wGljk JDP+cO/0LiLRW/NOm3mYHeUoRyxWxK7wEC8DINQU5qmiOMB4gXijI7bPNt6wLLx05d SzfiX/U+JRiEeHGtjhwB4asa3qE+5NnfTBuTbC8YkeTvtEc1sXzExl8u6cKszlWGmR 9fwoNM83X5gdw== X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=b/MrN/V9 Subject: Re: [Intel-wired-lan] [PATCH net-next v1] idpf: add support for IDPF PCI programming interface X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" On Tue, Aug 26, 2025 at 10:28:45AM -0700, Pavan Kumar Linga wrote: > At present IDPF supports only 0x1452 and 0x145C as PF and VF device IDs > on our current generation hardware. Future hardware exposes a new set of > device IDs for each generation. To avoid adding a new device ID for each > generation and to make the driver forward and backward compatible, > make use of the IDPF PCI programming interface to load the driver. > > Write and read the VF_ARQBAL mailbox register to find if the current > device is a PF or a VF. > > PCI SIG allocated a new programming interface for the IDPF compliant > ethernet network controller devices. It can be found at: > https://members.pcisig.com/wg/PCI-SIG/document/20113 > with the document titled as 'PCI Code and ID Assignment Revision 1.16' > or any latest revisions. > > Reviewed-by: Madhu Chittim > Reviewed-by: Sridhar Samudrala > Signed-off-by: Pavan Kumar Linga ... > diff --git a/drivers/net/ethernet/intel/idpf/idpf_main.c b/drivers/net/ethernet/intel/idpf/idpf_main.c > index 8c46481d2e1f..b161715e1168 100644 > --- a/drivers/net/ethernet/intel/idpf/idpf_main.c > +++ b/drivers/net/ethernet/intel/idpf/idpf_main.c > @@ -7,11 +7,57 @@ > > #define DRV_SUMMARY "Intel(R) Infrastructure Data Path Function Linux Driver" > > +#define IDPF_NETWORK_ETHERNET_PROGIF 0x01 > +#define IDPF_CLASS_NETWORK_ETHERNET_PROGIF \ > + (PCI_CLASS_NETWORK_ETHERNET << 8 | IDPF_NETWORK_ETHERNET_PROGIF) > + > MODULE_DESCRIPTION(DRV_SUMMARY); > MODULE_IMPORT_NS("LIBETH"); > MODULE_IMPORT_NS("LIBETH_XDP"); > MODULE_LICENSE("GPL"); > > +/** > + * idpf_dev_init - Initialize device specific parameters > + * @adapter: adapter to initialize > + * @ent: entry in idpf_pci_tbl > + * > + * Return: %0 on success, -%errno on failure. > + */ > +static int idpf_dev_init(struct idpf_adapter *adapter, > + const struct pci_device_id *ent) > +{ > + u8 is_vf = 0; > + int err; > + > + switch (ent->device) { > + case IDPF_DEV_ID_PF: > + goto dev_ops_init; > + case IDPF_DEV_ID_VF: > + is_vf = 1; > + goto dev_ops_init; > + default: > + if (ent->class == IDPF_CLASS_NETWORK_ETHERNET_PROGIF) > + goto check_vf; > + > + return -ENODEV; > + } > + > +check_vf: > + err = idpf_is_vf_device(adapter->pdev, &is_vf); > + if (err) > + return err; > + > +dev_ops_init: > + if (is_vf) { > + idpf_vf_dev_ops_init(adapter); > + adapter->crc_enable = true; > + } else { > + idpf_dev_ops_init(adapter); > + } > + > + return 0; > +} Hi Pavan, I think that in Kernel Networking code the usual use cases of goto labels are: for error handling; and, optimisation, f.e. in the datapath. I don't think this code falls into either category. So I suggest implementing it without gotos. Thanks! ... From mboxrd@z Thu Jan 1 00:00:00 1970 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 7C8AB30ACE8 for ; Thu, 28 Aug 2025 10:40:40 +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=1756377640; cv=none; b=FD6avwZb11xPQo78v4otj+54QduHqL+iaLZA1M+jwaHoBy4rliavU2a12Td8cojuDadk94oLi0kjg6BNkiNRWaybhdA3K+jwQtffrf0H1QRCctkZJeqfVmQk2wdO2dkZC+aiLtiUkE1buZU6OCbF0jarbREnTlM2uJTLeJumL98= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756377640; c=relaxed/simple; bh=NwR50ZpM6+Ymc6dkl0+mc9OsZhEF6EybCCscmIk+Dzo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=i9FZKzZyaLIBIC7WxL3lo9qS0Ic3yumJ10LyJan4o4k0kxivseRqIC2a57jFUcr+4BaO4tJQy0j9OxrlUngrN08GmQfGEbNwBlaq8M47/q9iWB0o0gSgSKXc41uSxkeE8uYAGySJNo+F3zxBTL58NVDaucUANyak/DRjIJh4WJE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=b/MrN/V9; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="b/MrN/V9" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C80CAC4CEEB; Thu, 28 Aug 2025 10:40:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1756377640; bh=NwR50ZpM6+Ymc6dkl0+mc9OsZhEF6EybCCscmIk+Dzo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=b/MrN/V9C+XQmfWdIPZiTK9ah1S1Zvix6O9zkq3Qk26i/Wna/kqG9XOV+7+c7Wc9n JOaIkR3bmfJ0nePmMaaodHhqeCe+bzLayOWcV/yN7bzttvT2ekqaA8euLSU9xVRBpg ASE0RGmdG/2Lw7YAcyeunohVxv0bsNNnWqgIodTSFLiCWvgeNYOaT9lijWiI9wGljk JDP+cO/0LiLRW/NOm3mYHeUoRyxWxK7wEC8DINQU5qmiOMB4gXijI7bPNt6wLLx05d SzfiX/U+JRiEeHGtjhwB4asa3qE+5NnfTBuTbC8YkeTvtEc1sXzExl8u6cKszlWGmR 9fwoNM83X5gdw== Date: Thu, 28 Aug 2025 11:40:36 +0100 From: Simon Horman To: Pavan Kumar Linga Cc: intel-wired-lan@lists.osuosl.org, madhu.chittim@intel.com, netdev@vger.kernel.org, Sridhar Samudrala Subject: Re: [PATCH net-next v1] idpf: add support for IDPF PCI programming interface Message-ID: <20250828104036.GA10519@horms.kernel.org> References: <20250826172845.265142-1-pavan.kumar.linga@intel.com> Precedence: bulk X-Mailing-List: netdev@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: <20250826172845.265142-1-pavan.kumar.linga@intel.com> On Tue, Aug 26, 2025 at 10:28:45AM -0700, Pavan Kumar Linga wrote: > At present IDPF supports only 0x1452 and 0x145C as PF and VF device IDs > on our current generation hardware. Future hardware exposes a new set of > device IDs for each generation. To avoid adding a new device ID for each > generation and to make the driver forward and backward compatible, > make use of the IDPF PCI programming interface to load the driver. > > Write and read the VF_ARQBAL mailbox register to find if the current > device is a PF or a VF. > > PCI SIG allocated a new programming interface for the IDPF compliant > ethernet network controller devices. It can be found at: > https://members.pcisig.com/wg/PCI-SIG/document/20113 > with the document titled as 'PCI Code and ID Assignment Revision 1.16' > or any latest revisions. > > Reviewed-by: Madhu Chittim > Reviewed-by: Sridhar Samudrala > Signed-off-by: Pavan Kumar Linga ... > diff --git a/drivers/net/ethernet/intel/idpf/idpf_main.c b/drivers/net/ethernet/intel/idpf/idpf_main.c > index 8c46481d2e1f..b161715e1168 100644 > --- a/drivers/net/ethernet/intel/idpf/idpf_main.c > +++ b/drivers/net/ethernet/intel/idpf/idpf_main.c > @@ -7,11 +7,57 @@ > > #define DRV_SUMMARY "Intel(R) Infrastructure Data Path Function Linux Driver" > > +#define IDPF_NETWORK_ETHERNET_PROGIF 0x01 > +#define IDPF_CLASS_NETWORK_ETHERNET_PROGIF \ > + (PCI_CLASS_NETWORK_ETHERNET << 8 | IDPF_NETWORK_ETHERNET_PROGIF) > + > MODULE_DESCRIPTION(DRV_SUMMARY); > MODULE_IMPORT_NS("LIBETH"); > MODULE_IMPORT_NS("LIBETH_XDP"); > MODULE_LICENSE("GPL"); > > +/** > + * idpf_dev_init - Initialize device specific parameters > + * @adapter: adapter to initialize > + * @ent: entry in idpf_pci_tbl > + * > + * Return: %0 on success, -%errno on failure. > + */ > +static int idpf_dev_init(struct idpf_adapter *adapter, > + const struct pci_device_id *ent) > +{ > + u8 is_vf = 0; > + int err; > + > + switch (ent->device) { > + case IDPF_DEV_ID_PF: > + goto dev_ops_init; > + case IDPF_DEV_ID_VF: > + is_vf = 1; > + goto dev_ops_init; > + default: > + if (ent->class == IDPF_CLASS_NETWORK_ETHERNET_PROGIF) > + goto check_vf; > + > + return -ENODEV; > + } > + > +check_vf: > + err = idpf_is_vf_device(adapter->pdev, &is_vf); > + if (err) > + return err; > + > +dev_ops_init: > + if (is_vf) { > + idpf_vf_dev_ops_init(adapter); > + adapter->crc_enable = true; > + } else { > + idpf_dev_ops_init(adapter); > + } > + > + return 0; > +} Hi Pavan, I think that in Kernel Networking code the usual use cases of goto labels are: for error handling; and, optimisation, f.e. in the datapath. I don't think this code falls into either category. So I suggest implementing it without gotos. Thanks! ...