From: Daniele Palmas <dnlplm@gmail.com>
To: David Miller <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Eric Dumazet <edumazet@google.com>,
Subash Abhinov Kasiviswanathan <quic_subashab@quicinc.com>,
Sean Tranchetti <quic_stranche@quicinc.com>,
Jonathan Corbet <corbet@lwn.net>,
Alexander Lobakin <alexandr.lobakin@intel.com>,
Gal Pressman <gal@nvidia.com>
Cc: "Bjørn Mork" <bjorn@mork.no>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
netdev@vger.kernel.org, "Daniele Palmas" <dnlplm@gmail.com>
Subject: [PATCH net-next v2 3/3] net: qualcomm: rmnet: add ethtool support for configuring tx aggregation
Date: Wed, 30 Nov 2022 13:46:16 +0100 [thread overview]
Message-ID: <20221130124616.1500643-4-dnlplm@gmail.com> (raw)
In-Reply-To: <20221130124616.1500643-1-dnlplm@gmail.com>
Add support for ETHTOOL_COALESCE_TX_AGGR for configuring the tx
aggregation settings.
Signed-off-by: Daniele Palmas <dnlplm@gmail.com>
---
v2
- Fixed undefined reference to `__aeabi_uldivmod' issue with arm, reported-by: kernel test robot
---
.../net/ethernet/qualcomm/rmnet/rmnet_vnd.c | 45 +++++++++++++++++++
1 file changed, 45 insertions(+)
diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c
index 6d8b8fdb9d03..046b5f7d8e7c 100644
--- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c
+++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c
@@ -215,7 +215,52 @@ static void rmnet_get_ethtool_stats(struct net_device *dev,
memcpy(data, st, ARRAY_SIZE(rmnet_gstrings_stats) * sizeof(u64));
}
+static int rmnet_get_coalesce(struct net_device *dev,
+ struct ethtool_coalesce *coal,
+ struct kernel_ethtool_coalesce *kernel_coal,
+ struct netlink_ext_ack *extack)
+{
+ struct rmnet_priv *priv = netdev_priv(dev);
+ struct rmnet_port *port;
+
+ port = rmnet_get_port_rtnl(priv->real_dev);
+
+ memset(kernel_coal, 0, sizeof(*kernel_coal));
+ kernel_coal->tx_aggr_max_bytes = port->egress_agg_params.bytes;
+ kernel_coal->tx_aggr_max_frames = port->egress_agg_params.count;
+ kernel_coal->tx_aggr_time_usecs = div_u64(port->egress_agg_params.time_nsec,
+ NSEC_PER_USEC);
+
+ return 0;
+}
+
+static int rmnet_set_coalesce(struct net_device *dev,
+ struct ethtool_coalesce *coal,
+ struct kernel_ethtool_coalesce *kernel_coal,
+ struct netlink_ext_ack *extack)
+{
+ struct rmnet_priv *priv = netdev_priv(dev);
+ struct rmnet_port *port;
+
+ port = rmnet_get_port_rtnl(priv->real_dev);
+
+ if (kernel_coal->tx_aggr_max_frames < 1 || kernel_coal->tx_aggr_max_frames > 64)
+ return -EINVAL;
+
+ if (kernel_coal->tx_aggr_max_bytes > 32768)
+ return -EINVAL;
+
+ rmnet_map_update_ul_agg_config(port, kernel_coal->tx_aggr_max_bytes,
+ kernel_coal->tx_aggr_max_frames,
+ kernel_coal->tx_aggr_time_usecs);
+
+ return 0;
+}
+
static const struct ethtool_ops rmnet_ethtool_ops = {
+ .supported_coalesce_params = ETHTOOL_COALESCE_TX_AGGR,
+ .get_coalesce = rmnet_get_coalesce,
+ .set_coalesce = rmnet_set_coalesce,
.get_ethtool_stats = rmnet_get_ethtool_stats,
.get_strings = rmnet_get_strings,
.get_sset_count = rmnet_get_sset_count,
--
2.37.1
next prev parent reply other threads:[~2022-11-30 12:53 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-30 12:46 [PATCH net-next v2 0/3] add tx packets aggregation to ethtool and rmnet Daniele Palmas
2022-11-30 12:46 ` [PATCH net-next v2 1/3] ethtool: add tx aggregation parameters Daniele Palmas
2022-12-02 0:21 ` Jakub Kicinski
2022-12-02 11:42 ` Daniele Palmas
2022-11-30 12:46 ` [PATCH net-next v2 2/3] net: qualcomm: rmnet: add tx packets aggregation Daniele Palmas
2022-11-30 16:35 ` kernel test robot
2022-12-01 2:01 ` kernel test robot
2022-11-30 12:46 ` Daniele Palmas [this message]
2022-11-30 15:04 ` [PATCH net-next v2 0/3] add tx packets aggregation to ethtool and rmnet Dave Taht
2022-12-01 10:48 ` Daniele Palmas
2022-12-01 15:22 ` Dave Taht
2022-12-02 16:56 ` Daniele Palmas
2022-12-02 17:27 ` Dave Taht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221130124616.1500643-4-dnlplm@gmail.com \
--to=dnlplm@gmail.com \
--cc=alexandr.lobakin@intel.com \
--cc=bjorn@mork.no \
--cc=corbet@lwn.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=gal@nvidia.com \
--cc=gregkh@linuxfoundation.org \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=quic_stranche@quicinc.com \
--cc=quic_subashab@quicinc.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.