}
int
-roc_nix_lf_reg_dump(struct roc_nix *roc_nix, uint64_t *data)
+nix_lf_gen_reg_dump(uintptr_t nix_lf_base, uint64_t *data)
{
- struct nix *nix = roc_nix_to_nix_priv(roc_nix);
- uintptr_t nix_lf_base = nix->base;
bool dump_stdout;
uint64_t reg;
uint32_t i;
- if (roc_nix == NULL)
- return NIX_ERR_PARAM;
-
dump_stdout = data ? 0 : 1;
for (i = 0; i < PLT_DIM(nix_lf_reg); i++) {
*data++ = reg;
}
+ return i;
+}
+
+int
+nix_lf_stat_reg_dump(uintptr_t nix_lf_base, uint64_t *data, uint8_t lf_tx_stats,
+ uint8_t lf_rx_stats)
+{
+ uint32_t i, count = 0;
+ bool dump_stdout;
+ uint64_t reg;
+
+ dump_stdout = data ? 0 : 1;
+
/* NIX_LF_TX_STATX */
- for (i = 0; i < nix->lf_tx_stats; i++) {
+ for (i = 0; i < lf_tx_stats; i++) {
reg = plt_read64(nix_lf_base + NIX_LF_TX_STATX(i));
if (dump_stdout && reg)
nix_dump("%32s_%d = 0x%" PRIx64, "NIX_LF_TX_STATX", i,
if (data)
*data++ = reg;
}
+ count += i;
/* NIX_LF_RX_STATX */
- for (i = 0; i < nix->lf_rx_stats; i++) {
+ for (i = 0; i < lf_rx_stats; i++) {
reg = plt_read64(nix_lf_base + NIX_LF_RX_STATX(i));
if (dump_stdout && reg)
nix_dump("%32s_%d = 0x%" PRIx64, "NIX_LF_RX_STATX", i,
*data++ = reg;
}
+ return count + i;
+}
+
+int
+nix_lf_int_reg_dump(uintptr_t nix_lf_base, uint64_t *data, uint16_t qints,
+ uint16_t cints)
+{
+ uint32_t i, count = 0;
+ bool dump_stdout;
+ uint64_t reg;
+
+ dump_stdout = data ? 0 : 1;
+
/* NIX_LF_QINTX_CNT*/
- for (i = 0; i < nix->qints; i++) {
+ for (i = 0; i < qints; i++) {
reg = plt_read64(nix_lf_base + NIX_LF_QINTX_CNT(i));
if (dump_stdout && reg)
nix_dump("%32s_%d = 0x%" PRIx64, "NIX_LF_QINTX_CNT", i,
if (data)
*data++ = reg;
}
+ count += i;
/* NIX_LF_QINTX_INT */
- for (i = 0; i < nix->qints; i++) {
+ for (i = 0; i < qints; i++) {
reg = plt_read64(nix_lf_base + NIX_LF_QINTX_INT(i));
if (dump_stdout && reg)
nix_dump("%32s_%d = 0x%" PRIx64, "NIX_LF_QINTX_INT", i,
if (data)
*data++ = reg;
}
+ count += i;
/* NIX_LF_QINTX_ENA_W1S */
- for (i = 0; i < nix->qints; i++) {
+ for (i = 0; i < qints; i++) {
reg = plt_read64(nix_lf_base + NIX_LF_QINTX_ENA_W1S(i));
if (dump_stdout && reg)
nix_dump("%32s_%d = 0x%" PRIx64, "NIX_LF_QINTX_ENA_W1S",
if (data)
*data++ = reg;
}
+ count += i;
/* NIX_LF_QINTX_ENA_W1C */
- for (i = 0; i < nix->qints; i++) {
+ for (i = 0; i < qints; i++) {
reg = plt_read64(nix_lf_base + NIX_LF_QINTX_ENA_W1C(i));
if (dump_stdout && reg)
nix_dump("%32s_%d = 0x%" PRIx64, "NIX_LF_QINTX_ENA_W1C",
if (data)
*data++ = reg;
}
+ count += i;
/* NIX_LF_CINTX_CNT */
- for (i = 0; i < nix->cints; i++) {
+ for (i = 0; i < cints; i++) {
reg = plt_read64(nix_lf_base + NIX_LF_CINTX_CNT(i));
if (dump_stdout && reg)
nix_dump("%32s_%d = 0x%" PRIx64, "NIX_LF_CINTX_CNT", i,
if (data)
*data++ = reg;
}
+ count += i;
/* NIX_LF_CINTX_WAIT */
- for (i = 0; i < nix->cints; i++) {
+ for (i = 0; i < cints; i++) {
reg = plt_read64(nix_lf_base + NIX_LF_CINTX_WAIT(i));
if (dump_stdout && reg)
nix_dump("%32s_%d = 0x%" PRIx64, "NIX_LF_CINTX_WAIT", i,
if (data)
*data++ = reg;
}
+ count += i;
/* NIX_LF_CINTX_INT */
- for (i = 0; i < nix->cints; i++) {
+ for (i = 0; i < cints; i++) {
reg = plt_read64(nix_lf_base + NIX_LF_CINTX_INT(i));
if (dump_stdout && reg)
nix_dump("%32s_%d = 0x%" PRIx64, "NIX_LF_CINTX_INT", i,
if (data)
*data++ = reg;
}
+ count += i;
/* NIX_LF_CINTX_INT_W1S */
- for (i = 0; i < nix->cints; i++) {
+ for (i = 0; i < cints; i++) {
reg = plt_read64(nix_lf_base + NIX_LF_CINTX_INT_W1S(i));
if (dump_stdout && reg)
nix_dump("%32s_%d = 0x%" PRIx64, "NIX_LF_CINTX_INT_W1S",
if (data)
*data++ = reg;
}
+ count += i;
/* NIX_LF_CINTX_ENA_W1S */
- for (i = 0; i < nix->cints; i++) {
+ for (i = 0; i < cints; i++) {
reg = plt_read64(nix_lf_base + NIX_LF_CINTX_ENA_W1S(i));
if (dump_stdout && reg)
nix_dump("%32s_%d = 0x%" PRIx64, "NIX_LF_CINTX_ENA_W1S",
if (data)
*data++ = reg;
}
+ count += i;
/* NIX_LF_CINTX_ENA_W1C */
- for (i = 0; i < nix->cints; i++) {
+ for (i = 0; i < cints; i++) {
reg = plt_read64(nix_lf_base + NIX_LF_CINTX_ENA_W1C(i));
if (dump_stdout && reg)
nix_dump("%32s_%d = 0x%" PRIx64, "NIX_LF_CINTX_ENA_W1C",
if (data)
*data++ = reg;
}
+
+ return count + i;
+}
+
+int
+roc_nix_lf_reg_dump(struct roc_nix *roc_nix, uint64_t *data)
+{
+ struct nix *nix = roc_nix_to_nix_priv(roc_nix);
+ bool dump_stdout = data ? 0 : 1;
+ uintptr_t nix_base;
+ uint32_t i;
+
+ if (roc_nix == NULL)
+ return NIX_ERR_PARAM;
+
+ nix_base = nix->base;
+ /* General registers */
+ i = nix_lf_gen_reg_dump(nix_base, data);
+
+ /* Rx, Tx stat registers */
+ i += nix_lf_stat_reg_dump(nix_base, dump_stdout ? NULL : &data[i],
+ nix->lf_tx_stats, nix->lf_rx_stats);
+
+ /* Intr registers */
+ i += nix_lf_int_reg_dump(nix_base, dump_stdout ? NULL : &data[i],
+ nix->qints, nix->cints);
+
return 0;
}
-static int
-nix_q_ctx_get(struct mbox *mbox, uint8_t ctype, uint16_t qid, __io void **ctx_p)
+int
+nix_q_ctx_get(struct dev *dev, uint8_t ctype, uint16_t qid, __io void **ctx_p)
{
+ struct mbox *mbox = dev->mbox;
int rc;
if (roc_model_is_cn9k()) {
nix_dump("W10: re_pkts \t\t\t0x%" PRIx64 "\n", (uint64_t)ctx->re_pkts);
}
-static inline void
+void
nix_lf_rq_dump(__io struct nix_cn10k_rq_ctx_s *ctx)
{
nix_dump("W0: wqe_aura \t\t\t%d\nW0: len_ol3_dis \t\t\t%d",
{
struct nix *nix = roc_nix_to_nix_priv(roc_nix);
int rc = -1, q, rq = nix->nb_rx_queues;
- struct mbox *mbox = (&nix->dev)->mbox;
struct npa_aq_enq_rsp *npa_rsp;
struct npa_aq_enq_req *npa_aq;
- volatile void *ctx;
+ struct dev *dev = &nix->dev;
int sq = nix->nb_tx_queues;
struct npa_lf *npa_lf;
+ volatile void *ctx;
uint32_t sqb_aura;
npa_lf = idev_npa_obj_get();
return NPA_ERR_DEVICE_NOT_BOUNDED;
for (q = 0; q < rq; q++) {
- rc = nix_q_ctx_get(mbox, NIX_AQ_CTYPE_CQ, q, &ctx);
+ rc = nix_q_ctx_get(dev, NIX_AQ_CTYPE_CQ, q, &ctx);
if (rc) {
plt_err("Failed to get cq context");
goto fail;
}
for (q = 0; q < rq; q++) {
- rc = nix_q_ctx_get(mbox, NIX_AQ_CTYPE_RQ, q, &ctx);
+ rc = nix_q_ctx_get(dev, NIX_AQ_CTYPE_RQ, q, &ctx);
if (rc) {
plt_err("Failed to get rq context");
goto fail;
}
for (q = 0; q < sq; q++) {
- rc = nix_q_ctx_get(mbox, NIX_AQ_CTYPE_SQ, q, &ctx);
+ rc = nix_q_ctx_get(dev, NIX_AQ_CTYPE_SQ, q, &ctx);
if (rc) {
plt_err("Failed to get sq context");
goto fail;
{
const union nix_rx_parse_u *rx =
(const union nix_rx_parse_u *)((const uint64_t *)cq + 1);
+ const uint64_t *sgs = (const uint64_t *)(rx + 1);
+ int i;
nix_dump("tag \t\t0x%x\tq \t\t%d\t\tnode \t\t%d\tcqe_type \t%d",
cq->tag, cq->q, cq->node, cq->cqe_type);
- nix_dump("W0: chan \t%d\t\tdesc_sizem1 \t%d", rx->chan,
+ nix_dump("W0: chan \t0x%x\t\tdesc_sizem1 \t%d", rx->chan,
rx->desc_sizem1);
nix_dump("W0: imm_copy \t%d\t\texpress \t%d", rx->imm_copy,
rx->express);
nix_dump("W5: vtag0_ptr \t%d\t\tvtag1_ptr \t%d\t\tflow_key_alg \t%d",
rx->vtag0_ptr, rx->vtag1_ptr, rx->flow_key_alg);
+
+ for (i = 0; i < (rx->desc_sizem1 + 1) << 1; i++)
+ nix_dump("sg[%u] = %p", i, (void *)sgs[i]);
}
void
}
int
-roc_nix_rq_ena_dis(struct roc_nix_rq *rq, bool enable)
+nix_rq_ena_dis(struct dev *dev, struct roc_nix_rq *rq, bool enable)
{
- struct nix *nix = roc_nix_to_nix_priv(rq->roc_nix);
- struct mbox *mbox = (&nix->dev)->mbox;
- int rc;
+ struct mbox *mbox = dev->mbox;
/* Pkts will be dropped silently if RQ is disabled */
if (roc_model_is_cn9k()) {
aq->rq_mask.ena = ~(aq->rq_mask.ena);
}
- rc = mbox_process(mbox);
+ return mbox_process(mbox);
+}
+
+int
+roc_nix_rq_ena_dis(struct roc_nix_rq *rq, bool enable)
+{
+ struct nix *nix = roc_nix_to_nix_priv(rq->roc_nix);
+ int rc;
+
+ rc = nix_rq_ena_dis(&nix->dev, rq, enable);
if (roc_model_is_cn10k())
plt_write64(rq->qid, nix->base + NIX_LF_OP_VWQE_FLUSH);
return rc;
}
-static int
-rq_cn9k_cfg(struct nix *nix, struct roc_nix_rq *rq, bool cfg, bool ena)
+int
+nix_rq_cn9k_cfg(struct dev *dev, struct roc_nix_rq *rq, uint16_t qints,
+ bool cfg, bool ena)
{
- struct mbox *mbox = (&nix->dev)->mbox;
+ struct mbox *mbox = dev->mbox;
struct nix_aq_enq_req *aq;
aq = mbox_alloc_msg_nix_aq_enq(mbox);
aq->rq.xqe_imm_size = 0; /* No pkt data copy to CQE */
aq->rq.rq_int_ena = 0;
/* Many to one reduction */
- aq->rq.qint_idx = rq->qid % nix->qints;
+ aq->rq.qint_idx = rq->qid % qints;
aq->rq.xqe_drop_ena = 1;
/* If RED enabled, then fill enable for all cases */
return 0;
}
-static int
-rq_cfg(struct nix *nix, struct roc_nix_rq *rq, bool cfg, bool ena)
+int
+nix_rq_cfg(struct dev *dev, struct roc_nix_rq *rq, uint16_t qints, bool cfg,
+ bool ena)
{
- struct mbox *mbox = (&nix->dev)->mbox;
struct nix_cn10k_aq_enq_req *aq;
+ struct mbox *mbox = dev->mbox;
aq = mbox_alloc_msg_nix_cn10k_aq_enq(mbox);
aq->qidx = rq->qid;
aq->rq.cq = rq->qid;
}
- if (rq->ipsech_ena)
+ if (rq->ipsech_ena) {
aq->rq.ipsech_ena = 1;
+ aq->rq.ipsecd_drop_en = 1;
+ }
aq->rq.lpb_aura = roc_npa_aura_handle_to_aura(rq->aura_handle);
aq->rq.xqe_imm_size = 0; /* No pkt data copy to CQE */
aq->rq.rq_int_ena = 0;
/* Many to one reduction */
- aq->rq.qint_idx = rq->qid % nix->qints;
+ aq->rq.qint_idx = rq->qid % qints;
aq->rq.xqe_drop_ena = 1;
/* If RED enabled, then fill enable for all cases */
struct nix *nix = roc_nix_to_nix_priv(roc_nix);
struct mbox *mbox = (&nix->dev)->mbox;
bool is_cn9k = roc_model_is_cn9k();
+ struct dev *dev = &nix->dev;
int rc;
if (roc_nix == NULL || rq == NULL)
rq->roc_nix = roc_nix;
if (is_cn9k)
- rc = rq_cn9k_cfg(nix, rq, false, ena);
+ rc = nix_rq_cn9k_cfg(dev, rq, nix->qints, false, ena);
else
- rc = rq_cfg(nix, rq, false, ena);
+ rc = nix_rq_cfg(dev, rq, nix->qints, false, ena);
if (rc)
return rc;
struct nix *nix = roc_nix_to_nix_priv(roc_nix);
struct mbox *mbox = (&nix->dev)->mbox;
bool is_cn9k = roc_model_is_cn9k();
+ struct dev *dev = &nix->dev;
int rc;
if (roc_nix == NULL || rq == NULL)
rq->roc_nix = roc_nix;
if (is_cn9k)
- rc = rq_cn9k_cfg(nix, rq, true, ena);
+ rc = nix_rq_cn9k_cfg(dev, rq, nix->qints, true, ena);
else
- rc = rq_cfg(nix, rq, true, ena);
+ rc = nix_rq_cfg(dev, rq, nix->qints, true, ena);
if (rc)
return rc;