iflib.c (301567) | iflib.c (302372) |
---|---|
1/*- 2 * Copyright (c) 2014-2016, Matthew Macy <mmacy@nextbsd.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are met: 7 * 8 * 1. Redistributions of source code must retain the above copyright notice, --- 12 unchanged lines hidden (view full) --- 21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 * POSSIBILITY OF SUCH DAMAGE. 26 */ 27 28#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2014-2016, Matthew Macy <mmacy@nextbsd.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are met: 7 * 8 * 1. Redistributions of source code must retain the above copyright notice, --- 12 unchanged lines hidden (view full) --- 21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 * POSSIBILITY OF SUCH DAMAGE. 26 */ 27 28#include <sys/cdefs.h> |
29__FBSDID("$FreeBSD: head/sys/net/iflib.c 301567 2016-06-07 20:26:00Z cem $"); | 29__FBSDID("$FreeBSD: head/sys/net/iflib.c 302372 2016-07-06 14:09:49Z nwhitehorn $"); |
30 31#include "opt_inet.h" 32#include "opt_inet6.h" 33#include "opt_acpi.h" 34 35#include <sys/param.h> 36#include <sys/types.h> 37#include <sys/bus.h> --- 3805 unchanged lines hidden (view full) --- 3843{ 3844 if_shared_ctx_t sctx = ctx->ifc_sctx; 3845 device_t dev = ctx->ifc_dev; 3846 int nrxqsets = ctx->ifc_softc_ctx.isc_nrxqsets; 3847 int ntxqsets = ctx->ifc_softc_ctx.isc_ntxqsets; 3848 iflib_txq_t txq; 3849 iflib_rxq_t rxq; 3850 iflib_fl_t fl = NULL; | 30 31#include "opt_inet.h" 32#include "opt_inet6.h" 33#include "opt_acpi.h" 34 35#include <sys/param.h> 36#include <sys/types.h> 37#include <sys/bus.h> --- 3805 unchanged lines hidden (view full) --- 3843{ 3844 if_shared_ctx_t sctx = ctx->ifc_sctx; 3845 device_t dev = ctx->ifc_dev; 3846 int nrxqsets = ctx->ifc_softc_ctx.isc_nrxqsets; 3847 int ntxqsets = ctx->ifc_softc_ctx.isc_ntxqsets; 3848 iflib_txq_t txq; 3849 iflib_rxq_t rxq; 3850 iflib_fl_t fl = NULL; |
3851 int i, j, err, txconf, rxconf, fl_ifdi_offset; | 3851 int i, j, cpu, err, txconf, rxconf, fl_ifdi_offset; |
3852 iflib_dma_info_t ifdip; 3853 uint32_t *rxqsizes = sctx->isc_rxqsizes; 3854 uint32_t *txqsizes = sctx->isc_txqsizes; 3855 uint8_t nrxqs = sctx->isc_nrxqs; 3856 uint8_t ntxqs = sctx->isc_ntxqs; 3857 int nfree_lists = sctx->isc_nfl ? sctx->isc_nfl : 1; 3858 caddr_t *vaddrs; 3859 uint64_t *paddrs; --- 32 unchanged lines hidden (view full) --- 3892 ctx->ifc_txqs = txq; 3893 ctx->ifc_rxqs = rxq; 3894 txq = NULL; 3895 rxq = NULL; 3896 3897 /* 3898 * XXX handle allocation failure 3899 */ | 3852 iflib_dma_info_t ifdip; 3853 uint32_t *rxqsizes = sctx->isc_rxqsizes; 3854 uint32_t *txqsizes = sctx->isc_txqsizes; 3855 uint8_t nrxqs = sctx->isc_nrxqs; 3856 uint8_t ntxqs = sctx->isc_ntxqs; 3857 int nfree_lists = sctx->isc_nfl ? sctx->isc_nfl : 1; 3858 caddr_t *vaddrs; 3859 uint64_t *paddrs; --- 32 unchanged lines hidden (view full) --- 3892 ctx->ifc_txqs = txq; 3893 ctx->ifc_rxqs = rxq; 3894 txq = NULL; 3895 rxq = NULL; 3896 3897 /* 3898 * XXX handle allocation failure 3899 */ |
3900 for (txconf = i = 0; i < ntxqsets; i++, txconf++, txq++) { | 3900 for (txconf = i = 0, cpu = CPU_FIRST(); i < ntxqsets; i++, txconf++, txq++, cpu = CPU_NEXT(cpu)) { |
3901 /* Set up some basics */ 3902 3903 if ((ifdip = malloc(sizeof(struct iflib_dma_info) * ntxqs, M_IFLIB, M_WAITOK|M_ZERO)) == NULL) { 3904 device_printf(dev, "failed to allocate iflib_dma_info\n"); 3905 err = ENOMEM; 3906 goto err_tx_desc; 3907 } 3908 txq->ift_ifdi = ifdip; 3909 for (j = 0; j < ntxqs; j++, ifdip++) { 3910 if (iflib_dma_alloc(ctx, txqsizes[j], ifdip, BUS_DMA_NOWAIT)) { 3911 device_printf(dev, "Unable to allocate Descriptor memory\n"); 3912 err = ENOMEM; 3913 goto err_tx_desc; 3914 } 3915 bzero((void *)ifdip->idi_vaddr, txqsizes[j]); 3916 } 3917 txq->ift_ctx = ctx; 3918 txq->ift_id = i; 3919 /* XXX fix this */ | 3901 /* Set up some basics */ 3902 3903 if ((ifdip = malloc(sizeof(struct iflib_dma_info) * ntxqs, M_IFLIB, M_WAITOK|M_ZERO)) == NULL) { 3904 device_printf(dev, "failed to allocate iflib_dma_info\n"); 3905 err = ENOMEM; 3906 goto err_tx_desc; 3907 } 3908 txq->ift_ifdi = ifdip; 3909 for (j = 0; j < ntxqs; j++, ifdip++) { 3910 if (iflib_dma_alloc(ctx, txqsizes[j], ifdip, BUS_DMA_NOWAIT)) { 3911 device_printf(dev, "Unable to allocate Descriptor memory\n"); 3912 err = ENOMEM; 3913 goto err_tx_desc; 3914 } 3915 bzero((void *)ifdip->idi_vaddr, txqsizes[j]); 3916 } 3917 txq->ift_ctx = ctx; 3918 txq->ift_id = i; 3919 /* XXX fix this */ |
3920 txq->ift_timer.c_cpu = i % mp_ncpus; 3921 txq->ift_db_check.c_cpu = i % mp_ncpus; | 3920 txq->ift_timer.c_cpu = cpu; 3921 txq->ift_db_check.c_cpu = cpu; |
3922 txq->ift_nbr = nbuf_rings; 3923 3924 if (iflib_txsd_alloc(txq)) { 3925 device_printf(dev, "Critical Failure setting up TX buffers\n"); 3926 err = ENOMEM; 3927 goto err_tx_desc; 3928 } 3929 --- 877 unchanged lines hidden --- | 3922 txq->ift_nbr = nbuf_rings; 3923 3924 if (iflib_txsd_alloc(txq)) { 3925 device_printf(dev, "Critical Failure setting up TX buffers\n"); 3926 err = ENOMEM; 3927 goto err_tx_desc; 3928 } 3929 --- 877 unchanged lines hidden --- |