From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CF0D0C17441 for ; Mon, 11 Nov 2019 17:38:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9D0E920818 for ; Mon, 11 Nov 2019 17:38:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=cloudflare.com header.i=@cloudflare.com header.b="QNQHT1jv" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726983AbfKKRip (ORCPT ); Mon, 11 Nov 2019 12:38:45 -0500 Received: from mail-lf1-f67.google.com ([209.85.167.67]:40772 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726763AbfKKRip (ORCPT ); Mon, 11 Nov 2019 12:38:45 -0500 Received: by mail-lf1-f67.google.com with SMTP id j26so3433260lfh.7 for ; Mon, 11 Nov 2019 09:38:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloudflare.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=nJFz9zTY/pPP/lruUjbdvSb0szMloxDkdcjSFe0zdXk=; b=QNQHT1jv0FP5wV/sCjlMJWmOfD5GpGNnTLK2vtxwwCkyWNQdhTQHQ9dvm+RGhAkEk8 pvw+WCMoxDbJNkzQC8oR9CUPWtlW0BZ0mAxjJ9/6OtYGtpktTkudlMCfA39yjGp8T4nS lOAA42hLo2wfFwZKNenm22/4J0VUa3ks4WLL8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=nJFz9zTY/pPP/lruUjbdvSb0szMloxDkdcjSFe0zdXk=; b=r0wr+YwcDf5o8vJODF3MTIk+2HDl+is0q2ZEckTEFbw16vjt85qduRz8BL3AVOl+qz K7N5fZcAAeeWqVetcwkpzuf9+BbZYfSANd80vIjwOKDfm8aJX+gGDX3arqHGhmgZi+3F N49/QqmELsMbAOlwmMjpfuJkl8EbErr3haU54+ttI/UG1D17IqTznY3NT5YRZ4yu+Lf/ ydZCipHqQHM3xV4zBtQloqjuK3XCfBcNyoEr/dS+reDuoyqgZhTRXdqWoQfO97lSAAh0 i8lU4ytaZms2epTpFLROfjMA2wu4ob62x37gm3+payb4NkAkiPacvp6OdX3ZWUCKQKZs pBQQ== X-Gm-Message-State: APjAAAX1NnyF1KsHHW2S3/g6JIlBNHMbub4qMputOQ5e7qocpWD/xPMf Ugjs8+l5F0e6ykcXi8zUkFqcma+io4gZtbcmnhNHbQ== X-Google-Smtp-Source: APXvYqyMhsY+dr5r5Pl9qpAKBj6HyRGST9YHSmAZ+4FVc+whsd+I3SZ5d+xsacpQ1FEFHthtN+KnL8mtCqv5Fz2Wg+U= X-Received: by 2002:a05:6512:509:: with SMTP id o9mr6230498lfb.28.1573493921419; Mon, 11 Nov 2019 09:38:41 -0800 (PST) MIME-Version: 1.0 References: <20191111105100.2992-1-afabre@cloudflare.com> In-Reply-To: From: Arthur Fabre Date: Mon, 11 Nov 2019 17:38:29 +0000 Message-ID: Subject: Re: [PATCH net-next] sfc: trace_xdp_exception on XDP failure To: Edward Cree Cc: Solarflare linux maintainers , Charles McLachlan , Martin Habets , David Miller , Alexei Starovoitov , Daniel Borkmann , Jakub Kicinski , Jesper Dangaard Brouer , John Fastabend , netdev , bpf , kernel-team Content-Type: text/plain; charset="UTF-8" Sender: bpf-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org On Mon, Nov 11, 2019 at 5:27 PM Edward Cree wrote: > > On 11/11/2019 10:51, Arthur Fabre wrote: > > diff --git a/drivers/net/ethernet/sfc/rx.c b/drivers/net/ethernet/sfc/rx.c > > index a7d9841105d8..5bfe1f6112a1 100644 > > --- a/drivers/net/ethernet/sfc/rx.c > > +++ b/drivers/net/ethernet/sfc/rx.c > > @@ -678,6 +678,7 @@ static bool efx_do_xdp(struct efx_nic *efx, struct efx_channel *channel, > > "XDP is not possible with multiple receive fragments (%d)\n", > > channel->rx_pkt_n_frags); > > channel->n_rx_xdp_bad_drops++; > > + trace_xdp_exception(efx->net_dev, xdp_prog, xdp_act); > > return false; > > } > AIUI trace_xdp_exception() is improper here as we have not run > the XDP program (and xdp_act is thus uninitialised). > > The other three, below, appear to be correct. > -Ed > Good point. Do you know under what conditions we'd end up with "fragmented" packets? As far as I can tell this isn't IP fragmentation? On Mon, Nov 11, 2019 at 5:27 PM Edward Cree wrote: > > On 11/11/2019 10:51, Arthur Fabre wrote: > > The sfc driver can drop packets processed with XDP, notably when running > > out of buffer space on XDP_TX, or returning an unknown XDP action. > > This increments the rx_xdp_bad_drops ethtool counter. > > > > Call trace_xdp_exception everywhere rx_xdp_bad_drops is incremented to > > easily monitor this from userspace. > > > > This mirrors the behavior of other drivers. > > > > Signed-off-by: Arthur Fabre > > --- > > drivers/net/ethernet/sfc/rx.c | 4 ++++ > > 1 file changed, 4 insertions(+) > > > > diff --git a/drivers/net/ethernet/sfc/rx.c b/drivers/net/ethernet/sfc/rx.c > > index a7d9841105d8..5bfe1f6112a1 100644 > > --- a/drivers/net/ethernet/sfc/rx.c > > +++ b/drivers/net/ethernet/sfc/rx.c > > @@ -678,6 +678,7 @@ static bool efx_do_xdp(struct efx_nic *efx, struct efx_channel *channel, > > "XDP is not possible with multiple receive fragments (%d)\n", > > channel->rx_pkt_n_frags); > > channel->n_rx_xdp_bad_drops++; > > + trace_xdp_exception(efx->net_dev, xdp_prog, xdp_act); > > return false; > > } > AIUI trace_xdp_exception() is improper here as we have not run > the XDP program (and xdp_act is thus uninitialised). > > The other three, below, appear to be correct. > -Ed > > > > > @@ -724,6 +725,7 @@ static bool efx_do_xdp(struct efx_nic *efx, struct efx_channel *channel, > > netif_err(efx, rx_err, efx->net_dev, > > "XDP TX failed (%d)\n", err); > > channel->n_rx_xdp_bad_drops++; > > + trace_xdp_exception(efx->net_dev, xdp_prog, xdp_act); > > } else { > > channel->n_rx_xdp_tx++; > > } > > @@ -737,6 +739,7 @@ static bool efx_do_xdp(struct efx_nic *efx, struct efx_channel *channel, > > netif_err(efx, rx_err, efx->net_dev, > > "XDP redirect failed (%d)\n", err); > > channel->n_rx_xdp_bad_drops++; > > + trace_xdp_exception(efx->net_dev, xdp_prog, xdp_act); > > } else { > > channel->n_rx_xdp_redirect++; > > } > > @@ -746,6 +749,7 @@ static bool efx_do_xdp(struct efx_nic *efx, struct efx_channel *channel, > > bpf_warn_invalid_xdp_action(xdp_act); > > efx_free_rx_buffers(rx_queue, rx_buf, 1); > > channel->n_rx_xdp_bad_drops++; > > + trace_xdp_exception(efx->net_dev, xdp_prog, xdp_act); > > break; > > > > case XDP_ABORTED: >