Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
M
Mock Turtle
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
Mock Turtle
Commits
06adfc30
Commit
06adfc30
authored
Jun 02, 2016
by
Federico Vaga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel: add HMQ message counter
Signed-off-by:
Federico Vaga
<
federico.vaga@cern.ch
>
parent
ab8aeafe
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
0 deletions
+30
-0
mockturtle-core.c
kernel/mockturtle-core.c
+1
-0
mockturtle-drv.h
kernel/mockturtle-drv.h
+9
-0
mockturtle-hmq.c
kernel/mockturtle-hmq.c
+20
-0
No files found.
kernel/mockturtle-core.c
View file @
06adfc30
...
...
@@ -485,6 +485,7 @@ static int trtl_probe_hmq(struct trtl_dev *trtl, unsigned int slot,
return
err
;
hmq
->
stats
.
count
=
0
;
hmq
->
buf
.
ptr_w
=
0
;
hmq
->
buf
.
ptr_r
=
0
;
hmq
->
buf
.
size
=
hmq_default_buf_size
;
...
...
kernel/mockturtle-drv.h
View file @
06adfc30
...
...
@@ -77,6 +77,13 @@ struct mturtle_hmq_buffer {
};
/**
* Collection of HMQ statistics
*/
struct
trtl_hmq_stats
{
unsigned
int
count
;
/**< number of messages passed throught the HMQ */
};
/**
* It describe the status of a HMQ slot
*/
...
...
@@ -108,6 +115,8 @@ struct trtl_hmq {
unsigned
int
max_depth
;
/**< maximum buffer queue length (HW) */
struct
mturtle_hmq_buffer
buf
;
/**< Circular buffer */
struct
trtl_hmq_stats
stats
;
};
/**
...
...
kernel/mockturtle-hmq.c
View file @
06adfc30
...
...
@@ -286,6 +286,20 @@ static ssize_t trtl_store_share(struct device *dev,
return
count
;
}
/**
* It returns the maximum number bytes per message
*/
static
ssize_t
trtl_show_total
(
struct
device
*
dev
,
struct
device_attribute
*
attr
,
char
*
buf
)
{
struct
trtl_hmq
*
hmq
=
to_trtl_hmq
(
dev
);
return
sprintf
(
buf
,
"%d
\n
"
,
hmq
->
stats
.
count
);
}
DEVICE_ATTR
(
full
,
S_IRUGO
,
trtl_show_full
,
NULL
);
DEVICE_ATTR
(
empty
,
S_IRUGO
,
trtl_show_empty
,
NULL
);
DEVICE_ATTR
(
count_hw
,
S_IRUGO
,
trtl_show_count
,
NULL
);
...
...
@@ -295,6 +309,7 @@ DEVICE_ATTR(count_max_hw, S_IRUGO, trtl_show_count_max_hw, NULL);
DEVICE_ATTR
(
width_max
,
S_IRUGO
,
trtl_show_width_max
,
NULL
);
DEVICE_ATTR
(
shared_by_users
,
(
S_IRUGO
|
S_IWUSR
|
S_IWGRP
|
S_IWOTH
),
trtl_show_share
,
trtl_store_share
);
DEVICE_ATTR
(
total_messages
,
S_IRUGO
,
trtl_show_total
,
NULL
);
static
struct
attribute
*
trtl_hmq_attr
[]
=
{
&
dev_attr_full
.
attr
,
...
...
@@ -304,6 +319,7 @@ static struct attribute *trtl_hmq_attr[] = {
&
dev_attr_count_max_hw
.
attr
,
&
dev_attr_width_max
.
attr
,
&
dev_attr_shared_by_users
.
attr
,
&
dev_attr_total_messages
.
attr
,
NULL
,
};
...
...
@@ -544,6 +560,8 @@ static int trtl_message_push(struct trtl_hmq *hmq, void *buf,
fmc_writel
(
fmc
,
MQUEUE_CMD_READY
|
((
size
/
4
)
&
0xFF
),
hmq
->
base_sr
+
MQUEUE_SLOT_COMMAND
);
hmq
->
stats
.
count
++
;
return
0
;
}
...
...
@@ -931,6 +949,8 @@ static void trtl_irq_handler_output(struct trtl_hmq *hmq)
fmc_writel
(
fmc
,
MQUEUE_CMD_DISCARD
,
hmq
->
base_sr
+
MQUEUE_SLOT_COMMAND
);
spin_unlock_irqrestore
(
&
hmq
->
lock
,
flags
);
hmq
->
stats
.
count
++
;
/* If we are waiting a synchronous answer on this HMQ check */
if
((
hmq
->
flags
&
TRTL_FLAG_HMQ_SYNC_WAIT
)
&&
hmq
->
waiting_seq
==
buffer
[
1
])
{
/* seq number always position 1 */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment