* question about BPF sk_skb_stream_verdict redirect and poll/epoll events
@ 2023-09-22 17:32 Farbod Shahinfar
2023-09-23 9:36 ` Ferenc Fejes
0 siblings, 1 reply; 3+ messages in thread
From: Farbod Shahinfar @ 2023-09-22 17:32 UTC (permalink / raw)
To: john.fastabend, netdev
Hello,
I am doing a simple experiment in which I send a message to a TCP server
and the server echoes the message. I am attaching a BPF sk_skb
stream_verdict program to the server socket to redirect the message back
to the client (redirects the SKB on the same socket but to the TX
queue). In my test, I noticed that the user-space server, which is using
the poll system call, is woken up, and when it reads the socket,
receives zero as the number of bytes read.
I first want to ask if this is the intended behavior.
In case this is the intended behavior, my second question is, what
should I do to prevent the user program from waking up? I hope by not
waking up the user program I could better use the available resources.
Sincerely,
Farbod
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: question about BPF sk_skb_stream_verdict redirect and poll/epoll events
2023-09-22 17:32 question about BPF sk_skb_stream_verdict redirect and poll/epoll events Farbod Shahinfar
@ 2023-09-23 9:36 ` Ferenc Fejes
2023-09-25 18:24 ` John Fastabend
0 siblings, 1 reply; 3+ messages in thread
From: Ferenc Fejes @ 2023-09-23 9:36 UTC (permalink / raw)
To: Farbod Shahinfar, john.fastabend, netdev
Hi!
On Fri, 2023-09-22 at 19:32 +0200, Farbod Shahinfar wrote:
> Hello,
>
> I am doing a simple experiment in which I send a message to a TCP
> server
> and the server echoes the message. I am attaching a BPF sk_skb
> stream_verdict program to the server socket to redirect the message
> back
> to the client (redirects the SKB on the same socket but to the TX
> queue). In my test, I noticed that the user-space server, which is
> using
> the poll system call, is woken up, and when it reads the socket,
> receives zero as the number of bytes read.
Do you poll for POLLIN events?
>
> I first want to ask if this is the intended behavior.
> In case this is the intended behavior, my second question is, what
> should I do to prevent the user program from waking up? I hope by not
> waking up the user program I could better use the available
> resources.
AFAIK sockets in sockmap are propagates every events to poll (fixme),
but with pollfd::events you can specify the ones makes sense to you
e.g.: POLLERR, POLLHUP, POLLRDHUP, etc.
>
> Sincerely,
> Farbod
Ferenc
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: question about BPF sk_skb_stream_verdict redirect and poll/epoll events
2023-09-23 9:36 ` Ferenc Fejes
@ 2023-09-25 18:24 ` John Fastabend
0 siblings, 0 replies; 3+ messages in thread
From: John Fastabend @ 2023-09-25 18:24 UTC (permalink / raw)
To: Ferenc Fejes, Farbod Shahinfar, john.fastabend, netdev
Ferenc Fejes wrote:
> Hi!
>
> On Fri, 2023-09-22 at 19:32 +0200, Farbod Shahinfar wrote:
> > Hello,
> >
> > I am doing a simple experiment in which I send a message to a TCP
> > server
> > and the server echoes the message. I am attaching a BPF sk_skb
> > stream_verdict program to the server socket to redirect the message
> > back
> > to the client (redirects the SKB on the same socket but to the TX
> > queue). In my test, I noticed that the user-space server, which is
> > using
> > the poll system call, is woken up, and when it reads the socket,
> > receives zero as the number of bytes read.
>
> Do you poll for POLLIN events?
>
> >
> > I first want to ask if this is the intended behavior.
> > In case this is the intended behavior, my second question is, what
> > should I do to prevent the user program from waking up? I hope by not
> > waking up the user program I could better use the available
> > resources.
>
> AFAIK sockets in sockmap are propagates every events to poll (fixme),
> but with pollfd::events you can specify the ones makes sense to you
> e.g.: POLLERR, POLLHUP, POLLRDHUP, etc.
Agree we should not wake up the application in this case. I currently
fixing the wake up for cases where SK_PASS is passed. I can add this
to the todo list if no one beats me to it. For reference with parser
program we have a series of similar issue I'll fix next.
> >
> > Sincerely,
> > Farbod
>
> Ferenc
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-09-25 18:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-22 17:32 question about BPF sk_skb_stream_verdict redirect and poll/epoll events Farbod Shahinfar
2023-09-23 9:36 ` Ferenc Fejes
2023-09-25 18:24 ` John Fastabend
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).