mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-18 22:14:16 +00:00
gve: Add adminq command to report nic timestamp
Add an adminq command to read NIC's hardware clock. The driver allocates dma memory and passes that dma memory address to the device. The device then writes the clock to the given address. Signed-off-by: Jeff Rogers <jefrogers@google.com> 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-3-hramamurthy@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
db576b61e6
commit
e0c9d5682c
4 changed files with 42 additions and 1 deletions
|
@ -813,6 +813,7 @@ struct gve_priv {
|
|||
u32 adminq_set_driver_parameter_cnt;
|
||||
u32 adminq_report_stats_cnt;
|
||||
u32 adminq_report_link_speed_cnt;
|
||||
u32 adminq_report_nic_timestamp_cnt;
|
||||
u32 adminq_get_ptype_map_cnt;
|
||||
u32 adminq_verify_driver_compatibility_cnt;
|
||||
u32 adminq_query_flow_rules_cnt;
|
||||
|
|
|
@ -326,6 +326,7 @@ int gve_adminq_alloc(struct device *dev, struct gve_priv *priv)
|
|||
priv->adminq_set_driver_parameter_cnt = 0;
|
||||
priv->adminq_report_stats_cnt = 0;
|
||||
priv->adminq_report_link_speed_cnt = 0;
|
||||
priv->adminq_report_nic_timestamp_cnt = 0;
|
||||
priv->adminq_get_ptype_map_cnt = 0;
|
||||
priv->adminq_query_flow_rules_cnt = 0;
|
||||
priv->adminq_cfg_flow_rule_cnt = 0;
|
||||
|
@ -564,6 +565,9 @@ static int gve_adminq_issue_cmd(struct gve_priv *priv,
|
|||
case GVE_ADMINQ_REPORT_LINK_SPEED:
|
||||
priv->adminq_report_link_speed_cnt++;
|
||||
break;
|
||||
case GVE_ADMINQ_REPORT_NIC_TIMESTAMP:
|
||||
priv->adminq_report_nic_timestamp_cnt++;
|
||||
break;
|
||||
case GVE_ADMINQ_GET_PTYPE_MAP:
|
||||
priv->adminq_get_ptype_map_cnt++;
|
||||
break;
|
||||
|
@ -1229,6 +1233,22 @@ int gve_adminq_report_link_speed(struct gve_priv *priv)
|
|||
return err;
|
||||
}
|
||||
|
||||
int gve_adminq_report_nic_ts(struct gve_priv *priv,
|
||||
dma_addr_t nic_ts_report_addr)
|
||||
{
|
||||
union gve_adminq_command cmd;
|
||||
|
||||
memset(&cmd, 0, sizeof(cmd));
|
||||
cmd.opcode = cpu_to_be32(GVE_ADMINQ_REPORT_NIC_TIMESTAMP);
|
||||
cmd.report_nic_ts = (struct gve_adminq_report_nic_ts) {
|
||||
.nic_ts_report_len =
|
||||
cpu_to_be64(sizeof(struct gve_nic_ts_report)),
|
||||
.nic_ts_report_addr = cpu_to_be64(nic_ts_report_addr),
|
||||
};
|
||||
|
||||
return gve_adminq_execute_cmd(priv, &cmd);
|
||||
}
|
||||
|
||||
int gve_adminq_get_ptype_map_dqo(struct gve_priv *priv,
|
||||
struct gve_ptype_lut *ptype_lut)
|
||||
{
|
||||
|
|
|
@ -27,6 +27,7 @@ enum gve_adminq_opcodes {
|
|||
GVE_ADMINQ_GET_PTYPE_MAP = 0xE,
|
||||
GVE_ADMINQ_VERIFY_DRIVER_COMPATIBILITY = 0xF,
|
||||
GVE_ADMINQ_QUERY_FLOW_RULES = 0x10,
|
||||
GVE_ADMINQ_REPORT_NIC_TIMESTAMP = 0x11,
|
||||
GVE_ADMINQ_QUERY_RSS = 0x12,
|
||||
|
||||
/* For commands that are larger than 56 bytes */
|
||||
|
@ -401,6 +402,21 @@ struct gve_adminq_report_link_speed {
|
|||
|
||||
static_assert(sizeof(struct gve_adminq_report_link_speed) == 8);
|
||||
|
||||
struct gve_adminq_report_nic_ts {
|
||||
__be64 nic_ts_report_len;
|
||||
__be64 nic_ts_report_addr;
|
||||
};
|
||||
|
||||
static_assert(sizeof(struct gve_adminq_report_nic_ts) == 16);
|
||||
|
||||
struct gve_nic_ts_report {
|
||||
__be64 nic_timestamp; /* NIC clock in nanoseconds */
|
||||
__be64 reserved1;
|
||||
__be64 reserved2;
|
||||
__be64 reserved3;
|
||||
__be64 reserved4;
|
||||
};
|
||||
|
||||
struct stats {
|
||||
__be32 stat_name;
|
||||
__be32 queue_id;
|
||||
|
@ -594,6 +610,7 @@ union gve_adminq_command {
|
|||
struct gve_adminq_query_flow_rules query_flow_rules;
|
||||
struct gve_adminq_configure_rss configure_rss;
|
||||
struct gve_adminq_query_rss query_rss;
|
||||
struct gve_adminq_report_nic_ts report_nic_ts;
|
||||
struct gve_adminq_extended_command extended_command;
|
||||
};
|
||||
};
|
||||
|
@ -633,6 +650,8 @@ int gve_adminq_reset_flow_rules(struct gve_priv *priv);
|
|||
int gve_adminq_query_flow_rules(struct gve_priv *priv, u16 query_opcode, u32 starting_loc);
|
||||
int gve_adminq_configure_rss(struct gve_priv *priv, struct ethtool_rxfh_param *rxfh);
|
||||
int gve_adminq_query_rss_config(struct gve_priv *priv, struct ethtool_rxfh_param *rxfh);
|
||||
int gve_adminq_report_nic_ts(struct gve_priv *priv,
|
||||
dma_addr_t nic_ts_report_addr);
|
||||
|
||||
struct gve_ptype_lut;
|
||||
int gve_adminq_get_ptype_map_dqo(struct gve_priv *priv,
|
||||
|
|
|
@ -76,7 +76,7 @@ static const char gve_gstrings_adminq_stats[][ETH_GSTRING_LEN] __nonstring_array
|
|||
"adminq_dcfg_device_resources_cnt", "adminq_set_driver_parameter_cnt",
|
||||
"adminq_report_stats_cnt", "adminq_report_link_speed_cnt", "adminq_get_ptype_map_cnt",
|
||||
"adminq_query_flow_rules", "adminq_cfg_flow_rule", "adminq_cfg_rss_cnt",
|
||||
"adminq_query_rss_cnt",
|
||||
"adminq_query_rss_cnt", "adminq_report_nic_timestamp_cnt",
|
||||
};
|
||||
|
||||
static const char gve_gstrings_priv_flags[][ETH_GSTRING_LEN] = {
|
||||
|
@ -456,6 +456,7 @@ gve_get_ethtool_stats(struct net_device *netdev,
|
|||
data[i++] = priv->adminq_cfg_flow_rule_cnt;
|
||||
data[i++] = priv->adminq_cfg_rss_cnt;
|
||||
data[i++] = priv->adminq_query_rss_cnt;
|
||||
data[i++] = priv->adminq_report_nic_timestamp_cnt;
|
||||
}
|
||||
|
||||
static void gve_get_channels(struct net_device *netdev,
|
||||
|
|
Loading…
Add table
Reference in a new issue