Received: by 10.192.165.156 with SMTP id m28csp890769imm; Tue, 17 Apr 2018 23:33:43 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/jhxvzZ0mDOKZiD4rFP45aXyvEhK4b9POUX9GKd1Q/Z+mzzOn4yvUqqDyJjAez31xITLhj X-Received: by 10.98.201.137 with SMTP id l9mr812360pfk.221.1524033222976; Tue, 17 Apr 2018 23:33:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524033222; cv=none; d=google.com; s=arc-20160816; b=scN2DKDiiZ5MlOxEvGCHVMrX+J1QB/QtOJJ4nZ6+yJVKJmuyInaVXUlbEyj9DKpiir Q12mfpH+v5FUoQ7u1L5WIkg1yzXEvTn08CjnDMuv1LiIHRjc2JfKewdEaXN4PvnmEwl8 SozWk85QJP2tfbhQg8EBaC9y75bEomm2xxzDlL+lOEJOgTGPqxpiM38EKZYGUraraZii AqrpVCWoEjQtX5g+JqzIXsJdi/7LuNh5Zp/GR6mRr39PlthFS0VbYH6eYcp7fmL2PpMV AN+2xUBfr6Be9CdRsJqwauu1Yr3p0Ok9jfeWv2J1NoNQWYPjuyl+zSg8pVqGGiI7tM3X OYKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=WyvFPHwi1KwXN7hi9oeYeDL9WwRC+d/+mLH+KDudg8g=; b=quwca5kD29wDoTl5sU1IEwDAnX0GkNIN57Q25BJPU8kfKaDtx1Gq43BVAJFz+ksX7F +6pI/VUFmg3Fx5Mz9XW3XxVRpRjzme35+vqwsAfoJuglchV9vgIX7GPHs4gqUn3VUwqp NpTzB4VkLBDMtWbNC2jpfYQrSgJgRpafE11AqBpP28/dLj/n5nIpHI3Vq3qY0oV/Bga4 Lfr4K6W+6AwLDB3i5xcd83F+t18p2teVIN481J7fODgX6Cbibe3a2fMSjWcdLY6hOHv0 jAgTsdHLewybv4kcgkxOff/zco3Qgdr2KWk9dRisAKF5VdOwkXx/EqR/9pw6aAAdr8Ae VyBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=AUjlNs4Y; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f10-v6si622994pln.359.2018.04.17.23.33.29; Tue, 17 Apr 2018 23:33:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=AUjlNs4Y; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752765AbeDRGbt (ORCPT + 99 others); Wed, 18 Apr 2018 02:31:49 -0400 Received: from lelnx193.ext.ti.com ([198.47.27.77]:40159 "EHLO lelnx193.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752597AbeDRGbr (ORCPT ); Wed, 18 Apr 2018 02:31:47 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by lelnx193.ext.ti.com (8.15.1/8.15.1) with ESMTP id w3I6VFXB021251; Wed, 18 Apr 2018 01:31:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1524033075; bh=6nP8ID3Ez8P0WacQafnO7YMCvCE4jzRZ2wSU8knpnps=; h=Subject:To:CC:References:From:Date:In-Reply-To; b=AUjlNs4YTksPIPHV88PCKIt0NThi3yUlYTEK00ycDV3AX5sgfJ9W6QxHAWU3JkJKV YlCAW4WWN1+M9EmpiVC755dzRtAMIFZK5jl4IJyZ546Z5BZmnec6y83tHjc123jBAK Ht8Kw7pwJqT9caUPA+7cTHqHHZeUVxxE+0zFGf9o= Received: from DFLE102.ent.ti.com (dfle102.ent.ti.com [10.64.6.23]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id w3I6VFXf003194; Wed, 18 Apr 2018 01:31:15 -0500 Received: from DFLE100.ent.ti.com (10.64.6.21) by DFLE102.ent.ti.com (10.64.6.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Wed, 18 Apr 2018 01:31:15 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE100.ent.ti.com (10.64.6.21) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1466.3 via Frontend Transport; Wed, 18 Apr 2018 01:31:15 -0500 Received: from [192.168.2.6] (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id w3I6VCHe012222; Wed, 18 Apr 2018 01:31:13 -0500 Subject: Re: [RFC 2/6] dmaengine: xilinx_dma: Pass AXI4-Stream control words to netdev dma client To: Lars-Peter Clausen , Radhey Shyam Pandey , Vinod Koul CC: "michal.simek@xilinx.com" , "linux-kernel@vger.kernel.org" , "dmaengine@vger.kernel.org" , "dan.j.williams@intel.com" , Appana Durga Kedareswara Rao , "linux-arm-kernel@lists.infradead.org" References: <1522665546-10035-1-git-send-email-radheys@xilinx.com> <1522665546-10035-3-git-send-email-radheys@xilinx.com> <20180411090854.GY6014@localhost> <7f549d2e-fc96-8c7e-d839-edb86ae088a5@metafoo.de> <4ba085c7-5256-6c8a-5697-c0d5736a6e46@ti.com> <1fc10bec-5c2c-98f1-1d5b-b768dea844ed@metafoo.de> <78828d31-e4cd-5211-f1b6-8918ac38f599@ti.com> From: Peter Ujfalusi Message-ID: Date: Wed, 18 Apr 2018 09:31:39 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 8bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018-04-17 18:54, Lars-Peter Clausen wrote: > On 04/17/2018 04:53 PM, Peter Ujfalusi wrote: >> On 2018-04-17 16:58, Lars-Peter Clausen wrote: >>>>> There are two options. >>>>> >>>>> Either you extend the generic interfaces so it can cover your usecase in a >>>>> generic way. E.g. the ability to attach meta data to transfer. >>>> >>>> Fwiw I have this patch as part of a bigger work to achieve similar results: >>> >>> That's good stuff. Is this in a public tree somewhere? >> >> Not atm. I can not send the user of the new API and I did not wanted to >> send something like this out of the blue w/o context. >> >> But as it is a generic patch, I can send it as well. The only thing is >> that the need for the memcpy, so I might end up with >> ptr = get_metadata_ptr(desc, &size); /* size: in RX the valid size */ >> >> and set_metadata_size(); /* in TX to tell how the client placed */ >> >> Or something like that, the attach_metadata() as it is works just fine, >> but high throughput might not like the memcpy. >> > > In the most abstracted way I'd say metadata and data are two different data > streams that are correlated and send/received at the same time. In my case the meatdata is sideband information or parameters for/from the remote end. Like timestamp, algorithm parameters, keys, etc. It is tight to the data payload, but it is not part of it. But the API should be generic enough to cover other use cases where clients need to provide additional information. For me, the metadata is part of the descriptor we give and receive back from the DMA, others might have sideband channel to send that. For metadata handling we could have: struct dma_desc_metadata_ops { /* To give a buffer for the DMA with the metadata, as it was in my * original patch */ int (*desc_attach_metadata)(struct dma_async_tx_descriptor *desc, void *data, size_t len); void *(*desc_get_metadata_ptr)(struct dma_async_tx_descriptor *desc, size_t *payload_len, size_t *max_len); int (*desc_set_payload_len)(struct dma_async_tx_descriptor *desc, size_t payload_len); }; Probably a simple flag variable to indicate which of the two modes are supported: 1. Client provided metadata buffer handling Clients provide the buffer via desc_attach_metadata(), the DMA driver will do whatever it needs to do, copy it in place, send it differently, use parameters. In RX the received metadata is going to be placed to the provided buffer. 2. Ability to give the metadata pointer to user to work on it. In TX, clients can use desc_get_metadata_ptr() to get the pointer, current payload size and maximum size of the metadata and can work directly on the buffer to place the data. Then desc_set_payload_len() to let the DMA know how much data is actually placed there. In RX, desc_get_metadata_ptr() will give the user the pointer and the payload size so it can process that information correctly. DMA driver can implement either or both, but clients must only use either 1 or 2 to work with the metadata. > Think multi-planar transfer, like for audio when the right and left channel > are in separate buffers and not interleaved. Or video with different > color/luminance components in separate buffers. This is something that is at > the moment not covered by the dmaengine API either. Hrm, true, but it is hardly the metadata use case. It is more like different DMA transfer type. >>>>> Or you can implement a interface that is specific to your DMA controller and >>>>> any client using this interface knows it is talking to your DMA controller. >>>> >>>> Hrm, so we can have DMA driver specific calls? The reason why TI's keystone 2 >>>> navigator DMA support was rejected that it was introducing NAV specific calls >>>> for clients to configure features not yet supported by the framework. >>> >>> In my opinion it is OK, somebody else might have different ideas. I mean it >>> is not nice, but it is better than the alternative of overloading the >>> generic API with driver specific semantics or introducing some kind of IOCTL >>> catch all callback. >> >> True, but the generic API can be extended as well to cover new grounds, >> features. Like this metadata thing. >> >>> If there is tight coupling between the DMA core and client and there is no >>> intention of using a generic client the best solution might even be to no >>> use DMAengine at all. >> >> This is how the knav stuff ended up. Well it is only used by networking >> atm, so it is 'fine' to have custom API, but it is not portable. > > I totally agree generic APIs are better, but not everybody has the resources > to rewrite the whole framework just because they want to do this tiny thing > that isn't covered by the framework yet. In that case it is better to go > with a custom API (that might evolve into a generic API), rather than > overloading the generic API and putting a strain on everybody who works on > the generic API. At some point a threshold is reached when the burden of maintaining a custom API is more costly than investing on the extension of the framework. What happens when an existing driver (using DMAengine API) need to be supported on platform where only custom DMA code is available or if you want to migrate to a new DMA from the custom API the drier is wired for? It is just plain pain. At the end what we want to do with DMA: move data from opne place to another (in oversimplified view). The framework can be extended to cover new features w/o much impact on generality or drivers do not need the feature, like the metadata. The impact is minimal for drivers who don't care. If there is interest I can send the core patches for the metadata in couple of days (need to update the documentation as well) and test the new give me the metadata pointer support. Unfortunately I can not send atm the DMA driver itself which is using this. If this helps others to move ahead, I'm fine spending extra time to get it in a good shape for upstream. - Péter Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki