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
0ffec775
Commit
0ffec775
authored
Jan 18, 2004
by
Robert Olsson
Committed by
Hideaki Yoshifuji
Jan 18, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PKTGEN]: Fix divide by zero and get integer precision at very short time intervals.
parent
1c2a00ad
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
3 deletions
+13
-3
net/core/pktgen.c
net/core/pktgen.c
+13
-3
No files found.
net/core/pktgen.c
View file @
0ffec775
...
...
@@ -88,7 +88,7 @@
#define cycles() ((u32)get_cycles())
#define VERSION "pktgen version 1.3"
#define VERSION "pktgen version 1.3
1
"
static
char
version
[]
__initdata
=
"pktgen.c: v1.3: Packet Generator for packet performance testing.
\n
"
;
...
...
@@ -720,8 +720,18 @@ static void inject(struct pktgen_info* info)
{
char
*
p
=
info
->
result
;
__u64
pps
=
(
__u32
)(
info
->
sofar
*
1000
)
/
((
__u32
)(
total
)
/
1000
);
__u64
bps
=
pps
*
8
*
(
info
->
pkt_size
+
4
);
/* take 32bit ethernet CRC into account */
__u64
bps
,
pps
=
0
;
if
(
total
>
1000
)
pps
=
(
__u32
)(
info
->
sofar
*
1000
)
/
((
__u32
)(
total
)
/
1000
);
else
if
(
total
>
100
)
pps
=
(
__u32
)(
info
->
sofar
*
10000
)
/
((
__u32
)(
total
)
/
100
);
else
if
(
total
>
10
)
pps
=
(
__u32
)(
info
->
sofar
*
100000
)
/
((
__u32
)(
total
)
/
10
);
else
if
(
total
>
1
)
pps
=
(
__u32
)(
info
->
sofar
*
1000000
)
/
(
__u32
)
total
;
bps
=
pps
*
8
*
(
info
->
pkt_size
+
4
);
/* take 32bit ethernet CRC into account */
p
+=
sprintf
(
p
,
"OK: %llu(c%llu+d%llu) usec, %llu (%dbyte,%dfrags) %llupps %lluMb/sec (%llubps) errors: %llu"
,
(
unsigned
long
long
)
total
,
(
unsigned
long
long
)
(
total
-
idle
),
...
...
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