patches for DPDK stable branches
 help / color / mirror / Atom feed
From: luca.boccassi@gmail.com
To: Long Li <longli@microsoft.com>
Cc: Stephen Hemminger <stephen@networkplumber.org>,
	dpdk stable <stable@dpdk.org>
Subject: patch 'net/netvsc: fix vmbus device reference in multi-process' has been queued to stable release 21.11.2
Date: Wed,  6 Jul 2022 21:34:45 +0100	[thread overview]
Message-ID: <20220706203506.3422496-10-luca.boccassi@gmail.com> (raw)
In-Reply-To: <20220706203506.3422496-1-luca.boccassi@gmail.com>

Hi,

FYI, your patch has been queued to stable release 21.11.2

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 07/08/22. 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/kevintraynor/dpdk-stable

This queued commit can be viewed at:
https://github.com/kevintraynor/dpdk-stable/commit/3287afa5e81416f0fc06e860c0e5ebfc860790d1

Thanks.

Luca Boccassi

---
From 3287afa5e81416f0fc06e860c0e5ebfc860790d1 Mon Sep 17 00:00:00 2001
From: Long Li <longli@microsoft.com>
Date: Wed, 29 Jun 2022 16:29:44 -0700
Subject: [PATCH] net/netvsc: fix vmbus device reference in multi-process

[ upstream commit 7b1a614dcbe2017f1984be28a01efabcd7fed8b8 ]

The vmbus device is allocated via "calloc" before the EAL memory is
initialized. The secondary process can't reference the vmbus device as
it is not mapped correctly in the shared memory region.

Replace all references to the vmbus device (and its contents) with the
pointers/contents set by the primary process.

Fixes: 4e9c73e96e ("net/netvsc: add Hyper-V network device")

Signed-off-by: Long Li <longli@microsoft.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/bus/vmbus/private.h       |  2 ++
 drivers/bus/vmbus/vmbus_channel.c | 15 +++++++--------
 drivers/net/netvsc/hn_ethdev.c    |  4 ++--
 drivers/net/netvsc/hn_nvs.c       | 14 +++++++-------
 drivers/net/netvsc/hn_rxtx.c      |  8 ++++----
 drivers/net/netvsc/hn_var.h       |  4 ++--
 6 files changed, 24 insertions(+), 23 deletions(-)

diff --git a/drivers/bus/vmbus/private.h b/drivers/bus/vmbus/private.h
index 1bca147e12..658303bc27 100644
--- a/drivers/bus/vmbus/private.h
+++ b/drivers/bus/vmbus/private.h
@@ -74,6 +74,8 @@ struct vmbus_channel {
 	uint16_t relid;
 	uint16_t subchannel_id;
 	uint8_t monitor_id;
+
+	struct vmbus_mon_page *monitor_page;
 };
 
 #define VMBUS_MAX_CHANNELS	64
diff --git a/drivers/bus/vmbus/vmbus_channel.c b/drivers/bus/vmbus/vmbus_channel.c
index 119b9b367e..9bd01679c3 100644
--- a/drivers/bus/vmbus/vmbus_channel.c
+++ b/drivers/bus/vmbus/vmbus_channel.c
@@ -27,7 +27,7 @@ vmbus_sync_set_bit(volatile uint32_t *addr, uint32_t mask)
 }
 
 static inline void
-vmbus_set_monitor(const struct rte_vmbus_device *dev, uint32_t monitor_id)
+vmbus_set_monitor(const struct vmbus_channel *channel, uint32_t monitor_id)
 {
 	uint32_t *monitor_addr, monitor_mask;
 	unsigned int trigger_index;
@@ -35,15 +35,14 @@ vmbus_set_monitor(const struct rte_vmbus_device *dev, uint32_t monitor_id)
 	trigger_index = monitor_id / HV_MON_TRIG_LEN;
 	monitor_mask = 1u << (monitor_id % HV_MON_TRIG_LEN);
 
-	monitor_addr = &dev->monitor_page->trigs[trigger_index].pending;
+	monitor_addr = &channel->monitor_page->trigs[trigger_index].pending;
 	vmbus_sync_set_bit(monitor_addr, monitor_mask);
 }
 
 static void
-vmbus_set_event(const struct rte_vmbus_device *dev,
-		const struct vmbus_channel *chan)
+vmbus_set_event(const struct vmbus_channel *chan)
 {
-	vmbus_set_monitor(dev, chan->monitor_id);
+	vmbus_set_monitor(chan, chan->monitor_id);
 }
 
 /*
@@ -81,7 +80,6 @@ rte_vmbus_set_latency(const struct rte_vmbus_device *dev,
 void
 rte_vmbus_chan_signal_tx(const struct vmbus_channel *chan)
 {
-	const struct rte_vmbus_device *dev = chan->device;
 	const struct vmbus_br *tbr = &chan->txbr;
 
 	/* Make sure all updates are done before signaling host */
@@ -91,7 +89,7 @@ rte_vmbus_chan_signal_tx(const struct vmbus_channel *chan)
 	if (tbr->vbr->imask)
 		return;
 
-	vmbus_set_event(dev, chan);
+	vmbus_set_event(chan);
 }
 
 
@@ -218,7 +216,7 @@ void rte_vmbus_chan_signal_read(struct vmbus_channel *chan, uint32_t bytes_read)
 	if (write_sz <= pending_sz)
 		return;
 
-	vmbus_set_event(chan->device, chan);
+	vmbus_set_event(chan);
 }
 
 int rte_vmbus_chan_recv(struct vmbus_channel *chan, void *data, uint32_t *len,
@@ -325,6 +323,7 @@ int vmbus_chan_create(const struct rte_vmbus_device *device,
 	chan->subchannel_id = subid;
 	chan->relid = relid;
 	chan->monitor_id = monitor_id;
+	chan->monitor_page = device->monitor_page;
 	*new_chan = chan;
 
 	err = vmbus_uio_map_rings(chan);
diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c
index 0a357d3645..787139c0b2 100644
--- a/drivers/net/netvsc/hn_ethdev.c
+++ b/drivers/net/netvsc/hn_ethdev.c
@@ -1169,8 +1169,8 @@ eth_hn_dev_init(struct rte_eth_dev *eth_dev)
 	}
 
 	hv->vmbus = vmbus;
-	hv->rxbuf_res = &vmbus->resource[HV_RECV_BUF_MAP];
-	hv->chim_res  = &vmbus->resource[HV_SEND_BUF_MAP];
+	hv->rxbuf_res = vmbus->resource[HV_RECV_BUF_MAP];
+	hv->chim_res  = vmbus->resource[HV_SEND_BUF_MAP];
 	hv->port_id = eth_dev->data->port_id;
 	hv->latency = HN_CHAN_LATENCY_NS;
 	hv->rx_copybreak = HN_RXCOPY_THRESHOLD;
diff --git a/drivers/net/netvsc/hn_nvs.c b/drivers/net/netvsc/hn_nvs.c
index a29ac18ff4..b90280c9ff 100644
--- a/drivers/net/netvsc/hn_nvs.c
+++ b/drivers/net/netvsc/hn_nvs.c
@@ -193,11 +193,11 @@ hn_nvs_conn_rxbuf(struct hn_data *hv)
 	 * Connect RXBUF to NVS.
 	 */
 	conn.type = NVS_TYPE_RXBUF_CONN;
-	conn.gpadl = hv->rxbuf_res->phys_addr;
+	conn.gpadl = hv->rxbuf_res.phys_addr;
 	conn.sig = NVS_RXBUF_SIG;
 	PMD_DRV_LOG(DEBUG, "connect rxbuff va=%p gpad=%#" PRIx64,
-		    hv->rxbuf_res->addr,
-		    hv->rxbuf_res->phys_addr);
+		    hv->rxbuf_res.addr,
+		    hv->rxbuf_res.phys_addr);
 
 	error = hn_nvs_execute(hv, &conn, sizeof(conn),
 			       &resp, sizeof(resp),
@@ -308,17 +308,17 @@ hn_nvs_conn_chim(struct hn_data *hv)
 	struct hn_nvs_chim_conn chim;
 	struct hn_nvs_chim_connresp resp;
 	uint32_t sectsz;
-	unsigned long len = hv->chim_res->len;
+	unsigned long len = hv->chim_res.len;
 	int error;
 
 	/* Connect chimney sending buffer to NVS */
 	memset(&chim, 0, sizeof(chim));
 	chim.type = NVS_TYPE_CHIM_CONN;
-	chim.gpadl = hv->chim_res->phys_addr;
+	chim.gpadl = hv->chim_res.phys_addr;
 	chim.sig = NVS_CHIM_SIG;
 	PMD_DRV_LOG(DEBUG, "connect send buf va=%p gpad=%#" PRIx64,
-		    hv->chim_res->addr,
-		    hv->chim_res->phys_addr);
+		    hv->chim_res.addr,
+		    hv->chim_res.phys_addr);
 
 	error = hn_nvs_execute(hv, &chim, sizeof(chim),
 			       &resp, sizeof(resp),
diff --git a/drivers/net/netvsc/hn_rxtx.c b/drivers/net/netvsc/hn_rxtx.c
index bf33bb031e..7a3bd523a5 100644
--- a/drivers/net/netvsc/hn_rxtx.c
+++ b/drivers/net/netvsc/hn_rxtx.c
@@ -582,7 +582,7 @@ static void hn_rxpkt(struct hn_rx_queue *rxq, struct hn_rx_bufinfo *rxb,
 		 * Use refcount to handle multiple packets in same
 		 * receive buffer section.
 		 */
-		rxbuf = hv->rxbuf_res->addr;
+		rxbuf = hv->rxbuf_res.addr;
 		iova = rte_mem_virt2iova(rxbuf) + RTE_PTR_DIFF(data, rxbuf);
 		shinfo = &rxb->shinfo;
 
@@ -765,8 +765,8 @@ hn_nvs_handle_rxbuf(struct rte_eth_dev *dev,
 {
 	const struct vmbus_chanpkt_rxbuf *pkt;
 	const struct hn_nvs_hdr *nvs_hdr = buf;
-	uint32_t rxbuf_sz = hv->rxbuf_res->len;
-	char *rxbuf = hv->rxbuf_res->addr;
+	uint32_t rxbuf_sz = hv->rxbuf_res.len;
+	char *rxbuf = hv->rxbuf_res.addr;
 	unsigned int i, hlen, count;
 	struct hn_rx_bufinfo *rxb;
 
@@ -1266,7 +1266,7 @@ hn_try_txagg(struct hn_data *hv, struct hn_tx_queue *txq,
 	if (txd->chim_index == NVS_CHIM_IDX_INVALID)
 		return NULL;
 
-	chim = (uint8_t *)hv->chim_res->addr
+	chim = (uint8_t *)hv->chim_res.addr
 			+ txd->chim_index * hv->chim_szmax;
 
 	txq->agg_txd = txd;
diff --git a/drivers/net/netvsc/hn_var.h b/drivers/net/netvsc/hn_var.h
index 416c042a27..98a3b83033 100644
--- a/drivers/net/netvsc/hn_var.h
+++ b/drivers/net/netvsc/hn_var.h
@@ -147,7 +147,7 @@ struct hn_data {
 	uint32_t	link_status;
 	uint32_t	link_speed;
 
-	struct rte_mem_resource *rxbuf_res;	/* UIO resource for Rx */
+	struct rte_mem_resource rxbuf_res;	/* UIO resource for Rx */
 	uint32_t	rxbuf_section_cnt;	/* # of Rx sections */
 	uint32_t	rx_copybreak;
 	uint32_t	rx_extmbuf_enable;
@@ -156,7 +156,7 @@ struct hn_data {
 	uint64_t	rss_offloads;
 
 	rte_spinlock_t	chim_lock;
-	struct rte_mem_resource *chim_res;	/* UIO resource for Tx */
+	struct rte_mem_resource chim_res;	/* UIO resource for Tx */
 	struct rte_bitmap *chim_bmap;		/* Send buffer map */
 	void		*chim_bmem;
 	uint32_t	tx_copybreak;
-- 
2.34.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2022-07-06 21:07:53.916097388 +0100
+++ 0010-net-netvsc-fix-vmbus-device-reference-in-multi-proce.patch	2022-07-06 21:07:53.539518631 +0100
@@ -1 +1 @@
-From 7b1a614dcbe2017f1984be28a01efabcd7fed8b8 Mon Sep 17 00:00:00 2001
+From 3287afa5e81416f0fc06e860c0e5ebfc860790d1 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 7b1a614dcbe2017f1984be28a01efabcd7fed8b8 ]
+
@@ -14 +15,0 @@
-Cc: stable@dpdk.org
@@ -163 +164 @@
-index 1afc14f280..909c07a4ab 100644
+index bf33bb031e..7a3bd523a5 100644
@@ -166 +167 @@
-@@ -580,7 +580,7 @@ static void hn_rxpkt(struct hn_rx_queue *rxq, struct hn_rx_bufinfo *rxb,
+@@ -582,7 +582,7 @@ static void hn_rxpkt(struct hn_rx_queue *rxq, struct hn_rx_bufinfo *rxb,
@@ -175 +176 @@
-@@ -763,8 +763,8 @@ hn_nvs_handle_rxbuf(struct rte_eth_dev *dev,
+@@ -765,8 +765,8 @@ hn_nvs_handle_rxbuf(struct rte_eth_dev *dev,
@@ -186 +187 @@
-@@ -1264,7 +1264,7 @@ hn_try_txagg(struct hn_data *hv, struct hn_tx_queue *txq,
+@@ -1266,7 +1266,7 @@ hn_try_txagg(struct hn_data *hv, struct hn_tx_queue *txq,

  parent reply	other threads:[~2022-07-06 20:35 UTC|newest]

Thread overview: 67+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-28 15:19 patch 'raw/ioat: fix build missing errno include' " Kevin Traynor
2022-06-28 15:19 ` patch 'raw/ioat: fix build when ioat dmadev enabled' " Kevin Traynor
2022-06-28 15:19 ` patch 'dma/idxd: fix AVX2 in non-datapath functions' " Kevin Traynor
2022-06-28 15:19 ` patch 'dma/idxd: fix non-AVX builds with old compilers' " Kevin Traynor
2022-06-28 15:19 ` patch 'rib: fix references for IPv6 implementation' " Kevin Traynor
2022-06-28 15:19 ` patch 'test/hash: fix out of bound access' " Kevin Traynor
2022-06-28 15:19 ` patch 'app/procinfo: show all non-owned ports' " Kevin Traynor
2022-06-28 15:19 ` patch 'test: check memory allocation for CRC' " Kevin Traynor
2022-06-28 15:19 ` patch 'app/testpmd: cleanup port resources after implicit close' " Kevin Traynor
2022-06-28 15:19 ` patch 'app/testpmd: fix flex parser destroy command' " Kevin Traynor
2022-06-28 15:19 ` patch 'net: fix GTP PSC headers' " Kevin Traynor
2022-06-28 15:19 ` patch 'app/testpmd: fix GTP PSC raw processing' " Kevin Traynor
2022-06-28 15:19 ` patch 'net/hns3: fix link status capability query from VF' " Kevin Traynor
2022-06-28 15:19 ` patch 'net/hns3: support backplane media type' " Kevin Traynor
2022-06-28 15:19 ` patch 'net/hns3: fix PTP interrupt logging' " Kevin Traynor
2022-06-28 15:19 ` patch 'net/hns3: fix statistics locking' " Kevin Traynor
2022-06-28 15:19 ` patch 'net/hns3: fix descriptors check with SVE' " Kevin Traynor
2022-06-28 15:19 ` patch 'net/hns3: delete unused code' " Kevin Traynor
2022-06-28 15:19 ` patch 'examples/distributor: fix distributor on Rx core' " Kevin Traynor
2022-06-28 15:19 ` patch 'doc: add more instructions for running as non-root' " Kevin Traynor
2022-06-28 20:26   ` Dmitry Kozlyuk
2022-06-28 15:19 ` patch 'net/bnxt: fix switch domain allocation' " Kevin Traynor
2022-06-28 15:19 ` patch 'net/bnxt: allow Tx only or Rx only' " Kevin Traynor
2022-06-28 15:19 ` patch 'net/bnxt: fix setting forced speed' " Kevin Traynor
2022-06-28 15:19 ` patch 'net/bnxt: disallow MTU change when device is started' " Kevin Traynor
2022-06-28 15:19 ` patch 'net/bnxt: cleanup MTU setting' " Kevin Traynor
2022-06-28 15:19 ` patch 'net/bnxt: fix check for autoneg enablement in the PHY FW' " Kevin Traynor
2022-07-06 20:34   ` patch 'test/crypto: fix authentication IV for ZUC SGL' " luca.boccassi
2022-07-06 20:34     ` patch 'test/crypto: fix ZUC vector IV format' " luca.boccassi
2022-07-06 20:34     ` patch 'test/crypto: fix SNOW3G " luca.boccassi
2022-07-06 20:34     ` patch 'examples/fips_validation: handle empty payload' " luca.boccassi
2022-07-07  7:22       ` [EXT] " Gowrishankar Muthukrishnan
2022-07-07  7:31         ` Gowrishankar Muthukrishnan
2022-07-06 20:34     ` patch 'crypto/qat: fix DOCSIS crash' " luca.boccassi
2022-07-06 20:34     ` patch 'doc: fix grammar and formatting in compressdev guide' " luca.boccassi
2022-07-06 20:34     ` patch 'doc: fix grammar and parameters in l2fwd-crypto " luca.boccassi
2022-07-06 20:34     ` patch 'eventdev/eth_tx: fix queue delete' " luca.boccassi
2022-07-06 20:34     ` patch 'app/testpmd: fix supported RSS offload display' " luca.boccassi
2022-07-06 20:34     ` luca.boccassi [this message]
2022-07-06 20:34     ` patch 'net/virtio-user: fix socket non-blocking mode' " luca.boccassi
2022-07-06 20:34     ` patch 'doc: fix readability in vhost guide' " luca.boccassi
2022-07-06 20:34     ` patch 'net/vhost: fix deadlock on vring state change' " luca.boccassi
2022-07-06 20:34     ` patch 'vdpa/sfc: fix sync between QEMU and vhost-user' " luca.boccassi
2022-07-06 20:34     ` patch 'vhost: add some trailing newline in log messages' " luca.boccassi
2022-07-06 20:34     ` patch 'vhost: restore device information " luca.boccassi
2022-07-06 20:34     ` patch 'net/virtio-user: fix Rx interrupts with multi-queue' " luca.boccassi
2022-07-06 20:34     ` patch 'common/cnxk: fix GRE tunnel parsing' " luca.boccassi
2022-07-06 20:34     ` patch 'net/iavf: fix VF reset' " luca.boccassi
2022-07-06 20:34     ` patch 'net/igc: support multi-process' " luca.boccassi
2022-07-06 20:34     ` patch 'service: fix lingering active status' " luca.boccassi
2022-07-06 20:34     ` patch 'gro: fix identifying fragmented packets' " luca.boccassi
2022-07-06 20:34     ` patch 'common/cnxk: allow changing PTP mode on CN10K' " luca.boccassi
2022-07-06 20:34     ` patch 'common/mlx5: fix non-expandable global MR cache' " luca.boccassi
2022-07-06 20:35     ` patch 'net/mlx5: reject negative integrity item configuration' " luca.boccassi
2022-07-06 20:35     ` patch 'dma/idxd: fix memory leak in PCI close' " luca.boccassi
2022-07-06 20:35     ` patch 'dma/idxd: fix partial freeing " luca.boccassi
2022-07-06 20:35     ` patch 'dma/idxd: fix null dereference in PCI remove' " luca.boccassi
2022-07-06 20:35     ` patch 'app/regex: avoid division by zero' " luca.boccassi
2022-07-06 20:35     ` patch 'app/regex: fix mbuf size for multi-segment buffer' " luca.boccassi
2022-07-06 20:35     ` patch 'avoid AltiVec keyword vector' " luca.boccassi
2022-07-12 19:23       ` patch 'examples/link_status_interrupt: fix stats refresh rate' " luca.boccassi
2022-07-12 19:23         ` patch 'vdpa/mlx5: fix leak on event thread creation' " luca.boccassi
2022-07-12 19:23         ` patch 'vdpa/ifc/base: fix null pointer dereference' " luca.boccassi
2022-07-13  2:13           ` Pei, Andy
2022-07-12 19:23         ` patch 'vdpa/sfc: resolve race between vhost lib and device conf' " luca.boccassi
2022-07-12 19:23         ` patch 'net/iavf: fix GTP-U extension flow' " luca.boccassi
2022-07-12 19:23         ` patch 'app/testpmd: fix GTP PSC raw processing' " luca.boccassi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220706203506.3422496-10-luca.boccassi@gmail.com \
    --to=luca.boccassi@gmail.com \
    --cc=longli@microsoft.com \
    --cc=stable@dpdk.org \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).