From patchwork Thu Nov 12 16:35:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Loftus, Ciara" X-Patchwork-Id: 84071 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 38375A09D3; Thu, 12 Nov 2020 18:03:43 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 303005953; Thu, 12 Nov 2020 18:03:40 +0100 (CET) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id B545A4CA6; Thu, 12 Nov 2020 18:03:36 +0100 (CET) IronPort-SDR: fcaoBfg+/DKOkJf1MFpgkApI2A87hyPErb0weWMX46JjZZZ5mBLN9R4qf0zFkCeDhWZyXwrvjP 7c6MpWSHmOag== X-IronPort-AV: E=McAfee;i="6000,8403,9803"; a="255051719" X-IronPort-AV: E=Sophos;i="5.77,472,1596524400"; d="scan'208";a="255051719" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Nov 2020 09:03:17 -0800 IronPort-SDR: VSEdeU5/mLnXACJvauf4r8byOFCNRV1YalWnXUC3cQSm6Fz/KM8JTbyII16i82p3ZYtpDyy5tX nl920EbaQEXw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,472,1596524400"; d="scan'208";a="308901228" Received: from silpixa00399839.ir.intel.com (HELO localhost.localdomain) ([10.237.222.142]) by fmsmga008.fm.intel.com with ESMTP; 12 Nov 2020 09:03:15 -0800 From: Ciara Loftus To: dev@dpdk.org Cc: Ciara Loftus , stable@dpdk.org Date: Thu, 12 Nov 2020 16:35:15 +0000 Message-Id: <20201112163515.29463-1-ciara.loftus@intel.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH] net/af_xdp: fix 32-bit build for older kernels X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 'uint64_t' is used to hold pointers in multiple locations in the copy-mode code (used for kernels before 5.4). For a 32-bit build this assumption is wrong and results in build errors. This commit replaces such instances of 'uint64_t' with 'uintptr_t'. While the copy-mode code will now compile for 32-bit, the PMD is not expected to work and will fail at initialisation due to some limitations in the kernel that were subsequently removed in v5.4. Add a note to the docs to flag this limitation. Fixes: f1debd77efaf ("net/af_xdp: introduce AF_XDP PMD") Fixes: d8a210774e1d ("net/af_xdp: support unaligned umem chunks") Cc: stable@dpdk.org Signed-off-by: Ciara Loftus --- doc/guides/nics/af_xdp.rst | 1 + drivers/net/af_xdp/rte_eth_af_xdp.c | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/doc/guides/nics/af_xdp.rst b/doc/guides/nics/af_xdp.rst index 052e59a3ae..5ed24374f8 100644 --- a/doc/guides/nics/af_xdp.rst +++ b/doc/guides/nics/af_xdp.rst @@ -50,6 +50,7 @@ This is a Linux-specific PMD, thus the following prerequisites apply: * For PMD zero copy, it requires kernel version later than v5.4-rc1; * For shared_umem, it requires kernel version v5.10 or later and libbpf version v0.2.0 or later. +* For 32-bit OS, a kernel with version 5.4 or later is required. Set up an af_xdp interface ----------------------------- diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c index 4076ff797c..75ff1c00b2 100644 --- a/drivers/net/af_xdp/rte_eth_af_xdp.c +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c @@ -349,7 +349,7 @@ af_xdp_rx_cp(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) for (i = 0; i < rcvd; i++) { const struct xdp_desc *desc; - uint64_t addr; + uintptr_t addr; uint32_t len; void *pkt; @@ -402,7 +402,7 @@ pull_umem_cq(struct xsk_umem_info *umem, int size, struct xsk_ring_cons *cq) n = xsk_ring_cons__peek(cq, size, &idx_cq); for (i = 0; i < n; i++) { - uint64_t addr; + uintptr_t addr; addr = *xsk_ring_cons__comp_addr(cq, idx_cq++); #if defined(XDP_UMEM_UNALIGNED_CHUNK_FLAG) addr = xsk_umem__extract_addr(addr); @@ -1005,7 +1005,7 @@ xsk_umem_info *xdp_umem_configure(struct pmd_internals *internals, char ring_name[RTE_RING_NAMESIZE]; char mz_name[RTE_MEMZONE_NAMESIZE]; int ret; - uint64_t i; + uintptr_t i; umem = rte_zmalloc_socket("umem", sizeof(*umem), 0, rte_socket_id()); if (umem == NULL) {