Date: Thu, 12 Jun 2014 11:15:19 +0000 (UTC) From: John Baldwin <jhb@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r267385 - in head/sys/dev: e1000 i40e ixgb ixgbe Message-ID: <201406121115.s5CBFJgP086177@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jhb Date: Thu Jun 12 11:15:19 2014 New Revision: 267385 URL: http://svnweb.freebsd.org/changeset/base/267385 Log: - Don't compare bus_dma map pointers for static DMA allocations against NULL to determine if bus_dmamap_unload() or bus_dmamem_free() should be called. Instead, check the associated bus and virtual addresses. - Don't clear static DMA maps to NULL. Reviewed by: jfv Modified: head/sys/dev/e1000/if_em.c head/sys/dev/e1000/if_igb.c head/sys/dev/e1000/if_lem.c head/sys/dev/i40e/i40e_osdep.c head/sys/dev/ixgb/if_ixgb.c head/sys/dev/ixgbe/ixgbe.c head/sys/dev/ixgbe/ixv.c Modified: head/sys/dev/e1000/if_em.c ============================================================================== --- head/sys/dev/e1000/if_em.c Thu Jun 12 09:59:11 2014 (r267384) +++ head/sys/dev/e1000/if_em.c Thu Jun 12 11:15:19 2014 (r267385) @@ -3088,7 +3088,6 @@ fail_2: bus_dmamem_free(dma->dma_tag, dma->dma_vaddr, dma->dma_map); bus_dma_tag_destroy(dma->dma_tag); fail_0: - dma->dma_map = NULL; dma->dma_tag = NULL; return (error); @@ -3099,12 +3098,15 @@ em_dma_free(struct adapter *adapter, str { if (dma->dma_tag == NULL) return; - if (dma->dma_map != NULL) { + if (dma->dma_paddr != 0) { bus_dmamap_sync(dma->dma_tag, dma->dma_map, BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); bus_dmamap_unload(dma->dma_tag, dma->dma_map); + dma->dma_paddr = 0; + } + if (dma->dma_vaddr != NULL) { bus_dmamem_free(dma->dma_tag, dma->dma_vaddr, dma->dma_map); - dma->dma_map = NULL; + dma->dma_vaddr = NULL; } bus_dma_tag_destroy(dma->dma_tag); dma->dma_tag = NULL; Modified: head/sys/dev/e1000/if_igb.c ============================================================================== --- head/sys/dev/e1000/if_igb.c Thu Jun 12 09:59:11 2014 (r267384) +++ head/sys/dev/e1000/if_igb.c Thu Jun 12 11:15:19 2014 (r267385) @@ -3259,7 +3259,6 @@ fail_2: bus_dmamem_free(dma->dma_tag, dma->dma_vaddr, dma->dma_map); bus_dma_tag_destroy(dma->dma_tag); fail_0: - dma->dma_map = NULL; dma->dma_tag = NULL; return (error); @@ -3270,12 +3269,15 @@ igb_dma_free(struct adapter *adapter, st { if (dma->dma_tag == NULL) return; - if (dma->dma_map != NULL) { + if (dma->dma_paddr != 0) { bus_dmamap_sync(dma->dma_tag, dma->dma_map, BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); bus_dmamap_unload(dma->dma_tag, dma->dma_map); + dma->dma_paddr = 0; + } + if (dma->dma_vaddr != NULL) { bus_dmamem_free(dma->dma_tag, dma->dma_vaddr, dma->dma_map); - dma->dma_map = NULL; + dma->dma_vaddr = NULL; } bus_dma_tag_destroy(dma->dma_tag); dma->dma_tag = NULL; Modified: head/sys/dev/e1000/if_lem.c ============================================================================== --- head/sys/dev/e1000/if_lem.c Thu Jun 12 09:59:11 2014 (r267384) +++ head/sys/dev/e1000/if_lem.c Thu Jun 12 11:15:19 2014 (r267385) @@ -2527,7 +2527,6 @@ fail_2: bus_dmamem_free(dma->dma_tag, dma->dma_vaddr, dma->dma_map); bus_dma_tag_destroy(dma->dma_tag); fail_0: - dma->dma_map = NULL; dma->dma_tag = NULL; return (error); @@ -2538,12 +2537,15 @@ lem_dma_free(struct adapter *adapter, st { if (dma->dma_tag == NULL) return; - if (dma->dma_map != NULL) { + if (dma->dma_paddr != 0) { bus_dmamap_sync(dma->dma_tag, dma->dma_map, BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); bus_dmamap_unload(dma->dma_tag, dma->dma_map); + dma->dma_paddr = 0; + } + if (dma->dma_vaddr != NULL) { bus_dmamem_free(dma->dma_tag, dma->dma_vaddr, dma->dma_map); - dma->dma_map = NULL; + dma->dma_vaddr = NULL; } bus_dma_tag_destroy(dma->dma_tag); dma->dma_tag = NULL; Modified: head/sys/dev/i40e/i40e_osdep.c ============================================================================== --- head/sys/dev/i40e/i40e_osdep.c Thu Jun 12 09:59:11 2014 (r267384) +++ head/sys/dev/i40e/i40e_osdep.c Thu Jun 12 11:15:19 2014 (r267385) @@ -116,7 +116,6 @@ fail_2: fail_1: bus_dma_tag_destroy(dma->tag); fail_0: - dma->map = NULL; dma->tag = NULL; return (err); } Modified: head/sys/dev/ixgb/if_ixgb.c ============================================================================== --- head/sys/dev/ixgb/if_ixgb.c Thu Jun 12 09:59:11 2014 (r267384) +++ head/sys/dev/ixgb/if_ixgb.c Thu Jun 12 11:15:19 2014 (r267385) @@ -1459,7 +1459,6 @@ fail_2: fail_1: bus_dma_tag_destroy(dma->dma_tag); fail_0: - dma->dma_map = NULL; dma->dma_tag = NULL; return (r); } Modified: head/sys/dev/ixgbe/ixgbe.c ============================================================================== --- head/sys/dev/ixgbe/ixgbe.c Thu Jun 12 09:59:11 2014 (r267384) +++ head/sys/dev/ixgbe/ixgbe.c Thu Jun 12 11:15:19 2014 (r267385) @@ -2788,7 +2788,6 @@ fail_2: fail_1: bus_dma_tag_destroy(dma->dma_tag); fail_0: - dma->dma_map = NULL; dma->dma_tag = NULL; return (r); } Modified: head/sys/dev/ixgbe/ixv.c ============================================================================== --- head/sys/dev/ixgbe/ixv.c Thu Jun 12 09:59:11 2014 (r267384) +++ head/sys/dev/ixgbe/ixv.c Thu Jun 12 11:15:19 2014 (r267385) @@ -1955,7 +1955,6 @@ fail_2: fail_1: bus_dma_tag_destroy(dma->dma_tag); fail_0: - dma->dma_map = NULL; dma->dma_tag = NULL; return (r); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201406121115.s5CBFJgP086177>