net: Introduce peer to peer one step PTP time stamping.
authorRichard Cochran <richardcochran@gmail.com>
Thu, 26 Dec 2019 02:16:19 +0000 (18:16 -0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 26 Dec 2019 03:51:34 +0000 (19:51 -0800)
The 1588 standard defines one step operation for both Sync and
PDelay_Resp messages.  Up until now, hardware with P2P one step has
been rare, and kernel support was lacking.  This patch adds support of
the mode in anticipation of new hardware developments.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.c
drivers/net/ethernet/microchip/lan743x_ptp.c
drivers/net/ethernet/qlogic/qede/qede_ptp.c
include/uapi/linux/net_tstamp.h
net/core/dev_ioctl.c

index cff64e43bdd80552e160d4d4935f2f55b37272e1..741d865e4afc6b8dd6b22139d46f48e1482a7475 100644 (file)
@@ -15410,6 +15410,7 @@ int bnx2x_configure_ptp_filters(struct bnx2x *bp)
                REG_WR(bp, rule, BNX2X_PTP_TX_ON_RULE_MASK);
                break;
        case HWTSTAMP_TX_ONESTEP_SYNC:
+       case HWTSTAMP_TX_ONESTEP_P2P:
                BNX2X_ERR("One-step timestamping is not supported\n");
                return -ERANGE;
        }
index ec2ff3d7f41c4877f2701679d1eaefefc4878ef5..4aaaa4937b1a72fde8057fbc1dc7baacca5dc3a5 100644 (file)
@@ -920,6 +920,7 @@ static int mlxsw_sp_ptp_get_message_types(const struct hwtstamp_config *config,
                egr_types = 0xff;
                break;
        case HWTSTAMP_TX_ONESTEP_SYNC:
+       case HWTSTAMP_TX_ONESTEP_P2P:
                return -ERANGE;
        }
 
index afe52463dc576ea015cab657961dfc5891194759..9399f6a987487b934223431a096f0373dbc66ee3 100644 (file)
@@ -1265,6 +1265,9 @@ int lan743x_ptp_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
 
                lan743x_ptp_set_sync_ts_insert(adapter, true);
                break;
+       case HWTSTAMP_TX_ONESTEP_P2P:
+               ret = -ERANGE;
+               break;
        default:
                netif_warn(adapter, drv, adapter->netdev,
                           "  tx_type = %d, UNKNOWN\n", config.tx_type);
index f815435cf106143270d7b503bc0e411d2fa8904a..4c7f7a7fc1515a0e1a1bcf2d602ef959511acaff 100644 (file)
@@ -247,6 +247,7 @@ static int qede_ptp_cfg_filters(struct qede_dev *edev)
                break;
 
        case HWTSTAMP_TX_ONESTEP_SYNC:
+       case HWTSTAMP_TX_ONESTEP_P2P:
                DP_ERR(edev, "One-step timestamping is not supported\n");
                return -ERANGE;
        }
index e5b39721c6e4877c1235b2708956474c80f4761f..f96e650d0af992158ac53ffce3d9f5414e733f59 100644 (file)
@@ -90,6 +90,14 @@ enum hwtstamp_tx_types {
         * queue.
         */
        HWTSTAMP_TX_ONESTEP_SYNC,
+
+       /*
+        * Same as HWTSTAMP_TX_ONESTEP_SYNC, but also enables time
+        * stamp insertion directly into PDelay_Resp packets. In this
+        * case, neither transmitted Sync nor PDelay_Resp packets will
+        * receive a time stamp via the socket error queue.
+        */
+       HWTSTAMP_TX_ONESTEP_P2P,
 };
 
 /* possible values for hwtstamp_config->rx_filter */
index 5163d900bb4fb1057e273ed667e9457f05b33c93..dbaebbe573f001b0a46bc7997f2a93d7359ef17f 100644 (file)
@@ -187,6 +187,7 @@ static int net_hwtstamp_validate(struct ifreq *ifr)
        case HWTSTAMP_TX_OFF:
        case HWTSTAMP_TX_ON:
        case HWTSTAMP_TX_ONESTEP_SYNC:
+       case HWTSTAMP_TX_ONESTEP_P2P:
                tx_type_valid = 1;
                break;
        }