NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: kern/50150: wm(4) failure
Hi Hauke Fath,
On 2016/05/18 21:05, Kengo NAKAHARA wrote:
> The following reply was made to PR kern/50150; it has been noted by GNATS.
>
> From: Kengo NAKAHARA <k-nakahara%iij.ad.jp@localhost>
> To: hf%spg.tu-darmstadt.de@localhost
> Cc: gnats-bugs%NetBSD.org@localhost, kern-bug-people%NetBSD.org@localhost, gnats-admin%NetBSD.org@localhost
> Subject: Re: kern/50150: wm(4) failure
> Date: Wed, 18 May 2016 21:00:14 +0900
>
> Hi,
>
> On 2016/05/18 20:46, Hauke Fath wrote:
> > On Wed, 18 May 2016 16:20:35 +0900, Kengo NAKAHARA wrote:
> >> I think if_wm.c:r1.397 might fix this problem. If you have time, Could
> >> you try if_wm.c:r1.397 or if_wm.c:r1.398 ?
> >
> > Hi Kengo,
> >
> > that's a huge diff against netbsd-7 - almost 40 k in file size alone.
> > Rev. 1.391 does not make it a drop-in replacement for the netbsd-7
> > version, either, and I don't have any particular knowledge about the
> > wm(4) code.
> >
> > Plus, this is about a production machine which cannot run -current.
> >
> > In short: Do you think you could narrow down the relevant changes to a
> > netbsd-7 compatible patch?
>
> Sorry, I assume you use -current.
> However, netbsd-7 seems to have a similar problem. As you indicated,
> there is huge diff between netbsd-7 and -current. So, I will implement
> new patch for netbsd-7 from scratch. Please give me a time for a few
> days... or a few weeks.
I implement that patch for netbsd-7. Here is the patch.
====================
diff --git a/sys/dev/pci/if_wm.c b/sys/dev/pci/if_wm.c
index da64cfc..ee4d00b 100644
--- a/sys/dev/pci/if_wm.c
+++ b/sys/dev/pci/if_wm.c
@@ -315,6 +315,7 @@ struct wm_softc {
/* Control data structures. */
int sc_ntxdesc; /* must be a power of two */
+ int sc_txdesc_size; /* size of a descriptor */
struct wm_control_data_82544 *sc_control_data;
bus_dmamap_t sc_cddmamap; /* control data DMA map */
bus_dma_segment_t sc_cd_seg; /* control data segment */
@@ -483,7 +484,7 @@ do { \
/* If it will wrap around, sync to the end of the ring. */ \
if ((__x + __n) > WM_NTXDESC(sc)) { \
bus_dmamap_sync((sc)->sc_dmat, (sc)->sc_cddmamap, \
- WM_CDTXOFF(__x), sizeof(wiseman_txdesc_t) * \
+ WM_CDTXOFF(__x), (sc)->sc_txdesc_size * \
(WM_NTXDESC(sc) - __x), (ops)); \
__n -= (WM_NTXDESC(sc) - __x); \
__x = 0; \
@@ -491,7 +492,7 @@ do { \
\
/* Now sync whatever is left. */ \
bus_dmamap_sync((sc)->sc_dmat, (sc)->sc_cddmamap, \
- WM_CDTXOFF(__x), sizeof(wiseman_txdesc_t) * __n, (ops)); \
+ WM_CDTXOFF(__x), (sc)->sc_txdesc_size * __n, (ops)); \
} while (/*CONSTCOND*/0)
#define WM_CDRXSYNC(sc, x, ops) \
@@ -1682,6 +1683,10 @@ wm_attach(device_t parent, device_t self, void *aux)
sc->sc_cd_size = sc->sc_type < WM_T_82544 ?
sizeof(struct wm_control_data_82542) :
sizeof(struct wm_control_data_82544);
+ if ((sc->sc_flags & WM_F_NEWQUEUE) != 0)
+ sc->sc_txdesc_size = sizeof(nq_txdesc_t);
+ else
+ sc->sc_txdesc_size = sizeof(wiseman_txdesc_t);
if ((error = bus_dmamem_alloc(sc->sc_dmat, sc->sc_cd_size, PAGE_SIZE,
(bus_size_t) 0x100000000ULL, &sc->sc_cd_seg, 1,
&sc->sc_cd_rseg, 0)) != 0) {
====================
I ensured above patch can apply to if_wm.c:r1.289.2.9 and can build.
Could you try this patch?
Thanks,
--
//////////////////////////////////////////////////////////////////////
Internet Initiative Japan Inc.
Device Engineering Section,
IoT Platform Development Department,
Network Division,
Technology Unit
Kengo NAKAHARA <k-nakahara%iij.ad.jp@localhost>
Home |
Main Index |
Thread Index |
Old Index