Lines Matching +full:tx +full:- +full:hw +full:- +full:gso +full:- +full:packets

1 .. SPDX-License-Identifier: GPL-2.0
43 -------------------------------------------------------------
47 the network stack, the feature has to be enabled for all packets. The
59 -------------------------------------------------------------------
72 ----------------------------------------------------------------------
93 created packets, not to packets already in the stack. As a result, it
94 is possible to selectively request timestamps for a subset of packets
110 Request tx timestamps generated by the network adapter. This flag
114 Request tx timestamps when data leaves the kernel. These timestamps
121 Request tx timestamps prior to entering the packet scheduler. Kernel
135 Request tx timestamps when all data in the send buffer has been
138 over-report measurement, because the timestamp is generated when all
150 are only reported for packets that also have the relevant timestamp
172 have multiple concurrent timestamping requests outstanding. Packets
181 is derived from a per-socket u32 counter (that wraps). For datagram
189 change the identifiers of existing packets in the system.
204 cmsg->cmsg_level = SOL_SOCKET;
205 cmsg->cmsg_type = SCM_TS_OPT_ID;
206 cmsg->cmsg_len = CMSG_LEN(sizeof(__u32));
222 a timestamp with counter N-1. SOF_TIMESTAMPING_OPT_ID_TCP
242 Support recv() cmsg for all timestamped packets. Control messages
243 are already supported unconditionally on all packets with receive
244 timestamps and on IPv6 packets with transmit timestamp. This option
245 extends them to IPv4 packets with transmit timestamp. One use case
246 is to correlate packets with their egress device, by enabling socket
270 packets with hardware timestamps. The message contains struct
272 received the packet and its length at layer 2. A valid (non-zero)
278 Request both hardware and software timestamps for outgoing packets
290 timestamps, packets for all socket will receive timestamped packets.
297 ignore the unexpected non-zero value. But it makes behavior subtly
324 cmsg->cmsg_level = SOL_SOCKET;
325 cmsg->cmsg_type = SO_TIMESTAMPING;
326 cmsg->cmsg_len = CMSG_LEN(sizeof(__u32));
344 -------------------------
351 many packets the data has been converted into.
354 correlating a timestamp with data is non-trivial. A range of bytes
379 skbuff as a result of Nagle, cork, autocork, segmentation and GSO. The
383 relevant sequence number in skb_shinfo(skb)->tskey. Because an skbuff
392 autocork. After linux-4.7, a better way to prevent coalescing is
414 ----------------------------
437 feature. At least one field is non-zero at any time. Most timestamps
442 a HW PTP clock source, to allow time conversion in userspace and
444 as linuxptp. For the PTP clock API, see Documentation/driver-api/ptp.rst.
481 is the first if ts[2] is non-zero, the second otherwise, in which
509 Reading from the error queue is always a non-blocking operation. To
545 the requested fine-grained filtering for incoming packets is not
547 of packets.
558 requested packets cannot be time stamped, then nothing should be
572 /* possible values for hwtstamp_config->tx_type */
582 * enables hardware time stamping for outgoing packets;
590 /* possible values for hwtstamp_config->rx_filter */
598 /* return value: time stamp all packets requested plus some others */
610 --------------------------------------------------------
617 Time stamps for received packets must be stored in the skb. To get a pointer
628 Time stamps for outgoing packets are to be generated as follows:
630 - In hard_start_xmit(), check if (skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP)
631 is set no-zero. If yes, then the driver is expected to do hardware time
633 - If this is possible for the skb and requested, then declare
635 SKBTX_IN_PROGRESS in skb_shinfo(skb)->tx_flags , e.g. with::
637 skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS;
643 - Driver should call skb_tx_timestamp() as close to passing sk_buff to hardware
646 - As soon as the driver has sent the packet and/or obtained a
658 ----------------------------------------------------------
675 interface (redirecting to the host port on TX, and intercepting frames on RX).
699 - ``.port_txtstamp()``: a hook called prior to the transmission of
700 packets with a hardware TX timestamping request from user space.
701 This is required for two-step timestamping, since the hardware
704 packet so that it can re-enqueue the packet back into the socket's
707 in skb->cb and enqueue a tx skb queue. Typically, a switch will have a
708 PTP TX timestamp register (or sometimes a FIFO) where the timestamp
710 key-value pairs of PTP sequence ID/message type/domain number and the
712 packets in a queue waiting for timestamping and the actual timestamps,
718 One-step TX timestamping do not require packet cloning, since there is
719 no follow-up message required by the PTP protocol (because the
720 TX timestamp is embedded into the packet by the MAC), and therefore
721 user space does not expect the packet annotated with the TX timestamp
722 to be re-enqueued into its socket's error queue.
724 - ``.port_rxtstamp()``: On RX, the BPF classifier is run by DSA to
725 identify PTP event messages (any other packets, including PTP general
729 timestamps might either be available in-band (through metadata in the
730 DSA header, or attached in other ways to the packet), or out-of-band
741 switches do. However, PHYs may be able to detect and timestamp PTP packets, for
746 mii_timestamper`` and add a pointer to it in ``phydev->mii_ts``. The presence
754 - Checking, in ``.ndo_eth_ioctl``, whether ``phy_has_hwtstamp(netdev->phydev)``
758 - On RX, special intervention may or may not be needed, depending on the
761 ``skb_defer_rx_timestamp(skb)`` is necessary or not - and if it is, don't
763 enabled, and ``skb->dev->phydev->mii_ts`` exists, its ``.rxtstamp()`` hook
774 - On TX, again, special intervention might or might not be needed. The
775 function that calls the ``mii_ts->txtstamp()`` hook is named
796 Stacked PHCs, especially DSA (but not only) - since that doesn't require any
798 all possible code paths - is that they uncover bugs which were impossible to
802 skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS;
804 Any TX timestamping logic, be it a plain MAC driver, a DSA switch driver, a PHY
809 For example, a typical driver design for TX timestamping might be to split the
812 1. "TX": checks whether PTP timestamping has been previously enabled through
813 the ``.ndo_eth_ioctl`` ("``priv->hwtstamp_tx_enabled == true``") and the
814 current skb requires a TX timestamp ("``skb_shinfo(skb)->tx_flags &
816 "``skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS``" flag. Note: as
821 2. "TX confirmation": Transmission has finished. The driver checks whether it
822 is necessary to collect any TX timestamp for it. Here is where the typical
824 "``skb_shinfo(skb)->tx_flags & SKBTX_IN_PROGRESS``" was set. With a stacked
826 in the TX data path who could have enabled SKBTX_IN_PROGRESS in the first
830 check in their "TX confirmation" portion, not only for
831 "``skb_shinfo(skb)->tx_flags & SKBTX_IN_PROGRESS``", but also for
832 "``priv->hwtstamp_tx_enabled == true``". Because the rest of the system ensures
834 this enhanced check will avoid delivering a duplicated TX timestamp to user