From patchwork Wed Dec 2 15:07:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Karlsson X-Patchwork-Id: 336560 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 A3E67C64E7B for ; Wed, 2 Dec 2020 15:08:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3E97020663 for ; Wed, 2 Dec 2020 15:08:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727408AbgLBPIU (ORCPT ); Wed, 2 Dec 2020 10:08:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726037AbgLBPIU (ORCPT ); Wed, 2 Dec 2020 10:08:20 -0500 Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4593C0613D6 for ; Wed, 2 Dec 2020 07:07:39 -0800 (PST) Received: by mail-pf1-x442.google.com with SMTP id w187so1419109pfd.5 for ; Wed, 02 Dec 2020 07:07:39 -0800 (PST) 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=bL8GQBSptP0Gq3pqr4BlBhH/zVnBYN2CeKoCMXNaK1I=; b=uo17RS5PP7aNMn3Hyk4DS49/NlHZEGUzUaggsVxu+I9yNLTTE3MN1JrylLETQ8RkXy eosiIMktNPsdbdquRHAYXsfZcj0xCzSMSiqp8NVJfsKX/K98/7Gky2+UuvKXgolmP0Il 0IO27UJuy2QKzThdKovd5a/CzMEi4Vu1jTXuBJtnW83mKZ7kvImfR5iE5WhYE5hTbRGU I4sXTOhetvK7nAn7KcaixbTO2+n2EgKGuSxOqhxWAFYeDgpO5ZO9ABc240xdPdfINHoE ae8i0HOp1uHPjAfqnbB0AeRIw9opYbYG4Sp8xL+UWhPrk+VUh5B/Wiw4ff72rgdoc2ng QUYw== 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=bL8GQBSptP0Gq3pqr4BlBhH/zVnBYN2CeKoCMXNaK1I=; b=ToHIe8zuRHSuomVoibVB8A+HXHjNN4axcSpOZvoeDVyjSteYHOrb5+a5Pf9QKljF2y hMTZQFolA80IY2SY2WQuQUJAt74wqzRu9FaIReXpD4SOHJqP36eyShD1jOlTCslYMXmm 8krj0TO1Z89sDNU4aMsOWEIQsTylNMWpUbaVJfl6HucCIp6tIqE0bSQptOANsXFuFdUA pJyhrivbEv/O6StbglewjOgUHDJ1k9hly4rQ/7yIBeAXVYXlLtVNOSAXwCC5lV0ZzAw1 sDUnocfJzb5sD8NSSRalce763W8hGREoYkzUFawuR66E9Q05PWQQj5XEOzvwFRznREc0 UDUw== X-Gm-Message-State: AOAM532tmmhhMZEIUbBdsVIpNJXr34YlfNa2VIyTZCAbRWYdoy49EBue Kix2Z4xNlb+LWDO35w9Ct4Q= X-Google-Smtp-Source: ABdhPJw9ZoYVEZ77jgu/AcWe9PFdfzPR5IVCbe3FNDvNqMSTqUqhpD1JFduPPw6g9g10kPwMhJf9dg== X-Received: by 2002:a63:7f03:: with SMTP id a3mr241963pgd.313.1606921659445; Wed, 02 Dec 2020 07:07:39 -0800 (PST) Received: from VM.ger.corp.intel.com ([192.55.55.41]) by smtp.gmail.com with ESMTPSA id p21sm148537pfn.87.2020.12.02.07.07.36 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 02 Dec 2020 07:07:38 -0800 (PST) From: Magnus Karlsson To: magnus.karlsson@intel.com, bjorn.topel@intel.com, intel-wired-lan@lists.osuosl.org, anthony.l.nguyen@intel.com Cc: netdev@vger.kernel.org, maciej.fijalkowski@intel.com, maciejromanfijalkowski@gmail.com Subject: [PATCH net-next 1/3] i40: optimize for XDP_REDIRECT in xsk path Date: Wed, 2 Dec 2020 16:07:22 +0100 Message-Id: <20201202150724.31439-2-magnus.karlsson@gmail.com> X-Mailer: git-send-email 2.29.0 In-Reply-To: <20201202150724.31439-1-magnus.karlsson@gmail.com> References: <20201202150724.31439-1-magnus.karlsson@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Magnus Karlsson Optimize i40e_run_xdp_zc() for the XDP program verdict being XDP_REDIRECT in the zsk zero-copy path. This path is only used when having AF_XDP zero-copy on and in that case most packets will be directed to user space. This provides a little over 100k extra packets in throughput on my server when running l2fwd in xdpsock. Signed-off-by: Magnus Karlsson Tested-by: George Kuruvinakunnel --- drivers/net/ethernet/intel/i40e/i40e_xsk.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/intel/i40e/i40e_xsk.c b/drivers/net/ethernet/intel/i40e/i40e_xsk.c index 67febc7b6798..fbf76c67d77d 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_xsk.c +++ b/drivers/net/ethernet/intel/i40e/i40e_xsk.c @@ -159,6 +159,13 @@ static int i40e_run_xdp_zc(struct i40e_ring *rx_ring, struct xdp_buff *xdp) xdp_prog = READ_ONCE(rx_ring->xdp_prog); act = bpf_prog_run_xdp(xdp_prog, xdp); + if (likely(act == XDP_REDIRECT)) { + err = xdp_do_redirect(rx_ring->netdev, xdp, xdp_prog); + result = !err ? I40E_XDP_REDIR : I40E_XDP_CONSUMED; + rcu_read_unlock(); + return result; + } + switch (act) { case XDP_PASS: break; @@ -166,10 +173,6 @@ static int i40e_run_xdp_zc(struct i40e_ring *rx_ring, struct xdp_buff *xdp) xdp_ring = rx_ring->vsi->xdp_rings[rx_ring->queue_index]; result = i40e_xmit_xdp_tx_ring(xdp, xdp_ring); break; - case XDP_REDIRECT: - err = xdp_do_redirect(rx_ring->netdev, xdp, xdp_prog); - result = !err ? I40E_XDP_REDIR : I40E_XDP_CONSUMED; - break; default: bpf_warn_invalid_xdp_action(act); fallthrough; From patchwork Wed Dec 2 15:07:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Karlsson X-Patchwork-Id: 336559 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 9FF07C64E7C for ; Wed, 2 Dec 2020 15:08:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3C63420663 for ; Wed, 2 Dec 2020 15:08:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727901AbgLBPIX (ORCPT ); Wed, 2 Dec 2020 10:08:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726037AbgLBPIX (ORCPT ); Wed, 2 Dec 2020 10:08:23 -0500 Received: from mail-pj1-x1043.google.com (mail-pj1-x1043.google.com [IPv6:2607:f8b0:4864:20::1043]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F1ACFC0617A6 for ; Wed, 2 Dec 2020 07:07:42 -0800 (PST) Received: by mail-pj1-x1043.google.com with SMTP id h7so691461pjk.1 for ; Wed, 02 Dec 2020 07:07:42 -0800 (PST) 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=D686hSiICwbI3KAxIZ+IHOTQOCH5FGtz5n2ONqK1CCI=; b=icskpsMgacpPpGanJiD9g39ACv0k53x49q4iDbl+CC1kVFvPKV4hsAa2Okas6HnW2s Ijy2IPvgRjZfWQJZ81YhvXS5Y23gL/CWuDTfNtiW0Apt0/lZy4Ibsyci/pjIZe0tdFO1 VHR1D0KFd07ruaZxwh4Xl525ChrSckjmV1JkfMilc1eik5udgPKlCdfa06vKiJcCFAlg xnllZCh7f8ZM4nbeT6aRERzIj8FJ7W/xrxzUVwGJ3YRn30TGYS3wI30XgCUNfvpaDP/R l8IRhCbVqzJXtDO2IE1P1mWOHKLkc/A2wNPeCmDAOQlKeLvwSrFzisGQ8hhzlvXIhjKy +4JA== 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=D686hSiICwbI3KAxIZ+IHOTQOCH5FGtz5n2ONqK1CCI=; b=l0/GIlSfZbx5ZXSweq1LynAsw4tzEiuk7jPQ1tspQtDi3WUnX6VxeaTJyLUp/8IJ7z jPQ+/SVBf/krAT2LOfbbEqTHsZw0HjfHdpE60c18XNMTyuIqjt84uHwSZWDZadjX6Y/P ehrVll5+nvzlqLWYNmPo9tTKP8ATQMxIdblWSTueAkNeNR3Rp+fuDd0uil/PTUs4G7KY gqxefq5cX36ALdoyt8dIJL8gwE+O66PdkJDcb56nE6aeCWcoJrWPU34srXABQBp8uN+6 uo+k3fSmwLNs8RfduK0nzHL+IY7lEPkrWE+8lHDpOHO+YsviL0in/R3Vv9ZGGqH5x6l1 7LOw== X-Gm-Message-State: AOAM5337HOAnxbN1QtYAl3t/xVBL6vGtMXeExDvp2uK6P1aOnK+Ld5vU FxRtzy+1aQFYry8AQBGbRlI= X-Google-Smtp-Source: ABdhPJxHIVLfr1VpNqQzLD/yEFI0hz/fSIAdQgOpKPK4ZJjBGPbz7kr3m+/sKrUSZLc4JdSLEBmJeg== X-Received: by 2002:a17:902:7606:b029:da:246c:5bd8 with SMTP id k6-20020a1709027606b02900da246c5bd8mr3075082pll.27.1606921662592; Wed, 02 Dec 2020 07:07:42 -0800 (PST) Received: from VM.ger.corp.intel.com ([192.55.55.41]) by smtp.gmail.com with ESMTPSA id p21sm148537pfn.87.2020.12.02.07.07.39 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 02 Dec 2020 07:07:42 -0800 (PST) From: Magnus Karlsson To: magnus.karlsson@intel.com, bjorn.topel@intel.com, intel-wired-lan@lists.osuosl.org, anthony.l.nguyen@intel.com Cc: netdev@vger.kernel.org, maciej.fijalkowski@intel.com, maciejromanfijalkowski@gmail.com Subject: [PATCH net-next 2/3] ixgbe: optimize for XDP_REDIRECT in xsk path Date: Wed, 2 Dec 2020 16:07:23 +0100 Message-Id: <20201202150724.31439-3-magnus.karlsson@gmail.com> X-Mailer: git-send-email 2.29.0 In-Reply-To: <20201202150724.31439-1-magnus.karlsson@gmail.com> References: <20201202150724.31439-1-magnus.karlsson@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Magnus Karlsson Optimize ixgbe_run_xdp_zc() for the XDP program verdict being XDP_REDIRECT in the zsk zero-copy path. This path is only used when having AF_XDP zero-copy on and in that case most packets will be directed to user space. This provides a little under 100k extra packets in throughput on my server when running l2fwd in xdpsock. Signed-off-by: Magnus Karlsson Tested-by: Vishakha Jambekar --- drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c index 3771857cf887..91ad5b902673 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c @@ -104,6 +104,13 @@ static int ixgbe_run_xdp_zc(struct ixgbe_adapter *adapter, xdp_prog = READ_ONCE(rx_ring->xdp_prog); act = bpf_prog_run_xdp(xdp_prog, xdp); + if (likely(act == XDP_REDIRECT)) { + err = xdp_do_redirect(rx_ring->netdev, xdp, xdp_prog); + result = !err ? IXGBE_XDP_REDIR : IXGBE_XDP_CONSUMED; + rcu_read_unlock(); + return result; + } + switch (act) { case XDP_PASS: break; @@ -115,10 +122,6 @@ static int ixgbe_run_xdp_zc(struct ixgbe_adapter *adapter, } result = ixgbe_xmit_xdp_ring(adapter, xdpf); break; - case XDP_REDIRECT: - err = xdp_do_redirect(rx_ring->netdev, xdp, xdp_prog); - result = !err ? IXGBE_XDP_REDIR : IXGBE_XDP_CONSUMED; - break; default: bpf_warn_invalid_xdp_action(act); fallthrough; From patchwork Wed Dec 2 15:07:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Karlsson X-Patchwork-Id: 337629 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 1C5A0C64E7C for ; Wed, 2 Dec 2020 15:08:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C17A3206CA for ; Wed, 2 Dec 2020 15:08:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728138AbgLBPI0 (ORCPT ); Wed, 2 Dec 2020 10:08:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726037AbgLBPI0 (ORCPT ); Wed, 2 Dec 2020 10:08:26 -0500 Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3131CC0617A7 for ; Wed, 2 Dec 2020 07:07:46 -0800 (PST) Received: by mail-pf1-x441.google.com with SMTP id q10so1436887pfn.0 for ; Wed, 02 Dec 2020 07:07:46 -0800 (PST) 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=oVUxlFzvG0YeZ7OkR1qvNOs6zaHHh9gvJZg4hCR2xvQ=; b=IpoqE5R1/KO4eIB1irQiNBUHh+Cf6DHXFh9d0k80o0IRJGSNBJA2G5lnPFDV92IPxz yYumX2Bj9tqLIUJ15xTSpI4+sjxS+/qE0CLzEm316ic5zxs2wt1n24eNilU+LBR7KjH5 j6kyiV4+x+InCWJ70out41tBtCOzVmF01RhayR+t+esMo4JTpfgzg3h3hk2PrpEDQIgq sBtVsfNQ/oe85vqSFxHLwQ+Q5fRPdc2h1fh4uzaO2lqQXD7Y7LplP0gHlTSsbWx/7v2W FuJVq2mRwvsR/98hHfd/tQnNgtlBS4SgP8UeWjbxq08DZPpMqcQ+dac/XZS+n1VzfsIW pJ2g== 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=oVUxlFzvG0YeZ7OkR1qvNOs6zaHHh9gvJZg4hCR2xvQ=; b=egeAt4Q0Z8V0Dc8tatLhGjL9Z0K0yZNi+7uug2BOD0IjTRf+CPcRTm6enuj1DAKWoP xCJxToD6Etzxl1A433UlHUzSIljT+SGND7CwXJJQ6Qn//LzrZKrGcNBfVRSNp47w04+9 6Crt+oGbiVI/Hi08HCiuEPBPsYw28g2UJeBe6mb6wFkcyx2O9V+i/rsTg6sz74p0TVje 6ZVz+XYAP3DPcJInMM0KGvW/6o6QmL8aHYw92sVBPnj7gXmiVSLy3CcvXuK48rXZQEOi eRnzha0RItlBv2Xy2SGPa4le3Cc88LpXLWHOSLZyFcGRHD4jYJIE6K5IW+Jz4aDybejc lblw== X-Gm-Message-State: AOAM532sdMZ3gYWRXNJUgTHWah6GbYFTxIIlEIr0/paZC8IaDINLpfsB M0FEVBOSW7uIykEXWKX1214= X-Google-Smtp-Source: ABdhPJyVqKylIIgWwX4bFqUPOpm3v1ZXtYI/7pXnEGQEgCAEpFQlGhF+/6wjHxKhsHJIT2T93P6cjA== X-Received: by 2002:a63:f03:: with SMTP id e3mr273635pgl.316.1606921665773; Wed, 02 Dec 2020 07:07:45 -0800 (PST) Received: from VM.ger.corp.intel.com ([192.55.55.41]) by smtp.gmail.com with ESMTPSA id p21sm148537pfn.87.2020.12.02.07.07.42 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 02 Dec 2020 07:07:45 -0800 (PST) From: Magnus Karlsson To: magnus.karlsson@intel.com, bjorn.topel@intel.com, intel-wired-lan@lists.osuosl.org, anthony.l.nguyen@intel.com Cc: netdev@vger.kernel.org, maciej.fijalkowski@intel.com, maciejromanfijalkowski@gmail.com Subject: [PATCH net-next 3/3] ice: optimize for XDP_REDIRECT in xsk path Date: Wed, 2 Dec 2020 16:07:24 +0100 Message-Id: <20201202150724.31439-4-magnus.karlsson@gmail.com> X-Mailer: git-send-email 2.29.0 In-Reply-To: <20201202150724.31439-1-magnus.karlsson@gmail.com> References: <20201202150724.31439-1-magnus.karlsson@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Magnus Karlsson Optimize ice_run_xdp_zc() for the XDP program verdict being XDP_REDIRECT in the zsk zero-copy path. This path is only used when having AF_XDP zero-copy on and in that case most packets will be directed to user space. This provides a little over 100k extra packets in throughput on my server when running l2fwd in xdpsock. Signed-off-by: Magnus Karlsson Tested-by: George Kuruvinakunnel --- drivers/net/ethernet/intel/ice/ice_xsk.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_xsk.c b/drivers/net/ethernet/intel/ice/ice_xsk.c index 797886524054..3b180e52112f 100644 --- a/drivers/net/ethernet/intel/ice/ice_xsk.c +++ b/drivers/net/ethernet/intel/ice/ice_xsk.c @@ -521,6 +521,14 @@ ice_run_xdp_zc(struct ice_ring *rx_ring, struct xdp_buff *xdp) } act = bpf_prog_run_xdp(xdp_prog, xdp); + + if (likely(act == XDP_REDIRECT)) { + err = xdp_do_redirect(rx_ring->netdev, xdp, xdp_prog); + result = !err ? ICE_XDP_REDIR : ICE_XDP_CONSUMED; + rcu_read_unlock(); + return result; + } + switch (act) { case XDP_PASS: break; @@ -528,10 +536,6 @@ ice_run_xdp_zc(struct ice_ring *rx_ring, struct xdp_buff *xdp) xdp_ring = rx_ring->vsi->xdp_rings[rx_ring->q_index]; result = ice_xmit_xdp_buff(xdp, xdp_ring); break; - case XDP_REDIRECT: - err = xdp_do_redirect(rx_ring->netdev, xdp, xdp_prog); - result = !err ? ICE_XDP_REDIR : ICE_XDP_CONSUMED; - break; default: bpf_warn_invalid_xdp_action(act); fallthrough;