Send connman mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
https://lists.01.org/mailman/listinfo/connman
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of connman digest..."
Today's Topics:
1. [PATCH] ntp: clear ADJ_MAXERROR to keep STA_UNSYNC cleared
after jump adjust (Alexander Kochetkov)
2. [PATCH] provider: Remove unnecessary condition check (Saurav Babu)
3. Re: [PATCHv2] service: Block auto connect when hidden
connection is in progress (Daniel Wagner)
4. Re: [PATCH] provider: Remove unnecessary condition check
(Daniel Wagner)
5. Re: [PATCH] ntp: clear ADJ_MAXERROR to keep STA_UNSYNC
cleared after jump adjust (Daniel Wagner)
6. Re: [PATCH] ntp: clear ADJ_MAXERROR to keep STA_UNSYNC
cleared after jump adjust (Jukka Rissanen)
7. Re: [PATCH] ntp: clear ADJ_MAXERROR to keep STA_UNSYNC
cleared after jump adjust (Alexander Kochetkov)
8. [PATCH v3 0/3] Add AlwaysConnectedTechnologies feature
(Ioan-Adrian Ratiu)
9. [PATCH v3 2/3] service: Implement AlwaysConnectedTechnologies
(Ioan-Adrian Ratiu)
----------------------------------------------------------------------
Message: 1
Date: Wed, 9 Nov 2016 00:03:43 +0300
From: Alexander Kochetkov <[email protected]>
To: [email protected]
Subject: [PATCH] ntp: clear ADJ_MAXERROR to keep STA_UNSYNC cleared
after jump adjust
Message-ID: <[email protected]>
NTP use jump adjust if system has incorrect time read from RTC during boot.
It is desireble to update RTC time as soon as NTP set correct system time.
Sometimes kernel failed to update RTC due to STA_UNSYNC get set before RTC
update finised. In that case RTC time wouldn't be updated within long time.
The commit makes RTC updates stable.
When NTP do jump time adjust using ADJ_SETOFFSET it clears STA_UNSYNC flag.
If don't clear ADJ_MAXERROR, STA_UNSYNC will be set again by kernel within
1 second (by second_overflow() function). STA_UNSYNC flag prevent RTC updates
in kernel. Sometimes the kernel is able to update RTC withing 1 second,
but sometimes it falied.
---
src/ntp.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/ntp.c b/src/ntp.c
index 7e66c9b..0e80c3e 100644
--- a/src/ntp.c
+++ b/src/ntp.c
@@ -351,11 +351,13 @@ static void decode_msg(void *base, size_t len, struct
timeval *tv,
connman_info("ntp: adjust (slew): %+.6f sec", offset);
} else {
- tmx.modes = ADJ_STATUS | ADJ_NANO | ADJ_SETOFFSET;
+ tmx.modes = ADJ_STATUS | ADJ_NANO | ADJ_SETOFFSET |
ADJ_MAXERROR | ADJ_ESTERROR;
/* ADJ_NANO uses nanoseconds in the microseconds field */
tmx.time.tv_sec = (long)offset;
tmx.time.tv_usec = (offset - tmx.time.tv_sec) * NSEC_PER_SEC;
+ tmx.maxerror = 0;
+ tmx.esterror = 0;
/* the kernel expects -0.3s as {-1, 7000.000.000} */
if (tmx.time.tv_usec < 0) {
--
1.7.9.5
------------------------------
Message: 2
Date: Wed, 09 Nov 2016 12:56:49 +0530
From: Saurav Babu <[email protected]>
To: [email protected]
Cc: [email protected], Saurav Babu <[email protected]>
Subject: [PATCH] provider: Remove unnecessary condition check
Message-ID: <[email protected]>
---
src/provider.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/src/provider.c b/src/provider.c
index 0726f4a..9c71a20 100644
--- a/src/provider.c
+++ b/src/provider.c
@@ -141,12 +141,8 @@ int connman_provider_disconnect(struct connman_provider
*provider)
provider_indicate_state(provider,
CONNMAN_SERVICE_STATE_DISCONNECT);
- if (err < 0) {
- if (err != -EINPROGRESS)
- return err;
-
- return -EINPROGRESS;
- }
+ if (err < 0)
+ return err;
if (provider->vpn_service)
provider_indicate_state(provider,
--
1.9.1
------------------------------
Message: 3
Date: Wed, 9 Nov 2016 14:05:47 +0100
From: Daniel Wagner <[email protected]>
To: Saurav Babu <[email protected]>, [email protected]
Cc: [email protected]
Subject: Re: [PATCHv2] service: Block auto connect when hidden
connection is in progress
Message-ID: <[email protected]>
Content-Type: text/plain; charset=windows-1252; format=flowed
> v2: Renamed service internal API to have prefix __connman_service
> Block auto connect for all service types instead of only WiFi
> Allow auto connect when hidden connection failed with error
[...]
> +void __connman_service_enable_autoconnect(bool autoconnect);
Doesn't match your changelog. And also I would like to know what changes
if you throw the autoconnect attempts away. This version of
the patch just ignores them and doesn't defer them. As I tried to
explain in the last mail, I am concerned that we change behavior not
just the timing. So if an autoconnect is deferred that should be
okay. Can you build a version which queues the autoconnect and then we
can play a bit with it and see if we ever happen to queue?
Thanks,
Daniel
------------------------------
Message: 4
Date: Wed, 9 Nov 2016 14:11:25 +0100
From: Daniel Wagner <[email protected]>
To: Saurav Babu <[email protected]>, [email protected]
Cc: [email protected]
Subject: Re: [PATCH] provider: Remove unnecessary condition check
Message-ID: <[email protected]>
Content-Type: text/plain; charset=windows-1252; format=flowed
applied.
thanks,
Daniel
------------------------------
Message: 5
Date: Wed, 9 Nov 2016 14:22:04 +0100
From: Daniel Wagner <[email protected]>
To: Alexander Kochetkov <[email protected]>
Cc: [email protected], Jukka Rissanen
<[email protected]>
Subject: Re: [PATCH] ntp: clear ADJ_MAXERROR to keep STA_UNSYNC
cleared after jump adjust
Message-ID: <[email protected]>
Content-Type: text/plain; charset=windows-1252; format=flowed
Hi Alexander,
On 11/08/2016 10:03 PM, Alexander Kochetkov wrote:
> NTP use jump adjust if system has incorrect time read from RTC during boot.
> It is desireble to update RTC time as soon as NTP set correct system time.
> Sometimes kernel failed to update RTC due to STA_UNSYNC get set before RTC
> update finised. In that case RTC time wouldn't be updated within long time.
> The commit makes RTC updates stable.
>
> When NTP do jump time adjust using ADJ_SETOFFSET it clears STA_UNSYNC flag.
> If don't clear ADJ_MAXERROR, STA_UNSYNC will be set again by kernel within
> 1 second (by second_overflow() function). STA_UNSYNC flag prevent RTC updates
> in kernel. Sometimes the kernel is able to update RTC withing 1 second,
> but sometimes it falied.
Thanks for your patch. Since I have no clue how this stuff works I would
like an ACK from Jukka who did some work in the past and seem to
understand it.
Jukka?
cheers,
daniel
------------------------------
Message: 6
Date: Wed, 09 Nov 2016 17:16:10 +0200
From: Jukka Rissanen <[email protected]>
To: Daniel Wagner <[email protected]>, Alexander Kochetkov
<[email protected]>
Cc: [email protected]
Subject: Re: [PATCH] ntp: clear ADJ_MAXERROR to keep STA_UNSYNC
cleared after jump adjust
Message-ID: <[email protected]>
Content-Type: text/plain; charset="UTF-8"
Hi Daniel,
unfortunately I have not worked with NTP and thus do not know it well
enough to comment this one. Have you tried git blame?
It seems?Justin Maggard sent some patches to ntp.c in July.
Cheers,
Jukka
On Wed, 2016-11-09 at 14:22 +0100, Daniel Wagner wrote:
> Hi Alexander,
>
> On 11/08/2016 10:03 PM, Alexander Kochetkov wrote:
> >
> > NTP use jump adjust if system has incorrect time read from RTC
> > during boot.
> > It is desireble to update RTC time as soon as NTP set correct
> > system time.
> > Sometimes kernel failed to update RTC due to STA_UNSYNC get set
> > before RTC
> > update finised. In that case RTC time wouldn't be updated within
> > long time.
> > The commit makes RTC updates stable.
> >
> > When NTP do jump time adjust using ADJ_SETOFFSET it clears
> > STA_UNSYNC flag.
> > If don't clear ADJ_MAXERROR, STA_UNSYNC will be set again by kernel
> > within
> > 1 second (by second_overflow() function). STA_UNSYNC flag prevent
> > RTC updates
> > in kernel. Sometimes the kernel is able to update RTC withing 1
> > second,
> > but sometimes it falied.
>
> Thanks for your patch. Since I have no clue how this stuff works I
> would?
> like an ACK from Jukka who did some work in the past and seem to?
> understand it.
>
> Jukka?
>
> cheers,
> daniel
------------------------------
Message: 7
Date: Wed, 9 Nov 2016 19:47:57 +0300
From: Alexander Kochetkov <[email protected]>
To: Daniel Wagner <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH] ntp: clear ADJ_MAXERROR to keep STA_UNSYNC
cleared after jump adjust
Message-ID: <[email protected]>
Content-Type: text/plain; charset=utf-8
Hi Daniel,
Actually the patch implement same code (keep STA_UNSYNC) already present for
slew updates.
Here a quick test you can do to see issue:
1. boot into linux
2. disconnect network
3. set incorrect date and time
date --set "2010-09-13 21:08:00"
hwclock --systohc ?utc
4. reboot (keep network disconnected, so connman cannot update system time
using NTP)
5. wait a bit (30 seconds)
6. run script in terminal
while true; do date; hwclock -r; echo; sleep 1; done
7. connect network
expected behavior:
system time and RTC time was corrected by NTP
actual behaviour:
system time was corrected by NTP, but RTC time still incorrect.
you should wait a lot, until NTP make another (slew) adjustment and clear
STA_UNSYNC
For testing that I made automatic test. But for running test fast linux kernel
should be patched also.
Regards,
Alexander.
8<======================================================
#!/bin/sh
trap 'exit' TERM INT EXIT
while [ true ]; do
echo Starting test
systemctl stop connman
date --set "2010-09-13 21:08:00"
hwclock --systohc --utc
systemctl start connman
while true; do
date | grep -q 2016 && break
sleep 1
done
echo NTP sync OK
counter=0
while true; do
if [ $counter -eq 10 ]; then
echo RTC not synced
exit
fi
hwclock -r | grep -q 2016 && break
counter=`expr $counter + 1`
sleep 1
done
echo RTC sync OK
done
8<======================================================
8<======================================================
>From 94e32c71160dc5794112e0d7ef17b1a97ce2f5a3 Mon Sep 17 00:00:00 2001
From: Alexander Kochetkov <[email protected]>
Date: Wed, 9 Nov 2016 13:57:38 +0300
Subject: ntp: restart cmos update timer in case STA_UNSYNC clear
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This allow to quickly sync RTC time to system time in case system and RTC time
was manually set incorrect.
---
kernel/time/ntp.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c
index 149cc80..1e98a81 100644
--- a/kernel/time/ntp.c
+++ b/kernel/time/ntp.c
@@ -562,13 +562,25 @@ static void sync_cmos_clock(struct work_struct *work)
&sync_cmos_work, timespec64_to_jiffies(&next));
}
+static int cancel_sync_cmos_work = 0;
+
void ntp_notify_cmos_timer(void)
{
+ if (cancel_sync_cmos_work) {
+ cancel_sync_cmos_work = 0;
+ cancel_delayed_work(&sync_cmos_work);
+ }
queue_delayed_work(system_power_efficient_wq, &sync_cmos_work, 0);
}
+static void reset_cmos_update_timer(void)
+{
+ cancel_sync_cmos_work = 1;
+}
+
#else
void ntp_notify_cmos_timer(void) { }
+static void reset_cmos_update_timer(void) { }
#endif
@@ -592,6 +604,9 @@ static inline void process_adj_status(struct timex *txc,
struct timespec64 *ts)
if (!(time_status & STA_PLL) && (txc->status & STA_PLL))
time_reftime = get_seconds();
+ if ((time_status & STA_UNSYNC) && !(txc->status & STA_UNSYNC))
+ reset_cmos_update_timer();
+
/* only set allowed bits */
time_status &= STA_RONLY;
time_status |= txc->status & ~STA_RONLY;
--
1.7.9.5
8<======================================================
------------------------------
Message: 8
Date: Wed, 9 Nov 2016 18:52:43 +0200
From: Ioan-Adrian Ratiu <[email protected]>
To: <[email protected]>, <[email protected]>
Subject: [PATCH v3 0/3] Add AlwaysConnectedTechnologies feature
Message-ID: <[email protected]>
Content-Type: text/plain
Hello
Thank you for the great feedback and sorry for the long delay,
I was swamped with other work but now I'm back on this series.
Changes since v2 (based on Patrik's feedback):
* Split the bigger patch into a 3 smaller patch series
* service.c: renamed the newly added function to always_connect()
and made it static
* Added some more conditions testing always_connect() in
auto_connect_service()
Ioan-Adrian Ratiu (3):
main: add new AlwaysConnectedTechnologies list option
service: Implement AlwaysConnectedTechnologies
main.conf: document AlwaysConnectedTechnologies option
src/main.c | 18 ++++++++++++++++++
src/main.conf | 7 +++++++
src/service.c | 24 ++++++++++++++++++++----
3 files changed, 45 insertions(+), 4 deletions(-)
--
2.10.2
------------------------------
Message: 9
Date: Wed, 9 Nov 2016 18:52:45 +0200
From: Ioan-Adrian Ratiu <[email protected]>
To: <[email protected]>, <[email protected]>
Subject: [PATCH v3 2/3] service: Implement AlwaysConnectedTechnologies
Message-ID: <[email protected]>
Content-Type: text/plain
Add a new function which returns true if a service type is in the list
of technologies to always autoconnect. Call that function at various
points in the auto_connect_service to ensure that service type always
connects regardless of any preffered technologies settings and correctly
handles session logic.
---
src/service.c | 24 ++++++++++++++++++++----
1 file changed, 20 insertions(+), 4 deletions(-)
diff --git a/src/service.c b/src/service.c
index f6a76f6..092c48c 100644
--- a/src/service.c
+++ b/src/service.c
@@ -3750,6 +3750,19 @@ static GList *preferred_tech_list_get(void)
return tech_data.preferred_list;
}
+static bool always_connect(enum connman_service_type type)
+{
+ unsigned int *always_connected_techs =
+ connman_setting_get_uint_list("AlwaysConnectedTechnologies");
+ int i;
+
+ for (i = 0; always_connected_techs && always_connected_techs[i]; i++)
+ if (always_connected_techs[i] == type)
+ return true;
+
+ return false;
+}
+
static bool auto_connect_service(GList *services,
enum connman_service_connect_reason reason,
bool preferred)
@@ -3757,6 +3770,7 @@ static bool auto_connect_service(GList *services,
struct connman_service *service = NULL;
bool ignore[MAX_CONNMAN_SERVICE_TYPES] = { };
bool autoconnecting = false;
+
GList *list;
DBG("preferred %d sessions %d reason %s", preferred, active_count,
@@ -3776,8 +3790,8 @@ static bool auto_connect_service(GList *services,
if (service->pending ||
is_connecting(service) ||
is_connected(service)) {
- if (!active_count)
- return true;
+ if (!active_count && !always_connect(service->type))
+ return true;
ignore[service->type] = true;
autoconnecting = true;
@@ -3799,7 +3813,9 @@ static bool auto_connect_service(GList *services,
CONNMAN_SERVICE_STATE_IDLE)
continue;
- if (autoconnecting && !active_sessions[service->type]) {
+ if (autoconnecting &&
+ !active_sessions[service->type] &&
+ !always_connect(service->type)) {
DBG("service %p type %s has no users", service,
__connman_service_type2string(service->type));
continue;
@@ -3810,7 +3826,7 @@ static bool auto_connect_service(GList *services,
__connman_service_connect(service, reason);
- if (!active_count)
+ if (!active_count && always_connect(service->type))
return true;
ignore[service->type] = true;
--
2.10.2
------------------------------
Subject: Digest Footer
_______________________________________________
connman mailing list
[email protected]
https://lists.01.org/mailman/listinfo/connman
------------------------------
End of connman Digest, Vol 13, Issue 7
**************************************