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 5E580A034C; Mon, 24 Oct 2022 12:47:26 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0E3564069C; Mon, 24 Oct 2022 12:47:26 +0200 (CEST) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2069.outbound.protection.outlook.com [40.107.223.69]) by mails.dpdk.org (Postfix) with ESMTP id B2B7940693 for ; Mon, 24 Oct 2022 12:47:24 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CsJquINeUAX6yw4jFXpthXOzUtIzN37fM68jtbiAEKxok0SyCQfdLPFKhNGZMnpwZ7lsj7F1Xmz+uRsCGg9z1L0ezudo5Ua358QB9gfjHcgZrbkScJXhpPzKoTLTAgjWshtvSRI6pJMJkoQWA+oZKH/s6EWwo+qnCkklW2CdcMd84VIO/035hL9odKbBO5jRYscuu5LeFN7FMYiQK8eLAuUxIKMv54tlDPJhUxj4wcsuTvZFVKQcNrjjqGE213zN6SjcCIlx2I2qEvukveQwMtkOoDffszQUoO9Co0HPDiG8j5HG6//6IPF8eeM3qW3Ld2szmAZpWvKT/+57t+SWPA== 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=mZdQ+0+BNszoCxUv4wYmY/tWOCF7UAl2nrUnc4jKwaA=; b=cSQCGZWr9izbxNc4rOEVWosi2yldwofhZEaHgq6ybDGDcayrzeNciEKqti6UECOFLPs2TRQzFUUGlThEo6FCKTiMkLbPWuspPGZdrxRW0lRamMT4bmy7ACHtqbLF2IRko05VBmmE3XcpROjUt1p1Llbvof4K0AI96QHEDJ5R0Vp6LBLKwoUXY85dZOYNV6xwTTdt/GGgfOBsYoy1em5ub4Jcb8/zg/+zWkbT6OtdhMI6rYLCZsqjMU7MyXrGHXIEuWuEG+txyvvaI7p4lMGOP8d0GJkn5u7B0SFMrt+TBY4XT6N3NsjrD9SJV2A8MH0sstR/VZZNYgCwm8jp/sUeRw== 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=mZdQ+0+BNszoCxUv4wYmY/tWOCF7UAl2nrUnc4jKwaA=; b=CNrql+Yljf9lLQ5CosXocSYneAUax1jioq+ORtwXruWI0UBzk/B81yMMcuOyxSzwc8WmxmKiIXR1fF5RqCssjrKKYteKZO0OygXKLavvQoMfzDf8RzlmnznTmWqUR4Z0/B3KohhKlO6BnB6BzG6JZy+aqx/oYpl6vrMCC8UV86A= 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 SN7PR12MB6959.namprd12.prod.outlook.com (2603:10b6:806:261::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.33; Mon, 24 Oct 2022 10:47:22 +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; Mon, 24 Oct 2022 10:47:22 +0000 Message-ID: Date: Mon, 24 Oct 2022 11:47:16 +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: "Guo, Junfeng" , "Zhang, Qi Z" , "Wu, Jingjing" , "Xing, Beilei" Cc: "dev@dpdk.org" , "Li, Xiaoyun" , "awogbemila@google.com" , "Richardson, Bruce" , "hemant.agrawal@nxp.com" , "stephen@networkplumber.org" , "Xia, Chenbo" , "Zhang, Helin" , "Wang, Haiyue" 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: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO4P123CA0637.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:296::14) To DM6PR12MB4297.namprd12.prod.outlook.com (2603:10b6:5:211::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR12MB4297:EE_|SN7PR12MB6959:EE_ X-MS-Office365-Filtering-Correlation-Id: 0bbf32fd-0885-454e-2bcb-08dab5ad2173 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bNoUMkSN2jBJg4e67f8HBRz98AgNAsxgpKRR3SzVeYBppcuhh6nwCDv7VugBp9FMRWwuK22EVT3vMU+plMDN0GzJF2b1LUngHbFQ25My+RjpIzvOu60ntqoYacVjHqeo+43OvKBW9krK3H8mFMzoRgSn9cN0RQwUEMZzKaikLXTQWAJmtRHAb8Vs49/iO5mWqO8rwMBO8bNVtbyV45lzNUVOi8KNqHWNSpwsX0K4YOwvbTjKlJ72a+asdPtPciGe3vjWYoRVAZeAdkrsz751k5sQjQ9hmnzp3//aauT6h9otLH0MlobdIXe3fxJRnFdDesBufUIQrHS0/D+pEVXAjLiK8DQ975u/veV0tGg+620k3NKSEgLiP1+ZzMgtJmVeLT+hEbs5B64lIiIet7VzKbGvy1EGekJGWVhyhUt6gYxkNVzSegLP52uDrVCP40qWHre1v5LbADTvkgrzYko/wiXVC3j+5iT9XSxtoj7E/4ANrA8wUdH2VC+4oa65k0M9F3vNMbbw9TtPwQA44W8Y0HuDsH8DqTk+yjmONkKLaaiLAemj6WHhaLWQGwZXVaY8NfaE531V/pc4tHxS01xFyGfcohNjy83DpBWQFRPixDIJd1J0QT9ch9G5xmJetSphC/ok66fQXXsA/NogxAmJnu6Zo2M72AhhU6ZBtiSyy8Q/Gcy356lqfpPt95kkv7/BjZcMChDcT5EZwGxChs/T0EhYnVdo06X2LNad8fDSpMcrBmx2hvCkTZNHdps5Mpr5o2sem8cOqfXSHQeKioVBEGs83Zh7duYrKo9PD0Y3hYM= 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)(39860400002)(366004)(136003)(346002)(376002)(396003)(451199015)(83380400001)(31686004)(6486002)(54906003)(316002)(478600001)(110136005)(66556008)(8676002)(44832011)(66476007)(7416002)(6666004)(66946007)(38100700002)(4326008)(31696002)(36756003)(8936002)(6512007)(86362001)(26005)(2906002)(53546011)(6506007)(5660300002)(41300700001)(186003)(2616005)(45980500001)(43740500002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?K3ZTWmRnOHU4dXNJbHNZUUZlaS90OEYwek1HSGtuOWFIUnJVMU1nMUFYeTRU?= =?utf-8?B?WGpZSHZUSnRaeE5mY0FQWHdOZ0VtYWYxZnZXQnJiVlFaQjlLSkxBMVVmbURj?= =?utf-8?B?L1pKRVJ4NW9JR1poaVZaSWVITGdXUG0wQWd5R2pJZmRlU3dSY2w2Y2NRQUU2?= =?utf-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TlEUSs3ak9M?= =?utf-8?B?TEx2MzVzNURxZnNCcGxYMGZRaGRxbWJGUHBvbGRxYmU1TDB6ckdFZnc1anE4?= =?utf-8?B?Wm9DOVpRVGl2ellPSHRJd2t1a1U1Z1Q0ZVdmOWpSY25KN3p5M1dSczQ2NG1V?= =?utf-8?Q?KelwrItzDMk2IxeipVHy+tf93?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0bbf32fd-0885-454e-2bcb-08dab5ad2173 X-MS-Exchange-CrossTenant-AuthSource: DM6PR12MB4297.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2022 10:47:22.3386 (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: GCnnvQBbgdwwKMN29wOzI9rTRy7GTREQFxeE5C+QHsomBfaJAhqRcaI7AZN4Nicj X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB6959 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/24/2022 6:04 AM, Guo, Junfeng wrote: > > >> -----Original Message----- >> From: Ferruh Yigit >> Sent: Friday, October 21, 2022 17:50 >> To: Guo, Junfeng ; Zhang, Qi Z >> ; Wu, Jingjing ; Xing, >> Beilei >> Cc: dev@dpdk.org; Li, Xiaoyun ; >> awogbemila@google.com; Richardson, Bruce >> ; hemant.agrawal@nxp.com; >> stephen@networkplumber.org; Xia, Chenbo ; >> Zhang, Helin ; Wang, Haiyue >> >> Subject: Re: [PATCH v7 3/8] net/gve: add support for device initialization >> >> 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'. > > The value in 'priv->dev_addr' is the 'real' mac address of the gvnic port. > So I suppose that there is no need to set a default valid one, since we can > get them/it from the backend in gve_adminq_describe_device(priv). Ack, thanks for clarification. In 'gve_adminq_describe_device()', RTE_ETHER_ADDR_PRT_FMT & RTE_ETHER_ADDR_BYTES can be used for log, I will comment on patch.