Skip to content

Commit

Permalink
Merge branch 'gve-minor-cleanups'
Browse files Browse the repository at this point in the history
Simon Horman says:

====================
gve: Minor cleanups

This short patchset provides two minor cleanups for the gve driver.

These were found by tooling as mentioned in each patch,
and otherwise by inspection.

No change in run time behaviour is intended.
Each patch is compile tested only.

v1: https://lore.kernel.org/r/20240503-gve-comma-v1-0-b50f965694ef@kernel.org
====================

Link: https://lore.kernel.org/r/20240508-gve-comma-v2-0-1ac919225f13@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Jakub Kicinski committed May 11, 2024
2 parents b9d5f57 + ba8bcb0 commit 9c1bbc7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 27 deletions.
4 changes: 2 additions & 2 deletions drivers/net/ethernet/google/gve/gve_adminq.c
Original file line number Diff line number Diff line change
Expand Up @@ -650,9 +650,9 @@ static void gve_adminq_get_create_rx_queue_cmd(struct gve_priv *priv,
GVE_RAW_ADDRESSING_QPL_ID : rx->data.qpl->id;

cmd->create_rx_queue.rx_desc_ring_addr =
cpu_to_be64(rx->desc.bus),
cpu_to_be64(rx->desc.bus);
cmd->create_rx_queue.rx_data_ring_addr =
cpu_to_be64(rx->data.data_bus),
cpu_to_be64(rx->data.data_bus);
cmd->create_rx_queue.index = cpu_to_be32(queue_index);
cmd->create_rx_queue.queue_page_list_id = cpu_to_be32(qpl_id);
cmd->create_rx_queue.packet_buffer_size = cpu_to_be16(rx->packet_buffer_size);
Expand Down
42 changes: 17 additions & 25 deletions drivers/net/ethernet/google/gve/gve_ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,42 +90,34 @@ static const char gve_gstrings_priv_flags[][ETH_GSTRING_LEN] = {
static void gve_get_strings(struct net_device *netdev, u32 stringset, u8 *data)
{
struct gve_priv *priv = netdev_priv(netdev);
char *s = (char *)data;
u8 *s = (char *)data;
int num_tx_queues;
int i, j;

num_tx_queues = gve_num_tx_queues(priv);
switch (stringset) {
case ETH_SS_STATS:
memcpy(s, *gve_gstrings_main_stats,
sizeof(gve_gstrings_main_stats));
s += sizeof(gve_gstrings_main_stats);

for (i = 0; i < priv->rx_cfg.num_queues; i++) {
for (j = 0; j < NUM_GVE_RX_CNTS; j++) {
snprintf(s, ETH_GSTRING_LEN,
gve_gstrings_rx_stats[j], i);
s += ETH_GSTRING_LEN;
}
}
for (i = 0; i < ARRAY_SIZE(gve_gstrings_main_stats); i++)
ethtool_puts(&s, gve_gstrings_main_stats[i]);

for (i = 0; i < num_tx_queues; i++) {
for (j = 0; j < NUM_GVE_TX_CNTS; j++) {
snprintf(s, ETH_GSTRING_LEN,
gve_gstrings_tx_stats[j], i);
s += ETH_GSTRING_LEN;
}
}
for (i = 0; i < priv->rx_cfg.num_queues; i++)
for (j = 0; j < NUM_GVE_RX_CNTS; j++)
ethtool_sprintf(&s, gve_gstrings_rx_stats[j],
i);

for (i = 0; i < num_tx_queues; i++)
for (j = 0; j < NUM_GVE_TX_CNTS; j++)
ethtool_sprintf(&s, gve_gstrings_tx_stats[j],
i);

for (i = 0; i < ARRAY_SIZE(gve_gstrings_adminq_stats); i++)
ethtool_puts(&s, gve_gstrings_adminq_stats[i]);

memcpy(s, *gve_gstrings_adminq_stats,
sizeof(gve_gstrings_adminq_stats));
s += sizeof(gve_gstrings_adminq_stats);
break;

case ETH_SS_PRIV_FLAGS:
memcpy(s, *gve_gstrings_priv_flags,
sizeof(gve_gstrings_priv_flags));
s += sizeof(gve_gstrings_priv_flags);
for (i = 0; i < ARRAY_SIZE(gve_gstrings_priv_flags); i++)
ethtool_puts(&s, gve_gstrings_priv_flags[i]);
break;

default:
Expand Down

0 comments on commit 9c1bbc7

Please sign in to comment.