Date: Wed, 23 Sep 2009 13:00:26 -0700 From: Pyun YongHyeon <pyunyh@gmail.com> To: WATANABE Kazuhiro <CQG00620@nifty.ne.jp> Cc: freebsd-current <freebsd-current@freebsd.org> Subject: Re: de(4) does not work on 8.0-RC1 (was: Re: [patch] de(4) has not worked on 8-current since Feb 13) Message-ID: <20090923200026.GC1099@michelle.cdnetworks.com> In-Reply-To: <20090923164246.E5F8882365@mail1.asahi-net.or.jp> References: <20081210125627.25732615CD@mail.asahi-net.or.jp> <494019AB.3020505@samsco.org> <20081211130057.B53EE5D0A4@mail.asahi-net.or.jp> <7d6fde3d0812111253n4b8f7135n76e9cef63158943e@mail.gmail.com> <20081212153714.3E15760FA3@mail.asahi-net.or.jp> <20090923164246.E5F8882365@mail1.asahi-net.or.jp>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
On Thu, Sep 24, 2009 at 01:42:46AM +0900, WATANABE Kazuhiro wrote:
> Hi, all.
>
> This problem still exists on 8.0-RC1. Does anyone have the same
> problem?
>
> I have two de(4) based NICs and they works well with 7.2-RELEASE.
> On 8.0-RC1, they cannot send any (almost all) data from it.
>
> * Corega FastEther PCI-TX
>
> > dmesg | grep ^de0
> de0: <Digital 21140A Fast Ethernet> port 0xe000-0xe07f mem 0xd9001000-0xd900107f irq 12 at device 15.0 on pci0
> de0: 21140A [10-100Mb/s] pass 2.2
> de0: WARNING: using obsoleted if_watchdog interface
> de0: Ethernet address: 00:00:f4:xx:xx:xx
> de0: [ITHREAD]
> > uname -a
> FreeBSD scorpio.sign.local 8.0-RC1 FreeBSD 8.0-RC1 #1: Wed Sep 23 00:44:22 JST 2009 nabe@capricorn:/FreeBSD/obj/i386/RELENG_8/FreeBSD/RELENG_8/src/sys/GENERIC i386
>
> * SMC EtherPower10/100
>
> > dmesg | grep ^de0
> de0: <Digital 21140A Fast Ethernet> port 0x6000-0x607f mem 0x20410000-0x2041007f irq 3 at device 13.0 on pci0
> de0: SMC 9332BDT 21140A [10-100Mb/s] pass 2.0
> de0: WARNING: using obsoleted if_watchdog interface
> de0: Ethernet address: 00:00:c0:xx:xx:xx
> de0: [ITHREAD]
> > uname -a
> FreeBSD aries.sign.local 8.0-RC1 FreeBSD 8.0-RC1 #0: Fri Sep 18 07:57:47 UTC 2009 root@asuna:/usr/obj/pc98/usr/src/sys/GENERIC pc98
>
>
Hi,
I'm not familiar with de(4) and didn't have chance to read data
sheet. So I'm not sure whether what alignment restriction the
controller has but PAGE_SIZE alignment for descriptors looks wrong.
As John said I think Tx buffer has no alignment limitation. Here is
guess work, would you give it try?
[-- Attachment #2 --]
Index: sys/dev/de/if_devar.h
===================================================================
--- sys/dev/de/if_devar.h (revision 197441)
+++ sys/dev/de/if_devar.h (working copy)
@@ -104,7 +104,7 @@
tulip_descinfo_t *ri_descinfo;
bus_dma_tag_t ri_ring_tag;
bus_dmamap_t ri_ring_map;
- uint32_t ri_dma_addr;
+ bus_addr_t ri_dma_addr;
bus_dma_tag_t ri_data_tag;
bus_dmamap_t *ri_data_maps;
} tulip_ringinfo_t;
@@ -134,11 +134,7 @@
* architecture which can't handle unaligned accesses) because with
* 100Mb/s cards the copying is just too much of a hit.
*/
-#if !defined(__i386__)
-#define TULIP_COPY_RXDATA 1
-#endif
-#define TULIP_DATA_PER_DESC 2032
#define TULIP_TXTIMER 4
#define TULIP_RXDESCS 48
#define TULIP_TXDESCS 128
@@ -560,7 +556,7 @@
*/
bus_dma_tag_t tulip_setup_tag;
bus_dmamap_t tulip_setup_map;
- uint32_t tulip_setup_dma_addr;
+ bus_addr_t tulip_setup_dma_addr;
u_int32_t *tulip_setupbuf;
u_int32_t tulip_setupdata[192 / sizeof(u_int32_t)];
char tulip_boardid[24];
Index: sys/dev/de/if_de.c
===================================================================
--- sys/dev/de/if_de.c (revision 197441)
+++ sys/dev/de/if_de.c (working copy)
@@ -160,7 +160,7 @@
static void
tulip_dma_map_addr(void *arg, bus_dma_segment_t *segs, int nseg, int error)
{
- u_int32_t *paddr;
+ bus_addr_t *paddr;
if (error)
return;
@@ -182,7 +182,7 @@
KASSERT(nseg == 1, ("too many DMA segments"));
KASSERT(segs[0].ds_len >= TULIP_RX_BUFLEN, ("receive buffer too small"));
- desc->d_addr1 = segs[0].ds_addr;
+ desc->d_addr1 = segs[0].ds_addr & 0xffffffff;
desc->d_length1 = TULIP_RX_BUFLEN;
#ifdef not_needed
/* These should already always be zero. */
@@ -3171,8 +3171,8 @@
sc->tulip_ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
}
- TULIP_CSR_WRITE(sc, csr_txlist, sc->tulip_txinfo.ri_dma_addr);
- TULIP_CSR_WRITE(sc, csr_rxlist, sc->tulip_rxinfo.ri_dma_addr);
+ TULIP_CSR_WRITE(sc, csr_txlist, sc->tulip_txinfo.ri_dma_addr & 0xffffffff);
+ TULIP_CSR_WRITE(sc, csr_rxlist, sc->tulip_rxinfo.ri_dma_addr & 0xffffffff);
TULIP_CSR_WRITE(sc, csr_busmode,
(1 << (3 /*pci_max_burst_len*/ + 8))
|TULIP_BUSMODE_CACHE_ALIGN8
@@ -3488,7 +3488,7 @@
struct mbuf *m0;
KASSERT(ms != NULL, ("no packet to accept"));
-#if defined(TULIP_COPY_RXDATA)
+#ifndef __NO_STRICT_ALIGNMENT
/*
* Copy the data into a new mbuf that is properly aligned. If
* we fail to allocate a new mbuf, then drop the packet. We will
@@ -3527,7 +3527,7 @@
*/
ms = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR);
-#if defined(TULIP_COPY_RXDATA)
+#ifndef __NO_STRICT_ALIGNMENT
skip_input:
#endif
if (ms == NULL) {
@@ -4016,9 +4016,9 @@
eop = nextout;
eop->di_desc->d_flag &= TULIP_DFLAG_ENDRING|TULIP_DFLAG_CHAIN;
eop->di_desc->d_status = d_status;
- eop->di_desc->d_addr1 = segs[segcnt].ds_addr;
+ eop->di_desc->d_addr1 = segs[segcnt].ds_addr & 0xffffffff;
eop->di_desc->d_length1 = segs[segcnt].ds_len;
- eop->di_desc->d_addr2 = segs[segcnt+1].ds_addr;
+ eop->di_desc->d_addr2 = segs[segcnt+1].ds_addr & 0xffffffff;
eop->di_desc->d_length2 = segs[segcnt+1].ds_len;
d_status = TULIP_DSTS_OWNER;
if (++nextout == ri->ri_last)
@@ -4028,7 +4028,7 @@
eop = nextout;
eop->di_desc->d_flag &= TULIP_DFLAG_ENDRING|TULIP_DFLAG_CHAIN;
eop->di_desc->d_status = d_status;
- eop->di_desc->d_addr1 = segs[segcnt].ds_addr;
+ eop->di_desc->d_addr1 = segs[segcnt].ds_addr & 0xffffffff;
eop->di_desc->d_length1 = segs[segcnt].ds_len;
eop->di_desc->d_addr2 = 0;
eop->di_desc->d_length2 = 0;
@@ -4194,7 +4194,7 @@
nextout->d_length2 = 0;
nextout->d_addr2 = 0;
nextout->d_length1 = sizeof(sc->tulip_setupdata);
- nextout->d_addr1 = sc->tulip_setup_dma_addr;
+ nextout->d_addr1 = sc->tulip_setup_dma_addr & 0xffffffff;
bus_dmamap_sync(sc->tulip_setup_tag, sc->tulip_setup_map,
BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE);
TULIP_TXDESC_PRESYNC(ri);
@@ -4491,7 +4491,7 @@
/* Allocate memory for a single descriptor ring. */
static int
tulip_busdma_allocring(device_t dev, tulip_softc_t * const sc, size_t count,
- bus_size_t maxsize, int nsegs, tulip_ringinfo_t *ri, const char *name)
+ bus_size_t align, int nsegs, tulip_ringinfo_t *ri, const char *name)
{
size_t size;
int error, i;
@@ -4499,7 +4499,7 @@
/* First, setup a tag. */
ri->ri_max = count;
size = count * sizeof(tulip_desc_t);
- error = bus_dma_tag_create(NULL, PAGE_SIZE, 0, BUS_SPACE_MAXADDR_32BIT,
+ error = bus_dma_tag_create(NULL, 32, 0, BUS_SPACE_MAXADDR_32BIT,
BUS_SPACE_MAXADDR, NULL, NULL, size, 1, size, 0, NULL, NULL,
&ri->ri_ring_tag);
if (error) {
@@ -4527,9 +4527,9 @@
}
/* Allocate a tag for the data buffers. */
- error = bus_dma_tag_create(NULL, 4, 0,
+ error = bus_dma_tag_create(NULL, align, 0,
BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
- maxsize, nsegs, TULIP_DATA_PER_DESC, 0, NULL, NULL, &ri->ri_data_tag);
+ MCLBYTES * nsegs, nsegs, MCLBYTES, 0, NULL, NULL, &ri->ri_data_tag);
if (error) {
device_printf(dev, "failed to allocate %s buffer dma tag\n", name);
return (error);
@@ -4563,6 +4563,7 @@
if (sc->tulip_setupbuf != NULL) {
bus_dmamem_free(sc->tulip_setup_tag, sc->tulip_setupbuf,
sc->tulip_setup_map);
+ bus_dmamap_destroy(sc->tulip_setup_tag, sc->tulip_setup_map);
sc->tulip_setup_map = NULL;
sc->tulip_setupbuf = NULL;
}
@@ -4586,8 +4587,8 @@
/*
* Allocate space and dmamap for transmit ring.
*/
- error = tulip_busdma_allocring(dev, sc, TULIP_TXDESCS, TULIP_DATA_PER_DESC,
- TULIP_MAX_TXSEG, &sc->tulip_txinfo, "transmit");
+ error = tulip_busdma_allocring(dev, sc, TULIP_TXDESCS, 1, TULIP_MAX_TXSEG,
+ &sc->tulip_txinfo, "transmit");
if (error)
return (error);
@@ -4598,7 +4599,7 @@
* a waste in practice though as an ethernet frame can easily fit
* in TULIP_RX_BUFLEN bytes.
*/
- error = tulip_busdma_allocring(dev, sc, TULIP_RXDESCS, MCLBYTES, 1,
+ error = tulip_busdma_allocring(dev, sc, TULIP_RXDESCS, 4, 1,
&sc->tulip_rxinfo, "receive");
if (error)
return (error);
@@ -4606,7 +4607,7 @@
/*
* Allocate a DMA tag, memory, and map for setup descriptor
*/
- error = bus_dma_tag_create(NULL, 4, 0,
+ error = bus_dma_tag_create(NULL, 32, 0,
BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
sizeof(sc->tulip_setupdata), 1, sizeof(sc->tulip_setupdata), 0,
NULL, NULL, &sc->tulip_setup_tag);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090923200026.GC1099>
