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
e73b898a
Commit
e73b898a
authored
Jul 07, 2020
by
Grzegorz Daniluk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bring back IP support
parent
d6f4484c
Pipeline
#285
failed with stages
in 9 seconds
Changes
14
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
47 additions
and
27 deletions
+47
-27
board.h
boards/afcz/board.h
+2
-0
board.h
boards/ertm14/board.h
+2
-0
board.h
boards/generic/board.h
+3
-1
board.h
boards/sis8300ku/board.h
+2
-0
wrc-task.h
include/wrc-task.h
+1
-0
arp.c
lib/arp.c
+2
-2
bootp.c
lib/bootp.c
+4
-4
ipv4.c
lib/ipv4.c
+7
-5
latency.c
lib/latency.c
+2
-2
lldp.c
lib/lldp.c
+3
-3
syslog.c
lib/syslog.c
+1
-1
wrc-tasks.c
lib/wrc-tasks.c
+16
-1
shell.c
shell/shell.c
+2
-0
wrc_main.c
wrc_main.c
+0
-8
No files found.
boards/afcz/board.h
View file @
e73b898a
...
...
@@ -98,6 +98,8 @@ int board_update(void);
#define HAS_ABSCAL 0
#endif
#define HAS_EB 0
#undef CONFIG_DISALLOW_LONG_DIVISION
#define BOARD_MAX_CONSOLE_DEVICES 1
...
...
boards/ertm14/board.h
View file @
e73b898a
...
...
@@ -67,6 +67,8 @@ int board_update(void);
#define HAS_IP 0
#endif
#define HAS_EB 0
#define ERTM14_MAX_CONFIGS 8
extern
unsigned
char
*
BASE_MINIC
;
...
...
boards/generic/board.h
View file @
e73b898a
...
...
@@ -18,7 +18,7 @@
#define BASE_SYSCON 0x20400
#define BASE_UART 0x20500
#define BASE_ONEWIRE 0x20600
//#define BASE_ETHERNOB
E_CFG 0x20700
#define BASE_ETHERBON
E_CFG 0x20700
/* Board-specific parameters */
#define TICS_PER_SECOND 1000
...
...
@@ -71,6 +71,8 @@
#define HAS_ABSCAL 0
#endif
#define HAS_EB 1
#define CONFIG_DISALLOW_LONG_DIVISION
#define BOARD_MAX_CONSOLE_DEVICES 1
...
...
boards/sis8300ku/board.h
View file @
e73b898a
...
...
@@ -64,6 +64,8 @@
#define HAS_ABSCAL 0
#endif
#define HAS_EB 0
#define CONFIG_DISALLOW_LONG_DIVISION
#define BOARD_MAX_CONSOLE_DEVICES 1
...
...
include/wrc-task.h
View file @
e73b898a
...
...
@@ -34,5 +34,6 @@ struct wrc_task *wrc_task_get(int tid);
void
wrc_start_all_tasks
(
void
);
void
wrc_poll_all_tasks
(
void
);
void
wrc_tasks_accounting_init
(
void
);
int
wrc_task_not_yet
(
uint32_t
*
lastt
,
unsigned
period
);
#endif
/* __WRC_TASK_H__ */
lib/arp.c
View file @
e73b898a
...
...
@@ -10,7 +10,7 @@
#include <wrpc.h>
#include <string.h>
#include "endpoint.h"
#include "
dev/
endpoint.h"
#include "ipv4.h"
#include "ptpd_netif.h"
...
...
@@ -77,7 +77,7 @@ static int process_arp(uint8_t * buf, int len)
buf
[
ARP_OPER
+
0
]
=
0
;
buf
[
ARP_OPER
+
1
]
=
2
;
// my MAC+IP
get_mac_addr
(
buf
+
ARP_SHA
);
ep_
get_mac_addr
(
buf
+
ARP_SHA
);
memcpy
(
buf
+
ARP_SPA
,
myIP
,
4
);
// his MAC+IP
memcpy
(
buf
+
ARP_THA
,
hisMAC
,
6
);
...
...
lib/bootp.c
View file @
e73b898a
...
...
@@ -8,7 +8,7 @@
*/
#include <string.h>
#include <wrc.h>
#include "endpoint.h"
#include "
dev/
endpoint.h"
#include "ipv4.h"
...
...
@@ -40,7 +40,7 @@ int prepare_bootp(struct wr_sockaddr *addr, uint8_t * buf, int retry)
buf
[
BOOTP_HOPS
]
=
0
;
/* A unique identifier for the request !!! FIXME */
get_mac_addr
(
buf
+
BOOTP_XID
);
ep_
get_mac_addr
(
buf
+
BOOTP_XID
);
buf
[
BOOTP_XID
+
0
]
^=
buf
[
BOOTP_XID
+
4
];
buf
[
BOOTP_XID
+
1
]
^=
buf
[
BOOTP_XID
+
5
];
buf
[
BOOTP_XID
+
2
]
^=
(
retry
>>
8
)
&
0xFF
;
...
...
@@ -56,7 +56,7 @@ int prepare_bootp(struct wr_sockaddr *addr, uint8_t * buf, int retry)
memset
(
buf
+
BOOTP_GIADDR
,
0
,
4
);
memset
(
buf
+
BOOTP_CHADDR
,
0
,
16
);
get_mac_addr
(
buf
+
BOOTP_CHADDR
);
/* own MAC address */
ep_
get_mac_addr
(
buf
+
BOOTP_CHADDR
);
/* own MAC address */
memset
(
buf
+
BOOTP_SNAME
,
0
,
64
);
/* desired BOOTP server */
memset
(
buf
+
BOOTP_FILE
,
0
,
128
);
/* desired BOOTP file */
...
...
@@ -81,7 +81,7 @@ int process_bootp(uint8_t * buf, int len)
uint8_t
mac
[
6
];
uint8_t
ip
[
4
];
get_mac_addr
(
mac
);
ep_
get_mac_addr
(
mac
);
if
(
len
!=
BOOTP_END
)
return
0
;
...
...
lib/ipv4.c
View file @
e73b898a
...
...
@@ -10,10 +10,10 @@
#include <wrpc.h>
#include <string.h>
#include "endpoint.h"
#include "
dev/
endpoint.h"
#include "ipv4.h"
#include "ptpd_netif.h"
#include "pps_gen.h"
#include "
dev/
pps_gen.h"
#include "hw/etherbone-config.h"
enum
ip_status
ip_status
=
IP_TRAINING
;
...
...
@@ -109,7 +109,7 @@ static int bootp_poll(void)
if
(
len
>
0
)
ret
=
process_bootp
(
buf
,
len
);
if
(
task_not_yet
(
&
bootp_tics
,
TICS_PER_SECOND
))
if
(
wrc_
task_not_yet
(
&
bootp_tics
,
TICS_PER_SECOND
))
return
ret
;
len
=
prepare_bootp
(
&
addr
,
buf
,
++
bootp_retry
);
...
...
@@ -199,8 +199,10 @@ void setIP(unsigned char *IP)
memcpy
(
myIP
,
IP
,
4
);
ip
=
(
myIP
[
0
]
<<
24
)
|
(
myIP
[
1
]
<<
16
)
|
(
myIP
[
2
]
<<
8
)
|
(
myIP
[
3
]);
while
(
*
eb_ip
!=
ip
)
*
eb_ip
=
ip
;
if
(
HAS_EB
)
{
while
(
*
eb_ip
!=
ip
)
*
eb_ip
=
ip
;
}
if
(
ip
==
0
)
ip_status
=
IP_TRAINING
;
...
...
lib/latency.c
View file @
e73b898a
...
...
@@ -91,7 +91,7 @@ static void latency_report(struct wr_timestamp *lat)
unsigned
char
mac
[
6
];
/* first time; pick a time in the future */
get_mac_addr
(
mac
);
ep_
get_mac_addr
(
mac
);
nextj
=
jiffies
+
TICS_PER_SECOND
*
(
10
+
(
mac
[
5
]
%
60
));
pp_printf
(
"%s: first sending at %li
\n
"
,
__func__
,
nextj
);
}
...
...
@@ -269,7 +269,7 @@ int latency_poll(void)
return
latency_poll_rx
();
/* Periodically send the frames */
if
(
task_not_yet
(
&
lastt
,
latency_period_ms
))
if
(
wrc_
task_not_yet
(
&
lastt
,
latency_period_ms
))
return
0
;
return
latency_poll_tx
();
}
...
...
lib/lldp.c
View file @
e73b898a
...
...
@@ -48,7 +48,7 @@ static void fill_mac(uint8_t *tlv, uint8_t type)
{
*
tlv
=
type
;
/* write MAC after subtype byte */
get_mac_addr
(
tlv
+
LLDP_SUBTYPE
);
ep_
get_mac_addr
(
tlv
+
LLDP_SUBTYPE
);
}
static
void
lldp_add_tlv
(
int
tlv_type
)
{
...
...
@@ -119,7 +119,7 @@ static void lldp_add_tlv(int tlv_type) {
(
char
*
)
buf
);
}
else
{
/* NOTE: no subtype */
get_mac_addr
(
mac
);
ep_
get_mac_addr
(
mac
);
pp_sprintf
(
buf
,
"%02x:%02x:%02x:%02x:%02x:%02x"
,
mac
[
0
],
mac
[
1
],
mac
[
2
],
mac
[
3
],
...
...
@@ -251,7 +251,7 @@ int lldp_poll(void)
/* periodic tasks */
if
(
ticks
>
LLDP_TX_TICK_INTERVAL
)
{
get_mac_addr
(
new_mac
);
ep_
get_mac_addr
(
new_mac
);
if
(
HAS_IP
)
{
getIP
(
&
new_ipWR
);
}
...
...
lib/syslog.c
View file @
e73b898a
...
...
@@ -130,7 +130,7 @@ int syslog_poll(void)
if
(
!
tics
)
{
/* first time ever, or new syslog server */
tics
=
now
-
1
;
get_mac_addr
(
mac
);
ep_
get_mac_addr
(
mac
);
len
=
syslog_header
(
buf
,
SYSLOG_DEFAULT_LEVEL
,
ip
);
len
+=
pp_sprintf
(
buf
+
len
,
"(%s) Node up "
"since %i seconds"
,
format_mac
(
b
,
mac
),
...
...
lib/wrc-tasks.c
View file @
e73b898a
...
...
@@ -146,4 +146,19 @@ void wrc_tasks_accounting_init()
shw_pps_gen_get_time
(
NULL
,
&
prev_nanos_for_profile
);
/* get tics */
prev_ticks_for_profile
=
timer_get_tics
();
}
\ No newline at end of file
}
int
wrc_task_not_yet
(
uint32_t
*
lastt
,
unsigned
period
)
{
uint32_t
now
=
timer_get_tics
();
if
(
!*
lastt
)
{
*
lastt
=
now
;
return
0
;
}
if
(
time_before
(
now
,
*
lastt
+
period
))
return
1
;
/* not yet */
*
lastt
+=
period
;
return
0
;
}
shell/shell.c
View file @
e73b898a
...
...
@@ -364,5 +364,7 @@ void shell_register_commands()
REGISTER_WRC_COMMAND
(
diag
);
REGISTER_WRC_COMMAND
(
init
);
REGISTER_WRC_COMMAND
(
sfp
);
if
(
HAS_IP
)
REGISTER_WRC_COMMAND
(
ip
);
}
wrc_main.c
View file @
e73b898a
...
...
@@ -40,10 +40,6 @@
#include "dev/dac_log.h"
#endif
#ifdef CONFIG_IP
#include "lib/arp.h"
#endif
#ifdef CONFIG_LATENCY_PROBE
#include "lib/latency.h"
#endif
...
...
@@ -52,10 +48,6 @@
#include "lib/lldp.h"
#endif
#ifdef CONFIG_SNMP
#include "lib/snmp.h"
#endif
char
wrc_hw_name
[
HW_NAME_LENGTH
];
uint32_t
cal_phase_transition
=
2389
;
...
...
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