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 76312A034C; Mon, 24 Oct 2022 12:50:42 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 69B4442B72; Mon, 24 Oct 2022 12:50:42 +0200 (CEST) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2051.outbound.protection.outlook.com [40.107.237.51]) by mails.dpdk.org (Postfix) with ESMTP id E00B54069C for ; Mon, 24 Oct 2022 12:50:40 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PWpNooywow414ptOKO7MKvzDe+CfKWVAxG+gK3WQ7oKATpUG3ZmhIdGjtRNmE3IWZ+NE/FkcjsjcSCnNqr7yhawHMRt3mHtG0/jssD6Ko5EwNyIgx4VpjLS0OYrdCn7Zsv8ewfU2pUVPypvw29m5sA7eZaF6baE0es60ZHLiaZrQoNXtPUlhQI80t4ZqfEbYdiFzY0/AylT5Fml1AThj+z3nxU9B//IhxTc01nFDm6+zYemwELFgqq2vCGnkJDjW7kQr0T+uTpPnp08KYFjvwxPepPN0z4yqCuFElLujv0kJcZSs4oBWNxKtRFpmb/GMFFBEEcKdI61iwQM4YXP25w== 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=bK43ieA1synzjsAyw3ZdYoYRx138LUcJfVuFJx6a6aI=; b=ETRsZULUhjXZhr/V4xsDCtXdwJH38Cc58T9yCDzak88xKl9sJMks2SVWRrd5bT3iBxhej1jG1i/ASN91AVNUzyK4zyqrgctAqweHAxfemeld1XQzkjLRGWUq2W8wcGrVauEeyayP1zQ8pcJGxDG+t+v9H8EpN2sf4i7Q/taQuA+FjzIjBE/bMe0QEDdhxnBJA+35H1mtScBJcTn+qqI4NhqTvxBG95LvF5fkkpTInXO+gRiJzWhLO1Yw3GguqwJJHSbD8DfYz0/NFAzlOILqrt6j2a61oj8WBkZV2Stb2RbcJo9qvceET6HR8Vb/Y1Jg12p/E8RtXinSIwwffn1xNQ== 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=bK43ieA1synzjsAyw3ZdYoYRx138LUcJfVuFJx6a6aI=; b=l4fmX0Z9+9KcakQD3ga4DBANmz7IlQURDRgBKTigaA7zAJk5h1l9KxnelcbX8Vl9WWKR9znrFqyCoM+fKPtYB2vJlS8M25rwUT1/paKWz0gf8rp09FL8L76vXfAJIuKwavvdgyaUOXR1xqzRb33lcCD+ak3NF1DiVbWE4J8Fo+A= 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 SJ2PR12MB8034.namprd12.prod.outlook.com (2603:10b6:a03:4c7::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.30; Mon, 24 Oct 2022 10:50:39 +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:50:39 +0000 Message-ID: <3ff4b7f5-057b-43ef-7846-66fad0a72849@amd.com> Date: Mon, 24 Oct 2022 11:50:32 +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 1/8] net/gve/base: introduce base code Content-Language: en-US To: Junfeng Guo , qi.z.zhang@intel.com, jingjing.wu@intel.com, ferruh.yigit@xilinx.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-2-junfeng.guo@intel.com> From: Ferruh Yigit In-Reply-To: <20221021091928.2674471-2-junfeng.guo@intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO2P265CA0154.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:9::22) To DM6PR12MB4297.namprd12.prod.outlook.com (2603:10b6:5:211::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR12MB4297:EE_|SJ2PR12MB8034:EE_ X-MS-Office365-Filtering-Correlation-Id: 51b16e70-3027-46c5-df62-08dab5ad96aa X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: guH7Nr5X+mPWwqumPTN37cltpviSCjli8Fbism+9t0B/vPyy9pcexdDMFNPmHwZAp8SyJeyJO0uhcMTAg6ZROJi+0O9GlVU5TmIjSuJo5m+wwNsb5iNfs+0xoWya47EvZoAE/BbnYpDnJmgPMunPyFDw5h80Vg6/PPCBd311aqPji1J2ljgRApOUhBwx12Yf/w/CECXFWKvbzOPuoGrAFibJcYoy3NfOUm4LwgRMwFprmr9PucJfVXYte2X9yx+aydIuqGbSjsvYZlqCrv76YyR+2iPmbzJgNF0oltQYicCtXidBfgcsuUykeLOfz/+zFVaf5rSXsTgyM4TXLhjv/ByoG02Zx2Z4r9l2r978Vtd+vPs2ay3LkrZQjzN/7eIdKk3Thaj3CJV3FmWm9on0/hFF1+V7fiQ/WXKieTNvVb/cWC3MWQiADtBZUcN3mJrcQ6JIReIh4gPTjtUQv3UCPogkICXnkWuPOqWp6b6W65hbUpv5/LgElIxGh9vdIsYErJv7oxmXuWkCixHtlIughuBssLpyOx4HjhLBLHwGmOJ7ZMyxnaXfXSUfOIJRBSVgho8QVyXT99lb8GppjQszqrnKxkD/xfuq1PE6d90yrvGFiawdNJuWMqIcZudIdx9CajO4tQggNsQFRFB73ZQ+JBCJq9Y0KnUxqYtZOZKqupQT9htP2OtPzZRmVAS2FaRQTs8ZPmRDqlRyOvBMXfsbS7WSyxL1cJQfkLJZEiMkcMQv0InFSbcGnrNdekdVjbdDcp2QlnyDgfQv0ZcFXp7/cNXYFisZF9zcsWrTTuEwwBw= 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)(39860400002)(366004)(376002)(346002)(396003)(451199015)(5660300002)(31686004)(2906002)(7416002)(8676002)(66946007)(478600001)(8936002)(66556008)(36756003)(6506007)(6486002)(6666004)(41300700001)(186003)(53546011)(26005)(316002)(83380400001)(38100700002)(44832011)(4326008)(6512007)(66476007)(2616005)(86362001)(31696002)(45980500001)(43740500002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?WCtsbE1pSmxyTFJiWWc3dFNXN0YyS0dEVktwblpGa1VCSC9QeElQQ0VhNXIx?= =?utf-8?B?Sy9NQ1JGZ1BVZEl4cGErWDdLZzQ3M2VoWmkzQWhuSlV3b1VkeWJYN3k1dys5?= =?utf-8?B?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ZWhQYWtMdmM4NUM1OUFP?= =?utf-8?B?RU43QVVzbmhxcko2UEVJN05NWllnQUU0VHh6SlEyRTgvRnltbnp4eFp2Zk5k?= =?utf-8?B?amI3RGlLMnV0QzlBUXl5T3RvZFFTNGpad2V2aThvcVZGSVNhMGhrQWlwTUlu?= =?utf-8?B?RzZCUjR6TGg2YklQWm85Y1docnBhM2Y2bU85TldnRXNYUm9PV1hyWmZOanhE?= =?utf-8?Q?WxDAk9NQbdk6OUkU2XrlR6oeu?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 51b16e70-3027-46c5-df62-08dab5ad96aa 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:50:39.0128 (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: 7mWejRL+rKT5vCpYmJWhfADvDdD1OwSZd8fax5dbJ53obFn25JX/eIhrbyhGKKOB X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB8034 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: > +int gve_adminq_describe_device(struct gve_priv *priv) > +{ > + struct gve_device_option_jumbo_frames *dev_op_jumbo_frames = NULL; > + struct gve_device_option_gqi_rda *dev_op_gqi_rda = NULL; > + struct gve_device_option_gqi_qpl *dev_op_gqi_qpl = NULL; > + struct gve_device_option_dqo_rda *dev_op_dqo_rda = NULL; > + struct gve_device_descriptor *descriptor; > + struct gve_dma_mem descriptor_dma_mem; > + u32 supported_features_mask = 0; > + union gve_adminq_command cmd; > + int err = 0; > + u8 *mac; > + u16 mtu; > + > + memset(&cmd, 0, sizeof(cmd)); > + descriptor = gve_alloc_dma_mem(&descriptor_dma_mem, PAGE_SIZE); > + if (!descriptor) > + return -ENOMEM; > + cmd.opcode = cpu_to_be32(GVE_ADMINQ_DESCRIBE_DEVICE); > + cmd.describe_device.device_descriptor_addr = > + cpu_to_be64(descriptor_dma_mem.pa); > + cmd.describe_device.device_descriptor_version = > + cpu_to_be32(GVE_ADMINQ_DEVICE_DESCRIPTOR_VERSION); > + cmd.describe_device.available_length = cpu_to_be32(PAGE_SIZE); > + > + err = gve_adminq_execute_cmd(priv, &cmd); > + if (err) > + goto free_device_descriptor; > + > + err = gve_process_device_options(priv, descriptor, &dev_op_gqi_rda, > + &dev_op_gqi_qpl, &dev_op_dqo_rda, > + &dev_op_jumbo_frames); > + if (err) > + goto free_device_descriptor; > + > + /* If the GQI_RAW_ADDRESSING option is not enabled and the queue format > + * is not set to GqiRda, choose the queue format in a priority order: > + * DqoRda, GqiRda, GqiQpl. Use GqiQpl as default. > + */ > + if (dev_op_dqo_rda) { > + priv->queue_format = GVE_DQO_RDA_FORMAT; > + PMD_DRV_LOG(INFO, "Driver is running with DQO RDA queue format."); > + supported_features_mask = > + be32_to_cpu(dev_op_dqo_rda->supported_features_mask); > + } else if (dev_op_gqi_rda) { > + priv->queue_format = GVE_GQI_RDA_FORMAT; > + PMD_DRV_LOG(INFO, "Driver is running with GQI RDA queue format."); > + supported_features_mask = > + be32_to_cpu(dev_op_gqi_rda->supported_features_mask); > + } else if (priv->queue_format == GVE_GQI_RDA_FORMAT) { > + PMD_DRV_LOG(INFO, "Driver is running with GQI RDA queue format."); > + } else { > + priv->queue_format = GVE_GQI_QPL_FORMAT; > + if (dev_op_gqi_qpl) > + supported_features_mask = > + be32_to_cpu(dev_op_gqi_qpl->supported_features_mask); > + PMD_DRV_LOG(INFO, "Driver is running with GQI QPL queue format."); > + } > + if (gve_is_gqi(priv)) { > + err = gve_set_desc_cnt(priv, descriptor); > + } else { > + /* DQO supports LRO. */ > + err = gve_set_desc_cnt_dqo(priv, descriptor, dev_op_dqo_rda); > + } > + if (err) > + goto free_device_descriptor; > + > + priv->max_registered_pages = > + be64_to_cpu(descriptor->max_registered_pages); > + mtu = be16_to_cpu(descriptor->mtu); > + if (mtu < ETH_MIN_MTU) { > + PMD_DRV_LOG(ERR, "MTU %d below minimum MTU", mtu); > + err = -EINVAL; > + goto free_device_descriptor; > + } > + priv->max_mtu = mtu; > + priv->num_event_counters = be16_to_cpu(descriptor->counters); > + rte_memcpy(priv->dev_addr.addr_bytes, descriptor->mac, ETH_ALEN); > + mac = descriptor->mac; > + PMD_DRV_LOG(INFO, "MAC addr: %02x:%02x:%02x:%02x:%02x:%02x", > + mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); There are 'RTE_ETHER_ADDR_PRT_FMT' & 'RTE_ETHER_ADDR_BYTES' macros for this purpose, you can use it like: PMD_DRV_LOG(INFO, "MAC addr" RTE_ETHER_ADDR_PRT_FMT, RTE_ETHER_ADDR_BYTES(priv->dev_addr)); So can get rid of 'mac' variable.