From patchwork Wed Jun 5 13:20:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 165888 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp7340423ili; Wed, 5 Jun 2019 06:21:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqz2uaBijJ89prLXvL5EzjXbjBM5QJ8wN7XIRmNBRT+pALJKwPy+2ukZoPlr3I1kPKgXlXfc X-Received: by 2002:a17:902:24c:: with SMTP id 70mr43392626plc.2.1559740863715; Wed, 05 Jun 2019 06:21:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559740863; cv=none; d=google.com; s=arc-20160816; b=Aeu4k0aaJP9ZcW6sFQuYj3P0+FSL6Ga2gqhFhn4z0/pKA3t8A1jFX7eduZXJsJVmXs uGGctV93rKqdXE2Syb6865AEkUeABXkGTdKZHUTZQExwAnHGCbFT/+zO0oldGaYn8qkz LCVBxj9luHhfI6s4hty74WkmWPG+Zgpjr0Tiknn7tfUikFBCcTaMFOvtUFlarjs5QeCL 8kZOURtQuR3GY3yNdQnnScSUoogAEQH6tDzbA8kM40iD6RsoA80NBAj3fNJD21lHPb74 sCdAX+m6gCBw3+llga6gwbdYGW7EiFddsD1a0dIz8ZyZmBwRtqc/xo7B+XD1oCCMbm6n /q/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=J8udFRfvbZ6fXOojTQ4C0YPBDnze74Ovvj+f7jr19Fw=; b=bNru7thUomV71lgj6S/jA41OQR3sqlX1PbN7RKxNT6BlK21DYcSsLOfGhzSNUniVjY f8Amn7mS/cv6gcFLo3uzOORXY2hssgim3TPB+SaylRWNCssIf0TIHhbPlHIj1CDYdsD6 GrTChOKBcD5gt/Og/STG8cOz99aVGp2GOM0EDG9PzutqnEgNb2+p5jeyxM/6CNdJr3m1 /O2ms+k64J1HERn9VFObxwEhYfHkXOaWYL29K4vOmeAhDxSENip/vHevIuWReeBdU0wm IeYc8NtDW4sRrBDeR5r0QWMRT9+Zx1JGpc8sqwS7ftIWL+r4xyzjLwpMQV+zhwxe1VRK KgzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kakw92oc; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m62si27163954pgm.392.2019.06.05.06.21.03; Wed, 05 Jun 2019 06:21:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-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=@linaro.org header.s=google header.b=kakw92oc; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728158AbfFENVC (ORCPT + 9 others); Wed, 5 Jun 2019 09:21:02 -0400 Received: from mail-lf1-f66.google.com ([209.85.167.66]:36573 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727903AbfFENUR (ORCPT ); Wed, 5 Jun 2019 09:20:17 -0400 Received: by mail-lf1-f66.google.com with SMTP id q26so19064467lfc.3 for ; Wed, 05 Jun 2019 06:20:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=J8udFRfvbZ6fXOojTQ4C0YPBDnze74Ovvj+f7jr19Fw=; b=kakw92oc5wH+oxJ6ODpgbLaUIoQW9h/zUc9x9pUca+W4hUS2xJ0UItvFLf9VQu8CIc 1szBRsbJ0awE7LTjIq4G2XLFuR6NA7/GMra+3MrrKql34p3S1K/0BW9XeVMFhQYKCTzz GDEEbdIwXdjGoo65Q5GIPn9ATH2Pplj3ZlximgzKWmvhwJO5uL4xt3wvQPWA9XCOdqby pldooEWZ4PPz+4lA99qqmGvqQJJB+5gPWnOAnNelCPYCw6w7kQYvm1e9sfZN8Rio0xT9 oX8uoCH8Mn8GL0cCRgeiLGtGD9Z2H3fzWi6Nd6Ib1p80OBQKGvSmhpjPo8Pw9YT+Zszq pj7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=J8udFRfvbZ6fXOojTQ4C0YPBDnze74Ovvj+f7jr19Fw=; b=gaekiRL+DKWofq+fLxbKkAqNXnQxWWq8fhmycKU7XqJjvs36FlQceG4V2oId5j+2SJ aeoLJDcFNv5WwTxxtyb7N3QmMg7gJrdX4tPgvIPMsSoEaiFLxTfLZmSvRgNreEbdYNus ViGKVpflYgh6qOMB44iUFsJ+nWT7JeIhGrkHINbRCbRQRKBNifuK4Tb/2tN0X06ZQIF/ 5jcrgIBXlpTGp2dTM5C6n3HRb/9t7yTpnlEwabgCOzs+eYkP3ziWHIcvJYmerquvkxa+ qwS4z8frRqjdyk9XyMpmFbvMOk0NEcQ+OHF2oeWx78E4Ci7OOV6yYX1JFmunOTv1mZ/G V3Ig== X-Gm-Message-State: APjAAAUjwkwOI/cGwBMe1I+Cl3Db529OTlMq2mHDLOda2ubJT+0SG0zY Z+vmA6kuMJAxiuWuuueGyrQUIQ== X-Received: by 2002:a19:2753:: with SMTP id n80mr20327221lfn.127.1559740815723; Wed, 05 Jun 2019 06:20:15 -0700 (PDT) Received: from localhost.localdomain (59-201-94-178.pool.ukrtel.net. [178.94.201.59]) by smtp.gmail.com with ESMTPSA id t3sm1893259lfk.59.2019.06.05.06.20.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Jun 2019 06:20:15 -0700 (PDT) From: Ivan Khoronzhuk To: grygorii.strashko@ti.com, hawk@kernel.org, davem@davemloft.net Cc: ast@kernel.org, linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, xdp-newbies@vger.kernel.org, ilias.apalodimas@linaro.org, netdev@vger.kernel.org, daniel@iogearbox.net, jakub.kicinski@netronome.com, john.fastabend@gmail.com, Jesper Dangaard Brouer , Ivan Khoronzhuk Subject: [PATCH v3 net-next 2/7] net: page_pool: add helper function to unmap dma addresses Date: Wed, 5 Jun 2019 16:20:04 +0300 Message-Id: <20190605132009.10734-3-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190605132009.10734-1-ivan.khoronzhuk@linaro.org> References: <20190605132009.10734-1-ivan.khoronzhuk@linaro.org> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Ilias Apalodimas On a previous patch dma addr was stored in 'struct page'. Use that to unmap DMA addresses used by network drivers Signed-off-by: Ilias Apalodimas Signed-off-by: Jesper Dangaard Brouer Signed-off-by: Ivan Khoronzhuk --- include/net/page_pool.h | 1 + net/core/page_pool.c | 7 +++++++ 2 files changed, 8 insertions(+) -- 2.17.1 diff --git a/include/net/page_pool.h b/include/net/page_pool.h index b885d86cb7a1..ad218cef88c5 100644 --- a/include/net/page_pool.h +++ b/include/net/page_pool.h @@ -110,6 +110,7 @@ static inline struct page *page_pool_dev_alloc_pages(struct page_pool *pool) struct page_pool *page_pool_create(const struct page_pool_params *params); void page_pool_destroy(struct page_pool *pool); +void page_pool_unmap_page(struct page_pool *pool, struct page *page); /* Never call this directly, use helpers below */ void __page_pool_put_page(struct page_pool *pool, diff --git a/net/core/page_pool.c b/net/core/page_pool.c index 5b2252c6d49b..205af7bd6d09 100644 --- a/net/core/page_pool.c +++ b/net/core/page_pool.c @@ -190,6 +190,13 @@ static void __page_pool_clean_page(struct page_pool *pool, page->dma_addr = 0; } +/* unmap the page and clean our state */ +void page_pool_unmap_page(struct page_pool *pool, struct page *page) +{ + __page_pool_clean_page(pool, page); +} +EXPORT_SYMBOL(page_pool_unmap_page); + /* Return a page to the page allocator, cleaning up our state */ static void __page_pool_return_page(struct page_pool *pool, struct page *page) { From patchwork Wed Jun 5 13:20:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 165883 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp7339655ili; Wed, 5 Jun 2019 06:20:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqz0jyY1y10bv3+3B0eNjkXmnxZStDcgvbTgSIDncjYQ6go0g8v7NF4TbOD2I/7pkDKovEWF X-Received: by 2002:a62:1483:: with SMTP id 125mr46106148pfu.137.1559740826394; Wed, 05 Jun 2019 06:20:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559740826; cv=none; d=google.com; s=arc-20160816; b=fdVORDrJT0L0fK8GSPeeJH/cdf9RC/z9KQqB3AWN9/PAZzrEA6EddWqCkApwAdPwsf 0aGuIJTmeUy6CrzRPTKkdvjWjchNON0C2DrwwA2zqHxiTYED+1NVFFYdzDWB740HgO7q 6zaara2XzPXyQukpWZyf5Z13PuGT0xb96qzcNS8gz2IBpOc0nm2bklQxBEeYISROIRfq pEWBlJ0rI6MkLjheXIi8H75cZth+lS1trbu1R3NZh3QKwf+X87MTKGvUio5GMno9WqTA ZWvgGG+pOqAbfee7YMpTrR+YUiNHRTq4HSkUVAHkEM6uAqRARjbzcyw6mkoNRy6UDiTW eDnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=ExBErmLKvAHAcEzB9N5VayIpTNJEe2yiC9dz/BkkizE=; b=VMEOJpKy7ORFY1UIrlbnWdMvCuQ6lB4CR1bjecKphBY4f9XPj/5/0SMN174ih6FrCM kPHXK19Amhxv6ItR/NijdOxRK2TeGUnC5KWlKOITLpq9vCsy4PkfnRIcOEYOCl483OkD 2z2DimHKs7I68yu7aK5d1FBOmz5bEtI2PZeIcTDyRnP0W9O1PuH5GSrwJist2YcIsSrb b/n2NQREI/+WzTANGBr/oNMK3orAfyqx+T1MLlkRmL+IDk0vQJCv53d2eckKt9cm9cFJ jdKaf5S22oHjRvW5raBsCeST/QnpXmEykzaBf0mlnNj2hjni+dTfILMBbAmx6Eg620XR f+Ug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=X7ck71nG; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s1si27444425pgj.147.2019.06.05.06.20.26; Wed, 05 Jun 2019 06:20:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-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=@linaro.org header.s=google header.b=X7ck71nG; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728087AbfFENUX (ORCPT + 9 others); Wed, 5 Jun 2019 09:20:23 -0400 Received: from mail-lf1-f67.google.com ([209.85.167.67]:43849 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728050AbfFENUW (ORCPT ); Wed, 5 Jun 2019 09:20:22 -0400 Received: by mail-lf1-f67.google.com with SMTP id j29so5148181lfk.10 for ; Wed, 05 Jun 2019 06:20:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ExBErmLKvAHAcEzB9N5VayIpTNJEe2yiC9dz/BkkizE=; b=X7ck71nGKtRWXB7809AuE9hEZDBJn1MsjyvkPtoKrbj01jcsBqcmAOlWDuv6ZOLZdq YHQ6xuuIoiHzm08o5x6ec7bpfTHojm0YRyjzykukcHFwBpdEOqhNG0pUOnAFnskNtASH GG5kVuowV8NYgXy2Pwnx1D4mgVY5mGZI6mFTIVClzZz4VOGPOtl13V51D1wyC16Lq8IE /aKAhegyBYjunqoWNakck+LLeKE0/e5qds28l2rPPBqJTtNsfVX+SWtH5xc2PCHeffza ZOD+tL0o73yMjfGuNyWGxAZyjaCq6w6jATng4U2K3kcavRTK0F4zTyQeilg5uuuJvqKK pgAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ExBErmLKvAHAcEzB9N5VayIpTNJEe2yiC9dz/BkkizE=; b=BaVHKyCi8psp9Nim5HXJNaK8lCh03Ud5c51hax6sM29f8vV/xVDLdscSdopAbrUKtZ +5uFkhP0FnBBk4X6ph5JmNrLJ2oBlU4twSbaagZF5Bqpz7Eep9e8ECXLA6fpCeoi1Acp 3dXPRLkz8zAVal4c226zKGHDjJCruHMWoy8BSFOI73yZlJ5INN6tXX8cJzQAeJ/C+QgY ZALEAOXtzo2jv1tU4vE4yZu/LxZVnrTD+k3J7L75Gv0QfkarDFJ/YdHWIOdF+7hrGkkj gTEEBc+/ts5KFDxRhQ3aJOvvdyd0NzOipD36c3oLqmAz/RbaAo08lkM9WxjnUKJt806s naUw== X-Gm-Message-State: APjAAAVZ1Q8f6Fd64/eYO+/W77ImEjqwLs41OIxatFx1BpM+KX/8gYKl Iw5zqsuCkG01MCV2URVrqQd/5A== X-Received: by 2002:a19:f713:: with SMTP id z19mr19485532lfe.121.1559740819649; Wed, 05 Jun 2019 06:20:19 -0700 (PDT) Received: from localhost.localdomain (59-201-94-178.pool.ukrtel.net. [178.94.201.59]) by smtp.gmail.com with ESMTPSA id t3sm1893259lfk.59.2019.06.05.06.20.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Jun 2019 06:20:19 -0700 (PDT) From: Ivan Khoronzhuk To: grygorii.strashko@ti.com, hawk@kernel.org, davem@davemloft.net Cc: ast@kernel.org, linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, xdp-newbies@vger.kernel.org, ilias.apalodimas@linaro.org, netdev@vger.kernel.org, daniel@iogearbox.net, jakub.kicinski@netronome.com, john.fastabend@gmail.com, Ivan Khoronzhuk Subject: [PATCH v3 net-next 5/7] net: ethernet: ti: davinci_cpdma: add dma mapped submit Date: Wed, 5 Jun 2019 16:20:07 +0300 Message-Id: <20190605132009.10734-6-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190605132009.10734-1-ivan.khoronzhuk@linaro.org> References: <20190605132009.10734-1-ivan.khoronzhuk@linaro.org> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org In case if dma mapped packet needs to be sent, like with XDP page pool, the "mapped" submit can be used. This patch adds dma mapped submit based on regular one. Signed-off-by: Ivan Khoronzhuk --- drivers/net/ethernet/ti/davinci_cpdma.c | 88 ++++++++++++++++++++----- drivers/net/ethernet/ti/davinci_cpdma.h | 2 + 2 files changed, 75 insertions(+), 15 deletions(-) -- 2.17.1 diff --git a/drivers/net/ethernet/ti/davinci_cpdma.c b/drivers/net/ethernet/ti/davinci_cpdma.c index 35bf14d8e7af..7f89b2299f05 100644 --- a/drivers/net/ethernet/ti/davinci_cpdma.c +++ b/drivers/net/ethernet/ti/davinci_cpdma.c @@ -125,6 +125,15 @@ struct cpdma_chan { u32 rate; }; +struct submit_info { + struct cpdma_chan *chan; + int directed; + void *token; + void *data; + int flags; + int len; +}; + struct cpdma_control_info { u32 reg; u32 shift, mask; @@ -176,6 +185,8 @@ static struct cpdma_control_info controls[] = { (directed << CPDMA_TO_PORT_SHIFT)); \ } while (0) +#define CPDMA_DMA_EXT_MAP BIT(16) + static void cpdma_desc_pool_destroy(struct cpdma_ctlr *ctlr) { struct cpdma_desc_pool *pool = ctlr->pool; @@ -1002,10 +1013,12 @@ static void __cpdma_chan_submit(struct cpdma_chan *chan, } } -int cpdma_chan_submit(struct cpdma_chan *chan, void *token, void *data, - int len, int directed) +static int cpdma_chan_submit_si(struct submit_info *si) { + struct cpdma_chan *chan = si->chan; struct cpdma_ctlr *ctlr = chan->ctlr; + int len = si->len; + int swlen = len; struct cpdma_desc __iomem *desc; dma_addr_t buffer; unsigned long flags; @@ -1037,16 +1050,22 @@ int cpdma_chan_submit(struct cpdma_chan *chan, void *token, void *data, chan->stats.runt_transmit_buff++; } - buffer = dma_map_single(ctlr->dev, data, len, chan->dir); - ret = dma_mapping_error(ctlr->dev, buffer); - if (ret) { - cpdma_desc_free(ctlr->pool, desc, 1); - ret = -EINVAL; - goto unlock_ret; - } - mode = CPDMA_DESC_OWNER | CPDMA_DESC_SOP | CPDMA_DESC_EOP; - cpdma_desc_to_port(chan, mode, directed); + cpdma_desc_to_port(chan, mode, si->directed); + + if (si->flags & CPDMA_DMA_EXT_MAP) { + buffer = (dma_addr_t)si->data; + dma_sync_single_for_device(ctlr->dev, buffer, len, chan->dir); + swlen |= CPDMA_DMA_EXT_MAP; + } else { + buffer = dma_map_single(ctlr->dev, si->data, len, chan->dir); + ret = dma_mapping_error(ctlr->dev, buffer); + if (ret) { + cpdma_desc_free(ctlr->pool, desc, 1); + ret = -EINVAL; + goto unlock_ret; + } + } /* Relaxed IO accessors can be used here as there is read barrier * at the end of write sequence. @@ -1055,9 +1074,9 @@ int cpdma_chan_submit(struct cpdma_chan *chan, void *token, void *data, writel_relaxed(buffer, &desc->hw_buffer); writel_relaxed(len, &desc->hw_len); writel_relaxed(mode | len, &desc->hw_mode); - writel_relaxed((uintptr_t)token, &desc->sw_token); + writel_relaxed((uintptr_t)si->token, &desc->sw_token); writel_relaxed(buffer, &desc->sw_buffer); - writel_relaxed(len, &desc->sw_len); + writel_relaxed(swlen, &desc->sw_len); desc_read(desc, sw_len); __cpdma_chan_submit(chan, desc); @@ -1072,6 +1091,38 @@ int cpdma_chan_submit(struct cpdma_chan *chan, void *token, void *data, return ret; } +int cpdma_chan_submit(struct cpdma_chan *chan, void *token, void *data, int len, + int directed) +{ + struct submit_info si; + + si.chan = chan; + si.token = token; + si.data = data; + si.len = len; + si.directed = directed; + si.flags = 0; + + return cpdma_chan_submit_si(&si); +} +EXPORT_SYMBOL_GPL(cpdma_chan_submit); + +int cpdma_chan_submit_mapped(struct cpdma_chan *chan, void *token, + dma_addr_t data, int len, int directed) +{ + struct submit_info si; + + si.chan = chan; + si.token = token; + si.data = (void *)data; + si.len = len; + si.directed = directed; + si.flags = CPDMA_DMA_EXT_MAP; + + return cpdma_chan_submit_si(&si); +} +EXPORT_SYMBOL_GPL(cpdma_chan_submit_mapped); + bool cpdma_check_free_tx_desc(struct cpdma_chan *chan) { struct cpdma_ctlr *ctlr = chan->ctlr; @@ -1097,10 +1148,17 @@ static void __cpdma_chan_free(struct cpdma_chan *chan, uintptr_t token; token = desc_read(desc, sw_token); - buff_dma = desc_read(desc, sw_buffer); origlen = desc_read(desc, sw_len); - dma_unmap_single(ctlr->dev, buff_dma, origlen, chan->dir); + buff_dma = desc_read(desc, sw_buffer); + if (origlen & CPDMA_DMA_EXT_MAP) { + origlen &= ~CPDMA_DMA_EXT_MAP; + dma_sync_single_for_cpu(ctlr->dev, buff_dma, origlen, + chan->dir); + } else { + dma_unmap_single(ctlr->dev, buff_dma, origlen, chan->dir); + } + cpdma_desc_free(pool, desc, 1); (*chan->handler)((void *)token, outlen, status); } diff --git a/drivers/net/ethernet/ti/davinci_cpdma.h b/drivers/net/ethernet/ti/davinci_cpdma.h index 10376062dafa..8f6f27185c63 100644 --- a/drivers/net/ethernet/ti/davinci_cpdma.h +++ b/drivers/net/ethernet/ti/davinci_cpdma.h @@ -77,6 +77,8 @@ int cpdma_chan_stop(struct cpdma_chan *chan); int cpdma_chan_get_stats(struct cpdma_chan *chan, struct cpdma_chan_stats *stats); +int cpdma_chan_submit_mapped(struct cpdma_chan *chan, void *token, + dma_addr_t data, int len, int directed); int cpdma_chan_submit(struct cpdma_chan *chan, void *token, void *data, int len, int directed); int cpdma_chan_process(struct cpdma_chan *chan, int quota);