#include "../../network_stack_driver.h"
#include "../../ptp_defs.h"
#include "../../task_ptp.h"
#include <arpa/inet.h>
#include <asm-generic/errno-base.h>
#include <asm/socket.h>
#include <fcntl.h>
#include <linux/ethtool.h>
#include <linux/net_tstamp.h>
#include <linux/sockios.h>
#include <net/if.h>
#include <netinet/in.h>
#include <stdio.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <unistd.h>
#include <inttypes.h>
#include <features.h>
#include <asm-generic/unistd.h>
#include <bits/time.h>
#include <linux/if_packet.h>
#include <netinet/ether.h>
#include <poll.h>
#include <pthread.h>
#include <sys/timex.h>
Go to the source code of this file.
◆ CLOCKFD
◆ CLOCKID_TO_FD
#define CLOCKID_TO_FD |
( |
|
clk | ) |
((unsigned int)~((clk) >> 3)) |
◆ CTRL_BUF_SIZE
#define CTRL_BUF_SIZE (256) |
◆ FD_TO_CLOCKID
#define FD_TO_CLOCKID |
( |
|
fd | ) |
((clockid_t)((((unsigned int)~fd) << 3) | CLOCKFD)) |
◆ LINUX_NSD_TS_DEBUG
#define LINUX_NSD_TS_DEBUG (0) |
◆ LINUX_NSD_TX_ENQUEUE_DEBUG
#define LINUX_NSD_TX_ENQUEUE_DEBUG (0) |
◆ MSG_BUF_SIZE
#define MSG_BUF_SIZE (1600) |
◆ NAME_BUF_SIZE
#define NAME_BUF_SIZE (256) |
◆ NOTIF_QUIT_TRANSCEIVER_THREAD
#define NOTIF_QUIT_TRANSCEIVER_THREAD 'Q' |
◆ PHY_FILE_NAME_SIZE
#define PHY_FILE_NAME_SIZE (16) |
◆ PPB_TO_TUNING_SCALER
#define PPB_TO_TUNING_SCALER (((double)(1 << 16)) / 1000.0) |
◆ PRINT_HWADDR
#define PRINT_HWADDR |
( |
|
a | ) |
MSG("%02X:%02X:%02X:%02X:%02X:%02X", a[0], a[1], a[2], a[3], a[4], a[5]); |
◆ enable_timestamping()
static void enable_timestamping |
( |
int |
sfd | ) |
|
|
static |
◆ linux_adjust_clock()
void linux_adjust_clock |
( |
double |
tuning_ppb | ) |
|
Adjust the PHC.
- Parameters
-
tuning_ppb | clock adjustment |
Definition at line 618 of file nsd_linux.c.
◆ linux_get_time()
Query PHC time.
- Parameters
-
pTime | pointer to a timestamp object |
Definition at line 639 of file nsd_linux.c.
◆ linux_nsd_cleanup()
void linux_nsd_cleanup |
( |
void |
| ) |
|
Clean up the Linux network stack driver.
Definition at line 207 of file nsd_linux.c.
◆ linux_nsd_preinit()
bool linux_nsd_preinit |
( |
const char * |
ifn | ) |
|
Preinitialize the Linux network stack driver.
- Parameters
-
ifn | name of the targeted network interface (e.g. eth0) |
- Returns
- initialization successful
Definition at line 76 of file nsd_linux.c.
◆ linux_set_time()
void linux_set_time |
( |
uint32_t |
seconds, |
|
|
uint32_t |
nanoseconds |
|
) |
| |
Set PHC time.
- Parameters
-
seconds | seconds part |
nanoseconds | nanoseconds part |
Definition at line 632 of file nsd_linux.c.
◆ nsd_thread()
static void * nsd_thread |
( |
void * |
arg | ) |
|
|
static |
◆ open_raw_socket()
static int open_raw_socket |
( |
PtpDelayMechanism |
dm, |
|
|
bool |
bind_socket, |
|
|
const char * |
hint |
|
) |
| |
|
static |
◆ open_udp_socket()
static int open_udp_socket |
( |
PtpDelayMechanism |
dm, |
|
|
uint16_t |
port, |
|
|
const char * |
hint |
|
) |
| |
|
static |
◆ post_notification()
static void post_notification |
( |
char |
c | ) |
|
|
static |
◆ ptp_nsd_get_interface_address()
void ptp_nsd_get_interface_address |
( |
uint8_t * |
hwa | ) |
|
Fetch the Ethernet network interface hardware address.
- Parameters
-
hwa | pointer to a 6-byte array where the hardware address is going to be stored to |
Definition at line 609 of file nsd_linux.c.
◆ ptp_nsd_igmp_join_leave()
void ptp_nsd_igmp_join_leave |
( |
bool |
join | ) |
|
Join or leave IGMP groups associated with the current PTP profile.
Definition at line 232 of file nsd_linux.c.
◆ ptp_nsd_init()
Initialize or reinitialize the Network Stack Driver.
- Parameters
-
tp | PTP transport type |
dm | PTP delay mechanism |
Definition at line 499 of file nsd_linux.c.
◆ ptp_nsd_transmit_msg()
Transmit a PTP message.
- Parameters
-
Definition at line 552 of file nsd_linux.c.
◆ socket_join_igmp()
static void socket_join_igmp |
( |
int |
fd | ) |
|
|
static |
◆ DM
◆ event_fd
◆ general_fd
◆ if_hwaddr
uint8_t if_hwaddr[IFHWADDRLEN] |
|
static |
◆ if_idx
◆ if_ipaddr
struct sockaddr_in if_ipaddr |
|
static |
◆ if_name
◆ matching_q
◆ msg_buf
◆ name_buf
◆ notif_q
◆ phc_clkid
◆ phc_fd
◆ phc_file_name
◆ phc_index
◆ rx_ctrl_buf
◆ TP
◆ transceiver_thread
pthread_t transceiver_thread |
|
static |