Lines Matching refs:cgr
269 struct qm_mcc_cgr cgr; member
1457 struct qman_cgr *cgr; in qm_congestion_task() local
1476 list_for_each_entry(cgr, &p->cgr_cbs, node) in qm_congestion_task()
1477 if (cgr->cb && qman_cgrs_get(&c, cgr->cgrid)) in qm_congestion_task()
1478 cgr->cb(p, cgr, qman_cgrs_get(&rr, cgr->cgrid)); in qm_congestion_task()
2180 static int qman_query_cgr(struct qman_cgr *cgr, in qman_query_cgr() argument
2189 mcc->cgr.cgid = cgr->cgrid; in qman_query_cgr()
2208 int qman_query_cgr_congested(struct qman_cgr *cgr, bool *result) in qman_query_cgr_congested() argument
2213 err = qman_query_cgr(cgr, &query_cgr); in qman_query_cgr_congested()
2217 *result = !!query_cgr.cgr.cs; in qman_query_cgr_congested()
2354 static int qm_modify_cgr(struct qman_cgr *cgr, u32 flags, in qm_modify_cgr() argument
2366 mcc->initcgr.cgid = cgr->cgrid; in qm_modify_cgr()
2387 static void qm_cgr_cscn_targ_set(struct __qm_mc_cgr *cgr, int pi, u32 val) in qm_cgr_cscn_targ_set() argument
2390 cgr->cscn_targ_upd_ctrl = cpu_to_be16(pi | in qm_cgr_cscn_targ_set()
2393 cgr->cscn_targ = cpu_to_be32(val | QM_CGR_TARG_PORTAL(pi)); in qm_cgr_cscn_targ_set()
2396 static void qm_cgr_cscn_targ_clear(struct __qm_mc_cgr *cgr, int pi, u32 val) in qm_cgr_cscn_targ_clear() argument
2399 cgr->cscn_targ_upd_ctrl = cpu_to_be16(pi); in qm_cgr_cscn_targ_clear()
2401 cgr->cscn_targ = cpu_to_be32(val & ~QM_CGR_TARG_PORTAL(pi)); in qm_cgr_cscn_targ_clear()
2408 struct qman_cgr cgr; in qman_init_cgr_all() local
2411 for (cgr.cgrid = 0; cgr.cgrid < CGR_NUM; cgr.cgrid++) { in qman_init_cgr_all()
2412 if (qm_modify_cgr(&cgr, QMAN_CGR_FLAG_USE_INIT, NULL)) in qman_init_cgr_all()
2421 int qman_create_cgr(struct qman_cgr *cgr, u32 flags, in qman_create_cgr() argument
2434 if (cgr->cgrid >= CGR_NUM) in qman_create_cgr()
2439 qman_cgr_cpus[cgr->cgrid] = smp_processor_id(); in qman_create_cgr()
2442 cgr->chan = p->config->channel; in qman_create_cgr()
2448 ret = qman_query_cgr(cgr, &cgr_state); in qman_create_cgr()
2452 qm_cgr_cscn_targ_set(&local_opts.cgr, PORTAL_IDX(p), in qman_create_cgr()
2453 be32_to_cpu(cgr_state.cgr.cscn_targ)); in qman_create_cgr()
2458 ret = qm_modify_cgr(cgr, QMAN_CGR_FLAG_USE_INIT, in qman_create_cgr()
2461 ret = qm_modify_cgr(cgr, 0, &local_opts); in qman_create_cgr()
2466 list_add(&cgr->node, &p->cgr_cbs); in qman_create_cgr()
2469 ret = qman_query_cgr(cgr, &cgr_state); in qman_create_cgr()
2476 if (cgr->cb && cgr_state.cgr.cscn_en && in qman_create_cgr()
2477 qman_cgrs_get(&p->cgrs[1], cgr->cgrid)) in qman_create_cgr()
2478 cgr->cb(p, cgr, 1); in qman_create_cgr()
2486 static struct qman_portal *qman_cgr_get_affine_portal(struct qman_cgr *cgr) in qman_cgr_get_affine_portal() argument
2490 if (cgr->chan != p->config->channel) { in qman_cgr_get_affine_portal()
2494 cgr->chan, p->config->channel); in qman_cgr_get_affine_portal()
2502 int qman_delete_cgr(struct qman_cgr *cgr) in qman_delete_cgr() argument
2509 struct qman_portal *p = qman_cgr_get_affine_portal(cgr); in qman_delete_cgr()
2516 list_del(&cgr->node); in qman_delete_cgr()
2522 if (i->cgrid == cgr->cgrid && i->cb) in qman_delete_cgr()
2524 ret = qman_query_cgr(cgr, &cgr_state); in qman_delete_cgr()
2527 list_add(&cgr->node, &p->cgr_cbs); in qman_delete_cgr()
2532 qm_cgr_cscn_targ_clear(&local_opts.cgr, PORTAL_IDX(p), in qman_delete_cgr()
2533 be32_to_cpu(cgr_state.cgr.cscn_targ)); in qman_delete_cgr()
2535 ret = qm_modify_cgr(cgr, 0, &local_opts); in qman_delete_cgr()
2538 list_add(&cgr->node, &p->cgr_cbs); in qman_delete_cgr()
2547 struct qman_cgr *cgr; member
2556 void qman_delete_cgr_safe(struct qman_cgr *cgr) in qman_delete_cgr_safe() argument
2559 if (qman_cgr_cpus[cgr->cgrid] != smp_processor_id()) { in qman_delete_cgr_safe()
2560 smp_call_function_single(qman_cgr_cpus[cgr->cgrid], in qman_delete_cgr_safe()
2561 qman_delete_cgr_smp_call, cgr, true); in qman_delete_cgr_safe()
2566 qman_delete_cgr(cgr); in qman_delete_cgr_safe()
2571 static int qman_update_cgr(struct qman_cgr *cgr, struct qm_mcc_initcgr *opts) in qman_update_cgr() argument
2575 struct qman_portal *p = qman_cgr_get_affine_portal(cgr); in qman_update_cgr()
2581 ret = qm_modify_cgr(cgr, 0, opts); in qman_update_cgr()
2588 struct qman_cgr *cgr; member
2597 params->ret = qman_update_cgr(params->cgr, params->opts); in qman_update_cgr_smp_call()
2600 int qman_update_cgr_safe(struct qman_cgr *cgr, struct qm_mcc_initcgr *opts) in qman_update_cgr_safe() argument
2603 .cgr = cgr, in qman_update_cgr_safe()
2608 if (qman_cgr_cpus[cgr->cgrid] != smp_processor_id()) in qman_update_cgr_safe()
2609 smp_call_function_single(qman_cgr_cpus[cgr->cgrid], in qman_update_cgr_safe()
2613 params.ret = qman_update_cgr(cgr, opts); in qman_update_cgr_safe()