Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F150111558
test01.c
dsl (Dmitry Salychev)
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
dsl
Sun, Mar 29, 11:37 AM
2026-03-29 11:37:01 (UTC+0)
Size
1 KB
Referenced Files
None
Subscribers
None
test01.c
View Options
/*
* test01.c
*
* TCP connection test which sends a pattern of 0xA...0xF numbers sequentially
* in 1024 byte blocks indefinitely. Server is supposed to verify received data
* read from the TCP connection and terminate it in case of missed bytes.
*
* This test helps to identify problems with the TX path of the DPAA2 driver in
* FreeBSD when generation of the checksums is offloaded to the DPAA2 hardware.
*
* See: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=292006#c31
*
* Based on G. Adam Stanislav work at
* https://docs.freebsd.org/en/books/developers-handbook/sockets/
*/
#include
<stdio.h>
#include
<string.h>
#include
<sys/types.h>
#include
<sys/socket.h>
#include
<netinet/in.h>
#include
<unistd.h>
#define BLOCKSZ (128u)
int
main
()
{
int
s
,
bytes
;
struct
sockaddr_in
sa
;
uint8_t
buffer
[
BLOCKSZ
],
sym
;
if
((
s
=
socket
(
PF_INET
,
SOCK_STREAM
,
0
))
<
0
)
{
perror
(
"socket"
);
return
1
;
}
memset
(
&
sa
,
'\0'
,
sizeof
(
sa
));
sa
.
sin_family
=
AF_INET
;
sa
.
sin_port
=
htons
(
5202
);
sa
.
sin_addr
.
s_addr
=
htonl
((((((
10
<<
8
)
|
100
)
<<
8
)
|
0
)
<<
8
)
|
2
);
if
(
connect
(
s
,
(
struct
sockaddr
*
)
&
sa
,
sizeof
sa
)
<
0
)
{
perror
(
"connect"
);
close
(
s
);
return
2
;
}
sym
=
0xAu
;
memset
(
&
buffer
,
sym
,
BLOCKSZ
);
while
(
write
(
s
,
buffer
,
BLOCKSZ
)
==
BLOCKSZ
)
{
sym
++
;
sym
=
(
sym
==
0x10u
)
?
0xAu
:
sym
;
memset
(
&
buffer
,
sym
,
BLOCKSZ
);
}
close
(
s
);
return
0
;
}
File Metadata
Details
Attached
Mime Type
text/x-c
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
30585733
Default Alt Text
test01.c (1 KB)
Attached To
Mode
D56144: dpaa2: Perform bus_dma pre-write sync before enqueue operation
Attached
Detach File
Event Timeline
Log In to Comment