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 636B5A0508; Tue, 26 Apr 2022 16:27:56 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5822B42801; Tue, 26 Apr 2022 16:27:56 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mails.dpdk.org (Postfix) with ESMTP id 1E7A242801 for ; Tue, 26 Apr 2022 16:27:54 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1650983275; x=1682519275; h=message-id:date:subject:to:references:from:in-reply-to: content-transfer-encoding:mime-version; bh=nDeQiQPaFmBLjNvonNSdK8sMIOXxeSCdCBYGktaiF9c=; b=Jvo0bQLkLJefjS5L7hCFZjMjJc6vKNzZbIulM87EvFVwSUTawZNz6xFx Q4m3aDm1lDvpfgTIBLLU0Zfn2n0UJmgk5y10Ar/UzgIkhZ1rPLhnY3jJK 792Cm+DCOkvOWMoVGKNExsicEKjWheVbVHfeSLGhd0Iz2QiEbCwLAELzg o80vOydZS/T+g1Gd2gxjmAyi4XMd2mxkgDVjtv9zY/wifz3vZdX3zNbC/ DUvs+y7VxNG3IH5NxEoqKvQUl8KgWTzSy2m/+biOmADroy02zo/FQDiyi hgrDkHVuqCpTwPQJtU0gNKV2J7yW7K30VB7EL8IWrBXqTDyteNu+dSvfF w==; X-IronPort-AV: E=McAfee;i="6400,9594,10328"; a="328536081" X-IronPort-AV: E=Sophos;i="5.90,291,1643702400"; d="scan'208";a="328536081" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2022 07:27:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,291,1643702400"; d="scan'208";a="874689431" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by fmsmga005.fm.intel.com with ESMTP; 26 Apr 2022 07:27:53 -0700 Received: from fmsmsx608.amr.corp.intel.com (10.18.126.88) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Tue, 26 Apr 2022 07:27:53 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx608.amr.corp.intel.com (10.18.126.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27 via Frontend Transport; Tue, 26 Apr 2022 07:27:53 -0700 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.176) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.27; Tue, 26 Apr 2022 07:27:53 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kJZPdyMqHV6uX6Ruzm9Z329ixdwcaC1pguGZiu06NnYrUB/1PXYjiMpk5D1tb+mM14QV/vvT5XNe6hrquVMsfSJ3piMu4TP0/dasbvE7165PRmFjTfHEZH448R2ZIL4nnIYVJTmI255Vwca2d49N3eJgAU/Yph38HawVsZTxATEjrO8pUtbalGvB2Hj/uUhO8xrQrYslK5qZ3WdiABpV9axVuP0ekEslLU4AuCgMNzLTSaWz74aII9FWiqQ4HP54pGG05sbDcD/ceVauunwaLitaDGOxAEOQGKpaO+TLGj2ivydvfGWzrXM4yfn6uoVIHxloV/20I0B6eor2i69sYQ== 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=TimzKbkdUa5WDD4lLBsst5Bq3w/FIiNwb/O/5smT/yk=; b=CDRReID1B+m6PUpmKMVs1Jow5bi+ukRcnvB5G9c1Zh0EA2BdjNU9y3mjBNrjUU9m6MiyFO4lSkTc4HEDpDiPBxQ5Djn79yNrDNSqGkkHTnxyckK98Li/qlqXg45tsKzez0QjK9KTD4Ee6qs+HWUe8QQ2WyiOtwwRbFI9GPyCsfXhXmOmjkLf7a5yWGCw1M/g1Bli9ghTLmTEzXYdAHBd1kmtmOUrYiom+TtBw61nsfQ/MH+CaYZYyFTWHHnJlioLq8ey2XKnY0YFZhtosoc3au5zmL4Jdh5yv8+LVcSBz1rVLpPmbNqFZwUPLyI7NgZWh/S7fWSQaRsBQBq3csZcWw== 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 SJ0PR11MB5772.namprd11.prod.outlook.com (2603:10b6:a03:422::8) by CY4PR11MB1496.namprd11.prod.outlook.com (2603:10b6:910:3::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5186.15; Tue, 26 Apr 2022 14:27:51 +0000 Received: from SJ0PR11MB5772.namprd11.prod.outlook.com ([fe80::b433:a97d:da56:c168]) by SJ0PR11MB5772.namprd11.prod.outlook.com ([fe80::b433:a97d:da56:c168%4]) with mapi id 15.20.5186.021; Tue, 26 Apr 2022 14:27:51 +0000 Message-ID: <651e769b-eab5-13a4-d338-13ef8684ba44@intel.com> Date: Tue, 26 Apr 2022 15:27:47 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Firefox/91.0 Thunderbird/91.8.0 Subject: Re: [PATCH 2/2] rib6: mark error tests with unlikely Content-Language: en-US To: Stephen Hemminger , References: <20220413020935.90499-1-stephen@networkplumber.org> <20220413020935.90499-3-stephen@networkplumber.org> From: "Medvedkin, Vladimir" In-Reply-To: <20220413020935.90499-3-stephen@networkplumber.org> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO2P265CA0383.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a3::35) To SJ0PR11MB5772.namprd11.prod.outlook.com (2603:10b6:a03:422::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 608b49ab-b18d-4667-f4c9-08da2790f1ce X-MS-TrafficTypeDiagnostic: CY4PR11MB1496:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 00A7zpShzHyzOCyq86OjCnJ3YIZ7P2XDDId4NE4LPb2aRNm4MceTnGQzmcrqd56C1Fxm4LzlvgmBTtfj49tOqiS2k7G2hkqVN0fMU/C/SdzKHSNIP68EA8qXlNe8QrpzE/WjsUG3lqd+hUfS3Wbl8Z08OcCLsxedO+2lxZxQiLvcTzAUdoFh5YTd36wP+j7ZolYL5bdVqatp8WuVgJ5WrbgvH5t2alCSfdZy4bpUMlcjooLJ7GrxHwT3rLVFpAP5fCtjPd+dpw7NDbAtUvDTNc28hi1rFC7xIn4STmTXEYAJVDbO3uwlO+M0rdE/D3G6yopy7F/MD5f+uJCU1ImZrTbzjmM6OY1AgoS9RFbMyw4vw/UPfoTv4elU5+RmBDtfwH7hLP4GjZTIl3ujkeAzsEd0AwyMGPcA4a8tuJuxy/p66W84ll+N0zfJFQ/lMBoWVgIwS7dEhnQNTK2F5gB66taBuXE3Yv4vQ0vUgFFCTMguQWgOsCHjpYKuMpWx8aRXTkqGlDjQUQWIwKJe7LuRzmCMtTfsS3dxDWNFXMpouQOuQlCYNNPJ18p3ZTuvwuEGEx7sZCuPRtfuM9b5jVrMKQ9PVb5edkJ6OTGCkz2JqAzZb4Pw77cbNapMKywiHiO5kYAhBDL4NRkRI4nK/fSuycouoI82rUYA2HqRmLdWenjgBVHGkhgDI1Drt6ZIQ4qH+J0ECV78y25l8H33iaO7uMHqbyZLn3j6dsFT+10ntpM= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR11MB5772.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(508600001)(31696002)(6486002)(38100700002)(2906002)(66556008)(66476007)(8676002)(66946007)(6666004)(82960400001)(86362001)(8936002)(316002)(5660300002)(26005)(83380400001)(6512007)(31686004)(6506007)(53546011)(2616005)(186003)(36756003)(43740500002)(45980500001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?VGg5enpka3lBRGVTNFp0V1JNdE53d2plOTcycXd2Z2k5NHJYbFB5OFpMdWJF?= =?utf-8?B?R0dIODNkK2w2S1pIcUthb25NQnFFc1NRVnJqWUxlL1RRbXBDOVNIeVE3ZVI2?= =?utf-8?B?S3dtWE1WQjArb2J2UWt3RU9lV25LbGErWUpCN2dGZDRGeUlmZjMyOEdCM1d5?= =?utf-8?B?N1VIb1R5eUpBK2p2ZEszblpqUUtwWmxXQTduMHRjdG1TY2pTV2FBUDdKYU1P?= =?utf-8?B?SHFqcmhaekUzSVN1dzRVMTNlMFFBOHhSTkVlWEQvTmRzOEQ4VzNJZk51M0Mv?= =?utf-8?B?eW1TUDJrWE5zdGl5MGFKeUdiQ1hHd1NPY2JZUWM2OGVkeWVWMHZCZk4xeUVO?= =?utf-8?B?NXZLc1gwelF1OTlVdTJsK0dna3ZkZTRIZ25vb2YwODJaM1NKN1pKS3VWbEJy?= =?utf-8?B?cWQwZGlqa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?= =?utf-8?B?NWtGZ3ZVbVFxNHphcjZjYTlMRkExU3dDZXpjWFhUZUI4Y3NRQzFtZmNmT1dk?= =?utf-8?B?VDRvTUlVangwckxuNytZTlhMVUpiQ0lkbXhTT2NBTy9TSW5lajg0MkdmT0ky?= =?utf-8?Q?Q+Vvyt5bmy28gsOc=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: 608b49ab-b18d-4667-f4c9-08da2790f1ce X-MS-Exchange-CrossTenant-AuthSource: SJ0PR11MB5772.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Apr 2022 14:27:51.2773 (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: uMnxWaUEbXgVCcRI52IjVVrqXlg2qwyySNNyDDU+VXQg4y9QxBQllMZkHpCGBXCQxUenagIp3sY8uAGtE7ycZD7Gj7xtvMzPMrr/2LxEZpA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR11MB1496 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 13/04/2022 03:09, Stephen Hemminger wrote: > Also mark some conditional functions as const. > > Signed-off-by: Stephen Hemminger > --- > lib/rib/rte_rib6.c | 25 ++++++++++++------------- > 1 file changed, 12 insertions(+), 13 deletions(-) > > diff --git a/lib/rib/rte_rib6.c b/lib/rib/rte_rib6.c > index 042ac1f090bf..650bf1b8f681 100644 > --- a/lib/rib/rte_rib6.c > +++ b/lib/rib/rte_rib6.c > @@ -47,13 +47,13 @@ struct rte_rib6 { > }; > > static inline bool > -is_valid_node(struct rte_rib6_node *node) > +is_valid_node(const struct rte_rib6_node *node) > { > return (node->flag & RTE_RIB_VALID_NODE) == RTE_RIB_VALID_NODE; > } > > static inline bool > -is_right_node(struct rte_rib6_node *node) > +is_right_node(const struct rte_rib6_node *node) > { > return node->parent->right == node; > } > @@ -171,7 +171,7 @@ rte_rib6_lookup_exact(struct rte_rib6 *rib, > uint8_t tmp_ip[RTE_RIB6_IPV6_ADDR_SIZE]; > int i; > > - if ((rib == NULL) || (ip == NULL) || (depth > RIB6_MAXDEPTH)) { > + if (unlikely(rib == NULL || ip == NULL || depth > RIB6_MAXDEPTH)) { > rte_errno = EINVAL; > return NULL; > } > @@ -210,7 +210,7 @@ rte_rib6_get_nxt(struct rte_rib6 *rib, > uint8_t tmp_ip[RTE_RIB6_IPV6_ADDR_SIZE]; > int i; > > - if ((rib == NULL) || (ip == NULL) || (depth > RIB6_MAXDEPTH)) { > + if (unlikely(rib == NULL || ip == NULL || depth > RIB6_MAXDEPTH)) { > rte_errno = EINVAL; > return NULL; > } > @@ -293,8 +293,7 @@ rte_rib6_insert(struct rte_rib6 *rib, > int i, d; > uint8_t common_depth, ip_xor; > > - if (unlikely((rib == NULL) || (ip == NULL) || > - (depth > RIB6_MAXDEPTH))) { > + if (unlikely((rib == NULL || ip == NULL || depth > RIB6_MAXDEPTH))) { > rte_errno = EINVAL; > return NULL; > } > @@ -413,7 +412,7 @@ int > rte_rib6_get_ip(const struct rte_rib6_node *node, > uint8_t ip[RTE_RIB6_IPV6_ADDR_SIZE]) > { > - if ((node == NULL) || (ip == NULL)) { > + if (unlikely(node == NULL || ip == NULL)) { > rte_errno = EINVAL; > return -1; > } > @@ -424,7 +423,7 @@ rte_rib6_get_ip(const struct rte_rib6_node *node, > int > rte_rib6_get_depth(const struct rte_rib6_node *node, uint8_t *depth) > { > - if ((node == NULL) || (depth == NULL)) { > + if (unlikely(node == NULL || depth == NULL)) { > rte_errno = EINVAL; > return -1; > } > @@ -441,7 +440,7 @@ rte_rib6_get_ext(struct rte_rib6_node *node) > int > rte_rib6_get_nh(const struct rte_rib6_node *node, uint64_t *nh) > { > - if ((node == NULL) || (nh == NULL)) { > + if (unlikely(node == NULL || nh == NULL)) { > rte_errno = EINVAL; > return -1; > } > @@ -452,7 +451,7 @@ rte_rib6_get_nh(const struct rte_rib6_node *node, uint64_t *nh) > int > rte_rib6_set_nh(struct rte_rib6_node *node, uint64_t nh) > { > - if (node == NULL) { > + if (unlikely(node == NULL)) { > rte_errno = EINVAL; > return -1; > } > @@ -471,7 +470,7 @@ rte_rib6_create(const char *name, int socket_id, > struct rte_mempool *node_pool; > > /* Check user arguments. */ > - if (name == NULL || conf == NULL || conf->max_nodes <= 0) { > + if (unlikely(name == NULL || conf == NULL || conf->max_nodes <= 0)) { > rte_errno = EINVAL; > return NULL; > } > @@ -506,7 +505,7 @@ rte_rib6_create(const char *name, int socket_id, > > /* allocate tailq entry */ > te = rte_zmalloc("RIB6_TAILQ_ENTRY", sizeof(*te), 0); > - if (te == NULL) { > + if (unlikely(te == NULL)) { > RTE_LOG(ERR, LPM, > "Can not allocate tailq entry for RIB6 %s\n", name); > rte_errno = ENOMEM; > @@ -516,7 +515,7 @@ rte_rib6_create(const char *name, int socket_id, > /* Allocate memory to store the RIB6 data structures. */ > rib = rte_zmalloc_socket(mem_name, > sizeof(struct rte_rib6), RTE_CACHE_LINE_SIZE, socket_id); > - if (rib == NULL) { > + if (unlikely(rib == NULL)) { > RTE_LOG(ERR, LPM, "RIB6 %s memory allocation failed\n", name); > rte_errno = ENOMEM; > goto free_te; Acked-by: Vladimir Medvedkin -- Regards, Vladimir