From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3E52CA0542; Tue, 6 Sep 2022 11:47:27 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2293440143; Tue, 6 Sep 2022 11:47:27 +0200 (CEST) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2075.outbound.protection.outlook.com [40.107.223.75]) by mails.dpdk.org (Postfix) with ESMTP id E8589400D6 for ; Tue, 6 Sep 2022 11:47:25 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OpvJl+eIJ7ih0ndtElFOFoTLd9r13V4qnX+91egutFwykCN4JpZCxWLwVL5BiXajcXcGEOIFxY0bB+4eD+qvgGt511RcYXcljeEKE+q9GZUCTWJZEzY6hVU6e5AVAzisVPMz/WE3PwzR26x4V5UYvc4FPYSu/LyC0rzPR/cGqEv7/arI7HnTc+LlmsvMtoiHVC2/RaMoOfAgz1m3YBjNzrpsoXiuMRcNcqgD/hZKaCxzTkk8BpGZZsxeM8hxRIYHYlj+pQOl6BiFVGcpafJ2onMiBqOindKV3tKOJK+du8IP0FHh6rzHcFmcxduBSyooAjtjkVDPEqOFgSBqEVXV1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=gCGk4ZUzlUa8aq7/PAWBzfM+h9hy+X89E3Ul2elCJzI=; b=DZxsgaiMWhZWkX9KgDVyTmObTVjJPzHMi/6vSj2gY5dfKPHnY738dJ/WyodnSbN73fmd05yZVmJJBI5U+FqhdeH+hu2LeTx4EZnZS30kDbFOGyQ3m5mtK7EmC6SVZdHn2/6LrAK414oi464eM6IDKgWOsPPotBwQKbUIe25cBVpAODfCwk0JojqiTFzZf+nYSV//kmTWOReeccPnZDu/0Y/0FUbkN3s8qSFhB5UZx0IvolvNeokJtuIFBEq5HmZJMyhS9kufogx/+yYzrEA1pkeinrZkElA9RZAwvxE5hBwblwHuGTx10QYdW7NEVLcaHf3rIGmx4IgTtqOPtyw4Qw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.80.198) smtp.rcpttodomain=corigine.com smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gCGk4ZUzlUa8aq7/PAWBzfM+h9hy+X89E3Ul2elCJzI=; b=Id4C9GKhy6QTjZHpgfWsPGfnbQcGcCJw27KFHP5zC+vLKJsHyRnyehxchN54FXAh1xEB/OWB/+pDFEcY+7ovZnU8VQz2QC3SrqQ38/Oo7kAfFK8u+9ORXsty0ZlQ4TAKbIz4n5hskBuBrRp/7etNU2IFHP97b87lmDS0IJfAWvw= Received: from SN6PR16CA0041.namprd16.prod.outlook.com (2603:10b6:805:ca::18) by BY5PR02MB7076.namprd02.prod.outlook.com (2603:10b6:a03:236::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.10; Tue, 6 Sep 2022 09:47:24 +0000 Received: from SN1NAM02FT0032.eop-nam02.prod.protection.outlook.com (2603:10b6:805:ca:cafe::c8) by SN6PR16CA0041.outlook.office365.com (2603:10b6:805:ca::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5612.12 via Frontend Transport; Tue, 6 Sep 2022 09:47:23 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.80.198) smtp.mailfrom=xilinx.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.80.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.80.198; helo=xir-pvapexch01.xlnx.xilinx.com; pr=C Received: from xir-pvapexch01.xlnx.xilinx.com (149.199.80.198) by SN1NAM02FT0032.mail.protection.outlook.com (10.97.5.58) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5588.10 via Frontend Transport; Tue, 6 Sep 2022 09:47:23 +0000 Received: from xir-pvapexch01.xlnx.xilinx.com (172.21.17.15) by xir-pvapexch01.xlnx.xilinx.com (172.21.17.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Tue, 6 Sep 2022 10:47:22 +0100 Received: from smtp.xilinx.com (172.21.105.197) by xir-pvapexch01.xlnx.xilinx.com (172.21.17.15) with Microsoft SMTP Server id 15.1.2375.24 via Frontend Transport; Tue, 6 Sep 2022 10:47:22 +0100 Envelope-to: chaoyong.he@corigine.com, dev@dpdk.org, oss-drivers@corigine.com, niklas.soderlund@corigine.com Received: from [10.71.194.74] (port=49090) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1oVVAw-0001Ca-2J; Tue, 06 Sep 2022 10:47:22 +0100 Message-ID: Date: Tue, 6 Sep 2022 10:47:21 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.2.1 Subject: Re: [PATCH v7 03/12] net/nfp: move app specific init logic to own function Content-Language: en-US To: Chaoyong He , "dev@dpdk.org" CC: oss-drivers , Niklas Soderlund References: <1660299750-10668-1-git-send-email-chaoyong.he@corigine.com> <1660299750-10668-4-git-send-email-chaoyong.he@corigine.com> <15d65d03-1c53-3e30-42ff-904ebdef0961@xilinx.com> From: Ferruh Yigit In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e3a724f3-6e9d-4ed2-5b73-08da8fecccc4 X-MS-TrafficTypeDiagnostic: BY5PR02MB7076:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: iDkPw1ZfheqlGhzCDcC+6EOpk+ogPlw9esxI7MTqR3HtXd6ExRweGo/luv5YWQVxcQdVtgUyNyKAZBcaPWXzagsSu09RrDPRHLFlFuvPbISCdxGEbW5pEJ3HcjoP6x4Z34yLxw5QSwLWdRj4w6bH8lsKhXSpmYgUMkEnvJipH6Rbl3KNw6kxVRksb04cLkyu5R/M/6MK63vOwSFhovqdr1WWmstv5BN2klm25cMpN4kYhniSdSaD3XmuDqb2JOJHGEBgBmfhu5CeL0oJpbLx1MU6U+t4c2CNBqAIefn83irsng2SM18SrVyvLzwz+G79n6orVlgWoGKYUEbrdvaM2LGzpoKuqF+iXQbsw7akMFXem6i3RhRw93hU8yqu2/WwpvE9ewOa1QYLlmqqpRtmN/h4+r9XN1zfDzQWTVbrkgoVNfPsS1+XfARUrOm2bRkfUz0b6cGTj+ukV+aMe8/cbi/lFgbjfyCjnrRfmtlO2v+rU9BL9zXMJVX8h1pXRzzJ+AhhupK4nfzX/MITrCKCUdRULzWq8/K0ZzCcJ8cvUHCM0piKOUVADId16W0ryYpdtXmXyl5DekpT7lv32dh6zOPRbwypug9tlmRU0DfnGurgl6GkYNq6x0RyqvW/xLwnYVPYdHgsiS70t1FDTL/pyBh0JqGueV0cs6C6y/XsepinAw/9vH0lBVM8mLrpek49lWKeqKRphX3HREL+GHmY0YBTusrWfB6nWSmd/6gxv3k7XUDP/qQ1EuTUDgo2ucjKxMZr//bcmGAl+OpvS95TZJWoGcf0xl+PQyt49vS24SRxaQ0nn5K3McMxbgoq69FzCqQeDp8g1DqrI3VeeFVjQA== X-Forefront-Antispam-Report: CIP:149.199.80.198; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:xir-pvapexch01.xlnx.xilinx.com; PTR:unknown-80-198.xilinx.com; CAT:NONE; SFS:(13230016)(4636009)(39860400002)(376002)(136003)(396003)(346002)(36840700001)(46966006)(40470700004)(83380400001)(8676002)(70206006)(4326008)(82310400005)(41300700001)(110136005)(54906003)(316002)(31696002)(31686004)(36756003)(70586007)(426003)(47076005)(336012)(2616005)(186003)(26005)(66574015)(44832011)(5660300002)(356005)(36860700001)(40480700001)(7636003)(2906002)(9786002)(53546011)(82740400003)(478600001)(40460700003)(8936002)(50156003)(43740500002); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Sep 2022 09:47:23.4008 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e3a724f3-6e9d-4ed2-5b73-08da8fecccc4 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.80.198]; Helo=[xir-pvapexch01.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: SN1NAM02FT0032.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR02MB7076 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On 9/6/2022 9:29 AM, Chaoyong He wrote: > CAUTION: This message has originated from an External Source. Please use proper judgment and caution when opening attachments, clicking links, or responding to this email. > > >> -----Original Message----- >> From: Ferruh Yigit >> Sent: Monday, September 5, 2022 11:39 PM >> To: Chaoyong He ; dev@dpdk.org >> Cc: oss-drivers ; Niklas Soderlund >> >> Subject: Re: [PATCH v7 03/12] net/nfp: move app specific init logic to own >> function >> >> On 8/12/2022 11:22 AM, Chaoyong He wrote: >>> The NFP card can load different firmware applications. >>> This commit move the init logic of corenic app of the secondary >>> process into its own function. >>> >>> Signed-off-by: Chaoyong He >>> Reviewed-by: Niklas Söderlund >> >> <...> >> >>> + switch (app_id) { >>> + case NFP_APP_CORE_NIC: >>> + PMD_INIT_LOG(INFO, "Initializing coreNIC"); >>> + ret = nfp_secondary_init_app_nic(pci_dev, sym_tbl, cpp); >>> + if (ret != 0) { >>> + PMD_INIT_LOG(ERR, "Could not initialize coreNIC!"); >>> + goto sym_tbl_cleanup; >>> } >> >> If you are planning to add more FW app support, what do you think to add >> another abstraction for it? Something like >> >> struct fw_ops { >> *init() >> *secondary_init() >> ... >> } >> >> ... >> ret = fw_ops[app_id].secondary_init(...); >> ... >> > > It does make sense if we can translate this switch statement into an array of function pointers. > But there are some problems: > 1. The `app_id` is returned by the firmware, so we can't simply regard it as an index of the array. > There should import some relation map logic. And we can't find a suitable upper limit for the > array, so maybe we will always update it as we add more and more firmware apps in the future. > We also have to check the value of `fw_ops[app_id].secondary_init` before we invoke it. > 2. Different firmware app may need different variables to initialize, which make it difficult to find a > suitable function prototype when we declare the function pointer. > > So the final logics seems will more complicated and maybe we can keep use the logics now? Got it, above mentioned issues looks valid, so it is OK to keep as it is.