Index | Thread | Search

From:
Mark Kettenis <mark.kettenis@xs4all.nl>
Subject:
Re: rge 64-bit dma
To:
Kevin Lo <kevlo@kevlo.org>
Cc:
tech@openbsd.org
Date:
Tue, 03 Mar 2026 20:27:49 +0100

Download raw body.

Thread
  • Kevin Lo:

    rge 64-bit dma

    • Mark Kettenis:

      rge 64-bit dma

> Date: Mon, 2 Mar 2026 11:01:32 +0800
> From: Kevin Lo <kevlo@kevlo.org>
> 
> Tested rge(4) with 64 bit dma:
> 
> rge0 at pci4 dev 0 function 0 "Realtek RTL8125" rev 0x00: msix, address 00:13:3b:xx:xx:xx
> rge1 at pci6 dev 0 function 0 "Realtek RTL8125" rev 0x04: msix: RTL8125B, address 7c:b5:9b:xx:xx:xx
> rge2 at pci7 dev 0 function 0 "Realtek RTL8125" rev 0x0c: msix: RTL8125D, address 34:5a:60:xx:xx:xx
> 
> rge0 at pci4 dev 0 function 0 "Realtek RTL8126" rev 0x01: msix, address 88:c9:b3:xx:xx:xx
> rge1 at pci5 dev 0 function 0 "Realtek RTL8127" rev 0x05: msix, address 1c:86:0b:xx:xx:xx
> 
> ok?

Yes, this should be fine.

ok kettenis@

> Index: sys/dev/pci/if_rge.c
> ===================================================================
> RCS file: /cvs/src/sys/dev/pci/if_rge.c,v
> diff -u -p -u -p -r1.42 if_rge.c
> --- sys/dev/pci/if_rge.c	26 Jan 2026 01:45:18 -0000	1.42
> +++ sys/dev/pci/if_rge.c	2 Mar 2026 02:27:00 -0000
> @@ -1102,7 +1102,8 @@ rge_allocmem(struct rge_softc *sc)
>  
>  	/* Allocate DMA'able memory for the TX ring. */
>  	error = bus_dmamap_create(sc->sc_dmat, RGE_TX_LIST_SZ, 1,
> -	    RGE_TX_LIST_SZ, 0, BUS_DMA_NOWAIT | BUS_DMA_ALLOCNOW,
> +	    RGE_TX_LIST_SZ, 0,
> +	    BUS_DMA_NOWAIT | BUS_DMA_ALLOCNOW | BUS_DMA_64BIT,
>  	    &q->q_tx.rge_tx_list_map);
>  	if (error) {
>  		printf("%s: can't create TX list map\n", sc->sc_dev.dv_xname);
> @@ -1110,7 +1111,7 @@ rge_allocmem(struct rge_softc *sc)
>  	}
>  	error = bus_dmamem_alloc(sc->sc_dmat, RGE_TX_LIST_SZ, RGE_ALIGN, 0,
>  	    &q->q_tx.rge_tx_listseg, 1, &q->q_tx.rge_tx_listnseg,
> -	    BUS_DMA_NOWAIT| BUS_DMA_ZERO);
> +	    BUS_DMA_NOWAIT | BUS_DMA_ZERO | BUS_DMA_64BIT);
>  	if (error) {
>  		printf("%s: can't alloc TX list\n", sc->sc_dev.dv_xname);
>  		return (error);
> @@ -1142,7 +1143,7 @@ rge_allocmem(struct rge_softc *sc)
>  	for (i = 0; i < RGE_TX_LIST_CNT; i++) {
>  		error = bus_dmamap_create(sc->sc_dmat, RGE_JUMBO_FRAMELEN,
>  		    RGE_TX_NSEGS, RGE_JUMBO_FRAMELEN, 0,
> -		    BUS_DMA_NOWAIT | BUS_DMA_ALLOCNOW,
> +		    BUS_DMA_NOWAIT | BUS_DMA_ALLOCNOW | BUS_DMA_64BIT,
>  		    &q->q_tx.rge_txq[i].txq_dmamap);
>  		if (error) {
>  			printf("%s: can't create DMA map for TX\n",
> @@ -1153,7 +1154,8 @@ rge_allocmem(struct rge_softc *sc)
>  
>  	/* Allocate DMA'able memory for the RX ring. */
>  	error = bus_dmamap_create(sc->sc_dmat, RGE_RX_LIST_SZ, 1,
> -	    RGE_RX_LIST_SZ, 0, BUS_DMA_NOWAIT | BUS_DMA_ALLOCNOW,
> +	    RGE_RX_LIST_SZ, 0,
> +	    BUS_DMA_NOWAIT | BUS_DMA_ALLOCNOW | BUS_DMA_64BIT,
>  	    &q->q_rx.rge_rx_list_map);
>  	if (error) {
>  		printf("%s: can't create RX list map\n", sc->sc_dev.dv_xname);
> @@ -1161,7 +1163,7 @@ rge_allocmem(struct rge_softc *sc)
>  	}
>  	error = bus_dmamem_alloc(sc->sc_dmat, RGE_RX_LIST_SZ, RGE_ALIGN, 0,
>  	    &q->q_rx.rge_rx_listseg, 1, &q->q_rx.rge_rx_listnseg,
> -	    BUS_DMA_NOWAIT| BUS_DMA_ZERO);
> +	    BUS_DMA_NOWAIT | BUS_DMA_ZERO | BUS_DMA_64BIT);
>  	if (error) {
>  		printf("%s: can't alloc RX list\n", sc->sc_dev.dv_xname);
>  		return (error);
> @@ -1192,7 +1194,8 @@ rge_allocmem(struct rge_softc *sc)
>  	/* Create DMA maps for RX buffers. */
>  	for (i = 0; i < RGE_RX_LIST_CNT; i++) {
>  		error = bus_dmamap_create(sc->sc_dmat, RGE_JUMBO_FRAMELEN, 1,
> -		    RGE_JUMBO_FRAMELEN, 0, BUS_DMA_NOWAIT | BUS_DMA_ALLOCNOW,
> +		    RGE_JUMBO_FRAMELEN, 0, 
> +		    BUS_DMA_NOWAIT | BUS_DMA_ALLOCNOW | BUS_DMA_64BIT,
>  		    &q->q_rx.rge_rxq[i].rxq_dmamap);
>  		if (error) {
>  			printf("%s: can't create DMA map for RX\n",
> 
>