From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Long Li <longli@microsoft.com>, kernel test robot <lkp@intel.com>,
Jakub Kicinski <kuba@kernel.org>, Sasha Levin <sashal@kernel.org>
Subject: [PATCH 5.10 53/73] hv_netvsc: Wait for completion on request SWITCH_DATA_PATH
Date: Wed, 13 Mar 2024 12:46:20 -0400 [thread overview]
Message-ID: <20240313164640.616049-54-sashal@kernel.org> (raw)
In-Reply-To: <20240313164640.616049-1-sashal@kernel.org>
From: Long Li <longli@microsoft.com>
[ Upstream commit 8b31f8c982b738e4130539e47f03967c599d8e22 ]
The completion indicates if NVSP_MSG4_TYPE_SWITCH_DATA_PATH has been
processed by the VSP. The traffic is steered to VF or synthetic after we
receive this completion.
Signed-off-by: Long Li <longli@microsoft.com>
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Stable-dep-of: 9cae43da9867 ("hv_netvsc: Register VF in netvsc_probe if NET_DEVICE_REGISTER missed")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/hyperv/netvsc.c | 37 ++++++++++++++++++++++++++++++---
drivers/net/hyperv/netvsc_drv.c | 1 -
2 files changed, 34 insertions(+), 4 deletions(-)
diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c
index c9b73a0448813..03333a4136bf4 100644
--- a/drivers/net/hyperv/netvsc.c
+++ b/drivers/net/hyperv/netvsc.c
@@ -37,6 +37,10 @@ void netvsc_switch_datapath(struct net_device *ndev, bool vf)
struct netvsc_device *nv_dev = rtnl_dereference(net_device_ctx->nvdev);
struct nvsp_message *init_pkt = &nv_dev->channel_init_pkt;
+ /* Block sending traffic to VF if it's about to be gone */
+ if (!vf)
+ net_device_ctx->data_path_is_vf = vf;
+
memset(init_pkt, 0, sizeof(struct nvsp_message));
init_pkt->hdr.msg_type = NVSP_MSG4_TYPE_SWITCH_DATA_PATH;
if (vf)
@@ -50,8 +54,11 @@ void netvsc_switch_datapath(struct net_device *ndev, bool vf)
vmbus_sendpacket(dev->channel, init_pkt,
sizeof(struct nvsp_message),
- VMBUS_RQST_ID_NO_RESPONSE,
- VM_PKT_DATA_INBAND, 0);
+ (unsigned long)init_pkt,
+ VM_PKT_DATA_INBAND,
+ VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
+ wait_for_completion(&nv_dev->channel_init_wait);
+ net_device_ctx->data_path_is_vf = vf;
}
/* Worker to setup sub channels on initial setup
@@ -757,8 +764,31 @@ static void netvsc_send_completion(struct net_device *ndev,
const struct vmpacket_descriptor *desc,
int budget)
{
- const struct nvsp_message *nvsp_packet = hv_pkt_data(desc);
+ const struct nvsp_message *nvsp_packet;
u32 msglen = hv_pkt_datalen(desc);
+ struct nvsp_message *pkt_rqst;
+ u64 cmd_rqst;
+
+ /* First check if this is a VMBUS completion without data payload */
+ if (!msglen) {
+ cmd_rqst = vmbus_request_addr(&incoming_channel->requestor,
+ (u64)desc->trans_id);
+ if (cmd_rqst == VMBUS_RQST_ERROR) {
+ netdev_err(ndev, "Invalid transaction id\n");
+ return;
+ }
+
+ pkt_rqst = (struct nvsp_message *)(uintptr_t)cmd_rqst;
+ switch (pkt_rqst->hdr.msg_type) {
+ case NVSP_MSG4_TYPE_SWITCH_DATA_PATH:
+ complete(&net_device->channel_init_wait);
+ break;
+
+ default:
+ netdev_err(ndev, "Unexpected VMBUS completion!!\n");
+ }
+ return;
+ }
/* Ensure packet is big enough to read header fields */
if (msglen < sizeof(struct nvsp_message_header)) {
@@ -766,6 +796,7 @@ static void netvsc_send_completion(struct net_device *ndev,
return;
}
+ nvsp_packet = hv_pkt_data(desc);
switch (nvsp_packet->hdr.msg_type) {
case NVSP_MSG_TYPE_INIT_COMPLETE:
if (msglen < sizeof(struct nvsp_message_header) +
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index 790bf750281ad..57a5ec098e7e0 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -2429,7 +2429,6 @@ static int netvsc_vf_changed(struct net_device *vf_netdev)
if (net_device_ctx->data_path_is_vf == vf_is_up)
return NOTIFY_OK;
- net_device_ctx->data_path_is_vf = vf_is_up;
if (vf_is_up && !net_device_ctx->vf_alloc) {
netdev_info(ndev, "Waiting for the VF association from host\n");
--
2.43.0
next prev parent reply other threads:[~2024-03-13 16:47 UTC|newest]
Thread overview: 98+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-13 16:45 [PATCH 5.10 00/73] 5.10.213-rc1 review Sasha Levin
2024-03-13 16:45 ` [PATCH 5.10 01/73] mmc: mmci: stm32: use a buffer for unaligned DMA requests Sasha Levin
2024-03-13 16:45 ` [PATCH 5.10 02/73] mmc: mmci: stm32: fix DMA API overlapping mappings warning Sasha Levin
2024-03-13 16:45 ` [PATCH 5.10 03/73] lan78xx: Fix white space and style issues Sasha Levin
2024-03-13 16:45 ` [PATCH 5.10 04/73] lan78xx: Add missing return code checks Sasha Levin
2024-03-13 16:45 ` [PATCH 5.10 05/73] lan78xx: Fix partial packet errors on suspend/resume Sasha Levin
2024-03-13 16:45 ` [PATCH 5.10 06/73] lan78xx: Fix race conditions in suspend/resume handling Sasha Levin
2024-03-13 16:45 ` [PATCH 5.10 07/73] net: lan78xx: fix runtime PM count underflow on link stop Sasha Levin
2024-03-13 16:45 ` [PATCH 5.10 08/73] ixgbe: {dis, en}able irqs in ixgbe_txrx_ring_{dis, en}able Sasha Levin
2024-03-13 16:45 ` [PATCH 5.10 09/73] i40e: disable NAPI right after disabling irqs when handling xsk_pool Sasha Levin
2024-03-13 16:45 ` [PATCH 5.10 10/73] tracing/net_sched: Fix tracepoints that save qdisc_dev() as a string Sasha Levin
2024-03-13 16:45 ` [PATCH 5.10 11/73] geneve: make sure to pull inner header in geneve_rx() Sasha Levin
2024-03-13 16:45 ` [PATCH 5.10 12/73] net: ice: Fix potential NULL pointer dereference in ice_bridge_setlink() Sasha Levin
2024-03-13 16:45 ` [PATCH 5.10 13/73] net/ipv6: avoid possible UAF in ip6_route_mpath_notify() Sasha Levin
2024-03-13 16:45 ` [PATCH 5.10 14/73] cpumap: Zero-initialise xdp_rxq_info struct before running XDP program Sasha Levin
2024-03-13 16:45 ` [PATCH 5.10 15/73] net/rds: fix WARNING in rds_conn_connect_if_down Sasha Levin
2024-03-13 16:45 ` [PATCH 5.10 16/73] netfilter: nft_ct: fix l3num expectations with inet pseudo family Sasha Levin
2024-03-13 16:45 ` [PATCH 5.10 17/73] netfilter: nf_conntrack_h323: Add protection for bmp length out of range Sasha Levin
2024-03-13 16:45 ` [PATCH 5.10 18/73] netrom: Fix a data-race around sysctl_netrom_default_path_quality Sasha Levin
2024-03-13 16:45 ` [PATCH 5.10 19/73] netrom: Fix a data-race around sysctl_netrom_obsolescence_count_initialiser Sasha Levin
2024-03-13 16:45 ` [PATCH 5.10 20/73] netrom: Fix data-races around sysctl_netrom_network_ttl_initialiser Sasha Levin
2024-03-13 16:45 ` [PATCH 5.10 21/73] netrom: Fix a data-race around sysctl_netrom_transport_timeout Sasha Levin
2024-03-13 16:45 ` [PATCH 5.10 22/73] netrom: Fix a data-race around sysctl_netrom_transport_maximum_tries Sasha Levin
2024-03-13 16:45 ` [PATCH 5.10 23/73] netrom: Fix a data-race around sysctl_netrom_transport_acknowledge_delay Sasha Levin
2024-03-13 16:45 ` [PATCH 5.10 24/73] netrom: Fix a data-race around sysctl_netrom_transport_busy_delay Sasha Levin
2024-03-13 16:45 ` [PATCH 5.10 25/73] netrom: Fix a data-race around sysctl_netrom_transport_requested_window_size Sasha Levin
2024-03-13 16:45 ` [PATCH 5.10 26/73] netrom: Fix a data-race around sysctl_netrom_transport_no_activity_timeout Sasha Levin
2024-03-13 16:45 ` [PATCH 5.10 27/73] netrom: Fix a data-race around sysctl_netrom_routing_control Sasha Levin
2024-03-13 16:45 ` [PATCH 5.10 28/73] netrom: Fix a data-race around sysctl_netrom_link_fails_count Sasha Levin
2024-03-13 16:45 ` [PATCH 5.10 29/73] netrom: Fix data-races around sysctl_net_busy_read Sasha Levin
2024-03-13 16:45 ` [PATCH 5.10 30/73] selftests/mm: switch to bash from sh Sasha Levin
2024-03-13 16:45 ` [PATCH 5.10 31/73] selftests: mm: fix map_hugetlb failure on 64K page size systems Sasha Levin
2024-03-13 16:45 ` [PATCH 5.10 32/73] um: allow not setting extra rpaths in the linux binary Sasha Levin
2024-03-13 16:46 ` [PATCH 5.10 33/73] xhci: remove extra loop in interrupt context Sasha Levin
2024-03-13 16:46 ` [PATCH 5.10 34/73] xhci: prevent double-fetch of transfer and transfer event TRBs Sasha Levin
2024-03-13 16:46 ` [PATCH 5.10 35/73] xhci: process isoc TD properly when there was a transaction error mid TD Sasha Levin
2024-03-13 16:46 ` [PATCH 5.10 36/73] xhci: handle isoc Babble and Buffer Overrun events properly Sasha Levin
2024-03-13 16:46 ` [PATCH 5.10 37/73] serial: max310x: Use devm_clk_get_optional() to get the input clock Sasha Levin
2024-03-13 16:46 ` [PATCH 5.10 38/73] serial: max310x: Try to get crystal clock rate from property Sasha Levin
2024-03-13 16:46 ` [PATCH 5.10 39/73] serial: max310x: fail probe if clock crystal is unstable Sasha Levin
2024-03-13 16:46 ` [PATCH 5.10 40/73] serial: max310x: Make use of device properties Sasha Levin
2024-03-13 16:46 ` [PATCH 5.10 41/73] serial: max310x: use regmap methods for SPI batch operations Sasha Levin
2024-03-13 16:46 ` [PATCH 5.10 42/73] serial: max310x: use a separate regmap for each port Sasha Levin
2024-03-13 16:46 ` [PATCH 5.10 43/73] serial: max310x: prevent infinite while() loop in port startup Sasha Levin
2024-03-13 16:46 ` [PATCH 5.10 44/73] net: Change sock_getsockopt() to take the sk ptr instead of the sock ptr Sasha Levin
2024-03-13 16:46 ` [PATCH 5.10 45/73] bpf: net: Change sk_getsockopt() to take the sockptr_t argument Sasha Levin
2024-03-13 16:46 ` [PATCH 5.10 46/73] lsm: make security_socket_getpeersec_stream() sockptr_t safe Sasha Levin
2024-03-13 16:46 ` [PATCH 5.10 47/73] lsm: fix default return value of the socket_getpeersec_*() hooks Sasha Levin
2024-03-13 16:46 ` [PATCH 5.10 48/73] ext4: make ext4_es_insert_extent() return void Sasha Levin
2024-03-13 16:46 ` [PATCH 5.10 49/73] ext4: refactor ext4_da_map_blocks() Sasha Levin
2024-03-13 16:46 ` [PATCH 5.10 50/73] ext4: convert to exclusive lock while inserting delalloc extents Sasha Levin
2024-03-13 16:46 ` [PATCH 5.10 51/73] Drivers: hv: vmbus: Add vmbus_requestor data structure for VMBus hardening Sasha Levin
2024-03-13 16:46 ` [PATCH 5.10 52/73] hv_netvsc: Use vmbus_requestor to generate transaction IDs " Sasha Levin
2024-03-13 16:46 ` Sasha Levin [this message]
2024-03-13 16:46 ` [PATCH 5.10 54/73] hv_netvsc: Process NETDEV_GOING_DOWN on VF hot remove Sasha Levin
2024-03-13 16:46 ` [PATCH 5.10 55/73] hv_netvsc: Make netvsc/VF binding check both MAC and serial number Sasha Levin
2024-03-13 16:46 ` [PATCH 5.10 56/73] hv_netvsc: use netif_is_bond_master() instead of open code Sasha Levin
2024-03-13 16:46 ` [PATCH 5.10 57/73] hv_netvsc: Register VF in netvsc_probe if NET_DEVICE_REGISTER missed Sasha Levin
2024-03-13 16:46 ` [PATCH 5.10 58/73] mm/hugetlb: change hugetlb_reserve_pages() to type bool Sasha Levin
2024-03-13 16:46 ` [PATCH 5.10 59/73] mm: hugetlb pages should not be reserved by shmat() if SHM_NORESERVE Sasha Levin
2024-03-13 16:46 ` [PATCH 5.10 60/73] getrusage: add the "signal_struct *sig" local variable Sasha Levin
2024-03-13 16:46 ` [PATCH 5.10 61/73] getrusage: move thread_group_cputime_adjusted() outside of lock_task_sighand() Sasha Levin
2024-03-13 16:46 ` [PATCH 5.10 62/73] getrusage: use __for_each_thread() Sasha Levin
2024-03-13 16:46 ` [PATCH 5.10 63/73] getrusage: use sig->stats_lock rather than lock_task_sighand() Sasha Levin
2024-03-13 16:46 ` [PATCH 5.10 64/73] exit: Fix typo in comment: s/sub-theads/sub-threads Sasha Levin
2024-03-13 16:46 ` [PATCH 5.10 65/73] exit: wait_task_zombie: kill the no longer necessary spin_lock_irq(siglock) Sasha Levin
2024-03-13 17:03 ` Oleg Nesterov
2024-03-13 20:10 ` Sasha Levin
2024-03-13 16:46 ` [PATCH 5.10 66/73] serial: max310x: Unprepare and disable clock in error path Sasha Levin
2024-03-13 16:46 ` [PATCH 5.10 67/73] Drivers: hv: vmbus: Drop error message when 'No request id available' Sasha Levin
2024-03-13 16:46 ` [PATCH 5.10 68/73] regmap: allow to define reg_update_bits for no bus configuration Sasha Levin
2024-03-13 16:52 ` Mark Brown
2024-03-13 16:46 ` [PATCH 5.10 69/73] regmap: Add bulk read/write callbacks into regmap_config Sasha Levin
2024-03-13 16:53 ` Mark Brown
2024-03-13 16:46 ` [PATCH 5.10 70/73] serial: max310x: make accessing revision id interface-agnostic Sasha Levin
2024-03-13 16:46 ` [PATCH 5.10 71/73] serial: max310x: implement I2C support Sasha Levin
2024-03-13 16:46 ` [PATCH 5.10 72/73] serial: max310x: fix IO data corruption in batched operations Sasha Levin
2024-03-13 16:46 ` [PATCH 5.10 73/73] Linux 5.10.213-rc1 Sasha Levin
2024-03-13 20:05 ` [PATCH 5.10 00/73] 5.10.213-rc1 review Pavel Machek
2024-03-14 7:03 ` Dominique Martinet
2024-03-14 15:07 ` Daniel Díaz
2024-03-15 16:52 ` Sasha Levin
2024-03-14 14:50 ` Naresh Kamboju
2024-03-14 19:52 ` Florian Fainelli
2024-03-14 21:47 ` Salvatore Bonaccorso
2024-03-15 18:39 ` Sasha Levin
2024-03-26 6:59 ` Salvatore Bonaccorso
2024-03-27 13:45 ` Greg Kroah-Hartman
2024-03-15 10:48 ` Shreeya Patel
2024-03-20 13:41 ` Pavel Machek
2024-03-20 20:03 ` Marek Vasut
2024-03-22 9:48 ` Pavel Machek
2024-03-22 11:23 ` Marek Vasut
2024-03-22 13:35 ` Pavel Machek
2024-03-20 13:44 ` btrfs fix missing in 5.10-stable was " Pavel Machek
2024-03-20 22:12 ` Sasha Levin
2024-03-25 6:55 ` Daniel Díaz
2024-03-25 15:20 ` Daniel Díaz
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=20240313164640.616049-54-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=longli@microsoft.com \
--cc=stable@vger.kernel.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
Powered by JetHome