From owner-freebsd-arm@FreeBSD.ORG Sun Mar 3 00:02:51 2013 Return-Path: Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id ECA39763 for ; Sun, 3 Mar 2013 00:02:51 +0000 (UTC) (envelope-from ThomasSkibo@sbcglobal.net) Received: from nm11-vm1.access.bullet.mail.mud.yahoo.com (nm11-vm1.access.bullet.mail.mud.yahoo.com [66.94.237.184]) by mx1.freebsd.org (Postfix) with ESMTP id A2BF3A27 for ; Sun, 3 Mar 2013 00:02:51 +0000 (UTC) Received: from [66.94.237.192] by nm11.access.bullet.mail.mud.yahoo.com with NNFMP; 03 Mar 2013 00:02:45 -0000 Received: from [68.142.198.106] by tm3.access.bullet.mail.mud.yahoo.com with NNFMP; 03 Mar 2013 00:02:45 -0000 Received: from [127.0.0.1] by smtp108.sbc.mail.mud.yahoo.com with NNFMP; 03 Mar 2013 00:02:45 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sbcglobal.net; s=s1024; t=1362268965; bh=7zUJUFN4qUczp5DujaE6tSgyP7wkv8HvAaQ6XqJYooQ=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Received:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:Content-Type:Content-Transfer-Encoding; b=eCUCYW9KH1mtN6w99wtsgxLPbj6TaXEEvrfbUfMXqvwC00tSKB9BBgln3F6db1R+bRdr141oa9HQGElnBCPbmlDtVChBdEZB33avHp+P9C1A5AXMVH5dE68CwhIUNrN8X9aPp3Z8RabiZAobQ9XekTlQ4OZPTQHgnPZOizVMa3M= X-Yahoo-Newman-Id: 680006.84655.bm@smtp108.sbc.mail.mud.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: xhb2PLcVM1nh5FUN3ZG4yQCovzOo7k75FchI2adqpz8SXAw NGWNaTZAbGBTZ1Rl2ApC_BvpxuhsY31VwgqvW5HQoLN9_yedR2XW7Rzgh8yf UTeF3nx3uQHxCb7Ncs.BLIZn4oizvUZNym8Vshn5zPpRw_tND71HSRCEGEBT aw7JyCVPOIcYBU3jvDkAiBix6yOIxuk9Gyo7BKpx0Wg2YDSNsQCEZWxNWvwB Bcp8WXG1hDe6a2ZaH3iBvCKPoGRTvLO7iCuLC8W7jw9k7uK8kii0TbhLRs0m 9WUUygoT24G0uNKR7rxFqNdek6KKpHIVLtK..5BVqgwX6RqDLMP5l9P.mktk eQGPptC1SlsZ.eysXvZ.Oa8hBR.wnMm.5tlcwXNceOOfUugBwo05uK4srlqE a_pfNJ4K6osAcJcdaebys4SUq_odqKgmfUaxLnvuDg.NU304pz7RQGKVhCXC NjWUxJ5B_9sFdhSYFIwCyGvQC0NupUY.3GikQ5xF.o5Tk7VsqmW61Vjzf3yg - X-Yahoo-SMTP: tUxoRneswBA21azLM.3ybMESf0mC2bFhTbmt0VU5ervH0kqi5lo- Received: from [192.168.1.9] (ThomasSkibo@71.139.174.219 with plain) by smtp108.sbc.mail.mud.yahoo.com with SMTP; 02 Mar 2013 16:02:45 -0800 PST Message-ID: <51329325.7070301@sbcglobal.net> Date: Sat, 02 Mar 2013 16:02:45 -0800 From: Thomas Skibo User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130216 Thunderbird/17.0.3 MIME-Version: 1.0 To: freebsd-arm@freebsd.org Subject: A bug in busdma_machdep-v6.c? Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Porting FreeBSD to the StrongARM Processor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Mar 2013 00:02:52 -0000 Hello. I've been trying to solve a tcp checksum bug and I think I see a problem in _bus_dmamap_load_buffer(): In the following code bit, a segment is tacked onto the previous segment's slist[] entry if it is adjacent to the previous segment in virtual memory. That's okay if all cache operations use virtual addresses but if the level 2 cache operations need physical addresses (ARM_L2_PIPT), the physical address of the second segment is lost. I don't think bus_dmamap_sync() is properly wb/invalidating the second segment from the level 2 cache. 1008 sl = &map->slist[map->sync_count - 1]; 1009 if (map->sync_count == 0 || 1010 vaddr != sl->vaddr + sl->datacount) { 1011 if (++map->sync_count > dmat->nsegments) 1012 goto cleanup; 1013 sl++; 1014 sl->vaddr = vaddr; 1015 sl->datacount = sgsize; 1016 sl->busaddr = curaddr; 1017 } else 1018 sl->datacount += sgsize; 1019 } I was seeing bad checksums on large packets. While examining the dma descriptors of the offending packets, I noticed that the second of three segments always ended on a page boundary so I just guessed the second and third were one buffer straddling a page boundary. So far, this patch is fixing the problem for me: *************** *** 1007,1012 **** --- 1007,1015 ---- } else { sl = &map->slist[map->sync_count - 1]; if (map->sync_count == 0 || + #ifdef ARM_L2_PIPT + curaddr != sl->busaddr + sl->datacount || + #endif vaddr != sl->vaddr + sl->datacount) { if (++map->sync_count > dmat->nsegments) goto cleanup; -- -------- Thomas Skibo ThomasSkibo@sbcglobal.net