From owner-freebsd-firewire@FreeBSD.ORG Mon Jun 25 11:08:25 2007 Return-Path: X-Original-To: freebsd-firewire@FreeBSD.org Delivered-To: freebsd-firewire@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C72B216A4C8 for ; Mon, 25 Jun 2007 11:08:25 +0000 (UTC) (envelope-from owner-bugmaster@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [69.147.83.40]) by mx1.freebsd.org (Postfix) with ESMTP id 9F5EC13C484 for ; Mon, 25 Jun 2007 11:08:25 +0000 (UTC) (envelope-from owner-bugmaster@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id l5PB8Pc8098671 for ; Mon, 25 Jun 2007 11:08:25 GMT (envelope-from owner-bugmaster@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id l5PB8No4098667 for freebsd-firewire@FreeBSD.org; Mon, 25 Jun 2007 11:08:23 GMT (envelope-from owner-bugmaster@FreeBSD.org) Date: Mon, 25 Jun 2007 11:08:23 GMT Message-Id: <200706251108.l5PB8No4098667@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: gnats set sender to owner-bugmaster@FreeBSD.org using -f From: FreeBSD bugmaster To: freebsd-firewire@FreeBSD.org Cc: Subject: Current problem reports assigned to you X-BeenThere: freebsd-firewire@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Firewire support in FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jun 2007 11:08:25 -0000 Current FreeBSD problem reports Critical problems Serious problems S Tracker Resp. Description -------------------------------------------------------------------------------- o kern/74238 firewire [firewire] fw_rcv: unknown response; firewire ad-hoc w o kern/85434 firewire [fwip] fwip (IP over firewire) doesn't work with polli 2 problems total. Non-critical problems From owner-freebsd-firewire@FreeBSD.ORG Thu Jun 28 09:40:19 2007 Return-Path: X-Original-To: freebsd-firewire@freebsd.org Delivered-To: freebsd-firewire@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6618C16A41F for ; Thu, 28 Jun 2007 09:40:19 +0000 (UTC) (envelope-from ikob@ni.aist.go.jp) Received: from mail.asahi-net.or.jp (mail1.asahi-net.or.jp [202.224.39.197]) by mx1.freebsd.org (Postfix) with ESMTP id 284B813C448 for ; Thu, 28 Jun 2007 09:40:19 +0000 (UTC) (envelope-from ikob@ni.aist.go.jp) Received: from [150.82.175.93] (unknown [150.82.175.93]) by mail.asahi-net.or.jp (Postfix) with ESMTP id C28E548BDF for ; Thu, 28 Jun 2007 18:40:17 +0900 (JST) Mime-Version: 1.0 (Apple Message framework v752.3) Content-Transfer-Encoding: 7bit Message-Id: <9E3627A8-0036-408A-B604-11A514B0CFD2@ni.aist.go.jp> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed To: freebsd-firewire@freebsd.org From: Kobayashi Katsushi Date: Thu, 28 Jun 2007 18:40:17 +0900 X-Mailer: Apple Mail (2.752.3) Subject: Patch for async. packet corruption in polling mode. X-BeenThere: freebsd-firewire@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Firewire support in FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jun 2007 09:40:19 -0000 Hi, I met async. packet corruption when using fwip device with polling mode. My patch for R6.2 is attached. Thanks, -- Katsushi Kobayashi Index: sys/dev/firewire/fwohci.c =================================================================== RCS file: /grid/home/ikob/develop/FreeBSD/sys/dev/firewire/fwohci.c,v retrieving revision 1.1.1.1 retrieving revision 1.1.1.1.6.3 diff -c -r1.1.1.1 -r1.1.1.1.6.3 *** sys/dev/firewire/fwohci.c 22 May 2007 06:25:52 -0000 1.1.1.1 --- sys/dev/firewire/fwohci.c 28 Jun 2007 09:09:11 -0000 1.1.1.1.6.3 *************** *** 125,131 **** static void fwohci_ibr (struct firewire_comm *); static void fwohci_db_init (struct fwohci_softc *, struct fwohci_dbch *); static void fwohci_db_free (struct fwohci_dbch *); ! static void fwohci_arcv (struct fwohci_softc *, struct fwohci_dbch *, int); static void fwohci_txd (struct fwohci_softc *, struct fwohci_dbch *); static void fwohci_start_atq (struct firewire_comm *); static void fwohci_start_ats (struct firewire_comm *); --- 125,131 ---- static void fwohci_ibr (struct firewire_comm *); static void fwohci_db_init (struct fwohci_softc *, struct fwohci_dbch *); static void fwohci_db_free (struct fwohci_dbch *); ! static int fwohci_arcv (struct fwohci_softc *, struct fwohci_dbch *, int); static void fwohci_txd (struct fwohci_softc *, struct fwohci_dbch *); static void fwohci_start_atq (struct firewire_comm *); static void fwohci_start_ats (struct firewire_comm *); *************** *** 580,585 **** --- 580,586 ---- } + sc->pollstat = 0; /* Enable interrupts */ OWRITE(sc, FWOHCI_INTMASK, OHCI_INT_ERR | OHCI_INT_PHY_SID *************** *** 671,676 **** --- 672,678 ---- sc->fc.tcode = tinfo; sc->fc.dev = dev; + sc->pollstat = 0; sc->fc.config_rom = fwdma_malloc(&sc->fc, CROMSIZE, CROMSIZE, &sc->crom_dma, BUS_DMA_WAITOK); *************** *** 1867,1873 **** dump_dma(sc, ARRS_CH); dump_db(sc, ARRS_CH); #endif ! fwohci_arcv(sc, &sc->arrs, count); } if((stat & OHCI_INT_DMA_PRRQ )){ #ifndef ACK_ALL --- 1869,1879 ---- dump_dma(sc, ARRS_CH); dump_db(sc, ARRS_CH); #endif ! if(fwohci_arcv(sc, &sc->arrs, count) == 0) { ! sc->pollstat &= ~OHCI_INT_DMA_PRRS; ! }else{ ! sc->pollstat |= OHCI_INT_DMA_PRRS; ! } } if((stat & OHCI_INT_DMA_PRRQ )){ #ifndef ACK_ALL *************** *** 1877,1883 **** dump_dma(sc, ARRQ_CH); dump_db(sc, ARRQ_CH); #endif ! fwohci_arcv(sc, &sc->arrq, count); } if(stat & OHCI_INT_PHY_SID){ uint32_t *buf, node_id; --- 1883,1893 ---- dump_dma(sc, ARRQ_CH); dump_db(sc, ARRQ_CH); #endif ! if(fwohci_arcv(sc, &sc->arrq, count) == 0){ ! sc->pollstat &= ~OHCI_INT_DMA_PRRQ; ! }else{ ! sc->pollstat |= OHCI_INT_DMA_PRRQ; ! } } if(stat & OHCI_INT_PHY_SID){ uint32_t *buf, node_id; *************** *** 2081,2086 **** --- 2091,2097 ---- if (1) { #endif stat = fwochi_check_stat(sc); + stat |= sc->pollstat; if (stat == 0 || stat == 0xffffffff) return; } *************** *** 2601,2607 **** return 0; } - static int fwohci_arcv_swap(struct fw_pkt *fp, int len) { --- 2612,2617 ---- *************** *** 2686,2692 **** dbch->bottom = db_tr; } ! static void fwohci_arcv(struct fwohci_softc *sc, struct fwohci_dbch *dbch, int count) { struct fwohcidb_tr *db_tr; --- 2696,2702 ---- dbch->bottom = db_tr; } ! static int fwohci_arcv(struct fwohci_softc *sc, struct fwohci_dbch *dbch, int count) { struct fwohcidb_tr *db_tr; *************** *** 2701,2713 **** int s; caddr_t buf; int resCount; if(&sc->arrq == dbch){ off = OHCI_ARQOFF; }else if(&sc->arrs == dbch){ off = OHCI_ARSOFF; }else{ ! return; } s = splfw(); --- 2711,2724 ---- int s; caddr_t buf; int resCount; + int ret = 0; if(&sc->arrq == dbch){ off = OHCI_ARQOFF; }else if(&sc->arrs == dbch){ off = OHCI_ARSOFF; }else{ ! return 0; } s = splfw(); *************** *** 2719,2725 **** status = FWOHCI_DMA_READ(db_tr->db[0].db.desc.res) >> OHCI_STATUS_SHIFT; resCount = FWOHCI_DMA_READ(db_tr->db[0].db.desc.res) & OHCI_COUNT_MASK; #if 0 ! printf("status 0x%04x, resCount 0x%04x\n", status, resCount); #endif while (status & OHCI_CNTL_DMA_ACTIVE) { len = dbch->xferq.psize - resCount; --- 2730,2736 ---- status = FWOHCI_DMA_READ(db_tr->db[0].db.desc.res) >> OHCI_STATUS_SHIFT; resCount = FWOHCI_DMA_READ(db_tr->db[0].db.desc.res) & OHCI_COUNT_MASK; #if 0 ! printf("status 0x%04x, resCount 0x%04x count %d\n", status, resCount, count); #endif while (status & OHCI_CNTL_DMA_ACTIVE) { len = dbch->xferq.psize - resCount; *************** *** 2733,2739 **** BUS_DMASYNC_POSTREAD); while (len > 0 ) { if (count >= 0 && count-- == 0) ! goto out; if(dbch->pdb_tr != NULL){ /* we have a fragment in previous buffer */ int rlen; --- 2744,2753 ---- BUS_DMASYNC_POSTREAD); while (len > 0 ) { if (count >= 0 && count-- == 0) ! { ! ret = 1; ! goto pollout; ! } if(dbch->pdb_tr != NULL){ /* we have a fragment in previous buffer */ int rlen; *************** *** 2898,2906 **** --- 2912,2922 ---- } /* XXX make sure DMA is not dead */ } + pollout: #if 0 if (pcnt < 1) printf("fwohci_arcv: no packets\n"); #endif splx(s); + return ret; } Index: sys/dev/firewire/fwohcivar.h =================================================================== RCS file: /grid/home/ikob/develop/FreeBSD/sys/dev/firewire/fwohcivar.h,v retrieving revision 1.1.1.1 retrieving revision 1.1.1.1.6.1 diff -c -r1.1.1.1 -r1.1.1.1.6.1 *** sys/dev/firewire/fwohcivar.h 22 May 2007 06:25:52 -0000 1.1.1.1 --- sys/dev/firewire/fwohcivar.h 28 Jun 2007 04:17:22 -0000 1.1.1.1.6.1 *************** *** 81,86 **** --- 81,87 ---- uint32_t intstat; struct task fwohci_task_complete; #endif + uint32_t pollstat; } fwohci_softc_t; void fwohci_intr (void *arg); -- Katsushi Kobayashi From owner-freebsd-firewire@FreeBSD.ORG Thu Jun 28 09:45:54 2007 Return-Path: X-Original-To: freebsd-firewire@freebsd.org Delivered-To: freebsd-firewire@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2306016A400 for ; Thu, 28 Jun 2007 09:45:54 +0000 (UTC) (envelope-from ikob@ni.aist.go.jp) Received: from mail.asahi-net.or.jp (mail2.asahi-net.or.jp [202.224.39.198]) by mx1.freebsd.org (Postfix) with ESMTP id D9B5B13C4AD for ; Thu, 28 Jun 2007 09:45:53 +0000 (UTC) (envelope-from ikob@ni.aist.go.jp) Received: from [150.82.175.93] (unknown [150.82.175.93]) by mail.asahi-net.or.jp (Postfix) with ESMTP id 1A4FB3DFAF for ; Thu, 28 Jun 2007 18:28:09 +0900 (JST) Mime-Version: 1.0 (Apple Message framework v752.3) Content-Transfer-Encoding: 7bit Message-Id: <4CED5BD2-A08B-4BA6-AB08-8B251D12F35D@ni.aist.go.jp> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed To: freebsd-firewire@freebsd.org From: Kobayashi Katsushi Date: Thu, 28 Jun 2007 18:28:08 +0900 X-Mailer: Apple Mail (2.752.3) Subject: firewire patch for polling mode. X-BeenThere: freebsd-firewire@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Firewire support in FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jun 2007 09:45:54 -0000 Hi, I met async. packet corruption when using fwip device with polling mode. My patch for R6.2 is attached. Thanks, -- Katsushi Kobayashi Index: sys/dev/firewire/fwohci.c =================================================================== RCS file: /grid/home/ikob/develop/FreeBSD/sys/dev/firewire/fwohci.c,v retrieving revision 1.1.1.1 retrieving revision 1.1.1.1.6.3 diff -c -r1.1.1.1 -r1.1.1.1.6.3 *** sys/dev/firewire/fwohci.c 22 May 2007 06:25:52 -0000 1.1.1.1 --- sys/dev/firewire/fwohci.c 28 Jun 2007 09:09:11 -0000 1.1.1.1.6.3 *************** *** 125,131 **** static void fwohci_ibr (struct firewire_comm *); static void fwohci_db_init (struct fwohci_softc *, struct fwohci_dbch *); static void fwohci_db_free (struct fwohci_dbch *); ! static void fwohci_arcv (struct fwohci_softc *, struct fwohci_dbch *, int); static void fwohci_txd (struct fwohci_softc *, struct fwohci_dbch *); static void fwohci_start_atq (struct firewire_comm *); static void fwohci_start_ats (struct firewire_comm *); --- 125,131 ---- static void fwohci_ibr (struct firewire_comm *); static void fwohci_db_init (struct fwohci_softc *, struct fwohci_dbch *); static void fwohci_db_free (struct fwohci_dbch *); ! static int fwohci_arcv (struct fwohci_softc *, struct fwohci_dbch *, int); static void fwohci_txd (struct fwohci_softc *, struct fwohci_dbch *); static void fwohci_start_atq (struct firewire_comm *); static void fwohci_start_ats (struct firewire_comm *); *************** *** 580,585 **** --- 580,586 ---- } + sc->pollstat = 0; /* Enable interrupts */ OWRITE(sc, FWOHCI_INTMASK, OHCI_INT_ERR | OHCI_INT_PHY_SID *************** *** 671,676 **** --- 672,678 ---- sc->fc.tcode = tinfo; sc->fc.dev = dev; + sc->pollstat = 0; sc->fc.config_rom = fwdma_malloc(&sc->fc, CROMSIZE, CROMSIZE, &sc->crom_dma, BUS_DMA_WAITOK); *************** *** 1867,1873 **** dump_dma(sc, ARRS_CH); dump_db(sc, ARRS_CH); #endif ! fwohci_arcv(sc, &sc->arrs, count); } if((stat & OHCI_INT_DMA_PRRQ )){ #ifndef ACK_ALL --- 1869,1879 ---- dump_dma(sc, ARRS_CH); dump_db(sc, ARRS_CH); #endif ! if(fwohci_arcv(sc, &sc->arrs, count) == 0) { ! sc->pollstat &= ~OHCI_INT_DMA_PRRS; ! }else{ ! sc->pollstat |= OHCI_INT_DMA_PRRS; ! } } if((stat & OHCI_INT_DMA_PRRQ )){ #ifndef ACK_ALL *************** *** 1877,1883 **** dump_dma(sc, ARRQ_CH); dump_db(sc, ARRQ_CH); #endif ! fwohci_arcv(sc, &sc->arrq, count); } if(stat & OHCI_INT_PHY_SID){ uint32_t *buf, node_id; --- 1883,1893 ---- dump_dma(sc, ARRQ_CH); dump_db(sc, ARRQ_CH); #endif ! if(fwohci_arcv(sc, &sc->arrq, count) == 0){ ! sc->pollstat &= ~OHCI_INT_DMA_PRRQ; ! }else{ ! sc->pollstat |= OHCI_INT_DMA_PRRQ; ! } } if(stat & OHCI_INT_PHY_SID){ uint32_t *buf, node_id; *************** *** 2081,2086 **** --- 2091,2097 ---- if (1) { #endif stat = fwochi_check_stat(sc); + stat |= sc->pollstat; if (stat == 0 || stat == 0xffffffff) return; } *************** *** 2601,2607 **** return 0; } - static int fwohci_arcv_swap(struct fw_pkt *fp, int len) { --- 2612,2617 ---- *************** *** 2686,2692 **** dbch->bottom = db_tr; } ! static void fwohci_arcv(struct fwohci_softc *sc, struct fwohci_dbch *dbch, int count) { struct fwohcidb_tr *db_tr; --- 2696,2702 ---- dbch->bottom = db_tr; } ! static int fwohci_arcv(struct fwohci_softc *sc, struct fwohci_dbch *dbch, int count) { struct fwohcidb_tr *db_tr; *************** *** 2701,2713 **** int s; caddr_t buf; int resCount; if(&sc->arrq == dbch){ off = OHCI_ARQOFF; }else if(&sc->arrs == dbch){ off = OHCI_ARSOFF; }else{ ! return; } s = splfw(); --- 2711,2724 ---- int s; caddr_t buf; int resCount; + int ret = 0; if(&sc->arrq == dbch){ off = OHCI_ARQOFF; }else if(&sc->arrs == dbch){ off = OHCI_ARSOFF; }else{ ! return 0; } s = splfw(); *************** *** 2719,2725 **** status = FWOHCI_DMA_READ(db_tr->db[0].db.desc.res) >> OHCI_STATUS_SHIFT; resCount = FWOHCI_DMA_READ(db_tr->db[0].db.desc.res) & OHCI_COUNT_MASK; #if 0 ! printf("status 0x%04x, resCount 0x%04x\n", status, resCount); #endif while (status & OHCI_CNTL_DMA_ACTIVE) { len = dbch->xferq.psize - resCount; --- 2730,2736 ---- status = FWOHCI_DMA_READ(db_tr->db[0].db.desc.res) >> OHCI_STATUS_SHIFT; resCount = FWOHCI_DMA_READ(db_tr->db[0].db.desc.res) & OHCI_COUNT_MASK; #if 0 ! printf("status 0x%04x, resCount 0x%04x count %d\n", status, resCount, count); #endif while (status & OHCI_CNTL_DMA_ACTIVE) { len = dbch->xferq.psize - resCount; *************** *** 2733,2739 **** BUS_DMASYNC_POSTREAD); while (len > 0 ) { if (count >= 0 && count-- == 0) ! goto out; if(dbch->pdb_tr != NULL){ /* we have a fragment in previous buffer */ int rlen; --- 2744,2753 ---- BUS_DMASYNC_POSTREAD); while (len > 0 ) { if (count >= 0 && count-- == 0) ! { ! ret = 1; ! goto pollout; ! } if(dbch->pdb_tr != NULL){ /* we have a fragment in previous buffer */ int rlen; *************** *** 2898,2906 **** --- 2912,2922 ---- } /* XXX make sure DMA is not dead */ } + pollout: #if 0 if (pcnt < 1) printf("fwohci_arcv: no packets\n"); #endif splx(s); + return ret; } Index: sys/dev/firewire/fwohcivar.h =================================================================== RCS file: /grid/home/ikob/develop/FreeBSD/sys/dev/firewire/fwohcivar.h,v retrieving revision 1.1.1.1 retrieving revision 1.1.1.1.6.1 diff -c -r1.1.1.1 -r1.1.1.1.6.1 *** sys/dev/firewire/fwohcivar.h 22 May 2007 06:25:52 -0000 1.1.1.1 --- sys/dev/firewire/fwohcivar.h 28 Jun 2007 04:17:22 -0000 1.1.1.1.6.1 *************** *** 81,86 **** --- 81,87 ---- uint32_t intstat; struct task fwohci_task_complete; #endif + uint32_t pollstat; } fwohci_softc_t; void fwohci_intr (void *arg); From owner-freebsd-firewire@FreeBSD.ORG Fri Jun 29 09:18:57 2007 Return-Path: X-Original-To: freebsd-firewire@freebsd.org Delivered-To: freebsd-firewire@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2D3DC16A468 for ; Fri, 29 Jun 2007 09:18:57 +0000 (UTC) (envelope-from freebsd@gm.nunu.org) Received: from py-out-1112.google.com (py-out-1112.google.com [64.233.166.178]) by mx1.freebsd.org (Postfix) with ESMTP id D5A5613C457 for ; Fri, 29 Jun 2007 09:18:56 +0000 (UTC) (envelope-from freebsd@gm.nunu.org) Received: by py-out-1112.google.com with SMTP id u77so1203256pyb for ; Fri, 29 Jun 2007 02:18:56 -0700 (PDT) Received: by 10.35.69.11 with SMTP id w11mr282737pyk.1183108735978; Fri, 29 Jun 2007 02:18:55 -0700 (PDT) Received: by 10.35.71.5 with HTTP; Fri, 29 Jun 2007 02:18:55 -0700 (PDT) Message-ID: <626eb4530706290218n66064fferfe04a6a146fb69f9@mail.gmail.com> Date: Fri, 29 Jun 2007 18:18:55 +0900 From: "Hidetoshi Shimokawa" Sender: freebsd@gm.nunu.org To: "Kobayashi Katsushi" In-Reply-To: <9E3627A8-0036-408A-B604-11A514B0CFD2@ni.aist.go.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <9E3627A8-0036-408A-B604-11A514B0CFD2@ni.aist.go.jp> X-Google-Sender-Auth: a5691995bdafaef1 Cc: freebsd-firewire@freebsd.org Subject: Re: Patch for async. packet corruption in polling mode. X-BeenThere: freebsd-firewire@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Firewire support in FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jun 2007 09:18:57 -0000 I remember that there is a PR related this problem. I'll check your patch next week. Thank you for your patch. On 6/28/07, Kobayashi Katsushi wrote: > Hi, > > I met async. packet corruption when using fwip device with > polling mode. My patch for R6.2 is attached. > > Thanks, > > -- > Katsushi Kobayashi > > Index: sys/dev/firewire/fwohci.c > =================================================================== > RCS file: /grid/home/ikob/develop/FreeBSD/sys/dev/firewire/fwohci.c,v > retrieving revision 1.1.1.1 > retrieving revision 1.1.1.1.6.3 > diff -c -r1.1.1.1 -r1.1.1.1.6.3 > *** sys/dev/firewire/fwohci.c 22 May 2007 06:25:52 -0000 1.1.1.1 > --- sys/dev/firewire/fwohci.c 28 Jun 2007 09:09:11 -0000 > 1.1.1.1.6.3 > *************** > *** 125,131 **** > static void fwohci_ibr (struct firewire_comm *); > static void fwohci_db_init (struct fwohci_softc *, struct > fwohci_dbch *); > static void fwohci_db_free (struct fwohci_dbch *); > ! static void fwohci_arcv (struct fwohci_softc *, struct fwohci_dbch > *, int); > static void fwohci_txd (struct fwohci_softc *, struct fwohci_dbch *); > static void fwohci_start_atq (struct firewire_comm *); > static void fwohci_start_ats (struct firewire_comm *); > --- 125,131 ---- > static void fwohci_ibr (struct firewire_comm *); > static void fwohci_db_init (struct fwohci_softc *, struct > fwohci_dbch *); > static void fwohci_db_free (struct fwohci_dbch *); > ! static int fwohci_arcv (struct fwohci_softc *, struct fwohci_dbch > *, int); > static void fwohci_txd (struct fwohci_softc *, struct fwohci_dbch *); > static void fwohci_start_atq (struct firewire_comm *); > static void fwohci_start_ats (struct firewire_comm *); > *************** > *** 580,585 **** > --- 580,586 ---- > } > > > + sc->pollstat = 0; > /* Enable interrupts */ > OWRITE(sc, FWOHCI_INTMASK, > OHCI_INT_ERR | OHCI_INT_PHY_SID > *************** > *** 671,676 **** > --- 672,678 ---- > > sc->fc.tcode = tinfo; > sc->fc.dev = dev; > + sc->pollstat = 0; > > sc->fc.config_rom = fwdma_malloc(&sc->fc, CROMSIZE, CROMSIZE, > &sc->crom_dma, > BUS_DMA_WAITOK); > *************** > *** 1867,1873 **** > dump_dma(sc, ARRS_CH); > dump_db(sc, ARRS_CH); > #endif > ! fwohci_arcv(sc, &sc->arrs, count); > } > if((stat & OHCI_INT_DMA_PRRQ )){ > #ifndef ACK_ALL > --- 1869,1879 ---- > dump_dma(sc, ARRS_CH); > dump_db(sc, ARRS_CH); > #endif > ! if(fwohci_arcv(sc, &sc->arrs, count) == 0) { > ! sc->pollstat &= ~OHCI_INT_DMA_PRRS; > ! }else{ > ! sc->pollstat |= OHCI_INT_DMA_PRRS; > ! } > } > if((stat & OHCI_INT_DMA_PRRQ )){ > #ifndef ACK_ALL > *************** > *** 1877,1883 **** > dump_dma(sc, ARRQ_CH); > dump_db(sc, ARRQ_CH); > #endif > ! fwohci_arcv(sc, &sc->arrq, count); > } > if(stat & OHCI_INT_PHY_SID){ > uint32_t *buf, node_id; > --- 1883,1893 ---- > dump_dma(sc, ARRQ_CH); > dump_db(sc, ARRQ_CH); > #endif > ! if(fwohci_arcv(sc, &sc->arrq, count) == 0){ > ! sc->pollstat &= ~OHCI_INT_DMA_PRRQ; > ! }else{ > ! sc->pollstat |= OHCI_INT_DMA_PRRQ; > ! } > } > if(stat & OHCI_INT_PHY_SID){ > uint32_t *buf, node_id; > *************** > *** 2081,2086 **** > --- 2091,2097 ---- > if (1) { > #endif > stat = fwochi_check_stat(sc); > + stat |= sc->pollstat; > if (stat == 0 || stat == 0xffffffff) > return; > } > *************** > *** 2601,2607 **** > return 0; > } > > - > static int > fwohci_arcv_swap(struct fw_pkt *fp, int len) > { > --- 2612,2617 ---- > *************** > *** 2686,2692 **** > dbch->bottom = db_tr; > } > > ! static void > fwohci_arcv(struct fwohci_softc *sc, struct fwohci_dbch *dbch, int > count) > { > struct fwohcidb_tr *db_tr; > --- 2696,2702 ---- > dbch->bottom = db_tr; > } > > ! static int > fwohci_arcv(struct fwohci_softc *sc, struct fwohci_dbch *dbch, int > count) > { > struct fwohcidb_tr *db_tr; > *************** > *** 2701,2713 **** > int s; > caddr_t buf; > int resCount; > > if(&sc->arrq == dbch){ > off = OHCI_ARQOFF; > }else if(&sc->arrs == dbch){ > off = OHCI_ARSOFF; > }else{ > ! return; > } > > s = splfw(); > --- 2711,2724 ---- > int s; > caddr_t buf; > int resCount; > + int ret = 0; > > if(&sc->arrq == dbch){ > off = OHCI_ARQOFF; > }else if(&sc->arrs == dbch){ > off = OHCI_ARSOFF; > }else{ > ! return 0; > } > > s = splfw(); > *************** > *** 2719,2725 **** > status = FWOHCI_DMA_READ(db_tr->db[0].db.desc.res) >> > OHCI_STATUS_SHIFT; > resCount = FWOHCI_DMA_READ(db_tr->db[0].db.desc.res) & > OHCI_COUNT_MASK; > #if 0 > ! printf("status 0x%04x, resCount 0x%04x\n", status, resCount); > #endif > while (status & OHCI_CNTL_DMA_ACTIVE) { > len = dbch->xferq.psize - resCount; > --- 2730,2736 ---- > status = FWOHCI_DMA_READ(db_tr->db[0].db.desc.res) >> > OHCI_STATUS_SHIFT; > resCount = FWOHCI_DMA_READ(db_tr->db[0].db.desc.res) & > OHCI_COUNT_MASK; > #if 0 > ! printf("status 0x%04x, resCount 0x%04x count %d\n", status, > resCount, count); > #endif > while (status & OHCI_CNTL_DMA_ACTIVE) { > len = dbch->xferq.psize - resCount; > *************** > *** 2733,2739 **** > BUS_DMASYNC_POSTREAD); > while (len > 0 ) { > if (count >= 0 && count-- == 0) > ! goto out; > if(dbch->pdb_tr != NULL){ > /* we have a fragment in previous > buffer */ > int rlen; > --- 2744,2753 ---- > BUS_DMASYNC_POSTREAD); > while (len > 0 ) { > if (count >= 0 && count-- == 0) > ! { > ! ret = 1; > ! goto pollout; > ! } > if(dbch->pdb_tr != NULL){ > /* we have a fragment in previous > buffer */ > int rlen; > *************** > *** 2898,2906 **** > --- 2912,2922 ---- > } > /* XXX make sure DMA is not dead */ > } > + pollout: > #if 0 > if (pcnt < 1) > printf("fwohci_arcv: no packets\n"); > #endif > splx(s); > + return ret; > } > Index: sys/dev/firewire/fwohcivar.h > =================================================================== > RCS file: /grid/home/ikob/develop/FreeBSD/sys/dev/firewire/fwohcivar.h,v > retrieving revision 1.1.1.1 > retrieving revision 1.1.1.1.6.1 > diff -c -r1.1.1.1 -r1.1.1.1.6.1 > *** sys/dev/firewire/fwohcivar.h 22 May 2007 06:25:52 > -0000 1.1.1.1 > --- sys/dev/firewire/fwohcivar.h 28 Jun 2007 04:17:22 > -0000 1.1.1.1.6.1 > *************** > *** 81,86 **** > --- 81,87 ---- > uint32_t intstat; > struct task fwohci_task_complete; > #endif > + uint32_t pollstat; > } fwohci_softc_t; > > void fwohci_intr (void *arg); > > > > > > > -- > Katsushi Kobayashi > > > > _______________________________________________ > freebsd-firewire@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-firewire > To unsubscribe, send any mail to "freebsd-firewire-unsubscribe@freebsd.org" > -- /\ Hidetoshi Shimokawa \/ simokawa@FreeBSD.ORG From owner-freebsd-firewire@FreeBSD.ORG Fri Jun 29 09:44:04 2007 Return-Path: X-Original-To: freebsd-firewire@freebsd.org Delivered-To: freebsd-firewire@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 65FB116A473; Fri, 29 Jun 2007 09:44:04 +0000 (UTC) (envelope-from dfr@rabson.org) Received: from itchy.rabson.org (mailgate.nlsystems.com [80.177.232.242]) by mx1.freebsd.org (Postfix) with ESMTP id 1588413C465; Fri, 29 Jun 2007 09:44:03 +0000 (UTC) (envelope-from dfr@rabson.org) Received: from herring.rabson.org (herring.rabson.org [80.177.232.250]) by itchy.rabson.org (8.13.3/8.13.3) with ESMTP id l5T9OvIp059594; Fri, 29 Jun 2007 10:24:57 +0100 (BST) (envelope-from dfr@rabson.org) From: Doug Rabson To: freebsd-firewire@freebsd.org Date: Fri, 29 Jun 2007 10:24:56 +0100 User-Agent: KMail/1.9.6 References: <626eb4530706060746u44226cfajcedb3e169996a51a@mail.gmail.com> In-Reply-To: <626eb4530706060746u44226cfajcedb3e169996a51a@mail.gmail.com> MIME-Version: 1.0 Message-Id: <200706291024.56591.dfr@rabson.org> X-Spam-Status: No, score=0.9 required=5.0 tests=HTML_10_20,HTML_MESSAGE, UNPARSEABLE_RELAY autolearn=no version=3.1.0 X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on itchy.rabson.org X-Virus-Scanned: ClamAV 0.87.1/3551/Fri Jun 29 02:52:16 2007 on itchy.rabson.org X-Virus-Status: Clean Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: Hidetoshi Shimokawa Subject: Re: [CFT] MPSAFE firewire X-BeenThere: freebsd-firewire@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Firewire support in FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jun 2007 09:44:04 -0000 On Wednesday 06 June 2007, Hidetoshi Shimokawa wrote: > I have just committed MPSAFE(Giant free) firewire driver to -current. > If you have any problem, please let me know. I've been looking through the code and I have a few questions. In fwohci_rbuf_update(), you only call FW_GLOCK() if the FWXFERQ_HANDLER flag is zero. Doesn't this cause problems for the if_fwip driver (the only one to set this flag)? As far as I can see, if this flag is set, there is no mutex protection for any of the dma queues. Shouln't FW_GLOCK be used always? Also, additional protection is needed in fwip_stream_input where it manipulates the stvalid and stfree queues. I'm a bit confused about the async read path too. I'm looking at the code in fwohci_arcv() and I can't see any mutex protection in this function while it manipulates the buffers. Is this correct? I see some fossil use of splfw() here which is why I ask. Following the input path back to the fwip driver again, I can't see any mutex protection for the driver's unicast packet input queues. The last possible problem I noticed reading through the code is that there is no mutex protection of the fragmented packet reassembly queues in firewire_input_fragment. Perhaps the fw_com structure should have a mutex pointer in it which can be initialised to the if_fwip code's mutex and used in this case. From owner-freebsd-firewire@FreeBSD.ORG Fri Jun 29 11:36:37 2007 Return-Path: X-Original-To: freebsd-firewire@freebsd.org Delivered-To: freebsd-firewire@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 59E8C16A54F for ; Fri, 29 Jun 2007 11:36:37 +0000 (UTC) (envelope-from freebsd@gm.nunu.org) Received: from py-out-1112.google.com (py-out-1112.google.com [64.233.166.176]) by mx1.freebsd.org (Postfix) with ESMTP id 1D9F113C44B for ; Fri, 29 Jun 2007 11:36:36 +0000 (UTC) (envelope-from freebsd@gm.nunu.org) Received: by py-out-1112.google.com with SMTP id u77so1257074pyb for ; Fri, 29 Jun 2007 04:36:27 -0700 (PDT) Received: by 10.35.90.1 with SMTP id s1mr464352pyl.1183116605807; Fri, 29 Jun 2007 04:30:05 -0700 (PDT) Received: by 10.35.71.5 with HTTP; Fri, 29 Jun 2007 04:30:05 -0700 (PDT) Message-ID: <626eb4530706290430we45e352xf27592d7eac99cf8@mail.gmail.com> Date: Fri, 29 Jun 2007 20:30:05 +0900 From: "Hidetoshi Shimokawa" Sender: freebsd@gm.nunu.org To: "Doug Rabson" In-Reply-To: <200706291024.56591.dfr@rabson.org> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <626eb4530706060746u44226cfajcedb3e169996a51a@mail.gmail.com> <200706291024.56591.dfr@rabson.org> X-Google-Sender-Auth: 338ecdfdb5c1999a Cc: freebsd-firewire@freebsd.org Subject: Re: [CFT] MPSAFE firewire X-BeenThere: freebsd-firewire@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Firewire support in FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jun 2007 11:36:37 -0000 All the access to the RX DMA is dispatched from a taskqueue, so that they are serialized and they don't need a lock. As far as I understand, the code paths you concern are running in a single thread(fw_taskq). Correct me, if I'm wrong. FWXFERQ_HANDLER is currently used only by fwe and fwip. For DV streams, since the queue is access by userland threads, we need a lock. On 6/29/07, Doug Rabson wrote: > > > On Wednesday 06 June 2007, Hidetoshi Shimokawa wrote: > > > I have just committed MPSAFE(Giant free) firewire driver to -current. > > > If you have any problem, please let me know. > > > > I've been looking through the code and I have a few questions. > > > > In fwohci_rbuf_update(), you only call FW_GLOCK() if the FWXFERQ_HANDLER > flag is zero. Doesn't this cause problems for the if_fwip driver (the only > one to set this flag)? As far as I can see, if this flag is set, there is no > mutex protection for any of the dma queues. Shouln't FW_GLOCK be used > always? Also, additional protection is needed in fwip_stream_input where it > manipulates the stvalid and stfree queues. > > > > I'm a bit confused about the async read path too. I'm looking at the code in > fwohci_arcv() and I can't see any mutex protection in this function while it > manipulates the buffers. Is this correct? I see some fossil use of splfw() > here which is why I ask. Following the input path back to the fwip driver > again, I can't see any mutex protection for the driver's unicast packet > input queues. > > > > The last possible problem I noticed reading through the code is that there > is no mutex protection of the fragmented packet reassembly queues in > firewire_input_fragment. Perhaps the fw_com structure should have a mutex > pointer in it which can be initialised to the if_fwip code's mutex and used > in this case. > > -- /\ Hidetoshi Shimokawa \/ simokawa@FreeBSD.ORG From owner-freebsd-firewire@FreeBSD.ORG Fri Jun 29 12:48:54 2007 Return-Path: X-Original-To: freebsd-firewire@FreeBSD.ORG Delivered-To: freebsd-firewire@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1750116A484; Fri, 29 Jun 2007 12:48:54 +0000 (UTC) (envelope-from dfr@rabson.org) Received: from mail.qubesoft.com (gate.qubesoft.com [217.169.36.34]) by mx1.freebsd.org (Postfix) with ESMTP id 9055013C480; Fri, 29 Jun 2007 12:48:53 +0000 (UTC) (envelope-from dfr@rabson.org) Received: from [10.201.19.245] (doug02.dyn.qubesoft.com [10.201.19.245]) by mail.qubesoft.com (8.13.3/8.13.3) with ESMTP id l5TC926s045698; Fri, 29 Jun 2007 13:09:11 +0100 (BST) (envelope-from dfr@rabson.org) In-Reply-To: <626eb4530706290430we45e352xf27592d7eac99cf8@mail.gmail.com> References: <626eb4530706060746u44226cfajcedb3e169996a51a@mail.gmail.com> <200706291024.56591.dfr@rabson.org> <626eb4530706290430we45e352xf27592d7eac99cf8@mail.gmail.com> Mime-Version: 1.0 (Apple Message framework v752.2) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Content-Transfer-Encoding: 7bit From: Doug Rabson Date: Fri, 29 Jun 2007 13:08:47 +0100 To: Hidetoshi Shimokawa X-Mailer: Apple Mail (2.752.2) X-Spam-Status: No, score=-2.8 required=5.0 tests=ALL_TRUSTED autolearn=failed version=3.0.4 X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on mail.qubesoft.com X-Virus-Scanned: ClamAV 0.86.2/3554/Fri Jun 29 11:58:29 2007 on mail.qubesoft.com X-Virus-Status: Clean Cc: freebsd-firewire@FreeBSD.ORG Subject: Re: [CFT] MPSAFE firewire X-BeenThere: freebsd-firewire@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Firewire support in FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jun 2007 12:48:54 -0000 Thanks for clarifying, it makes sense to me now. I guess this also covers the fragment reassembly code in if_fwsubr.c. Perhaps a comment should be added to make it clear that the caller of firewire_input is responsible for serialising access. On 29 Jun 2007, at 12:30, Hidetoshi Shimokawa wrote: > All the access to the RX DMA is dispatched from a taskqueue, > so that they are serialized and they don't need a lock. > As far as I understand, the code paths you concern are running > in a single thread(fw_taskq). > > Correct me, if I'm wrong. > > FWXFERQ_HANDLER is currently used only by fwe and fwip. > For DV streams, since the queue is access by userland threads, > we need a lock. > > On 6/29/07, Doug Rabson wrote: >> >> >> On Wednesday 06 June 2007, Hidetoshi Shimokawa wrote: >> >> > I have just committed MPSAFE(Giant free) firewire driver to - >> current. >> >> > If you have any problem, please let me know. >> >> >> >> I've been looking through the code and I have a few questions. >> >> >> >> In fwohci_rbuf_update(), you only call FW_GLOCK() if the >> FWXFERQ_HANDLER >> flag is zero. Doesn't this cause problems for the if_fwip driver >> (the only >> one to set this flag)? As far as I can see, if this flag is set, >> there is no >> mutex protection for any of the dma queues. Shouln't FW_GLOCK be used >> always? Also, additional protection is needed in fwip_stream_input >> where it >> manipulates the stvalid and stfree queues. >> >> >> >> I'm a bit confused about the async read path too. I'm looking at >> the code in >> fwohci_arcv() and I can't see any mutex protection in this >> function while it >> manipulates the buffers. Is this correct? I see some fossil use of >> splfw() >> here which is why I ask. Following the input path back to the fwip >> driver >> again, I can't see any mutex protection for the driver's unicast >> packet >> input queues. >> >> >> >> The last possible problem I noticed reading through the code is >> that there >> is no mutex protection of the fragmented packet reassembly queues in >> firewire_input_fragment. Perhaps the fw_com structure should have >> a mutex >> pointer in it which can be initialised to the if_fwip code's mutex >> and used >> in this case. >> >> > > > -- > /\ Hidetoshi Shimokawa > \/ simokawa@FreeBSD.ORG