diff options
author | Michal Kalderon <Michal.Kalderon@qlogic.com> | 2014-08-17 09:47:44 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-08-22 15:31:15 -0400 |
commit | eeed018cbfa30c0bde89075b06b62fc198afb51c (patch) | |
tree | 20df0c6ec8501e675d882e021e6a320799948b33 /drivers/net/ethernet/broadcom/bnx2x/bnx2x.h | |
parent | e42780b66aab88d3a82b6087bcd6095b90eecde7 (diff) |
bnx2x: Add timestamping and PTP hardware clock support
This adds a PHC to the bnx2x driver. Driver supports timestamping send/receive
PTP packets, as well as adjusting the on-chip clock.
The driver has been tested with linuxptp project.
Signed-off-by: Michal Kalderon <Michal.Kalderon@qlogic.com>
Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: Ariel Elior <Ariel.Elior@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/broadcom/bnx2x/bnx2x.h')
-rw-r--r-- | drivers/net/ethernet/broadcom/bnx2x/bnx2x.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h index d777fae86988..a0b06a07cbde 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h | |||
@@ -20,6 +20,10 @@ | |||
20 | #include <linux/types.h> | 20 | #include <linux/types.h> |
21 | #include <linux/pci_regs.h> | 21 | #include <linux/pci_regs.h> |
22 | 22 | ||
23 | #include <linux/ptp_clock_kernel.h> | ||
24 | #include <linux/net_tstamp.h> | ||
25 | #include <linux/clocksource.h> | ||
26 | |||
23 | /* compilation time flags */ | 27 | /* compilation time flags */ |
24 | 28 | ||
25 | /* define this to make the driver freeze on error to allow getting debug info | 29 | /* define this to make the driver freeze on error to allow getting debug info |
@@ -70,6 +74,7 @@ enum bnx2x_int_mode { | |||
70 | #define BNX2X_MSG_SP 0x0100000 /* was: NETIF_MSG_INTR */ | 74 | #define BNX2X_MSG_SP 0x0100000 /* was: NETIF_MSG_INTR */ |
71 | #define BNX2X_MSG_FP 0x0200000 /* was: NETIF_MSG_INTR */ | 75 | #define BNX2X_MSG_FP 0x0200000 /* was: NETIF_MSG_INTR */ |
72 | #define BNX2X_MSG_IOV 0x0800000 | 76 | #define BNX2X_MSG_IOV 0x0800000 |
77 | #define BNX2X_MSG_PTP 0x1000000 | ||
73 | #define BNX2X_MSG_IDLE 0x2000000 /* used for idle check*/ | 78 | #define BNX2X_MSG_IDLE 0x2000000 /* used for idle check*/ |
74 | #define BNX2X_MSG_ETHTOOL 0x4000000 | 79 | #define BNX2X_MSG_ETHTOOL 0x4000000 |
75 | #define BNX2X_MSG_DCB 0x8000000 | 80 | #define BNX2X_MSG_DCB 0x8000000 |
@@ -1591,6 +1596,8 @@ struct bnx2x { | |||
1591 | #define BC_SUPPORTS_RMMOD_CMD (1 << 24) | 1596 | #define BC_SUPPORTS_RMMOD_CMD (1 << 24) |
1592 | #define HAS_PHYS_PORT_ID (1 << 25) | 1597 | #define HAS_PHYS_PORT_ID (1 << 25) |
1593 | #define AER_ENABLED (1 << 26) | 1598 | #define AER_ENABLED (1 << 26) |
1599 | #define PTP_SUPPORTED (1 << 27) | ||
1600 | #define TX_TIMESTAMPING_EN (1 << 28) | ||
1594 | 1601 | ||
1595 | #define BP_NOMCP(bp) ((bp)->flags & NO_MCP_FLAG) | 1602 | #define BP_NOMCP(bp) ((bp)->flags & NO_MCP_FLAG) |
1596 | 1603 | ||
@@ -1933,6 +1940,19 @@ struct bnx2x { | |||
1933 | 1940 | ||
1934 | u8 phys_port_id[ETH_ALEN]; | 1941 | u8 phys_port_id[ETH_ALEN]; |
1935 | 1942 | ||
1943 | /* PTP related context */ | ||
1944 | struct ptp_clock *ptp_clock; | ||
1945 | struct ptp_clock_info ptp_clock_info; | ||
1946 | struct work_struct ptp_task; | ||
1947 | struct cyclecounter cyclecounter; | ||
1948 | struct timecounter timecounter; | ||
1949 | bool timecounter_init_done; | ||
1950 | struct sk_buff *ptp_tx_skb; | ||
1951 | unsigned long ptp_tx_start; | ||
1952 | bool hwtstamp_ioctl_called; | ||
1953 | u16 tx_type; | ||
1954 | u16 rx_filter; | ||
1955 | |||
1936 | struct bnx2x_link_report_data vf_link_vars; | 1956 | struct bnx2x_link_report_data vf_link_vars; |
1937 | }; | 1957 | }; |
1938 | 1958 | ||
@@ -2559,4 +2579,11 @@ void bnx2x_update_mng_version(struct bnx2x *bp); | |||
2559 | 2579 | ||
2560 | #define E1H_MAX_MF_SB_COUNT (HC_SB_MAX_SB_E1X/(E1HVN_MAX * PORT_MAX)) | 2580 | #define E1H_MAX_MF_SB_COUNT (HC_SB_MAX_SB_E1X/(E1HVN_MAX * PORT_MAX)) |
2561 | 2581 | ||
2582 | void bnx2x_init_ptp(struct bnx2x *bp); | ||
2583 | int bnx2x_configure_ptp_filters(struct bnx2x *bp); | ||
2584 | void bnx2x_set_rx_ts(struct bnx2x *bp, struct sk_buff *skb); | ||
2585 | |||
2586 | #define BNX2X_MAX_PHC_DRIFT 31000000 | ||
2587 | #define BNX2X_PTP_TX_TIMEOUT | ||
2588 | |||
2562 | #endif /* bnx2x.h */ | 2589 | #endif /* bnx2x.h */ |