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 6D0B5A0547; Wed, 12 Oct 2022 10:07:25 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5DA5842EE2; Wed, 12 Oct 2022 10:07:25 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mails.dpdk.org (Postfix) with ESMTP id 8B94642EC2 for ; Wed, 12 Oct 2022 10:07:22 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1665562042; x=1697098042; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=ZO+xt/n1dAcn90r/NFf0ZGtFIIQ4O2n7H8V8tV44Hno=; b=T2aSBw2oG6+uJCHHi3sgkZhRa8WdnLlEMxhd+SWCHTpcTCyCQ1NZIYEA rSQb+hEgrIZFec6flKocEACzeLPtRzsS04ATwVwYYsSPGVSJ8SOHPv+md ZkHsbJQVi2oZr/pCnDegCkOTU8vq3O6qkhh5vvgNeGU1LkHXsewVS4yai OpbgcCMO3Sz7FiNTZcEIVYn1fCF6umRwh98PKkfUQq4HwvpN9mZ/8AJMz GH/uON7l5JG2OK9vSxYngUfToER3PFKonkubmlH2iUQ5TqkVQ2sqFN7k2 x5FL/m/PZj08jzUBx6XtSFI0XbbfYhXeVvg34uNgJsd42+G4Etx3KcbF4 Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10497"; a="284457011" X-IronPort-AV: E=Sophos;i="5.95,178,1661842800"; d="scan'208";a="284457011" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2022 01:07:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10497"; a="769120500" X-IronPort-AV: E=Sophos;i="5.95,178,1661842800"; d="scan'208";a="769120500" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by fmsmga001.fm.intel.com with ESMTP; 12 Oct 2022 01:07:16 -0700 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) 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.2375.31; Wed, 12 Oct 2022 01:07:16 -0700 Received: from fmsmsx609.amr.corp.intel.com (10.18.126.89) by fmsmsx611.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Wed, 12 Oct 2022 01:07:15 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx609.amr.corp.intel.com (10.18.126.89) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31 via Frontend Transport; Wed, 12 Oct 2022 01:07:15 -0700 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.103) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2375.31; Wed, 12 Oct 2022 01:07:15 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JUin1+y3bEEX5hxCD5UzSwbIccIh+UGjfA1husX+yRaKtyX+n8LO3lulztS4UWqyggIIQ5990/LvCy5gLXv47ee5CsRl8cO4oee8iIeivs9TZHlYPC00CWQfm9IiKn3TjpgxxiOIrfWotPtMFQyvt57W8v2t9lvmWMWt5+nLNN0HYFdZRKFiDcGJ+2/OHyFywtGvxphW1SyzKuSgJ6/KFGoNE1L8pnGSQSEAz0J4VFwF+H996377UOJVYGCgZJv8P8qWiqYO9YpdbnZpYzCLVwHISKONRy7X53RTz1kIxtXJ2nnsp1bzuEQIZJWNZe39mV25Q8Zv1QIkIaoq20kkMg== 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=yx5ChR/SsNpp6SZo/PgJ/WA+nNT8c6BTM86m9wgW/xM=; b=NMBiJtOkAUBYAd5WaINFBelso5uPIa+wXt38Oec/3UHyEonlgcIPktr4390uPnxf+H/QdDpAPZlK3a4HVCkZHTOd0U1O+nl3vCyXBmUm/vD4wrT+vBEna4/2Qz81jtvYeBbAz/YEo0Z2fqhNuqTQiYLFBwv1Xl0F8bgSzGFlBlcu5sXNya+wFNe/iLELEeIFsBDmbiQwnGY4pb2oV917oy4ggC2t1gt4j7iU+bYsNg+jzhc7KTH39ritB6gtatlQbvg7CJLTM72GatNuAtFRdcGPcjmpHl804tN3Fe7tKOyXIOFe3RaZ4HNjxTXyg1JFRlgSE1DrUqa88RaqdcMJUg== 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 Received: from SA0PR11MB4575.namprd11.prod.outlook.com (2603:10b6:806:9b::18) by PH0PR11MB5831.namprd11.prod.outlook.com (2603:10b6:510:14b::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5709.15; Wed, 12 Oct 2022 08:07:13 +0000 Received: from SA0PR11MB4575.namprd11.prod.outlook.com ([fe80::95dc:6564:8d3b:bcf]) by SA0PR11MB4575.namprd11.prod.outlook.com ([fe80::95dc:6564:8d3b:bcf%3]) with mapi id 15.20.5709.022; Wed, 12 Oct 2022 08:07:13 +0000 From: "Wu, Wenjun1" To: "Guo, Junfeng" , "Zhang, Qi Z" , "Wu, Jingjing" , "Xing, Beilei" CC: "dev@dpdk.org" , "Wang, Xiao W" , "Guo, Junfeng" Subject: RE: [PATCH v2 02/14] net/idpf/base: add logs and OS specific implementation Thread-Topic: [PATCH v2 02/14] net/idpf/base: add logs and OS specific implementation Thread-Index: AQHYwRaItFbbO5PiEEu+G2G8rP5HWa4KoLAA Date: Wed, 12 Oct 2022 08:07:13 +0000 Message-ID: References: <20220803113104.1184059-1-junfeng.guo@intel.com> <20220905105828.3190335-1-junfeng.guo@intel.com> <20220905105828.3190335-3-junfeng.guo@intel.com> In-Reply-To: <20220905105828.3190335-3-junfeng.guo@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.6.500.17 dlp-reaction: no-action authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: SA0PR11MB4575:EE_|PH0PR11MB5831:EE_ x-ms-office365-filtering-correlation-id: 4898e095-b7c5-43b2-4289-08daac28c56b x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Wkhbukxo2z40ixr9jcmUdMM6+qPcSAEvkSjtorFRhAo8vwTNsIImga/Bcaa+3aBdd+KZP1fZ4AWbTUb+61Ijo4CYercGBIeskhCpnZTul4bwV8UnLxi7KnLTME6KZ7gL5uLG/lWNM3zZHyJZ18qV4ZPHDsszhovgoDZNKpQ0OihHwSoOpWhLjotJERYkoqEHqdujJ/Pxfd0JVNSa+J60kfHO5ULYaekx4x2eus++RfwufwTXi7PJUZ0U+pDbiCKHCFf9XccbhNKGjbOx7pDkeJi5oE/rfgadKmOSmkgFuaR8RooOMSsF+PQJqlwVQqxndhzePTrRg7SexirmtqN27x6HJQ2IWXzvGxuZADu3EumTlkOrkM9TivEJSnG/GCiQhBFG0ZIZ2pVRfPsfckvSUJvNacceYJUxYzUX4fG84BiK738Hhq5Jf5B0UriT/kIyd4TT4Y5bh4FG5B4FcW4myBM5sjOZpVrB6awm+2LzCz+RrSu2X5tzQplfvDQf7NQR4RA6kPXKg5vbJKq9CFVeDXZ3tJoIWrnjSFfLZSUceTf2eHxgr3dN8qGMDufr/umrDs2YDHrWh/wbIVhbr1jCVsi0F5YzsYFvDwItcY0FNzKpnoM35yqMw0rxurwym7Z6U8qvpmyz2MFVyBY6WjH8LH6CKd2Cg1YBLlWPLJmLcYHQMwOgm93BYT5llGXv0Kerrw4LVddkzK2umauk8YEvPifv8mki9YLkbtQzXbszMt/dNuLiZTZt5X9OqLAS+FHDO+1toX3bOUaawvAukFQyRg== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SA0PR11MB4575.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(396003)(366004)(346002)(136003)(39860400002)(376002)(451199015)(9686003)(7696005)(53546011)(8936002)(86362001)(26005)(82960400001)(71200400001)(478600001)(122000001)(107886003)(186003)(33656002)(6506007)(38100700002)(55016003)(38070700005)(83380400001)(4326008)(66446008)(8676002)(66476007)(41300700001)(2906002)(54906003)(52536014)(6636002)(66556008)(316002)(76116006)(5660300002)(110136005)(66946007)(30864003)(64756008); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?RPsvOGs5ECg75xUit8654LZC9ZtTaiRrr39QyEc5yqh5spLq66l3O5sDsQNq?= =?us-ascii?Q?k49UjS2V8Qrfua1v5/LvhyPPIJeFboViBUiFyOnqnGlToNZq+f71Q+AyCbjS?= =?us-ascii?Q?gKXO0HLCh/fhnrDdALAmGy5cPOi1UH5W5lDI6pmXOxCyQSWmIUlvVGn1DSAC?= =?us-ascii?Q?ZhjypaQ4bVan5pxjCUnaMqCYkZGejBm6CAupDNONGnr0edzv0TNYMOqs2qvJ?= =?us-ascii?Q?YOy1W03VBXeSOW7RAXlAbDnwiYT/OGE/2iLAW5n9xDFJrgIYpGJcpk0KxTnw?= =?us-ascii?Q?2tLXQq0MK1UsfS3eQvffGE4CFvl2yOGqXilXsZQutAFszmfkUcqHOnfwKAfk?= =?us-ascii?Q?j78kgJoN7hWrWu6O7dC+IUszz3QZndnCksG6YTvJp48J+aN1DoX0CiHs3aqK?= =?us-ascii?Q?fngEMRnqG2FS6SHR99jJK3UvGrXvxhvLHD8uzFuPRzp87NFZf4UqbuZiexA2?= =?us-ascii?Q?VdynmN5v9VhLnYz1XQF5+AWubvlelfU5AaSqinUILyglhtF7ZulJjuUfp5NJ?= =?us-ascii?Q?epau+MqXt7MBlTlWiJunxxpHqFlVKnsHTKzLw535aY1t9uWpjGY6LIAxIQpL?= =?us-ascii?Q?yqNP3G3OSXHHUy8E9Q3gqqUfaMiaBMeNtlTrMjZxs+sbBBTsKxnvL4tHAC/J?= =?us-ascii?Q?j+PvcXkFl8HbSMGn+hbz2uxOtwb97HBipMbw2aSVQMusieRVqes61WPrhGXu?= =?us-ascii?Q?4UB3TgPaQghNNzx2+2ufPgbDuLiI1UgVuKwoOms3UJEuoopK6X9E3Ph3RM1L?= =?us-ascii?Q?NYqg6L8S48aBF7F98oAyUxq4ITWEh3+9RMQ1JhqJeDSlHZxcu9BKmWdkXRNZ?= =?us-ascii?Q?5wL9qSHe9yHdT5Gpd/sgcbVDpsCeNcMPptGBaKsGgu8tzfYG493WWp2ugAj2?= =?us-ascii?Q?tU0Dj2tZ9t1QztZmTP+6cYGYMCr7ZKURIfMHBRZY8LIaqo3+YPtur7DarWzg?= =?us-ascii?Q?ZFUYn2fmirxIgEITVcm9UV2sU7KxolbzANmiQ38dUAUfA0D3yE7NVpMEVnV6?= =?us-ascii?Q?a95khYn5Rb+f7dufBO2cb7/Ml9+g6XtJmPSzUlFMeKUQEK/Zpo7Tkse495LK?= =?us-ascii?Q?ny/4jQ4w76i5163g+/zQXvKjeLImGuEEs4M1bDbOsklAN4yKrFDrjDXbWQS1?= =?us-ascii?Q?siYWq86MuVU6B8P5xnsW2iK2b3c5qFBeDBVJp7DVULaRnC+xMqkKnGxZa+Rh?= =?us-ascii?Q?sTQjh5lk6JOSnZhkLk8voFOo00PvWs+rcN3t5YtyvPcc1HBTRl4KPJFoINoj?= =?us-ascii?Q?oya6gpG4aThvrDEoplpUlhj5eY7j3dLQFTMQCcYv3QYWUDhIdLjBQDhVdIOl?= =?us-ascii?Q?DL08Am3LREdtysYsiOgD/jsTLJJl/AeUBgzlgH77FtLwvE1JleRIgYafp/pL?= =?us-ascii?Q?576e3oZP61G7+AQg9HC7EvnMvOUHUQkopmCyyJO96F3oUeoyqRndNFRh8hy0?= =?us-ascii?Q?uHwin/+g5Z/xXs8S8j++yAhVbZRQwsmhQ0jY7uKobD0QcI7S6d7ud04a6szw?= =?us-ascii?Q?mYO/PBGU5aK3KvEezMPtk4v7P9+zmkQynMQ20qTuV5kWs3Y2iO4OtsvTxWmm?= =?us-ascii?Q?1vgMlkqNPVQiXQeccnqm8qwDgq7HO5Dtjw4ySdbS?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SA0PR11MB4575.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4898e095-b7c5-43b2-4289-08daac28c56b X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Oct 2022 08:07:13.7000 (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: U9wR0x+JPTtnIkYRDa7sx4zSNIFptta6KpeZWT9AIpKrOPkP66jYo4sO9yDZfy6EsZSI4qunCohZPQrdpB/cdw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR11MB5831 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 > -----Original Message----- > From: Junfeng Guo > Sent: Monday, September 5, 2022 6:58 PM > To: Zhang, Qi Z ; Wu, Jingjing > ; Xing, Beilei > Cc: dev@dpdk.org; Wang, Xiao W ; Guo, Junfeng > > Subject: [PATCH v2 02/14] net/idpf/base: add logs and OS specific > implementation >=20 > Add PMD logs. > Add some MACRO definations and small functions which are specific for > DPDK. >=20 > Signed-off-by: Beilei Xing > Signed-off-by: Junfeng Guo > --- > drivers/net/idpf/base/iecm_osdep.h | 365 > +++++++++++++++++++++++++++++ > drivers/net/idpf/idpf_logs.h | 38 +++ > 2 files changed, 403 insertions(+) > create mode 100644 drivers/net/idpf/base/iecm_osdep.h > create mode 100644 drivers/net/idpf/idpf_logs.h >=20 > diff --git a/drivers/net/idpf/base/iecm_osdep.h > b/drivers/net/idpf/base/iecm_osdep.h > new file mode 100644 > index 0000000000..60e21fbc1b > --- /dev/null > +++ b/drivers/net/idpf/base/iecm_osdep.h > @@ -0,0 +1,365 @@ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Copyright(c) 2001-2022 Intel Corporation */ > + > +#ifndef _IECM_OSDEP_H_ > +#define _IECM_OSDEP_H_ > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include "../idpf_logs.h" > + > +#define INLINE inline > +#define STATIC static > + > +typedef uint8_t u8; > +typedef int8_t s8; > +typedef uint16_t u16; > +typedef int16_t s16; > +typedef uint32_t u32; > +typedef int32_t s32; > +typedef uint64_t u64; > +typedef uint64_t s64; > + > +typedef enum iecm_status iecm_status; > +typedef struct iecm_lock iecm_lock; > + > +#define __iomem > +#define hw_dbg(hw, S, A...) do {} while (0) > +#define upper_32_bits(n) ((u32)(((n) >> 16) >> 16)) > +#define lower_32_bits(n) ((u32)(n)) > +#define low_16_bits(x) ((x) & 0xFFFF) > +#define high_16_bits(x) (((x) & 0xFFFF0000) >> 16) > + > +#ifndef ETH_ADDR_LEN > +#define ETH_ADDR_LEN 6 > +#endif > + > +#ifndef __le16 > +#define __le16 uint16_t > +#endif > +#ifndef __le32 > +#define __le32 uint32_t > +#endif > +#ifndef __le64 > +#define __le64 uint64_t > +#endif > +#ifndef __be16 > +#define __be16 uint16_t > +#endif > +#ifndef __be32 > +#define __be32 uint32_t > +#endif > +#ifndef __be64 > +#define __be64 uint64_t > +#endif > + > +#ifndef __always_unused > +#define __always_unused __attribute__((__unused__)) #endif #ifndef > +__maybe_unused #define __maybe_unused __attribute__((__unused__)) > +#endif #ifndef __packed #define __packed __attribute__((packed)) > +#endif > + > +#ifndef BIT_ULL > +#define BIT_ULL(a) (1ULL << (a)) > +#endif > + > +#ifndef BIT > +#define BIT(a) (1ULL << (a)) > +#endif > + > +#define FALSE 0 > +#define TRUE 1 > +#define false 0 > +#define true 1 > + > +#define min(a, b) RTE_MIN(a, b) > +#define max(a, b) RTE_MAX(a, b) > + > +#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0])) #define > +FIELD_SIZEOF(t, f) (sizeof(((t *)0)->(f))) #define MAKEMASK(m, s) ((m) > +<< (s)) > + > +#define DEBUGOUT(S) PMD_DRV_LOG_RAW(DEBUG, S) #define > DEBUGOUT2(S, > +A...) PMD_DRV_LOG_RAW(DEBUG, S, ##A) #define DEBUGFUNC(F) > +PMD_DRV_LOG_RAW(DEBUG, F) > + > +#define iecm_debug(h, m, s, ...) \ > + do { \ > + if (((m) & (h)->debug_mask)) \ > + PMD_DRV_LOG_RAW(DEBUG, "iecm %02x.%x " s, > \ > + (h)->bus.device, (h)->bus.func, \ > + ##__VA_ARGS__); > \ > + } while (0) > + > +#define iecm_info(hw, fmt, args...) iecm_debug(hw, IECM_DBG_ALL, fmt, > +##args) #define iecm_warn(hw, fmt, args...) iecm_debug(hw, > IECM_DBG_ALL, fmt, ##args) > +#define iecm_debug_array(hw, type, rowsize, groupsize, buf, len) \ > + do { \ > + struct iecm_hw *hw_l =3D hw; \ > + u16 len_l =3D len; \ > + u8 *buf_l =3D buf; \ > + int i; \ > + for (i =3D 0; i < len_l; i +=3D 8) \ > + iecm_debug(hw_l, type, > \ > + "0x%04X 0x%016"PRIx64"\n", > \ > + i, *((u64 *)((buf_l) + i))); \ > + } while (0) > +#define iecm_snprintf snprintf > +#ifndef SNPRINTF > +#define SNPRINTF iecm_snprintf > +#endif > + > +#define IECM_PCI_REG(reg) rte_read32(reg) > +#define IECM_PCI_REG_ADDR(a, reg) \ > + ((volatile uint32_t *)((char *)(a)->hw_addr + (reg))) > +#define IECM_PCI_REG64(reg) rte_read64(reg) > +#define IECM_PCI_REG_ADDR64(a, reg) \ > + ((volatile uint64_t *)((char *)(a)->hw_addr + (reg))) > + > +#define iecm_wmb() rte_io_wmb() > +#define iecm_rmb() rte_io_rmb() > +#define iecm_mb() rte_io_mb() > + > +static inline uint32_t iecm_read_addr(volatile void *addr) { > + return rte_le_to_cpu_32(IECM_PCI_REG(addr)); > +} > + > +static inline uint64_t iecm_read_addr64(volatile void *addr) { > + return rte_le_to_cpu_64(IECM_PCI_REG64(addr)); > +} > + > +#define IECM_PCI_REG_WRITE(reg, value) \ > + rte_write32((rte_cpu_to_le_32(value)), reg) > + > +#define IECM_PCI_REG_WRITE64(reg, value) \ > + rte_write64((rte_cpu_to_le_64(value)), reg) > + > +#define IECM_READ_REG(hw, reg) > iecm_read_addr(IECM_PCI_REG_ADDR((hw), (reg))) > +#define IECM_WRITE_REG(hw, reg, value) > \ > + IECM_PCI_REG_WRITE(IECM_PCI_REG_ADDR((hw), (reg)), (value)) > + > +#define rd32(a, reg) iecm_read_addr(IECM_PCI_REG_ADDR((a), (reg))) > +#define wr32(a, reg, value) \ > + IECM_PCI_REG_WRITE(IECM_PCI_REG_ADDR((a), (reg)), (value)) > #define > +div64_long(n, d) ((n) / (d)) #define rd64(a, reg) > +iecm_read_addr64(IECM_PCI_REG_ADDR64((a), (reg))) > + > +#define BITS_PER_BYTE 8 > + > +/* memory allocation tracking */ > +struct iecm_dma_mem { > + void *va; > + u64 pa; > + u32 size; > + const void *zone; > +} __attribute__((packed)); > + > +struct iecm_virt_mem { > + void *va; > + u32 size; > +} __attribute__((packed)); > + > +#define iecm_malloc(h, s) rte_zmalloc(NULL, s, 0) > +#define iecm_calloc(h, c, s) rte_zmalloc(NULL, (c) * (s), 0) > +#define iecm_free(h, m) rte_free(m) > + > +#define iecm_memset(a, b, c, d) memset((a), (b), (c)) > +#define iecm_memcpy(a, b, c, d) rte_memcpy((a), (b), (c)) > +#define iecm_memdup(a, b, c, d) rte_memcpy(iecm_malloc(a, c), b, c) > + > +#define CPU_TO_BE16(o) rte_cpu_to_be_16(o) #define CPU_TO_BE32(o) > +rte_cpu_to_be_32(o) #define CPU_TO_BE64(o) rte_cpu_to_be_64(o) > #define > +CPU_TO_LE16(o) rte_cpu_to_le_16(o) #define CPU_TO_LE32(s) > +rte_cpu_to_le_32(s) #define CPU_TO_LE64(h) rte_cpu_to_le_64(h) #define > +LE16_TO_CPU(a) rte_le_to_cpu_16(a) #define LE32_TO_CPU(c) > +rte_le_to_cpu_32(c) #define LE64_TO_CPU(k) rte_le_to_cpu_64(k) > + > +#define NTOHS(a) rte_be_to_cpu_16(a) > +#define NTOHL(a) rte_be_to_cpu_32(a) > +#define HTONS(a) rte_cpu_to_be_16(a) > +#define HTONL(a) rte_cpu_to_be_32(a) > + > +/* SW spinlock */ > +struct iecm_lock { > + rte_spinlock_t spinlock; > +}; > + > +static inline void > +iecm_init_lock(struct iecm_lock *sp) > +{ > + rte_spinlock_init(&sp->spinlock); > +} > + > +static inline void > +iecm_acquire_lock(struct iecm_lock *sp) { > + rte_spinlock_lock(&sp->spinlock); > +} > + > +static inline void > +iecm_release_lock(struct iecm_lock *sp) { > + rte_spinlock_unlock(&sp->spinlock); > +} > + > +static inline void > +iecm_destroy_lock(__attribute__((unused)) struct iecm_lock *sp) { } > + > +struct iecm_hw; > + > +static inline void * > +iecm_alloc_dma_mem(__attribute__((unused)) struct iecm_hw *hw, > + struct iecm_dma_mem *mem, u64 size) { > + const struct rte_memzone *mz =3D NULL; > + char z_name[RTE_MEMZONE_NAMESIZE]; > + > + if (!mem) > + return NULL; > + > + snprintf(z_name, sizeof(z_name), "iecm_dma_%"PRIu64, rte_rand()); > + mz =3D rte_memzone_reserve_aligned(z_name, size, SOCKET_ID_ANY, > + RTE_MEMZONE_IOVA_CONTIG, > RTE_PGSIZE_4K); > + if (!mz) > + return NULL; > + > + mem->size =3D size; > + mem->va =3D mz->addr; > + mem->pa =3D mz->iova; > + mem->zone =3D (const void *)mz; > + memset(mem->va, 0, size); > + > + return mem->va; > +} > + > +static inline void > +iecm_free_dma_mem(__attribute__((unused)) struct iecm_hw *hw, > + struct iecm_dma_mem *mem) > +{ > + rte_memzone_free((const struct rte_memzone *)mem->zone); > + mem->size =3D 0; > + mem->va =3D NULL; > + mem->pa =3D 0; > +} > + > +static inline u8 > +iecm_hweight8(u32 num) > +{ > + u8 bits =3D 0; > + u32 i; > + > + for (i =3D 0; i < 8; i++) { > + bits +=3D (u8)(num & 0x1); > + num >>=3D 1; > + } > + > + return bits; > +} > + > +static inline u8 > +iecm_hweight32(u32 num) > +{ > + u8 bits =3D 0; > + u32 i; > + > + for (i =3D 0; i < 32; i++) { > + bits +=3D (u8)(num & 0x1); > + num >>=3D 1; > + } > + > + return bits; > +} > + > +#define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d)) #define DELAY(x) > +rte_delay_us(x) #define iecm_usec_delay(x) rte_delay_us(x) #define > +iecm_msec_delay(x, y) rte_delay_us(1000 * (x)) #define udelay(x) > +DELAY(x) #define msleep(x) DELAY(1000 * (x)) #define usleep_range(min, > +max) msleep(DIV_ROUND_UP(min, 1000)) > + > +#ifndef IECM_DBG_TRACE > +#define IECM_DBG_TRACE BIT_ULL(0) > +#endif > + > +#ifndef DIVIDE_AND_ROUND_UP > +#define DIVIDE_AND_ROUND_UP(a, b) (((a) + (b) - 1) / (b)) #endif > + > +#ifndef IECM_INTEL_VENDOR_ID > +#define IECM_INTEL_VENDOR_ID 0x8086 > +#endif > + > +#ifndef IS_UNICAST_ETHER_ADDR > +#define IS_UNICAST_ETHER_ADDR(addr) \ > + ((bool)((((u8 *)(addr))[0] % ((u8)0x2)) =3D=3D 0)) #endif > + > +#ifndef IS_MULTICAST_ETHER_ADDR > +#define IS_MULTICAST_ETHER_ADDR(addr) \ > + ((bool)((((u8 *)(addr))[0] % ((u8)0x2)) =3D=3D 1)) #endif > + > +#ifndef IS_BROADCAST_ETHER_ADDR > +/* Check whether an address is broadcast. */ > +#define IS_BROADCAST_ETHER_ADDR(addr) \ > + ((bool)((((u16 *)(addr))[0] =3D=3D ((u16)0xffff)))) #endif > + > +#ifndef IS_ZERO_ETHER_ADDR > +#define IS_ZERO_ETHER_ADDR(addr) \ > + (((bool)((((u16 *)(addr))[0] =3D=3D ((u16)0x0)))) && \ > + ((bool)((((u16 *)(addr))[1] =3D=3D ((u16)0x0)))) && \ > + ((bool)((((u16 *)(addr))[2] =3D=3D ((u16)0x0))))) #endif > + > +#ifndef LIST_HEAD_TYPE > +#define LIST_HEAD_TYPE(list_name, type) LIST_HEAD(list_name, type) > +#endif > + > +#ifndef LIST_ENTRY_TYPE > +#define LIST_ENTRY_TYPE(type) LIST_ENTRY(type) > +#endif > + > +#ifndef LIST_FOR_EACH_ENTRY_SAFE > +#define LIST_FOR_EACH_ENTRY_SAFE(pos, temp, head, entry_type, list) > \ > + LIST_FOREACH(pos, head, list) > + > +#endif > + > +#ifndef LIST_FOR_EACH_ENTRY > +#define LIST_FOR_EACH_ENTRY(pos, head, entry_type, list) \ > + LIST_FOREACH(pos, head, list) > + > +#endif > + > +#endif /* _IECM_OSDEP_H_ */ > diff --git a/drivers/net/idpf/idpf_logs.h b/drivers/net/idpf/idpf_logs.h = new > file mode 100644 index 0000000000..906aae8463 > --- /dev/null > +++ b/drivers/net/idpf/idpf_logs.h > @@ -0,0 +1,38 @@ License description is missed in this new file. > +#ifndef _IDPF_LOGS_H_ > +#define _IDPF_LOGS_H_ > + > +#include > + > +extern int idpf_logtype_init; > +extern int idpf_logtype_driver; > + > +#define PMD_INIT_LOG(level, fmt, args...) \ > + rte_log(RTE_LOG_ ## level, idpf_logtype_init, \ > + "%s(): " fmt "\n", __func__, ##args) > + > +#define PMD_INIT_FUNC_TRACE() PMD_DRV_LOG(DEBUG, " >>") > + > +#define PMD_DRV_LOG_RAW(level, fmt, args...) \ > + rte_log(RTE_LOG_ ## level, idpf_logtype_driver, \ > + "%s(): " fmt "\n", __func__, ##args) > + > +#define PMD_DRV_LOG(level, fmt, args...) \ > + PMD_DRV_LOG_RAW(level, fmt "\n", ## args) > + > +#define PMD_DRV_FUNC_TRACE() PMD_DRV_LOG(DEBUG, " >>") > + > +#ifdef RTE_LIBRTE_IDPF_DEBUG_RX > +#define PMD_RX_LOG(level, fmt, args...) \ > + RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args) #else > +#define PMD_RX_LOG(level, fmt, args...) do { } while (0) #endif > + > +#ifdef RTE_LIBRTE_IDPF_DEBUG_TX > +#define PMD_TX_LOG(level, fmt, args...) \ > + RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args) #else > +#define PMD_TX_LOG(level, fmt, args...) do { } while (0) #endif > + > +#endif /* _IDPF_LOGS_H_ */ > -- > 2.25.1