Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4861975pxj; Wed, 9 Jun 2021 03:52:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw6p6U4c/mosMhVMDbLkTxGCCrg9R0EsHSBoRuk/Kh+btcwiGqM0EsT1B4lVku6YU8pEq4h X-Received: by 2002:a17:906:22c6:: with SMTP id q6mr28106810eja.275.1623235930221; Wed, 09 Jun 2021 03:52:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623235930; cv=none; d=google.com; s=arc-20160816; b=f/VjOpM6c1lzSzKEKdgDX3Dn8KdgSXDDCcaXPKVbu98D90HuigueWYkafiqaxazqrS gmrnAxA3u0ZvAE7aDEGKpznjrr1/RCuEIkWGUkV2gc/JMkemc3tqxklxtnkNw+T50Vpe tRvidAEJWVH3MyUbdMnqxyGVymfTuy+j15rys7/iRrNKwjOng1NlUM1/hOTHQVKuNhQS GNkxTAo6KxiejVKCLX3GLxeb4n1gMpur5UOS/vN3YB4bysr94eiP+XDjLZK71z2zni6Y bhE+Lv3sr4E/F3xHMjZ8PUPaPyMpOYjFzSB8g7bGG1y+9u/AExNiuPxO/jQxwFk7q4ah aqOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=5e9NE/j6QsPmvZdqRMEzA+kX7ZYNPxQUr4QO2ud2c98=; b=Lg3ERMUqSNDKdD+bsW3t6oe1KhL51gm+kUPhdYtzZ3qM1zaTWPLRZb+GuzLTrD/Lsa V62/c2mTTTQwRJp+HgrsiPf6TMT9bO+xyRW/wWkwmBguESRQrbvgpALXaGaz4027nces h0GUPqHaUaaGyqIbIjyIBzQI3aWyzsoejBsfwqZ6YCVQxzoQw/4y+3NZAw4Ixn/PG5hp NyAouD6Yh3duQvM9k4dEtx0NkTD6lncTwuNHGqWRuzeRaG7PORYTFTfvboq114csM/gt otxo4xU2HlhkJs085IDHPzqAlDU6Rcp2ejRTYZfU6JiJLLC1Vgp65rTRA7DADOEc5HVh lxng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RTGSnJib; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dz7si1977942edb.68.2021.06.09.03.51.46; Wed, 09 Jun 2021 03:52:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RTGSnJib; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237406AbhFHTAd (ORCPT + 99 others); Tue, 8 Jun 2021 15:00:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:53762 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236445AbhFHSyN (ORCPT ); Tue, 8 Jun 2021 14:54:13 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2DCD461435; Tue, 8 Jun 2021 18:41:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1623177669; bh=Xy7V8RpSkFJ/vI1m5rvzWUgGYbx7g9nPvDbYVd+oj9E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RTGSnJibD4IU1NOSIBXSh8ul0c/7YLxlLcvmOs0Pz+0/yEyxCjCCdLrXZaB906Imk VAGlWXzmXk430niSe35nm54YnfYcrGko1FwQXJ5T5tb9XL4CRW/Rv7MpnAcv8MgpSk zcVSMy5CyrR/6Xcg604bv8R2tFv8cq9HzWap8jUg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Magnus Karlsson , Vishakha Jambekar , Tony Nguyen , Sasha Levin Subject: [PATCH 5.10 057/137] ixgbe: optimize for XDP_REDIRECT in xsk path Date: Tue, 8 Jun 2021 20:26:37 +0200 Message-Id: <20210608175944.315559266@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210608175942.377073879@linuxfoundation.org> References: <20210608175942.377073879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Magnus Karlsson [ Upstream commit 7d52fe2eaddfa3d7255d43c3e89ebf2748b7ea7a ] Optimize ixgbe_run_xdp_zc() for the XDP program verdict being XDP_REDIRECT in the xsk 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 Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin --- 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; -- 2.30.2