Re: AF_XDP socket TX path interact with TC?

Toke Høiland-Jørgensen <[email protected]>
Newsgroups org.kernel.vger.xdp-newbies
Message-ID <[email protected]>
Jun Hu <[email protected]> writes:

> On Tue, Oct 26, 2021 at 4:08 AM Konrad Zemek <[email protected]> wrote:
>>
>> On Monday, October 25th, 2021 at 8:26 PM, Jun Hu <[email protected]> wrote:
>>
>> > On Mon, Oct 25, 2021 at 3:48 AM Toke Høiland-Jørgensen [email protected] wrote:
>> >
>> > > Jun Hu [email protected] writes:
>> > >
>> > > > Hi,
>> > > >
>> > > > I want to put a timestamp in the egress packets, and I want to use
>> > > >
>> > > > AF_XDP socket for both sending and receiving packets; since a XDP
>> > > >
>> > > > kernel program only work in ingress direction, I wonder if I could use
>> > > >
>> > > > a tc kernel program to change a packet sent out via an AF_XDP socket?
>> > > >
>> > > > I searched around, but couldn't find any direct answer...
>> > >
>> > > Nope, AF_XDP bypasses the stack completely, so TC won't see the packet
>> > >
>> > > on egress...
>> > >
>> > > -Toke
>> >
>> > Ok, thanks for the clarification, I guess I have to wait for the XDP
>> >
>> > egress support ...
>>
>> You can also directly modify the packet that you send out through an
>> AF_XDP socket, before putting it on the outgoing queue. Is there
>> anything specific that you would want to do in an egress-attached BPF
>> program that you would not be able to do in the userspace program
>> that manages your AF_XDP socket?
>>
>> Konrad
>
> Yes, that's what I am doing right now, however ideally I want to add a
> timestamp to the packet as close as it egress the NIC; since AF_XDP
> doesn't have access to hardware timestamp, that's why I was searching
> for an alternative solution.

Cc. Jesper, as I believe timestamps is one of his initial use cases for
xdp-hints (hardware metadata).

-Toke
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.