Commit 233eb4e7 authored by Shay Agroskin's avatar Shay Agroskin Committed by Jakub Kicinski
Browse files

ethtool: Add support for configuring tx_push_buf_len



This attribute, which is part of ethtool's ring param configuration
allows the user to specify the maximum number of the packet's payload
that can be written directly to the device.

Example usage:
    # ethtool -G [interface] tx-push-buf-len [number of bytes]

Co-developed-by: default avatarJakub Kicinski <kuba@kernel.org>
Signed-off-by: default avatarShay Agroskin <shayagr@amazon.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 3e4d5ba9
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -165,6 +165,12 @@ attribute-sets:
      -
        name: rx-push
        type: u8
      -
        name: tx-push-buf-len
        type: u32
      -
        name: tx-push-buf-len-max
        type: u32

  -
    name: mm-stat
@@ -311,6 +317,8 @@ operations:
            - cqe-size
            - tx-push
            - rx-push
            - tx-push-buf-len
            - tx-push-buf-len-max
      dump: *ring-get-op
    -
      name: rings-set
+31 −16
Original line number Diff line number Diff line
@@ -860,7 +860,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
@@ -875,7 +875,9 @@ Kernel response contents:
  ``ETHTOOL_A_RINGS_CQE_SIZE``              u32     Size of TX/RX CQE
  ``ETHTOOL_A_RINGS_TX_PUSH``               u8      flag of TX Push mode
  ``ETHTOOL_A_RINGS_RX_PUSH``               u8      flag of RX Push mode
  ====================================  ======  ===========================
  ``ETHTOOL_A_RINGS_TX_PUSH_BUF_LEN``       u32     size of TX push buffer
  ``ETHTOOL_A_RINGS_TX_PUSH_BUF_LEN_MAX``   u32     max size of TX push buffer
  =======================================   ======  ===========================

``ETHTOOL_A_RINGS_TCP_DATA_SPLIT`` indicates whether the device is usable with
page-flipping TCP zero-copy receive (``getsockopt(TCP_ZEROCOPY_RECEIVE)``).
@@ -891,6 +893,18 @@ through MMIO writes, thus reducing the latency. However, enabling this feature
may increase the CPU cost. Drivers may enforce additional per-packet
eligibility checks (e.g. on packet size).

``ETHTOOL_A_RINGS_TX_PUSH_BUF_LEN`` specifies the maximum number of bytes of a
transmitted packet a driver can push directly to the underlying device
('push' mode). Pushing some of the payload bytes to the device has the
advantages of reducing latency for small packets by avoiding DMA mapping (same
as ``ETHTOOL_A_RINGS_TX_PUSH`` parameter) as well as allowing the underlying
device to process packet headers ahead of fetching its payload.
This can help the device to make fast actions based on the packet's headers.
This is similar to the "tx-copybreak" parameter, which copies the packet to a
preallocated DMA memory area instead of mapping new memory. However,
tx-push-buff parameter copies the packet directly to the device to allow the
device to take faster actions on the packet.

RINGS_SET
=========

@@ -908,6 +922,7 @@ Request contents:
  ``ETHTOOL_A_RINGS_CQE_SIZE``          u32     Size of TX/RX CQE
  ``ETHTOOL_A_RINGS_TX_PUSH``           u8      flag of TX Push mode
  ``ETHTOOL_A_RINGS_RX_PUSH``           u8      flag of RX Push mode
  ``ETHTOOL_A_RINGS_TX_PUSH_BUF_LEN``   u32     size of TX push buffer
  ====================================  ======  ===========================

Kernel checks that requested ring sizes do not exceed limits reported by
+10 −4
Original line number Diff line number Diff line
@@ -75,6 +75,8 @@ enum {
 * @tx_push: The flag of tx push mode
 * @rx_push: The flag of rx push mode
 * @cqe_size: Size of TX/RX completion queue event
 * @tx_push_buf_len: Size of TX push buffer
 * @tx_push_buf_max_len: Maximum allowed size of TX push buffer
 */
struct kernel_ethtool_ringparam {
	u32	rx_buf_len;
@@ -82,6 +84,8 @@ struct kernel_ethtool_ringparam {
	u8	tx_push;
	u8	rx_push;
	u32	cqe_size;
	u32	tx_push_buf_len;
	u32	tx_push_buf_max_len;
};

/**
@@ -90,12 +94,14 @@ struct kernel_ethtool_ringparam {
 * @ETHTOOL_RING_USE_CQE_SIZE: capture for setting cqe_size
 * @ETHTOOL_RING_USE_TX_PUSH: capture for setting tx_push
 * @ETHTOOL_RING_USE_RX_PUSH: capture for setting rx_push
 * @ETHTOOL_RING_USE_TX_PUSH_BUF_LEN: capture for setting tx_push_buf_len
 */
enum ethtool_supported_ring_param {
	ETHTOOL_RING_USE_RX_BUF_LEN		= BIT(0),
	ETHTOOL_RING_USE_CQE_SIZE		= BIT(1),
	ETHTOOL_RING_USE_TX_PUSH		= BIT(2),
	ETHTOOL_RING_USE_RX_PUSH		= BIT(3),
	ETHTOOL_RING_USE_TX_PUSH_BUF_LEN	= BIT(4),
};

#define __ETH_RSS_HASH_BIT(bit)	((u32)1 << (bit))
+2 −0
Original line number Diff line number Diff line
@@ -357,6 +357,8 @@ enum {
	ETHTOOL_A_RINGS_CQE_SIZE,			/* u32 */
	ETHTOOL_A_RINGS_TX_PUSH,			/* u8 */
	ETHTOOL_A_RINGS_RX_PUSH,			/* u8 */
	ETHTOOL_A_RINGS_TX_PUSH_BUF_LEN,		/* u32 */
	ETHTOOL_A_RINGS_TX_PUSH_BUF_LEN_MAX,		/* u32 */

	/* add new constants above here */
	__ETHTOOL_A_RINGS_CNT,
+1 −1
Original line number Diff line number Diff line
@@ -413,7 +413,7 @@ extern const struct nla_policy ethnl_features_set_policy[ETHTOOL_A_FEATURES_WANT
extern const struct nla_policy ethnl_privflags_get_policy[ETHTOOL_A_PRIVFLAGS_HEADER + 1];
extern const struct nla_policy ethnl_privflags_set_policy[ETHTOOL_A_PRIVFLAGS_FLAGS + 1];
extern const struct nla_policy ethnl_rings_get_policy[ETHTOOL_A_RINGS_HEADER + 1];
extern const struct nla_policy ethnl_rings_set_policy[ETHTOOL_A_RINGS_RX_PUSH + 1];
extern const struct nla_policy ethnl_rings_set_policy[ETHTOOL_A_RINGS_TX_PUSH_BUF_LEN_MAX + 1];
extern const struct nla_policy ethnl_channels_get_policy[ETHTOOL_A_CHANNELS_HEADER + 1];
extern const struct nla_policy ethnl_channels_set_policy[ETHTOOL_A_CHANNELS_COMBINED_COUNT + 1];
extern const struct nla_policy ethnl_coalesce_get_policy[ETHTOOL_A_COALESCE_HEADER + 1];
Loading