From patchwork Mon Jul 10 20:00:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 107324 Delivered-To: patch@linaro.org Received: by 10.182.72.42 with SMTP id a10csp3825561obv; Mon, 10 Jul 2017 13:02:23 -0700 (PDT) X-Received: by 10.200.35.168 with SMTP id q37mr6696711qtq.129.1499716942925; Mon, 10 Jul 2017 13:02:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499716942; cv=none; d=google.com; s=arc-20160816; b=caDNsgjf4qnFzWePyPWwkhQP6+m5xVhrbfWNbAOZuuD6l1hv54KiX7XpBwBbO3z8+V LNNhlLKo4KAaLvmuvNdWg2J2Lj3kJwN79QR8yMkytWpqIUg4jlTeDx/PqvbzgOERgAL2 UQa4jiBT64Va6gBimrLyU0CcrHGmr3YG9jEr/uDjUwLcyNrfVHGNbFm2b5YVFIBxlCtE Rkt0a4uKo6xl/LtdN8I1lkfP/JAlbaX63ikIRc5fn2GQ5HwzRXhYYk5i6W32FDwSkLkS /g74uR7Eat7yJiFGhoBR0LHdXKkDjf4Hbp6RsX0adSiXBGPlG45/zrZ/qNZk7/BLPdC9 lztA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=cToIaiYF8r70Bk2zi5JoGLUpoH+Cj5GVpeP9xT+kqq0=; b=r/D3li1LslSAOPimTBME/kPfel4yfLiAy+DbSMN+ZzW6eal9UOj5bIivwFe/AX+LIL qUuOkY+Q2LeLvmz5adm1CDJxdqbQtDKzk/0fMuqVpceIPqFxod/00qBCgil5yf8Efacl oTlBYgOsDpIAur3dC/0E6aQzhqAKJcKF0jYJTsSR0lArm6JZP7gMB/auDDVB6XOgEq6v LDgB/+iBimQ/lhMbWAqvZawUOB2qPNhQ8zBtLo2bGWix4rIfbzUoChN3q4A9ryjPwAHn vzScT7WdCcvblVxvtVmyvkFlw5Z6oXTPyohtHkNQrBvjtEcQBIFioTkQmQonLx+wlsLT Z4wA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id 8si11871051qtx.357.2017.07.10.13.02.22; Mon, 10 Jul 2017 13:02:22 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id 3353E60C10; Mon, 10 Jul 2017 20:02:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id EDDAA64478; Mon, 10 Jul 2017 20:00:31 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id F3E386447C; Mon, 10 Jul 2017 20:00:27 +0000 (UTC) Received: from forward5p.cmail.yandex.net (forward5p.cmail.yandex.net [77.88.31.20]) by lists.linaro.org (Postfix) with ESMTPS id 6552B60750 for ; Mon, 10 Jul 2017 20:00:20 +0000 (UTC) Received: from smtp2m.mail.yandex.net (smtp2m.mail.yandex.net [IPv6:2a02:6b8:0:2519::122]) by forward5p.cmail.yandex.net (Yandex) with ESMTP id AAAAC2027C for ; Mon, 10 Jul 2017 23:00:15 +0300 (MSK) Received: from smtp2m.mail.yandex.net (localhost.localdomain [127.0.0.1]) by smtp2m.mail.yandex.net (Yandex) with ESMTP id 7FC9A2300CFA for ; Mon, 10 Jul 2017 23:00:14 +0300 (MSK) Received: by smtp2m.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id JjKiuef2uk-0ER4CuHw; Mon, 10 Jul 2017 23:00:14 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) X-Yandex-Suid-Status: 1 0 From: Github ODP bot To: lng-odp@lists.linaro.org Date: Mon, 10 Jul 2017 23:00:04 +0300 Message-Id: <1499716806-18707-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1499716806-18707-1-git-send-email-odpbot@yandex.ru> References: <1499716806-18707-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 72 Subject: [lng-odp] [PATCH v1 1/3] linux-gen: pktio: ipc fix packets free X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Maxim Uvarov Signed-off-by: Maxim Uvarov --- /** Email created from pull request 72 (muvarov:master_ipc_pkt_free_fix) ** https://github.com/Linaro/odp/pull/72 ** Patch: https://github.com/Linaro/odp/pull/72.patch ** Base sha: 5a2ed3eefb1a263139282c376741adb2c355bd5a ** Merge commit sha: 5853863d527ef327a244740d931cd2d0fb05db5f **/ platform/linux-generic/pktio/ipc.c | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/platform/linux-generic/pktio/ipc.c b/platform/linux-generic/pktio/ipc.c index 54e42227..f0facd8c 100644 --- a/platform/linux-generic/pktio/ipc.c +++ b/platform/linux-generic/pktio/ipc.c @@ -389,10 +389,15 @@ static void _ipc_free_ring_packets(pktio_entry_t *pktio_entry, _ring_t *r) int ret; void **rbuf_p; int i; + void *addr; + pool_t *pool; if (!r) return; + pool = pool_entry_from_hdl(pktio_entry->s.ipc.pool); + addr = odp_shm_addr(pool->shm); + rbuf_p = (void *)&offsets; while (1) { @@ -403,10 +408,10 @@ static void _ipc_free_ring_packets(pktio_entry_t *pktio_entry, _ring_t *r) for (i = 0; i < ret; i++) { odp_packet_hdr_t *phdr; odp_packet_t pkt; - void *mbase = pktio_entry->s.ipc.pool_mdata_base; - phdr = (void *)((uint8_t *)mbase + offsets[i]); + phdr = (void *)((uint8_t *)addr + offsets[i]); pkt = packet_handle(phdr); + odp_packet_free(pkt); } } @@ -420,7 +425,7 @@ static int ipc_pktio_recv_lockless(pktio_entry_t *pktio_entry, _ring_t *r; _ring_t *r_p; uintptr_t offsets[PKTIO_IPC_ENTRIES]; - void **ipcbufs_p = (void *)&offsets; + void **ipcbufs_p = (void *)&offsets[0]; uint32_t ready; int pkts_ring; @@ -437,6 +442,11 @@ static int ipc_pktio_recv_lockless(pktio_entry_t *pktio_entry, if (odp_unlikely(pkts < 0)) ODP_ABORT("internal error dequeue\n"); + for (i = 0; i < pkts; i++) { + IPC_ODP_DBG("%d/%d recv packet offset %x\n", + i, pkts, offsets[i]); + } + /* fast path */ if (odp_likely(0 == pkts)) return 0; @@ -511,9 +521,17 @@ static int ipc_pktio_recv_lockless(pktio_entry_t *pktio_entry, r_p = pktio_entry->s.ipc.rx.free; repeat: + + ipcbufs_p = (void *)&offsets[0]; pkts_ring = _ring_mp_enqueue_burst(r_p, ipcbufs_p, pkts); if (odp_unlikely(pkts_ring < 0)) ODP_ABORT("ipc: odp_ring_mp_enqueue_bulk r_p fail\n"); + + for (i = 0; i < pkts; i++) { + IPC_ODP_DBG("%d/%d send to be free packet offset %x\n", + i, pkts, offsets[i]); + } + if (odp_unlikely(pkts != pkts_ring)) { IPC_ODP_DBG("odp_ring_full: %d, odp_ring_count %d," " _ring_free_count %d\n", @@ -597,10 +615,13 @@ static int ipc_pktio_send_lockless(pktio_entry_t *pktio_entry, /* compile all function code even if ipc disabled with config */ pkt_hdr->buf_hdr.ipc_data_offset = data_pool_off; IPC_ODP_DBG("%d/%d send packet %llx, pool %llx," - "phdr = %p, offset %x\n", + "phdr = %p, offset %x sendoff %x, addr %llx iaddr %llx\n", i, len, odp_packet_to_u64(pkt), odp_pool_to_u64(pool_hdl), - pkt_hdr, pkt_hdr->buf_hdr.ipc_data_offset); + pkt_hdr, pkt_hdr->buf_hdr.ipc_data_offset, + offsets[i], odp_shm_addr(pool->shm), + odp_shm_addr(pool_entry_from_hdl( + pktio_entry->s.ipc.pool)->shm)); } /* Put packets to ring to be processed by other process. */