Lines Matching full:vi

125 alloc_nm_rxq(struct vi_info *vi, struct sge_nm_rxq *nm_rxq, int intr_idx,  in alloc_nm_rxq()  argument
134 struct adapter *sc = vi->adapter; in alloc_nm_rxq()
135 struct netmap_adapter *na = NA(vi->ifp); in alloc_nm_rxq()
139 len = vi->qsize_rxq * IQ_ESIZE; in alloc_nm_rxq()
151 nm_rxq->vi = vi; in alloc_nm_rxq()
154 nm_rxq->iq_sidx = vi->qsize_rxq - sc->params.sge.spg_len / IQ_ESIZE; in alloc_nm_rxq()
162 ctx = &vi->ctx; in alloc_nm_rxq()
163 children = SYSCTL_CHILDREN(vi->nm_rxq_oid); in alloc_nm_rxq()
193 free_nm_rxq(struct vi_info *vi, struct sge_nm_rxq *nm_rxq) in free_nm_rxq() argument
195 struct adapter *sc = vi->adapter; in free_nm_rxq()
197 if (!(vi->flags & VI_INIT_DONE)) in free_nm_rxq()
201 free_nm_rxq_hwq(vi, nm_rxq); in free_nm_rxq()
213 alloc_nm_txq(struct vi_info *vi, struct sge_nm_txq *nm_txq, int iqidx, int idx) in alloc_nm_txq() argument
217 struct port_info *pi = vi->pi; in alloc_nm_txq()
219 struct netmap_adapter *na = NA(vi->ifp); in alloc_nm_txq()
222 struct sysctl_oid_list *children = SYSCTL_CHILDREN(vi->nm_txq_oid); in alloc_nm_txq()
236 V_TXPKT_VF(vi->vin) | V_TXPKT_VF_VLD(vi->vfvld)); in alloc_nm_txq()
244 oid = SYSCTL_ADD_NODE(&vi->ctx, children, OID_AUTO, name, in alloc_nm_txq()
248 SYSCTL_ADD_UINT(&vi->ctx, children, OID_AUTO, "cntxt_id", CTLFLAG_RD, in alloc_nm_txq()
250 SYSCTL_ADD_U16(&vi->ctx, children, OID_AUTO, "cidx", CTLFLAG_RD, in alloc_nm_txq()
252 SYSCTL_ADD_U16(&vi->ctx, children, OID_AUTO, "pidx", CTLFLAG_RD, in alloc_nm_txq()
259 free_nm_txq(struct vi_info *vi, struct sge_nm_txq *nm_txq) in free_nm_txq() argument
261 struct adapter *sc = vi->adapter; in free_nm_txq()
263 if (!(vi->flags & VI_INIT_DONE)) in free_nm_txq()
267 free_nm_txq_hwq(vi, nm_txq); in free_nm_txq()
277 alloc_nm_rxq_hwq(struct vi_info *vi, struct sge_nm_rxq *nm_rxq) in alloc_nm_rxq_hwq() argument
281 struct adapter *sc = vi->adapter; in alloc_nm_rxq_hwq()
282 struct port_info *pi = vi->pi; in alloc_nm_rxq_hwq()
284 struct netmap_adapter *na = NA(vi->ifp); in alloc_nm_rxq_hwq()
293 bzero(nm_rxq->iq_desc, vi->qsize_rxq * IQ_ESIZE); in alloc_nm_rxq_hwq()
315 V_FW_IQ_CMD_VIID(vi->viid) | in alloc_nm_rxq_hwq()
321 c.iqsize = htobe16(vi->qsize_rxq); in alloc_nm_rxq_hwq()
350 MPASS(nm_rxq->iq_sidx == vi->qsize_rxq - sp->spg_len / IQ_ESIZE); in alloc_nm_rxq_hwq()
390 free_nm_rxq_hwq(struct vi_info *vi, struct sge_nm_rxq *nm_rxq) in free_nm_rxq_hwq() argument
392 struct adapter *sc = vi->adapter; in free_nm_rxq_hwq()
405 alloc_nm_txq_hwq(struct vi_info *vi, struct sge_nm_txq *nm_txq) in alloc_nm_txq_hwq() argument
409 struct adapter *sc = vi->adapter; in alloc_nm_txq_hwq()
410 struct netmap_adapter *na = NA(vi->ifp); in alloc_nm_txq_hwq()
429 F_FW_EQ_ETH_CMD_AUTOEQUEQE | V_FW_EQ_ETH_CMD_VIID(vi->viid)); in alloc_nm_txq_hwq()
432 V_FW_EQ_ETH_CMD_PCIECHN(vi->pi->tx_chan) | F_FW_EQ_ETH_CMD_FETCHRO | in alloc_nm_txq_hwq()
443 device_printf(vi->dev, in alloc_nm_txq_hwq()
488 device_printf(vi->dev, in alloc_nm_txq_hwq()
499 free_nm_txq_hwq(struct vi_info *vi, struct sge_nm_txq *nm_txq) in free_nm_txq_hwq() argument
501 struct adapter *sc = vi->adapter; in free_nm_txq_hwq()
513 cxgbe_netmap_simple_rss(struct adapter *sc, struct vi_info *vi, in cxgbe_netmap_simple_rss() argument
526 for_each_nm_rxq(vi, j, nm_rxq) { in cxgbe_netmap_simple_rss()
541 rss = vi->rss; in cxgbe_netmap_simple_rss()
542 defq = vi->rss[0]; in cxgbe_netmap_simple_rss()
544 for (i = 0; i < vi->rss_size;) { in cxgbe_netmap_simple_rss()
545 for_each_nm_rxq(vi, j, nm_rxq) { in cxgbe_netmap_simple_rss()
554 vi->nm_rss[i++] = nm_rxq->iq_abs_id; in cxgbe_netmap_simple_rss()
555 if (i == vi->rss_size) in cxgbe_netmap_simple_rss()
560 rss = vi->nm_rss; in cxgbe_netmap_simple_rss()
563 rc = -t4_config_rss_range(sc, sc->mbox, vi->viid, 0, vi->rss_size, rss, in cxgbe_netmap_simple_rss()
564 vi->rss_size); in cxgbe_netmap_simple_rss()
568 rc = -t4_config_vi_rss(sc, sc->mbox, vi->viid, vi->hashen, defq, 0, 0); in cxgbe_netmap_simple_rss()
581 cxgbe_netmap_split_rss(struct adapter *sc, struct vi_info *vi, in cxgbe_netmap_split_rss() argument
592 MPASS(vi->nnmrxq > 1); in cxgbe_netmap_split_rss()
594 for_each_nm_rxq(vi, i, nm_rxq) { in cxgbe_netmap_split_rss()
595 j = i / ((vi->nnmrxq + 1) / 2); in cxgbe_netmap_split_rss()
610 return (cxgbe_netmap_simple_rss(sc, vi, ifp, na)); in cxgbe_netmap_split_rss()
625 nm_rxq = &sc->sge.nm_rxq[vi->first_nm_rxq]; in cxgbe_netmap_split_rss()
626 while (i < vi->rss_size / 2) { in cxgbe_netmap_split_rss()
627 for (j = 0; j < (vi->nnmrxq + 1) / 2; j++) { in cxgbe_netmap_split_rss()
639 vi->nm_rss[i++] = nm_rxq[j].iq_abs_id; in cxgbe_netmap_split_rss()
640 if (i == vi->rss_size / 2) in cxgbe_netmap_split_rss()
644 while (i < vi->rss_size) { in cxgbe_netmap_split_rss()
645 for (j = (vi->nnmrxq + 1) / 2; j < vi->nnmrxq; j++) { in cxgbe_netmap_split_rss()
657 vi->nm_rss[i++] = nm_rxq[j].iq_abs_id; in cxgbe_netmap_split_rss()
658 if (i == vi->rss_size) in cxgbe_netmap_split_rss()
663 rc = -t4_config_rss_range(sc, sc->mbox, vi->viid, 0, vi->rss_size, in cxgbe_netmap_split_rss()
664 vi->nm_rss, vi->rss_size); in cxgbe_netmap_split_rss()
668 rc = -t4_config_vi_rss(sc, sc->mbox, vi->viid, vi->hashen, defq, 0, 0); in cxgbe_netmap_split_rss()
676 cxgbe_netmap_rss(struct adapter *sc, struct vi_info *vi, if_t ifp, in cxgbe_netmap_rss() argument
680 if (nm_split_rss == 0 || vi->nnmrxq == 1) in cxgbe_netmap_rss()
681 return (cxgbe_netmap_simple_rss(sc, vi, ifp, na)); in cxgbe_netmap_rss()
683 return (cxgbe_netmap_split_rss(sc, vi, ifp, na)); in cxgbe_netmap_rss()
687 cxgbe_netmap_on(struct adapter *sc, struct vi_info *vi, if_t ifp, in cxgbe_netmap_on() argument
698 MPASS(vi->nnmrxq > 0); in cxgbe_netmap_on()
699 MPASS(vi->nnmtxq > 0); in cxgbe_netmap_on()
701 if ((vi->flags & VI_INIT_DONE) == 0 || in cxgbe_netmap_on()
728 for_each_nm_rxq(vi, i, nm_rxq) { in cxgbe_netmap_on()
733 alloc_nm_rxq_hwq(vi, nm_rxq); in cxgbe_netmap_on()
758 for_each_nm_txq(vi, i, nm_txq) { in cxgbe_netmap_on()
763 alloc_nm_txq_hwq(vi, nm_txq); in cxgbe_netmap_on()
768 if (vi->nm_rss == NULL) { in cxgbe_netmap_on()
769 vi->nm_rss = malloc(vi->rss_size * sizeof(uint16_t), M_CXGBE, in cxgbe_netmap_on()
773 return (cxgbe_netmap_rss(sc, vi, ifp, na)); in cxgbe_netmap_on()
777 cxgbe_netmap_off(struct adapter *sc, struct vi_info *vi, if_t ifp, in cxgbe_netmap_off() argument
786 MPASS(vi->nnmrxq > 0); in cxgbe_netmap_off()
787 MPASS(vi->nnmtxq > 0); in cxgbe_netmap_off()
792 if ((vi->flags & VI_INIT_DONE) == 0) in cxgbe_netmap_off()
796 rc = cxgbe_netmap_rss(sc, vi, ifp, na); in cxgbe_netmap_off()
800 for_each_nm_txq(vi, i, nm_txq) { in cxgbe_netmap_off()
808 device_printf(vi->dev, in cxgbe_netmap_off()
818 for_each_nm_rxq(vi, i, nm_rxq) { in cxgbe_netmap_off()
831 device_printf(vi->dev, in cxgbe_netmap_off()
854 struct vi_info *vi = if_getsoftc(ifp); in cxgbe_netmap_reg() local
855 struct adapter *sc = vi->adapter; in cxgbe_netmap_reg()
858 rc = begin_synchronized_op(sc, vi, SLEEP_OK | INTR_OK, "t4nmreg"); in cxgbe_netmap_reg()
862 rc = cxgbe_netmap_on(sc, vi, ifp, na); in cxgbe_netmap_reg()
864 rc = cxgbe_netmap_off(sc, vi, ifp, na); in cxgbe_netmap_reg()
1108 struct vi_info *vi = if_getsoftc(ifp); in cxgbe_netmap_txsync() local
1109 struct adapter *sc = vi->adapter; in cxgbe_netmap_txsync()
1110 struct sge_nm_txq *nm_txq = &sc->sge.nm_txq[vi->first_nm_txq + kring->ring_id]; in cxgbe_netmap_txsync()
1172 struct vi_info *vi = if_getsoftc(ifp); in cxgbe_netmap_rxsync() local
1173 struct adapter *sc = vi->adapter; in cxgbe_netmap_rxsync()
1174 struct sge_nm_rxq *nm_rxq = &sc->sge.nm_rxq[vi->first_nm_rxq + kring->ring_id]; in cxgbe_netmap_rxsync()
1256 cxgbe_nm_attach(struct vi_info *vi) in cxgbe_nm_attach() argument
1262 MPASS(vi->nnmrxq > 0); in cxgbe_nm_attach()
1263 MPASS(vi->ifp != NULL); in cxgbe_nm_attach()
1265 pi = vi->pi; in cxgbe_nm_attach()
1270 na.ifp = vi->ifp; in cxgbe_nm_attach()
1274 na.num_tx_desc = vi->qsize_txq - sc->params.sge.spg_len / EQ_ESIZE; in cxgbe_nm_attach()
1282 na.num_rx_desc = rounddown(vi->qsize_rxq, 8); in cxgbe_nm_attach()
1286 na.num_tx_rings = vi->nnmtxq; in cxgbe_nm_attach()
1287 na.num_rx_rings = vi->nnmrxq; in cxgbe_nm_attach()
1293 cxgbe_nm_detach(struct vi_info *vi) in cxgbe_nm_detach() argument
1296 MPASS(vi->nnmrxq > 0); in cxgbe_nm_detach()
1297 MPASS(vi->ifp != NULL); in cxgbe_nm_detach()
1299 netmap_detach(vi->ifp); in cxgbe_nm_detach()
1329 struct vi_info *vi = nm_rxq->vi; in service_nm_rxq() local
1330 struct adapter *sc = vi->adapter; in service_nm_rxq()
1331 if_t ifp = vi->ifp; in service_nm_rxq()