Lines Matching defs:cst

746 alloc_etid(struct adapter *sc, struct cxgbe_rate_tag *cst)
757 p->cst = cst;
769 return (t->etid_tab[etid - t->etid_base].cst);
806 struct cxgbe_rate_tag *cst;
816 cst = malloc(sizeof(*cst), M_CXGBE, M_ZERO | M_NOWAIT);
817 if (cst == NULL) {
823 cst->etid = alloc_etid(sc, cst);
824 if (cst->etid < 0) {
825 free(cst, M_CXGBE);
829 mtx_init(&cst->lock, "cst_lock", NULL, MTX_DEF);
830 mbufq_init(&cst->pending_tx, INT_MAX);
831 mbufq_init(&cst->pending_fwack, INT_MAX);
832 m_snd_tag_init(&cst->com, ifp, &cxgbe_rate_tag_sw);
833 cst->flags |= EO_FLOWC_PENDING | EO_SND_TAG_REF;
834 cst->adapter = sc;
835 cst->port_id = pi->port_id;
836 cst->schedcl = schedcl;
837 cst->max_rate = params->rate_limit.max_rate;
838 cst->tx_credits = sc->params.eo_wr_cred;
839 cst->tx_total = cst->tx_credits;
840 cst->plen = 0;
841 cst->ctrl0 = htobe32(V_TXPKT_OPCODE(CPL_TX_PKT_XT) |
849 *pt = &cst->com;
861 struct cxgbe_rate_tag *cst = mst_to_crt(mst);
862 struct adapter *sc = cst->adapter;
865 MPASS(cst->schedcl >= 0 && cst->schedcl < sc->params.nsched_cls);
867 mtx_lock(&cst->lock);
868 MPASS(cst->flags & EO_SND_TAG_REF);
869 rc = t4_reserve_cl_rl_kbps(sc, cst->port_id,
874 t4_release_cl_rl(sc, cst->port_id, cst->schedcl);
875 cst->schedcl = schedcl;
876 cst->max_rate = params->rate_limit.max_rate;
877 mtx_unlock(&cst->lock);
886 struct cxgbe_rate_tag *cst = mst_to_crt(mst);
888 params->rate_limit.max_rate = cst->max_rate;
890 #define CST_TO_MST_QLEVEL_SCALE (IF_SND_QUEUE_LEVEL_MAX / cst->tx_total)
892 (cst->tx_total - cst->tx_credits) * CST_TO_MST_QLEVEL_SCALE;
898 * Unlocks cst and frees it.
901 cxgbe_rate_tag_free_locked(struct cxgbe_rate_tag *cst)
903 struct adapter *sc = cst->adapter;
905 mtx_assert(&cst->lock, MA_OWNED);
906 MPASS((cst->flags & EO_SND_TAG_REF) == 0);
907 MPASS(cst->tx_credits == cst->tx_total);
908 MPASS(cst->plen == 0);
909 MPASS(mbufq_first(&cst->pending_tx) == NULL);
910 MPASS(mbufq_first(&cst->pending_fwack) == NULL);
912 if (cst->etid >= 0)
913 free_etid(sc, cst->etid);
914 if (cst->schedcl != -1)
915 t4_release_cl_rl(sc, cst->port_id, cst->schedcl);
916 mtx_unlock(&cst->lock);
917 mtx_destroy(&cst->lock);
918 free(cst, M_CXGBE);
924 struct cxgbe_rate_tag *cst = mst_to_crt(mst);
926 mtx_lock(&cst->lock);
929 MPASS(cst->flags & EO_SND_TAG_REF);
930 cst->flags &= ~EO_SND_TAG_REF;
932 if (cst->ncompl == 0) {
938 if (cst->tx_credits == cst->tx_total) {
939 cxgbe_rate_tag_free_locked(cst);
940 return; /* cst is gone. */
942 send_etid_flush_wr(cst);
944 mtx_unlock(&cst->lock);