Branch data Line data Source code
1 : : /* SPDX-License-Identifier: BSD-3-Clause
2 : : * Copyright(C) 2021 Marvell.
3 : : */
4 : :
5 : : #include "roc_api.h"
6 : : #include "roc_priv.h"
7 : :
8 : : static int
9 : : nix_fc_rxchan_bpid_get(struct roc_nix *roc_nix, struct roc_nix_fc_cfg *fc_cfg)
10 : : {
11 : : struct nix *nix = roc_nix_to_nix_priv(roc_nix);
12 : :
13 [ # # ]: 0 : if (nix->chan_cnt != 0)
14 : 0 : fc_cfg->rxchan_cfg.enable = true;
15 : : else
16 : 0 : fc_cfg->rxchan_cfg.enable = false;
17 : :
18 : 0 : fc_cfg->type = ROC_NIX_FC_RXCHAN_CFG;
19 : :
20 : : return 0;
21 : : }
22 : :
23 : : static int
24 : 0 : nix_fc_rxchan_bpid_set(struct roc_nix *roc_nix, bool enable)
25 : : {
26 : : struct nix *nix = roc_nix_to_nix_priv(roc_nix);
27 : : struct dev *dev = &nix->dev;
28 : 0 : struct mbox *mbox = mbox_get(dev->mbox);
29 : : struct nix_bp_cfg_req *req;
30 : : struct nix_bp_cfg_rsp *rsp;
31 : : int rc = -ENOSPC, i;
32 : :
33 [ # # ]: 0 : if (enable) {
34 : 0 : req = mbox_alloc_msg_nix_bp_enable(mbox);
35 [ # # ]: 0 : if (req == NULL)
36 : 0 : goto exit;
37 : :
38 : 0 : req->chan_base = 0;
39 [ # # # # ]: 0 : if (roc_nix_is_lbk(roc_nix) || roc_nix_is_sdp(roc_nix))
40 : 0 : req->chan_cnt = NIX_LBK_MAX_CHAN;
41 : : else
42 : 0 : req->chan_cnt = NIX_CGX_MAX_CHAN;
43 : :
44 : 0 : req->bpid_per_chan = true;
45 : :
46 : : rc = mbox_process_msg(mbox, (void *)&rsp);
47 [ # # # # ]: 0 : if (rc || (req->chan_cnt != rsp->chan_cnt)) {
48 : : rc = -EIO;
49 : 0 : goto exit;
50 : : }
51 : :
52 : 0 : nix->chan_cnt = rsp->chan_cnt;
53 [ # # ]: 0 : for (i = 0; i < rsp->chan_cnt; i++)
54 : 0 : nix->bpid[i] = rsp->chan_bpid[i] & 0x7FF;
55 : : } else {
56 : 0 : req = mbox_alloc_msg_nix_bp_disable(mbox);
57 [ # # ]: 0 : if (req == NULL)
58 : 0 : goto exit;
59 : 0 : req->chan_base = 0;
60 : 0 : req->chan_cnt = nix->chan_cnt;
61 : :
62 : 0 : rc = mbox_process(mbox);
63 [ # # ]: 0 : if (rc)
64 : 0 : goto exit;
65 : :
66 : 0 : memset(nix->bpid, 0, sizeof(uint16_t) * NIX_MAX_CHAN);
67 : 0 : nix->chan_cnt = 0;
68 : : }
69 : :
70 [ # # ]: 0 : if (roc_model_is_cn9k())
71 : 0 : goto exit;
72 : :
73 : : /* Enable backpressure on CPT if inline inb is enabled */
74 [ # # # # : 0 : if (enable && roc_nix_inl_inb_is_enabled(roc_nix) &&
# # ]
75 : : !roc_errata_cpt_hang_on_x2p_bp()) {
76 : 0 : req = mbox_alloc_msg_nix_cpt_bp_enable(mbox);
77 [ # # ]: 0 : if (req == NULL)
78 : 0 : goto exit;
79 : 0 : req->chan_base = 0;
80 [ # # # # ]: 0 : if (roc_nix_is_lbk(roc_nix) || roc_nix_is_sdp(roc_nix))
81 : 0 : req->chan_cnt = NIX_LBK_MAX_CHAN;
82 : : else
83 : 0 : req->chan_cnt = NIX_CGX_MAX_CHAN;
84 : 0 : req->bpid_per_chan = 0;
85 : :
86 : : rc = mbox_process_msg(mbox, (void *)&rsp);
87 [ # # ]: 0 : if (rc)
88 : 0 : goto exit;
89 : 0 : nix->cpt_lbpid = rsp->chan_bpid[0] & 0x7FF;
90 : : }
91 : :
92 : : /* CPT to NIX BP on all channels */
93 [ # # # # ]: 0 : if (!roc_feature_nix_has_rxchan_multi_bpid() || !nix->cpt_nixbpid ||
94 : 0 : !roc_nix_inl_inb_is_enabled(roc_nix))
95 : 0 : goto exit;
96 : :
97 : : mbox_put(mbox);
98 [ # # ]: 0 : for (i = 0; i < nix->rx_chan_cnt; i++) {
99 : 0 : rc = roc_nix_chan_bpid_set(roc_nix, i, nix->cpt_nixbpid, enable, false);
100 [ # # ]: 0 : if (rc)
101 : : break;
102 : : }
103 : : return rc;
104 : 0 : exit:
105 : : mbox_put(mbox);
106 : 0 : return rc;
107 : : }
108 : :
109 : : static int
110 : 0 : nix_fc_cq_config_get(struct roc_nix *roc_nix, struct roc_nix_fc_cfg *fc_cfg)
111 : : {
112 : : struct nix *nix = roc_nix_to_nix_priv(roc_nix);
113 : : struct dev *dev = &nix->dev;
114 : 0 : struct mbox *mbox = mbox_get(dev->mbox);
115 : : struct nix_aq_enq_rsp *rsp;
116 : : int rc;
117 : :
118 [ # # ]: 0 : if (roc_model_is_cn9k()) {
119 : : struct nix_aq_enq_req *aq;
120 : :
121 : 0 : aq = mbox_alloc_msg_nix_aq_enq(mbox);
122 [ # # ]: 0 : if (!aq) {
123 : : rc = -ENOSPC;
124 : 0 : goto exit;
125 : : }
126 : :
127 : 0 : aq->qidx = fc_cfg->cq_cfg.rq;
128 : 0 : aq->ctype = NIX_AQ_CTYPE_CQ;
129 : 0 : aq->op = NIX_AQ_INSTOP_READ;
130 [ # # ]: 0 : } else if (roc_model_is_cn10k()) {
131 : : struct nix_cn10k_aq_enq_req *aq;
132 : :
133 : 0 : aq = mbox_alloc_msg_nix_cn10k_aq_enq(mbox);
134 [ # # ]: 0 : if (!aq) {
135 : : rc = -ENOSPC;
136 : 0 : goto exit;
137 : : }
138 : :
139 : 0 : aq->qidx = fc_cfg->cq_cfg.rq;
140 : 0 : aq->ctype = NIX_AQ_CTYPE_CQ;
141 : 0 : aq->op = NIX_AQ_INSTOP_READ;
142 : : } else {
143 : : struct nix_cn20k_aq_enq_req *aq;
144 : :
145 : 0 : aq = mbox_alloc_msg_nix_cn20k_aq_enq(mbox);
146 [ # # ]: 0 : if (!aq) {
147 : : rc = -ENOSPC;
148 : 0 : goto exit;
149 : : }
150 : :
151 : 0 : aq->qidx = fc_cfg->cq_cfg.rq;
152 : 0 : aq->ctype = NIX_AQ_CTYPE_CQ;
153 : 0 : aq->op = NIX_AQ_INSTOP_READ;
154 : : }
155 : :
156 : : rc = mbox_process_msg(mbox, (void *)&rsp);
157 [ # # ]: 0 : if (rc)
158 : 0 : goto exit;
159 : :
160 : 0 : fc_cfg->cq_cfg.cq_drop = rsp->cq.drop;
161 : 0 : fc_cfg->cq_cfg.cq_bp = rsp->cq.bp;
162 : 0 : fc_cfg->cq_cfg.enable = rsp->cq.bp_ena;
163 : 0 : fc_cfg->type = ROC_NIX_FC_CQ_CFG;
164 : :
165 : 0 : exit:
166 : : mbox_put(mbox);
167 : 0 : return rc;
168 : : }
169 : :
170 : : static int
171 : 0 : nix_fc_rq_config_get(struct roc_nix *roc_nix, struct roc_nix_fc_cfg *fc_cfg)
172 : : {
173 : : struct nix *nix = roc_nix_to_nix_priv(roc_nix);
174 : : struct npa_cn20k_aq_enq_req *npa_req_cn20k;
175 : : struct npa_cn20k_aq_enq_rsp *npa_rsp_cn20k;
176 : : struct dev *dev = &nix->dev;
177 : 0 : struct mbox *mbox = mbox_get(dev->mbox);
178 : : struct nix_aq_enq_rsp *rsp;
179 : : struct npa_aq_enq_req *npa_req;
180 : : struct npa_aq_enq_rsp *npa_rsp;
181 : : int rc;
182 : :
183 [ # # ]: 0 : if (roc_model_is_cn9k()) {
184 : : struct nix_aq_enq_req *aq;
185 : :
186 : 0 : aq = mbox_alloc_msg_nix_aq_enq(mbox);
187 [ # # ]: 0 : if (!aq) {
188 : : rc = -ENOSPC;
189 : 0 : goto exit;
190 : : }
191 : :
192 : 0 : aq->qidx = fc_cfg->rq_cfg.rq;
193 : 0 : aq->ctype = NIX_AQ_CTYPE_RQ;
194 : 0 : aq->op = NIX_AQ_INSTOP_READ;
195 [ # # ]: 0 : } else if (roc_model_is_cn10k()) {
196 : : struct nix_cn10k_aq_enq_req *aq;
197 : :
198 : 0 : aq = mbox_alloc_msg_nix_cn10k_aq_enq(mbox);
199 [ # # ]: 0 : if (!aq) {
200 : : rc = -ENOSPC;
201 : 0 : goto exit;
202 : : }
203 : :
204 : 0 : aq->qidx = fc_cfg->rq_cfg.rq;
205 : 0 : aq->ctype = NIX_AQ_CTYPE_RQ;
206 : 0 : aq->op = NIX_AQ_INSTOP_READ;
207 : : } else {
208 : : struct nix_cn20k_aq_enq_req *aq;
209 : :
210 : 0 : aq = mbox_alloc_msg_nix_cn20k_aq_enq(mbox);
211 [ # # ]: 0 : if (!aq) {
212 : : rc = -ENOSPC;
213 : 0 : goto exit;
214 : : }
215 : :
216 : 0 : aq->qidx = fc_cfg->rq_cfg.rq;
217 : 0 : aq->ctype = NIX_AQ_CTYPE_RQ;
218 : 0 : aq->op = NIX_AQ_INSTOP_READ;
219 : : }
220 : :
221 : : rc = mbox_process_msg(mbox, (void *)&rsp);
222 [ # # ]: 0 : if (rc)
223 : 0 : goto exit;
224 : :
225 [ # # ]: 0 : if (roc_model_is_cn20k()) {
226 : 0 : npa_req_cn20k = mbox_alloc_msg_npa_cn20k_aq_enq(mbox);
227 [ # # ]: 0 : if (!npa_req_cn20k) {
228 : : rc = -ENOSPC;
229 : 0 : goto exit;
230 : : }
231 : :
232 : 0 : npa_req_cn20k->aura_id = rsp->rq.lpb_aura;
233 : 0 : npa_req_cn20k->ctype = NPA_AQ_CTYPE_AURA;
234 : 0 : npa_req_cn20k->op = NPA_AQ_INSTOP_READ;
235 : :
236 : : rc = mbox_process_msg(mbox, (void *)&npa_rsp_cn20k);
237 [ # # ]: 0 : if (rc)
238 : 0 : goto exit;
239 : :
240 : 0 : fc_cfg->cq_cfg.cq_drop = npa_rsp_cn20k->aura.bp;
241 : 0 : fc_cfg->cq_cfg.enable = npa_rsp_cn20k->aura.bp_ena;
242 : 0 : fc_cfg->type = ROC_NIX_FC_RQ_CFG;
243 : : } else {
244 : 0 : npa_req = mbox_alloc_msg_npa_aq_enq(mbox);
245 [ # # ]: 0 : if (!npa_req) {
246 : : rc = -ENOSPC;
247 : 0 : goto exit;
248 : : }
249 : :
250 : 0 : npa_req->aura_id = rsp->rq.lpb_aura;
251 : 0 : npa_req->ctype = NPA_AQ_CTYPE_AURA;
252 : 0 : npa_req->op = NPA_AQ_INSTOP_READ;
253 : :
254 : : rc = mbox_process_msg(mbox, (void *)&npa_rsp);
255 [ # # ]: 0 : if (rc)
256 : 0 : goto exit;
257 : :
258 : 0 : fc_cfg->cq_cfg.cq_drop = npa_rsp->aura.bp;
259 : 0 : fc_cfg->cq_cfg.enable = npa_rsp->aura.bp_ena;
260 : 0 : fc_cfg->type = ROC_NIX_FC_RQ_CFG;
261 : : }
262 : :
263 : 0 : exit:
264 : : mbox_put(mbox);
265 : 0 : return rc;
266 : : }
267 : :
268 : : static int
269 : 0 : nix_fc_cq_config_set(struct roc_nix *roc_nix, struct roc_nix_fc_cfg *fc_cfg)
270 : : {
271 : : struct nix *nix = roc_nix_to_nix_priv(roc_nix);
272 : : struct dev *dev = &nix->dev;
273 : 0 : struct mbox *mbox = mbox_get(dev->mbox);
274 : : int rc;
275 : :
276 [ # # ]: 0 : if (roc_model_is_cn9k()) {
277 : : struct nix_aq_enq_req *aq;
278 : :
279 : 0 : aq = mbox_alloc_msg_nix_aq_enq(mbox);
280 [ # # ]: 0 : if (!aq) {
281 : : rc = -ENOSPC;
282 : 0 : goto exit;
283 : : }
284 : :
285 : 0 : aq->qidx = fc_cfg->cq_cfg.rq;
286 : 0 : aq->ctype = NIX_AQ_CTYPE_CQ;
287 : 0 : aq->op = NIX_AQ_INSTOP_WRITE;
288 : :
289 [ # # ]: 0 : if (fc_cfg->cq_cfg.enable) {
290 : 0 : aq->cq.bpid = nix->bpid[fc_cfg->cq_cfg.tc];
291 : 0 : aq->cq_mask.bpid = ~(aq->cq_mask.bpid);
292 : 0 : aq->cq.bp = fc_cfg->cq_cfg.cq_bp;
293 : 0 : aq->cq_mask.bp = ~(aq->cq_mask.bp);
294 : : }
295 : :
296 : 0 : aq->cq.bp_ena = !!(fc_cfg->cq_cfg.enable);
297 : 0 : aq->cq_mask.bp_ena = ~(aq->cq_mask.bp_ena);
298 [ # # ]: 0 : } else if (roc_model_is_cn10k()) {
299 : : struct nix_cn10k_aq_enq_req *aq;
300 : :
301 : 0 : aq = mbox_alloc_msg_nix_cn10k_aq_enq(mbox);
302 [ # # ]: 0 : if (!aq) {
303 : : rc = -ENOSPC;
304 : 0 : goto exit;
305 : : }
306 : :
307 : 0 : aq->qidx = fc_cfg->cq_cfg.rq;
308 : 0 : aq->ctype = NIX_AQ_CTYPE_CQ;
309 : 0 : aq->op = NIX_AQ_INSTOP_WRITE;
310 : :
311 [ # # ]: 0 : if (fc_cfg->cq_cfg.enable) {
312 : 0 : aq->cq.bpid = nix->bpid[fc_cfg->cq_cfg.tc];
313 : 0 : aq->cq_mask.bpid = ~(aq->cq_mask.bpid);
314 : 0 : aq->cq.bp = fc_cfg->cq_cfg.cq_bp;
315 : 0 : aq->cq_mask.bp = ~(aq->cq_mask.bp);
316 : : }
317 : :
318 : 0 : aq->cq.bp_ena = !!(fc_cfg->cq_cfg.enable);
319 : 0 : aq->cq_mask.bp_ena = ~(aq->cq_mask.bp_ena);
320 : : } else {
321 : : struct nix_cn20k_aq_enq_req *aq;
322 : :
323 : 0 : aq = mbox_alloc_msg_nix_cn20k_aq_enq(mbox);
324 [ # # ]: 0 : if (!aq) {
325 : : rc = -ENOSPC;
326 : 0 : goto exit;
327 : : }
328 : :
329 : 0 : aq->qidx = fc_cfg->cq_cfg.rq;
330 : 0 : aq->ctype = NIX_AQ_CTYPE_CQ;
331 : 0 : aq->op = NIX_AQ_INSTOP_WRITE;
332 : :
333 [ # # ]: 0 : if (fc_cfg->cq_cfg.enable) {
334 : 0 : aq->cq.bpid = nix->bpid[fc_cfg->cq_cfg.tc];
335 : 0 : aq->cq_mask.bpid = ~(aq->cq_mask.bpid);
336 : 0 : aq->cq.bpid_ext = (nix->bpid[fc_cfg->cq_cfg.tc] >> 9) & 0x3;
337 : 0 : aq->cq_mask.bpid_ext = ~(aq->cq_mask.bpid_ext);
338 : 0 : aq->cq.bp = fc_cfg->cq_cfg.cq_bp;
339 : 0 : aq->cq_mask.bp = ~(aq->cq_mask.bp);
340 : : }
341 : :
342 : 0 : aq->cq.bp_ena = !!(fc_cfg->cq_cfg.enable);
343 : 0 : aq->cq_mask.bp_ena = ~(aq->cq_mask.bp_ena);
344 : : }
345 : :
346 : 0 : rc = mbox_process(mbox);
347 : 0 : exit:
348 : : mbox_put(mbox);
349 : 0 : return rc;
350 : : }
351 : :
352 : : static int
353 : 0 : nix_fc_rq_config_set(struct roc_nix *roc_nix, struct roc_nix_fc_cfg *fc_cfg)
354 : : {
355 : : struct nix *nix = roc_nix_to_nix_priv(roc_nix);
356 : : uint64_t pool_drop_pct, spb_pool_drop_pct;
357 : : struct roc_nix_fc_cfg tmp;
358 : : struct roc_nix_rq *rq;
359 : : int rc;
360 : :
361 [ # # ]: 0 : if (fc_cfg->rq_cfg.rq >= nix->nb_rx_queues)
362 : : return NIX_ERR_QUEUE_INVALID_RANGE;
363 : :
364 : 0 : rq = nix->rqs[fc_cfg->rq_cfg.rq];
365 [ # # ]: 0 : if (rq == NULL)
366 : : return NIX_ERR_PARAM;
367 : :
368 [ # # ]: 0 : if (rq->sso_ena) {
369 : 0 : pool_drop_pct = fc_cfg->rq_cfg.pool_drop_pct;
370 : : /* Use default value for zero pct */
371 [ # # # # ]: 0 : if (fc_cfg->rq_cfg.enable && !pool_drop_pct)
372 : : pool_drop_pct = ROC_NIX_AURA_THRESH;
373 : :
374 : 0 : roc_nix_fc_npa_bp_cfg(roc_nix, fc_cfg->rq_cfg.pool, fc_cfg->rq_cfg.enable,
375 : 0 : roc_nix->force_rx_aura_bp, fc_cfg->rq_cfg.tc, pool_drop_pct);
376 : :
377 [ # # ]: 0 : if (rq->spb_ena) {
378 : 0 : spb_pool_drop_pct = fc_cfg->rq_cfg.spb_pool_drop_pct;
379 : : /* Use default value for zero pct */
380 [ # # ]: 0 : if (!spb_pool_drop_pct)
381 : : spb_pool_drop_pct = ROC_NIX_AURA_THRESH;
382 : :
383 : 0 : roc_nix_fc_npa_bp_cfg(roc_nix, fc_cfg->rq_cfg.spb_pool,
384 : 0 : fc_cfg->rq_cfg.enable, roc_nix->force_rx_aura_bp,
385 : 0 : fc_cfg->rq_cfg.tc, spb_pool_drop_pct);
386 : : }
387 : :
388 [ # # # # ]: 0 : if (roc_nix->local_meta_aura_ena && roc_nix->meta_aura_handle)
389 : 0 : roc_nix_fc_npa_bp_cfg(roc_nix, roc_nix->meta_aura_handle,
390 : 0 : fc_cfg->rq_cfg.enable, roc_nix->force_rx_aura_bp,
391 : 0 : fc_cfg->rq_cfg.tc, pool_drop_pct);
392 : : }
393 : :
394 : : /* Copy RQ config to CQ config as they are occupying same area */
395 : : memset(&tmp, 0, sizeof(tmp));
396 : 0 : tmp.type = ROC_NIX_FC_CQ_CFG;
397 : 0 : tmp.cq_cfg.rq = fc_cfg->rq_cfg.rq;
398 : 0 : tmp.cq_cfg.tc = fc_cfg->rq_cfg.tc;
399 : 0 : tmp.cq_cfg.cq_drop = fc_cfg->rq_cfg.cq_drop;
400 : 0 : tmp.cq_cfg.cq_bp = fc_cfg->rq_cfg.cq_bp;
401 : 0 : tmp.cq_cfg.enable = fc_cfg->rq_cfg.enable;
402 : :
403 : 0 : rc = nix_fc_cq_config_set(roc_nix, &tmp);
404 [ # # ]: 0 : if (rc)
405 : : return rc;
406 : :
407 [ # # ]: 0 : rq->tc = fc_cfg->rq_cfg.enable ? fc_cfg->rq_cfg.tc : ROC_NIX_PFC_CLASS_INVALID;
408 [ # # ]: 0 : plt_nix_dbg("RQ %u: TC %u %s", fc_cfg->rq_cfg.rq, fc_cfg->rq_cfg.tc,
409 : : fc_cfg->rq_cfg.enable ? "enabled" : "disabled");
410 : 0 : return 0;
411 : : }
412 : :
413 : : int
414 : 0 : roc_nix_fc_config_get(struct roc_nix *roc_nix, struct roc_nix_fc_cfg *fc_cfg)
415 : : {
416 [ # # # # : 0 : if (!roc_nix_is_pf(roc_nix) && !roc_nix_is_lbk(roc_nix) &&
# # ]
417 : 0 : !roc_nix_is_sdp(roc_nix))
418 : : return 0;
419 : :
420 [ # # ]: 0 : if (fc_cfg->type == ROC_NIX_FC_CQ_CFG)
421 : 0 : return nix_fc_cq_config_get(roc_nix, fc_cfg);
422 [ # # ]: 0 : else if (fc_cfg->type == ROC_NIX_FC_RQ_CFG)
423 : 0 : return nix_fc_rq_config_get(roc_nix, fc_cfg);
424 [ # # ]: 0 : else if (fc_cfg->type == ROC_NIX_FC_RXCHAN_CFG)
425 : 0 : return nix_fc_rxchan_bpid_get(roc_nix, fc_cfg);
426 [ # # ]: 0 : else if (fc_cfg->type == ROC_NIX_FC_TM_CFG)
427 : 0 : return nix_tm_bp_config_get(roc_nix, &fc_cfg->tm_cfg.enable);
428 : :
429 : : return -EINVAL;
430 : : }
431 : :
432 : : int
433 : 0 : roc_nix_fc_config_set(struct roc_nix *roc_nix, struct roc_nix_fc_cfg *fc_cfg)
434 : : {
435 [ # # ]: 0 : if (fc_cfg->type == ROC_NIX_FC_CQ_CFG)
436 : 0 : return nix_fc_cq_config_set(roc_nix, fc_cfg);
437 [ # # ]: 0 : else if (fc_cfg->type == ROC_NIX_FC_RQ_CFG)
438 : 0 : return nix_fc_rq_config_set(roc_nix, fc_cfg);
439 [ # # ]: 0 : else if (fc_cfg->type == ROC_NIX_FC_RXCHAN_CFG)
440 : 0 : return nix_fc_rxchan_bpid_set(roc_nix,
441 : 0 : fc_cfg->rxchan_cfg.enable);
442 [ # # ]: 0 : else if (fc_cfg->type == ROC_NIX_FC_TM_CFG)
443 : 0 : return nix_tm_bp_config_set(roc_nix, fc_cfg->tm_cfg.sq,
444 : 0 : fc_cfg->tm_cfg.tc,
445 : 0 : fc_cfg->tm_cfg.enable);
446 : :
447 : : return -EINVAL;
448 : : }
449 : :
450 : : enum roc_nix_fc_mode
451 : 0 : roc_nix_fc_mode_get(struct roc_nix *roc_nix)
452 : : {
453 : : struct nix *nix = roc_nix_to_nix_priv(roc_nix);
454 : : enum roc_nix_fc_mode mode;
455 : :
456 [ # # # # ]: 0 : if (nix->tx_pause && nix->rx_pause)
457 : : mode = ROC_NIX_FC_FULL;
458 [ # # ]: 0 : else if (nix->rx_pause)
459 : : mode = ROC_NIX_FC_RX;
460 [ # # ]: 0 : else if (nix->tx_pause)
461 : : mode = ROC_NIX_FC_TX;
462 : : else
463 : : mode = ROC_NIX_FC_NONE;
464 : 0 : return mode;
465 : : }
466 : :
467 : : int
468 : 0 : roc_nix_fc_mode_set(struct roc_nix *roc_nix, enum roc_nix_fc_mode mode)
469 : : {
470 : : struct nix *nix = roc_nix_to_nix_priv(roc_nix);
471 : : struct dev *dev = &nix->dev;
472 : 0 : struct mbox *mbox = mbox_get(dev->mbox);
473 : : struct cgx_pause_frm_cfg *req;
474 : : uint8_t tx_pause, rx_pause;
475 : : int rc = -ENOSPC;
476 : :
477 : 0 : rx_pause = (mode == ROC_NIX_FC_FULL) || (mode == ROC_NIX_FC_RX);
478 : 0 : tx_pause = (mode == ROC_NIX_FC_FULL) || (mode == ROC_NIX_FC_TX);
479 : :
480 : : /* Nothing much to do for LBK links */
481 [ # # ]: 0 : if (roc_nix_is_lbk(roc_nix)) {
482 : 0 : nix->rx_pause = rx_pause;
483 : 0 : nix->tx_pause = tx_pause;
484 : : rc = 0;
485 : 0 : goto exit;
486 : : }
487 : :
488 : : /* Set new config */
489 : 0 : req = mbox_alloc_msg_cgx_cfg_pause_frm(mbox);
490 [ # # ]: 0 : if (req == NULL)
491 : 0 : goto exit;
492 : 0 : req->set = 1;
493 : 0 : req->rx_pause = rx_pause;
494 : 0 : req->tx_pause = tx_pause;
495 : :
496 : 0 : rc = mbox_process(mbox);
497 [ # # ]: 0 : if (rc)
498 : 0 : goto exit;
499 : :
500 : 0 : nix->rx_pause = rx_pause;
501 : 0 : nix->tx_pause = tx_pause;
502 : 0 : exit:
503 : : mbox_put(mbox);
504 : 0 : return rc;
505 : : }
506 : :
507 : : static int
508 [ # # ]: 0 : nix_rx_chan_multi_bpid_cfg(struct roc_nix *roc_nix, uint8_t chan, uint16_t bpid, uint16_t *bpid_new)
509 : : {
510 : : struct roc_nix *roc_nix_tmp, *roc_nix_pre = NULL;
511 : : struct roc_nix_list *nix_list;
512 : : uint8_t chan_pre;
513 : :
514 : : if (!roc_feature_nix_has_rxchan_multi_bpid())
515 : : return -ENOTSUP;
516 : :
517 : 0 : nix_list = roc_idev_nix_list_get();
518 [ # # ]: 0 : if (nix_list == NULL)
519 : : return -EINVAL;
520 : :
521 : : /* Find associated NIX RX channel if Aura BPID is of that of a NIX. */
522 [ # # ]: 0 : TAILQ_FOREACH(roc_nix_tmp, nix_list, next) {
523 : : struct nix *nix = roc_nix_to_nix_priv(roc_nix_tmp);
524 : : int i;
525 : :
526 [ # # ]: 0 : for (i = 0; i < NIX_MAX_CHAN; i++) {
527 [ # # ]: 0 : if (nix->bpid[i] == bpid)
528 : : break;
529 : : }
530 : :
531 [ # # ]: 0 : if (i < NIX_MAX_CHAN) {
532 : : roc_nix_pre = roc_nix_tmp;
533 : 0 : chan_pre = i;
534 : 0 : break;
535 : : }
536 : : }
537 : :
538 : : /* Alloc and configure a new BPID if Aura BPID is that of a NIX. */
539 [ # # ]: 0 : if (roc_nix_pre) {
540 [ # # ]: 0 : if (roc_nix_bpids_alloc(roc_nix, ROC_NIX_INTF_TYPE_SSO, 1, bpid_new) <= 0)
541 : : return -ENOSPC;
542 : :
543 [ # # ]: 0 : if (roc_nix_chan_bpid_set(roc_nix_pre, chan_pre, *bpid_new, 1, false) < 0)
544 : : return -ENOSPC;
545 : :
546 [ # # ]: 0 : if (roc_nix_chan_bpid_set(roc_nix, chan, *bpid_new, 1, false) < 0)
547 : : return -ENOSPC;
548 : :
549 : 0 : return 0;
550 : : } else {
551 : 0 : return roc_nix_chan_bpid_set(roc_nix, chan, bpid, 1, false);
552 : : }
553 : :
554 : : return 0;
555 : : }
556 : :
557 : : #define NIX_BPID_INVALID 0xFFFF
558 : :
559 : : static void
560 : 0 : nix_fc_npa_multi_bp_cfg(struct roc_nix *roc_nix, uint64_t pool_handle, uint8_t ena, uint8_t force,
561 : : uint8_t tc, uint64_t drop_percent)
562 : : {
563 : 0 : uint32_t pool_id = roc_npa_aura_handle_to_aura(pool_handle);
564 : : struct nix *nix = roc_nix_to_nix_priv(roc_nix);
565 : 0 : struct npa_lf *lf = idev_npa_obj_get();
566 : : struct npa_aura_attr *aura_attr;
567 : : uint8_t bp_thresh, bp_ena;
568 : : uint16_t bpid;
569 : : int i;
570 : :
571 [ # # ]: 0 : if (!lf)
572 : : return;
573 : :
574 : 0 : aura_attr = &lf->aura_attr[pool_id];
575 : :
576 : 0 : bp_thresh = NIX_RQ_AURA_BP_THRESH(drop_percent, aura_attr->limit, aura_attr->shift);
577 : 0 : bpid = aura_attr->nix0_bpid;
578 : 0 : bp_ena = aura_attr->bp_ena;
579 : :
580 : : /* BP is already enabled. */
581 [ # # # # ]: 0 : if ((bp_ena & (0x1 << tc)) && ena) {
582 [ # # ]: 0 : if (bp_thresh != aura_attr->bp_thresh[tc]) {
583 [ # # ]: 0 : if (roc_npa_pool_bp_configure(pool_id, nix->bpid[0], bp_thresh, tc, true))
584 : 0 : plt_err("Enabling backpressue failed on pool 0x%" PRIx32, pool_id);
585 : : } else {
586 : 0 : aura_attr->ref_count++;
587 : : }
588 : :
589 : 0 : return;
590 : : }
591 : :
592 [ # # ]: 0 : if (ena) {
593 [ # # ]: 0 : if (roc_npa_pool_bp_configure(pool_id, nix->bpid[0], bp_thresh, tc, true))
594 : 0 : plt_err("Enabling backpressue failed on pool 0x%" PRIx32, pool_id);
595 : : else
596 : 0 : aura_attr->ref_count++;
597 : : } else {
598 : 0 : bool found = !!force;
599 : :
600 : : /* Don't disable if existing BPID is not within this port's list */
601 [ # # ]: 0 : for (i = 0; i < nix->chan_cnt; i++)
602 [ # # ]: 0 : if (bpid == nix->bpid[i])
603 : : found = true;
604 [ # # ]: 0 : if (!found)
605 : : return;
606 [ # # # # ]: 0 : else if ((aura_attr->ref_count > 0) && --(aura_attr->ref_count))
607 : : return;
608 : :
609 [ # # ]: 0 : if (roc_npa_pool_bp_configure(pool_id, 0, 0, 0, false))
610 : 0 : plt_err("Disabling backpressue failed on pool 0x%" PRIx32, pool_id);
611 : : }
612 : : }
613 : :
614 : : void
615 : 0 : roc_nix_fc_npa_bp_cfg(struct roc_nix *roc_nix, uint64_t pool_id, uint8_t ena, uint8_t force,
616 : : uint8_t tc, uint64_t drop_percent)
617 : : {
618 : : uint32_t aura_id = roc_npa_aura_handle_to_aura(pool_id);
619 : : struct nix *nix = roc_nix_to_nix_priv(roc_nix);
620 : 0 : struct npa_lf *lf = idev_npa_obj_get();
621 : : struct npa_aura_attr *aura_attr;
622 : : uint8_t bp_thresh, bp_intf;
623 : : uint16_t bpid;
624 : : int i;
625 : :
626 [ # # ]: 0 : if (roc_nix_is_sdp(roc_nix))
627 : : return;
628 : :
629 [ # # ]: 0 : if (!lf)
630 : : return;
631 : :
632 [ # # # # ]: 0 : if (roc_model_is_cn20k() && roc_nix->use_multi_bpids) {
633 : 0 : nix_fc_npa_multi_bp_cfg(roc_nix, pool_id, ena, force, tc, drop_percent);
634 : 0 : return;
635 : : }
636 : :
637 : 0 : aura_attr = &lf->aura_attr[aura_id];
638 : :
639 : 0 : bp_intf = 1 << nix->is_nix1;
640 : 0 : bp_thresh = NIX_RQ_AURA_BP_THRESH(drop_percent, aura_attr->limit, aura_attr->shift);
641 : :
642 [ # # ]: 0 : bpid = (aura_attr->bp_ena & 0x1) ? aura_attr->nix0_bpid : aura_attr->nix1_bpid;
643 : : /* BP is already enabled. */
644 [ # # # # ]: 0 : if (aura_attr->bp_ena && ena) {
645 [ # # ]: 0 : if (bpid != nix->bpid[tc]) {
646 : 0 : uint16_t bpid_new = NIX_BPID_INVALID;
647 : :
648 [ # # # # ]: 0 : if (force && !nix_rx_chan_multi_bpid_cfg(roc_nix, tc, bpid, &bpid_new)) {
649 : 0 : plt_info("Setting up shared BPID on shared aura 0x%" PRIx64,
650 : : pool_id);
651 : :
652 : : /* Configure Aura with new BPID if it is allocated. */
653 [ # # ]: 0 : if (roc_npa_aura_bp_configure(pool_id, bpid_new, bp_intf, bp_thresh,
654 : : true))
655 : 0 : plt_err("Enabling backpressue failed on aura 0x%" PRIx64,
656 : : pool_id);
657 : : } else {
658 : 0 : aura_attr->ref_count++;
659 : 0 : plt_info("Ignoring port=%u tc=%u config on shared aura 0x%" PRIx64,
660 : : roc_nix->port_id, tc, pool_id);
661 : : }
662 : : } else {
663 : 0 : aura_attr->ref_count++;
664 : : }
665 : :
666 : 0 : return;
667 : : }
668 : :
669 [ # # ]: 0 : if (ena) {
670 [ # # ]: 0 : if (roc_npa_aura_bp_configure(pool_id, nix->bpid[tc], bp_intf, bp_thresh, true))
671 : 0 : plt_err("Enabling backpressue failed on aura 0x%" PRIx64, pool_id);
672 : : else
673 : 0 : aura_attr->ref_count++;
674 : : } else {
675 : 0 : bool found = !!force;
676 : :
677 : : /* Don't disable if existing BPID is not within this port's list */
678 [ # # ]: 0 : for (i = 0; i < nix->chan_cnt; i++)
679 [ # # ]: 0 : if (bpid == nix->bpid[i])
680 : : found = true;
681 [ # # ]: 0 : if (!found)
682 : : return;
683 [ # # # # ]: 0 : else if ((aura_attr->ref_count > 0) && --(aura_attr->ref_count))
684 : : return;
685 : :
686 [ # # ]: 0 : if (roc_npa_aura_bp_configure(pool_id, 0, 0, 0, false))
687 : 0 : plt_err("Disabling backpressue failed on aura 0x%" PRIx64, pool_id);
688 : : }
689 : :
690 : : return;
691 : : }
692 : :
693 : : int
694 : 0 : roc_nix_pfc_mode_set(struct roc_nix *roc_nix, struct roc_nix_pfc_cfg *pfc_cfg)
695 : : {
696 : : struct nix *nix = roc_nix_to_nix_priv(roc_nix);
697 : : struct dev *dev = &nix->dev;
698 : 0 : struct mbox *mbox = mbox_get(dev->mbox);
699 : : uint8_t tx_pause, rx_pause;
700 : : struct cgx_pfc_cfg *req;
701 : : struct cgx_pfc_rsp *rsp;
702 : : int rc = -ENOSPC;
703 : :
704 [ # # ]: 0 : if (roc_nix_is_lbk(roc_nix)) {
705 : : rc = NIX_ERR_OP_NOTSUP;
706 : 0 : goto exit;
707 : : }
708 : :
709 : 0 : rx_pause = (pfc_cfg->mode == ROC_NIX_FC_FULL) ||
710 : : (pfc_cfg->mode == ROC_NIX_FC_RX);
711 : 0 : tx_pause = (pfc_cfg->mode == ROC_NIX_FC_FULL) ||
712 : : (pfc_cfg->mode == ROC_NIX_FC_TX);
713 : :
714 : 0 : req = mbox_alloc_msg_cgx_prio_flow_ctrl_cfg(mbox);
715 [ # # ]: 0 : if (req == NULL)
716 : 0 : goto exit;
717 : :
718 : 0 : req->pfc_en = pfc_cfg->tc;
719 : 0 : req->rx_pause = rx_pause;
720 : 0 : req->tx_pause = tx_pause;
721 : :
722 : : rc = mbox_process_msg(mbox, (void *)&rsp);
723 [ # # ]: 0 : if (rc)
724 : 0 : goto exit;
725 : :
726 : 0 : nix->pfc_rx_pause = rsp->rx_pause;
727 : 0 : nix->pfc_tx_pause = rsp->tx_pause;
728 [ # # ]: 0 : if (rsp->tx_pause)
729 : 0 : nix->cev |= BIT(pfc_cfg->tc);
730 : : else
731 : 0 : nix->cev &= ~BIT(pfc_cfg->tc);
732 : :
733 : 0 : exit:
734 : : mbox_put(mbox);
735 : 0 : return rc;
736 : : }
737 : :
738 : : int
739 : 0 : roc_nix_pfc_mode_get(struct roc_nix *roc_nix, struct roc_nix_pfc_cfg *pfc_cfg)
740 : : {
741 : : struct nix *nix = roc_nix_to_nix_priv(roc_nix);
742 : :
743 [ # # ]: 0 : if (roc_nix_is_lbk(roc_nix))
744 : : return NIX_ERR_OP_NOTSUP;
745 : :
746 : 0 : pfc_cfg->tc = nix->cev;
747 : :
748 [ # # # # ]: 0 : if (nix->pfc_rx_pause && nix->pfc_tx_pause)
749 : 0 : pfc_cfg->mode = ROC_NIX_FC_FULL;
750 [ # # ]: 0 : else if (nix->pfc_rx_pause)
751 : 0 : pfc_cfg->mode = ROC_NIX_FC_RX;
752 [ # # ]: 0 : else if (nix->pfc_tx_pause)
753 : 0 : pfc_cfg->mode = ROC_NIX_FC_TX;
754 : : else
755 : 0 : pfc_cfg->mode = ROC_NIX_FC_NONE;
756 : :
757 : : return 0;
758 : : }
759 : :
760 : : uint16_t
761 : 0 : roc_nix_chan_count_get(struct roc_nix *roc_nix)
762 : : {
763 : : struct nix *nix = roc_nix_to_nix_priv(roc_nix);
764 : :
765 : 0 : return nix->chan_cnt;
766 : : }
767 : :
768 : : /* Allocate BPID for requested type
769 : : * Returns number of BPIDs allocated
770 : : * 0 if no BPIDs available
771 : : * -ve value on error
772 : : */
773 : : int
774 : 0 : nix_bpids_alloc(struct dev *dev, uint8_t type, uint8_t bp_cnt, uint16_t *bpids)
775 : : {
776 : 0 : struct mbox *mbox = mbox_get(dev->mbox);
777 : : struct nix_alloc_bpid_req *req;
778 : : struct nix_bpids *rsp;
779 : : int rc = -EINVAL;
780 : :
781 : : /* Use this api for unreserved interface types */
782 [ # # # # ]: 0 : if ((type < ROC_NIX_INTF_TYPE_RSVD) || (bp_cnt > ROC_NIX_MAX_BPID_CNT) || !bpids)
783 : 0 : goto exit;
784 : :
785 : : rc = -ENOSPC;
786 : 0 : req = mbox_alloc_msg_nix_alloc_bpids(mbox);
787 [ # # ]: 0 : if (req == NULL)
788 : 0 : goto exit;
789 : 0 : req->type = type;
790 : 0 : req->bpid_cnt = bp_cnt;
791 : :
792 : : rc = mbox_process_msg(mbox, (void *)&rsp);
793 [ # # ]: 0 : if (rc)
794 : 0 : goto exit;
795 : :
796 [ # # ]: 0 : for (rc = 0; rc < rsp->bpid_cnt; rc++)
797 : 0 : bpids[rc] = rsp->bpids[rc];
798 : 0 : exit:
799 : : mbox_put(mbox);
800 : 0 : return rc;
801 : : }
802 : :
803 : : int
804 : 0 : nix_bpids_free(struct dev *dev, uint8_t bp_cnt, uint16_t *bpids)
805 : : {
806 : 0 : struct mbox *mbox = mbox_get(dev->mbox);
807 : : struct nix_bpids *req;
808 : : int rc = -EINVAL;
809 : :
810 : : /* Use this api for unreserved interface types */
811 [ # # ]: 0 : if ((bp_cnt > ROC_NIX_MAX_BPID_CNT) || !bpids)
812 : 0 : goto exit;
813 : :
814 : : rc = -ENOSPC;
815 : 0 : req = mbox_alloc_msg_nix_free_bpids(mbox);
816 [ # # ]: 0 : if (req == NULL)
817 : 0 : goto exit;
818 [ # # ]: 0 : for (rc = 0; rc < bp_cnt; rc++)
819 : 0 : req->bpids[rc] = bpids[rc];
820 : 0 : req->bpid_cnt = rc;
821 : :
822 : 0 : rc = mbox_process(mbox);
823 : 0 : exit:
824 : : mbox_put(mbox);
825 : 0 : return rc;
826 : : }
827 : :
828 : : int
829 : 0 : roc_nix_bpids_alloc(struct roc_nix *roc_nix, uint8_t type, uint8_t bp_cnt, uint16_t *bpids)
830 : : {
831 : : struct nix *nix = roc_nix_to_nix_priv(roc_nix);
832 : 0 : return nix_bpids_alloc(&nix->dev, type, bp_cnt, bpids);
833 : : }
834 : :
835 : : int
836 : 0 : roc_nix_bpids_free(struct roc_nix *roc_nix, uint8_t bp_cnt, uint16_t *bpids)
837 : : {
838 : : struct nix *nix = roc_nix_to_nix_priv(roc_nix);
839 : 0 : return nix_bpids_free(&nix->dev, bp_cnt, bpids);
840 : : }
841 : :
842 : : int
843 : 0 : roc_nix_rx_chan_cfg_get(struct roc_nix *roc_nix, uint16_t chan, bool is_cpt, uint64_t *cfg)
844 : : {
845 : : struct nix *nix = roc_nix_to_nix_priv(roc_nix);
846 : 0 : struct mbox *mbox = mbox_get(nix->dev.mbox);
847 : : struct nix_rx_chan_cfg *req;
848 : : struct nix_rx_chan_cfg *rsp;
849 : : int rc = -EINVAL;
850 : :
851 : 0 : req = mbox_alloc_msg_nix_rx_chan_cfg(mbox);
852 [ # # ]: 0 : if (req == NULL)
853 : 0 : goto exit;
854 [ # # ]: 0 : if (is_cpt)
855 : 0 : req->type = ROC_NIX_INTF_TYPE_CPT;
856 : 0 : req->chan = chan;
857 : 0 : req->read = 1;
858 : :
859 : : rc = mbox_process_msg(mbox, (void *)&rsp);
860 [ # # ]: 0 : if (rc)
861 : 0 : goto exit;
862 : 0 : *cfg = rsp->val;
863 : 0 : exit:
864 : : mbox_put(mbox);
865 : 0 : return rc;
866 : : }
867 : :
868 : : int
869 : 0 : roc_nix_rx_chan_cfg_set(struct roc_nix *roc_nix, uint16_t chan, bool is_cpt, uint64_t val)
870 : : {
871 : : struct nix *nix = roc_nix_to_nix_priv(roc_nix);
872 : 0 : struct mbox *mbox = mbox_get(nix->dev.mbox);
873 : : struct nix_rx_chan_cfg *req;
874 : : int rc = -EINVAL;
875 : :
876 : 0 : req = mbox_alloc_msg_nix_rx_chan_cfg(mbox);
877 [ # # ]: 0 : if (req == NULL)
878 : 0 : goto exit;
879 [ # # ]: 0 : if (is_cpt)
880 : 0 : req->type = ROC_NIX_INTF_TYPE_CPT;
881 : 0 : req->chan = chan;
882 : 0 : req->val = val;
883 : 0 : req->read = 0;
884 : :
885 : 0 : rc = mbox_process(mbox);
886 : 0 : exit:
887 : : mbox_put(mbox);
888 : 0 : return rc;
889 : : }
890 : :
891 : : #define NIX_BPID1_ENA 15
892 : : #define NIX_BPID2_ENA 14
893 : : #define NIX_BPID3_ENA 13
894 : :
895 : : #define NIX_BPID1_OFF 20
896 : : #define NIX_BPID2_OFF 32
897 : : #define NIX_BPID3_OFF 44
898 : :
899 : : int
900 [ # # ]: 0 : roc_nix_chan_bpid_set(struct roc_nix *roc_nix, uint16_t chan, uint64_t bpid, int ena, bool cpt_chan)
901 : : {
902 : : uint64_t cfg;
903 : : int rc;
904 : :
905 : : if (!roc_feature_nix_has_rxchan_multi_bpid())
906 : : return -ENOTSUP;
907 : :
908 : 0 : rc = roc_nix_rx_chan_cfg_get(roc_nix, chan, cpt_chan, &cfg);
909 [ # # ]: 0 : if (rc)
910 : : return rc;
911 : :
912 [ # # ]: 0 : if (ena) {
913 [ # # ]: 0 : if ((((cfg >> NIX_BPID1_OFF) & GENMASK_ULL(10, 0)) == bpid) ||
914 [ # # ]: 0 : (((cfg >> NIX_BPID2_OFF) & GENMASK_ULL(10, 0)) == bpid) ||
915 [ # # ]: 0 : (((cfg >> NIX_BPID3_OFF) & GENMASK_ULL(10, 0)) == bpid))
916 : : return 0;
917 : :
918 [ # # ]: 0 : if (!(cfg & BIT_ULL(NIX_BPID1_ENA))) {
919 : 0 : cfg &= ~GENMASK_ULL(NIX_BPID1_OFF + 10, NIX_BPID1_OFF);
920 : 0 : cfg |= (((uint64_t)bpid << NIX_BPID1_OFF) | BIT_ULL(NIX_BPID1_ENA));
921 [ # # ]: 0 : } else if (!(cfg & BIT_ULL(NIX_BPID2_ENA))) {
922 : 0 : cfg &= ~GENMASK_ULL(NIX_BPID2_OFF + 10, NIX_BPID2_OFF);
923 : 0 : cfg |= (((uint64_t)bpid << NIX_BPID2_OFF) | BIT_ULL(NIX_BPID2_ENA));
924 [ # # ]: 0 : } else if (!(cfg & BIT_ULL(NIX_BPID3_ENA))) {
925 : 0 : cfg &= ~GENMASK_ULL(NIX_BPID3_OFF + 10, NIX_BPID3_OFF);
926 : 0 : cfg |= (((uint64_t)bpid << NIX_BPID3_OFF) | BIT_ULL(NIX_BPID3_ENA));
927 : : } else {
928 : 0 : plt_nix_dbg("Exceed maximum BPIDs");
929 : 0 : return -ENOSPC;
930 : : }
931 : : } else {
932 [ # # ]: 0 : if (((cfg >> NIX_BPID1_OFF) & GENMASK_ULL(10, 0)) == bpid) {
933 : 0 : cfg &= ~(GENMASK_ULL(NIX_BPID1_OFF + 10, NIX_BPID1_OFF) |
934 : : BIT_ULL(NIX_BPID1_ENA));
935 [ # # ]: 0 : } else if (((cfg >> NIX_BPID2_OFF) & GENMASK_ULL(10, 0)) == bpid) {
936 : 0 : cfg &= ~(GENMASK_ULL(NIX_BPID2_OFF + 10, NIX_BPID2_OFF) |
937 : : BIT_ULL(NIX_BPID2_ENA));
938 [ # # ]: 0 : } else if (((cfg >> NIX_BPID3_OFF) & GENMASK_ULL(10, 0)) == bpid) {
939 : 0 : cfg &= ~(GENMASK_ULL(NIX_BPID3_OFF + 10, NIX_BPID3_OFF) |
940 : : BIT_ULL(NIX_BPID3_ENA));
941 : : } else {
942 : 0 : plt_nix_dbg("BPID not found");
943 : 0 : return -EINVAL;
944 : : }
945 : : }
946 : 0 : return roc_nix_rx_chan_cfg_set(roc_nix, chan, cpt_chan, cfg);
947 : : }
|