From patchwork Thu Jun 20 08:39:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Laatz, Kevin" X-Patchwork-Id: 1119855 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=osuosl.org (client-ip=140.211.166.136; helo=silver.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=intel.com Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45VHC83kRDz9sN4 for ; Fri, 21 Jun 2019 08:52:35 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 509D2203E4; Thu, 20 Jun 2019 22:52:33 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id bSi7H3qEslcm; Thu, 20 Jun 2019 22:52:32 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 1C18E203D0; Thu, 20 Jun 2019 22:52:32 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id CC7F61BF5E9 for ; Thu, 20 Jun 2019 16:53:57 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id C8F3E20770 for ; Thu, 20 Jun 2019 16:53:57 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id cbveQnzkGKrA for ; Thu, 20 Jun 2019 16:53:57 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by silver.osuosl.org (Postfix) with ESMTPS id 32E2720389 for ; Thu, 20 Jun 2019 16:53:57 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Jun 2019 09:53:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,397,1557212400"; d="scan'208";a="183135141" Received: from silpixa00399838.ir.intel.com (HELO silpixa00399838.ger.corp.intel.com) ([10.237.223.110]) by fmsmga004.fm.intel.com with ESMTP; 20 Jun 2019 09:53:55 -0700 From: Kevin Laatz To: netdev@vger.kernel.org, ast@kernel.org, daniel@iogearbox.net, bjorn.topel@intel.com, magnus.karlsson@intel.com Date: Thu, 20 Jun 2019 08:39:18 +0000 Message-Id: <20190620083924.1996-6-kevin.laatz@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190620083924.1996-1-kevin.laatz@intel.com> References: <20190620083924.1996-1-kevin.laatz@intel.com> X-Mailman-Approved-At: Thu, 20 Jun 2019 22:52:28 +0000 Subject: [Intel-wired-lan] [PATCH 05/11] ixgbe: add offset to zca_free X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: bruce.richardson@intel.com, ciara.loftus@intel.com, Kevin Laatz , intel-wired-lan@lists.osuosl.org, bpf@vger.kernel.com MIME-Version: 1.0 Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" This patch adds the offset param to for zero_copy_allocator to ixgbe_zca_free. This change is required to calculate the handle, otherwise, this function will not work in unaligned chunk mode since we can't easily mask back to the original handle in unaligned chunk mode. Signed-off-by: Kevin Laatz --- drivers/net/ethernet/intel/ixgbe/ixgbe_txrx_common.h | 3 ++- drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_txrx_common.h b/drivers/net/ethernet/intel/ixgbe/ixgbe_txrx_common.h index d93a690aff74..49702e2a4360 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_txrx_common.h +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_txrx_common.h @@ -33,7 +33,8 @@ struct xdp_umem *ixgbe_xsk_umem(struct ixgbe_adapter *adapter, int ixgbe_xsk_umem_setup(struct ixgbe_adapter *adapter, struct xdp_umem *umem, u16 qid); -void ixgbe_zca_free(struct zero_copy_allocator *alloc, unsigned long handle); +void ixgbe_zca_free(struct zero_copy_allocator *alloc, unsigned long handle, + off_t off); void ixgbe_alloc_rx_buffers_zc(struct ixgbe_ring *rx_ring, u16 cleaned_count); int ixgbe_clean_rx_irq_zc(struct ixgbe_q_vector *q_vector, diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c index 49536adafe8e..1ec02077ccb2 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c @@ -268,16 +268,16 @@ static void ixgbe_reuse_rx_buffer_zc(struct ixgbe_ring *rx_ring, obi->skb = NULL; } -void ixgbe_zca_free(struct zero_copy_allocator *alloc, unsigned long handle) +void ixgbe_zca_free(struct zero_copy_allocator *alloc, unsigned long handle, + off_t off) { struct ixgbe_rx_buffer *bi; struct ixgbe_ring *rx_ring; - u64 hr, mask; + u64 hr; u16 nta; rx_ring = container_of(alloc, struct ixgbe_ring, zca); hr = rx_ring->xsk_umem->headroom + XDP_PACKET_HEADROOM; - mask = rx_ring->xsk_umem->chunk_mask; nta = rx_ring->next_to_alloc; bi = rx_ring->rx_buffer_info; @@ -285,7 +285,7 @@ void ixgbe_zca_free(struct zero_copy_allocator *alloc, unsigned long handle) nta++; rx_ring->next_to_alloc = (nta < rx_ring->count) ? nta : 0; - handle &= mask; + handle -= off; bi->dma = xdp_umem_get_dma(rx_ring->xsk_umem, handle); bi->dma += hr;