Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
Simple PCIe FMC carrier SPEC
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
50
Issues
50
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
Simple PCIe FMC carrier SPEC
Commits
bbf5a4aa
Commit
bbf5a4aa
authored
Oct 01, 2020
by
Federico Vaga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sw:drv: use a dedicated function to release tx memory
Signed-off-by:
Federico Vaga
<
federico.vaga@cern.ch
>
parent
7555fa98
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
6 deletions
+25
-6
spec-gn412x-dma.c
software/kernel/spec-gn412x-dma.c
+25
-6
No files found.
software/kernel/spec-gn412x-dma.c
View file @
bbf5a4aa
...
...
@@ -535,6 +535,29 @@ err:
return
NULL
;
}
static
void
gn412x_dma_tx_free
(
struct
gn412x_dma_tx
*
tx
)
{
struct
gn412x_dma_device
*
gn412x_dma
;
int
i
;
gn412x_dma
=
to_gn412x_dma_device
(
tx
->
tx
.
chan
->
device
);
for
(
i
=
0
;
i
<
tx
->
sg_len
;
++
i
)
{
dma_addr_t
phys
;
dev_dbg
(
&
gn412x_dma
->
pdev
->
dev
,
"Release TX (%p) DMA desc %d
\n
"
,
tx
,
i
);
if
(
i
==
0
)
{
phys
=
tx
->
tx
.
phys
;
}
else
{
phys
=
tx
->
sgl_hw
[
i
-
1
]
->
next_addr_h
;
phys
<<=
32
;
phys
|=
tx
->
sgl_hw
[
i
-
1
]
->
next_addr_l
;
}
dma_pool_free
(
gn412x_dma
->
pool
,
tx
->
sgl_hw
[
i
],
phys
);
}
kfree
(
tx
->
sgl_hw
);
kfree
(
tx
);
}
static
void
gn412x_dma_schedule_next
(
struct
gn412x_dma_chan
*
gn412x_dma_chan
)
{
unsigned
long
flags
;
...
...
@@ -656,13 +679,13 @@ static int gn412x_dma_device_control(struct dma_chan *chan,
}
#endif
static
irqreturn_t
gn412x_dma_irq_handler
(
int
irq
,
void
*
arg
)
{
struct
gn412x_dma_device
*
gn412x_dma
=
arg
;
struct
gn412x_dma_chan
*
chan
=
&
gn412x_dma
->
chan
;
struct
gn412x_dma_tx
*
tx
;
unsigned
long
flags
;
unsigned
int
i
;
enum
gn412x_dma_state
state
;
/* FIXME check for spurious - need HDL fix */
...
...
@@ -717,11 +740,7 @@ static irqreturn_t gn412x_dma_irq_handler(int irq, void *arg)
}
/* Clean up memory */
for
(
i
=
0
;
i
<
tx
->
sg_len
;
++
i
)
dma_pool_free
(
gn412x_dma
->
pool
,
tx
->
sgl_hw
[
i
],
tx
->
tx
.
phys
);
kfree
(
tx
->
sgl_hw
);
kfree
(
tx
);
gn412x_dma_tx_free
(
tx
);
gn412x_dma_schedule_next
(
chan
);
return
IRQ_HANDLED
;
...
...
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