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 B9D1FA0093; Fri, 21 Oct 2022 11:50:05 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AD3D242BE7; Fri, 21 Oct 2022 11:50:05 +0200 (CEST) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2065.outbound.protection.outlook.com [40.107.223.65]) by mails.dpdk.org (Postfix) with ESMTP id D076742BA4 for ; Fri, 21 Oct 2022 11:50:03 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mBXf6WaakoVE41IF8wIfEjHz50oztU7VXecZ4KRRoMZqVMUZcJZhvH+dqcN0Za5dALMslYJ9sB27mGO0m4QtRB2HOdel8YVGFVOQ6twHvBlrz94z9xo3wpmjbf3Bv9NG2kb15Io862tAfgd/V5jKHJtsWXjKR91U/g+P8zoV8W5udAbA3UZrf1RxJvxawD4Z3Dh9usFyd4dSnSCt006Ap+x7ZuBaAGP/AuHwx2zYbYSbW8HR+VwZrQ5RlBG2t+WJ4nvpkeQEuLCEwXKSDV+TVk09nwth9uJVcR4RUSm40FCtHTjOBGh7XShEllPuB9+6OcqXdD6CXmwJuHTd/UO+Kw== 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=iv3+miiFaGBfWdJvTj1SYHEgwxCctw+DfT1i+mjZSOE=; b=fEVGobFPvSrSz48RU4BYHpx1U+tQxoDL93xjAQfjvAEOsCevCyyB7z+VS4Wjdb48ko0LTy7JPqDX0aO7+mQUt28JCbI9efobI9/wsKdiWmxQENVwmJu1qzbLSVgS41zruNFxQxaY8owUAcTuPqrX+Uoa9Hn/KA4Bwd1oNFPk9A5A1ROBt3WgHx+k6tSYj1Gt944Mi9Ba92zPiB+WMTsxFiVJmx3m5B3FUYqVI40r8knfsggO43w9ro0W3sXPFD7mKgL1CBpgYX2JB7WUGZO5MEGqpjOkPo4DFm6UVpJg85klIHR7irxg5fBfi1BV4/nFBfOZEAVzNl1N4ZmjunmHsw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=iv3+miiFaGBfWdJvTj1SYHEgwxCctw+DfT1i+mjZSOE=; b=ia3qUNasDzFO8ENl2b0sD8pmwk7dk9aXpuGqV+D7FgjI+/jPHpb4JEaJ1nFMlBXjFeVq5PyzXF52mgHLSGTxkpJxHe6D+2dNEyB5n09XXQxWJTLUleBngvJiGLe8RG1Mch6Op+Sf8W9csIvE3C/mx7a21Yirg6zy/feICI+RTBc= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from DM6PR12MB4297.namprd12.prod.outlook.com (2603:10b6:5:211::20) by BL1PR12MB5079.namprd12.prod.outlook.com (2603:10b6:208:31a::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.34; Fri, 21 Oct 2022 09:50:02 +0000 Received: from DM6PR12MB4297.namprd12.prod.outlook.com ([fe80::b9fd:e732:4585:6b25]) by DM6PR12MB4297.namprd12.prod.outlook.com ([fe80::b9fd:e732:4585:6b25%7]) with mapi id 15.20.5723.033; Fri, 21 Oct 2022 09:50:02 +0000 Message-ID: Date: Fri, 21 Oct 2022 10:49:57 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.3.3 Subject: Re: [PATCH v7 3/8] net/gve: add support for device initialization Content-Language: en-US To: Junfeng Guo , qi.z.zhang@intel.com, jingjing.wu@intel.com, beilei.xing@intel.com Cc: dev@dpdk.org, xiaoyun.li@intel.com, awogbemila@google.com, bruce.richardson@intel.com, hemant.agrawal@nxp.com, stephen@networkplumber.org, chenbo.xia@intel.com, helin.zhang@intel.com, Haiyue Wang References: <20221020103656.1068036-1-junfeng.guo@intel.com> <20221021091928.2674471-1-junfeng.guo@intel.com> <20221021091928.2674471-4-junfeng.guo@intel.com> From: Ferruh Yigit In-Reply-To: <20221021091928.2674471-4-junfeng.guo@intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO2P265CA0251.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:8a::23) To DM6PR12MB4297.namprd12.prod.outlook.com (2603:10b6:5:211::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR12MB4297:EE_|BL1PR12MB5079:EE_ X-MS-Office365-Filtering-Correlation-Id: 74fdc6fb-478b-40ca-a400-08dab3499fab X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AxK2tBhQqtMtMWhJM5BaG0bSMVq5jGEidCZLneh0+2ZZ/4XG0hpmT27DMNELLCgE4IuZuygphhmFvJzLCef8EMmoI1t2rU6Bm56valTNAFPMGhwa9cadsd/4FxNplL86dNl7pf5sDiy5zfbRNRf3DRpFRxXe3Mygo72W9TZFQWo7uOXY5p0MPnhiCYedAdnsuC/S4lniugLOlqiWfN9yU000t8eOUo+TXnffBbPbo0DW94w9GVXdOWc2OkiTU0b9IRCg4liky2F6VhvxLxHwzPjvX3641MgoGnDyB+Bg+9uMQ83vagVe9tQIUmSVMAQG2cXbwWr5n9vkKcoJsWyw0Y1HAtaPIpngGHMJpKcZr57B4POod9CUIgE4JCvwANc0mBfdlLr3sLnOCkoxwqwDpo6hs56Cn0e8XPvYD/VU+AMDoac67K62Hotx2/Fs4C/NOtMMMncXcnML3qV/0aJol4P5g68CcdCAWMuF5QuIz1SPUXuJZzr6eyNNX7vnRp83MUVsrZDu72Xn9//CntcReOvSJdlsEoXUoVWlVy9XnNLO/y+qhGb5vwIwGh3pXSapJLhhaDhSIusOdefuM3qPm23pa9LZZ2jrD5atqOhlqYZXZpKr5Eil2s1ebc73741csFoWDFwVAw9DrZRPbqjLSqZAqHtrCcnnm1L2Cr1oSv2q3qewCqVfTUcKdU+8vccr0WpsXT76wOwvVKkJsdrxzS88zO9Q6779y36TNMP/yUpIz5GD6Xgv44xibHqGoRQPUgV6hINSYiROyPfyJicVfQU1O03n6EauyX7lFDwMrDw= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR12MB4297.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(136003)(376002)(39860400002)(366004)(346002)(396003)(451199015)(31686004)(86362001)(44832011)(36756003)(26005)(6506007)(4326008)(8676002)(53546011)(2906002)(66476007)(8936002)(66556008)(38100700002)(41300700001)(7416002)(31696002)(5660300002)(66946007)(6512007)(83380400001)(316002)(186003)(478600001)(6666004)(2616005)(6486002)(45980500001)(43740500002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?Q1c1SXkvaDFBVXRuUDAzblVqeXpjTU03WjZ4L1VUTXlpbGMwNG05Y1VLcDVQ?= =?utf-8?B?clFzUWtWZDYyeVhtZVNEc205dVNMZkthYWYvbkZqWWJ3dmRDS0hoc3Z1K2d3?= =?utf-8?B?U3pLKzBXeE9SS2hwMzcxUUNNZEZyeVByQnpBaXVvb2ZlZ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lGNzh0MFd4QzgyQ1MvS0JUejl4?= =?utf-8?B?djY1Vy9yM0ZHSVNXWFBmQ2o1YWRoRmN5QmFaekZTbVVaTlVnVjViUFBmL0RW?= =?utf-8?B?L2RhempsTmxTNFZTR3JTbVlPb2o3bVREcjI4SGVQM0hudloreW1PSUxUOFpO?= =?utf-8?Q?pM0b26qoBiyHvdXIdFXDcaXXF?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 74fdc6fb-478b-40ca-a400-08dab3499fab X-MS-Exchange-CrossTenant-AuthSource: DM6PR12MB4297.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2022 09:50:02.1031 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Y7SGNyyhdsnFuqfPyucObPBfLoStAFrnlSN0X+4m4N8AHD3fN7eL3woZYhlI53bT X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5079 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 10/21/2022 10:19 AM, Junfeng Guo wrote: > > Support device init and add following devops skeleton: > - dev_configure > - dev_start > - dev_stop > - dev_close > > Note that build system (including doc) is also added in this patch. > > Signed-off-by: Haiyue Wang > Signed-off-by: Xiaoyun Li > Signed-off-by: Junfeng Guo <...> > +static int > +gve_dev_init(struct rte_eth_dev *eth_dev) > +{ > + struct gve_priv *priv = eth_dev->data->dev_private; > + int max_tx_queues, max_rx_queues; > + struct rte_pci_device *pci_dev; > + struct gve_registers *reg_bar; > + rte_be32_t *db_bar; > + int err; > + > + eth_dev->dev_ops = &gve_eth_dev_ops; > + > + if (rte_eal_process_type() != RTE_PROC_PRIMARY) > + return 0; > + > + pci_dev = RTE_DEV_TO_PCI(eth_dev->device); > + > + reg_bar = pci_dev->mem_resource[GVE_REG_BAR].addr; > + if (!reg_bar) { > + PMD_DRV_LOG(ERR, "Failed to map pci bar!"); > + return -ENOMEM; > + } > + > + db_bar = pci_dev->mem_resource[GVE_DB_BAR].addr; > + if (!db_bar) { > + PMD_DRV_LOG(ERR, "Failed to map doorbell bar!"); > + return -ENOMEM; > + } > + > + gve_write_version(®_bar->driver_version); > + /* Get max queues to alloc etherdev */ > + max_tx_queues = ioread32be(®_bar->max_tx_queues); > + max_rx_queues = ioread32be(®_bar->max_rx_queues); > + > + priv->reg_bar0 = reg_bar; > + priv->db_bar2 = db_bar; > + priv->pci_dev = pci_dev; > + priv->state_flags = 0x0; > + > + priv->max_nb_txq = max_tx_queues; > + priv->max_nb_rxq = max_rx_queues; > + > + err = gve_init_priv(priv, false); > + if (err) > + return err; > + > + eth_dev->data->mac_addrs = &priv->dev_addr; > + [copy/paste from previous version] What is the value in 'priv->dev_addr'? Even allocating memory for 'eth_dev->data->mac_addrs' removed or not, as we discussed, independent from it, need to set a valid value to 'priv->dev_addr'.