From mboxrd@z Thu Jan 1 00:00:00 1970 From: Claudiu Manoil Subject: Re: [PATCH net v2] gianfar: Fix dma check map error when DMA_API_DEBUG is enabled Date: Thu, 11 Dec 2014 19:05:54 +0200 Message-ID: <5489CEF2.5090208@freescale.com> References: <20141211020646.GB18701@pek-khao-d1.corp.ad.wrs.com> <1418278121-20209-1-git-send-email-haokexin@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit Cc: David Miller To: Kevin Hao , Return-path: Received: from mail-bn1bon0110.outbound.protection.outlook.com ([157.56.111.110]:61164 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750702AbaLKRiv (ORCPT ); Thu, 11 Dec 2014 12:38:51 -0500 In-Reply-To: <1418278121-20209-1-git-send-email-haokexin@gmail.com> Sender: netdev-owner@vger.kernel.org List-ID: On 12/11/2014 8:08 AM, Kevin Hao wrote: > We need to use dma_mapping_error() to check the dma address returned > by dma_map_single/page(). Otherwise we would get warning like this: > WARNING: at lib/dma-debug.c:1140 > Modules linked in: > CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.18.0-rc2-next-20141029 #196 > task: c0834300 ti: effe6000 task.ti: c0874000 > NIP: c02b2c98 LR: c02b2c98 CTR: c030abc4 > REGS: effe7d70 TRAP: 0700 Not tainted (3.18.0-rc2-next-20141029) > MSR: 00021000 CR: 22044022 XER: 20000000 > > GPR00: c02b2c98 effe7e20 c0834300 00000098 00021000 00000000 c030b898 00000003 > GPR08: 00000001 00000000 00000001 749eec9d 22044022 1001abe0 00000020 ef278678 > GPR16: ef278670 ef278668 ef278660 070a8040 c087f99c c08cdc60 00029000 c0840d44 > GPR24: c08be6e8 c0840000 effe7e78 ef041340 00000600 ef114e10 00000000 c08be6e0 > NIP [c02b2c98] check_unmap+0x51c/0x9e4 > LR [c02b2c98] check_unmap+0x51c/0x9e4 > Call Trace: > [effe7e20] [c02b2c98] check_unmap+0x51c/0x9e4 (unreliable) > [effe7e70] [c02b31d8] debug_dma_unmap_page+0x78/0x8c > [effe7ed0] [c03d1640] gfar_clean_rx_ring+0x208/0x488 > [effe7f40] [c03d1a9c] gfar_poll_rx_sq+0x3c/0xa8 > [effe7f60] [c04f8714] net_rx_action+0xc0/0x178 > [effe7f90] [c00435a0] __do_softirq+0x100/0x1fc > [effe7fe0] [c0043958] irq_exit+0xa4/0xc8 > [effe7ff0] [c000d14c] call_do_irq+0x24/0x3c > [c0875e90] [c00048a0] do_IRQ+0x8c/0xf8 > [c0875eb0] [c000ed10] ret_from_except+0x0/0x18 > > For TX, we need to unmap the pages which has already been mapped and > free the skb before return. > > For RX, move the dma mapping and error check to gfar_new_skb(). We > would reuse the original skb in the rx ring when either allocating > skb failure or dma mapping error. > > Signed-off-by: Kevin Hao > --- > v2: Just update the RX path to reuse the original skb when dma mapping error > occurs as suggested by David. > Very nice refactoring of gfar_new_skb(), removing gfar_new_rxbdp() in the process. (Did not have the time to test it yet.) Thanks. Reviewed-by: Claudiu Manoil