Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Software for White Rabbit PTP Core
Manage
Activity
Members
Labels
Plan
Issues
39
Issue boards
Milestones
Wiki
Code
Merge requests
5
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Projects
Software for White Rabbit PTP Core
Commits
e9ca75d4
Commit
e9ca75d4
authored
9 years ago
by
Alessandro Rubini
Browse files
Options
Downloads
Patches
Plain Diff
dev/minic: fix too long payload by 14 bytes
Signed-off-by:
Alessandro Rubini
<
rubini@gnudd.com
>
parent
677c4ca4
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dev/minic.c
+8
-8
8 additions, 8 deletions
dev/minic.c
lib/net.c
+1
-1
1 addition, 1 deletion
lib/net.c
with
9 additions
and
9 deletions
dev/minic.c
+
8
−
8
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
;
}
...
...
This diff is collapsed.
Click to expand it.
lib/net.c
+
1
−
1
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
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment