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 C1BBBA0540; Tue, 13 Dec 2022 17:57:27 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 649CB40146; Tue, 13 Dec 2022 17:57:27 +0100 (CET) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id BA9AD400D5 for ; Tue, 13 Dec 2022 17:57:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1670950645; x=1702486645; h=date:from:to:cc:subject:message-id:references: content-transfer-encoding:in-reply-to:mime-version; bh=01KkaXlW9BXTj7hiKKBZp2eO3rgwCfTylDUUbYIU3K4=; b=Bu/DSUnBXFNU6hC/rQmkaoAwLn7IhY6kEmp4uYhGsruyEwgsZpMw+ljK 2SgDJTh2bPubiZ3jVJv8XUGS7GNcC75FsGa0mNR/jJAmqWYQZDtFmLf84 LPuTQ3WxxeITqZc+3OIg2gckA4aZEpSylHk5EhNAx1iL4ZiF6XyJgnPf2 jURPh7g1/6aSPXTJwuNsfpLGfAg/hQ+7yiZSz1HCQ3SSl9hN607yOt4pz ua7KrKlkQnGTc2I717d0aKHdK3EMQV2G0dmaDDL6cS6noapBoBpN3dDpi U9esd5dw1/IxkSgcm4UoFqUgMnbPEiCYA6QUUn31qNZuEJpHVDzW0VNU7 w==; X-IronPort-AV: E=McAfee;i="6500,9779,10560"; a="404439983" X-IronPort-AV: E=Sophos;i="5.96,241,1665471600"; d="scan'208";a="404439983" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Dec 2022 08:57:24 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10560"; a="626413878" X-IronPort-AV: E=Sophos;i="5.96,241,1665471600"; d="scan'208";a="626413878" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by orsmga006.jf.intel.com with ESMTP; 13 Dec 2022 08:57:23 -0800 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Tue, 13 Dec 2022 08:57:23 -0800 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16 via Frontend Transport; Tue, 13 Dec 2022 08:57:23 -0800 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.172) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.16; Tue, 13 Dec 2022 08:57:22 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gFUnk7Id6sa2VWDJJnyF1OmgUKd/hmS1b3Noohu+8+/d/FczRZo7ENgCL+4ItG+KD/ha7aAv5pd/EfHUbea15ad4P7EYjTnIb+t38mMJNYcMubUZnRrVU6ITsyce0Av7SlXzUXDNVkVytn7/JiuoMgFLZjg7GrDvuf+lTYDpSSZROpYDZwoAB8PEVDpzh1hEyGzcttDba5VEfwD+W1KKvwkydiKOP8ekKxQaG2im5NdbKn16f1mGtx/bbEgJ8B+cRGziwEbxs3Eix5lRLYBRHAgixCqfdRatJ1bTINjUcCTH6fzQtpCGsx/avZhetScRgr8gALDLgMIm/I/6CLcvmA== 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=CdpKecY5FfglpIqbMnwgTXWpCp7YlQV+aMY5WPWVvJg=; b=AqcrhmKFkI9e/KlusAxRgPH7yTt4dEOIQ9rbKBHq8Nsx1p5sH8TtloM6MK8YX/PdOdCfCs+JAcjOpc0lrajM/4vdu25rFJ71862vhF2Z5cGOL5Rr8ThjTT2lGwkDxaeJbkV/4JSrzyxlEU117CLSGLLGtL9UfRcfT/UEkv/kTBpBbghuOl01SjguCOOf67OUz66HoFndq1ANsPgweV/06mA2HT1R6v4HgsMXlIihQwQbkm/klx35GFth70rJ3zrHCGYi9Asuvx2H++cknR3EaM4Xpu1h9FE2z1ggC+EWaIgU8GdHXJ1gi6q4t09tz/d3rTeCPsz3CqI0NsDjMSRxZA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from MWHPR11MB1629.namprd11.prod.outlook.com (2603:10b6:301:d::21) by PH0PR11MB5157.namprd11.prod.outlook.com (2603:10b6:510:3d::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.19; Tue, 13 Dec 2022 16:57:21 +0000 Received: from MWHPR11MB1629.namprd11.prod.outlook.com ([fe80::18bd:edae:ad31:a228]) by MWHPR11MB1629.namprd11.prod.outlook.com ([fe80::18bd:edae:ad31:a228%3]) with mapi id 15.20.5880.019; Tue, 13 Dec 2022 16:57:21 +0000 Date: Tue, 13 Dec 2022 16:57:14 +0000 From: Bruce Richardson To: Huisong Li CC: , , , , , Subject: Re: [PATCH V4 6/9] telemetry: refactor mapping between value and array type Message-ID: References: <20221208080540.62913-1-lihuisong@huawei.com> <20221213101512.39919-1-lihuisong@huawei.com> <20221213101512.39919-7-lihuisong@huawei.com> Content-Type: text/plain; charset="iso-8859-1" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20221213101512.39919-7-lihuisong@huawei.com> X-ClientProxiedBy: LO4P302CA0033.GBRP302.PROD.OUTLOOK.COM (2603:10a6:600:317::8) To MWHPR11MB1629.namprd11.prod.outlook.com (2603:10b6:301:d::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR11MB1629:EE_|PH0PR11MB5157:EE_ X-MS-Office365-Filtering-Correlation-Id: e7c1f490-69e4-4e4d-a4e0-08dadd2b197e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1ZovdoRnM9/P97hyoKvKLlzkvgvE+nGAVKlXiHzdH9WvHt2CfeUE3eUOR05GhRJEbrtM57JrCuzQopSrqf4+Kz71qrhqgc1t8X92168tTFD5+GgQWucNdxBVcjhhBdCZqHmUmE5M3OY4fbfr+yQkh8gEBvznYCfy7nk7AhmaVW8AR+UdQq+TilfTKTxaC7dh05Rt1ppO27LCKyVwKNUgTZ/ikB/bfWnmD/go1jgJqkWb7Dtd8InGoQcoO/a4S5bFTQoxlZKzbFV6pjSCp1rCAaKzg6RXOEC5tvV9Q8fl5rAZBgEzS/La3TvJ3cjPkXgpi8p2xa1Fn1LNDciJvXWxRLPa+TpBs3UZPL1L/vQl9CtqVW3HcUm632k8bsUTd5sYhpZRk8EAOTHOQqrzIDyUW9mpbPmTqk62LvvAWhGTr9bHB+iVdfjwA/4m/L9gxG91EoefFJhSt9jmvDnYNmdDHpD1G6oyaIAhh57jASkMIheUUaAt+Vqjhod3s7k79LvN7jIdjr7CzZpwakpghIK9QM0ctE/Af0KBJ61btbZunn86myhRb9Pf83Jqvovfl2zfRVYASEnJ8fD7CLykxucNLOwYFuIKddU162M6wpiHBbsY7W7hSIvAGI9SwyUnCiC+QJDJExqn9/7HgNf07tXoUw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR11MB1629.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(376002)(396003)(136003)(346002)(39860400002)(366004)(451199015)(82960400001)(41300700001)(38100700002)(86362001)(6486002)(6666004)(8936002)(478600001)(4326008)(316002)(8676002)(66946007)(66556008)(6916009)(186003)(2906002)(83380400001)(66476007)(26005)(6506007)(66574015)(6512007)(44832011)(5660300002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?iso-8859-1?Q?Nfcq5Cfk3OGWGr9DlKwrV/PZMJMl7vu1tCFd6x1aak+w9zF6V7RGf1t8Et?= =?iso-8859-1?Q?XtzTQO0wPpDfhbkl5wX2IqWUv66sSRue7HF/CTFFjmPoaFcu579kZkjGY7?= =?iso-8859-1?Q?u1nX/PvdUBFYsakcw2idSESTFAdBQtT3oZQip5F7asu3ciCKr96/tb4TY6?= =?iso-8859-1?Q?r7jQ/S6mwBpd3s589LhFquxsXX6YzlRT1pXfURzAEp4QDys9d27/9+EU3V?= =?iso-8859-1?Q?4x8NwsDVRRl+4D1k7Ho9Rb0Soe/0XEJi8cegyobOD9oW44kYAIuxxnh3ke?= =?iso-8859-1?Q?q07x7Wqle9CK5UN7y3ahHxb830D1T9sGmsvgfgMLov6ubXsMd8UsgoqUa2?= =?iso-8859-1?Q?G9N0Ev56GnRM+0i7WUxtO4hrojEugz3E1E5tX7gsYczcz1EpbFbcAsL4nY?= =?iso-8859-1?Q?je7WD/XViaCy8gJZyZ2EPi7KbeMtNWqDlSKRCu5Gkaq8/WYjis4A5pbZBO?= =?iso-8859-1?Q?fJBXtbONdLYuF0nMOVedccJbZdat/QPNOTwoyTP8ff5Y3YGE2KUTFiuMJD?= =?iso-8859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FrS4tbOhOC+3WfX5++mBjIYQ5/DhYqkEYvm8ERi?= =?iso-8859-1?Q?aneqk7hvBCU8qMm/tDpBPDc+9si8mbBsQkt06DbZQe+cfpr9QQjhCD5y7s?= =?iso-8859-1?Q?Q7SQ8Hx0lCay9TQ5HuIrAFpywvMcVaxz6ZSbxzjnI4WqFFTuoPuZLopDG+?= =?iso-8859-1?Q?AK2nHtzQhnwbuKTUsFa1RsOlxv9hcQpLdmf7Xedpuwt9pFGKE5bS8Ofovf?= =?iso-8859-1?Q?9nyo6dDSAejywPLI6C7r9FNUNo/jLVVx7irShMjX5reip7tji1Qx+VlA?= =?iso-8859-1?Q?=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: e7c1f490-69e4-4e4d-a4e0-08dadd2b197e X-MS-Exchange-CrossTenant-AuthSource: MWHPR11MB1629.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Dec 2022 16:57:21.1939 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: fO+rusgj1r7XF2k7Z6+9/uCG9Sq6uou85xP7dxA3J4CoctwfyEOI3SJg+Wg38G5YhA+i//yiI9SwS7wXCVeHE3SfheIv4nwxSn1HHXANaR4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR11MB5157 X-OriginatorOrg: intel.com 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 Tue, Dec 13, 2022 at 06:15:09PM +0800, Huisong Li wrote: > Currently, use rte_tel_value_type as index of array to find the > tel_container_types in rte_tel_data_start_array. It's not good > for maintenance. > > Fixes: ed1bfad7d384 ("telemetry: add functions for returning callback data") > Cc: stable@dpdk.org > > Signed-off-by: Huisong Li > Acked-by: Morten Brørup > Acked-by: Chengwen Feng > --- > lib/telemetry/telemetry_data.c | 28 ++++++++++++++++++++++------ > 1 file changed, 22 insertions(+), 6 deletions(-) > > diff --git a/lib/telemetry/telemetry_data.c b/lib/telemetry/telemetry_data.c > index 34366ecee3..080d99aec9 100644 > --- a/lib/telemetry/telemetry_data.c > +++ b/lib/telemetry/telemetry_data.c > @@ -15,13 +15,29 @@ > int > rte_tel_data_start_array(struct rte_tel_data *d, enum rte_tel_value_type type) > { > - enum tel_container_types array_types[] = { > - RTE_TEL_ARRAY_STRING, /* RTE_TEL_STRING_VAL = 0 */ > - RTE_TEL_ARRAY_INT, /* RTE_TEL_INT_VAL = 1 */ > - RTE_TEL_ARRAY_U64, /* RTE_TEL_u64_VAL = 2 */ > - RTE_TEL_ARRAY_CONTAINER, /* RTE_TEL_CONTAINER = 3 */ > + struct { > + enum rte_tel_value_type value_type; > + enum tel_container_types array_type; > + } value2array_types_map[] = { > + {RTE_TEL_STRING_VAL, RTE_TEL_ARRAY_STRING}, > + {RTE_TEL_INT_VAL, RTE_TEL_ARRAY_INT}, > + {RTE_TEL_U64_VAL, RTE_TEL_ARRAY_U64}, > + {RTE_TEL_CONTAINER, RTE_TEL_ARRAY_CONTAINER}, > }; > - d->type = array_types[type]; > + int array_types = -1; > + uint16_t i; > + > + for (i = 0; i < RTE_DIM(value2array_types_map); i++) { > + if (type == value2array_types_map[i].value_type) { > + array_types = value2array_types_map[i].array_type; > + break; > + } > + } > + While this may need cleanup, I don't think this particular way is the best method to use, so NAK for this patch for now. /Bruce