From patchwork Mon May 10 09:38:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Karlsson X-Patchwork-Id: 433478 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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham 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 C0CDFC433B4 for ; Mon, 10 May 2021 09:39:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 935806144F for ; Mon, 10 May 2021 09:39:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230318AbhEJJk0 (ORCPT ); Mon, 10 May 2021 05:40:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230286AbhEJJkX (ORCPT ); Mon, 10 May 2021 05:40:23 -0400 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16460C061574 for ; Mon, 10 May 2021 02:39:19 -0700 (PDT) Received: by mail-wr1-x435.google.com with SMTP id z6so15881212wrm.4 for ; Mon, 10 May 2021 02:39:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ZUYE8uhwJ5aoRnKQOShutBC+Cl1nbGcNA8ZVeVX77ro=; b=g6VAjI18Lug5NcuzobpmsdpjILQ2lxpBmOJUpRwhUHQY+xI8gLTxoq5L7sSrvLrwxy WS6i0J7xjBsz36UdipReASh4l5FBMbQ8Ilv8H9HYZJIxHrNOOTXuob1S1zdgooRhkxWV lHTOx9ZNADFpbtaw135iFb2mAOe8P6KT3UqY6yZNBSO08nLyZz7peAQ3xfvms01ySAuP I3qU6FsedXsL+lZZWDv09C0nni3mHGep2ilXF0GIkhMP85Gq5Hn36axO5n7vW4e9qnCk R588ESAM2rYsxOp3IFXiQJv+hgOkuEsKDbIKVIc4I0yornrSwBKUfjOdP4v+geVA4bvt 7gtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ZUYE8uhwJ5aoRnKQOShutBC+Cl1nbGcNA8ZVeVX77ro=; b=OwAR9mT5lCGmTXZO66bWMS3IK4UpD1mfE++wx2h6gf+2e/uGSN5TDLANPuvXqVhGyZ UjINcuB1n/6bKhOyzB/L0dyrRQywWEtMTvShPnjKjRIPGTAmglGtpPmABE/zLrxh2hIK YhpdH5zOF3BITQf6TsvVO+SmZ3BLPoy5B3+SgMyqM4X6AfRK6AEcc5m9G94HmM7/FhCP jmCrvPoBQUw6e53O6O4I+sQoX9yUHGFHKtCumrFBxDRrUJkrGQTv3A+PS4WinBh3zZMU wbkyHAGtJNsA0y7kKX3GD3FdQZ+06BKPX6jzpEHWTys4xII3Ffr4qf3YDRUHJ5Jzrbt/ 7/cw== X-Gm-Message-State: AOAM531+iz7jo5GOBFAx5LAFgAtUZ8xck+mBwPX8M3vcWox/ssmucr7L EFVoEEMSmQuLx6gnL+hPwEyYQKEWZEkkBQ== X-Google-Smtp-Source: ABdhPJxpY8ooez7lOvBhPv0kqt2ownholonszizPwCfgQoTwG1Y4eWCQ4FeqfLhCkEHfkl5xR/LG/A== X-Received: by 2002:a05:6000:110c:: with SMTP id z12mr28866989wrw.188.1620639557856; Mon, 10 May 2021 02:39:17 -0700 (PDT) Received: from localhost.localdomain (h-47-246.A165.priv.bahnhof.se. [46.59.47.246]) by smtp.gmail.com with ESMTPSA id i2sm25892933wro.0.2021.05.10.02.39.16 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 May 2021 02:39:17 -0700 (PDT) From: Magnus Karlsson To: magnus.karlsson@intel.com, intel-wired-lan@lists.osuosl.org, anthony.l.nguyen@intel.com, maciej.fijalkowski@intel.com Cc: netdev@vger.kernel.org, brouer@redhat.com Subject: [PATCH intel-net v2 1/6] i40e: add correct exception tracing for XDP Date: Mon, 10 May 2021 11:38:49 +0200 Message-Id: <20210510093854.31652-2-magnus.karlsson@gmail.com> X-Mailer: git-send-email 2.29.0 In-Reply-To: <20210510093854.31652-1-magnus.karlsson@gmail.com> References: <20210510093854.31652-1-magnus.karlsson@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Magnus Karlsson Add missing exception tracing to XDP when a number of different errors can occur. The support was only partial. Several errors where not logged which would confuse the user quite a lot not knowing where and why the packets disappeared. Fixes: 74608d17fe29 ("i40e: add support for XDP_TX action") Fixes: 0a714186d3c0 ("i40e: add AF_XDP zero-copy Rx support") Reported-by: Jesper Dangaard Brouer Signed-off-by: Magnus Karlsson Tested-by: Kiran Bhandare A Contingent Worker at Intel --- drivers/net/ethernet/intel/i40e/i40e_txrx.c | 7 ++++++- drivers/net/ethernet/intel/i40e/i40e_xsk.c | 8 ++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c index de70c16ef619..b883ab809df3 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c +++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c @@ -2313,15 +2313,20 @@ static int i40e_run_xdp(struct i40e_ring *rx_ring, struct xdp_buff *xdp) case XDP_TX: xdp_ring = rx_ring->vsi->xdp_rings[rx_ring->queue_index]; result = i40e_xmit_xdp_tx_ring(xdp, xdp_ring); + if (result == I40E_XDP_CONSUMED) + goto out_failure; break; case XDP_REDIRECT: err = xdp_do_redirect(rx_ring->netdev, xdp, xdp_prog); - result = !err ? I40E_XDP_REDIR : I40E_XDP_CONSUMED; + if (err) + goto out_failure; + result = I40E_XDP_REDIR; break; default: bpf_warn_invalid_xdp_action(act); fallthrough; case XDP_ABORTED: +out_failure: trace_xdp_exception(rx_ring->netdev, xdp_prog, act); fallthrough; /* handle aborts by dropping packet */ case XDP_DROP: diff --git a/drivers/net/ethernet/intel/i40e/i40e_xsk.c b/drivers/net/ethernet/intel/i40e/i40e_xsk.c index 46d884417c63..68f177a86403 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_xsk.c +++ b/drivers/net/ethernet/intel/i40e/i40e_xsk.c @@ -162,9 +162,10 @@ static int i40e_run_xdp_zc(struct i40e_ring *rx_ring, struct xdp_buff *xdp) if (likely(act == XDP_REDIRECT)) { err = xdp_do_redirect(rx_ring->netdev, xdp, xdp_prog); - result = !err ? I40E_XDP_REDIR : I40E_XDP_CONSUMED; + if (err) + goto out_failure; rcu_read_unlock(); - return result; + return I40E_XDP_REDIR; } switch (act) { @@ -173,11 +174,14 @@ static int i40e_run_xdp_zc(struct i40e_ring *rx_ring, struct xdp_buff *xdp) case XDP_TX: xdp_ring = rx_ring->vsi->xdp_rings[rx_ring->queue_index]; result = i40e_xmit_xdp_tx_ring(xdp, xdp_ring); + if (result == I40E_XDP_CONSUMED) + goto out_failure; break; default: bpf_warn_invalid_xdp_action(act); fallthrough; case XDP_ABORTED: +out_failure: trace_xdp_exception(rx_ring->netdev, xdp_prog, act); fallthrough; /* handle aborts by dropping packet */ case XDP_DROP: From patchwork Mon May 10 09:38:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Karlsson X-Patchwork-Id: 434797 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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham 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 402CBC433B4 for ; Mon, 10 May 2021 09:39:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F30C96144F for ; Mon, 10 May 2021 09:39:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230338AbhEJJk2 (ORCPT ); Mon, 10 May 2021 05:40:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230307AbhEJJkY (ORCPT ); Mon, 10 May 2021 05:40:24 -0400 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41AD6C061574 for ; Mon, 10 May 2021 02:39:20 -0700 (PDT) Received: by mail-wr1-x430.google.com with SMTP id t18so15880915wry.1 for ; Mon, 10 May 2021 02:39:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gJ24jMtfVd96yK7jKT2cYd+nQBdfHaBQjl52YeItdPE=; b=JlbZHLXkDCy4bzK91k18C4VTTUPUIcwMxego4GZjrjdtAMqZQFdiLY00HdIval+Tig vcp4roeukpCq4j9KSu7X+2FBN8oolg+AUpgBsSM0O0Kxw7/STyCfZyNTKraF4Zz2vTXP sYPWH49c/bNUm+S+YwulH9Pd+pZ9GfMaibTkepjgB87N2uQoGou0kQO3M9vRGWfqDXAL RPk7mmh30CNjXRpu1hhbHAlRgBYskQChJTAx2jF/c1cvnjP3MScMgTFSelZCEl0dEI7m k7AwgK+b6jHItqNbOsFpUkeiPD930oe3mBnqxoFAAqoCFIViYNx/ud/EYZ0pTXnZNJfq 6hOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gJ24jMtfVd96yK7jKT2cYd+nQBdfHaBQjl52YeItdPE=; b=PyWZ414PFhCeQzbaPGHC/5uGQZNIbOm3vz1DJ8GSOudS95DS2I/wBGfiVeE1vHAr1a mqKPaX6NfAFzROf4o8zV8eqjEwUya9r2DBSFG+i/q5OJQCiNuQkEuiWpUcZJSWhJEvTo vlrOcOiA51ncZPY33BHvcwIuQND4gOnZLKlL5vL1TOp8QR799FdMfiRTeK8r7LccWmYo NnpB4wYweKqfUqTs13ysWv76kd/2mrAsWI3QfOv/csAxYJuHgMsKlJrYpucbvM3pzCro oqoXEbcuOPY6IgZWhmhCbBU2DiGLqt3hOr9pNcUFrbkYUYEBIAG+z/XPere7bKBl+3jq 1gTA== X-Gm-Message-State: AOAM533UTfrxhlJ2ZWL1nBphUaCI3p7LC0jT1ZIYztghJ63VUud10IIz 6O16tFxkg+5QCJ7ZyT2onnrrIc3OYX+xrg== X-Google-Smtp-Source: ABdhPJxnpIiD0k4t+3U3jRK+IdwKX8g/C+ai+VmERwyYWvoENT7g+7O77KjOQqcxa0NdpLJMoQon6A== X-Received: by 2002:a05:6000:144f:: with SMTP id v15mr28720897wrx.182.1620639559046; Mon, 10 May 2021 02:39:19 -0700 (PDT) Received: from localhost.localdomain (h-47-246.A165.priv.bahnhof.se. [46.59.47.246]) by smtp.gmail.com with ESMTPSA id i2sm25892933wro.0.2021.05.10.02.39.17 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 May 2021 02:39:18 -0700 (PDT) From: Magnus Karlsson To: magnus.karlsson@intel.com, intel-wired-lan@lists.osuosl.org, anthony.l.nguyen@intel.com, maciej.fijalkowski@intel.com Cc: netdev@vger.kernel.org, brouer@redhat.com Subject: [PATCH intel-net v2 2/6] ice: add correct exception tracing for XDP Date: Mon, 10 May 2021 11:38:50 +0200 Message-Id: <20210510093854.31652-3-magnus.karlsson@gmail.com> X-Mailer: git-send-email 2.29.0 In-Reply-To: <20210510093854.31652-1-magnus.karlsson@gmail.com> References: <20210510093854.31652-1-magnus.karlsson@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Magnus Karlsson Add missing exception tracing to XDP when a number of different errors can occur. The support was only partial. Several errors where not logged which would confuse the user quite a lot not knowing where and why the packets disappeared. Fixes: efc2214b6047 ("ice: Add support for XDP") Fixes: 2d4238f55697 ("ice: Add support for AF_XDP") Reported-by: Jesper Dangaard Brouer Signed-off-by: Magnus Karlsson Tested-by: Kiran Bhandare A Contingent Worker at Intel --- drivers/net/ethernet/intel/ice/ice_txrx.c | 12 +++++++++--- drivers/net/ethernet/intel/ice/ice_xsk.c | 8 ++++++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_txrx.c b/drivers/net/ethernet/intel/ice/ice_txrx.c index e2b4b29ea207..93e5d9ebfd74 100644 --- a/drivers/net/ethernet/intel/ice/ice_txrx.c +++ b/drivers/net/ethernet/intel/ice/ice_txrx.c @@ -523,7 +523,7 @@ ice_run_xdp(struct ice_ring *rx_ring, struct xdp_buff *xdp, struct bpf_prog *xdp_prog) { struct ice_ring *xdp_ring; - int err; + int err, result; u32 act; act = bpf_prog_run_xdp(xdp_prog, xdp); @@ -532,14 +532,20 @@ ice_run_xdp(struct ice_ring *rx_ring, struct xdp_buff *xdp, return ICE_XDP_PASS; case XDP_TX: xdp_ring = rx_ring->vsi->xdp_rings[smp_processor_id()]; - return ice_xmit_xdp_buff(xdp, xdp_ring); + result = ice_xmit_xdp_buff(xdp, xdp_ring); + if (result == ICE_XDP_CONSUMED) + goto out_failure; + return result; case XDP_REDIRECT: err = xdp_do_redirect(rx_ring->netdev, xdp, xdp_prog); - return !err ? ICE_XDP_REDIR : ICE_XDP_CONSUMED; + if (err) + goto out_failure; + return ICE_XDP_REDIR; default: bpf_warn_invalid_xdp_action(act); fallthrough; case XDP_ABORTED: +out_failure: trace_xdp_exception(rx_ring->netdev, xdp_prog, act); fallthrough; case XDP_DROP: diff --git a/drivers/net/ethernet/intel/ice/ice_xsk.c b/drivers/net/ethernet/intel/ice/ice_xsk.c index faa7b8d96adb..7228e4d427bc 100644 --- a/drivers/net/ethernet/intel/ice/ice_xsk.c +++ b/drivers/net/ethernet/intel/ice/ice_xsk.c @@ -473,9 +473,10 @@ ice_run_xdp_zc(struct ice_ring *rx_ring, struct xdp_buff *xdp) if (likely(act == XDP_REDIRECT)) { err = xdp_do_redirect(rx_ring->netdev, xdp, xdp_prog); - result = !err ? ICE_XDP_REDIR : ICE_XDP_CONSUMED; + if (err) + goto out_failure; rcu_read_unlock(); - return result; + return ICE_XDP_REDIR; } switch (act) { @@ -484,11 +485,14 @@ ice_run_xdp_zc(struct ice_ring *rx_ring, struct xdp_buff *xdp) case XDP_TX: xdp_ring = rx_ring->vsi->xdp_rings[rx_ring->q_index]; result = ice_xmit_xdp_buff(xdp, xdp_ring); + if (result == ICE_XDP_CONSUMED) + goto out_failure; break; default: bpf_warn_invalid_xdp_action(act); fallthrough; case XDP_ABORTED: +out_failure: trace_xdp_exception(rx_ring->netdev, xdp_prog, act); fallthrough; case XDP_DROP: From patchwork Mon May 10 09:38:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Karlsson X-Patchwork-Id: 434796 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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham 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 61E05C433ED for ; Mon, 10 May 2021 09:39:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 40F02613CA for ; Mon, 10 May 2021 09:39:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230342AbhEJJkd (ORCPT ); Mon, 10 May 2021 05:40:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230320AbhEJJk1 (ORCPT ); Mon, 10 May 2021 05:40:27 -0400 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E3B0C061574 for ; Mon, 10 May 2021 02:39:21 -0700 (PDT) Received: by mail-wm1-x32b.google.com with SMTP id s5-20020a7bc0c50000b0290147d0c21c51so8487169wmh.4 for ; Mon, 10 May 2021 02:39:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nlEE7d+pfgB+nDRoRKdy3JbmugaRLKlWWEIWRuI///o=; b=TNAQofFA9Bi4PTYIJIT/nmwET2L6Yim2+BU6ZFkwuz3DtqxhkiOuf/jRXydWJc64yk LUidxssciot8G9JiAAbQTUyxX2q4VKljxafif+qzN5zRf6zHtLgfvrlF4NLxMjPJjvry gZDQ+shFkScjRUFSCcbjQPguLHO4vECwEyBHCBkC82HeBKcACUms+K9oDvUa8xqA1mvY NEY/F89YdgYfqUCdZmUFJKEDXTcBWcbjxPMyX9LocOWXvTYBZCY0TkaxheeOBKYztHW6 EbRC0X7x1gxL0M/PMZJ5z0Yzj0rYmAESersoBaQx9VxPfIF3cTNIZ1xdcIICGiLpZwmg UH+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nlEE7d+pfgB+nDRoRKdy3JbmugaRLKlWWEIWRuI///o=; b=C7RzSAhnei8gCYh7Sw1fx0aWxCGRPnv5kGuJaxnS6axt++ASjKYXZEe48M/CO+ij/U /LIb99AFqvU3YDFxGdoh3TpTuFQSfScArMQKFgEZq5sYzdLcomL6500fmf7om8aBCBXW caujHvxG4jVHdTQKzk64UzbrIvcNqYrOLsPgXADcM0pItm9xFbiAVP+XoQ5qqS4YKg5R Tv9X3XRjhy3O55oPyWXaSUxzAlrHCFsNVQRJF5dNc0o9A8JZTAYGSjV0qu3qSUPAQ862 wDkY4KuetslVNBrpGTdMH9Ggx2htiYWQZfKcp4hjnkTqilHFaG2YVyI+/6qf3vHOoAGv s+rA== X-Gm-Message-State: AOAM530MNrM7xQVTy1yWIrf4bTYKGR5d3h7OS9naF7mmfyzaliUw/Uql v5+60Skf14id4FOGvUw17Qo= X-Google-Smtp-Source: ABdhPJyaiLBWLE3zFTCZLPlp+ZAwUyW27M71G7rGAITLCWWKI367KfUUS++FDzxLynxREvbGP+lHQQ== X-Received: by 2002:a05:600c:4ba3:: with SMTP id e35mr24752681wmp.47.1620639560175; Mon, 10 May 2021 02:39:20 -0700 (PDT) Received: from localhost.localdomain (h-47-246.A165.priv.bahnhof.se. [46.59.47.246]) by smtp.gmail.com with ESMTPSA id i2sm25892933wro.0.2021.05.10.02.39.19 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 May 2021 02:39:19 -0700 (PDT) From: Magnus Karlsson To: magnus.karlsson@intel.com, intel-wired-lan@lists.osuosl.org, anthony.l.nguyen@intel.com, maciej.fijalkowski@intel.com Cc: netdev@vger.kernel.org, brouer@redhat.com Subject: [PATCH intel-net v2 3/6] ixgbe: add correct exception tracing for XDP Date: Mon, 10 May 2021 11:38:51 +0200 Message-Id: <20210510093854.31652-4-magnus.karlsson@gmail.com> X-Mailer: git-send-email 2.29.0 In-Reply-To: <20210510093854.31652-1-magnus.karlsson@gmail.com> References: <20210510093854.31652-1-magnus.karlsson@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Magnus Karlsson Add missing exception tracing to XDP when a number of different errors can occur. The support was only partial. Several errors where not logged which would confuse the user quite a lot not knowing where and why the packets disappeared. Fixes: 33fdc82f0883 ("ixgbe: add support for XDP_TX action") Fixes: d0bcacd0a130 ("ixgbe: add AF_XDP zero-copy Rx support") Reported-by: Jesper Dangaard Brouer Signed-off-by: Magnus Karlsson Tested-by: Vishakha Jambekar --- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 16 ++++++++-------- drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c | 14 ++++++++------ 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index c5ec17d19c59..2ac5b82676f3 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c @@ -2213,23 +2213,23 @@ static struct sk_buff *ixgbe_run_xdp(struct ixgbe_adapter *adapter, break; case XDP_TX: xdpf = xdp_convert_buff_to_frame(xdp); - if (unlikely(!xdpf)) { - result = IXGBE_XDP_CONSUMED; - break; - } + if (unlikely(!xdpf)) + goto out_failure; result = ixgbe_xmit_xdp_ring(adapter, xdpf); + if (result == IXGBE_XDP_CONSUMED) + goto out_failure; break; case XDP_REDIRECT: err = xdp_do_redirect(adapter->netdev, xdp, xdp_prog); - if (!err) - result = IXGBE_XDP_REDIR; - else - result = IXGBE_XDP_CONSUMED; + if (err) + goto out_failure; + result = IXGBE_XDP_REDIR; break; default: bpf_warn_invalid_xdp_action(act); fallthrough; case XDP_ABORTED: +out_failure: trace_xdp_exception(rx_ring->netdev, xdp_prog, act); fallthrough; /* handle aborts by dropping packet */ case XDP_DROP: diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c index 91ad5b902673..f72d2978263b 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c @@ -106,9 +106,10 @@ static int ixgbe_run_xdp_zc(struct ixgbe_adapter *adapter, if (likely(act == XDP_REDIRECT)) { err = xdp_do_redirect(rx_ring->netdev, xdp, xdp_prog); - result = !err ? IXGBE_XDP_REDIR : IXGBE_XDP_CONSUMED; + if (err) + goto out_failure; rcu_read_unlock(); - return result; + return IXGBE_XDP_REDIR; } switch (act) { @@ -116,16 +117,17 @@ static int ixgbe_run_xdp_zc(struct ixgbe_adapter *adapter, break; case XDP_TX: xdpf = xdp_convert_buff_to_frame(xdp); - if (unlikely(!xdpf)) { - result = IXGBE_XDP_CONSUMED; - break; - } + if (unlikely(!xdpf)) + goto out_failure; result = ixgbe_xmit_xdp_ring(adapter, xdpf); + if (result == IXGBE_XDP_CONSUMED) + goto out_failure; break; default: bpf_warn_invalid_xdp_action(act); fallthrough; case XDP_ABORTED: +out_failure: trace_xdp_exception(rx_ring->netdev, xdp_prog, act); fallthrough; /* handle aborts by dropping packet */ case XDP_DROP: From patchwork Mon May 10 09:38:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Karlsson X-Patchwork-Id: 433477 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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham 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 AC7A1C43460 for ; Mon, 10 May 2021 09:39:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 921D161466 for ; Mon, 10 May 2021 09:39:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230357AbhEJJkb (ORCPT ); Mon, 10 May 2021 05:40:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55126 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230319AbhEJJk1 (ORCPT ); Mon, 10 May 2021 05:40:27 -0400 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92FA8C06175F for ; Mon, 10 May 2021 02:39:22 -0700 (PDT) Received: by mail-wm1-x32e.google.com with SMTP id n205so8803354wmf.1 for ; Mon, 10 May 2021 02:39:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vrGRBMEMBYdn7xsdOu9Vp0GY4DXrITa4gzZ8kQN2zME=; b=lOP0IvOfVhJVX0SdpTPVUaZmw0YtS+95e8JoBC5851SxngZkPhF9z4HPVov4sHZX3u +J9ik7XLJXmoaLDGL6W5wVSxBxI/Fsup3m/0L4XJ9stAQ5KNb3FuBSCreAYU2Jd2YLOZ SLx4uSVYt3X7XX9FEbHB1QX3Ys9MW2ltz2PXY02uEvywx6ccPdhfsx30q3KEn592iNEg rbD91S9HLV4eNq+ZbGwkx9cn5b8nsfp5p4RnzInb9MQ0Z15ZpCqGS1aRA/s09PQr/EKc UFMYIk/vy2HM6uJpVMlKLKYcQdSfw4h+USggPIaoc2hyQJvG6rOw+QWU6nK5oePsm4LM uPDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vrGRBMEMBYdn7xsdOu9Vp0GY4DXrITa4gzZ8kQN2zME=; b=f0Dzu11fdxNsYKawOhnoTyFsSTR18gI083XbrrHtkj9xUfJ4TfgLSPgxpFa0P36MIS pcdhbP7fAKlcCK/44vdJ4KY8CTv8/4AaClMNSLC5XsDXt6175SOR9eX8rU6BGM1+cXXf h+l+RqFbHI6WWyeav6XIgoDVfcZu2a4d6paf5mcrJHjsqjM5CTpxkmHNi7j1P+EJpAD1 ytzhcoxp7bmArm+2eryPQHOA1bzGcJ3BXlxIf6r5/dbVRpLh3XTGY88vgikJiCHQPUrF BUmBkFt9bx7OHd8I5deAHvd429FgCXKy1utYU0D5/tRXs5aO6kJTYf3QKJwBwRq/L7DT uPrA== X-Gm-Message-State: AOAM533gxWvE5aQUL0zHIngvrkHoNmF1VYGppFqFVYZJt9eyyrJKKE9y fDR2SD152ZeQ1/mxIwAYziw= X-Google-Smtp-Source: ABdhPJxDq6hQN5O0/HVqWr9ddKcumjxbGtyJQZShCuo/z//KHYAFqRunTQkKv+3Vr8NNXS3Jm4G5MQ== X-Received: by 2002:a05:600c:154a:: with SMTP id f10mr25597527wmg.31.1620639561387; Mon, 10 May 2021 02:39:21 -0700 (PDT) Received: from localhost.localdomain (h-47-246.A165.priv.bahnhof.se. [46.59.47.246]) by smtp.gmail.com with ESMTPSA id i2sm25892933wro.0.2021.05.10.02.39.20 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 May 2021 02:39:21 -0700 (PDT) From: Magnus Karlsson To: magnus.karlsson@intel.com, intel-wired-lan@lists.osuosl.org, anthony.l.nguyen@intel.com, maciej.fijalkowski@intel.com Cc: netdev@vger.kernel.org, brouer@redhat.com Subject: [PATCH intel-net v2 4/6] igb: add correct exception tracing for XDP Date: Mon, 10 May 2021 11:38:52 +0200 Message-Id: <20210510093854.31652-5-magnus.karlsson@gmail.com> X-Mailer: git-send-email 2.29.0 In-Reply-To: <20210510093854.31652-1-magnus.karlsson@gmail.com> References: <20210510093854.31652-1-magnus.karlsson@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Magnus Karlsson Add missing exception tracing to XDP when a number of different errors can occur. The support was only partial. Several errors where not logged which would confuse the user quite a lot not knowing where and why the packets disappeared. Fixes: 9cbc948b5a20 ("igb: add XDP support") Reported-by: Jesper Dangaard Brouer Signed-off-by: Magnus Karlsson Tested-by: Vishakha Jambekar --- drivers/net/ethernet/intel/igb/igb_main.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index 038a9fd1af44..004a5b15fadb 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c @@ -8401,18 +8401,20 @@ static struct sk_buff *igb_run_xdp(struct igb_adapter *adapter, break; case XDP_TX: result = igb_xdp_xmit_back(adapter, xdp); + if (result == IGB_XDP_CONSUMED) + goto out_failure; break; case XDP_REDIRECT: err = xdp_do_redirect(adapter->netdev, xdp, xdp_prog); - if (!err) - result = IGB_XDP_REDIR; - else - result = IGB_XDP_CONSUMED; + if (err) + goto out_failure; + result = IGB_XDP_REDIR; break; default: bpf_warn_invalid_xdp_action(act); fallthrough; case XDP_ABORTED: +out_failure: trace_xdp_exception(rx_ring->netdev, xdp_prog, act); fallthrough; case XDP_DROP: From patchwork Mon May 10 09:38:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Karlsson X-Patchwork-Id: 433476 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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham 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 31672C433B4 for ; Mon, 10 May 2021 09:39:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 09FD06144F for ; Mon, 10 May 2021 09:39:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230373AbhEJJkd (ORCPT ); Mon, 10 May 2021 05:40:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230337AbhEJJk2 (ORCPT ); Mon, 10 May 2021 05:40:28 -0400 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD2F4C061574 for ; Mon, 10 May 2021 02:39:23 -0700 (PDT) Received: by mail-wm1-x329.google.com with SMTP id y124-20020a1c32820000b029010c93864955so10752679wmy.5 for ; Mon, 10 May 2021 02:39:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=6+LTRB3VeUFqK10wpr4zxmf6+vUY37t/15OeIVQYx0c=; b=TzJR5KOFFl9YqEnH/MEwkVADy+gytZMw3a1UlDM1riIoHbLyRlQGfuK1g4Cz3NZWXx zOYeMiyNPxlBVQ9nLQsdtG6ePRAQ0cxBa+l+Pot50fyOrxnJhzlKZSCaGR6fZtcNUPQR 0zAwye4vRwnTq0xPeGJq/koVWlk2PEB9PiKS0NlMrJH3PEm/fX0zL6QK6j22D7v3Y/E/ ZNmdbpWbpUNSNR4qIBkeE6B2W/FSIC/D55YP/j2jqqpT00neN7Fl9LUjKeG6oraBsGxB Qn61siwM9Fuu1+Z+77tI1x+n+yUgWKsNcIS8+ywH6Zw6P2YfkqSTTJ2Rt8eukxFcAI+k JV8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=6+LTRB3VeUFqK10wpr4zxmf6+vUY37t/15OeIVQYx0c=; b=lWGRO3cjnRjwXK6tMGOBp+ndDatlAzSGx7ScC01Qo4ceKQ5skayJnZFYyAxBcm5vM0 V/h2f3t7gN+41dde/LYyJZbe7bXMHaMmxqPk5s7rPcVqTv40sEv5rexvw336cV8KMSvo y3b/6ui+4BR4GpmO7nysdUuKHbuAW4SXt+G4q8UWRc/M5Ih3DIWwPgONKHAib/JApI7k uMtJ3LPNSmCPrZveJxpPeMkbf5WlenfRI2GXMf6O6svlmgTwBusCK44EI0CBL3VDMCJ9 ETLpQ3RwbJnrSVppVQSW5OtRnAP3pU1g4PLuyElD3p1OkJlvKKaQwAcd0+lWBl6+t1Dh TQ7Q== X-Gm-Message-State: AOAM531HzobdlH4hzrxm3ax3VAxUY2B/yMmWmAaTVNc0tma63WC6x6/2 QY02YGBeS6/pESwxgt1aFc8= X-Google-Smtp-Source: ABdhPJw4IDSVTCDH95Xq0Ef9vi4FdUcD02zRAsTdyPWRHyY6/xpHdSOZoI9y9/QzBQosRl5dYlOWsg== X-Received: by 2002:a1c:f705:: with SMTP id v5mr34937718wmh.69.1620639562547; Mon, 10 May 2021 02:39:22 -0700 (PDT) Received: from localhost.localdomain (h-47-246.A165.priv.bahnhof.se. [46.59.47.246]) by smtp.gmail.com with ESMTPSA id i2sm25892933wro.0.2021.05.10.02.39.21 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 May 2021 02:39:22 -0700 (PDT) From: Magnus Karlsson To: magnus.karlsson@intel.com, intel-wired-lan@lists.osuosl.org, anthony.l.nguyen@intel.com, maciej.fijalkowski@intel.com Cc: netdev@vger.kernel.org, brouer@redhat.com Subject: [PATCH intel-net v2 5/6] ixgbevf: add correct exception tracing for XDP Date: Mon, 10 May 2021 11:38:53 +0200 Message-Id: <20210510093854.31652-6-magnus.karlsson@gmail.com> X-Mailer: git-send-email 2.29.0 In-Reply-To: <20210510093854.31652-1-magnus.karlsson@gmail.com> References: <20210510093854.31652-1-magnus.karlsson@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Magnus Karlsson Add missing exception tracing to XDP when a number of different errors can occur. The support was only partial. Several errors where not logged which would confuse the user quite a lot not knowing where and why the packets disappeared. Fixes: 21092e9ce8b1 ("ixgbevf: Add support for XDP_TX action") Reported-by: Jesper Dangaard Brouer Signed-off-by: Magnus Karlsson Tested-by: Vishakha Jambekar --- drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c index ba2ed8a43d2d..0e733cc15c58 100644 --- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c +++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c @@ -1067,11 +1067,14 @@ static struct sk_buff *ixgbevf_run_xdp(struct ixgbevf_adapter *adapter, case XDP_TX: xdp_ring = adapter->xdp_ring[rx_ring->queue_index]; result = ixgbevf_xmit_xdp_ring(xdp_ring, xdp); + if (result == IXGBEVF_XDP_CONSUMED) + goto out_failure; break; default: bpf_warn_invalid_xdp_action(act); fallthrough; case XDP_ABORTED: +out_failure: trace_xdp_exception(rx_ring->netdev, xdp_prog, act); fallthrough; /* handle aborts by dropping packet */ case XDP_DROP: From patchwork Mon May 10 09:38:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Karlsson X-Patchwork-Id: 434795 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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham 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 030ECC433ED for ; Mon, 10 May 2021 09:39:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D56FC61430 for ; Mon, 10 May 2021 09:39:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230396AbhEJJkg (ORCPT ); Mon, 10 May 2021 05:40:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230347AbhEJJka (ORCPT ); Mon, 10 May 2021 05:40:30 -0400 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E390BC061763 for ; Mon, 10 May 2021 02:39:24 -0700 (PDT) Received: by mail-wr1-x431.google.com with SMTP id n2so15931044wrm.0 for ; Mon, 10 May 2021 02:39:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=HZeUvAh+ikwDmY/Rpx/0dfPv/y2blsSGC/hug1HK8f4=; b=g+hWkqeGFjepemAxYPKAzvNKEJDCNCvG6+KeEY70i3mWYBFfhAUc9hFQ4FoFGuKkEc Nz+DIBzk2ttzCcpY+9TECzAZiuOJwnxcfC5lyaUoa6EEyZlrrdH3+y8inZ1LsZASZUxg bUatE/X7murdSa3ED9EuWTREHTvKhDL4kpnRCdinw63fDyFiSdnam478ebOOEE7mouw6 3LvZnwSQDoVJLwk38iN0iTgBhuHAAga+KMsLjFJAj9j3k3QwBUOsZK/U7eeu8tFP3JP0 eVWgukKJM0lQZqKScTzvIlCFUr13EPDD7JSbyvq1kR2Kj9x1pnRzqqvHg6lKOKzi9TR1 HcAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HZeUvAh+ikwDmY/Rpx/0dfPv/y2blsSGC/hug1HK8f4=; b=UdggLPALjh6+LP7BA3TS0yjgUz6G4gKLpW6q5VOEl+nhF+t9mLtzgaYyEwERrNNWMC hgK/n5VuffLAZlvmYq2W2toSShelo/f2mkSBVg9/AhFL68SyqpLmTl9InK56EesmWMJQ W7fDMoKJtXhCBFAh67V+XG/CwBKnvuyFS3FMqVlmFiSMhe8iCB1qQGJ9nhUto71gNa7r 3jZi6hWDV4wSi6629gn3hczHUjCl/P8fztqK+CigDPuwAiAcW23v6C8lpOY93qFSzL5k VinoVhe/6lEa6+OLr90bNgXERe4xR311bnwrAVJa3mfIbCVQKwVY4xLLvoBu4NMoi2An TJKQ== X-Gm-Message-State: AOAM532IHT9eI/bdOSwG/Bg0B3mJGMX4zZrFIrhC2+rmPEvOUI6xfdBU WHaHLdMMxzd0QHu7e+Mdjm/Kht3Ve6iN9A== X-Google-Smtp-Source: ABdhPJzfXM86VStYs4heIkT5ntqyyXLWNiqOsHG8TvgoNymz6mpUuml5xVSJJcN4Yt4d7S+LJ4At/g== X-Received: by 2002:a5d:608a:: with SMTP id w10mr29751980wrt.342.1620639563688; Mon, 10 May 2021 02:39:23 -0700 (PDT) Received: from localhost.localdomain (h-47-246.A165.priv.bahnhof.se. [46.59.47.246]) by smtp.gmail.com with ESMTPSA id i2sm25892933wro.0.2021.05.10.02.39.22 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 May 2021 02:39:23 -0700 (PDT) From: Magnus Karlsson To: magnus.karlsson@intel.com, intel-wired-lan@lists.osuosl.org, anthony.l.nguyen@intel.com, maciej.fijalkowski@intel.com Cc: netdev@vger.kernel.org, brouer@redhat.com Subject: [PATCH intel-net v2 6/6] igc: add correct exception tracing for XDP Date: Mon, 10 May 2021 11:38:54 +0200 Message-Id: <20210510093854.31652-7-magnus.karlsson@gmail.com> X-Mailer: git-send-email 2.29.0 In-Reply-To: <20210510093854.31652-1-magnus.karlsson@gmail.com> References: <20210510093854.31652-1-magnus.karlsson@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Magnus Karlsson Add missing exception tracing to XDP when a number of different errors can occur. The support was only partial. Several errors where not logged which would confuse the user quite a lot not knowing where and why the packets disappeared. Fixes: 73f1071c1d29 ("igc: Add support for XDP_TX action") Fixes: 4ff320361092 ("igc: Add support for XDP_REDIRECT action") Reported-by: Jesper Dangaard Brouer Signed-off-by: Magnus Karlsson Tested-by: Dvora Fuxbrumer --- drivers/net/ethernet/intel/igc/igc_main.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c index 069471b7ffb0..f1adf154ec4a 100644 --- a/drivers/net/ethernet/intel/igc/igc_main.c +++ b/drivers/net/ethernet/intel/igc/igc_main.c @@ -2047,20 +2047,19 @@ static struct sk_buff *igc_xdp_run_prog(struct igc_adapter *adapter, break; case XDP_TX: if (igc_xdp_xmit_back(adapter, xdp) < 0) - res = IGC_XDP_CONSUMED; - else - res = IGC_XDP_TX; + goto out_failure; + res = IGC_XDP_TX; break; case XDP_REDIRECT: if (xdp_do_redirect(adapter->netdev, xdp, prog) < 0) - res = IGC_XDP_CONSUMED; - else - res = IGC_XDP_REDIRECT; + goto out_failure; + res = IGC_XDP_REDIRECT; break; default: bpf_warn_invalid_xdp_action(act); fallthrough; case XDP_ABORTED: +out_failure: trace_xdp_exception(adapter->netdev, prog, act); fallthrough; case XDP_DROP: