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 B09E341E04; Tue, 7 Mar 2023 16:03:23 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7064140ED6; Tue, 7 Mar 2023 16:03:23 +0100 (CET) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2055.outbound.protection.outlook.com [40.107.223.55]) by mails.dpdk.org (Postfix) with ESMTP id 0DB964067B for ; Tue, 7 Mar 2023 16:03:22 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GIqotx6ZEXfwqm62A/MvpEIsS1GhmuXLLcEpTntbUWbw1M8Oqhhr0OK9GMRJsvSDPklWBvTrfTchMcVGCi2ezspdksZRwMsbYsdZgdU7zhm2jUI9O5U3xtAR0Wf1jlGs7cpJoNm6v8LSM+3sGVYoys4bF9nHF3SxdiJAG0ZrSQZB/CBBdlUgSMi2pPKACcanU3nskcpU3s8L+s5uH6BzAuIyfGogI2qqcPfIMixnmhblftYT/0FXh27iTrGEz9eQbHnEAPAdsK4LZl0iNnGT60LkBOvVKNzvgIH963aqnrWNaFRKysy5Rfs8IQyHAVdMLC2vXUlFUQ1PnAq3skP8rA== 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=PVYdwMi4SDJKJiry+KoubDaiVkiUiXRZyOIK7Y8mPs8=; b=NsnLoUZINvp9YfRtDMDrgjfanGqXagNGQd+W0Jb95JJZzTRxO6RJdXV2KZBNwutqohsS3lAQYbf3Vjg6cNLNaF8inSPHnB3X1DY1uIL1W2C9VZdhMfTmrJd2u/WkC3EBk3cfQp9g/EshcP3wMjWmzjGoYmvz3yc67f9uZEDA1f4Qgr3dAkSUj3zfBu183m3WBCNJpOYscf05DdAcPe2J4A/SligRZqsseVuepbHtwoNjnccTp+AU5js/swugnwvcDjPeAwFWqY9JcmJeMMJpBhwu75GOYVvUW3Q8w8twFpb+weDthW9fIPKtsLiBT6z+utB1jSgDHSSlewFvc06c7Q== 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=PVYdwMi4SDJKJiry+KoubDaiVkiUiXRZyOIK7Y8mPs8=; b=NExSc09QuVA+LpcV5Vfdba0607Tr4ghXmtUsFn0kqNw/Ksahh3EggeYuL3kJoMVpi/LT0sZ3ZaOOky/9rDECb++2aQLTrF1Wlr9FICqjF8rO3UvRso1TdScUOdcKp34AKJT0valxLcmabOtZ4BhjgmrIyO2Ny3OIvLHk7kmKaCU= 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 SA1PR12MB5672.namprd12.prod.outlook.com (2603:10b6:806:23c::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6156.29; Tue, 7 Mar 2023 15:03:19 +0000 Received: from CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::dd5a:8a5c:f493:9640]) by CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::dd5a:8a5c:f493:9640%4]) with mapi id 15.20.6156.029; Tue, 7 Mar 2023 15:03:19 +0000 Message-ID: <756fa1cf-1abe-1b0c-8a86-d7d407500663@amd.com> Date: Tue, 7 Mar 2023 15:03:12 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Content-Language: en-US From: Ferruh Yigit To: Mingxia Liu , beilei.xing@intel.com, yuying.zhang@intel.com, Raslan Darawsheh Cc: dev@dpdk.org, Stephen Hemminger , Bruce Richardson , Qi Z Zhang References: <20230302103527.931071-1-mingxia.liu@intel.com> <20230302212057.1114863-1-mingxia.liu@intel.com> <20230302212057.1114863-2-mingxia.liu@intel.com> <1d8452f4-d507-0f62-b595-b1f9e67242ce@amd.com> Subject: Re: [PATCH v9 01/21] net/cpfl: support device initialization In-Reply-To: <1d8452f4-d507-0f62-b595-b1f9e67242ce@amd.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO4P265CA0042.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:2ac::7) To CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PR12MB4294:EE_|SA1PR12MB5672:EE_ X-MS-Office365-Filtering-Correlation-Id: b688878f-ce67-4d18-a127-08db1f1d1635 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +M5l6XtwJMjVGyDtKZjkF04YLcqokoQlHErtdSNPcF5jzXy7Gbrly2DVEp/PY86szZ75fJHfEc79zlm5l0LwM8HEXUSrvSJwUKEoIOt/LDdufreNJ10w6FM2MdwfeNBFvlxPPIShslTgw/xp6Zw+yNUfP49VzfXCwdHHcytN6gz7pcKPF0LGuWV+fVZ3K9+C0qTKCxuK4z9LLM2m5wMDyLsR7odyk8tw6rGY1KOvaCKFGw5ixUkVwq6iUVw2wSuVV8dq8ftl1fHGKGJ/8HQxGNySaoiJY1/B2OVssU8toZ0Jj7mC16Ji2ea6GgNoA9Uxvuk1yGm1R2ktdfg/JhqvERtz7/TUUNpDHftxtPBAAh886ZZ02iZfwKEe5uZItT1zeJRNwJn2Hv9m8Kyd3g8qu+/RomiqFjumZUsQxZnzLY88PBZT6d1tAhHK6VzSP7Sq1y/xpN6OpLGHiOa64bYUsTEliDEOwa/csOcl0G4vSNphoxldAcWfV8nlFCSQNKZaiTehc/tbwWTVxInQEk+n1YqjVL/Mxwt1qAQ2cBsNJ9xFcPLWHyvy/awlavXJnoYEeNrRNgKPU6SaPGiBrI55zKAd6VvjgSbwM4LXw7uTSt7pezlDLHmxdv5SUH+WC3mnzmxHqnLe8sFRXihdUPNiA/IY5+zOHawuKjWLHnKS6pm+wYvQztmlI/nCX4ql60IA/6gxJFKT3PnpzlO4m1nG85jTu0S8xa4O4k+MSoIxf7E= 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:(13230025)(4636009)(366004)(396003)(346002)(136003)(376002)(39860400002)(451199018)(83380400001)(8676002)(66556008)(66946007)(66476007)(4326008)(31696002)(86362001)(186003)(38100700002)(2616005)(36756003)(316002)(478600001)(110136005)(54906003)(6666004)(53546011)(6512007)(26005)(6506007)(6486002)(2906002)(8936002)(5660300002)(31686004)(44832011)(41300700001)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?TFdXaWFkYTFNZXNUTDlYQnFnZlFDeDlzb2NPUDZ5YytsREI3azZWNk1nK0Fj?= =?utf-8?B?RGhRSG1WV2pjQzc1ang3c1psWHkwczNRdmp6M05ma2hRSHlENkUxRDFYdE9B?= =?utf-8?B?ZEFESGFhM3BROVhJL2JDV0YyRHdGa25sTTVXQ2dBdTkvaEZCcDV5bmJTMkYv?= =?utf-8?B?MElVZGlZeGVINENTS1FQbGJ5WXMrb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= =?utf-8?B?cVJoWVVZOE9pZXlyMHdhOWpYbEFucVI0NFU5WXJuTmtnVUFUMXBvNVhpd1pH?= =?utf-8?B?QkIvRk5sbHR5N1ZIbG5sZENOT2N0VU1nWU44bFJpSWpkZEt2eXlmS0NTOFJh?= =?utf-8?Q?Nm666sDfxKlDfN4dt/SiqUKn0?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: b688878f-ce67-4d18-a127-08db1f1d1635 X-MS-Exchange-CrossTenant-AuthSource: CH2PR12MB4294.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Mar 2023 15:03:19.2931 (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: uiNEVIcfJJ6J6mRiuI58vp9SCENwZHoLi8GiB+S/F2FdE1BBuxqIXQrA183+jFPc X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB5672 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 3/7/2023 2:11 PM, Ferruh Yigit wrote: > On 3/2/2023 9:20 PM, Mingxia Liu wrote: >> Support device init and add the following dev ops: >> - dev_configure >> - dev_close >> - dev_infos_get >> - link_update >> - dev_supported_ptypes_get >> >> Signed-off-by: Mingxia Liu > > <...> > >> +static void >> +cpfl_handle_virtchnl_msg(struct cpfl_adapter_ext *adapter) >> +{ >> + struct idpf_adapter *base = &adapter->base; >> + struct idpf_dma_mem *dma_mem = NULL; >> + struct idpf_hw *hw = &base->hw; >> + struct virtchnl2_event *vc_event; >> + struct idpf_ctlq_msg ctlq_msg; >> + enum idpf_mbx_opc mbx_op; >> + struct idpf_vport *vport; >> + enum virtchnl_ops vc_op; >> + uint16_t pending = 1; >> + int ret; >> + >> + while (pending) { >> + ret = idpf_vc_ctlq_recv(hw->arq, &pending, &ctlq_msg); >> + if (ret) { >> + PMD_DRV_LOG(INFO, "Failed to read msg from virtual channel, ret: %d", ret); >> + return; >> + } >> + >> + memcpy(base->mbx_resp, ctlq_msg.ctx.indirect.payload->va, >> + IDPF_DFLT_MBX_BUF_SIZE); >> + >> + mbx_op = rte_le_to_cpu_16(ctlq_msg.opcode); >> + vc_op = rte_le_to_cpu_32(ctlq_msg.cookie.mbx.chnl_opcode); >> + base->cmd_retval = rte_le_to_cpu_32(ctlq_msg.cookie.mbx.chnl_retval); >> + >> + switch (mbx_op) { >> + case idpf_mbq_opc_send_msg_to_peer_pf: >> + if (vc_op == VIRTCHNL2_OP_EVENT) { > > > Raslan reported following build error [1], 'VIRTCHNL2_OP_EVENT' is not > an element of "enum virtchnl_ops", can you please check? > > > I guess there are a few options, have a new enum for virtchnl2, like > "enum virtchnl2_ops" which inlucde all 'VIRTCHNL2_OP_', > > OR > > use 'uint32_t' type (instead of "enum virtchnl_ops") when > 'VIRTCHNL2_OP_' opcodes can be used, this seems simpler. > > > BTW, this is same in the idfp driver. > > > [1] > drivers/libtmp_rte_net_cpfl.a.p/net_cpfl_cpfl_ethdev.c.o -c > ../../root/dpdk/drivers/net/cpfl/cpfl_ethdev.c > ../../root/dpdk/drivers/net/cpfl/cpfl_ethdev.c:1118:14: error: > comparison of constant 522 with expression of type 'enum virtchnl_ops' > is always false [-Werror,-Wtautological-constant-out-of-range-compare] > if (vc_op == VIRTCHNL2_OP_EVENT) { > ~~~~~ ^ ~~~~~~~~~~~~~~~~~~ > 1 error generated. > Thinking twice, I am not sure if this a compiler issue or coding issue, many compilers doesn't complain about above issue. As far as I understand C allows assigning unlisted values to enums, because underneath it just uses an integer type. Only caveat I can see is, the integer type used is not fixed, technically compiler can select the type that fits all enum values, so for above enum compiler can select an char type to store the values, but fixed value is 522 out of the char limit may cause an issue. But in practice I am not sure if compilers are selecting char as underlying type, or if they all just use 'int'.