Commit 9c03e227 authored by David S. Miller's avatar David S. Miller

Merge branch 'bnx2x-Support-for-timestamping-in-P2P-mode'

Sudarsana Reddy Kalluru says:

====================
bnx2x: Support for timestamping in P2P mode.

The patch series adds driver support for timestamping the ptp packets
in peer-delay (P2P) mode.
 - Patch (1) performs the code cleanup.
 - Patch (2) adds the required implementation.

Please consider applying it 'net-next' tree.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents a32b9d91 00165c25
...@@ -15376,27 +15376,47 @@ static int bnx2x_enable_ptp_packets(struct bnx2x *bp) ...@@ -15376,27 +15376,47 @@ static int bnx2x_enable_ptp_packets(struct bnx2x *bp)
return 0; return 0;
} }
#define BNX2X_P2P_DETECT_PARAM_MASK 0x5F5
#define BNX2X_P2P_DETECT_RULE_MASK 0x3DBB
#define BNX2X_PTP_TX_ON_PARAM_MASK (BNX2X_P2P_DETECT_PARAM_MASK & 0x6AA)
#define BNX2X_PTP_TX_ON_RULE_MASK (BNX2X_P2P_DETECT_RULE_MASK & 0x3EEE)
#define BNX2X_PTP_V1_L4_PARAM_MASK (BNX2X_P2P_DETECT_PARAM_MASK & 0x7EE)
#define BNX2X_PTP_V1_L4_RULE_MASK (BNX2X_P2P_DETECT_RULE_MASK & 0x3FFE)
#define BNX2X_PTP_V2_L4_PARAM_MASK (BNX2X_P2P_DETECT_PARAM_MASK & 0x7EA)
#define BNX2X_PTP_V2_L4_RULE_MASK (BNX2X_P2P_DETECT_RULE_MASK & 0x3FEE)
#define BNX2X_PTP_V2_L2_PARAM_MASK (BNX2X_P2P_DETECT_PARAM_MASK & 0x6BF)
#define BNX2X_PTP_V2_L2_RULE_MASK (BNX2X_P2P_DETECT_RULE_MASK & 0x3EFF)
#define BNX2X_PTP_V2_PARAM_MASK (BNX2X_P2P_DETECT_PARAM_MASK & 0x6AA)
#define BNX2X_PTP_V2_RULE_MASK (BNX2X_P2P_DETECT_RULE_MASK & 0x3EEE)
int bnx2x_configure_ptp_filters(struct bnx2x *bp) int bnx2x_configure_ptp_filters(struct bnx2x *bp)
{ {
int port = BP_PORT(bp); int port = BP_PORT(bp);
u32 param, rule;
int rc; int rc;
if (!bp->hwtstamp_ioctl_called) if (!bp->hwtstamp_ioctl_called)
return 0; return 0;
param = port ? NIG_REG_P1_TLLH_PTP_PARAM_MASK :
NIG_REG_P0_TLLH_PTP_PARAM_MASK;
rule = port ? NIG_REG_P1_TLLH_PTP_RULE_MASK :
NIG_REG_P0_TLLH_PTP_RULE_MASK;
switch (bp->tx_type) { switch (bp->tx_type) {
case HWTSTAMP_TX_ON: case HWTSTAMP_TX_ON:
bp->flags |= TX_TIMESTAMPING_EN; bp->flags |= TX_TIMESTAMPING_EN;
REG_WR(bp, port ? NIG_REG_P1_TLLH_PTP_PARAM_MASK : REG_WR(bp, param, BNX2X_PTP_TX_ON_PARAM_MASK);
NIG_REG_P0_TLLH_PTP_PARAM_MASK, 0x6AA); REG_WR(bp, rule, BNX2X_PTP_TX_ON_RULE_MASK);
REG_WR(bp, port ? NIG_REG_P1_TLLH_PTP_RULE_MASK :
NIG_REG_P0_TLLH_PTP_RULE_MASK, 0x3EEE);
break; break;
case HWTSTAMP_TX_ONESTEP_SYNC: case HWTSTAMP_TX_ONESTEP_SYNC:
BNX2X_ERR("One-step timestamping is not supported\n"); BNX2X_ERR("One-step timestamping is not supported\n");
return -ERANGE; return -ERANGE;
} }
param = port ? NIG_REG_P1_LLH_PTP_PARAM_MASK :
NIG_REG_P0_LLH_PTP_PARAM_MASK;
rule = port ? NIG_REG_P1_LLH_PTP_RULE_MASK :
NIG_REG_P0_LLH_PTP_RULE_MASK;
switch (bp->rx_filter) { switch (bp->rx_filter) {
case HWTSTAMP_FILTER_NONE: case HWTSTAMP_FILTER_NONE:
break; break;
...@@ -15410,30 +15430,24 @@ int bnx2x_configure_ptp_filters(struct bnx2x *bp) ...@@ -15410,30 +15430,24 @@ int bnx2x_configure_ptp_filters(struct bnx2x *bp)
case HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ: case HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ:
bp->rx_filter = HWTSTAMP_FILTER_PTP_V1_L4_EVENT; bp->rx_filter = HWTSTAMP_FILTER_PTP_V1_L4_EVENT;
/* Initialize PTP detection for UDP/IPv4 events */ /* Initialize PTP detection for UDP/IPv4 events */
REG_WR(bp, port ? NIG_REG_P1_LLH_PTP_PARAM_MASK : REG_WR(bp, param, BNX2X_PTP_V1_L4_PARAM_MASK);
NIG_REG_P0_LLH_PTP_PARAM_MASK, 0x7EE); REG_WR(bp, rule, BNX2X_PTP_V1_L4_RULE_MASK);
REG_WR(bp, port ? NIG_REG_P1_LLH_PTP_RULE_MASK :
NIG_REG_P0_LLH_PTP_RULE_MASK, 0x3FFE);
break; break;
case HWTSTAMP_FILTER_PTP_V2_L4_EVENT: case HWTSTAMP_FILTER_PTP_V2_L4_EVENT:
case HWTSTAMP_FILTER_PTP_V2_L4_SYNC: case HWTSTAMP_FILTER_PTP_V2_L4_SYNC:
case HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ: case HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ:
bp->rx_filter = HWTSTAMP_FILTER_PTP_V2_L4_EVENT; bp->rx_filter = HWTSTAMP_FILTER_PTP_V2_L4_EVENT;
/* Initialize PTP detection for UDP/IPv4 or UDP/IPv6 events */ /* Initialize PTP detection for UDP/IPv4 or UDP/IPv6 events */
REG_WR(bp, port ? NIG_REG_P1_LLH_PTP_PARAM_MASK : REG_WR(bp, param, BNX2X_PTP_V2_L4_PARAM_MASK);
NIG_REG_P0_LLH_PTP_PARAM_MASK, 0x7EA); REG_WR(bp, rule, BNX2X_PTP_V2_L4_RULE_MASK);
REG_WR(bp, port ? NIG_REG_P1_LLH_PTP_RULE_MASK :
NIG_REG_P0_LLH_PTP_RULE_MASK, 0x3FEE);
break; break;
case HWTSTAMP_FILTER_PTP_V2_L2_EVENT: case HWTSTAMP_FILTER_PTP_V2_L2_EVENT:
case HWTSTAMP_FILTER_PTP_V2_L2_SYNC: case HWTSTAMP_FILTER_PTP_V2_L2_SYNC:
case HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ: case HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ:
bp->rx_filter = HWTSTAMP_FILTER_PTP_V2_L2_EVENT; bp->rx_filter = HWTSTAMP_FILTER_PTP_V2_L2_EVENT;
/* Initialize PTP detection L2 events */ /* Initialize PTP detection L2 events */
REG_WR(bp, port ? NIG_REG_P1_LLH_PTP_PARAM_MASK : REG_WR(bp, param, BNX2X_PTP_V2_L2_PARAM_MASK);
NIG_REG_P0_LLH_PTP_PARAM_MASK, 0x6BF); REG_WR(bp, rule, BNX2X_PTP_V2_L2_RULE_MASK);
REG_WR(bp, port ? NIG_REG_P1_LLH_PTP_RULE_MASK :
NIG_REG_P0_LLH_PTP_RULE_MASK, 0x3EFF);
break; break;
case HWTSTAMP_FILTER_PTP_V2_EVENT: case HWTSTAMP_FILTER_PTP_V2_EVENT:
...@@ -15441,10 +15455,8 @@ int bnx2x_configure_ptp_filters(struct bnx2x *bp) ...@@ -15441,10 +15455,8 @@ int bnx2x_configure_ptp_filters(struct bnx2x *bp)
case HWTSTAMP_FILTER_PTP_V2_DELAY_REQ: case HWTSTAMP_FILTER_PTP_V2_DELAY_REQ:
bp->rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT; bp->rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT;
/* Initialize PTP detection L2, UDP/IPv4 or UDP/IPv6 events */ /* Initialize PTP detection L2, UDP/IPv4 or UDP/IPv6 events */
REG_WR(bp, port ? NIG_REG_P1_LLH_PTP_PARAM_MASK : REG_WR(bp, param, BNX2X_PTP_V2_PARAM_MASK);
NIG_REG_P0_LLH_PTP_PARAM_MASK, 0x6AA); REG_WR(bp, rule, BNX2X_PTP_V2_RULE_MASK);
REG_WR(bp, port ? NIG_REG_P1_LLH_PTP_RULE_MASK :
NIG_REG_P0_LLH_PTP_RULE_MASK, 0x3EEE);
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment