mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-04 04:06:26 +00:00
soc: fsl: qbman: Add CGR update function
This adds a function to update a CGR with new parameters. qman_create_cgr can almost be used for this (with flags=0), but it's not suitable because it also registers the callback function. The _safe variant was modeled off of qman_cgr_delete_safe. However, we handle multiple arguments and a return value. Signed-off-by: Sean Anderson <sean.anderson@seco.com> Acked-by: Camelia Groza <camelia.groza@nxp.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
d0e17a4653
commit
914f8b228e
@ -2568,6 +2568,54 @@ void qman_delete_cgr_safe(struct qman_cgr *cgr)
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL(qman_delete_cgr_safe);
|
EXPORT_SYMBOL(qman_delete_cgr_safe);
|
||||||
|
|
||||||
|
static int qman_update_cgr(struct qman_cgr *cgr, struct qm_mcc_initcgr *opts)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
unsigned long irqflags;
|
||||||
|
struct qman_portal *p = qman_cgr_get_affine_portal(cgr);
|
||||||
|
|
||||||
|
if (!p)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
spin_lock_irqsave(&p->cgr_lock, irqflags);
|
||||||
|
ret = qm_modify_cgr(cgr, 0, opts);
|
||||||
|
spin_unlock_irqrestore(&p->cgr_lock, irqflags);
|
||||||
|
put_affine_portal();
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct update_cgr_params {
|
||||||
|
struct qman_cgr *cgr;
|
||||||
|
struct qm_mcc_initcgr *opts;
|
||||||
|
int ret;
|
||||||
|
};
|
||||||
|
|
||||||
|
static void qman_update_cgr_smp_call(void *p)
|
||||||
|
{
|
||||||
|
struct update_cgr_params *params = p;
|
||||||
|
|
||||||
|
params->ret = qman_update_cgr(params->cgr, params->opts);
|
||||||
|
}
|
||||||
|
|
||||||
|
int qman_update_cgr_safe(struct qman_cgr *cgr, struct qm_mcc_initcgr *opts)
|
||||||
|
{
|
||||||
|
struct update_cgr_params params = {
|
||||||
|
.cgr = cgr,
|
||||||
|
.opts = opts,
|
||||||
|
};
|
||||||
|
|
||||||
|
preempt_disable();
|
||||||
|
if (qman_cgr_cpus[cgr->cgrid] != smp_processor_id())
|
||||||
|
smp_call_function_single(qman_cgr_cpus[cgr->cgrid],
|
||||||
|
qman_update_cgr_smp_call, ¶ms,
|
||||||
|
true);
|
||||||
|
else
|
||||||
|
params.ret = qman_update_cgr(cgr, opts);
|
||||||
|
preempt_enable();
|
||||||
|
return params.ret;
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL(qman_update_cgr_safe);
|
||||||
|
|
||||||
/* Cleanup FQs */
|
/* Cleanup FQs */
|
||||||
|
|
||||||
static int _qm_mr_consume_and_match_verb(struct qm_portal *p, int v)
|
static int _qm_mr_consume_and_match_verb(struct qm_portal *p, int v)
|
||||||
|
@ -1171,6 +1171,15 @@ int qman_delete_cgr(struct qman_cgr *cgr);
|
|||||||
*/
|
*/
|
||||||
void qman_delete_cgr_safe(struct qman_cgr *cgr);
|
void qman_delete_cgr_safe(struct qman_cgr *cgr);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* qman_update_cgr_safe - Modifies a congestion group object from any CPU
|
||||||
|
* @cgr: the 'cgr' object to modify
|
||||||
|
* @opts: state of the CGR settings
|
||||||
|
*
|
||||||
|
* This will select the proper CPU and modify the CGR settings.
|
||||||
|
*/
|
||||||
|
int qman_update_cgr_safe(struct qman_cgr *cgr, struct qm_mcc_initcgr *opts);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* qman_query_cgr_congested - Queries CGR's congestion status
|
* qman_query_cgr_congested - Queries CGR's congestion status
|
||||||
* @cgr: the 'cgr' object to query
|
* @cgr: the 'cgr' object to query
|
||||||
|
Loading…
Reference in New Issue
Block a user