public inbox for bpf@vger.kernel.org
 help / color / mirror / Atom feed
From: Alexander Lobakin <aleksander.lobakin@intel.com>
To: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Cc: <bpf@vger.kernel.org>, <ast@kernel.org>, <daniel@iogearbox.net>,
	<andrii@kernel.org>, <netdev@vger.kernel.org>,
	<magnus.karlsson@intel.com>, <bjorn@kernel.org>,
	<michal.kubiak@intel.com>
Subject: Re: [PATCH bpf] xsk: check IFF_UP earlier in Tx path
Date: Wed, 15 Feb 2023 18:57:31 +0100	[thread overview]
Message-ID: <4c993fb0-de7b-7671-8d0a-19bd7c49e70c@intel.com> (raw)
In-Reply-To: <20230215143309.13145-1-maciej.fijalkowski@intel.com>

From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Date: Wed, 15 Feb 2023 15:33:09 +0100

> Xsk Tx can be triggered via either sendmsg() or poll() syscalls. These
> two paths share a call to common function xsk_xmit() which has two
> sanity checks within. A pseudo code example to show the two paths:

[...]

> @@ -627,17 +618,31 @@ static bool xsk_no_wakeup(struct sock *sk)
>  #endif
>  }
>  
> +static int xsk_check_common(struct xdp_sock *xs)
> +{
> +	if (unlikely(!xsk_is_bound(xs)))
> +		return -ENXIO;
> +	if (unlikely(!(xs->dev->flags & IFF_UP)))
> +		return -ENETDOWN;
> +
> +	return 0;
> +}

It's called several times in the code. Have you tried marking it inline
and compare the object code? I'm worrying a bit some beyond-smart
compiler can uninline these 4 lines and slow down things for no reason.

(it's okay to have inlines in C files if proven that not marking them
 hurts a lot)

> +
>  static int __xsk_sendmsg(struct socket *sock, struct msghdr *m, size_t total_len)
The rest is:

Reviewed-by: Alexander Lobakin <aleksander.lobakin@intel.com>

Thanks,
Olek

  reply	other threads:[~2023-02-15 17:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-15 14:33 [PATCH bpf] xsk: check IFF_UP earlier in Tx path Maciej Fijalkowski
2023-02-15 17:57 ` Alexander Lobakin [this message]
2023-02-17  7:10 ` patchwork-bot+netdevbpf

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=4c993fb0-de7b-7671-8d0a-19bd7c49e70c@intel.com \
    --to=aleksander.lobakin@intel.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bjorn@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=maciej.fijalkowski@intel.com \
    --cc=magnus.karlsson@intel.com \
    --cc=michal.kubiak@intel.com \
    --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