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 C8BF7A0C45; Wed, 22 Sep 2021 18:42:30 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 49A7A41208; Wed, 22 Sep 2021 18:42:27 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mails.dpdk.org (Postfix) with ESMTP id 4917C411F9 for ; Wed, 22 Sep 2021 18:42:24 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10115"; a="203795843" X-IronPort-AV: E=Sophos;i="5.85,314,1624345200"; d="scan'208";a="203795843" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Sep 2021 09:40:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,314,1624345200"; d="scan'208";a="435498606" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by orsmga006.jf.intel.com with ESMTP; 22 Sep 2021 09:40:52 -0700 Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) 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.2242.12; Wed, 22 Sep 2021 09:40:52 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx612.amr.corp.intel.com (10.22.229.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12 via Frontend Transport; Wed, 22 Sep 2021 09:40:52 -0700 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (104.47.55.170) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.12; Wed, 22 Sep 2021 09:40:51 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NSqlPRURTgEtIc6XTXi0DE8U+tjfxt/qv4s9HBC4Pb+g0VfvD8Vk0nizS96EHgvYjToYxFyYYFvrVLOVgKZpzoz27QrrxzFzmukaiTyfLbxyepe/sSOkLnyarydz4T9DXr8WwerDXll9JaCb9klpNxd//ebYUeToEv51hOjc0BnNPMSrzxFd7aqjmvCgA9ZQmFAxkFiUvPXyK4b+F2i7yY35S6tGSDqTAr0PTHjav8iPfMCkEQnmJnY+yu9amuZaE6onWUPS/JntYy5BBxl8yLcrZjbiLA0n/jUc2J+4/5nxytoimV0n5DxTHVlyydAN7tEX4PMQ5gDNX1H+AmfJbA== 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; bh=UMM67Emzeqa2WXM/Na+KkesV4eUyjKeQ0RzL1eaXgOA=; b=dNTzXdQThswfJtsGSukbdjvCflt7pPmxXFA3A2G1rAhREubo5zIuV7Uh4HhtbJF9ewfb4oS3LnEO83ylQwVcEYwIsbYH/Hg6TBzw0Ny6N5g/vqaUcb2PpC6oOkbpsmQpcRPms/CpiZccqkuI0hq1DQRRDByzGVSuMnKDALuZ+9Dl9SemYiHpO4o2VxFU1oHg4E2RY7IrT8Wjn0fM1P3uAKtZ2NZjpW/9mnx/H464KoKKLPz9peNgCWtREWXEKyLYtPLmKwUHuZYVgzb8wa1eAVfGuWE6qiSRqlzWj7kzRPXJFoxX1GG2ZqihI9rdP+6hWX1U5KflbDNp7bfpa5teHA== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UMM67Emzeqa2WXM/Na+KkesV4eUyjKeQ0RzL1eaXgOA=; b=Z3BlhAZb78zmuRR8vKSW1tPhkGdSfUDzEIImlp2RI8z7iGXFfj35uJqKSX6Xq1oLKNo7oY1SZkiQGOuzDo5lZNC2trXOT4NkCKAEpcScNuA0FRuKL4OTAibQvZHK8tQtz8/ypVdVkbDK7MCACr8uVIa8jUMrj9foN91pW5XMxmU= Authentication-Results: dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=none action=none header.from=intel.com; Received: from PH0PR11MB5207.namprd11.prod.outlook.com (2603:10b6:510:32::15) by PH0PR11MB5045.namprd11.prod.outlook.com (2603:10b6:510:3f::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.14; Wed, 22 Sep 2021 16:40:48 +0000 Received: from PH0PR11MB5207.namprd11.prod.outlook.com ([fe80::9578:a4b5:2716:fbaa]) by PH0PR11MB5207.namprd11.prod.outlook.com ([fe80::9578:a4b5:2716:fbaa%6]) with mapi id 15.20.4544.014; Wed, 22 Sep 2021 16:40:48 +0000 To: fengchengwen , , , CC: References: <20210827172550.1522362-1-conor.walsh@intel.com> <20210917154227.737554-1-conor.walsh@intel.com> <20210917154227.737554-3-conor.walsh@intel.com> <796b4e65-16a1-d530-59ba-e59a18d92633@huawei.com> From: Conor Walsh Message-ID: <5ccabcbb-23e1-41eb-91f2-6012527b312f@intel.com> Date: Wed, 22 Sep 2021 17:40:42 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 In-Reply-To: <796b4e65-16a1-d530-59ba-e59a18d92633@huawei.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-ClientProxiedBy: DB8P191CA0007.EURP191.PROD.OUTLOOK.COM (2603:10a6:10:130::17) To PH0PR11MB5207.namprd11.prod.outlook.com (2603:10b6:510:32::15) MIME-Version: 1.0 Received: from [192.168.1.20] (109.79.118.85) by DB8P191CA0007.EURP191.PROD.OUTLOOK.COM (2603:10a6:10:130::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.15 via Frontend Transport; Wed, 22 Sep 2021 16:40:47 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e8a6bd76-d714-4293-31de-08d97de7bb41 X-MS-TrafficTypeDiagnostic: PH0PR11MB5045: X-LD-Processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3276; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: oBe0Wm3523sqXuf54PB3SVjSWIHFHUJsZ5D7t5q1eVVO7BMYh/aq5SzL5TAMaLXLMMSNUwSS4tKw1jbNjhwyl6t0l2pcKw++SKZ/NDdXgdnZleGrJNbpONBkerm7DefFmA0Q/sX4L3MNxG/jsJPjHjqb9zXrinJbpzDx2v3wjZ8A9XwIw0xCJ7F4NB0IFfUcjOPq3iaCVA/p8AMPrkdDvBT+1Pbzh+zdNsXqSB/NUUACTl+hvW+Q5s3V7OSWpbTmLniguaU8THuUm3tnSuSJfaNij9gBbZNkN8eZ8ncvD3IrS6djYG1gJTKTjjHczdJuTGV7SXo+f4GPZYapzn8CuK1wAQI/G+POor43lPX4cCU7L5L8AQPCTRzdwKuTxX/rpV2Z3SEVMFuYMLyHNlNrGZ7mhEkwbQDg4TNqPUedrTwxkPJgWTYiugElblOzlFPjsogOh7j5jq+K32jyAS+FMl6i1+TIMjDxGry6t8ee0BlCxbVzTRiBnnWOUmAak073N5yaFwBXgvnxVW3N/9ykUsHXi4kuPuL/GdhgOFYSJsLGUECQzfHX7rE2OOATCTQRh3WjBJ6lEktjPvHOZt3L7IVhCXp6SAE5QoMKlxGB9zURew+MCZFgYt7Aj6yHqkekTY6bG6IqqBZmsC30OKpo+QiBej0hdrhjtHdaEcqomvBv98lE4EcnJA+prdC1rTwPIuOqt6MxbyWPb0XkzdLa66Jew6tOPRmhLWYCzY6uJ8Q= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH0PR11MB5207.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(8936002)(2616005)(186003)(2906002)(26005)(4326008)(38100700002)(31686004)(66476007)(956004)(66556008)(66946007)(6636002)(8676002)(36756003)(508600001)(83380400001)(86362001)(5660300002)(53546011)(6486002)(316002)(6666004)(44832011)(16576012)(31696002)(45980500001)(43740500002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?MkQzek9INExtd2tqVjZuTHlzeVIvczV0bHRDcEVIVzVJdXBzS0FEWDdJbmJz?= =?utf-8?B?a3ROMDF3ZTVRTTU1OFp3VXZ6bU4xV3ZJUCtjWW9yU2FsNy9ZNHhaOVFhREZr?= =?utf-8?B?RFM5RkcyN21Pb1RhTEJBMEVZSWNIOEFvNkdPQlBBY21BSm1HWXkzdWFheHg2?= =?utf-8?B?a0EyaWNPZVJnd3A4QzdIeVovOTBjaThIUFdKaWlWT0hYVStUZjk1ZDJPZlpr?= =?utf-8?B?MEpwdFNxSGlxWHgyQ3NkWFRYbXpLc096dG1QYzcvcWdwK0NxZTdKVEFtZUNB?= =?utf-8?B?cGJYaTJUK0dkUXV0aVFvSk9rcHpid2ZSVEdtVGtOb2FOQkhDbVdrdVAxL3dm?= =?utf-8?B?U2RmWDJybmhrcjNvekdpWmZJZ0VBTEhlQ01adnhGaTBiT3IxSUJNVzl5VmFN?= =?utf-8?B?RFA0THpCMnBtOVJlcjY2NHZUQWY1TkRVdzVxTDdzd3V1UDZxenpYWmo3ajNY?= =?utf-8?B?cGZZc21WMHlZbE0xRnFHc2dIajFTRGdES29zMjRrWXpwcHU5bkZYcTMyc25H?= =?utf-8?B?Y3ZyOTRtTVlCY2lNaFJiZWNTODZyNkhXK2kwWmlBeEdyeXdDVFlDV3pJTGww?= =?utf-8?B?WnFoanVJSE11N21VVkYrSitMYVBYRDdkejIzcHpmc0U5WXNOZVB3cUVvUGxH?= =?utf-8?B?T0cxbWg1czdxYWM3UDB4elRETjF2MWNvcllVdFV0c2Z0dTBweUV2UTVtWnF2?= =?utf-8?B?WVZPVTE5U3NJQzF2cDNoTlhiRGlva1ZGcFJMU2JCQW9DN0ZZOVVNRFJMeTNn?= =?utf-8?B?d1lkUTBwZVZKaDR2UUxsWVdrUllQV1VzdGpzdUNJZFFWK3ZGYmxsREF6ci85?= =?utf-8?B?SWxVSEZtM0JhNC9BN0dDRzBVaXAzeFVIQkJ0NWNndjdQYmNFTE1vU1FYbTVz?= =?utf-8?B?N3c5WTJXWEYvZWprMlJUY09BSkJmSy9OUnZqNERzQUhYTFoyRUhzb2lETlQ1?= =?utf-8?B?M2pNUURJNXFhMFdRWGwrK2FjMkluWlBrcG5yZWs3cTZHK2FsbDlaK1ZQTFhF?= =?utf-8?B?SUxEM21hZ2pFclNjVC9UTlNiTk4xbVhjTjU5bnBSOEU4OVE0NTVmNHR4Z09m?= =?utf-8?B?cVhYcEtIWUs5NUFNV083WW1OTnQvaUk3L3ZTSnFFZUFIREdKL1NYdk41MjZB?= =?utf-8?B?TUxjT2oydmdrY3pSU1Jzd1F0d1NJa2Q3ajFVS0I0U0VBd2tkYm1DVmpmQUVz?= =?utf-8?B?d3JpOXZ0QnptR1FUSlJraDhpUnZ2TjJxZmU4OWhCdFBsUkpETG5SS1JxWUlM?= =?utf-8?B?RitXeWttR01zTUFZRTIwM0tBMGhNNW1uQk5nTFExays1Q013M1NjeE5vTFR3?= =?utf-8?B?VmYwUVBkekx1b2JvYlAwL2VZZEFCWEhjWG9NT3orNjBuVHZFUE1QYStYUys5?= =?utf-8?B?RXZBaG0vQ2x2eVl2SU1xY3h2NjVUc0VnbTc0TVZZenZwVGUwalhFUHQyRWxQ?= =?utf-8?B?MmRDODFBbEFyMncwVlA5Vk9mTnNlOVFIV1JaR2ExQlBkUjdOTlE3MEJtN0VT?= =?utf-8?B?NDhXZ1ZCTnBnaDBIZzV1c3VXMGdnUUxhZC9rQ2RRQ2c0TjY1cTMxWTV3NlRm?= =?utf-8?B?U1BtS29ncHRZaDI3aUxQTVRsSFpJN1NvcWxXOUY1ZGFwSStaSmlJc0VzaG9u?= =?utf-8?B?dzJLL2R0T0V6ZXpveWErZ2FiMW1jeUxlZDRGcCsxWFJpMlVna0tMKzJJYkNp?= =?utf-8?B?MVBHWFpwNnk3cUZrOTFTd2x6NENiSGtmaDJwZlM2SUo3ZmJyOHRsR1BRQjdp?= =?utf-8?Q?24IYDHR/4ADpQpzfHxmlqiMrGDVpuZoggPUn1N6?= X-MS-Exchange-CrossTenant-Network-Message-Id: e8a6bd76-d714-4293-31de-08d97de7bb41 X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB5207.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2021 16:40:48.3509 (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: +CpzJoacoeplFPdUhDvzQ6wg/2iP0qFg492GpX79M7uhRYZvyhDePckbRhyE+3KHAqVV+/MAjUPXh7znWK1+1w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR11MB5045 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v4 02/11] dma/ioat: create dmadev instances on PCI probe 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 Sender: "dev" On 22/09/2021 09:04, fengchengwen wrote: > On 2021/9/17 23:42, Conor Walsh wrote: >> When a suitable device is found during the PCI probe, create a dmadev >> instance for each channel. Internal structures and HW definitions required >> for device creation are also included. >> >> Signed-off-by: Conor Walsh >> Reviewed-by: Kevin Laatz >> --- >> drivers/dma/ioat/ioat_dmadev.c | 119 ++++++++++++++++++++++++++++++- >> drivers/dma/ioat/ioat_hw_defs.h | 45 ++++++++++++ >> drivers/dma/ioat/ioat_internal.h | 24 +++++++ >> 3 files changed, 186 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/dma/ioat/ioat_dmadev.c b/drivers/dma/ioat/ioat_dmadev.c >> index f3491d45b1..b815d30bcf 100644 >> --- a/drivers/dma/ioat/ioat_dmadev.c >> +++ b/drivers/dma/ioat/ioat_dmadev.c >> @@ -4,6 +4,7 @@ >> >> #include >> #include >> +#include >> >> #include "ioat_internal.h" >> >> @@ -14,6 +15,120 @@ RTE_LOG_REGISTER_DEFAULT(ioat_pmd_logtype, INFO); >> #define IOAT_PMD_NAME dmadev_ioat >> #define IOAT_PMD_NAME_STR RTE_STR(IOAT_PMD_NAME) >> >> +/* Create a DMA device. */ >> +static int >> +ioat_dmadev_create(const char *name, struct rte_pci_device *dev) >> +{ >> + static const struct rte_dma_dev_ops ioat_dmadev_ops = { }; >> + >> + struct rte_dma_dev *dmadev = NULL; >> + struct ioat_dmadev *ioat = NULL; >> + int retry = 0; >> + >> + if (!name) { >> + IOAT_PMD_ERR("Invalid name of the device!"); >> + return -EINVAL; >> + } >> + >> + /* Allocate device structure. */ >> + dmadev = rte_dma_pmd_allocate(name, dev->device.numa_node, >> + sizeof(dmadev->dev_private)); >> + if (dmadev == NULL) { >> + IOAT_PMD_ERR("Unable to allocate dma device"); >> + return -ENOMEM; >> + } >> + >> + dmadev->device = &dev->device; >> + >> + dmadev->data->dev_private = rte_malloc_socket(NULL, sizeof(*ioat), >> + 0, dmadev->device->numa_node); >> + dmadev->dev_private = dmadev->data->dev_private; > The dmalib will malloc dev_private, so please invoke like: > dmadev = rte_dma_pmd_allocate(name, dev->device.numa_node, sizeof(*ioat)); I will update this in v5. >> + dmadev->dev_ops = &ioat_dmadev_ops; >> + >> + ioat = dmadev->data->dev_private; >> + ioat->dmadev = dmadev; >> + ioat->regs = dev->mem_resource[0].addr; >> + ioat->doorbell = &ioat->regs->dmacount; >> + ioat->qcfg.nb_desc = 0; >> + ioat->desc_ring = NULL; >> + >> + /* Do device initialization - reset and set error behaviour. */ >> + if (ioat->regs->chancnt != 1) >> + IOAT_PMD_WARN("%s: Channel count == %d\n", __func__, >> + ioat->regs->chancnt); >> + >> + /* Locked by someone else. */ >> + if (ioat->regs->chanctrl & IOAT_CHANCTRL_CHANNEL_IN_USE) { >> + IOAT_PMD_WARN("%s: Channel appears locked\n", __func__); >> + ioat->regs->chanctrl = 0; >> + } >> + >> + /* clear any previous errors */ >> + if (ioat->regs->chanerr != 0) { >> + uint32_t val = ioat->regs->chanerr; >> + ioat->regs->chanerr = val; >> + } >> + >> + ioat->regs->chancmd = IOAT_CHANCMD_SUSPEND; >> + rte_delay_ms(1); >> + ioat->regs->chancmd = IOAT_CHANCMD_RESET; >> + rte_delay_ms(1); >> + while (ioat->regs->chancmd & IOAT_CHANCMD_RESET) { >> + ioat->regs->chainaddr = 0; >> + rte_delay_ms(1); >> + if (++retry >= 200) { >> + IOAT_PMD_ERR("%s: cannot reset device. CHANCMD=%#"PRIx8 >> + ", CHANSTS=%#"PRIx64", CHANERR=%#"PRIx32"\n", >> + __func__, >> + ioat->regs->chancmd, >> + ioat->regs->chansts, >> + ioat->regs->chanerr); > please release the dmadev. Will add in v5. >> + return -EIO; >> + } >> + } >> + ioat->regs->chanctrl = IOAT_CHANCTRL_ANY_ERR_ABORT_EN | >> + IOAT_CHANCTRL_ERR_COMPLETION_EN; >> + > please change dmadev state to RTE_DMA_DEV_READY. I will add this in v5. >> + return 0; >> + >> +} >> + >> +/* Destroy a DMA device. */ >> +static int >> +ioat_dmadev_destroy(const char *name) >> +{ >> + struct rte_dma_dev *dev; >> + struct ioat_dmadev *ioat; >> + int ret; >> + >> + if (!name) { >> + IOAT_PMD_ERR("Invalid device name"); >> + return -EINVAL; >> + } >> + >> + dev = &rte_dma_devices[rte_dma_get_dev_id(name)]; >> + if (!dev) { >> + IOAT_PMD_ERR("Invalid device name (%s)", name); >> + return -EINVAL; >> + } >> + >> + ioat = dev->dev_private; >> + if (!ioat) { >> + IOAT_PMD_ERR("Error getting dev_private"); >> + return -EINVAL; >> + } >> + >> + dev->dev_private = NULL; >> + rte_free(ioat->desc_ring); >> + >> + ret = rte_dma_pmd_release(name); >> + if (ret) >> + IOAT_PMD_DEBUG("Device cleanup failed"); > driver only need call rte_dma_pmd_relese, and the dev_private will freed > in dmalib. I have removed the "dev->dev_private = NULL;" line for v5, that was probably stopping the free in the lib. > >> + return 0; >> +} >> + >> /* Probe DMA device. */ >> static int >> ioat_dmadev_probe(struct rte_pci_driver *drv, struct rte_pci_device *dev) >> @@ -24,7 +139,7 @@ ioat_dmadev_probe(struct rte_pci_driver *drv, struct rte_pci_device *dev) >> IOAT_PMD_INFO("Init %s on NUMA node %d", name, dev->device.numa_node); >> >> dev->device.driver = &drv->driver; >> - return 0; >> + return ioat_dmadev_create(name, dev); >> } >> >> /* Remove DMA device. */ >> @@ -38,7 +153,7 @@ ioat_dmadev_remove(struct rte_pci_device *dev) >> IOAT_PMD_INFO("Closing %s on NUMA node %d", >> name, dev->device.numa_node); >> >> - return 0; >> + return ioat_dmadev_destroy(name); >> } >> >> static const struct rte_pci_id pci_id_ioat_map[] = { >> diff --git a/drivers/dma/ioat/ioat_hw_defs.h b/drivers/dma/ioat/ioat_hw_defs.h >> index eeabba41ef..73bdf548b3 100644 >> --- a/drivers/dma/ioat/ioat_hw_defs.h >> +++ b/drivers/dma/ioat/ioat_hw_defs.h >> @@ -11,6 +11,8 @@ extern "C" { >> >> #include >> >> +#define IOAT_PCI_CHANERR_INT_OFFSET 0x180 >> + >> #define IOAT_VER_3_0 0x30 >> #define IOAT_VER_3_3 0x33 >> >> @@ -28,6 +30,49 @@ extern "C" { >> #define IOAT_DEVICE_ID_BDXF 0x6f2F >> #define IOAT_DEVICE_ID_ICX 0x0b00 >> >> +#define IOAT_COMP_UPDATE_SHIFT 3 >> +#define IOAT_CMD_OP_SHIFT 24 >> + >> +/* DMA Channel Registers */ >> +#define IOAT_CHANCTRL_CHANNEL_PRIORITY_MASK 0xF000 >> +#define IOAT_CHANCTRL_COMPL_DCA_EN 0x0200 >> +#define IOAT_CHANCTRL_CHANNEL_IN_USE 0x0100 >> +#define IOAT_CHANCTRL_DESCRIPTOR_ADDR_SNOOP_CONTROL 0x0020 >> +#define IOAT_CHANCTRL_ERR_INT_EN 0x0010 >> +#define IOAT_CHANCTRL_ANY_ERR_ABORT_EN 0x0008 >> +#define IOAT_CHANCTRL_ERR_COMPLETION_EN 0x0004 >> +#define IOAT_CHANCTRL_INT_REARM 0x0001 >> + >> +struct ioat_registers { >> + uint8_t chancnt; >> + uint8_t xfercap; >> + uint8_t genctrl; >> + uint8_t intrctrl; >> + uint32_t attnstatus; >> + uint8_t cbver; /* 0x08 */ >> + uint8_t reserved4[0x3]; /* 0x09 */ >> + uint16_t intrdelay; /* 0x0C */ >> + uint16_t cs_status; /* 0x0E */ >> + uint32_t dmacapability; /* 0x10 */ >> + uint8_t reserved5[0x6C]; /* 0x14 */ >> + uint16_t chanctrl; /* 0x80 */ >> + uint8_t reserved6[0x2]; /* 0x82 */ >> + uint8_t chancmd; /* 0x84 */ >> + uint8_t reserved3[1]; /* 0x85 */ >> + uint16_t dmacount; /* 0x86 */ >> + uint64_t chansts; /* 0x88 */ >> + uint64_t chainaddr; /* 0x90 */ >> + uint64_t chancmp; /* 0x98 */ >> + uint8_t reserved2[0x8]; /* 0xA0 */ >> + uint32_t chanerr; /* 0xA8 */ >> + uint32_t chanerrmask; /* 0xAC */ >> +} __rte_packed; >> + >> +#define IOAT_CHANCMD_RESET 0x20 >> +#define IOAT_CHANCMD_SUSPEND 0x04 >> + >> +#define IOAT_CHANCMP_ALIGN 8 /* CHANCMP address must be 64-bit aligned */ >> + >> #ifdef __cplusplus >> } >> #endif >> diff --git a/drivers/dma/ioat/ioat_internal.h b/drivers/dma/ioat/ioat_internal.h >> index f1ec12a919..a4e323f360 100644 >> --- a/drivers/dma/ioat/ioat_internal.h >> +++ b/drivers/dma/ioat/ioat_internal.h >> @@ -7,6 +7,30 @@ >> >> #include "ioat_hw_defs.h" >> >> +struct ioat_dmadev { >> + struct rte_dma_dev *dmadev; > maybe the rte_dma_dev_data more appropriate if support multi-process. Changed for v5. >> + struct rte_dma_vchan_conf qcfg; >> + struct rte_dma_stats stats; >> + >> + volatile uint16_t *doorbell __rte_cache_aligned; >> + phys_addr_t status_addr; >> + phys_addr_t ring_addr; >> + >> + struct ioat_dma_hw_desc *desc_ring; >> + >> + unsigned short next_read; >> + unsigned short next_write; >> + unsigned short last_write; /* Used to compute submitted count. */ >> + unsigned short offset; /* Used after a device recovery when counts -> 0. */ >> + unsigned int failure; /* Used to store chanerr for error handling. */ >> + >> + /* To report completions, the device will write status back here. */ >> + volatile uint64_t status __rte_cache_aligned; >> + >> + /* Pointer to the register bar. */ >> + volatile struct ioat_registers *regs; >> +}; >> + >> extern int ioat_pmd_logtype; >> >> #define IOAT_PMD_LOG(level, fmt, args...) rte_log(RTE_LOG_ ## level, \ >>