aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/sfxge/common/efx_intr.c
diff options
context:
space:
mode:
authorAndrew Rybchenko <arybchik@FreeBSD.org>2018-11-27 13:00:39 +0000
committerAndrew Rybchenko <arybchik@FreeBSD.org>2018-11-27 13:00:39 +0000
commit4aaefb9559ec6e09dbd4f323b4465197a7ef3b50 (patch)
tree323aa126b458fdc0a692cbabe84630b940c115a9 /sys/dev/sfxge/common/efx_intr.c
parent725bb178d36cb8432845f10a9ad7edd6e63a6383 (diff)
downloadsrc-4aaefb9559ec6e09dbd4f323b4465197a7ef3b50.tar.gz
src-4aaefb9559ec6e09dbd4f323b4465197a7ef3b50.zip
sfxge(4): add efsys macro to get memory region size
EFSYS_MEM_SIZE() reports the DMA mapped size of an efsys_mem_t allocated region (the allocation size may be different due to memory allocator and DMA alignment restrictions). This ensures that common code internals have explicit knowledge of the usable size of DMA mapped memory regions. Submitted by: Andy Moreton <amoreton at solarflare.com> Sponsored by: Solarflare Communications, Inc. Differential Revision: https://reviews.freebsd.org/D18170
Notes
Notes: svn path=/head/; revision=341051
Diffstat (limited to 'sys/dev/sfxge/common/efx_intr.c')
-rw-r--r--sys/dev/sfxge/common/efx_intr.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/sys/dev/sfxge/common/efx_intr.c b/sys/dev/sfxge/common/efx_intr.c
index 911679656d13..279413807e7c 100644
--- a/sys/dev/sfxge/common/efx_intr.c
+++ b/sys/dev/sfxge/common/efx_intr.c
@@ -318,6 +318,12 @@ siena_intr_init(
{
efx_intr_t *eip = &(enp->en_intr);
efx_oword_t oword;
+ efx_rc_t rc;
+
+ if ((esmp == NULL) || (EFSYS_MEM_SIZE(esmp) < EFX_INTR_SIZE)) {
+ rc = EINVAL;
+ goto fail1;
+ }
/*
* bug17213 workaround.
@@ -349,6 +355,11 @@ siena_intr_init(
EFX_BAR_WRITEO(enp, FR_AZ_INT_ADR_REG_KER, &oword);
return (0);
+
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+ return (rc);
}
static void