Helper function bpf_skb_set_tstamp
Definition
Copyright (c) 2015 The Libbpf Authors. All rights reserved.
Change the __sk_buff->tstamp_type to tstamp_type and set tstamp to the __sk_buff->tstamp together.
If there is no need to change the __sk_buff->tstamp_type, the tstamp value can be directly written to __sk_buff->tstamp instead.
BPF_SKB_TSTAMP_DELIVERY_MONO is the only tstamp that will be kept during bpf_redirect__(). A non zero tstamp must be used with the BPF_SKB_TSTAMP_DELIVERY_MONO tstamp_type.
A BPF_SKB_TSTAMP_UNSPEC tstamp_type can only be used with a zero tstamp.
Only IPv4 and IPv6 skb->protocol are supported.
This function is most useful when it needs to set a mono delivery time to sk_buff->tstamp and then bpf_redirect() to the egress of an iface. For example, changing the (rcv) timestamp in sk_buff->tstamp at ingress to a mono delivery time and then bpf_redirect() to sch_fq@phy-dev.
Returns
0 on success. -EINVAL for invalid input -EOPNOTSUPP for unsupported protocol
static long (* const bpf_skb_set_tstamp)(struct __sk_buff *skb, __u64 tstamp, __u32 tstamp_type) = (void *) 192;
Usage
Docs could be improved
This part of the docs is incomplete, contributions are very welcome
Program types
This helper call can be used in the following program types:
Example
Docs could be improved
This part of the docs is incomplete, contributions are very welcome