Commit 8e2a2f90 authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'ethtool-copybreak'



Guangbin Huang says:

====================
ethtool: add support to set/get tx copybreak buf size and rx buf len

This series add support to set/get tx copybreak buf size and rx buf len via
ethtool and hns3 driver implements them.

Tx copybreak buf size is used for tx copybreak feature which for small size
packet or frag. Use ethtool --get-tunable command to get it, and ethtool
--set-tunable command to set it, examples are as follow:

1. set tx spare buf size to 102400:
$ ethtool --set-tunable eth1 tx-buf-size 102400

2. get tx spare buf size:
$ ethtool --get-tunable eth1 tx-buf-size
tx-buf-size: 102400

Rx buf len is buffer length of each rx BD. Use ethtool -g command to get
it, and ethtool -G command to set it, examples are as follow:

1. set rx buf len to 4096
$ ethtool -G eth1 rx-buf-len 4096

2. get rx buf len
$ ethtool -g eth1
...
RX Buf Len:     4096

Change log:
V5 -> V6
1.Fix compile error for divers/s390.

V4 -> V5
1.Change struct ethtool_ringparam_ext to kernel_ethtool_ringparam.
2.change "__u32 rx_buf_len" to "u32 rx_buf_len".

V3 -> V4
1.Fix a few allmodconfig compile warning.
2.Add more '=' synbol to ethtool-netlink.rst to refine format.
3.Move definement of struct ethtool_ringparam_ext to include/linux/ethtool.h.
4.Move related modify of rings_fill_reply() from patch 4/6 to patch 3/6.

V2 -> V3
1.Remove documentation for tx copybreak buf size, there is description for
it in userspace ethtool.
2.Move extending parameters for get/set_ringparam function from patch3/6
to patch 4/6.

V1 -> V2
1.Add documentation for rx buf len and tx copybreak buf size.
2.Extend structure ringparam_ext for extenal ring params.
3.Change type of ETHTOOL_A_RINGS_RX_BUF_LEN from NLA_U32 to
  NLA_POLICY_MIN(NLA_U32, 1).
4.Add supported_ring_params in ethtool_ops to indicate if support external
  params.
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 89f97118 e175eb5f
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -849,7 +849,7 @@ Request contents:

Kernel response contents:

  ====================================  ======  ==========================
  ====================================  ======  ===========================
  ``ETHTOOL_A_RINGS_HEADER``            nested  reply header
  ``ETHTOOL_A_RINGS_RX_MAX``            u32     max size of RX ring
  ``ETHTOOL_A_RINGS_RX_MINI_MAX``       u32     max size of RX mini ring
@@ -859,7 +859,8 @@ Kernel response contents:
  ``ETHTOOL_A_RINGS_RX_MINI``           u32     size of RX mini ring
  ``ETHTOOL_A_RINGS_RX_JUMBO``          u32     size of RX jumbo ring
  ``ETHTOOL_A_RINGS_TX``                u32     size of TX ring
  ====================================  ======  ==========================
  ``ETHTOOL_A_RINGS_RX_BUF_LEN``        u32     size of buffers on the ring
  ====================================  ======  ===========================


RINGS_SET
@@ -869,13 +870,14 @@ Sets ring sizes like ``ETHTOOL_SRINGPARAM`` ioctl request.

Request contents:

  ====================================  ======  ==========================
  ====================================  ======  ===========================
  ``ETHTOOL_A_RINGS_HEADER``            nested  reply header
  ``ETHTOOL_A_RINGS_RX``                u32     size of RX ring
  ``ETHTOOL_A_RINGS_RX_MINI``           u32     size of RX mini ring
  ``ETHTOOL_A_RINGS_RX_JUMBO``          u32     size of RX jumbo ring
  ``ETHTOOL_A_RINGS_TX``                u32     size of TX ring
  ====================================  ======  ==========================
  ``ETHTOOL_A_RINGS_RX_BUF_LEN``        u32     size of buffers on the ring
  ====================================  ======  ===========================

Kernel checks that requested ring sizes do not exceed limits reported by
driver. Driver may impose additional constraints and may not suspport all
+3 −1
Original line number Diff line number Diff line
@@ -1441,7 +1441,9 @@ static int vector_net_load_bpf_flash(struct net_device *dev,
}

static void vector_get_ringparam(struct net_device *netdev,
				struct ethtool_ringparam *ring)
				 struct ethtool_ringparam *ring,
				 struct kernel_ethtool_ringparam *kernel_ring,
				 struct netlink_ext_ack *extack)
{
	struct vector_private *vp = netdev_priv(netdev);

+3 −1
Original line number Diff line number Diff line
@@ -20,7 +20,9 @@ static void c_can_get_drvinfo(struct net_device *netdev,
}

static void c_can_get_ringparam(struct net_device *netdev,
				struct ethtool_ringparam *ring)
				struct ethtool_ringparam *ring,
				struct kernel_ethtool_ringparam *kernel_ring,
				struct netlink_ext_ack *extack)
{
	struct c_can_priv *priv = netdev_priv(netdev);

+3 −1
Original line number Diff line number Diff line
@@ -1138,7 +1138,9 @@ typhoon_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
}

static void
typhoon_get_ringparam(struct net_device *dev, struct ethtool_ringparam *ering)
typhoon_get_ringparam(struct net_device *dev, struct ethtool_ringparam *ering,
		      struct kernel_ethtool_ringparam *kernel_ering,
		      struct netlink_ext_ack *extack)
{
	ering->rx_max_pending = RXENT_ENTRIES;
	ering->tx_max_pending = TXLO_ENTRIES - 1;
+6 −2
Original line number Diff line number Diff line
@@ -465,7 +465,9 @@ static void ena_get_drvinfo(struct net_device *dev,
}

static void ena_get_ringparam(struct net_device *netdev,
			      struct ethtool_ringparam *ring)
			      struct ethtool_ringparam *ring,
			      struct kernel_ethtool_ringparam *kernel_ring,
			      struct netlink_ext_ack *extack)
{
	struct ena_adapter *adapter = netdev_priv(netdev);

@@ -476,7 +478,9 @@ static void ena_get_ringparam(struct net_device *netdev,
}

static int ena_set_ringparam(struct net_device *netdev,
			     struct ethtool_ringparam *ring)
			     struct ethtool_ringparam *ring,
			     struct kernel_ethtool_ringparam *kernel_ring,
			     struct netlink_ext_ack *extack)
{
	struct ena_adapter *adapter = netdev_priv(netdev);
	u32 new_tx_size, new_rx_size;
Loading