Lines Matching defs:ss

1200 	struct mxge_slice_state *ss;
1264 rx_done = &sc->ss[slice].rx_done;
1301 ss = &sc->ss[slice];
1303 ss->irq_claim = irq_claim + (2 * slice);
1305 ss->rx_done.idx = 0;
1306 ss->rx_done.cnt = 0;
1307 ss->tx.req = 0;
1308 ss->tx.done = 0;
1309 ss->tx.pkt_done = 0;
1310 ss->tx.queue_active = 0;
1311 ss->tx.activate = 0;
1312 ss->tx.deactivate = 0;
1313 ss->tx.wake = 0;
1314 ss->tx.defrag = 0;
1315 ss->tx.stall = 0;
1316 ss->rx_big.cnt = 0;
1317 ss->rx_small.cnt = 0;
1318 ss->lc.lro_bad_csum = 0;
1319 ss->lc.lro_queued = 0;
1320 ss->lc.lro_flushed = 0;
1321 if (ss->fw_stats != NULL) {
1322 bzero(ss->fw_stats, sizeof *ss->fw_stats);
1437 struct mxge_slice_state *ss;
1444 ss = &sc->ss[slice];
1445 if (ss == NULL || ss->sysctl_tree == NULL)
1447 sysctl_ctx_free(&ss->sysctl_ctx);
1448 ss->sysctl_tree = NULL;
1460 struct mxge_slice_state *ss;
1466 fw = sc->ss[0].fw_stats;
1623 ss = &sc->ss[slice];
1624 sysctl_ctx_init(&ss->sysctl_ctx);
1625 ctx = &ss->sysctl_ctx;
1628 ss->sysctl_tree =
1631 children = SYSCTL_CHILDREN(ss->sysctl_tree);
1634 CTLFLAG_RD, &ss->rx_small.cnt,
1638 CTLFLAG_RD, &ss->rx_big.cnt,
1641 "lro_flushed", CTLFLAG_RD, &ss->lc.lro_flushed,
1645 "lro_bad_csum", CTLFLAG_RD, &ss->lc.lro_bad_csum,
1649 "lro_queued", CTLFLAG_RD, &ss->lc.lro_queued,
1660 CTLFLAG_RD, &ss->tx.req,
1665 CTLFLAG_RD, &ss->tx.done,
1669 CTLFLAG_RD, &ss->tx.pkt_done,
1673 CTLFLAG_RD, &ss->tx.stall,
1677 CTLFLAG_RD, &ss->tx.wake,
1681 CTLFLAG_RD, &ss->tx.defrag,
1685 CTLFLAG_RD, &ss->tx.queue_active,
1689 CTLFLAG_RD, &ss->tx.activate,
1693 CTLFLAG_RD, &ss->tx.deactivate,
1773 mxge_parse_tx(struct mxge_slice_state *ss, struct mbuf *m,
1802 ss->scratch);
1803 pi->ip = (struct ip *)(ss->scratch + pi->ip_off);
1812 sizeof(struct tcphdr), ss->scratch);
1813 pi->ip = (struct ip *)(ss->scratch + pi->ip_off);
1822 ss->scratch);
1823 pi->ip6 = (struct ip6_hdr *)(ss->scratch + pi->ip_off);
1834 if (pi->ip_off + pi->ip_hlen > ss->sc->max_tso6_hlen)
1840 sizeof(struct tcphdr), ss->scratch);
1841 pi->ip6 = (struct ip6_hdr *)(ss->scratch + pi->ip_off);
1855 mxge_encap_tso(struct mxge_slice_state *ss, struct mbuf *m,
1921 tx = &ss->tx;
2014 if ((ss->sc->num_slices > 1) && tx->queue_active == 0) {
2027 ss->oerrors++;
2075 mxge_encap(struct mxge_slice_state *ss, struct mbuf *m)
2089 sc = ss->sc;
2091 tx = &ss->tx;
2102 if (mxge_parse_tx(ss, m, &pi))
2118 ss->tx.defrag++;
2137 mxge_encap_tso(ss, m, cnt, &pi);
2223 if ((ss->sc->num_slices > 1) && tx->queue_active == 0) {
2236 ss->oerrors++;
2250 tx = &sc->ss[slice].tx;
2260 mxge_start_locked(struct mxge_slice_state *ss)
2267 sc = ss->sc;
2269 tx = &ss->tx;
2280 mxge_encap(ss, m);
2283 if (((ss->if_drv_flags & IFF_DRV_OACTIVE) == 0)
2285 ss->if_drv_flags |= IFF_DRV_OACTIVE;
2291 mxge_transmit_locked(struct mxge_slice_state *ss, struct mbuf *m)
2298 sc = ss->sc;
2300 tx = &ss->tx;
2302 if ((ss->if_drv_flags & (IFF_DRV_RUNNING|IFF_DRV_OACTIVE)) !=
2313 mxge_encap(ss, m);
2318 mxge_start_locked(ss);
2326 struct mxge_slice_state *ss;
2334 ss = &sc->ss[slice];
2335 tx = &ss->tx;
2338 err = mxge_transmit_locked(ss, m);
2350 mxge_start_locked(struct mxge_slice_state *ss)
2357 sc = ss->sc;
2359 tx = &ss->tx;
2369 mxge_encap(ss, m);
2382 struct mxge_slice_state *ss;
2385 ss = &sc->ss[0];
2386 mtx_lock(&ss->tx.mtx);
2387 mxge_start_locked(ss);
2388 mtx_unlock(&ss->tx.mtx);
2416 mxge_get_buf_small(struct mxge_slice_state *ss, bus_dmamap_t map, int idx)
2420 mxge_rx_ring_t *rx = &ss->rx_small;
2449 mxge_get_buf_big(struct mxge_slice_state *ss, bus_dmamap_t map, int idx)
2453 mxge_rx_ring_t *rx = &ss->rx_big;
2660 mxge_rx_done_big(struct mxge_slice_state *ss, uint32_t len,
2671 sc = ss->sc;
2673 rx = &ss->rx_big;
2679 if (mxge_get_buf_big(ss, rx->extra_map, idx)) {
2700 ss->ipackets++;
2707 m->m_pkthdr.flowid = (ss - sc->ss);
2719 if (lro && (0 == tcp_lro_rx(&ss->lc, m, 0)))
2728 mxge_rx_done_small(struct mxge_slice_state *ss, uint32_t len,
2739 sc = ss->sc;
2741 rx = &ss->rx_small;
2747 if (mxge_get_buf_small(ss, rx->extra_map, idx)) {
2768 ss->ipackets++;
2775 m->m_pkthdr.flowid = (ss - sc->ss);
2787 if (lro && (0 == tcp_lro_rx(&ss->lc, m, csum)))
2796 mxge_clean_rx_done(struct mxge_slice_state *ss)
2798 mxge_rx_done_t *rx_done = &ss->rx_done;
2804 lro = ss->sc->ifp->if_capenable & IFCAP_LRO;
2810 mxge_rx_done_small(ss, length, checksum, lro);
2812 mxge_rx_done_big(ss, length, checksum, lro);
2821 tcp_lro_flush_all(&ss->lc);
2827 mxge_tx_done(struct mxge_slice_state *ss, uint32_t mcp_idx)
2836 tx = &ss->tx;
2837 ifp = ss->sc->ifp;
2845 ss->obytes += m->m_pkthdr.len;
2847 ss->omcasts++;
2848 ss->opackets++;
2863 flags = &ss->if_drv_flags;
2867 mtx_lock(&ss->tx.mtx);
2871 ss->tx.wake++;
2872 mxge_start_locked(ss);
2875 if ((ss->sc->num_slices > 1) && (tx->req == tx->done)) {
2886 mtx_unlock(&ss->tx.mtx);
3080 struct mxge_slice_state *ss = arg;
3081 mxge_softc_t *sc = ss->sc;
3082 mcp_irq_data_t *stats = ss->fw_stats;
3083 mxge_tx_ring_t *tx = &ss->tx;
3084 mxge_rx_done_t *rx_done = &ss->rx_done;
3092 if (ss != sc->ss) {
3093 mxge_clean_rx_done(ss);
3094 *ss->irq_claim = be32toh(3);
3122 mxge_tx_done(ss, (int)send_done_count);
3123 mxge_clean_rx_done(ss);
3131 if (__predict_false((ss == sc->ss) && stats->stats_updated)) {
3162 *ss->irq_claim = be32toh(3);
3163 *(ss->irq_claim + 1) = be32toh(3);
3182 mxge_free_slice_mbufs(struct mxge_slice_state *ss)
3187 tcp_lro_free(&ss->lc);
3189 for (i = 0; i <= ss->rx_big.mask; i++) {
3190 if (ss->rx_big.info[i].m == NULL)
3192 bus_dmamap_unload(ss->rx_big.dmat,
3193 ss->rx_big.info[i].map);
3194 m_freem(ss->rx_big.info[i].m);
3195 ss->rx_big.info[i].m = NULL;
3198 for (i = 0; i <= ss->rx_small.mask; i++) {
3199 if (ss->rx_small.info[i].m == NULL)
3201 bus_dmamap_unload(ss->rx_small.dmat,
3202 ss->rx_small.info[i].map);
3203 m_freem(ss->rx_small.info[i].m);
3204 ss->rx_small.info[i].m = NULL;
3208 if (ss->tx.info == NULL)
3211 for (i = 0; i <= ss->tx.mask; i++) {
3212 ss->tx.info[i].flag = 0;
3213 if (ss->tx.info[i].m == NULL)
3215 bus_dmamap_unload(ss->tx.dmat,
3216 ss->tx.info[i].map);
3217 m_freem(ss->tx.info[i].m);
3218 ss->tx.info[i].m = NULL;
3228 mxge_free_slice_mbufs(&sc->ss[slice]);
3232 mxge_free_slice_rings(struct mxge_slice_state *ss)
3237 if (ss->rx_done.entry != NULL)
3238 mxge_dma_free(&ss->rx_done.dma);
3239 ss->rx_done.entry = NULL;
3241 if (ss->tx.req_bytes != NULL)
3242 free(ss->tx.req_bytes, M_DEVBUF);
3243 ss->tx.req_bytes = NULL;
3245 if (ss->tx.seg_list != NULL)
3246 free(ss->tx.seg_list, M_DEVBUF);
3247 ss->tx.seg_list = NULL;
3249 if (ss->rx_small.shadow != NULL)
3250 free(ss->rx_small.shadow, M_DEVBUF);
3251 ss->rx_small.shadow = NULL;
3253 if (ss->rx_big.shadow != NULL)
3254 free(ss->rx_big.shadow, M_DEVBUF);
3255 ss->rx_big.shadow = NULL;
3257 if (ss->tx.info != NULL) {
3258 if (ss->tx.dmat != NULL) {
3259 for (i = 0; i <= ss->tx.mask; i++) {
3260 bus_dmamap_destroy(ss->tx.dmat,
3261 ss->tx.info[i].map);
3263 bus_dma_tag_destroy(ss->tx.dmat);
3265 free(ss->tx.info, M_DEVBUF);
3267 ss->tx.info = NULL;
3269 if (ss->rx_small.info != NULL) {
3270 if (ss->rx_small.dmat != NULL) {
3271 for (i = 0; i <= ss->rx_small.mask; i++) {
3272 bus_dmamap_destroy(ss->rx_small.dmat,
3273 ss->rx_small.info[i].map);
3275 bus_dmamap_destroy(ss->rx_small.dmat,
3276 ss->rx_small.extra_map);
3277 bus_dma_tag_destroy(ss->rx_small.dmat);
3279 free(ss->rx_small.info, M_DEVBUF);
3281 ss->rx_small.info = NULL;
3283 if (ss->rx_big.info != NULL) {
3284 if (ss->rx_big.dmat != NULL) {
3285 for (i = 0; i <= ss->rx_big.mask; i++) {
3286 bus_dmamap_destroy(ss->rx_big.dmat,
3287 ss->rx_big.info[i].map);
3289 bus_dmamap_destroy(ss->rx_big.dmat,
3290 ss->rx_big.extra_map);
3291 bus_dma_tag_destroy(ss->rx_big.dmat);
3293 free(ss->rx_big.info, M_DEVBUF);
3295 ss->rx_big.info = NULL;
3304 mxge_free_slice_rings(&sc->ss[slice]);
3308 mxge_alloc_slice_rings(struct mxge_slice_state *ss, int rx_ring_entries,
3311 mxge_softc_t *sc = ss->sc;
3317 ss->rx_small.mask = ss->rx_big.mask = rx_ring_entries - 1;
3318 ss->rx_done.mask = (2 * rx_ring_entries) - 1;
3321 bytes = rx_ring_entries * sizeof (*ss->rx_small.shadow);
3322 ss->rx_small.shadow = malloc(bytes, M_DEVBUF, M_ZERO|M_WAITOK);
3324 bytes = rx_ring_entries * sizeof (*ss->rx_big.shadow);
3325 ss->rx_big.shadow = malloc(bytes, M_DEVBUF, M_ZERO|M_WAITOK);
3328 bytes = rx_ring_entries * sizeof (*ss->rx_small.info);
3329 ss->rx_small.info = malloc(bytes, M_DEVBUF, M_ZERO|M_WAITOK);
3331 bytes = rx_ring_entries * sizeof (*ss->rx_big.info);
3332 ss->rx_big.info = malloc(bytes, M_DEVBUF, M_ZERO|M_WAITOK);
3346 &ss->rx_small.dmat); /* tag */
3373 &ss->rx_big.dmat); /* tag */
3379 for (i = 0; i <= ss->rx_small.mask; i++) {
3380 err = bus_dmamap_create(ss->rx_small.dmat, 0,
3381 &ss->rx_small.info[i].map);
3388 err = bus_dmamap_create(ss->rx_small.dmat, 0,
3389 &ss->rx_small.extra_map);
3396 for (i = 0; i <= ss->rx_big.mask; i++) {
3397 err = bus_dmamap_create(ss->rx_big.dmat, 0,
3398 &ss->rx_big.info[i].map);
3405 err = bus_dmamap_create(ss->rx_big.dmat, 0,
3406 &ss->rx_big.extra_map);
3417 if (ss != ss->sc->ss)
3421 ss->tx.mask = tx_ring_entries - 1;
3422 ss->tx.max_desc = MIN(MXGE_MAX_SEND_DESC, tx_ring_entries / 4);
3427 sizeof (*ss->tx.req_list) * (ss->tx.max_desc + 4);
3428 ss->tx.req_bytes = malloc(bytes, M_DEVBUF, M_WAITOK);
3430 ss->tx.req_list = (mcp_kreq_ether_send_t *)
3431 ((unsigned long)(ss->tx.req_bytes + 7) & ~7UL);
3434 bytes = sizeof (*ss->tx.seg_list) * ss->tx.max_desc;
3435 ss->tx.seg_list = (bus_dma_segment_t *)
3439 bytes = tx_ring_entries * sizeof (*ss->tx.info);
3440 ss->tx.info = malloc(bytes, M_DEVBUF, M_ZERO|M_WAITOK);
3450 ss->tx.max_desc - 2, /* num segs */
3454 &ss->tx.dmat); /* tag */
3464 for (i = 0; i <= ss->tx.mask; i++) {
3465 err = bus_dmamap_create(ss->tx.dmat, 0,
3466 &ss->tx.info[i].map);
3500 err = mxge_alloc_slice_rings(&sc->ss[slice],
3551 mxge_slice_open(struct mxge_slice_state *ss, int nbufs, int cl_size)
3559 sc = ss->sc;
3560 slice = ss - sc->ss;
3563 (void)tcp_lro_init(&ss->lc);
3565 ss->lc.ifp = sc->ifp;
3576 ss->tx.lanai =
3578 ss->tx.send_go = (volatile uint32_t *)
3580 ss->tx.send_stop = (volatile uint32_t *)
3588 ss->rx_small.lanai =
3592 ss->rx_big.lanai =
3602 for (i = 0; i <= ss->rx_small.mask; i++) {
3603 map = ss->rx_small.info[i].map;
3604 err = mxge_get_buf_small(ss, map, i);
3607 i, ss->rx_small.mask + 1);
3611 for (i = 0; i <= ss->rx_big.mask; i++) {
3612 ss->rx_big.shadow[i].addr_low = 0xffffffff;
3613 ss->rx_big.shadow[i].addr_high = 0xffffffff;
3615 ss->rx_big.nbufs = nbufs;
3616 ss->rx_big.cl_size = cl_size;
3617 ss->rx_big.mlen = ss->sc->ifp->if_mtu + ETHER_HDR_LEN +
3619 for (i = 0; i <= ss->rx_big.mask; i += ss->rx_big.nbufs) {
3620 map = ss->rx_big.info[i].map;
3621 err = mxge_get_buf_big(ss, map, i);
3624 i, ss->rx_big.mask + 1);
3638 struct mxge_slice_state *ss;
3715 ss = &sc->ss[slice];
3717 MXGE_LOWPART_TO_U32(ss->fw_stats_dma.bus_addr);
3719 MXGE_HIGHPART_TO_U32(ss->fw_stats_dma.bus_addr);
3726 bus = sc->ss->fw_stats_dma.bus_addr;
3745 err = mxge_slice_open(&sc->ss[slice], nbufs, cl_size);
3761 ss = &sc->ss[slice];
3762 ss->if_drv_flags |= IFF_DRV_RUNNING;
3763 ss->if_drv_flags &= ~IFF_DRV_OACTIVE;
3784 struct mxge_slice_state *ss;
3790 ss = &sc->ss[slice];
3791 ss->if_drv_flags &= ~IFF_DRV_RUNNING;
3867 struct mxge_slice_state *ss;
3920 ss = &sc->ss[s];
3921 mtx_lock(&ss->tx.mtx);
3943 ss = &sc->ss[s];
3945 mxge_start_locked(ss);
3947 mtx_unlock(&ss->tx.mtx);
3979 tx = &sc->ss[slice].tx;
3988 be32toh(sc->ss->fw_stats->send_done_count));
3995 uint32_t rx_pause = be32toh(sc->ss->fw_stats->dropped_pause);
4007 tx = &sc->ss[i].tx;
4044 rv += sc->ss[s].ipackets;
4048 rv += sc->ss[s].opackets;
4052 rv += sc->ss[s].oerrors;
4057 rv += sc->ss[s].obytes;
4061 rv += sc->ss[s].omcasts;
4065 rv += sc->ss[s].tx.br->br_drops;
4347 struct mxge_slice_state *ss;
4351 if (sc->ss == NULL)
4355 ss = &sc->ss[i];
4356 if (ss->fw_stats != NULL) {
4357 mxge_dma_free(&ss->fw_stats_dma);
4358 ss->fw_stats = NULL;
4360 if (ss->tx.br != NULL) {
4361 drbr_free(ss->tx.br, M_DEVBUF);
4362 ss->tx.br = NULL;
4365 mtx_destroy(&ss->tx.mtx);
4367 if (ss->rx_done.entry != NULL) {
4368 mxge_dma_free(&ss->rx_done.dma);
4369 ss->rx_done.entry = NULL;
4372 free(sc->ss, M_DEVBUF);
4373 sc->ss = NULL;
4380 struct mxge_slice_state *ss;
4392 bytes = sizeof (*sc->ss) * sc->num_slices;
4393 sc->ss = malloc(bytes, M_DEVBUF, M_NOWAIT | M_ZERO);
4394 if (sc->ss == NULL)
4397 ss = &sc->ss[i];
4399 ss->sc = sc;
4403 bytes = max_intr_slots * sizeof (*ss->rx_done.entry);
4404 err = mxge_dma_alloc(sc, &ss->rx_done.dma, bytes, 4096);
4407 ss->rx_done.entry = ss->rx_done.dma.addr;
4408 bzero(ss->rx_done.entry, bytes);
4420 bytes = sizeof (*ss->fw_stats);
4421 err = mxge_dma_alloc(sc, &ss->fw_stats_dma,
4422 sizeof (*ss->fw_stats), 64);
4425 ss->fw_stats = (mcp_irq_data_t *)ss->fw_stats_dma.addr;
4426 snprintf(ss->tx.mtx_name, sizeof(ss->tx.mtx_name),
4428 mtx_init(&ss->tx.mtx, ss->tx.mtx_name, NULL, MTX_DEF);
4430 ss->tx.br = buf_ring_alloc(2048, M_DEVBUF, M_WAITOK,
4431 &ss->tx.mtx);
4594 mxge_intr, &sc->ss[i], &sc->msix_ih[i]);
4672 mxge_intr, &sc->ss[0], &sc->ih);
4911 sizeof (sc->ss[0].scratch));