netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joe Stringer <joe@wand.net.nz>
To: Quentin Monnet <quentin@isovalent.com>
Cc: Andrii Nakryiko <andrii.nakryiko@gmail.com>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Jesper Dangaard Brouer <brouer@redhat.com>,
	Hangbin Liu <liuhangbin@gmail.com>, bpf <bpf@vger.kernel.org>,
	Networking <netdev@vger.kernel.org>,
	Joe Stringer <joe@wand.net.nz>
Subject: Re: [PATCH bpf-next] bpf: fix missing * in bpf.h
Date: Mon, 1 Mar 2021 17:31:13 -0800	[thread overview]
Message-ID: <CAOftzPhhJmvk=XrzsvLGie7gS5yTS+MyRv8jMuyLxh520mD0Aw@mail.gmail.com> (raw)
In-Reply-To: <b64fa932-5902-f13f-b3b9-f476e389db1b@isovalent.com>

On Fri, Feb 26, 2021 at 8:51 AM Quentin Monnet <quentin@isovalent.com> wrote:
>
> 2021-02-24 10:59 UTC-0800 ~ Andrii Nakryiko <andrii.nakryiko@gmail.com>
> > On Wed, Feb 24, 2021 at 7:55 AM Daniel Borkmann <daniel@iogearbox.net> wrote:
> >>
> >> On 2/23/21 3:43 PM, Jesper Dangaard Brouer wrote:
> >>> On Tue, 23 Feb 2021 20:45:54 +0800
> >>> Hangbin Liu <liuhangbin@gmail.com> wrote:
> >>>
> >>>> Commit 34b2021cc616 ("bpf: Add BPF-helper for MTU checking") lost a *
> >>>> in bpf.h. This will make bpf_helpers_doc.py stop building
> >>>> bpf_helper_defs.h immediately after bpf_check_mtu, which will affect
> >>>> future add functions.
> >>>>
> >>>> Fixes: 34b2021cc616 ("bpf: Add BPF-helper for MTU checking")
> >>>> Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
> >>>> ---
> >>>>   include/uapi/linux/bpf.h       | 2 +-
> >>>>   tools/include/uapi/linux/bpf.h | 2 +-
> >>>>   2 files changed, 2 insertions(+), 2 deletions(-)
> >>>
> >>> Thanks for fixing that!
> >>>
> >>> Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>
> >>
> >> Thanks guys, applied!
> >>
> >>> I though I had already fix that, but I must have missed or reintroduced
> >>> this, when I rolling back broken ideas in V13.
> >>>
> >>> I usually run this command to check the man-page (before submitting):
> >>>
> >>>   ./scripts/bpf_helpers_doc.py | rst2man | man -l -
> >>
> >> [+ Andrii] maybe this could be included to run as part of CI to catch such
> >> things in advance?
> >
> > We do something like that as part of bpftool build, so there is no
> > reason we can't add this to selftests/bpf/Makefile as well.
>
> Hi, pretty sure this is the case already? [0]
>
> This helps catching RST formatting issues, for example if a description
> is using invalid markup, and reported by rst2man. My understanding is
> that in the current case, the missing star simply ends the block for the
> helpers documentation from the parser point of view, it's not considered
> an error.
>
> I see two possible workarounds:
>
> 1) Check that the number of helpers found ("len(self.helpers)") is equal
> to the number of helpers in the file, but that requires knowing how many
> helpers we have in the first place (e.g. parsing "__BPF_FUNC_MAPPER(FN)").

This is not so difficult as long as we stick to one symbol per line:

diff --git a/scripts/bpf_doc.py b/scripts/bpf_doc.py
index e2ffac2b7695..74cdcc2bbf18 100755
--- a/scripts/bpf_doc.py
+++ b/scripts/bpf_doc.py
@@ -183,25 +183,51 @@ class HeaderParser(object):
         self.reader.readline()
         self.line = self.reader.readline()

+    def get_elem_count(self, target):
+        self.seek_to(target, 'Could not find symbol "%s"' % target)
+        end_re = re.compile('^$')
+        count = 0
+        while True:
+            capture = end_re.match(self.line)
+            if capture:
+                break
+            self.line = self.reader.readline()
+            count += 1
+
+        # The last line (either '};' or '/* */' doesn't count.
+        return count
+

I can either roll this into my docs update v2, or hold onto it for
another dedicated patch fixup. Either way I'm trialing this out
locally to regression-test my own docs update PR and make sure I'm not
breaking one of the various output formats.

  parent reply	other threads:[~2021-03-02  8:40 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-23 12:45 [PATCH bpf-next] bpf: fix missing * in bpf.h Hangbin Liu
2021-02-23 13:14 ` [PATCHv2 bpf-next] bpf: remove blank line in bpf helper description Hangbin Liu
2021-02-24  9:19   ` Jesper Dangaard Brouer
2021-02-24 16:30   ` patchwork-bot+netdevbpf
2021-02-23 14:43 ` [PATCH bpf-next] bpf: fix missing * in bpf.h Jesper Dangaard Brouer
2021-02-24 15:55   ` Daniel Borkmann
2021-02-24 18:59     ` Andrii Nakryiko
2021-02-26 16:50       ` Quentin Monnet
2021-02-26 19:59         ` Andrii Nakryiko
2021-03-02  1:31         ` Joe Stringer [this message]
2021-02-24 16:00 ` 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='CAOftzPhhJmvk=XrzsvLGie7gS5yTS+MyRv8jMuyLxh520mD0Aw@mail.gmail.com' \
    --to=joe@wand.net.nz \
    --cc=andrii.nakryiko@gmail.com \
    --cc=bpf@vger.kernel.org \
    --cc=brouer@redhat.com \
    --cc=daniel@iogearbox.net \
    --cc=liuhangbin@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=quentin@isovalent.com \
    /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).