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 901E4A00C3; Sat, 14 May 2022 14:21:19 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 73D0840683; Sat, 14 May 2022 14:21:19 +0200 (CEST) Received: from mail-il1-f170.google.com (mail-il1-f170.google.com [209.85.166.170]) by mails.dpdk.org (Postfix) with ESMTP id 98F9D40395 for ; Sat, 14 May 2022 14:21:17 +0200 (CEST) Received: by mail-il1-f170.google.com with SMTP id b11so3547585ilr.4 for ; Sat, 14 May 2022 05:21:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=GfR8m9gVH18KsqyhwOTk9zdP8kt3uilwIa+97AUykGk=; b=V5IaGBpEHf3RuvhyvrKAq5YLi8J7qZkYYHzWaeYxNBVXt7BCdHnhiY7uI/vzH9iYmN k8qbPprRFaCQDNzn60fxhDkcyzNdM1/xyx73oIkBp5GoD4aCiR7FF73b5fAp/gNwN9Yj dDESNzp+p/bvMv4RsFWIzpyBxnVHoZMyE0TrmRYYMW8q9lV6t+kf16eSVCoFy0tVrqSX TBBEJOfwJoMjXNFH3vJGt3aVPosBFOGUKTlCKNT7KCY5vMIxQPoyknxzJnSChBFC66j7 gcPJdOIVr7+zm+DQAX1SMdhAX9eZRtDF6ZVq+/Vd7Cf4+rzaFxMnQijWjT5oIOYThW/n w4pQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=GfR8m9gVH18KsqyhwOTk9zdP8kt3uilwIa+97AUykGk=; b=3MJB2SG/5Wphk5DEUZj+u8xrv+uXD9PMOZi9SQguFeu4AR7jlE7BA60lJ1BR7Zaqqh VB7moXnEEI5enUruk4FuNPPkpE4zmL5e4whYIeQFD7kMXeKTPEGG8BXcn5G0xEIl+5dA krbECaTEwk1iOk2yQAUftp58oau2HeNs5VXEnJxZ/00zpvV8F795MWkj/pFkWtTYTReC gIVsTWc82t2ycKi99EWzDvDtpJrEQwcf8jt/okyZrLXuIm7txd5VfDTx8IVaGTRD0cyN IS7u+vP9U/H9t4A1Obj9i92UJV/VnQF+0iiRlZ+Ttj5g67uXUpHqdFJN2mS6abGWdqL8 2VBg== X-Gm-Message-State: AOAM530BpeyewinFvNXUmfw4ArISLEtkbxNDG8P6/BC/klSe9UwaYskt 8RYJyMbiz5vL3jvjuyk9GpnOLSPzwmFTVtI9jKU= X-Google-Smtp-Source: ABdhPJyqDTCB/QgH6DzFPdGNltc5iOPKD44Gf3nImzlNrLjqWxTh9yxOanmmxmRkQNfm9NYDbHHqZipRH7ryJbia7XA= X-Received: by 2002:a05:6e02:1d8a:b0:2cd:fa75:6395 with SMTP id h10-20020a056e021d8a00b002cdfa756395mr4800409ila.294.1652530875924; Sat, 14 May 2022 05:21:15 -0700 (PDT) MIME-Version: 1.0 References: <20220412174224.13143-1-syalavarthi@marvell.com> In-Reply-To: <20220412174224.13143-1-syalavarthi@marvell.com> From: Jerin Jacob Date: Sat, 14 May 2022 17:50:50 +0530 Message-ID: Subject: Re: [PATCH 1/1] common/cnxk: added new macros to platform layer To: Srikanth Yalavarthi Cc: Nithin Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao , dpdk-dev , Jerin Jacob , sshankarnara@marvell.com Content-Type: text/plain; charset="UTF-8" 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, Apr 12, 2022 at 11:12 PM Srikanth Yalavarthi wrote: > > Added new macros for pointer operations, bitwise operations, > spinlocks and 32 bit read and write. > > Signed-off-by: Srikanth Yalavarthi > --- > drivers/common/cnxk/roc_bits.h | 12 ++++++++++++ > drivers/common/cnxk/roc_platform.h | 28 +++++++++++++++++++--------- > 2 files changed, 31 insertions(+), 9 deletions(-) > > diff --git a/drivers/common/cnxk/roc_bits.h b/drivers/common/cnxk/roc_bits.h > index 11216d9d63..ce3dffa08d 100644 > --- a/drivers/common/cnxk/roc_bits.h > +++ b/drivers/common/cnxk/roc_bits.h > @@ -29,4 +29,16 @@ > (~0ULL >> (BITS_PER_LONG_LONG - 1 - (h)))) > #endif > > +#ifndef IS_BIT_SET > +#define IS_BIT_SET(num, n) ((num) & (1 << (n))) > +#endif > + > +#ifndef SET_BIT > +#define SET_BIT(num, n) ((num) | (1 << (n))) > +#endif > + > +#ifndef CLEAR_BIT > +#define CLEAR_BIT(num, n) ((num) &= ~((1) << (n))) > +#endif lib/eal/include/rte_bitops.h has similar ops already, Please use those schemes now. ie. #define plt_bit_relaxed_get32 rte_bit_relaxed_get32 > #endif /* _ROC_BITS_H_ */ > diff --git a/drivers/common/cnxk/roc_platform.h b/drivers/common/cnxk/roc_platform.h > index 28004b1743..3671e55c23 100644 > --- a/drivers/common/cnxk/roc_platform.h > +++ b/drivers/common/cnxk/roc_platform.h > @@ -41,6 +41,7 @@ > #define PLT_MEMZONE_NAMESIZE RTE_MEMZONE_NAMESIZE > #define PLT_STD_C11 RTE_STD_C11 > #define PLT_PTR_ADD RTE_PTR_ADD > +#define PLT_PTR_SUB RTE_PTR_SUB > #define PLT_PTR_DIFF RTE_PTR_DIFF > #define PLT_MAX_RXTX_INTR_VEC_ID RTE_MAX_RXTX_INTR_VEC_ID > #define PLT_INTR_VEC_RXTX_OFFSET RTE_INTR_VEC_RXTX_OFFSET > @@ -70,12 +71,16 @@ > #define PLT_U32_CAST(val) ((uint32_t)(val)) > #define PLT_U16_CAST(val) ((uint16_t)(val)) > > +/* Add / Sub pointer with scalar and cast to uint64_t */ > +#define PLT_PTR_ADD_U64_CAST(__ptr, __x) PLT_U64_CAST(PLT_PTR_ADD(__ptr, __x)) > +#define PLT_PTR_SUB_U64_CAST(__ptr, __x) PLT_U64_CAST(PLT_PTR_SUB(__ptr, __x)) > + > /** Divide ceil */ > -#define PLT_DIV_CEIL(x, y) \ > - ({ \ > - __typeof(x) __x = x; \ > - __typeof(y) __y = y; \ > - (__x + __y - 1) / __y; \ > +#define PLT_DIV_CEIL(x, y) \ > + ({ \ > + __typeof(x) __x = x; \ > + __typeof(y) __y = y; \ > + (__x + __y - 1) / __y; \ > }) Please remove formatting changes. > > #define __plt_cache_aligned __rte_cache_aligned > @@ -113,10 +118,11 @@ > #define plt_bitmap_scan rte_bitmap_scan > #define plt_bitmap_get_memory_footprint rte_bitmap_get_memory_footprint > > -#define plt_spinlock_t rte_spinlock_t > -#define plt_spinlock_init rte_spinlock_init > -#define plt_spinlock_lock rte_spinlock_lock > -#define plt_spinlock_unlock rte_spinlock_unlock > +#define plt_spinlock_t rte_spinlock_t > +#define plt_spinlock_init rte_spinlock_init > +#define plt_spinlock_lock rte_spinlock_lock > +#define plt_spinlock_unlock rte_spinlock_unlock > +#define plt_spinlock_trylock rte_spinlock_trylock > > #define plt_intr_callback_register rte_intr_callback_register > #define plt_intr_callback_unregister rte_intr_callback_unregister > @@ -165,6 +171,10 @@ > #define plt_write64(val, addr) \ > rte_write64_relaxed((val), (volatile void *)(addr)) > > +#define plt_read32(addr) rte_read32_relaxed((volatile void *)(addr)) > +#define plt_write32(val, addr) \ > + rte_write32_relaxed((val), (volatile void *)(addr)) > + > #define plt_wmb() rte_wmb() > #define plt_rmb() rte_rmb() > #define plt_io_wmb() rte_io_wmb() > -- > 2.17.1 >