From: <pbhagavatula@marvell.com>
To: <jerinj@marvell.com>, Nithin Dabilpuram <ndabilpuram@marvell.com>,
"Kiran Kumar K" <kirankumark@marvell.com>,
Sunil Kumar Kori <skori@marvell.com>,
Satha Rao <skoteshwar@marvell.com>
Cc: <dev@dpdk.org>, Pavan Nikhilesh <pbhagavatula@marvell.com>
Subject: [PATCH v2 1/3] common/cnxk: update timer base code
Date: Mon, 11 Dec 2023 18:53:18 +0530 [thread overview]
Message-ID: <20231211132320.1254-1-pbhagavatula@marvell.com> (raw)
In-Reply-To: <20231207065630.4009-1-pbhagavatula@marvell.com>
From: Pavan Nikhilesh <pbhagavatula@marvell.com>
Update event timer base code.
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
---
v2 Changes:
- Split patches.
drivers/common/cnxk/hw/tim.h | 5 +++--
drivers/common/cnxk/roc_mbox.h | 11 +++++++++++
drivers/common/cnxk/roc_sso.c | 2 +-
drivers/common/cnxk/roc_tim.c | 27 ++++++++++++++++++++++++++-
drivers/common/cnxk/roc_tim.h | 3 +++
5 files changed, 44 insertions(+), 4 deletions(-)
diff --git a/drivers/common/cnxk/hw/tim.h b/drivers/common/cnxk/hw/tim.h
index 61c38ae175..82b094e3dc 100644
--- a/drivers/common/cnxk/hw/tim.h
+++ b/drivers/common/cnxk/hw/tim.h
@@ -49,7 +49,8 @@
#define TIM_LF_RING_REL (0x400)
#define TIM_MAX_INTERVAL_TICKS ((1ULL << 32) - 1)
-#define TIM_MAX_BUCKET_SIZE ((1ULL << 20) - 1)
-#define TIM_MIN_BUCKET_SIZE 3
+#define TIM_MAX_BUCKET_SIZE ((1ULL << 20) - 2)
+#define TIM_MIN_BUCKET_SIZE 1
+#define TIM_BUCKET_WRAP_SIZE 3
#endif /* __TIM_HW_H__ */
diff --git a/drivers/common/cnxk/roc_mbox.h b/drivers/common/cnxk/roc_mbox.h
index 05434aec5a..4590e5f2dd 100644
--- a/drivers/common/cnxk/roc_mbox.h
+++ b/drivers/common/cnxk/roc_mbox.h
@@ -154,6 +154,8 @@ struct mbox_msghdr {
M(TIM_DISABLE_RING, 0x804, tim_disable_ring, tim_ring_req, msg_rsp) \
M(TIM_GET_MIN_INTVL, 0x805, tim_get_min_intvl, tim_intvl_req, \
tim_intvl_rsp) \
+ M(TIM_CAPTURE_COUNTERS, 0x806, tim_capture_counters, msg_req, \
+ tim_capture_rsp) \
/* CPT mbox IDs (range 0xA00 - 0xBFF) */ \
M(CPT_LF_ALLOC, 0xA00, cpt_lf_alloc, cpt_lf_alloc_req_msg, msg_rsp) \
M(CPT_LF_FREE, 0xA01, cpt_lf_free, msg_req, msg_rsp) \
@@ -2541,6 +2543,10 @@ enum tim_clk_srcs {
TIM_CLK_SRCS_GPIO = 1,
TIM_CLK_SRCS_GTI = 2,
TIM_CLK_SRCS_PTP = 3,
+ TIM_CLK_SRCS_SYNCE = 4,
+ TIM_CLK_SRCS_BTS = 5,
+ TIM_CLK_SRCS_EXT_MIO = 6,
+ TIM_CLK_SRCS_EXT_GTI = 7,
TIM_CLK_SRSC_INVALID,
};
@@ -2652,6 +2658,11 @@ struct tim_intvl_rsp {
uint64_t __io intvl_ns;
};
+struct tim_capture_rsp {
+ struct mbox_msghdr hdr;
+ uint64_t __io counters[TIM_CLK_SRSC_INVALID];
+};
+
struct sdp_node_info {
/* Node to which this PF belons to */
uint8_t __io node_id;
diff --git a/drivers/common/cnxk/roc_sso.c b/drivers/common/cnxk/roc_sso.c
index 748d287bad..f09b535c80 100644
--- a/drivers/common/cnxk/roc_sso.c
+++ b/drivers/common/cnxk/roc_sso.c
@@ -891,7 +891,7 @@ roc_sso_rsrc_init(struct roc_sso *roc_sso, uint8_t nb_hws, uint16_t nb_hwgrp, ui
goto sso_msix_fail;
}
- nb_tim_lfs = nb_tim_lfs ? PLT_MIN(nb_tim_lfs, free_tim_lfs) : free_tim_lfs;
+ nb_tim_lfs = PLT_MIN(nb_tim_lfs, free_tim_lfs);
}
/* 2 error interrupt per TIM LF */
diff --git a/drivers/common/cnxk/roc_tim.c b/drivers/common/cnxk/roc_tim.c
index f8607b2852..095afbb9e6 100644
--- a/drivers/common/cnxk/roc_tim.c
+++ b/drivers/common/cnxk/roc_tim.c
@@ -91,6 +91,31 @@ tim_err_desc(int rc)
}
}
+int
+roc_tim_capture_counters(struct roc_tim *roc_tim, uint64_t *counters, uint8_t nb_cntrs)
+{
+ struct sso *sso = roc_sso_to_sso_priv(roc_tim->roc_sso);
+ struct dev *dev = &sso->dev;
+ struct mbox *mbox = mbox_get(dev->mbox);
+ struct tim_capture_rsp *rsp;
+ int rc, i;
+
+ mbox_alloc_msg_tim_capture_counters(mbox);
+ rc = mbox_process_msg(dev->mbox, (void **)&rsp);
+ if (rc) {
+ tim_err_desc(rc);
+ rc = -EIO;
+ goto fail;
+ }
+
+ for (i = 0; i < nb_cntrs; i++)
+ counters[i] = rsp->counters[i];
+
+fail:
+ mbox_put(mbox);
+ return rc;
+}
+
int
roc_tim_lf_enable(struct roc_tim *roc_tim, uint8_t ring_id, uint64_t *start_tsc,
uint32_t *cur_bkt)
@@ -138,7 +163,7 @@ roc_tim_lf_disable(struct roc_tim *roc_tim, uint8_t ring_id)
goto fail;
req->ring = ring_id;
- rc = mbox_process(dev->mbox);
+ rc = mbox_process(mbox);
if (rc) {
tim_err_desc(rc);
rc = -EIO;
diff --git a/drivers/common/cnxk/roc_tim.h b/drivers/common/cnxk/roc_tim.h
index 7dc9ae0a61..f9a9ad1887 100644
--- a/drivers/common/cnxk/roc_tim.h
+++ b/drivers/common/cnxk/roc_tim.h
@@ -14,6 +14,8 @@ enum roc_tim_clk_src {
ROC_TIM_CLK_SRC_PTP,
ROC_TIM_CLK_SRC_SYNCE,
ROC_TIM_CLK_SRC_BTS,
+ ROC_TIM_CLK_SRC_EXT_MIO,
+ ROC_TIM_CLK_SRC_EXT_GTI,
ROC_TIM_CLK_SRC_INVALID,
};
@@ -48,5 +50,6 @@ int __roc_api roc_tim_lf_alloc(struct roc_tim *roc_tim, uint8_t ring_id,
int __roc_api roc_tim_lf_free(struct roc_tim *roc_tim, uint8_t ring_id);
uintptr_t __roc_api roc_tim_lf_base_get(struct roc_tim *roc_tim,
uint8_t ring_id);
+int roc_tim_capture_counters(struct roc_tim *roc_tim, uint64_t *counters, uint8_t nb_cntrs);
#endif
--
2.25.1
next prev parent reply other threads:[~2023-12-11 13:23 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-07 6:56 [PATCH] event/cnxk: update " pbhagavatula
2023-12-11 12:00 ` Jerin Jacob
2023-12-11 13:23 ` pbhagavatula [this message]
2023-12-11 13:23 ` [PATCH v2 2/3] common/cnxk: update scheduler " pbhagavatula
2023-12-11 13:23 ` [PATCH v2 3/3] event/cnxk: add option to update links via mbox pbhagavatula
2023-12-12 5:03 ` Jerin Jacob
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231211132320.1254-1-pbhagavatula@marvell.com \
--to=pbhagavatula@marvell.com \
--cc=dev@dpdk.org \
--cc=jerinj@marvell.com \
--cc=kirankumark@marvell.com \
--cc=ndabilpuram@marvell.com \
--cc=skori@marvell.com \
--cc=skoteshwar@marvell.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).