Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
Software for White Rabbit PTP Core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
32
Issues
32
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Schedules
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
Software for White Rabbit PTP Core
Commits
7b82e986
Commit
7b82e986
authored
Jan 13, 2016
by
Alessandro Rubini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
trivial: net: removed two typedef
Signed-off-by:
Alessandro Rubini
<
rubini@gnudd.com
>
parent
c82ffd4d
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
24 deletions
+25
-24
ptpd_netif.h
include/ptpd_netif.h
+11
-11
arp.c
lib/arp.c
+2
-2
ipv4.c
lib/ipv4.c
+2
-2
net.c
lib/net.c
+9
-8
ppsi
ppsi
+1
-1
No files found.
include/ptpd_netif.h
View file @
7b82e986
...
...
@@ -31,16 +31,16 @@ typedef uint8_t mac_addr_t[6];
typedef
void
*
wr_socket_t
;
// Socket address for ptp_netif_ functions
typedef
struct
{
struct
wr_sockaddr
{
// MAC address
mac_addr_t
mac
;
// Destination MASC address, filled by recvfrom()
mac_addr_t
mac_dest
;
// RAW ethertype
uint16_t
ethertype
;
}
wr_sockaddr_t
;
};
PACKED
struct
_
wr_timestamp
{
PACKED
struct
wr_timestamp
{
// Seconds
int64_t
sec
;
...
...
@@ -60,37 +60,37 @@ PACKED struct _wr_timestamp {
int
correct
;
};
typedef
struct
_wr_timestamp
wr_timestamp_t
;
// Creates UDP or Ethernet RAW socket (determined by sock_type) bound
// to bind_addr. If PTPD_FLAG_MULTICAST is set, the socket is
// automatically added to multicast group. User can specify
// physical_port field to bind the socket to specific switch port only.
wr_socket_t
*
ptpd_netif_create_socket
(
int
unused
,
int
unused2
,
wr_sockaddr_t
*
bind_addr
);
struct
wr_sockaddr
*
bind_addr
);
// Sends a UDP/RAW packet (data, data_length) to addr in wr_sockaddr
_t
.
// Sends a UDP/RAW packet (data, data_length) to addr in wr_sockaddr.
// For raw frames, mac/ethertype needs to be provided, for UDP - ip/port.
// Every transmitted frame has assigned a tag value, stored at tag parameter.
// This value is later used for recovering the precise transmit timestamp.
// If user doesn't need it, tag parameter can be left NULL.
int
ptpd_netif_sendto
(
wr_socket_t
*
sock
,
wr_sockaddr_t
*
to
,
void
*
data
,
size_t
data_length
,
wr_timestamp_t
*
tx_ts
);
int
ptpd_netif_sendto
(
wr_socket_t
*
sock
,
struct
wr_sockaddr
*
to
,
void
*
data
,
size_t
data_length
,
struct
wr_timestamp
*
tx_ts
);
// Receives an UDP/RAW packet. Data is written to (data) and len is returned.
// Maximum buffer length can be specified by data_length parameter.
// Sender information is stored in structure specified in 'from'.
// All RXed packets are timestamped and the timestamp
// is stored in rx_timestamp (unless it's NULL).
int
ptpd_netif_recvfrom
(
wr_socket_t
*
sock
,
wr_sockaddr_t
*
from
,
void
*
data
,
size_t
data_length
,
wr_timestamp_t
*
rx_timestamp
);
int
ptpd_netif_recvfrom
(
wr_socket_t
*
sock
,
struct
wr_sockaddr
*
from
,
void
*
data
,
size_t
data_length
,
struct
wr_timestamp
*
rx_timestamp
);
// Closes the socket.
int
ptpd_netif_close_socket
(
wr_socket_t
*
sock
);
int
ptpd_netif_get_hw_addr
(
wr_socket_t
*
sock
,
mac_addr_t
*
mac
);
void
ptpd_netif_linearize_rx_timestamp
(
wr_timestamp_t
*
ts
,
int32_t
dmtd_phase
,
void
ptpd_netif_linearize_rx_timestamp
(
struct
wr_timestamp
*
ts
,
int32_t
dmtd_phase
,
int
cntr_ahead
,
int
transition_point
,
int
clock_period
);
void
ptpd_netif_set_phase_transition
(
uint32_t
phase
);
...
...
lib/arp.c
View file @
7b82e986
...
...
@@ -31,7 +31,7 @@ static wr_socket_t *arp_socket;
void
arp_init
(
void
)
{
wr_sockaddr_t
saddr
;
struct
wr_sockaddr
saddr
;
/* Configure socket filter */
memset
(
&
saddr
,
0
,
sizeof
(
saddr
));
...
...
@@ -85,7 +85,7 @@ static int process_arp(uint8_t * buf, int len)
void
arp_poll
(
void
)
{
uint8_t
buf
[
ARP_END
+
100
];
wr_sockaddr_t
addr
;
struct
wr_sockaddr
addr
;
int
len
;
if
(
needIP
)
...
...
lib/ipv4.c
View file @
7b82e986
...
...
@@ -39,7 +39,7 @@ unsigned int ipv4_checksum(unsigned short *buf, int shorts)
void
ipv4_init
(
void
)
{
wr_sockaddr_t
saddr
;
struct
wr_sockaddr
saddr
;
/* Reset => need a fresh IP */
needIP
=
1
;
...
...
@@ -58,7 +58,7 @@ static uint32_t bootp_tics;
void
ipv4_poll
(
void
)
{
uint8_t
buf
[
400
];
wr_sockaddr_t
addr
;
struct
wr_sockaddr
addr
;
int
len
;
if
(
!
bootp_tics
)
...
...
lib/net.c
View file @
7b82e986
...
...
@@ -39,7 +39,7 @@ struct sockq {
struct
wrpc_socket
{
int
in_use
;
wr_sockaddr_t
bind_addr
;
struct
wr_sockaddr
bind_addr
;
mac_addr_t
local_mac
;
uint32_t
phase_transition
;
...
...
@@ -68,7 +68,7 @@ void ptpd_netif_set_phase_transition(uint32_t phase)
wr_socket_t
*
ptpd_netif_create_socket
(
int
unused
,
int
unusd2
,
wr_sockaddr_t
*
bind_addr
)
struct
wr_sockaddr
*
bind_addr
)
{
int
i
;
struct
hal_port_state
pstate
;
...
...
@@ -89,7 +89,7 @@ wr_socket_t *ptpd_netif_create_socket(int unused, int unusd2,
if
(
wrpc_get_port_state
(
&
pstate
,
"wr0"
/* unused */
)
<
0
)
return
NULL
;
memcpy
(
&
sock
->
bind_addr
,
bind_addr
,
sizeof
(
wr_sockaddr_t
));
memcpy
(
&
sock
->
bind_addr
,
bind_addr
,
sizeof
(
struct
wr_sockaddr
));
/*get mac from endpoint */
get_mac_addr
(
sock
->
local_mac
);
...
...
@@ -124,7 +124,8 @@ int ptpd_netif_close_socket(wr_socket_t * sock)
*
* Have a look at the note at http://ohwr.org/documents/xxx for details.
*/
void
ptpd_netif_linearize_rx_timestamp
(
wr_timestamp_t
*
ts
,
int32_t
dmtd_phase
,
void
ptpd_netif_linearize_rx_timestamp
(
struct
wr_timestamp
*
ts
,
int32_t
dmtd_phase
,
int
cntr_ahead
,
int
transition_point
,
int
clock_period
)
{
...
...
@@ -223,8 +224,8 @@ static int wrap_copy_out(struct sockq *q, void *src, size_t len)
return
len
;
}
int
ptpd_netif_recvfrom
(
wr_socket_t
*
sock
,
wr_sockaddr_t
*
from
,
void
*
data
,
size_t
data_length
,
wr_timestamp_t
*
rx_timestamp
)
int
ptpd_netif_recvfrom
(
wr_socket_t
*
sock
,
struct
wr_sockaddr
*
from
,
void
*
data
,
size_t
data_length
,
struct
wr_timestamp
*
rx_timestamp
)
{
struct
wrpc_socket
*
s
=
(
struct
wrpc_socket
*
)
sock
;
struct
sockq
*
q
=
&
s
->
queue
;
...
...
@@ -274,8 +275,8 @@ int ptpd_netif_recvfrom(wr_socket_t * sock, wr_sockaddr_t * from, void *data,
return
min
(
size
-
sizeof
(
struct
ethhdr
),
data_length
);
}
int
ptpd_netif_sendto
(
wr_socket_t
*
sock
,
wr_sockaddr_t
*
to
,
void
*
data
,
size_t
data_length
,
wr_timestamp_t
*
tx_timestamp
)
int
ptpd_netif_sendto
(
wr_socket_t
*
sock
,
struct
wr_sockaddr
*
to
,
void
*
data
,
size_t
data_length
,
struct
wr_timestamp
*
tx_timestamp
)
{
struct
wrpc_socket
*
s
=
(
struct
wrpc_socket
*
)
sock
;
struct
hw_timestamp
hwts
;
...
...
ppsi
@
0208eb8f
Subproject commit
b203cc96df8d4008fe311deaf7baab8e555d5c9
6
Subproject commit
0208eb8fc6f1dc03aea051651f6b28e432b42b5
6
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