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
7
Merge Requests
7
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
e9ca75d4
Commit
e9ca75d4
authored
Jan 21, 2016
by
Alessandro Rubini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dev/minic: fix too long payload by 14 bytes
Signed-off-by:
Alessandro Rubini
<
rubini@gnudd.com
>
parent
677c4ca4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
9 deletions
+9
-9
minic.c
dev/minic.c
+8
-8
net.c
lib/net.c
+1
-1
No files found.
dev/minic.c
View file @
e9ca75d4
...
...
@@ -194,7 +194,7 @@ int minic_poll_rx()
int
minic_rx_frame
(
uint8_t
*
hdr
,
uint8_t
*
payload
,
uint32_t
buf_size
,
struct
hw_timestamp
*
hwts
)
{
uint32_t
payload_size
,
num_words
;
uint32_t
frame_size
,
payload_size
,
num_words
;
uint32_t
desc_hdr
;
uint32_t
raw_ts
;
uint32_t
cur_avail
;
...
...
@@ -217,8 +217,8 @@ int minic_rx_frame(uint8_t * hdr, uint8_t * payload, uint32_t buf_size,
}
return
0
;
}
payload
_size
=
RX_DESC_SIZE
(
desc_hdr
);
num_words
=
((
payload
_size
+
3
)
>>
2
)
+
1
;
frame
_size
=
RX_DESC_SIZE
(
desc_hdr
);
num_words
=
((
frame
_size
+
3
)
>>
2
)
+
1
;
/* valid packet */
if
(
!
RX_DESC_ERROR
(
desc_hdr
))
{
...
...
@@ -229,15 +229,15 @@ int minic_rx_frame(uint8_t * hdr, uint8_t * payload, uint32_t buf_size,
int
cntr_diff
;
uint16_t
dhdr
;
payload
_size
-=
RX_OOB_SIZE
;
frame
_size
-=
RX_OOB_SIZE
;
/* fixme: ugly way of doing unaligned read */
minic_rx_memcpy
((
uint8_t
*
)
&
raw_ts
,
(
uint8_t
*
)
minic
.
rx_head
+
payload
_size
+
6
,
4
);
+
frame
_size
+
6
,
4
);
minic_rx_memcpy
((
uint8_t
*
)
&
dhdr
,
(
uint8_t
*
)
minic
.
rx_head
+
payload
_size
+
4
,
2
);
frame
_size
+
4
,
2
);
EXPLODE_WR_TIMESTAMP
(
raw_ts
,
counter_r
,
counter_f
);
shw_pps_gen_get_time
(
&
sec
,
&
counter_ppsg
);
...
...
@@ -258,14 +258,14 @@ int minic_rx_frame(uint8_t * hdr, uint8_t * payload, uint32_t buf_size,
hwts
->
nsec
=
counter_r
*
(
REF_CLOCK_PERIOD_PS
/
1000
);
hwts
->
valid
=
(
dhdr
&
RXOOB_TS_INCORRECT
)
?
0
:
1
;
}
payload_size
=
frame_size
-
ETH_HEADER_SIZE
;
n_recvd
=
(
buf_size
<
payload_size
?
buf_size
:
payload_size
);
minic
.
rx_count
++
;
minic_rx_memcpy
(
hdr
,
(
void
*
)
minic
.
rx_head
+
4
,
ETH_HEADER_SIZE
);
minic_rx_memcpy
(
payload
,
(
void
*
)
minic
.
rx_head
+
4
+
ETH_HEADER_SIZE
,
n_recvd
-
ETH_HEADER_SIZE
);
+
ETH_HEADER_SIZE
,
n_recvd
);
}
else
{
n_recvd
=
-
1
;
}
...
...
lib/net.c
View file @
e9ca75d4
...
...
@@ -253,7 +253,7 @@ int ptpd_netif_recvfrom(struct wrpc_socket *s, struct wr_sockaddr *from, void *d
q
->
tail
,
hdr
.
srcmac
[
0
],
hdr
.
srcmac
[
1
],
hdr
.
srcmac
[
2
],
hdr
.
srcmac
[
3
],
hdr
.
srcmac
[
4
],
hdr
.
srcmac
[
5
]);
return
min
(
size
-
sizeof
(
struct
ethhdr
)
,
data_length
);
return
min
(
size
,
data_length
);
}
int
ptpd_netif_sendto
(
struct
wrpc_socket
*
sock
,
struct
wr_sockaddr
*
to
,
void
*
data
,
...
...
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