From patchwork Fri Apr 23 10:04:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Karlsson X-Patchwork-Id: 12220045 X-Patchwork-Delegate: kuba@kernel.org 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.7 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,URIBL_BLOCKED,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 9BA8BC433B4 for ; Fri, 23 Apr 2021 10:05:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 607986144D for ; Fri, 23 Apr 2021 10:05:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241859AbhDWKFn (ORCPT ); Fri, 23 Apr 2021 06:05:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241717AbhDWKFm (ORCPT ); Fri, 23 Apr 2021 06:05:42 -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 706AFC061574 for ; Fri, 23 Apr 2021 03:05:06 -0700 (PDT) Received: by mail-wr1-x431.google.com with SMTP id c15so38830710wro.13 for ; Fri, 23 Apr 2021 03:05:06 -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=iFvprk5eZdrkDBhOM9vDGXqzXgRtJo1NH3HF5wiCJ8w=; b=YzzxEQMRiIeqQutvaaH7MQMjSEZV9WesqCo+090HU0LoJ8dQ0JqFIqgKXeiuYFsEfh SLk19tIX/fWagO2H9UVV1KvqnhtHzbMPn4J5ZZ1nQ68Vzjcfou7LnFR0jNEikUSTn3eH sEmYkEtbhxulzeAJFx7OxoF6ziJhl9ygsx9gmqGHsiv4/rZ3mEqk3sOdm3lGjuopTH2P +BXrO7Y1UObb8W2xFbSqrGHM4lImuj/03vEf1plC4g/C8yWZwwR5CKlpOANIhC5gnUfV udK+1fMeY/7oU8ueYzREghu6D8eNltauj0aNI+vjQCWyhFOlH9b9l0uW4d6+UCBFpsbQ ytkw== 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=iFvprk5eZdrkDBhOM9vDGXqzXgRtJo1NH3HF5wiCJ8w=; b=TouZEDSiR/QEwqbD6hDjq5hoxr+3LBMVOOhnKcvLBXI9i+o52yKYZeFLuUTCdwQ9pB SZS1owZBKDOK849T2THYKaynm5YjNebZMYdb1nnBVaWli5mQtkXgoRa30JMJtG/gmYgP j0leqTAnWyLnjssP2hb8k1R3aTlOPorxz7GnDlH5yqlYnhxlGkz91qVq3Ii2uIviUiIL eFPWDd9Gr7Py8pHTX/6KZ4e5uLbObdT9a5Ity66UuTICXYexBewvnO4iO0an3MmENK7L PTngHmBcLqNvaSla4cUztHaAbMf8D4JF839RlmUs6XnaBzP5IE5ujmXZ2WQzSDaTpWdN szPw== X-Gm-Message-State: AOAM531SDRCBE8Z2aEcy15x7xKmEf3+Sri+U+9C0KS1RZCYp7erQQrFH pK2Fm+nKM7weEFV/babt5wg= X-Google-Smtp-Source: ABdhPJz007+yIfG8kVQNq3vhnps8FNbFbz+ahSJoEBlbfrw6OaUIMmevEzGzQ3ylD4MBd1FHHT6LrA== X-Received: by 2002:adf:d20b:: with SMTP id j11mr3744318wrh.292.1619172305240; Fri, 23 Apr 2021 03:05:05 -0700 (PDT) Received: from localhost.localdomain ([188.149.128.194]) by smtp.gmail.com with ESMTPSA id t12sm8599481wrs.42.2021.04.23.03.05.04 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Apr 2021 03:05:04 -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 1/5] i40e: add correct exception tracing for XDP Date: Fri, 23 Apr 2021 12:04:42 +0200 Message-Id: <20210423100446.15412-2-magnus.karlsson@gmail.com> X-Mailer: git-send-email 2.29.0 In-Reply-To: <20210423100446.15412-1-magnus.karlsson@gmail.com> References: <20210423100446.15412-1-magnus.karlsson@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@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 --- drivers/net/ethernet/intel/i40e/i40e_txrx.c | 7 ++++++- drivers/net/ethernet/intel/i40e/i40e_xsk.c | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c index 06b4271219b1..08fbb2ec7ff8 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c +++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c @@ -2317,15 +2317,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 12ca84113587..ca7dd1afe37a 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_xsk.c +++ b/drivers/net/ethernet/intel/i40e/i40e_xsk.c @@ -166,15 +166,20 @@ 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; 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: From patchwork Fri Apr 23 10:04:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Karlsson X-Patchwork-Id: 12220047 X-Patchwork-Delegate: kuba@kernel.org 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.7 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,URIBL_BLOCKED,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 4570FC433ED for ; Fri, 23 Apr 2021 10:05:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0DAE661406 for ; Fri, 23 Apr 2021 10:05:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241950AbhDWKFp (ORCPT ); Fri, 23 Apr 2021 06:05:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241717AbhDWKFo (ORCPT ); Fri, 23 Apr 2021 06:05:44 -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 89481C061574 for ; Fri, 23 Apr 2021 03:05:07 -0700 (PDT) Received: by mail-wr1-x431.google.com with SMTP id w4so44052748wrt.5 for ; Fri, 23 Apr 2021 03:05:07 -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=ICila3w9bfvENDGrDK3/90N1VTO1RwjzN2ngo0a/tfI=; b=Ee4RHyuAuNRKDVyl9fGJ4NYG4bhrIL31yp8l+uV2/ERs2waDxP7tDvAs3HR5mSB69F xGaB6sRZc+EKI7Ifjy7WytBHFPPHujiQDmz/2LzuilJk5TfRySU3X/+pISrV8k1lnLOs YG3xVRl8YLVHNQnSJC+jnrxHHn3JH1KG+6IbWCuyID4h7C+r5CfaK29038K7vpIzvnpw rSmr7KFaMtvSOYKl8eSTb3xovJZPYbXl+JHnCYr7uEoENxUX8sb+v7gPZnaN/SFoPqk+ jNgOMyUsVht1yuKfTevdSN1roUG8Ajob3tasqI1TTDMo4nYqf+92tWOv8GBf+cSc+Zyo dbGg== 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=ICila3w9bfvENDGrDK3/90N1VTO1RwjzN2ngo0a/tfI=; b=fEWWBLwnX8zjmZhwAmvjsM+bcNIF2vh8gXxY0ZIhk6MAi2WHQF4nQkaK/4qXhnEwih xHvOfJgOZzA6eZO0qacvxjv+5F7cujoBippzm23H7nwQ1+IPUzOFuHX+RhZAlaAGtFHv dgpwUsABqx/md5iYi2+7FclDR8HBdstmuOq81v9FBbPAQj+i4gtIkOOadaruxA8gi8zh DzyvDnIbdo/a4eBto2pjGrTLAxM7tTa4Eqhr7MNgGTmb2zigSfbKyqL3felKCd1aExxe GI4ytLaV1IiqZf4KcRHqRK+SrgzblaabvKsGLsyoHK+XcX7Qz5GRlfA8JqR+f4LsK5qJ QcCw== X-Gm-Message-State: AOAM533rV37340Msr1M6fl5/7fei2RGhU5mK55dBykduT54U1uQRxPcX Ixr/2RB7Ls7zeDgp7ncKHBQ= X-Google-Smtp-Source: ABdhPJzufyqoI6Buar2H/VQ0xGkUoK7rmeMcyvMRqdF2BIqahSLtfxcLOYBK08DJBSzCXNBg41MiCg== X-Received: by 2002:a5d:6b81:: with SMTP id n1mr3622036wrx.265.1619172306327; Fri, 23 Apr 2021 03:05:06 -0700 (PDT) Received: from localhost.localdomain ([188.149.128.194]) by smtp.gmail.com with ESMTPSA id t12sm8599481wrs.42.2021.04.23.03.05.05 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Apr 2021 03:05:05 -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 2/5] ice: add correct exception tracing for XDP Date: Fri, 23 Apr 2021 12:04:43 +0200 Message-Id: <20210423100446.15412-3-magnus.karlsson@gmail.com> X-Mailer: git-send-email 2.29.0 In-Reply-To: <20210423100446.15412-1-magnus.karlsson@gmail.com> References: <20210423100446.15412-1-magnus.karlsson@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@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 --- drivers/net/ethernet/intel/ice/ice_txrx.c | 12 +++++++++--- drivers/net/ethernet/intel/ice/ice_xsk.c | 7 ++++++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_txrx.c b/drivers/net/ethernet/intel/ice/ice_txrx.c index b91dcfd12727..b0a58d463441 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 9f94d9159acd..ec8d590bccdd 100644 --- a/drivers/net/ethernet/intel/ice/ice_xsk.c +++ b/drivers/net/ethernet/intel/ice/ice_xsk.c @@ -479,15 +479,20 @@ 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; case 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; + result = ICE_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 Fri Apr 23 10:04:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Karlsson X-Patchwork-Id: 12220049 X-Patchwork-Delegate: kuba@kernel.org 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.7 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,URIBL_BLOCKED,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 9AEF8C433B4 for ; Fri, 23 Apr 2021 10:05:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 687BA6144D for ; Fri, 23 Apr 2021 10:05:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242018AbhDWKFr (ORCPT ); Fri, 23 Apr 2021 06:05:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241919AbhDWKFp (ORCPT ); Fri, 23 Apr 2021 06:05:45 -0400 Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5C0DC06174A for ; Fri, 23 Apr 2021 03:05:08 -0700 (PDT) Received: by mail-wr1-x42a.google.com with SMTP id c15so38830842wro.13 for ; Fri, 23 Apr 2021 03:05:08 -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=JdL0Ez3l1Nos4wM54poc3BjM7zKIfXH2UXskbWVhJQ8=; b=BPfOgWrCFfFO+GSxopd1iPXmx6Fi/SDqLU5KGt04otBrlAsUPvTFVuFvUCCobsoK9n yhN+TF4rSwk/w/WAakBCsfp0l0YiQXpP8EVhKq+aZBOsY7sdPZcdhektO/kRVQ3V5EI7 oYXnt2yveN9w2Cb/kqJyaz+4tgxtJehRueescJMizeu60ci9RtA1PDVMmdN1lnuKMlVo XBwPO1FwNs87YkQ8y7LxL+lV1xBBoKJITUKYv5NrgVmUCudCk45LHubg2RvNLWMNEi4f 81S75sVpSsX4VHHwLFoupaA0xyWXqN+brasm0R+1OWCoHa23y5KoYZs6/nwhXa1SQaxt m32Q== 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=JdL0Ez3l1Nos4wM54poc3BjM7zKIfXH2UXskbWVhJQ8=; b=oeIWxlE+hjcCw0kb6c5u8q9o0NismnJiBHgBJyvX6jgJ0ygCk3MCWVvMjqg7qHbAgm GN0dS+emKfobDZB5jithnNKMqClJ8NPRTA4oq9tdIbNAbFHlIdCdnEL5cKgi/S3i46nW MZONgz0O6KdRdA1QHoWFasgNiNY3tkMpeXnGMKHnYTcRvuOmDAKQsS/x4NN2lhHAeU+t WovZpTpFGQOzA1n4/JuCO8gONoNBprD+n+ZILcP9gVNMnQpCBBxM5gS/UCzOb2D8zTuN Y+vvCbpjhm+DAGpP4PLUUtOST9qXoxvVY69zZh5cVQGqbbJYWfunsgq2kubSQihUjmg2 7MhA== X-Gm-Message-State: AOAM532Ks3l1ygYdmFp7efoXZKVjCo6cL2y/BrlraMSY+TVReMKEViXF GftbFrpcAqll7g3K2Q0MW+M= X-Google-Smtp-Source: ABdhPJxtd9/pnCXV3cMTAh5A+jskcQD0uwhYXOAEiYFQ3RRaBWlmASMQYIVwv37gq+gFdNSpj0NFqA== X-Received: by 2002:adf:f5cc:: with SMTP id k12mr3626655wrp.117.1619172307458; Fri, 23 Apr 2021 03:05:07 -0700 (PDT) Received: from localhost.localdomain ([188.149.128.194]) by smtp.gmail.com with ESMTPSA id t12sm8599481wrs.42.2021.04.23.03.05.06 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Apr 2021 03:05:07 -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 3/5] ixgbe: add correct exception tracing for XDP Date: Fri, 23 Apr 2021 12:04:44 +0200 Message-Id: <20210423100446.15412-4-magnus.karlsson@gmail.com> X-Mailer: git-send-email 2.29.0 In-Reply-To: <20210423100446.15412-1-magnus.karlsson@gmail.com> References: <20210423100446.15412-1-magnus.karlsson@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@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 | 13 ++++++++----- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index cffb95f8f632..c194158a421c 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 3771857cf887..5f01e724037a 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c @@ -109,20 +109,23 @@ 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; case 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; + 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: From patchwork Fri Apr 23 10:04:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Karlsson X-Patchwork-Id: 12220051 X-Patchwork-Delegate: kuba@kernel.org 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.7 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,URIBL_BLOCKED,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 65CE4C433B4 for ; Fri, 23 Apr 2021 10:05:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 32C90608FE for ; Fri, 23 Apr 2021 10:05:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242034AbhDWKFv (ORCPT ); Fri, 23 Apr 2021 06:05:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241997AbhDWKFr (ORCPT ); Fri, 23 Apr 2021 06:05:47 -0400 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2AD8C061756 for ; Fri, 23 Apr 2021 03:05:09 -0700 (PDT) Received: by mail-wr1-x434.google.com with SMTP id a4so47788803wrr.2 for ; Fri, 23 Apr 2021 03:05:09 -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=WOEa3H9ikuixMJBnj2BWjU2Lt8l1O0JIiIqWbM9kpD8=; b=pizEhOxllejzw/8cviEnPDfzzWXgysABi96iBqVvHDG1iXJK/pYLRhoNySP4d9eP9q PKW1r2ou2j1/7Ceb/oT7pI763fbyqD7s5xEn85KWeF0IJuRUY12G9/rMJCwl99+qNPeJ zXepmL5egnTXebZVP7TqRZfuMdMDITBqflQCMA/7cCgbPEuj5dEb08M8Hd/jlpVn2QvU 7NSjQ+BwO7QADLzz0kiD+dQHjKDRAGZapHbWzZhFqzZf8BVN8OJ6UxmAFoAKlTQB12y+ 2+8GCPhrqvp7YFme5icmLl9NbvPW7n+qOvn6s+VY4RG8obwz+WHRDG2vfSsHO8z+6K/U FJjw== 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=WOEa3H9ikuixMJBnj2BWjU2Lt8l1O0JIiIqWbM9kpD8=; b=Dk3VLgVpVC9fwfKVBOIHVTvtz22UXBuD+96m1NaBAp3IwOAvsUwra5OLd4NcvOEY3H Xg31BOfB1fmlL9U6/gXNMlMIz88BJkI6+dhln6VEXu0F9RLYl412ShU5Gm9uSWyofYSr DL9ZKj+s873t/UGoDpqftVQGkyzsrFl7sP6ALEjXkyZxnpmIPdNybTfKEAGms61cotvB 2Hc1frrpNzR+4Vvyy9gcoO58mdkb9F/I0DY0GZLJNUtT0DLlGaGHtiItDGCqcxOVnqsj +X/jfHMjxrBTsRjG2u2k8MaBYHtXCQJunz0R2jhR3zsHN3DRyEFwiojO6CXBG8DdOUEc jqWA== X-Gm-Message-State: AOAM532xNscTNpWdxtc/7XWB2h2/vYpwll1rUCJpzMEoQiiZeNQR1Wwg KjT/dL5x1SR7uJpQZdwmhNY= X-Google-Smtp-Source: ABdhPJwsnMZlDbqV2YXuKVj/0Ix/n/fmzLvCeqQlH158jIuHWh0Betz0dYC2WcyeJPHt2CvixCpEiA== X-Received: by 2002:a5d:69d0:: with SMTP id s16mr3705364wrw.102.1619172308621; Fri, 23 Apr 2021 03:05:08 -0700 (PDT) Received: from localhost.localdomain ([188.149.128.194]) by smtp.gmail.com with ESMTPSA id t12sm8599481wrs.42.2021.04.23.03.05.07 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Apr 2021 03:05:08 -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 4/5] igb add correct exception tracing for XDP Date: Fri, 23 Apr 2021 12:04:45 +0200 Message-Id: <20210423100446.15412-5-magnus.karlsson@gmail.com> X-Mailer: git-send-email 2.29.0 In-Reply-To: <20210423100446.15412-1-magnus.karlsson@gmail.com> References: <20210423100446.15412-1-magnus.karlsson@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@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 --- 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 a45cd2b416c8..45fcfc536b38 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c @@ -8402,18 +8402,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 Fri Apr 23 10:04:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Karlsson X-Patchwork-Id: 12220053 X-Patchwork-Delegate: kuba@kernel.org 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.7 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,URIBL_BLOCKED,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 91409C43460 for ; Fri, 23 Apr 2021 10:05:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 22F0A6144D for ; Fri, 23 Apr 2021 10:05:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242021AbhDWKFx (ORCPT ); Fri, 23 Apr 2021 06:05:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242019AbhDWKFr (ORCPT ); Fri, 23 Apr 2021 06:05:47 -0400 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04101C06174A for ; Fri, 23 Apr 2021 03:05:11 -0700 (PDT) Received: by mail-wr1-x432.google.com with SMTP id j5so46806365wrn.4 for ; Fri, 23 Apr 2021 03:05:10 -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=qnu8+xANZ9fCEYBDMJeqZXufIm484UwdqLlibJM+xGg=; b=gTywlByTY8QOwBs3ivbEvMqShqcmbc4tS9l9NuuXjPrkAexiFBUVJjPIZWN6Pqi2Ek ly2V/tpirLtOQD9WJ+jvJ2Sj6Gn3qkCh9idbNI5dBkXGK2lYa7esVN2E5GvOlfJ2mDG0 i0OiVaFxW6Ij7RpgIF0CqP8TqN5wPdtoHIUvTMuudrupWItd1FrHaV7lqnfebOwumtsy p+XHdCPypdhizZI0H413GnC/MvtTWMZ0WirnT1dBwIPviLe3hVLUOv1e4mCEwKUZFqGW 92wy55YvAlADM4FjY34V+mLELpOI5zbh35QAZeqtLDJGdSvULAbLh20HNlD7vcfY33E9 4Dog== 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=qnu8+xANZ9fCEYBDMJeqZXufIm484UwdqLlibJM+xGg=; b=Gew0mmqmGsRQLKgIFMZAsaTllgZjSAZs6nbwsxEEHHxHilSbo94fuWrIsjmegWvmeR YjobafSy8mnFUbiKhnyIpixCX83fjVeEl35UKVgOLIMJGPMEvAGvqs+5Hda5NFar09hj c1DAt8brRjzeXknIV745UPogqTPeJ3CACdsJYR8TFdCdsqYTk2hX5mflLVsq8Xk0LbnB wZkV+LnhxzDbHn64wQ9MAZ0kn5g1pfrSj5MBcLFnG2Ln78vinUZuqmTc/EnyTNg4814t pIg3/z08W1ktL+DHq9osCt5upBnksO5uK5sPZFsfSJLYbBXP5LA11BT2GBdVy0hNga09 MAOQ== X-Gm-Message-State: AOAM532zab+Gwq5So3ldndr5m7K7YD3/4A24mJSzBrkzcok9TwRZe0Wh mCahJB3f+tXwcyQE6scxf7Q= X-Google-Smtp-Source: ABdhPJzii5OWQkCLiIFA+BGj7w6KHZ66O4nqK+QYLm0i/NTPCGM5wB3mN8Lhidzx/+Dt8uLt6Jxcww== X-Received: by 2002:a5d:47c1:: with SMTP id o1mr3672237wrc.216.1619172309744; Fri, 23 Apr 2021 03:05:09 -0700 (PDT) Received: from localhost.localdomain ([188.149.128.194]) by smtp.gmail.com with ESMTPSA id t12sm8599481wrs.42.2021.04.23.03.05.08 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Apr 2021 03:05:09 -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 5/5] ixgbevf: add correct exception tracing for XDP Date: Fri, 23 Apr 2021 12:04:46 +0200 Message-Id: <20210423100446.15412-6-magnus.karlsson@gmail.com> X-Mailer: git-send-email 2.29.0 In-Reply-To: <20210423100446.15412-1-magnus.karlsson@gmail.com> References: <20210423100446.15412-1-magnus.karlsson@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@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 --- 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 449d7d5b280d..b38860c48598 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: