Skip to contentSkip to conversation

hv_netvsc: rework link status change handling

PATCH Applied Vitaly Kuznetsov 2 participants 2 messages Nov 27, 2015 – Dec 1, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hv_netvsc: rework link status change handling

There are several issues in hv_netvsc driver with regards to link status change handling:
- RNDIS_STATUS_NETWORK_CHANGE results in calling userspace helper doing '/etc/init.d/network restart' and this is inappropriate and broken for many reasons.
- link_watch infrastructure only sends one notification per second and in case of e.g. paired disconnect/connect events we get only one notification with last status. This makes it impossible to handle such situations in userspace.

Redo link status changes handling in the following way:
- Create a list of reconfig events in network device context.
- On a reconfig event add it to the list of events and schedule netvsc_link_change().
- In netvsc_link_change() ensure 2-second delay between link status changes.
- Handle RNDIS_STATUS_NETWORK_CHANGE as a paired disconnect/connect event.

---
 drivers/net/hyperv/hyperv_net.h |  14 +++-
 drivers/net/hyperv/netvsc_drv.c | 142 +++++++++++++++++++++++++++-------------
 2 files changed, 108 insertions(+), 48 deletions(-)
drivers/net/hyperv/hyperv_net.h +13 -1
index 5fa98f5..7661a12 100644
@@ -177,7 +177,6 @@ struct rndis_device {
 
 	enum rndis_device_state state;
 	bool link_state;
-	bool link_change;
 	atomic_t new_req_id;
 
 	spinlock_t request_lock;
@@ -644,11 +643,24 @@ struct netvsc_stats {
 	struct u64_stats_sync syncp;
 };
 
+struct netvsc_reconfig {
+	struct list_head list;
+	u32 event;
+};
+
 /* The context of the netvsc device  */
 struct net_device_context {
 	/* point back to our device context */
 	struct hv_device *device_ctx;
+	/* reconfigure work */
 	struct delayed_work dwork;
+	/* last reconfig time */
+	unsigned long last_reconfig;
+	/* reconfig events */
+	struct list_head reconfig_events;
+	/* list protection */
+	spinlock_t lock;
+
 	struct work_struct work;
 	u32 msg_enable; /* debug level */
 
drivers/net/hyperv/netvsc_drv.c +95 -47

200 lines not on this page · raw message

Signature · 1 line
2.4.3
maintainer Applied
#1 lore raw

From: Vitaly Kuznetsov <[email protected]>
Date: Fri, 27 Nov 2015 11:39:55 +0100

Quoted 18 lines

There are several issues in hv_netvsc driver with regards to link status change handling:
- RNDIS_STATUS_NETWORK_CHANGE results in calling userspace helper doing '/etc/init.d/network restart' and this is inappropriate and broken for many reasons.
- link_watch infrastructure only sends one notification per second and in case of e.g. paired disconnect/connect events we get only one notification with last status. This makes it impossible to handle such situations in userspace.

Redo link status changes handling in the following way:
- Create a list of reconfig events in network device context.
- On a reconfig event add it to the list of events and schedule netvsc_link_change().
- In netvsc_link_change() ensure 2-second delay between link status changes.
- Handle RNDIS_STATUS_NETWORK_CHANGE as a paired disconnect/connect event.

Quoted 1 line

Applied, thank you.