From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2EACDA0527 for ; Mon, 9 Nov 2020 19:44:01 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 28F2069C8; Mon, 9 Nov 2020 19:44:00 +0100 (CET) Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) by dpdk.org (Postfix) with ESMTP id 3361469C8 for ; Mon, 9 Nov 2020 19:43:58 +0100 (CET) Received: by mail-wr1-f46.google.com with SMTP id 33so9865054wrl.7 for ; Mon, 09 Nov 2020 10:43:58 -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=HEPIPwDJXUUJRpBfIo1TKgKAK/JuT+arj/qZgygJ1o0=; b=QQBsKXUy7+HBRL1P32XN0ZDRw+rNQ/BBUX1qMvPRx7/VXWSxdTFkAq1lS8TZTL/lP2 7vbkzS3uSDo7qFUHjfbqDEyQaIf+6fun6GMn4ASkgw/TUrBCOKb64YBLXx10idK0fz1n kJklI8PrOFYdgUEreLwjQA/LfoRiiNlIcMFlunb4EdJ0xA45mEhy9umW4B1I0CWsw3BP 8kvy8iqmZ4nr7cDDZk3EnNpjxLRX0SW0YvfLKLC8gQpK06CwDV2BKBTHHPBUSFy36+/C 9ECbRcGE0Sh5wQ4q2RlUJEXYfLUCGT484L9AmzS4rrfrNK7X58nUmlnuxrmpSQZj71g5 1waA== 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=HEPIPwDJXUUJRpBfIo1TKgKAK/JuT+arj/qZgygJ1o0=; b=hvDhUxb5WzfqQH7yp5zd+P5kUv4Qh461qFBjc/FGjobiKaZNBAlUtKOeLcPeOOruM3 W1k+oBZFZ4qt7WStdKqgwoHCKp0oiaWN8VLuZLWfA8yCLtTMo/lrNtemVolYMEuucmDg Tuhddkn7ZLZ2ZZkjDUsowKBn+gPmiS2TfbsFCr3mzkA7jz/DWtJIksWahWu4nhWqf/pI LsanzboDc7Va8MUqXjQD0pVU8/otGgQAXJMbaJDCouJ1twj6VjVOJf/WyVF6lvxELfO3 GVz5lMvBfAWga1kDSCeXp1Xec7eQNjVyiq3guzq7PTOyJv6gCjH0YulDVKzEIlC6+Crx 2cCA== X-Gm-Message-State: AOAM532bdfxvi22r6wDm8mifyKlas3WEjdu1WwJHso49GKkqsuh1iBgt aQ9ngjgiAGNF1uzXlO577OqNK5F/fEeLWTzS X-Google-Smtp-Source: ABdhPJzAe+ntWhHDO77xgsROX2W7Y0/Hy5w/HKIG0WpHe+yAVt6smdYd7MaKePVFBnCO7jQrhvLpIw== X-Received: by 2002:adf:9b98:: with SMTP id d24mr19136013wrc.17.1604947436991; Mon, 09 Nov 2020 10:43:56 -0800 (PST) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id l3sm376701wmg.32.2020.11.09.10.43.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Nov 2020 10:43:56 -0800 (PST) From: luca.boccassi@gmail.com To: Long Li Cc: dpdk stable Date: Mon, 9 Nov 2020 18:40:35 +0000 Message-Id: <20201109184111.3463090-47-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20201109184111.3463090-1-luca.boccassi@gmail.com> References: <20201028104606.3504127-207-luca.boccassi@gmail.com> <20201109184111.3463090-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/netvsc: allocate contiguous physical memory for RNDIS' has been queued to stable release 19.11.6 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi, FYI, your patch has been queued to stable release 19.11.6 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 11/11/20. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/e896b661e65b9efc015818b9a10a25c3f73e5f5b Thanks. Luca Boccassi --- >From e896b661e65b9efc015818b9a10a25c3f73e5f5b Mon Sep 17 00:00:00 2001 From: Long Li Date: Wed, 21 Oct 2020 17:26:07 -0700 Subject: [PATCH] net/netvsc: allocate contiguous physical memory for RNDIS [ upstream commit b8c3c628aff6defbabf677b4eea14c0529486357 ] When sending data, netvsc assumes the tx_rndis buffer is contiguous and calculates physical addresses based on this assumption. Use memzone to allocate tx_rndis so it's guaranteed that this buffer is physically contiguous. Signed-off-by: Long Li --- drivers/net/netvsc/hn_rxtx.c | 23 ++++++++++++----------- drivers/net/netvsc/hn_var.h | 2 ++ 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/drivers/net/netvsc/hn_rxtx.c b/drivers/net/netvsc/hn_rxtx.c index 4286b6b463..c0965ab420 100644 --- a/drivers/net/netvsc/hn_rxtx.c +++ b/drivers/net/netvsc/hn_rxtx.c @@ -283,10 +283,15 @@ hn_dev_tx_queue_setup(struct rte_eth_dev *dev, PMD_INIT_LOG(DEBUG, "TX descriptor pool %s n=%u size=%zu", name, nb_desc, sizeof(struct hn_txdesc)); - txq->tx_rndis = rte_calloc("hn_txq_rndis", nb_desc, - HN_RNDIS_PKT_ALIGNED, RTE_CACHE_LINE_SIZE); - if (txq->tx_rndis == NULL) + txq->tx_rndis_mz = rte_memzone_reserve_aligned(name, + nb_desc * HN_RNDIS_PKT_ALIGNED, rte_socket_id(), + RTE_MEMZONE_IOVA_CONTIG, HN_RNDIS_PKT_ALIGNED); + if (!txq->tx_rndis_mz) { + err = -rte_errno; goto error; + } + txq->tx_rndis = txq->tx_rndis_mz->addr; + txq->tx_rndis_iova = txq->tx_rndis_mz->iova; txq->txdesc_pool = rte_mempool_create(name, nb_desc, sizeof(struct hn_txdesc), @@ -315,7 +320,7 @@ hn_dev_tx_queue_setup(struct rte_eth_dev *dev, error: if (txq->txdesc_pool) rte_mempool_free(txq->txdesc_pool); - rte_free(txq->tx_rndis); + rte_memzone_free(txq->tx_rndis_mz); rte_free(txq); return err; } @@ -357,7 +362,7 @@ hn_dev_tx_queue_release(void *arg) if (txq->txdesc_pool) rte_mempool_free(txq->txdesc_pool); - rte_free(txq->tx_rndis); + rte_memzone_free(txq->tx_rndis_mz); rte_free(txq); } @@ -1356,12 +1361,8 @@ static int hn_xmit_sg(struct hn_tx_queue *txq, hn_rndis_dump(txd->rndis_pkt); /* pass IOVA of rndis header in first segment */ - addr = rte_malloc_virt2iova(txq->tx_rndis); - if (unlikely(addr == RTE_BAD_IOVA)) { - PMD_DRV_LOG(ERR, "RNDIS transmit can not get iova"); - return -EINVAL; - } - addr = addr + ((char *)txd->rndis_pkt - (char *)txq->tx_rndis); + addr = txq->tx_rndis_iova + + ((char *)txd->rndis_pkt - (char *)txq->tx_rndis); sg[0].page = addr / PAGE_SIZE; sg[0].ofs = addr & PAGE_MASK; diff --git a/drivers/net/netvsc/hn_var.h b/drivers/net/netvsc/hn_var.h index a4d47abca3..44c9db95a6 100644 --- a/drivers/net/netvsc/hn_var.h +++ b/drivers/net/netvsc/hn_var.h @@ -53,7 +53,9 @@ struct hn_tx_queue { uint16_t queue_id; uint32_t free_thresh; struct rte_mempool *txdesc_pool; + const struct rte_memzone *tx_rndis_mz; void *tx_rndis; + rte_iova_t tx_rndis_iova; /* Applied packet transmission aggregation limits. */ uint32_t agg_szmax; -- 2.27.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-11-09 18:40:13.027533497 +0000 +++ 0047-net-netvsc-allocate-contiguous-physical-memory-for-R.patch 2020-11-09 18:40:11.171311905 +0000 @@ -1 +1 @@ -From b8c3c628aff6defbabf677b4eea14c0529486357 Mon Sep 17 00:00:00 2001 +From e896b661e65b9efc015818b9a10a25c3f73e5f5b Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit b8c3c628aff6defbabf677b4eea14c0529486357 ] + @@ -12,2 +13,0 @@ -Cc: stable@dpdk.org - @@ -21 +21 @@ -index 5d59db513c..d8aa0996e7 100644 +index 4286b6b463..c0965ab420 100644 @@ -52 +52 @@ -@@ -366,7 +371,7 @@ hn_dev_tx_queue_release(void *arg) +@@ -357,7 +362,7 @@ hn_dev_tx_queue_release(void *arg) @@ -61 +61 @@ -@@ -1445,12 +1450,8 @@ static int hn_xmit_sg(struct hn_tx_queue *txq, +@@ -1356,12 +1361,8 @@ static int hn_xmit_sg(struct hn_tx_queue *txq, @@ -77 +77 @@ -index 56bfa972d1..20bb3c38dc 100644 +index a4d47abca3..44c9db95a6 100644 @@ -80 +80 @@ -@@ -54,7 +54,9 @@ struct hn_tx_queue { +@@ -53,7 +53,9 @@ struct hn_tx_queue {