diff mbox series

[net-next,3/3] net: qualcomm: rmnet: add ethtool support for configuring tx aggregation

Message ID 20221109180249.4721-4-dnlplm@gmail.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series add tx packets aggregation to ethtool and rmnet | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Series has a cover letter
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit fail Errors and warnings before: 2 this patch: 4
netdev/cc_maintainers success CCed 7 of 7 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch warning WARNING: line length of 89 exceeds 80 columns WARNING: line length of 96 exceeds 80 columns
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Daniele Palmas Nov. 9, 2022, 6:02 p.m. UTC
Add support for ETHTOOL_COALESCE_TX_AGGR for configuring the tx
aggregation settings.

Signed-off-by: Daniele Palmas <dnlplm@gmail.com>
---
 .../net/ethernet/qualcomm/rmnet/rmnet_vnd.c   | 44 +++++++++++++++++++
 1 file changed, 44 insertions(+)

Comments

kernel test robot Nov. 11, 2022, 6:46 a.m. UTC | #1
Hi Daniele,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on net-next/master]

url:    https://github.com/intel-lab-lkp/linux/commits/Daniele-Palmas/add-tx-packets-aggregation-to-ethtool-and-rmnet/20221110-021152
patch link:    https://lore.kernel.org/r/20221109180249.4721-4-dnlplm%40gmail.com
patch subject: [PATCH net-next 3/3] net: qualcomm: rmnet: add ethtool support for configuring tx aggregation
config: arm-randconfig-c033-20221110
compiler: arm-linux-gnueabi-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/1d616d4cfe80553017ff177ae01d4bbfcaf48213
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Daniele-Palmas/add-tx-packets-aggregation-to-ethtool-and-rmnet/20221110-021152
        git checkout 1d616d4cfe80553017ff177ae01d4bbfcaf48213
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   arm-linux-gnueabi-ld: drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.o: in function `rmnet_get_coalesce':
>> drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c:226: undefined reference to `__aeabi_uldivmod'


vim +226 drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c

   212	
   213	static int rmnet_get_coalesce(struct net_device *dev,
   214				      struct ethtool_coalesce *coal,
   215				      struct kernel_ethtool_coalesce *kernel_coal,
   216				      struct netlink_ext_ack *extack)
   217	{
   218		struct rmnet_priv *priv = netdev_priv(dev);
   219		struct rmnet_port *port;
   220	
   221		port = rmnet_get_port_rtnl(priv->real_dev);
   222	
   223		memset(kernel_coal, 0, sizeof(*kernel_coal));
   224		kernel_coal->tx_max_aggr_size = port->egress_agg_params.agg_size;
   225		kernel_coal->tx_max_aggr_frames = port->egress_agg_params.agg_count;
 > 226		kernel_coal->tx_usecs_aggr_time = port->egress_agg_params.agg_time_nsec / NSEC_PER_USEC;
   227	
   228		return 0;
   229	}
   230
diff mbox series

Patch

diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c
index 1b2119b1d48a..630cf6737f64 100644
--- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c
+++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c
@@ -210,7 +210,51 @@  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_max_aggr_size = port->egress_agg_params.agg_size;
+	kernel_coal->tx_max_aggr_frames = port->egress_agg_params.agg_count;
+	kernel_coal->tx_usecs_aggr_time = port->egress_agg_params.agg_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_max_aggr_frames <= 1 || kernel_coal->tx_max_aggr_frames > 64)
+		return -EINVAL;
+
+	if (kernel_coal->tx_max_aggr_size > 32768)
+		return -EINVAL;
+
+	rmnet_map_update_ul_agg_config(port, kernel_coal->tx_max_aggr_size,
+				       kernel_coal->tx_max_aggr_frames,
+				       kernel_coal->tx_usecs_aggr_time);
+
+	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,