Changeset View
Changeset View
Standalone View
Standalone View
sys/net/iflib.c
Context not available. | |||||
#include <x86/iommu/busdma_dmar.h> | #include <x86/iommu/busdma_dmar.h> | ||||
#endif | #endif | ||||
#include <sys/bitstring.h> | |||||
/* | /* | ||||
* enable accounting of every mbuf as it comes in to and goes out of | * enable accounting of every mbuf as it comes in to and goes out of | ||||
* iflib's software descriptor references | * iflib's software descriptor references | ||||
Context not available. | |||||
#endif | #endif | ||||
/* implicit pad */ | /* implicit pad */ | ||||
bitstr_t *ifl_rx_bitmap;; | |||||
sbruno: There appears to be an additional semi-colon here. | |||||
qidx_t ifl_fragidx; | |||||
/* constant */ | /* constant */ | ||||
qidx_t ifl_size; | qidx_t ifl_size; | ||||
uint16_t ifl_buf_size; | uint16_t ifl_buf_size; | ||||
Context not available. | |||||
_iflib_fl_refill(if_ctx_t ctx, iflib_fl_t fl, int count) | _iflib_fl_refill(if_ctx_t ctx, iflib_fl_t fl, int count) | ||||
{ | { | ||||
struct mbuf *m; | struct mbuf *m; | ||||
int idx, pidx = fl->ifl_pidx; | int idx, frag_idx = fl->ifl_fragidx, pidx = fl->ifl_pidx; | ||||
Not Done Inline ActionsFor readability, please make changes on a new line of declaration instead of inserting the new variable into the middle of the existing line. sbruno: For readability, please make changes on a new line of declaration instead of inserting the new… | |||||
Not Done Inline ActionsSure, I'll consider this. bhargava.marreddy_broadcom.com: Sure, I'll consider this. | |||||
Not Done Inline ActionsSure, I'll consider this. bhargava.marreddy_broadcom.com: Sure, I'll consider this. | |||||
caddr_t cl, *sd_cl; | caddr_t cl, *sd_cl; | ||||
struct mbuf **sd_m; | struct mbuf **sd_m; | ||||
uint8_t *sd_flags; | uint8_t *sd_flags; | ||||
Context not available. | |||||
* | * | ||||
* If the cluster is still set then we know a minimum sized packet was received | * If the cluster is still set then we know a minimum sized packet was received | ||||
*/ | */ | ||||
if ((cl = sd_cl[idx]) == NULL) { | bit_ffc_at(fl->ifl_rx_bitmap, frag_idx, fl->ifl_size, &frag_idx); | ||||
if ((cl = sd_cl[idx] = m_cljget(NULL, M_NOWAIT, fl->ifl_buf_size)) == NULL) | if ((frag_idx < 0) || (frag_idx >= fl->ifl_size)) | ||||
bit_ffc(fl->ifl_rx_bitmap, fl->ifl_size, &frag_idx); | |||||
if ((cl = sd_cl[frag_idx]) == NULL) { | |||||
if ((cl = sd_cl[frag_idx] = m_cljget(NULL, M_NOWAIT, fl->ifl_buf_size)) == NULL) | |||||
break; | break; | ||||
#if MEMORY_LOGGING | #if MEMORY_LOGGING | ||||
fl->ifl_cl_enqueued++; | fl->ifl_cl_enqueued++; | ||||
Context not available. | |||||
cb_arg.error = 0; | cb_arg.error = 0; | ||||
q = fl->ifl_rxq; | q = fl->ifl_rxq; | ||||
MPASS(sd_map != NULL); | MPASS(sd_map != NULL); | ||||
MPASS(sd_map[idx] != NULL); | MPASS(sd_map[frag_idx] != NULL); | ||||
err = bus_dmamap_load(fl->ifl_desc_tag, sd_map[idx], | err = bus_dmamap_load(fl->ifl_desc_tag, sd_map[frag_idx], | ||||
cl, fl->ifl_buf_size, _rxq_refill_cb, &cb_arg, 0); | cl, fl->ifl_buf_size, _rxq_refill_cb, &cb_arg, 0); | ||||
bus_dmamap_sync(fl->ifl_desc_tag, sd_map[idx], BUS_DMASYNC_PREREAD); | bus_dmamap_sync(fl->ifl_desc_tag, sd_map[frag_idx], | ||||
BUS_DMASYNC_PREREAD); | |||||
if (err != 0 || cb_arg.error) { | if (err != 0 || cb_arg.error) { | ||||
/* | /* | ||||
Context not available. | |||||
} | } | ||||
bus_addr = cb_arg.seg.ds_addr; | bus_addr = cb_arg.seg.ds_addr; | ||||
} | } | ||||
sd_flags[idx] |= RX_SW_DESC_INUSE; | bit_set(fl->ifl_rx_bitmap, frag_idx); | ||||
sd_flags[frag_idx] |= RX_SW_DESC_INUSE; | |||||
MPASS(sd_m[idx] == NULL); | MPASS(sd_m[frag_idx] == NULL); | ||||
sd_cl[idx] = cl; | sd_cl[frag_idx] = cl; | ||||
sd_m[idx] = m; | sd_m[frag_idx] = m; | ||||
fl->ifl_rxd_idxs[i] = idx; | fl->ifl_rxd_idxs[i] = frag_idx; | ||||
fl->ifl_bus_addrs[i] = bus_addr; | fl->ifl_bus_addrs[i] = bus_addr; | ||||
fl->ifl_vm_addrs[i] = cl; | fl->ifl_vm_addrs[i] = cl; | ||||
fl->ifl_credits++; | fl->ifl_credits++; | ||||
Context not available. | |||||
ctx->isc_rxd_refill(ctx->ifc_softc, &iru); | ctx->isc_rxd_refill(ctx->ifc_softc, &iru); | ||||
i = 0; | i = 0; | ||||
pidx = idx; | pidx = idx; | ||||
fl->ifl_pidx = idx; | |||||
} | } | ||||
fl->ifl_pidx = idx; | |||||
} | } | ||||
done: | done: | ||||
Context not available. | |||||
bus_dmamap_sync(fl->ifl_ifdi->idi_tag, fl->ifl_ifdi->idi_map, | bus_dmamap_sync(fl->ifl_ifdi->idi_tag, fl->ifl_ifdi->idi_map, | ||||
BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); | BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); | ||||
ctx->isc_rxd_flush(ctx->ifc_softc, fl->ifl_rxq->ifr_id, fl->ifl_id, pidx); | ctx->isc_rxd_flush(ctx->ifc_softc, fl->ifl_rxq->ifr_id, fl->ifl_id, pidx); | ||||
fl->ifl_fragidx = frag_idx; | |||||
} | } | ||||
static __inline void | static __inline void | ||||
Context not available. | |||||
/* | /* | ||||
* Reset free list values | * Reset free list values | ||||
*/ | */ | ||||
fl->ifl_credits = fl->ifl_cidx = fl->ifl_pidx = fl->ifl_gen = 0;; | fl->ifl_credits = fl->ifl_cidx = fl->ifl_pidx = fl->ifl_gen = fl->ifl_fragidx = 0; | ||||
bzero(idi->idi_vaddr, idi->idi_size); | bzero(idi->idi_vaddr, idi->idi_size); | ||||
} | } | ||||
Context not available. | |||||
if_ctx_t ctx = rxq->ifr_ctx; | if_ctx_t ctx = rxq->ifr_ctx; | ||||
if_softc_ctx_t sctx = &ctx->ifc_softc_ctx; | if_softc_ctx_t sctx = &ctx->ifc_softc_ctx; | ||||
bit_nclear(fl->ifl_rx_bitmap, 0, fl->ifl_size); | |||||
/* | /* | ||||
** Free current RX buffer structs and their mbufs | ** Free current RX buffer structs and their mbufs | ||||
*/ | */ | ||||
Context not available. | |||||
if (map != NULL) | if (map != NULL) | ||||
bus_dmamap_sync(fl->ifl_ifdi->idi_tag, fl->ifl_ifdi->idi_map, | bus_dmamap_sync(fl->ifl_ifdi->idi_tag, fl->ifl_ifdi->idi_map, | ||||
BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); | BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); | ||||
bit_clear(fl->ifl_rx_bitmap, cidx); | |||||
} | } | ||||
static struct mbuf * | static struct mbuf * | ||||
Context not available. | |||||
iflib_txq_t txq; | iflib_txq_t txq; | ||||
iflib_rxq_t rxq; | iflib_rxq_t rxq; | ||||
device_t dev = ctx->ifc_dev; | device_t dev = ctx->ifc_dev; | ||||
int i; | int i, j; | ||||
struct taskqgroup *tqg; | struct taskqgroup *tqg; | ||||
iflib_fl_t fl; | |||||
/* Make sure VLANS are not using driver */ | /* Make sure VLANS are not using driver */ | ||||
if (if_vlantrunkinuse(ifp)) { | if (if_vlantrunkinuse(ifp)) { | ||||
Context not available. | |||||
for (i = 0, rxq = ctx->ifc_rxqs; i < NRXQSETS(ctx); i++, rxq++) { | for (i = 0, rxq = ctx->ifc_rxqs; i < NRXQSETS(ctx); i++, rxq++) { | ||||
if (rxq->ifr_task.gt_uniq != NULL) | if (rxq->ifr_task.gt_uniq != NULL) | ||||
taskqgroup_detach(tqg, &rxq->ifr_task); | taskqgroup_detach(tqg, &rxq->ifr_task); | ||||
for (j = 0, fl = rxq->ifr_fl; j < rxq->ifr_nfl; j++, fl++) | |||||
free(fl->ifl_rx_bitmap, M_IFLIB); | |||||
} | } | ||||
tqg = qgroup_if_config_tqg; | tqg = qgroup_if_config_tqg; | ||||
if (ctx->ifc_admin_task.gt_uniq != NULL) | if (ctx->ifc_admin_task.gt_uniq != NULL) | ||||
Context not available. | |||||
err = ENOMEM; | err = ENOMEM; | ||||
goto err_rx_desc; | goto err_rx_desc; | ||||
} | } | ||||
for (j = 0, fl = rxq->ifr_fl; j < rxq->ifr_nfl; j++, fl++) | |||||
fl->ifl_rx_bitmap = bit_alloc(fl->ifl_size, M_IFLIB, M_WAITOK|M_ZERO); | |||||
} | } | ||||
/* TXQs */ | /* TXQs */ | ||||
Context not available. |
There appears to be an additional semi-colon here.