Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions
ptp.c File Reference
#include <linux/ip.h>
#include <linux/udp.h>
#include <linux/time.h>
#include <linux/ktime.h>
#include <linux/module.h>
#include <linux/net_tstamp.h>
#include <linux/pps_kernel.h>
#include <linux/ptp_clock_kernel.h>
#include "net_driver.h"
#include "efx.h"
#include "mcdi.h"
#include "mcdi_pcol.h"
#include "io.h"
#include "regs.h"
#include "nic.h"

Go to the source code of this file.

Data Structures

struct  efx_ptp_match
 
struct  efx_ptp_event_rx
 
struct  efx_ptp_timeset
 
struct  efx_ptp_data
 

Macros

#define MAX_EVENT_FRAGS   3
 
#define MAX_SYNCHRONISE_WAIT_MS   2
 
#define SYNCHRONISE_PERIOD_NS   250000
 
#define SYNCHRONISATION_GRANULARITY_NS   200
 
#define MIN_SYNCHRONISATION_NS   120
 
#define MAX_SYNCHRONISATION_NS   1000
 
#define MAX_RECEIVE_EVENTS   8
 
#define AVERAGE_LENGTH   16
 
#define PKT_EVENT_LIFETIME_MS   10
 
#define PTP_DPORT_OFFSET   22
 
#define PTP_V1_VERSION_LENGTH   2
 
#define PTP_V1_VERSION_OFFSET   28
 
#define PTP_V1_UUID_LENGTH   6
 
#define PTP_V1_UUID_OFFSET   50
 
#define PTP_V1_SEQUENCE_LENGTH   2
 
#define PTP_V1_SEQUENCE_OFFSET   58
 
#define PTP_V1_MIN_LENGTH   64
 
#define PTP_V2_VERSION_LENGTH   1
 
#define PTP_V2_VERSION_OFFSET   29
 
#define PTP_V2_MC_UUID_LENGTH   6
 
#define PTP_V2_MC_UUID_OFFSET   50
 
#define PTP_V2_SEQUENCE_LENGTH   2
 
#define PTP_V2_SEQUENCE_OFFSET   58
 
#define PTP_V2_MIN_LENGTH   63
 
#define PTP_MIN_LENGTH   63
 
#define PTP_ADDRESS   0xe0000181 /* 224.0.1.129 */
 
#define PTP_EVENT_PORT   319
 
#define PTP_GENERAL_PORT   320
 
#define PTP_VERSION_V1   1
 
#define PTP_VERSION_V2   2
 
#define PTP_VERSION_V2_MASK   0x0f
 
#define MC_NANOSECOND_BITS   30
 
#define MC_NANOSECOND_MASK   ((1 << MC_NANOSECOND_BITS) - 1)
 
#define MC_SECOND_MASK   ((1 << (32 - MC_NANOSECOND_BITS)) - 1)
 
#define MAX_PPB   1000000
 
#define MAX_PPB_BITS   20
 
#define PPB_EXTRA_BITS   2
 
#define PPB_SCALE_WORD
 
#define PTP_SYNC_ATTEMPTS   4
 

Enumerations

enum  ptp_packet_state { PTP_PACKET_STATE_UNMATCHED = 0, PTP_PACKET_STATE_MATCHED, PTP_PACKET_STATE_TIMED_OUT, PTP_PACKET_STATE_MATCH_UNWANTED }
 

Functions

bool efx_ptp_is_ptp_tx (struct efx_nic *efx, struct sk_buff *skb)
 
int efx_ptp_tx (struct efx_nic *efx, struct sk_buff *skb)
 
int efx_ptp_get_ts_info (struct net_device *net_dev, struct ethtool_ts_info *ts_info)
 
int efx_ptp_ioctl (struct efx_nic *efx, struct ifreq *ifr, int cmd)
 
void efx_ptp_event (struct efx_nic *efx, efx_qword_t *ev)
 
void efx_ptp_probe (struct efx_nic *efx)
 

Macro Definition Documentation

#define AVERAGE_LENGTH   16

Definition at line 74 of file ptp.c.

#define MAX_EVENT_FRAGS   3

Definition at line 53 of file ptp.c.

#define MAX_PPB   1000000

Definition at line 147 of file ptp.c.

#define MAX_PPB_BITS   20

Definition at line 150 of file ptp.c.

#define MAX_RECEIVE_EVENTS   8

Definition at line 71 of file ptp.c.

#define MAX_SYNCHRONISATION_NS   1000

Definition at line 68 of file ptp.c.

#define MAX_SYNCHRONISE_WAIT_MS   2

Definition at line 56 of file ptp.c.

#define MC_NANOSECOND_BITS   30

Definition at line 142 of file ptp.c.

#define MC_NANOSECOND_MASK   ((1 << MC_NANOSECOND_BITS) - 1)

Definition at line 143 of file ptp.c.

#define MC_SECOND_MASK   ((1 << (32 - MC_NANOSECOND_BITS)) - 1)

Definition at line 144 of file ptp.c.

#define MIN_SYNCHRONISATION_NS   120

Definition at line 65 of file ptp.c.

#define PKT_EVENT_LIFETIME_MS   10

Definition at line 77 of file ptp.c.

#define PPB_EXTRA_BITS   2

Definition at line 156 of file ptp.c.

#define PPB_SCALE_WORD
Value:
MAX_PPB_BITS)) / 1000000000LL)

Definition at line 159 of file ptp.c.

#define PTP_ADDRESS   0xe0000181 /* 224.0.1.129 */

Definition at line 120 of file ptp.c.

#define PTP_DPORT_OFFSET   22

Definition at line 83 of file ptp.c.

#define PTP_EVENT_PORT   319

Definition at line 121 of file ptp.c.

#define PTP_GENERAL_PORT   320

Definition at line 122 of file ptp.c.

#define PTP_MIN_LENGTH   63

Definition at line 118 of file ptp.c.

#define PTP_SYNC_ATTEMPTS   4

Definition at line 162 of file ptp.c.

#define PTP_V1_MIN_LENGTH   64

Definition at line 97 of file ptp.c.

#define PTP_V1_SEQUENCE_LENGTH   2

Definition at line 91 of file ptp.c.

#define PTP_V1_SEQUENCE_OFFSET   58

Definition at line 92 of file ptp.c.

#define PTP_V1_UUID_LENGTH   6

Definition at line 88 of file ptp.c.

#define PTP_V1_UUID_OFFSET   50

Definition at line 89 of file ptp.c.

#define PTP_V1_VERSION_LENGTH   2

Definition at line 85 of file ptp.c.

#define PTP_V1_VERSION_OFFSET   28

Definition at line 86 of file ptp.c.

#define PTP_V2_MC_UUID_LENGTH   6

Definition at line 107 of file ptp.c.

#define PTP_V2_MC_UUID_OFFSET   50

Definition at line 108 of file ptp.c.

#define PTP_V2_MIN_LENGTH   63

Definition at line 116 of file ptp.c.

#define PTP_V2_SEQUENCE_LENGTH   2

Definition at line 110 of file ptp.c.

#define PTP_V2_SEQUENCE_OFFSET   58

Definition at line 111 of file ptp.c.

#define PTP_V2_VERSION_LENGTH   1

Definition at line 99 of file ptp.c.

#define PTP_V2_VERSION_OFFSET   29

Definition at line 100 of file ptp.c.

#define PTP_VERSION_V1   1

Definition at line 127 of file ptp.c.

#define PTP_VERSION_V2   2

Definition at line 129 of file ptp.c.

#define PTP_VERSION_V2_MASK   0x0f

Definition at line 130 of file ptp.c.

#define SYNCHRONISATION_GRANULARITY_NS   200

Definition at line 62 of file ptp.c.

#define SYNCHRONISE_PERIOD_NS   250000

Definition at line 59 of file ptp.c.

Enumeration Type Documentation

Enumerator:
PTP_PACKET_STATE_UNMATCHED 
PTP_PACKET_STATE_MATCHED 
PTP_PACKET_STATE_TIMED_OUT 
PTP_PACKET_STATE_MATCH_UNWANTED 

Definition at line 132 of file ptp.c.

Function Documentation

void efx_ptp_event ( struct efx_nic efx,
efx_qword_t ev 
)

Definition at line 1309 of file ptp.c.

int efx_ptp_get_ts_info ( struct net_device net_dev,
struct ethtool_ts_info ts_info 
)

Definition at line 1199 of file ptp.c.

int efx_ptp_ioctl ( struct efx_nic efx,
struct ifreq ifr,
int  cmd 
)

Definition at line 1222 of file ptp.c.

bool efx_ptp_is_ptp_tx ( struct efx_nic efx,
struct sk_buff skb 
)

Definition at line 994 of file ptp.c.

void efx_ptp_probe ( struct efx_nic efx)

Definition at line 1473 of file ptp.c.

int efx_ptp_tx ( struct efx_nic efx,
struct sk_buff skb 
)

Definition at line 1082 of file ptp.c.