netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: John Fastabend <john.fastabend@gmail.com>
To: Ferenc Fejes <fejes@inf.elte.hu>,
	 Farbod Shahinfar <farbod.shahinfar@polimi.it>,
	 john.fastabend@gmail.com,  netdev@vger.kernel.org
Subject: Re: question about BPF sk_skb_stream_verdict redirect and poll/epoll events
Date: Mon, 25 Sep 2023 11:24:44 -0700	[thread overview]
Message-ID: <6511d06c64462_110e5208d1@john.notmuch> (raw)
In-Reply-To: <3fd39981aba0e0aa8ced76398c2ea8ad85208f7d.camel@inf.elte.hu>

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
> 



      reply	other threads:[~2023-09-25 18:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6511d06c64462_110e5208d1@john.notmuch \
    --to=john.fastabend@gmail.com \
    --cc=farbod.shahinfar@polimi.it \
    --cc=fejes@inf.elte.hu \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).