Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
306a2782
Commit
306a2782
authored
Jun 28, 2013
by
Ben Hutchings
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sfc: Separate out queue-empty check from efx_nic_may_push_tx_desc()
Signed-off-by:
Ben Hutchings
<
bhutchings@solarflare.com
>
parent
183233be
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
6 deletions
+22
-6
drivers/net/ethernet/sfc/nic.h
drivers/net/ethernet/sfc/nic.h
+22
-6
No files found.
drivers/net/ethernet/sfc/nic.h
View file @
306a2782
...
@@ -71,6 +71,26 @@ efx_tx_desc(struct efx_tx_queue *tx_queue, unsigned int index)
...
@@ -71,6 +71,26 @@ efx_tx_desc(struct efx_tx_queue *tx_queue, unsigned int index)
return
((
efx_qword_t
*
)
(
tx_queue
->
txd
.
buf
.
addr
))
+
index
;
return
((
efx_qword_t
*
)
(
tx_queue
->
txd
.
buf
.
addr
))
+
index
;
}
}
/* Report whether the NIC considers this TX queue empty, given the
* write_count used for the last doorbell push. May return false
* negative.
*/
static
inline
bool
__efx_nic_tx_is_empty
(
struct
efx_tx_queue
*
tx_queue
,
unsigned
int
write_count
)
{
unsigned
int
empty_read_count
=
ACCESS_ONCE
(
tx_queue
->
empty_read_count
);
if
(
empty_read_count
==
0
)
return
false
;
return
((
empty_read_count
^
write_count
)
&
~
EFX_EMPTY_COUNT_VALID
)
==
0
;
}
static
inline
bool
efx_nic_tx_is_empty
(
struct
efx_tx_queue
*
tx_queue
)
{
return
__efx_nic_tx_is_empty
(
tx_queue
,
tx_queue
->
write_count
);
}
/* Decide whether to push a TX descriptor to the NIC vs merely writing
/* Decide whether to push a TX descriptor to the NIC vs merely writing
* the doorbell. This can reduce latency when we are adding a single
* the doorbell. This can reduce latency when we are adding a single
* descriptor to an empty queue, but is otherwise pointless. Further,
* descriptor to an empty queue, but is otherwise pointless. Further,
...
@@ -80,14 +100,10 @@ efx_tx_desc(struct efx_tx_queue *tx_queue, unsigned int index)
...
@@ -80,14 +100,10 @@ efx_tx_desc(struct efx_tx_queue *tx_queue, unsigned int index)
static
inline
bool
efx_nic_may_push_tx_desc
(
struct
efx_tx_queue
*
tx_queue
,
static
inline
bool
efx_nic_may_push_tx_desc
(
struct
efx_tx_queue
*
tx_queue
,
unsigned
int
write_count
)
unsigned
int
write_count
)
{
{
unsigned
empty_read_count
=
ACCESS_ONCE
(
tx_queue
->
empty_read_count
);
bool
was_empty
=
__efx_nic_tx_is_empty
(
tx_queue
,
write_count
);
if
(
empty_read_count
==
0
)
return
false
;
tx_queue
->
empty_read_count
=
0
;
tx_queue
->
empty_read_count
=
0
;
return
((
empty_read_count
^
write_count
)
&
~
EFX_EMPTY_COUNT_VALID
)
==
0
return
was_empty
&&
tx_queue
->
write_count
-
write_count
==
1
;
&&
tx_queue
->
write_count
-
write_count
==
1
;
}
}
/* Returns a pointer to the specified descriptor in the RX descriptor queue */
/* Returns a pointer to the specified descriptor in the RX descriptor queue */
...
...
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