]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
gve: Advertise support for rx hardware timestamping
authorJohn Fraker <jfraker@google.com>
Sat, 14 Jun 2025 00:07:54 +0000 (00:07 +0000)
committerJakub Kicinski <kuba@kernel.org>
Mon, 16 Jun 2025 22:27:25 +0000 (15:27 -0700)
Expand the get_ts_info ethtool handler with the new gve_get_ts_info
which advertises support for rx hardware timestamping.

With this patch, the driver now fully supports rx hardware timestamping.

Signed-off-by: John Fraker <jfraker@google.com>
Signed-off-by: Ziwei Xiao <ziweixiao@google.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Harshitha Ramamurthy <hramamurthy@google.com>
Link: https://patch.msgid.link/20250614000754.164827-9-hramamurthy@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/google/gve/gve_ethtool.c

index 6ecbcee4ec1336e3c3208e145c4fdf6b68bd9f49..8dbd7639e1159573531fdb55c209a3823e6ce516 100644 (file)
@@ -923,6 +923,27 @@ static int gve_set_rxfh(struct net_device *netdev, struct ethtool_rxfh_param *rx
        return 0;
 }
 
+static int gve_get_ts_info(struct net_device *netdev,
+                          struct kernel_ethtool_ts_info *info)
+{
+       struct gve_priv *priv = netdev_priv(netdev);
+
+       ethtool_op_get_ts_info(netdev, info);
+
+       if (priv->nic_timestamp_supported) {
+               info->so_timestamping |= SOF_TIMESTAMPING_RX_HARDWARE |
+                                        SOF_TIMESTAMPING_RAW_HARDWARE;
+
+               info->rx_filters |= BIT(HWTSTAMP_FILTER_NONE) |
+                                   BIT(HWTSTAMP_FILTER_ALL);
+
+               if (priv->ptp)
+                       info->phc_index = ptp_clock_index(priv->ptp->clock);
+       }
+
+       return 0;
+}
+
 const struct ethtool_ops gve_ethtool_ops = {
        .supported_coalesce_params = ETHTOOL_COALESCE_USECS,
        .supported_ring_params = ETHTOOL_RING_USE_TCP_DATA_SPLIT,
@@ -951,5 +972,5 @@ const struct ethtool_ops gve_ethtool_ops = {
        .get_priv_flags = gve_get_priv_flags,
        .set_priv_flags = gve_set_priv_flags,
        .get_link_ksettings = gve_get_link_ksettings,
-       .get_ts_info = ethtool_op_get_ts_info,
+       .get_ts_info = gve_get_ts_info,
 };