Skip to contentSkip to conversation

station: Remove diagnostics interface reliably

PATCH Applied Andrew Zaborowski 2 participants 9 messages Jun 18, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 station: Remove diagnostics interface reliably

If the idea is that the interface should only be present when connected then don't do this in the DISCONNECTING state as there are various possible transitions from CONNECTED or ROAMING directly to DISCONNECTED.

---
 src/station.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
src/station.c +2 -3
index 5b8b61b4..11711973 100644
@@ -1211,9 +1211,6 @@ static void station_enter_state(struct station *station,
 		periodic_scan_stop(station);
 		break;
 	case STATION_STATE_DISCONNECTING:
-		l_dbus_object_remove_interface(dbus_get_bus(),
-					netdev_get_path(station->netdev),
-					IWD_STATION_DIAGNOSTIC_INTERFACE);
 		break;
 	case STATION_STATE_ROAMING:
 		break;
@@ -1317,6 +1314,8 @@ static void station_reset_connection_state(struct station *station)
 				IWD_STATION_INTERFACE, "ConnectedNetwork");
 	l_dbus_property_changed(dbus, network_get_path(network),
 				IWD_NETWORK_INTERFACE, "Connected");
+	l_dbus_object_remove_interface(dbus, netdev_get_path(station->netdev),
+				IWD_STATION_DIAGNOSTIC_INTERFACE);
 }
 
 static void station_disassociated(struct station *station)
Signature · 1 line
2.30.2
#1 lore raw

PATCH 2/3 station: Check if busy in station_get_diagnostics

---
 src/station.c | 3 +++
 1 file changed, 3 insertions(+)
src/station.c +3 -0
index 11711973..0b0cc59c 100644
@@ -3768,6 +3768,9 @@ static struct l_dbus_message *station_get_diagnostics(struct l_dbus *dbus,
 	struct station *station = user_data;
 	int ret;
 
+	if (station->get_station_pending)
+		return dbus_error_busy(message);
+
 	ret = netdev_get_current_station(station->netdev,
 				station_get_diagnostic_cb, station,
 				station_get_diagnostic_destroy);
Signature · 1 line
2.30.2
#2 lore raw

Re: [PATCH 2/3] station: Check if busy in station_get_diagnostics

Hi Andrew,

Quoted 4 lines · Andrew Zaborowski
---
  src/station.c | 3 +++
  1 file changed, 3 insertions(+)

Applied, thanks.

Regards,
-Denis

#3 lore raw

PATCH 3/3 station: Stop periodic scan when netdev connected

In reply to Andrew Zaborowski

For consistency call periodic_scan_stop() right after netdev signals connected even if station stays in the CONNECTING state because it's waiting for netconfig to finish.

---
 src/station.c | 1 +
 1 file changed, 1 insertion(+)
src/station.c +1 -0
index 0b0cc59c..66ddc76e 100644
@@ -2468,6 +2468,7 @@ static void station_connect_ok(struct station *station)
 	}
 
 	network_connected(station->connected_network);
+	periodic_scan_stop(station);
 
 	if (station->netconfig)
 		netconfig_configure(station->netconfig,
Signature · 1 line
2.30.2
#4 lore raw

Re: [PATCH 3/3] station: Stop periodic scan when netdev connected

Hi Andrew,

Quoted 3 lines · Andrew Zaborowski

For consistency call periodic_scan_stop() right after netdev signals connected even if station stays in the CONNECTING state because it's waiting for netconfig to finish.

Hmm, why is this needed? We should be calling periodic_scan_stop as soon as we transition to CONNECTING/CONNECTING_AUTO state. In fact, even the periodic_scan_stop on transition to CONNECTED seems suspicious now.

Might be helpful to include an actual log of the issue you're fixing in the commit description?

Quoted 4 lines
---
  src/station.c | 1 +
  1 file changed, 1 insertion(+)

Regards,
-Denis

#5 lore raw

Re: [PATCH 3/3] station: Stop periodic scan when netdev connected

Quoted 7 lines · Denis Kenzior
Quoted 3 lines · Andrew Zaborowski

For consistency call periodic_scan_stop() right after netdev signals connected even if station stays in the CONNECTING state because it's waiting for netconfig to finish.

Hmm, why is this needed? We should be calling periodic_scan_stop as soon as we transition to CONNECTING/CONNECTING_AUTO state.

That's another option but I think the logic until now was that if the connection failed we'd just return to periodic scanning without ever stopping and restarting it. During the netdev CMD_CONNECT it would be inhibited by the kernel or by the radio work. We only needed to explicitly stop the scanning when CMD_CONNECT succeeded, so that's what I was trying to restore in this patch, otherwise if we were unlucky we might have been scanning during the netconfig.

Best regards

#6 lore raw

Re: [PATCH 3/3] station: Stop periodic scan when netdev connected

Hi Andrew,

Quoted 6 lines · Andrew Zaborowski
Quoted 5 lines · Denis Kenzior
Quoted 3 lines · Andrew Zaborowski

For consistency call periodic_scan_stop() right after netdev signals connected even if station stays in the CONNECTING state because it's waiting for netconfig to finish.

Quoted 6 lines
Quoted 2 lines

Hmm, why is this needed? We should be calling periodic_scan_stop as soon as we transition to CONNECTING/CONNECTING_AUTO state.

That's another option but I think the logic until now was that if the connection failed we'd just return to periodic scanning without ever stopping and restarting it. During the netdev CMD_CONNECT it would be

I don't think so. See commit c3e160880f32f and commit da485179a6e92 prior to that. It looks like we have stopped periodic scan when entering CONNECTING state for quite some time.

Quoted 4 lines

inhibited by the kernel or by the radio work. We only needed to explicitly stop the scanning when CMD_CONNECT succeeded, so that's what I was trying to restore in this patch, otherwise if we were unlucky we might have been scanning during the netconfig.

Fair enough, but it doesn't look like your patch does that since we stop the periodic scan when we reach CONNECTING state today.

Regards,
-Denis

#7 lore raw

Re: [PATCH 3/3] station: Stop periodic scan when netdev connected

Quoted 5 lines · Denis Kenzior
Quoted 4 lines · Andrew Zaborowski
Quoted 2 lines · Denis Kenzior

We should be calling periodic_scan_stop as soon as we
transition to CONNECTING/CONNECTING_AUTO state.

Quoted 7 lines
Quoted 3 lines

That's another option but I think the logic until now was that if the connection failed we'd just return to periodic scanning without ever stopping and restarting it. During the netdev CMD_CONNECT it would be

I don't think so. See commit c3e160880f32f and commit da485179a6e92 prior to that. It looks like we have stopped periodic scan when entering CONNECTING state for quite some time.

True, I missed this. Please ignore this patch.

Best regards

#8 lore raw
In reply to Andrew Zaborowski

Hi Andrew,

Quoted 7 lines · Andrew Zaborowski

If the idea is that the interface should only be present when connected then don't do this in the DISCONNECTING state as there are various possible transitions from CONNECTED or ROAMING directly to DISCONNECTED.

---
  src/station.c | 5 ++---
  1 file changed, 2 insertions(+), 3 deletions(-)

Applied, thanks.

Regards,
-Denis