Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
FMC TDC 1ns 5cha - Software
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
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
FMC TDC 1ns 5cha - Software
Commits
985d9745
Commit
985d9745
authored
Mar 04, 2015
by
Federico Vaga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel: limit kfifo size
Signed-off-by:
Federico Vaga
<
federico.vaga@cern.ch
>
parent
816acbfd
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
4 deletions
+10
-4
fmc-tdc.h
kernel/fmc-tdc.h
+1
-0
ft-core.c
kernel/ft-core.c
+4
-4
ft-irq.c
kernel/ft-irq.c
+5
-0
No files found.
kernel/fmc-tdc.h
View file @
985d9745
...
...
@@ -137,6 +137,7 @@ struct ft_channel_state {
between pulses */
struct
kfifo
fifo
;
uint32_t
fifo_len
;
};
/* Main TDC device context */
...
...
kernel/ft-core.c
View file @
985d9745
...
...
@@ -43,19 +43,19 @@ static int ft_show_sdb;
module_param_named
(
show_sdb
,
ft_show_sdb
,
int
,
0444
);
MODULE_PARM_DESC
(
verbose
,
"Print a dump of the gateware's SDB tree."
);
static
int
ft_buffer_size
=
8192
;
static
int
ft_buffer_size
=
64
;
module_param_named
(
buffer_size
,
ft_buffer_size
,
int
,
0444
);
MODULE_PARM_DESC
(
verbose
,
"Number of timestamps in each channel's software FIFO buffer."
);
"Number of timestamps in each channel's software FIFO buffer
(It must be a power of 2)
."
);
static
int
ft_init_channel
(
struct
fmctdc_dev
*
ft
,
int
channel
)
{
struct
ft_channel_state
*
st
=
&
ft
->
channels
[
channel
-
1
];
st
->
expected_edge
=
1
;
st
->
fifo_len
=
ft_buffer_size
;
return
kfifo_alloc
(
&
st
->
fifo
,
sizeof
(
struct
ft_wr_timestamp
)
*
ft_buffer_size
,
sizeof
(
struct
ft_wr_timestamp
)
*
st
->
fifo_len
,
GFP_KERNEL
);
}
...
...
kernel/ft-irq.c
View file @
985d9745
...
...
@@ -213,6 +213,11 @@ static inline void process_timestamp(struct fmctdc_dev *ft,
/* Put the timestamp in the FIFO */
kfifo_in_spinlocked
(
&
st
->
fifo
,
&
ts
,
sizeof
(
struct
ft_wr_timestamp
),
&
ft
->
lock
);
if
(
st
->
fifo_len
<=
kfifo_len
(
&
st
->
fifo
)
/
sizeof
(
struct
ft_wr_timestamp
))
{
kfifo_out_spinlocked
(
&
st
->
fifo
,
&
ts
,
sizeof
(
struct
ft_wr_timestamp
),
&
ft
->
lock
);
}
}
/* Wait for the next raising edge */
...
...
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