6

I want to capture packets using tcpdump and get as precise timestamps as possible. The latest version of tcpdump has the -j adapter command-line option, which can be used for this.

I tested the option inside a virtual machine (which definitely has no hardware timestamps ;-)), but there was no error message.

Online research did not yield any keyword or phrase that can be used to check whether some card supports it or not. Typical NIC data sheets don't have anything in them which indicates timestamp precision or general support for such a thing.

How can I check whether my actual NIC supports hardware timestamps?

  • @Dameas you have answered your question already with regards to how to check if your NIC supports hardware timestamp offloading. With regards to why you get no error message, if hardware timestamping isn't available when requested the Kernel will fall back to software based timestamping. So you need to write a program to check for the capabilities for your self (or find one already written, as per your answer :) ). – jwbensley Mar 24 '18 at 19:28
6

I guess you could run the command below, it will depict every capability your software and hardware networking has,

sudo ethtool -T <interface> interface information such as names are accessible via ifconfig

For example it is my network system output:

Time stamping parameters for eth0:
Capabilities:
    hardware-transmit     (SOF_TIMESTAMPING_TX_HARDWARE)
    software-transmit     (SOF_TIMESTAMPING_TX_SOFTWARE)
    hardware-receive      (SOF_TIMESTAMPING_RX_HARDWARE)
    software-receive      (SOF_TIMESTAMPING_RX_SOFTWARE)
    software-system-clock (SOF_TIMESTAMPING_SOFTWARE)
    hardware-raw-clock    (SOF_TIMESTAMPING_RAW_HARDWARE)
PTP Hardware Clock: 0
Hardware Transmit Timestamp Modes:
    off                   (HWTSTAMP_TX_OFF)
    on                    (HWTSTAMP_TX_ON)
Hardware Receive Filter Modes:
    none                  (HWTSTAMP_FILTER_NONE)
    all                   (HWTSTAMP_FILTER_ALL)
    ptpv1-l4-sync         (HWTSTAMP_FILTER_PTP_V1_L4_SYNC)
    ptpv1-l4-delay-req    (HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ)
    ptpv2-l4-sync         (HWTSTAMP_FILTER_PTP_V2_L4_SYNC)
    ptpv2-l4-delay-req    (HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ)
    ptpv2-l2-sync         (HWTSTAMP_FILTER_PTP_V2_L2_SYNC)
    ptpv2-l2-delay-req    (HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ)
    ptpv2-event           (HWTSTAMP_FILTER_PTP_V2_EVENT)
    ptpv2-sync            (HWTSTAMP_FILTER_PTP_V2_SYNC)
    ptpv2-delay-req       (HWTSTAMP_FILTER_PTP_V2_DELAY_REQ)

There is also a documentation in kernel source in case you want to see more about the flags! Here

I hope it helps.

| improve this answer | |
1

I found this simple C program that can be used to capture using different timestamping options for Linux sockets:

https://www.kernel.org/doc/Documentation/networking/timestamping/timestamping.c

Invoking it with interface SOF_TIMESTAMPING_RX_HARDWARE gives a output like SIOCSHWTSTAMP: Operation not supported.

Unfortunately, I apparently don't have hardware available that is capable of hardware timestamps so I don't know for sure whether the test also succeeds for NICs that are hardstamp-capable.

| improve this answer | |
  • You should accept your answer so that it doesn't keep popping up forever, looking for an answer. – Ron Maupin Oct 15 '15 at 14:05

Not the answer you're looking for? Browse other questions tagged or ask your own question.