1 From dfd2deb8bc482588999a4f03b5ab5d049e50fdb0 Mon Sep 17 00:00:00 2001
2 From: Camelia Groza <camelia.groza@nxp.com>
3 Date: Wed, 30 May 2018 14:51:35 +0300
4 Subject: [PATCH] sdk_dpaa: ceetm: propagate the ceetm channel through the
7 Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
9 .../ethernet/freescale/sdk_dpaa/dpaa_eth_ceetm.c | 61 +++++++++-------------
10 .../ethernet/freescale/sdk_dpaa/dpaa_eth_ceetm.h | 4 +-
11 2 files changed, 29 insertions(+), 36 deletions(-)
13 --- a/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_ceetm.c
14 +++ b/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_ceetm.c
15 @@ -242,7 +242,6 @@ static int ceetm_config_lfq(struct qm_ce
16 /* Configure a prio ceetm class */
17 static int ceetm_config_prio_cls(struct ceetm_class *cls,
18 struct net_device *dev,
19 - struct qm_ceetm_channel *channel,
23 @@ -253,22 +252,22 @@ static int ceetm_config_prio_cls(struct
26 /* Claim and configure the CCG */
27 - err = ceetm_config_ccg(&cls->prio.ccg, channel, id, cls->prio.fq,
28 + err = ceetm_config_ccg(&cls->prio.ccg, cls->ch, id, cls->prio.fq,
33 /* Claim and configure the CQ */
34 - err = qman_ceetm_cq_claim(&cls->prio.cq, channel, id, cls->prio.ccg);
35 + err = qman_ceetm_cq_claim(&cls->prio.cq, cls->ch, id, cls->prio.ccg);
40 - err = qman_ceetm_channel_set_cq_cr_eligibility(channel, id, 1);
41 + err = qman_ceetm_channel_set_cq_cr_eligibility(cls->ch, id, 1);
45 - err = qman_ceetm_channel_set_cq_er_eligibility(channel, id, 1);
46 + err = qman_ceetm_channel_set_cq_er_eligibility(cls->ch, id, 1);
50 @@ -284,7 +283,6 @@ static int ceetm_config_prio_cls(struct
51 /* Configure a wbfs ceetm class */
52 static int ceetm_config_wbfs_cls(struct ceetm_class *cls,
53 struct net_device *dev,
54 - struct qm_ceetm_channel *channel,
55 unsigned int id, int type)
58 @@ -295,17 +293,17 @@ static int ceetm_config_wbfs_cls(struct
61 /* Claim and configure the CCG */
62 - err = ceetm_config_ccg(&cls->wbfs.ccg, channel, id, cls->wbfs.fq,
63 + err = ceetm_config_ccg(&cls->wbfs.ccg, cls->ch, id, cls->wbfs.fq,
68 /* Claim and configure the CQ */
69 if (type == WBFS_GRP_B)
70 - err = qman_ceetm_cq_claim_B(&cls->wbfs.cq, channel, id,
71 + err = qman_ceetm_cq_claim_B(&cls->wbfs.cq, cls->ch, id,
74 - err = qman_ceetm_cq_claim_A(&cls->wbfs.cq, channel, id,
75 + err = qman_ceetm_cq_claim_A(&cls->wbfs.cq, cls->ch, id,
79 @@ -366,10 +364,10 @@ static void ceetm_cls_destroy(struct Qdi
80 cl->root.child = NULL;
83 - if (cl->root.ch && qman_ceetm_channel_release(cl->root.ch))
84 + if (cl->ch && qman_ceetm_channel_release(cl->ch))
85 pr_err(KBUILD_BASENAME
86 " : %s : error releasing the channel %d\n",
87 - __func__, cl->root.ch->idx);
88 + __func__, cl->ch->idx);
92 @@ -766,6 +764,7 @@ static int ceetm_init_prio(struct Qdisc
94 priv->shaped = parent_cl->shaped;
95 priv->prio.qcount = qopt->qcount;
96 + priv->prio.ch = parent_cl->ch;
98 /* Create and configure qcount child classes */
99 for (i = 0; i < priv->prio.qcount; i++) {
100 @@ -790,6 +789,7 @@ static int ceetm_init_prio(struct Qdisc
101 child_cl->type = CEETM_PRIO;
102 child_cl->shaped = priv->shaped;
103 child_cl->prio.child = NULL;
104 + child_cl->ch = priv->prio.ch;
106 /* All shaped CQs have CR and ER enabled by default */
107 child_cl->prio.cr = child_cl->shaped;
108 @@ -798,8 +798,7 @@ static int ceetm_init_prio(struct Qdisc
109 child_cl->prio.cq = NULL;
111 /* Configure the corresponding hardware CQ */
112 - err = ceetm_config_prio_cls(child_cl, dev,
113 - parent_cl->root.ch, i);
114 + err = ceetm_config_prio_cls(child_cl, dev, i);
116 pr_err(KBUILD_BASENAME " : %s : failed to configure the ceetm prio class %X\n",
117 __func__, child_cl->common.classid);
118 @@ -831,7 +830,6 @@ static int ceetm_init_wbfs(struct Qdisc
119 struct ceetm_class *parent_cl, *child_cl, *root_cl;
120 struct Qdisc *parent_qdisc;
121 struct ceetm_qdisc *parent_priv;
122 - struct qm_ceetm_channel *channel;
123 struct net_device *dev = qdisc_dev(sch);
125 pr_debug(KBUILD_BASENAME " : %s : qdisc %X\n", __func__, sch->handle);
126 @@ -904,8 +902,7 @@ static int ceetm_init_wbfs(struct Qdisc
127 priv->wbfs.qcount = qopt->qcount;
128 priv->wbfs.cr = qopt->cr;
129 priv->wbfs.er = qopt->er;
131 - channel = root_cl->root.ch;
132 + priv->wbfs.ch = parent_cl->ch;
134 /* Configure the hardware wbfs channel groups */
135 if (priv->wbfs.qcount == CEETM_MAX_WBFS_QCOUNT) {
136 @@ -920,7 +917,7 @@ static int ceetm_init_wbfs(struct Qdisc
137 /* Configure the group B */
138 priv->wbfs.group_type = WBFS_GRP_B;
140 - err = qman_ceetm_channel_get_group(channel, &small_group,
141 + err = qman_ceetm_channel_get_group(priv->wbfs.ch, &small_group,
144 pr_err(KBUILD_BASENAME " : %s : failed to get group details\n",
145 @@ -938,7 +935,7 @@ static int ceetm_init_wbfs(struct Qdisc
146 /* Configure the small group A */
147 priv->wbfs.group_type = WBFS_GRP_A;
149 - err = qman_ceetm_channel_get_group(channel, &small_group,
150 + err = qman_ceetm_channel_get_group(priv->wbfs.ch, &small_group,
153 pr_err(KBUILD_BASENAME " : %s : failed to get group details\n",
154 @@ -953,13 +950,13 @@ static int ceetm_init_wbfs(struct Qdisc
155 prio_b = prio_b ? : prio_a;
158 - err = qman_ceetm_channel_set_group(channel, small_group, prio_a,
159 + err = qman_ceetm_channel_set_group(priv->wbfs.ch, small_group, prio_a,
165 - err = qman_ceetm_channel_set_group_cr_eligibility(channel,
166 + err = qman_ceetm_channel_set_group_cr_eligibility(priv->wbfs.ch,
170 @@ -968,7 +965,7 @@ static int ceetm_init_wbfs(struct Qdisc
174 - err = qman_ceetm_channel_set_group_er_eligibility(channel,
175 + err = qman_ceetm_channel_set_group_er_eligibility(priv->wbfs.ch,
179 @@ -1003,13 +1000,14 @@ static int ceetm_init_wbfs(struct Qdisc
180 child_cl->wbfs.fq = NULL;
181 child_cl->wbfs.cq = NULL;
182 child_cl->wbfs.weight = qopt->qweight[i];
183 + child_cl->ch = priv->wbfs.ch;
185 if (priv->wbfs.group_type == WBFS_GRP_B)
186 id = WBFS_GRP_B_OFFSET + i;
188 id = WBFS_GRP_A_OFFSET + i;
190 - err = ceetm_config_wbfs_cls(child_cl, dev, channel, id,
191 + err = ceetm_config_wbfs_cls(child_cl, dev, id,
192 priv->wbfs.group_type);
194 pr_err(KBUILD_BASENAME " : %s : failed to configure the ceetm wbfs class %X\n",
195 @@ -1178,9 +1176,6 @@ static int ceetm_change_wbfs(struct Qdis
199 - struct qm_ceetm_channel *channel;
200 - struct ceetm_class *prio_class, *root_class;
201 - struct ceetm_qdisc *prio_qdisc;
204 pr_err("CEETM: the qcount can not be modified\n");
205 @@ -1206,14 +1201,10 @@ static int ceetm_change_wbfs(struct Qdis
209 - prio_class = priv->wbfs.parent;
210 - prio_qdisc = qdisc_priv(prio_class->parent);
211 - root_class = prio_qdisc->prio.parent;
212 - channel = root_class->root.ch;
213 group_b = priv->wbfs.group_type == WBFS_GRP_B;
215 if (qopt->cr != priv->wbfs.cr) {
216 - err = qman_ceetm_channel_set_group_cr_eligibility(channel,
217 + err = qman_ceetm_channel_set_group_cr_eligibility(priv->wbfs.ch,
221 @@ -1222,7 +1213,7 @@ static int ceetm_change_wbfs(struct Qdis
224 if (qopt->er != priv->wbfs.er) {
225 - err = qman_ceetm_channel_set_group_er_eligibility(channel,
226 + err = qman_ceetm_channel_set_group_er_eligibility(priv->wbfs.ch,
230 @@ -1337,7 +1328,7 @@ static int ceetm_cls_change_root(struct
232 if (cl->shaped && cl->root.rate != copt->rate) {
233 bps = copt->rate << 3; /* Bps -> bps */
234 - err = qman_ceetm_channel_set_commit_rate_bps(cl->root.ch, bps,
235 + err = qman_ceetm_channel_set_commit_rate_bps(cl->ch, bps,
239 @@ -1346,7 +1337,7 @@ static int ceetm_cls_change_root(struct
241 if (cl->shaped && cl->root.ceil != copt->ceil) {
242 bps = copt->ceil << 3; /* Bps -> bps */
243 - err = qman_ceetm_channel_set_excess_rate_bps(cl->root.ch, bps,
244 + err = qman_ceetm_channel_set_excess_rate_bps(cl->ch, bps,
248 @@ -1354,7 +1345,7 @@ static int ceetm_cls_change_root(struct
251 if (!cl->shaped && cl->root.tbl != copt->tbl) {
252 - err = qman_ceetm_channel_set_weight(cl->root.ch, copt->tbl);
253 + err = qman_ceetm_channel_set_weight(cl->ch, copt->tbl);
256 cl->root.tbl = copt->tbl;
257 @@ -1555,7 +1546,7 @@ static int ceetm_cls_change(struct Qdisc
261 - cl->root.ch = channel;
265 /* Configure the channel shaper */
266 --- a/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_ceetm.h
267 +++ b/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_ceetm.h
268 @@ -121,12 +121,14 @@ struct root_q {
271 struct ceetm_class *parent;
272 + struct qm_ceetm_channel *ch;
278 struct ceetm_class *parent;
279 + struct qm_ceetm_channel *ch;
283 @@ -165,7 +167,6 @@ struct root_c {
287 - struct qm_ceetm_channel *ch;
291 @@ -194,6 +195,7 @@ struct ceetm_class {
292 struct tcf_proto *filter_list; /* class attached filters */
293 struct tcf_block *block;
294 struct Qdisc *parent;
295 + struct qm_ceetm_channel *ch;
297 int type; /* ROOT/PRIO/WBFS */