Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
ixgbe_ptp.c File Reference
#include "ixgbe.h"
#include <linux/export.h>
#include <linux/ptp_classify.h>

Go to the source code of this file.


#define IXGBE_INCVAL_10GB   0x66666666
#define IXGBE_INCVAL_1GB   0x40000000
#define IXGBE_INCVAL_100   0x50000000
#define IXGBE_INCVAL_SHIFT_10GB   28
#define IXGBE_INCVAL_SHIFT_100   21
#define IXGBE_INCVAL_SHIFT_82599   7
#define IXGBE_INCPER_SHIFT_82599   24
#define NSECS_PER_SEC   1000000000ULL
#define PTP_PORT   319


void ixgbe_ptp_check_pps_event (struct ixgbe_adapter *adapter, u32 eicr)
void ixgbe_ptp_overflow_check (struct ixgbe_adapter *adapter)
void ixgbe_ptp_tx_hwtstamp (struct ixgbe_q_vector *q_vector, struct sk_buff *skb)
void ixgbe_ptp_rx_hwtstamp (struct ixgbe_q_vector *q_vector, union ixgbe_adv_rx_desc *rx_desc, struct sk_buff *skb)
int ixgbe_ptp_hwtstamp_ioctl (struct ixgbe_adapter *adapter, struct ifreq *ifr, int cmd)
void ixgbe_ptp_start_cyclecounter (struct ixgbe_adapter *adapter)
void ixgbe_ptp_init (struct ixgbe_adapter *adapter)
void ixgbe_ptp_stop (struct ixgbe_adapter *adapter)

Macro Definition Documentation

#define IXGBE_INCPER_SHIFT_82599   24

Definition at line 95 of file ixgbe_ptp.c.

#define IXGBE_INCVAL_100   0x50000000

Definition at line 88 of file ixgbe_ptp.c.

#define IXGBE_INCVAL_10GB   0x66666666

Definition at line 86 of file ixgbe_ptp.c.

#define IXGBE_INCVAL_1GB   0x40000000

Definition at line 87 of file ixgbe_ptp.c.

#define IXGBE_INCVAL_SHIFT_100   21

Definition at line 92 of file ixgbe_ptp.c.

#define IXGBE_INCVAL_SHIFT_10GB   28

Definition at line 90 of file ixgbe_ptp.c.


Definition at line 91 of file ixgbe_ptp.c.

#define IXGBE_INCVAL_SHIFT_82599   7

Definition at line 94 of file ixgbe_ptp.c.


Definition at line 96 of file ixgbe_ptp.c.


Definition at line 98 of file ixgbe_ptp.c.

#define NSECS_PER_SEC   1000000000ULL

Definition at line 101 of file ixgbe_ptp.c.

#define PTP_PORT   319

Function Documentation

void ixgbe_ptp_check_pps_event ( struct ixgbe_adapter adapter,
u32  eicr 

ixgbe_ptp_check_pps_event : the private adapter structure : the interrupt cause register value

This function is called by the interrupt routine when checking for interrupts. It will check and handle a pps event.

Definition at line 385 of file ixgbe_ptp.c.

int ixgbe_ptp_hwtstamp_ioctl ( struct ixgbe_adapter adapter,
struct ifreq ifr,
int  cmd 

ixgbe_ptp_hwtstamp_ioctl - control hardware time stamping : pointer to adapter struct : ioctl data : particular ioctl requested

Outgoing time stamping can be enabled and disabled. Play nice and disable it when requested, although it shouldn't case any overhead when no packet needs it. At most one packet in the queue may be marked for time stamping, otherwise it would be impossible to tell for sure to which packet the hardware time stamp belongs.

Incoming time stamping has to be configured via the hardware filters. Not all combinations are supported, in particular event type has to be specified. Matching the kind of event packet is not supported, with the exception of "all V2 events regardless of level 2 or 4".

Since hardware always timestamps Path delay packets when timestamping V2 packets, regardless of the type specified in the register, only use V2 Event mode. This more accurately tells the user what the hardware is going to do anyways.

Definition at line 618 of file ixgbe_ptp.c.

void ixgbe_ptp_init ( struct ixgbe_adapter adapter)

ixgbe_ptp_init : the ixgbe private adapter structure

This function performs the required steps for enabling ptp support. If ptp support has already been loaded it simply calls the cyclecounter init routine and exits.

Definition at line 901 of file ixgbe_ptp.c.

void ixgbe_ptp_overflow_check ( struct ixgbe_adapter adapter)

ixgbe_ptp_overflow_check - delayed work to detect SYSTIME overflow : structure containing information about this work task

this work function is scheduled to continue reading the timecounter in order to prevent missing when the system time registers wrap around. This needs to be run approximately twice a minute when no PTP activity is occurring.

Definition at line 409 of file ixgbe_ptp.c.

void ixgbe_ptp_rx_hwtstamp ( struct ixgbe_q_vector q_vector,
union ixgbe_adv_rx_desc rx_desc,
struct sk_buff skb 

ixgbe_ptp_rx_hwtstamp - utility function which checks for RX time stamp : structure containing interrupt and ring information : the rx descriptor : particular skb to send timestamp with

if the timestamp is valid, we convert it into the timecounter ns value, then store that result into the shhwtstamps structure which is passed up the network stack

Definition at line 539 of file ixgbe_ptp.c.

void ixgbe_ptp_start_cyclecounter ( struct ixgbe_adapter adapter)

ixgbe_ptp_start_cyclecounter - create the cycle counter from hw : pointer to the adapter structure

this function initializes the timecounter and cyclecounter structures for use in generated a ns counter from the arbitrary fixed point cycles registers in the hardware.

A change in link speed impacts the frequency of the DMA clock on the device, which is used to generate the cycle counter registers. Therefor this function is called whenever the link speed changes.

This function also turns on the SDP pin for clock out feature (X540 only), because this is where the shift is first calculated.

Determine what speed we need to set the cyclecounter for. It should be different for 100Mb, 1Gb, and 10Gb. Treat unknown speeds as 10Gb. (Hence why we can't just copy the link_speed.

Scale the NIC cycle counter by a large factor so that relatively small corrections to the frequency can be added or subtracted. The drawbacks of a large factor include (a) the clock register overflows more quickly, (b) the cycle counter structure must be able to convert the systime value to nanoseconds using only a multiplier and a right-shift, and (c) the value must fit within the timinca register space => math based on internal DMA clock rate and available bits

Modify the calculated values to fit within the correct number of bits specified by the hardware. The 82599 doesn't have the same space as the X540, so bitshift the calculated values to fit.

Definition at line 774 of file ixgbe_ptp.c.

void ixgbe_ptp_stop ( struct ixgbe_adapter adapter)

ixgbe_ptp_stop - disable ptp device and stop the overflow check : pointer to adapter struct

this function stops the ptp support, and cancels the delayed work.

Definition at line 967 of file ixgbe_ptp.c.

void ixgbe_ptp_tx_hwtstamp ( struct ixgbe_q_vector q_vector,
struct sk_buff skb 

ixgbe_ptp_tx_hwtstamp - utility function which checks for TX time stamp : structure containing interrupt and ring information : particular skb to send timestamp with

if the timestamp is valid, we convert it into the timecounter ns value, then store that result into the shhwtstamps structure which is passed up the network stack

Definition at line 492 of file ixgbe_ptp.c.