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 DD483A0C45; Fri, 24 Sep 2021 10:40:16 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 87D4D4122D; Fri, 24 Sep 2021 10:40:16 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mails.dpdk.org (Postfix) with ESMTP id EBDF140142 for ; Fri, 24 Sep 2021 10:40:14 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10116"; a="220830124" X-IronPort-AV: E=Sophos;i="5.85,319,1624345200"; d="scan'208";a="220830124" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Sep 2021 01:40:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,319,1624345200"; d="scan'208";a="455421239" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by orsmga002.jf.intel.com with ESMTP; 24 Sep 2021 01:40:11 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Fri, 24 Sep 2021 01:40:10 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12 via Frontend Transport; Fri, 24 Sep 2021 01:40:10 -0700 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.100) 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.2242.12; Fri, 24 Sep 2021 01:40:10 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PbRe+DcsH0CzS6XHbmNxxpu094ibGJZreaQdYrvkvqz4QcQRN6AD7cHGL3501BnaFBizdVP1Eg/F0WEmM49taYvjNKEwFLWomv2UyeVPYE4mdpQLaZ1OVyMWkG7qJ4K45LvMOXBzTJ21dVAvt0b0ikk69XVTPTjuhQvH3wcY3cEuIQnJoL3nh8ZhpsIJ05+ZtC18UyajVstPNkjBybxrroEoX6M1xJxabGOscN1ZZxduQTyRCwp0IQUeL0RdqZrnlWz5y7Rbuuwop2d/YTmgpDaxKcDiJcE1A2muMvAsuK+FUkULBvgSP3m6qvaPA5yR3E/SXLtcnN+rOrstrprLwg== 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=+HmfjpE6kTIydXboPgQowgrlf1A+6XQ958YSFJqxE4w=; b=nxieCN3DNkdNFIC5WU07waduavHu3riEdDxQ7q5ya8PqTeiZZIeZ8NTknsOXbpReZEspPhTfVVCgPOtWqAYjSuxAtSh1jsUr6S0NqguLlx9KOwqgVX94ZHA2cvAYLgvFghwWvtkyG5whw6AIh1ncfOOqNFt77Gk4hArWrREBIcodWsakfXsEDUTPO5ry8+DNGzhARu9hrHeLiPf4Yi4lG4YgWCn9gbeBocDN3jDay4V/pvu9eBWLNLJ58fC0ejwSfSuK1QtTIz3fK4cc39jPAqwh9N6Oh4y1Ln3VS6yyNVBopBNED6FuuMBFFGbHE7fvFXQEVaMYJB4AZcxmhlczSQ== 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=+HmfjpE6kTIydXboPgQowgrlf1A+6XQ958YSFJqxE4w=; b=LvkZ1P9yOiZIcwAf8gkhZCULS1leCNOs5FAOMVJx4o25zT52zZAuEtP2Gqq050PBNpxDO/nUTIG8FT786/SLYYq5cAKnN7iHL8HlvBZUCw4wuxApiW7jhis7E8NXXuIBoqwKgsrkmHU4Q7QWr86+nwYvVjqP4ta400/rQZ6d4yM= Authentication-Results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; Received: from SJ0PR11MB5055.namprd11.prod.outlook.com (2603:10b6:a03:2d9::10) by BYAPR11MB3175.namprd11.prod.outlook.com (2603:10b6:a03:7c::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.14; Fri, 24 Sep 2021 08:40:08 +0000 Received: from SJ0PR11MB5055.namprd11.prod.outlook.com ([fe80::78d4:6f82:aa87:c271]) by SJ0PR11MB5055.namprd11.prod.outlook.com ([fe80::78d4:6f82:aa87:c271%7]) with mapi id 15.20.4523.018; Fri, 24 Sep 2021 08:40:08 +0000 To: fengchengwen , CC: , References: <20210910172737.2561156-1-kevin.laatz@intel.com> <20210917164136.3499904-1-kevin.laatz@intel.com> <20210917164136.3499904-5-kevin.laatz@intel.com> From: Kevin Laatz Message-ID: <3311244e-2541-d871-81e7-fc6c345e4e9c@intel.com> Date: Fri, 24 Sep 2021 09:40:01 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-GB X-ClientProxiedBy: DB6P195CA0019.EURP195.PROD.OUTLOOK.COM (2603:10a6:4:cb::29) To SJ0PR11MB5055.namprd11.prod.outlook.com (2603:10b6:a03:2d9::10) MIME-Version: 1.0 Received: from [192.168.1.15] (109.78.133.43) by DB6P195CA0019.EURP195.PROD.OUTLOOK.COM (2603:10a6:4:cb::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.15 via Frontend Transport; Fri, 24 Sep 2021 08:40:06 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 90612e59-d926-4de9-574c-08d97f36e9d4 X-MS-TrafficTypeDiagnostic: BYAPR11MB3175: 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:9508; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1byk37QWC0tDk8K1qPTJzFR36u104wZllL4GliZf/nZsYGWw6XRYP9NP3pl2bC2B91WgEz0CRETyLW9pmuWa+2CyGSodY1AQE5UfOB0nr3bWHHVagQ5U5COZglf9Uj9eZVL4Tixrelf0/ExbakHBcgARK0v6MqYl6TxFRIrcu0vVdqaoR5SF46M8y1twnZx7nJkVUnM6hsKRN0MCx51+RH7sum2Xw3VX7GzDenSf33jf7UXgYCQz/B7JwOsJMmN5lAkp0yMgvfsZvn1fC58gLvkUYMEKpni8QQdn3Bay+e0RDXCaqRDV1r9vZvYvbtMQWX4hBnv6vR5IMA4UCG9H5Dr04WsysgYgGcPZbPRQbQ0SYszsmlUHJ+kLsUAOebZll4EOo/EqCYNARpz1mZl3YcoKTZ9sz5PQpbtywQG9Nx8unhu/OOzuiH3Zkhn9YMWjha/Y4NLfHSrez9UyJ6/ZNuvuKsub1EofSp/N/DV0i0zrMqeRKQKV6eOi6Hq2fqcDRp5TWoNQDtK96+eZfMUcXSCyPHjn8U8tXD6bdgyZDJHdXcAsPSpGoIzfPvoqTQJNfZLtwK1tMczqdnmIXatdg0fU58L8wXQUs2nyozKE1tXvjFX7MPy2yUpDh+pILIzuBowwJ3v4WXrAx3iZhegltKXT05LVIooi3bISu2gCs3TJf8A+iF6bfHsXWt88IdwgHmj+7i5bc5GLFWLUyGbjvUdh8o04qzoWIxnLc+AGQ0Q= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR11MB5055.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(6486002)(86362001)(36756003)(26005)(66556008)(186003)(83380400001)(8676002)(44832011)(31686004)(956004)(66946007)(6666004)(16576012)(5660300002)(2616005)(2906002)(38100700002)(53546011)(8936002)(508600001)(107886003)(316002)(31696002)(66476007)(4326008)(43740500002)(45980500001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?cHhrT2JxdlNZTDhFSDVYMFk1ays5RDBDOGd2M0xpU0JXVFkyeElTOVlNWnBn?= =?utf-8?B?WHN6cFUzbzBIWFFTdDgrV1dZM1BzRUd4T2NxRURFL0xUSG1rWE8zdktNamJT?= =?utf-8?B?bU1MbjUxaENuZWp5OXQzNW1QMEpCSUhubGNHd1ZzalJFc3grMmtWY0Ewc3ll?= =?utf-8?B?dVl3bm83SFpTMGJUdHBBTlBFcklBUHRnSUVNcUdJOXBDWExwT21keWlFUDBY?= =?utf-8?B?Z3VPTUNzblpyRHNBb1F1TElkTFJQRjZnbkh1bE9wUFhWMVY5QzhNK3N1UXJC?= =?utf-8?B?TGhneXdBUkZ6M0kyYzQxMkxCVUw1Wm9CZUhqUXBQUzExdzV0czlkcjQyRk05?= =?utf-8?B?SkxhdDkyUmxvdlE4NTl5K0dsVGp0Nk81ZHRRNmV1V3dCSkFzdFg1WUV1T2Ew?= =?utf-8?B?YU95aTEvWXU5SFZGK0U3NmVvcWJwaUh3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b2Z1aXkweENQb2t3NXhmT2FUUXpLNkVkRGdVaU5HYVoyTmhi?= =?utf-8?B?Y0FuSjI4OHIzVzQwRnJIU0pkWUhrOVNkc2phR2MyL1hON3cycWdwN3VOYWJK?= =?utf-8?B?S2VVNkxrVGhoemFjUHFBU3Z3aWt0cG9xMW1ncDMwbktkRWc2RE9YRkMwMHdy?= =?utf-8?B?Wk1zcDdzNWZsd2ZSK2h3R2pvTkdKUm5HQWp5QlRlTTBYOUM5bzNSWCszNkVS?= =?utf-8?B?RnVYMWF1UDZxYUNyTGJjR01VYXRvQnYvaXFrRlJ3V1k4YXRsWm8yQmJPQ1dO?= =?utf-8?B?OFNUTjZOK0NZQ3hqYnk1RlduTnNqaGhIZElCRmpKSHZEVC9ka2xzM3BLMS95?= =?utf-8?B?NldSRlhXT1ArcC9kdUV4UitpYXJzaGJES0RCWkJ3cTNGWEFOVXFNUWRrQTUx?= =?utf-8?Q?++aSSncdY9O1MZue/wIdADw/P5SqzWNaIef7uVr?= X-MS-Exchange-CrossTenant-Network-Message-Id: 90612e59-d926-4de9-574c-08d97f36e9d4 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR11MB5055.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Sep 2021 08:40:07.9456 (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: WVFoGy3eb5nIEjgMMZOKClmVygzq4vH2qrRFTeObai0CYkIYWW36PH0xi+oxo2tQpAEbPRlK+kbAH2XDWtxkRw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB3175 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v2 4/6] examples/ioat: port application to dmadev APIs 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 24/09/2021 05:00, fengchengwen wrote: > On 2021/9/18 0:41, Kevin Laatz wrote: >> The dmadev library abstraction allows applications to use the same APIs for >> all DMA device drivers in DPDK. This patch updates the ioatfwd application >> to make use of the new dmadev APIs, in turn making it a generic application >> which can be used with any of the DMA device drivers. >> >> Signed-off-by: Kevin Laatz >> >> --- >> v2: >> - dmadev api name updates following rebase >> - use rte_config macro for max devs >> - use PRIu64 for printing stats >> --- >> examples/ioat/ioatfwd.c | 239 ++++++++++++++++---------------------- >> examples/ioat/meson.build | 8 +- >> 2 files changed, 105 insertions(+), 142 deletions(-) >> > [snip] > >> >> typedef enum copy_mode_t { >> @@ -95,6 +94,16 @@ static copy_mode_t copy_mode = COPY_MODE_IOAT_NUM; >> */ >> static unsigned short ring_size = 2048; >> >> +/* global mbuf arrays for tracking DMA bufs */ >> +#define MBUF_RING_SIZE 1024 >> +#define MBUF_RING_MASK (MBUF_RING_SIZE - 1) >> +struct dma_bufs { >> + struct rte_mbuf *bufs[MBUF_RING_SIZE]; >> + struct rte_mbuf *copies[MBUF_RING_SIZE]; >> + uint16_t sent; >> +}; > The dma_bufs size only hold 1024 address info, and the dmadev virtual channel ring size is 2048 default, > If the DMA cannot be moved in time, may exist overlay in dma_bufs in dma_dequeue() API. Will match the dmadev lib default in v3. > >> +static struct dma_bufs dma_bufs[RTE_DMADEV_DEFAULT_MAX_DEVS]; >> + >> /* global transmission config */ >> struct rxtx_transmission_config cfg; > [snip] > >> } >> /* >8 End of configuration of device. */ >> >> @@ -820,18 +789,16 @@ assign_rawdevs(void) >> >> for (i = 0; i < cfg.nb_ports; i++) { >> for (j = 0; j < cfg.ports[i].nb_queues; j++) { >> - struct rte_rawdev_info rdev_info = { 0 }; >> + struct rte_dma_info dmadev_info = { 0 }; >> >> do { >> - if (rdev_id == rte_rawdev_count()) >> + if (rdev_id == rte_dma_count_avail()) >> goto end; >> - rte_rawdev_info_get(rdev_id++, &rdev_info, 0); >> - } while (rdev_info.driver_name == NULL || >> - strcmp(rdev_info.driver_name, >> - IOAT_PMD_RAWDEV_NAME_STR) != 0); >> + rte_dma_info_get(rdev_id++, &dmadev_info); >> + } while (!rte_dma_is_valid(rdev_id)); >> >> - cfg.ports[i].ioat_ids[j] = rdev_id - 1; >> - configure_rawdev_queue(cfg.ports[i].ioat_ids[j]); >> + cfg.ports[i].dmadev_ids[j] = rdev_id - 1; >> + configure_rawdev_queue(cfg.ports[i].dmadev_ids[j]); > Tests show that if there are four dmadevs, only three dmadevs can be allocated here. > > 1st malloc: rdev_id=0, assign successful, and the dmadev_id=0, rdev_id=1 > 2st malloc: rdev_id=1, assign successful, and the dmadev_id=1, rdev_id=2 > 3st malloc: rdev_id=2, assign successful, and the dmadev_id=2, rdev_id=3 > 4st malloc: rdev_id=3, assign failed, because rte_dma_info_get(rdev_id++,...), the rdev_id is 4 and it's not a valid id. > > Recommended use rte_dma_next_dev() which Bruce introduced. Ack, will use rte_dma_next_dev() in v3. Thanks! >> ++nb_rawdev; >> } >> } >> @@ -840,7 +807,7 @@ assign_rawdevs(void) >> rte_exit(EXIT_FAILURE, >> "Not enough IOAT rawdevs (%u) for all queues (%u).\n", >> nb_rawdev, cfg.nb_ports * cfg.ports[0].nb_queues); >> - RTE_LOG(INFO, IOAT, "Number of used rawdevs: %u.\n", nb_rawdev); >> + RTE_LOG(INFO, DMA, "Number of used rawdevs: %u.\n", nb_rawdev); >> } >> /* >8 End of using IOAT rawdev API functions. */ >> > [snip] >