Re: [PATCH net-next 1/3] net: ethtool: extend ringparam set/get APIs for tx_push

From: Jakub Kicinski
Date: Fri Apr 08 2022 - 17:55:57 EST


On Fri, 8 Apr 2022 15:12:43 +0800 Guangbin Huang wrote:
> From: Jie Wang <wangjie125@xxxxxxxxxx>
>
> Currently tx push is a standard driver feature which controls use of a fast
> path descriptor push. So this patch extends the ringparam APIs and data
> structures to support set/get tx push by ethtool -G/g.
>
> Signed-off-by: Jie Wang <wangjie125@xxxxxxxxxx>
> Signed-off-by: Guangbin Huang <huangguangbin2@xxxxxxxxxx>

> +``ETHTOOL_A_RINGS_TX_PUSH`` flag is used to choose the ordinary path or the fast
> +path to send packets. In ordinary path, driver fills BDs to DDR memory and
> +notifies NIC hardware. In fast path, driver pushes BDs to the device memory
> +directly and thus reducing the sending latencies. Setting tx push attribute "on"
> +will enable tx push mode and send packets in fast path if packet size matches.
> +For those not supported hardwares, this attributes is "off" by default settings.

Since you need to respin to fix the kdoc warning - could you also add
a mention that enabling this feature may increase CPU cost? Unless it's
not the case for your implementation, I thought it usually is..

> RINGS_SET
> =========
> @@ -887,6 +894,7 @@ Request contents:
> ``ETHTOOL_A_RINGS_TX`` u32 size of TX ring
> ``ETHTOOL_A_RINGS_RX_BUF_LEN`` u32 size of buffers on the ring
> ``ETHTOOL_A_RINGS_CQE_SIZE`` u32 Size of TX/RX CQE
> + ``ETHTOOL_A_RINGS_TX_PUSH`` u8 flag of TX Push mode
> ==================================== ====== ===========================
>
> Kernel checks that requested ring sizes do not exceed limits reported by
> diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
> index 4af58459a1e7..ede4f9154cd2 100644
> --- a/include/linux/ethtool.h
> +++ b/include/linux/ethtool.h
> @@ -71,11 +71,13 @@ enum {
> * struct kernel_ethtool_ringparam - RX/TX ring configuration
> * @rx_buf_len: Current length of buffers on the rx ring.
> * @tcp_data_split: Scatter packet headers and data to separate buffers
> + * @tx_push: The flag of tx push mode
> * @cqe_size: Size of TX/RX completion queue event
> */
> struct kernel_ethtool_ringparam {
> u32 rx_buf_len;
> u8 tcp_data_split;
> + u8 tx_push;
> u32 cqe_size;
> };
>
> @@ -87,6 +89,7 @@ struct kernel_ethtool_ringparam {
> 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),

include/linux/ethtool.h:94: warning: Enum value 'ETHTOOL_RING_USE_TX_PUSH' not described in enum 'ethtool_supported_ring_param'