Skip to content

Commit 9c1bbc7

Browse files
committed
Merge branch 'gve-minor-cleanups'
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/[email protected] ==================== Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents b9d5f57 + ba8bcb0 commit 9c1bbc7

File tree

2 files changed

+19
-27
lines changed

2 files changed

+19
-27
lines changed

drivers/net/ethernet/google/gve/gve_adminq.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -650,9 +650,9 @@ static void gve_adminq_get_create_rx_queue_cmd(struct gve_priv *priv,
650650
GVE_RAW_ADDRESSING_QPL_ID : rx->data.qpl->id;
651651

652652
cmd->create_rx_queue.rx_desc_ring_addr =
653-
cpu_to_be64(rx->desc.bus),
653+
cpu_to_be64(rx->desc.bus);
654654
cmd->create_rx_queue.rx_data_ring_addr =
655-
cpu_to_be64(rx->data.data_bus),
655+
cpu_to_be64(rx->data.data_bus);
656656
cmd->create_rx_queue.index = cpu_to_be32(queue_index);
657657
cmd->create_rx_queue.queue_page_list_id = cpu_to_be32(qpl_id);
658658
cmd->create_rx_queue.packet_buffer_size = cpu_to_be16(rx->packet_buffer_size);

drivers/net/ethernet/google/gve/gve_ethtool.c

Lines changed: 17 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -90,42 +90,34 @@ static const char gve_gstrings_priv_flags[][ETH_GSTRING_LEN] = {
9090
static void gve_get_strings(struct net_device *netdev, u32 stringset, u8 *data)
9191
{
9292
struct gve_priv *priv = netdev_priv(netdev);
93-
char *s = (char *)data;
93+
u8 *s = (char *)data;
9494
int num_tx_queues;
9595
int i, j;
9696

9797
num_tx_queues = gve_num_tx_queues(priv);
9898
switch (stringset) {
9999
case ETH_SS_STATS:
100-
memcpy(s, *gve_gstrings_main_stats,
101-
sizeof(gve_gstrings_main_stats));
102-
s += sizeof(gve_gstrings_main_stats);
103-
104-
for (i = 0; i < priv->rx_cfg.num_queues; i++) {
105-
for (j = 0; j < NUM_GVE_RX_CNTS; j++) {
106-
snprintf(s, ETH_GSTRING_LEN,
107-
gve_gstrings_rx_stats[j], i);
108-
s += ETH_GSTRING_LEN;
109-
}
110-
}
100+
for (i = 0; i < ARRAY_SIZE(gve_gstrings_main_stats); i++)
101+
ethtool_puts(&s, gve_gstrings_main_stats[i]);
111102

112-
for (i = 0; i < num_tx_queues; i++) {
113-
for (j = 0; j < NUM_GVE_TX_CNTS; j++) {
114-
snprintf(s, ETH_GSTRING_LEN,
115-
gve_gstrings_tx_stats[j], i);
116-
s += ETH_GSTRING_LEN;
117-
}
118-
}
103+
for (i = 0; i < priv->rx_cfg.num_queues; i++)
104+
for (j = 0; j < NUM_GVE_RX_CNTS; j++)
105+
ethtool_sprintf(&s, gve_gstrings_rx_stats[j],
106+
i);
107+
108+
for (i = 0; i < num_tx_queues; i++)
109+
for (j = 0; j < NUM_GVE_TX_CNTS; j++)
110+
ethtool_sprintf(&s, gve_gstrings_tx_stats[j],
111+
i);
112+
113+
for (i = 0; i < ARRAY_SIZE(gve_gstrings_adminq_stats); i++)
114+
ethtool_puts(&s, gve_gstrings_adminq_stats[i]);
119115

120-
memcpy(s, *gve_gstrings_adminq_stats,
121-
sizeof(gve_gstrings_adminq_stats));
122-
s += sizeof(gve_gstrings_adminq_stats);
123116
break;
124117

125118
case ETH_SS_PRIV_FLAGS:
126-
memcpy(s, *gve_gstrings_priv_flags,
127-
sizeof(gve_gstrings_priv_flags));
128-
s += sizeof(gve_gstrings_priv_flags);
119+
for (i = 0; i < ARRAY_SIZE(gve_gstrings_priv_flags); i++)
120+
ethtool_puts(&s, gve_gstrings_priv_flags[i]);
129121
break;
130122

131123
default:

0 commit comments

Comments
 (0)