Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752330AbdLJUe0 (ORCPT ); Sun, 10 Dec 2017 15:34:26 -0500 Received: from home.regit.org ([37.187.126.138]:55208 "EHLO home.regit.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751999AbdLJUeW (ORCPT ); Sun, 10 Dec 2017 15:34:22 -0500 Message-ID: <1512938058.10027.7.camel@regit.org> Subject: Re: [PATCH net-next] libbpf: add function to setup XDP From: Eric Leblond To: Jakub Kicinski Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, ast@kernel.org, daniel@iogearbox.net Date: Sun, 10 Dec 2017 21:34:18 +0100 In-Reply-To: <20171209155715.78ef02e1@cakuba.netronome.com> References: <20171209144315.25890-1-eric@regit.org> <20171209155715.78ef02e1@cakuba.netronome.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.26.2-1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Spam-Score: -1.0 (-) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1583 Lines: 50 Hello, On Sat, 2017-12-09 at 15:57 -0800, Jakub Kicinski wrote: > On Sat, 9 Dec 2017 15:43:15 +0100, Eric Leblond wrote: > > + for (nh = (struct nlmsghdr *)buf; NLMSG_OK(nh, len); > > + nh = NLMSG_NEXT(nh, len)) { > > + if (nh->nlmsg_pid != getpid()) { > > + ret = -LIBBPF_ERRNO__WRNGPID; > > + goto cleanup; > > + } > > + if (nh->nlmsg_seq != seq) { > > + ret = -LIBBPF_ERRNO__INVSEQ; > > + goto cleanup; > > + } > > + switch (nh->nlmsg_type) { > > + case NLMSG_ERROR: > > + err = (struct nlmsgerr *)NLMSG_DATA(nh); > > + if (!err->error) > > + continue; > > + ret = err->error; > > + goto cleanup; > > + case NLMSG_DONE: > > + break; > > + default: > > + break; > > + } > > Would it be possible to print out or preferably return to the caller > the ext ack error message? A couple of drivers are using it for XDP > mis-configuration reporting instead of printks. We should encourage > other to do the same and support it in all user space since ext ack > msgs lead to much better user experience. I've seen the kind of messages displayed by reading at kernel log. They are really useful and it looks almost mandatory to be able to display them. Kernel code seems to not have a parser for the ext ack error message. Did I miss something here ? Looking at tc code, it seems it is using libmnl to parse them and I doubt it is a good idea to use that in libbpf as it is introducing a dependency. Does someone has an existing parsing code or should I write on my own ? BR, -- Eric Leblond Blog: https://home.regit.org/