> -----Original Message-----
> From: Willem de Bruijn <[email protected]>
> Sent: Wednesday, September 2, 2026 8:17 PM
> To: [email protected]
> Cc: [email protected]; [email protected]; [email protected];
> [email protected]; [email protected]; [email protected]; Willem de
> Bruijn <[email protected]>; Nguyen, Anthony L
> <[email protected]>; Kitszel, Przemyslaw
> <[email protected]>; Hay, Joshua A
> <[email protected]>; [email protected]
> Subject: [PATCH net-next v8 3/6] idpf: support pacing offload
>
> From: Willem de Bruijn <[email protected]>
>
> If skb->tstamp is in the future, program this future delivery txtime
> in the transmit descriptor.
>
> TCP pacing offload is only offloaded if SK_PACING_FQ is negotiated and
> the FQ offload_horizon is configured. But device support for pacing
> offload must be more robust: it can also be reached through SO_TXTIME.
>
> Bounds check txtime. Only packets with timestamp between now and the
> horizon (pacing_offload_horizon) are offloaded.
>
> Negotiate the feature with the device using virtchnl. Support is
> conditional on
> - splitq mode, where tx and tx completion queues are separate, so
> completions can be returned out of order.
> - flow scheduling mode, where completions can arrive out of order.
> - PTP to ensure the NIC clock is synced to CLOCK_TAI.
>
> These features are negotiated per adapter, but expect all vports to
> uniformly request splitq (req_[rt]x_splitq) and flow scheduling
> (flow_sch_en) when available.
>
> Do not explicitly check all preconditions. Trust the firmware to only
> advertise EDT when all are met. In general, firmware response is
> trusted to be correct. If not, EDT would be the least of the worries.
> In particular, granularity is trusted to be a power of two. And
> time_horizon_ns is a range expressible given the chosen granularity.
>
> Packets beyond the horizon are sent immediately with the overflow bit
> set.
>
> On device reset, dev->pacing_offload_horizon, fq offload_horizon and
> granularity are not re-negotiated. It is safe to assume that firmware
> does not change these EDT capabilities across resets.
>
> Must not be called from netpoll due to ktime_get. But netpoll does not
> generate packets with EDT, so no explicit test is needed.
>
> Do not fail device initialization on EDT init error. Log an error, but
> continue without EDT, similar to PTP.
>
> Cc: Tony Nguyen <[email protected]>
> Cc: Przemek Kitszel <[email protected]>
> Cc: Joshua A Hay <[email protected]>
> Cc: [email protected]
> Signed-off-by: Willem de Bruijn <[email protected]>
>
> ---
>
> Changes
> v7 -> v8
> - remove unused variable np in idpf_tx_splitq_set_txtime
> v6 -> v7
> - rebase onto libie changes: adjust idpf_send_get_edt_caps_msg
> - only set horizon if splitq with flow scheduling
> - fail on illegal granularity 0, rather than use hardcoded default
> - zero edt_caps on negotation error, in case of call after reset
negotation -> negotiation
Reviewed-by: Aleksandr Loktionov <[email protected]>
> - cache ts_gran_pow2 in idpf_tx_queue to be in hot cache line
> - similar to FQ, add offload slack to avoid pacing < 400ns of now
> - remove now superfluous include netpoll.h
> - reverse xmas tree (1x)
> v5 -> v6
> - move EDT caps from virtchnl2_edt_caps_ilog2 to
> idpf_edt_caps_ilog2
> - do not fail device init if EDT init failed, same as PTP
> - replace netpoll branch with commit-msg comment
> - add commit-msg comment about device reset
> - add commit-msg about behavior beyond horizon
> - add commit-msg about trusting EDT capability response
> v4 -> v5
> - fix kdoc: idpf.h:738 struct member 'edt_caps' not described..
> v3 -> v4
> - add EDT virtchnl negotiation
> - move endianness fix to its own iwl-net patch
> - update commit-msg: check is against pacing_offload_horizon, not
> max_..
> - simplify assignment, avoid the le32 assignment in favor of u8
> inits
> - replace open coded constant with
> IDPF_TXD_FLOW_SCH_HORIZON_OVERFLOW_M
> - (minor) fix 24b timestamp comment: is 23b + overflow bit
> - (minor) remove unused parameter
> v2 -> v3
> - use READ_ONCE and read pacing_offload_horizon only once
> v1 -> v2
> - move special zero case up and return early
>
> Sashiko, ignore pre-existing issues.
>
> Sashiko, ignore that idpf_tx_splitq_set_txtime may have a benign race
> by calling ktime_mono_to_any twice to get TAI to REALTIME offset.
> ---
> drivers/net/ethernet/intel/idpf/idpf.h | 12 ++++
> drivers/net/ethernet/intel/idpf/idpf_lib.c | 6 ++
> drivers/net/ethernet/intel/idpf/idpf_txrx.c | 66
> ++++++++++++++++++-
> drivers/net/ethernet/intel/idpf/idpf_txrx.h | 8 ++-
> .../net/ethernet/intel/idpf/idpf_virtchnl.c | 60 ++++++++++++++++-
> 5 files changed, 149 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/idpf/idpf.h
> b/drivers/net/ethernet/intel/idpf/idpf.h
> index 470bc23c844c..f214023095ee 100644
> --- a/drivers/net/ethernet/intel/idpf/idpf.h
> +++ b/drivers/net/ethernet/intel/idpf/idpf.h
> @@ -604,6 +604,16 @@ struct idpf_vport_config {
> DECLARE_BITMAP(flags, IDPF_VPORT_CONFIG_FLAGS_NBITS); };
>
...
> pci_sriov_set_totalvfs(adapter->pdev,
> idpf_get_max_vfs(adapter));
> num_max_vports = idpf_get_max_vports(adapter);
> adapter->vports = kzalloc_objs(*adapter->vports,
> num_max_vports);
> --
> 2.55.0.970.g62bdec98f9-goog