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 5DFAA41E33; Wed, 8 Mar 2023 18:03:45 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4F8344113C; Wed, 8 Mar 2023 18:03:45 +0100 (CET) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2073.outbound.protection.outlook.com [40.107.92.73]) by mails.dpdk.org (Postfix) with ESMTP id 2C03A40FDF for ; Wed, 8 Mar 2023 18:03:43 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ChGlzf+ZNb3JmLRCuHXo7t1zJ1L5UzUaKVqgDDoVLzEEoeu4TZ5a/OV/67YiInX0OQQOwDfRZ6+N3JWZ+nZYBjHaK981Kz72I5UZfun8ZHVwxmImS+CirB0W0KwcQSm5QDqgNuD8J/QBzpZoMlDENJ7rGKjb3ZMG5i8xZQuQ/0h/yIBqSjR8PNLBhMZWPJSi4phHC60hEOdAAVjw7J/tL6DxKeMyP+EKa6sd1//q9J2ihKqXB7FX+Uik7hcWhLXfOrv6Wxzo7PK+wst3z2iwzbQ3NEAST4x+AscyNRKulkTz8nd3MOwkmXK5H1tlwnNwjFmpjTEv51gUGJxaK1wIiw== 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=PMiz2eoU+MArEPPruEwYJQ1RRStKPRi71/2Vmf6lGFY=; b=n5jw198sCOaEgBKpzBpjCAR92+zI2ZMKqKDW+hRmNxHKRv3yq5lmFmAQugZK8nS7gpyGxyUDSgie8m+kW+GzFEpCQ5hpjuL7DTFvlibUneleAnmLoCIxYeCJ5X+NkHB/nqH/u779G1Sx415UdKO4bWr6EEFQYx9cx2KzQVRkZm8oxFGuddNmWUJmA0aWkiLFhzsiK5awd7YLEBRINCn0koGgr+C65y9Oh7xhZGNDH9W8SXJfTJp/+jlsQ6H2MfqJAt0Fq7TFo6w6CVkqCIdnlN7pxfXSsDscEVci9LwOqLOJ10rcd9dte7CxhODnaXlSP6IfQgD6NNxVSlVOsniEDg== 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=PMiz2eoU+MArEPPruEwYJQ1RRStKPRi71/2Vmf6lGFY=; b=hLWZ3LAWHDmy2qoTgiLQvWo2myk/IUEjNF+/2rrCYY+KdhsfZ0/UizZQgwiqriREfhOhJSh2yr6sCUPTBwio71yvh7Gqt9cBvzDB+190523xgSG9lVmdAk+uMyT2bHZKv86h5lm7HtdSAlWcYFoltg0trPHSjhZZvbq1FAFhbGw= 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 SA1PR12MB5659.namprd12.prod.outlook.com (2603:10b6:806:236::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.17; Wed, 8 Mar 2023 17:03:40 +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; Wed, 8 Mar 2023 17:03:40 +0000 Message-ID: <112c73a7-4b35-6a95-08e9-c05d99cefeae@amd.com> Date: Wed, 8 Mar 2023 17:03:34 +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, Qi Z Zhang Cc: dev@dpdk.org, Stephen Hemminger , Bruce Richardson , Raslan Darawsheh 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> <756fa1cf-1abe-1b0c-8a86-d7d407500663@amd.com> Subject: Re: [PATCH v9 01/21] net/cpfl: support device initialization In-Reply-To: <756fa1cf-1abe-1b0c-8a86-d7d407500663@amd.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO2P265CA0309.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a5::33) To CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PR12MB4294:EE_|SA1PR12MB5659:EE_ X-MS-Office365-Filtering-Correlation-Id: c77f196d-f702-43bf-809e-08db1ff710ee X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: eI6viaEq1OcZYXDzHE5ff5QtNlkK+6OZhxFzK/U9YBJL4UfmstVIfALyJzlI7YDsy/5WJqHGvyD3xTTn1U6ouhvMwFbN7i6BqhayekilERFmOImLm2fHx4791Ly1IfCv180CHzqgfAixSOSv7pg0/9aBFJod6+1pFx4xOcz1ohfc0bMdyID3L9WZwssycjY5Aj6a0tr+2zAoFbEo2T1qZPvFaBMmga66VINX6xKvdH9eh7M3ypvQoIrI5V1NURcC642VCmata6f8yxy8P72fN1seZAIrdDYRYr8OEdIU3mTEFrg1wUEziKKKPsJwMtbQPEiwNy4hPBwiw0mbqs+LGyPS2gfEKj66Yb6iW8hhyMMV5qOVpyPvhyVv7OLqOwHkuIWvQ1jE6WaLv7N82vbzaEMzAQVOsXSt1hlB3CE3sDv6qBtmlRgdw0mUwbRHKM1hbiLegYuwnklnd9EB2AAf6uxtDZCteik8kuVty/SubB7EttQ2kDoyGfSoQBqHeRllf/aWyaQVrNAZnkiUSlmSP3yc9v0ecX2efleDwhDbN9R4xLZDwvElT+KYv9Jxa3qq8ygIG7JHql0Dl8rYCZr7Upscki4C1ME6lf29PR3TrKQgKBKwCSKoJhiGukYaCMJxEED/behoQhNvQbIwG2wsH1/oE8F5hzLi3nLZtau8Au0E1gM7zu/m9sMs03AC+ziIJTU35kmP8Pern5eOfxFDuQ== 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)(39860400002)(136003)(346002)(376002)(451199018)(5660300002)(83380400001)(478600001)(6666004)(53546011)(6506007)(6512007)(2906002)(26005)(186003)(44832011)(31686004)(31696002)(38100700002)(66556008)(8676002)(4326008)(66946007)(66476007)(36756003)(2616005)(6486002)(966005)(8936002)(86362001)(41300700001)(54906003)(110136005)(316002)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?R3FnSGFReW1SOXN1RExNbGpuRlBScTltQXJFK2FsZlJsYnFzdTJVb0RMZmdT?= =?utf-8?B?OVltTUZPWHBzVEVHaEtteDcwcDg5RW9CeTdyTERyck5Jc2k4SzZRZ0xaVnZ2?= =?utf-8?B?RnlxT2t0bXd3ekhOYVl6bDZnaEtSeFRULzliLzVvQlRsMUMva002ZzdYQVlR?= =?utf-8?B?UnZBcFA3ZW9pV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HejFjbEVUN01uVEFt?= =?utf-8?B?dGYxSHArZXRIWmtUbVFQQ1Zwc0NrQWdva1hFUXFPb0lxUllIZ0pOWHN6OVpo?= =?utf-8?B?a3BuVkg4Z1hDTytQazhLOGMrZGJVS05RT2t4REI2OU5weVV3aU0zMlVwWHkr?= =?utf-8?Q?aiZkWvAFaPZXXVhggsBr/BiGO?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: c77f196d-f702-43bf-809e-08db1ff710ee X-MS-Exchange-CrossTenant-AuthSource: CH2PR12MB4294.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Mar 2023 17:03:40.6849 (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: yrRv49nLGogLPYQTv7/zp9bsO06gxl8mChxRe7DO2y3WtsKjTkLIFtH6S0xkfWh7 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB5659 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 3:03 PM, Ferruh Yigit wrote: > 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'. > Hi Mingxia, Beilei, Yuying, Qi, Reminder of this issue. Build error is observed by clang 3.4.x [1], can you please work on a fix? [1] https://godbolt.org/z/zrKz7371b Thanks, ferruh