Module Name: src Committed By: skrll Date: Sun Aug 25 16:25:29 UTC 2024
Modified Files: src/sys/dev/cadence: if_cemac.c Log Message: Use roundup - same code before and after. To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 src/sys/dev/cadence/if_cemac.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/cadence/if_cemac.c diff -u src/sys/dev/cadence/if_cemac.c:1.35 src/sys/dev/cadence/if_cemac.c:1.36 --- src/sys/dev/cadence/if_cemac.c:1.35 Sun Aug 25 16:06:46 2024 +++ src/sys/dev/cadence/if_cemac.c Sun Aug 25 16:25:29 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: if_cemac.c,v 1.35 2024/08/25 16:06:46 skrll Exp $ */ +/* $NetBSD: if_cemac.c,v 1.36 2024/08/25 16:25:29 skrll Exp $ */ /* * Copyright (c) 2015 Genetec Corporation. All rights reserved. @@ -40,7 +40,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_cemac.c,v 1.35 2024/08/25 16:06:46 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_cemac.c,v 1.36 2024/08/25 16:25:29 skrll Exp $"); #include <sys/param.h> #include <sys/types.h> @@ -390,8 +390,7 @@ cemac_init(struct cemac_softc *sc) CEMAC_GEM_WRITE(SA4H, 0); /* Allocate a page of memory for receive queue descriptors */ - sc->rbqlen = (ETH_DSC_SIZE * (RX_QLEN + 1) * 2 + PAGE_SIZE - 1) / PAGE_SIZE; - sc->rbqlen *= PAGE_SIZE; + sc->rbqlen = roundup(ETH_DSC_SIZE * (RX_QLEN + 1) * 2, PAGE_SIZE); DPRINTFN(1,("%s: rbqlen=%i\n", __FUNCTION__, sc->rbqlen)); err = bus_dmamem_alloc(sc->sc_dmat, sc->rbqlen, 0, @@ -420,8 +419,7 @@ cemac_init(struct cemac_softc *sc) memset(sc->rbqpage, 0, sc->rbqlen); /* Allocate a page of memory for transmit queue descriptors */ - sc->tbqlen = (ETH_DSC_SIZE * (TX_QLEN + 1) * 2 + PAGE_SIZE - 1) / PAGE_SIZE; - sc->tbqlen *= PAGE_SIZE; + sc->tbqlen = roundup(ETH_DSC_SIZE * (TX_QLEN + 1) * 2, PAGE_SIZE); DPRINTFN(1,("%s: tbqlen=%i\n", __FUNCTION__, sc->tbqlen)); err = bus_dmamem_alloc(sc->sc_dmat, sc->tbqlen, 0,