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 C8F20A00C4; Thu, 6 Oct 2022 16:20:02 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 62B3642C67; Thu, 6 Oct 2022 16:20:02 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2070.outbound.protection.outlook.com [40.107.94.70]) by mails.dpdk.org (Postfix) with ESMTP id 1196E42C66 for ; Thu, 6 Oct 2022 16:20:00 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZDl7hlVjxpsnUaqqBYLSF5PYpUtmuNy/8pPYBL/Jq7CPZ/kJ+kDv2br+etOpFB+y8j531zw1JLmbqxAgItePdQ3Jy05mdH/mfFxLRs4ebSmCiJShpavvSkwzF/3rYbNvwb/LeP3eb/BxS3WRTc5u9+6KqUnjXmpbazHiAc6Pz5eitqhZfvUUOatRV0Bv8nngFZOOUw1KhBLxTjjpLZYztXCPivLcA6VIu9OPl0QIARk9kmAEooyml6sHrqn/go2UtS29x8mv1twovFVD4qWADei+NXfHeIdM3/cW2mhiOrhhyn6ntYKzp8HDiWDD+oWgsOTEeClNME8o7nbOeLoEpg== 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=3mElpKSPZTW2l+RA/QDPMehrAKNpIwVw23A5BjNScwk=; b=e2o++w7bvwOHUBD52SIUF+1fj9qvJVuOxDLgNtBvx2PVzMKqueuB0R/ytYH2hBfiruCBA84dFZCR7jp+fEVAB6Th+kdJ8UqOhKoHkakytSvSijPgwrCYSf4w+3PhVJkLEV1vpMdqfThcs5nFf6Dl0EUG5VqvM4BLp5CNnaGfgUj/J0OuLxNnsQh+H83ngLo966V1b5Wk0XpivFsZK2c7AuBifYTK9GBo8vTS6LmtzXRcQO2UCPgiuGRVAXTq0sS2IXA3JZs29J7NgIqlD0s6WM2/fVV6b4aMSj4S4qwtICrwLRcXOF+yifN/egFJOG5lSjqMrVypEchbu5mOT0Dezg== 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=3mElpKSPZTW2l+RA/QDPMehrAKNpIwVw23A5BjNScwk=; b=L8M4EbWDZH3xQA/6ZO4cvT/SSDJ5AwI91TKonPbaOPre/Q0/pyq0ZzM6t6WI37+FNpHU4De03YKjTiMfuezIRoFEniE2xNUiNcsU4bo7vNSvb95rf6RtthCXUOG5gBrpulpYGTgGfJFzbUOQYbgEYv7tD5fTfg1YE9QOuziGyLw= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) by BL1PR12MB5285.namprd12.prod.outlook.com (2603:10b6:208:31f::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.23; Thu, 6 Oct 2022 14:19:56 +0000 Received: from CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::d07a:463f:6f93:337f]) by CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::d07a:463f:6f93:337f%7]) with mapi id 15.20.5676.036; Thu, 6 Oct 2022 14:19:54 +0000 Message-ID: <5dbd6741-8d7c-1185-dae5-ec2dc5c14e29@amd.com> Date: Thu, 6 Oct 2022 15:19:43 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.3.1 Subject: Re: [PATCH v4 1/9] net/gve/base: introduce GVE PMD base code Content-Language: en-US To: Junfeng Guo , qi.z.zhang@intel.com, jingjing.wu@intel.com Cc: ferruh.yigit@xilinx.com, dev@dpdk.org, xiaoyun.li@intel.com, awogbemila@google.com, bruce.richardson@intel.com, xueqin.lin@intel.com, Haiyue Wang References: <20220923093829.3019525-2-junfeng.guo@intel.com> <20220927073255.1803892-1-junfeng.guo@intel.com> <20220927073255.1803892-2-junfeng.guo@intel.com> From: Ferruh Yigit In-Reply-To: <20220927073255.1803892-2-junfeng.guo@intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO4P123CA0208.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:1a5::15) To CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PR12MB4294:EE_|BL1PR12MB5285:EE_ X-MS-Office365-Filtering-Correlation-Id: b08b7474-a1d2-48f9-cb0e-08daa7a5d6ae X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gAExEPnQfIYyS2cdR9Fs5G63Psl2bEX1Ftew2TdkeGGEV1tU7SbBrYfZqgG0R0zm4DyB98ZoI6S5ouMib86i3G1HHlBSY+9fXQf6UpN6dwRUoGxQ08VEl1nxxHLkehRXYyDXaa12/8KHqBYTzw7cGkMZ4zqOJHiuHlyZpwHFhAMpj6EgUBGKV+t0/F4QyQpECWvTtRJAz40GEYXcUjJlATfqQt779GarGgeQdBre3Fodj+yRQV09vQ9GkSa6WavaARCccAIL8Tzn+0epXLPhb6V05jyDeDXMziWPjuaMzJNIINej287Cx21ALmQpsS8KyAVDf++FZFwolak0JwzypnS4eyDPqtg3AnDZMsbpjyxaiSb4G7uH9fuAVecFGAXc7YZE5OFinRqr7We21XOuoSWQe97rKxD4RV5e/I7hjKT1faJLpWx27vH34hYd1sNU/P5+QKAEHXT4tET1Fu4gKFELJryYVn/S64hhpkDlC/vpyoKyxOFN6cbV5UvCFMfbN1G+sPigEwDXfFeJd9oC967/jXm3Y87YUFniA4we5YFtZpiIy3lq2qp43CeergkmI9TDZycLih4bsz/UDZJZVmr4vkyoqfakbxeMSuX8lvNA7Y4XAzr6Ku/JvMmbIcTPyv+gLbev7t8av45+YZMISklHXefhipkWHSRuseiBwYFzQMnhHljaMZhF2X/YJyvmtUXvvu35//TIUnrPLxylS0ij0woJtZGFwYdXpFLQgjAc0+SM0UrhGp26hTeuW/7JetORdcEGzrlSmzpc8WVP7UGsppcbyU1SLwvJbLhkk0QmXlPBwpCci71zLc1g3WzQ X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CH2PR12MB4294.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(136003)(376002)(366004)(39860400002)(396003)(346002)(451199015)(186003)(86362001)(31696002)(38100700002)(8936002)(41300700001)(5660300002)(44832011)(316002)(8676002)(66476007)(4326008)(66556008)(66946007)(6666004)(26005)(6512007)(6506007)(53546011)(2616005)(966005)(6486002)(2906002)(478600001)(83380400001)(36756003)(31686004)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?ZGp0WkFBTjNWSGxPenQyb0F6ZER1cmVjTDZNVTBQYjJ3OTRKSXlranJaeXBt?= =?utf-8?B?S0IwKzRwYUxSd1QxK3NsTXMwK1QzcFVSMlhoRXgvNDBxcUdkR29CKzVYT3pI?= =?utf-8?B?ZVpGb0JiVWc4TVNqM1ptSXdSSGgxaDduen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B?RmJ3VkhZSXZpUEJJOVJ4dnRzMXFsem5SVEtJSE5MTHRwYncvOHFQM2FtNWtS?= =?utf-8?B?NEMrYThsd3M5d3AvbUN6Y25oZzE0SzZGUFRzcUR1ZVU2bFMwMTJWREQyL2hU?= =?utf-8?B?THlZQStPckxMd2dnTVg0b21DRmRXdHhZR1hSTkUwNnh3WW1lZU9ub2tBRkc4?= =?utf-8?Q?Jzq2OpQeuMKXoVOQaRBbLSSNt?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: b08b7474-a1d2-48f9-cb0e-08daa7a5d6ae X-MS-Exchange-CrossTenant-AuthSource: CH2PR12MB4294.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Oct 2022 14:19:54.3473 (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: 716EpTyxbaxNgKgWXNcRUcsNSsvKRNHAf0bWiHOGZZIgHEnVV+ZAXdI9wGNXvfeC X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5285 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/27/2022 8:32 AM, Junfeng Guo wrote: > > The following base code is based on Google Virtual Ethernet (gve) > driver v1.3.0 under MIT license. > - gve_adminq.c > - gve_adminq.h > - gve_desc.h > - gve_desc_dqo.h > - gve_register.h > - gve.h > > The original code is in: > https://github.com/GoogleCloudPlatform/compute-virtual-ethernet-linux/\ > tree/v1.3.0/google/gve > > Note that these code are not Intel files and they come from the kernel > community. The base code there has the statement of > SPDX-License-Identifier: (GPL-2.0 OR MIT). Here we just follow the > required MIT license as an exception to DPDK. > > Signed-off-by: Xiaoyun Li > Signed-off-by: Haiyue Wang > Signed-off-by: Junfeng Guo <...> > +/* Process all device options for a given describe device call. */ > +static int > +gve_process_device_options(struct gve_priv *priv, > + struct gve_device_descriptor *descriptor, > + struct gve_device_option_gqi_rda **dev_op_gqi_rda, > + struct gve_device_option_gqi_qpl **dev_op_gqi_qpl, > + struct gve_device_option_dqo_rda **dev_op_dqo_rda, > + struct gve_device_option_jumbo_frames **dev_op_jumbo_frames) > +{ > + const int num_options = be16_to_cpu(descriptor->num_device_options); > + struct gve_device_option *dev_opt; > + int i; > + > + /* The options struct directly follows the device descriptor. */ > + dev_opt = RTE_PTR_ADD(descriptor, sizeof(*descriptor)); > + for (i = 0; i < num_options; i++) { > + struct gve_device_option *next_opt; > + > + next_opt = gve_get_next_option(descriptor, dev_opt); > + if (!next_opt) { > + PMD_DRV_LOG(ERR, > + "options exceed device_descriptor's total length."); > + return -EINVAL; > + } > + > + gve_parse_device_option(priv, dev_opt, > + dev_op_gqi_rda, dev_op_gqi_qpl, > + dev_op_dqo_rda, dev_op_jumbo_frames); > + dev_opt = next_opt; > + } > + > + return 0; > +} > + > +int gve_adminq_alloc(struct gve_priv *priv) Can you please be consistent in the syntax, at least within same file, if this file has slightly different syntax because it is base file, keep the file syntax instead of mixing with DPDK syntax, like return type of function should be on separate line. A generic comment for all base files. <...> > +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]); > + priv->tx_pages_per_qpl = be16_to_cpu(descriptor->tx_pages_per_qpl); > + priv->rx_data_slot_cnt = be16_to_cpu(descriptor->rx_pages_per_qpl); > + > + if (gve_is_gqi(priv) && priv->rx_data_slot_cnt < priv->rx_desc_cnt) { > + PMD_DRV_LOG(ERR, "rx_data_slot_cnt cannot be smaller than rx_desc_cnt, setting rx_desc_cnt down to %d", Can you try to reduce the line length as; PMD_DRV_LOG(ERR, "rx_data_slot_cnt cannot be smaller than rx_desc_cnt, setting rx_desc_cnt down to %d",