[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230305154942.1770925-1-alvaro.karsz@solid-run.com>
Date: Sun, 5 Mar 2023 17:49:42 +0200
From: Alvaro Karsz <alvaro.karsz@...id-run.com>
To: netdev@...r.kernel.org, virtualization@...ts.linux-foundation.org
Cc: Alvaro Karsz <alvaro.karsz@...id-run.com>,
"Michael S. Tsirkin" <mst@...hat.com>,
Jason Wang <jasowang@...hat.com>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>
Subject: [PATCH net] virtio-net: unify notifications coalescing structs
Unify virtio_net_ctrl_coal_tx and virtio_net_ctrl_coal_rx structs into a
single struct, virtio_net_ctrl_coal, as they are identical.
This patch follows the VirtIO spec patch:
https://lists.oasis-open.org/archives/virtio-comment/202302/msg00431.html
Signed-off-by: Alvaro Karsz <alvaro.karsz@...id-run.com>
---
drivers/net/virtio_net.c | 15 +++++++--------
include/uapi/linux/virtio_net.h | 24 +++++++-----------------
2 files changed, 14 insertions(+), 25 deletions(-)
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index fb5e68ed3ec..86b6b3e0257 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -2883,12 +2883,11 @@ static int virtnet_send_notf_coal_cmds(struct virtnet_info *vi,
struct ethtool_coalesce *ec)
{
struct scatterlist sgs_tx, sgs_rx;
- struct virtio_net_ctrl_coal_tx coal_tx;
- struct virtio_net_ctrl_coal_rx coal_rx;
+ struct virtio_net_ctrl_coal coal_params;
- coal_tx.tx_usecs = cpu_to_le32(ec->tx_coalesce_usecs);
- coal_tx.tx_max_packets = cpu_to_le32(ec->tx_max_coalesced_frames);
- sg_init_one(&sgs_tx, &coal_tx, sizeof(coal_tx));
+ coal_params.max_usecs = cpu_to_le32(ec->tx_coalesce_usecs);
+ coal_params.max_packets = cpu_to_le32(ec->tx_max_coalesced_frames);
+ sg_init_one(&sgs_tx, &coal_params, sizeof(coal_params));
if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_NOTF_COAL,
VIRTIO_NET_CTRL_NOTF_COAL_TX_SET,
@@ -2899,9 +2898,9 @@ static int virtnet_send_notf_coal_cmds(struct virtnet_info *vi,
vi->tx_usecs = ec->tx_coalesce_usecs;
vi->tx_max_packets = ec->tx_max_coalesced_frames;
- coal_rx.rx_usecs = cpu_to_le32(ec->rx_coalesce_usecs);
- coal_rx.rx_max_packets = cpu_to_le32(ec->rx_max_coalesced_frames);
- sg_init_one(&sgs_rx, &coal_rx, sizeof(coal_rx));
+ coal_params.max_usecs = cpu_to_le32(ec->rx_coalesce_usecs);
+ coal_params.max_packets = cpu_to_le32(ec->rx_max_coalesced_frames);
+ sg_init_one(&sgs_rx, &coal_params, sizeof(coal_params));
if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_NOTF_COAL,
VIRTIO_NET_CTRL_NOTF_COAL_RX_SET,
diff --git a/include/uapi/linux/virtio_net.h b/include/uapi/linux/virtio_net.h
index b4062bed186..ce044260e02 100644
--- a/include/uapi/linux/virtio_net.h
+++ b/include/uapi/linux/virtio_net.h
@@ -367,28 +367,18 @@ struct virtio_net_hash_config {
* Available with the VIRTIO_NET_F_NOTF_COAL feature bit.
*/
#define VIRTIO_NET_CTRL_NOTF_COAL 6
-/*
- * Set the tx-usecs/tx-max-packets parameters.
- */
-struct virtio_net_ctrl_coal_tx {
- /* Maximum number of packets to send before a TX notification */
- __le32 tx_max_packets;
- /* Maximum number of usecs to delay a TX notification */
- __le32 tx_usecs;
-};
-
-#define VIRTIO_NET_CTRL_NOTF_COAL_TX_SET 0
/*
- * Set the rx-usecs/rx-max-packets parameters.
+ * Set the max_usecs/max_packets coalescing parameters for all transmit/receive virtqueues.
*/
-struct virtio_net_ctrl_coal_rx {
- /* Maximum number of packets to receive before a RX notification */
- __le32 rx_max_packets;
- /* Maximum number of usecs to delay a RX notification */
- __le32 rx_usecs;
+struct virtio_net_ctrl_coal {
+ /* Maximum number of packets to send/receive before a TX/RX notification */
+ __le32 max_packets;
+ /* Maximum number of microseconds to delay a TX/RX notification */
+ __le32 max_usecs;
};
+#define VIRTIO_NET_CTRL_NOTF_COAL_TX_SET 0
#define VIRTIO_NET_CTRL_NOTF_COAL_RX_SET 1
#endif /* _UAPI_LINUX_VIRTIO_NET_H */
--
2.34.1
Powered by blists - more mailing lists