* [RFC 03/07] compat-wireless: Enable changing regulatory domain
@ 2011-10-12 1:02 Dmitry Tarnyagin
2011-10-12 3:17 ` Julian Calaby
2011-10-12 8:22 ` Johannes Berg
0 siblings, 2 replies; 3+ messages in thread
From: Dmitry Tarnyagin @ 2011-10-12 1:02 UTC (permalink / raw)
To: linux-wireless.vger.kernel.org
Cc: Bartosz MARKOWSKI, Janusz DZIEDZIC, Johan Lilje
From: Johan Lilje <johan.lilje@stericsson.com>
Date: Tue, 2 Aug 2011 09:21:49 +0200
If compat-wireless code is compiled into the kernel,
first request regulatory hint fails to return since
userspace is not ready yet.
Added timeout mechanism to remove old pending requests.
Signed-off-by: Johan Lilje <johan.lilje@stericsson.com>
---
include/net/regulatory.h | 3 +++
net/wireless/reg.c | 26 +++++++++++++++++++++++---
2 files changed, 26 insertions(+), 3 deletions(-)
diff --git a/include/net/regulatory.h b/include/net/regulatory.h
index eb7d3c2..98dda7b 100644
--- a/include/net/regulatory.h
+++ b/include/net/regulatory.h
@@ -61,6 +61,8 @@ enum environment_cap {
* country IE
* @country_ie_env: lets us know if the AP is telling us we are outdoor,
* indoor, or if it doesn't matter
+ * @timestamp: stores the time when this request calls crda, to enable
+ * timeout mechanism.
* @list: used to insert into the reg_requests_list linked list
*/
struct regulatory_request {
@@ -70,6 +72,7 @@ struct regulatory_request {
bool intersect;
bool processed;
enum environment_cap country_ie_env;
+ struct timespec timestamp;
struct list_head list;
};
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 6acba9d..1fbd36a 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -35,6 +35,7 @@
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+#include <linux/time.h>
#include <linux/kernel.h>
#include <linux/export.h>
#include <linux/slab.h>
@@ -1433,6 +1434,9 @@ new_request:
return r;
}
+ /* Get timestamp */
+ getnstimeofday(&(last_request->timestamp));
+
return call_crda(last_request->alpha2);
}
@@ -1479,15 +1483,31 @@ static void reg_process_hint(struct
regulatory_request *reg_request)
static void reg_process_pending_hints(void)
{
struct regulatory_request *reg_request;
+ struct timespec time_diff;
+ struct timespec timestamp_now;
mutex_lock(&cfg80211_mutex);
mutex_lock(®_mutex);
/* When last_request->processed becomes true this will be rescheduled */
if (last_request && !last_request->processed) {
- REG_DBG_PRINT("Pending regulatory request, waiting "
- "for it to be processed...\n");
- goto out;
+ /* Get time since last request */
+ if (last_request->timestamp.tv_nsec) {
+ getnstimeofday(×tamp_now);
+ time_diff = timespec_sub(timestamp_now,
+ last_request->timestamp);
+ }
+
+ /* Previous call to CRDA did not return within 2 seconds */
+ if (time_diff.tv_sec > 2) {
+ REG_DBG_PRINT("Regulatory request timeout, "
+ "removing pending hint\n");
+ reg_set_request_processed();
+ } else {
+ REG_DBG_PRINT("Pending regulatory request, waiting "
+ "for it to be processed...\n");
+ goto out;
+ }
}
spin_lock(®_requests_lock);
--
1.7.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [RFC 03/07] compat-wireless: Enable changing regulatory domain
2011-10-12 1:02 [RFC 03/07] compat-wireless: Enable changing regulatory domain Dmitry Tarnyagin
@ 2011-10-12 3:17 ` Julian Calaby
2011-10-12 8:22 ` Johannes Berg
1 sibling, 0 replies; 3+ messages in thread
From: Julian Calaby @ 2011-10-12 3:17 UTC (permalink / raw)
To: Dmitry Tarnyagin
Cc: linux-wireless.vger.kernel.org, Bartosz MARKOWSKI,
Janusz DZIEDZIC, Johan Lilje
Hi Dmitry,
Some minor comments on this patch:
Note that I'm not a maintainer and that these are comments on the
patch itself, not the code it adds.
On Wed, Oct 12, 2011 at 12:02, Dmitry Tarnyagin <abi.dmitryt@gmail.com> wrote:
> From: Johan Lilje <johan.lilje@stericsson.com>
> Date: Tue, 2 Aug 2011 09:21:49 +0200
>
> If compat-wireless code is compiled into the kernel,
> first request regulatory hint fails to return since
> userspace is not ready yet.
> Added timeout mechanism to remove old pending requests.
>
> Signed-off-by: Johan Lilje <johan.lilje@stericsson.com>
> ---
> include/net/regulatory.h | 3 +++
> net/wireless/reg.c | 26 +++++++++++++++++++++++---
Again, you're updating files that aren't part of the compat-wireless
repository. Are you sure this patch is correct?
Thanks,
--
Julian Calaby
Email: julian.calaby@gmail.com
Profile: http://www.google.com/profiles/julian.calaby/
.Plan: http://sites.google.com/site/juliancalaby/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFC 03/07] compat-wireless: Enable changing regulatory domain
2011-10-12 1:02 [RFC 03/07] compat-wireless: Enable changing regulatory domain Dmitry Tarnyagin
2011-10-12 3:17 ` Julian Calaby
@ 2011-10-12 8:22 ` Johannes Berg
1 sibling, 0 replies; 3+ messages in thread
From: Johannes Berg @ 2011-10-12 8:22 UTC (permalink / raw)
To: Dmitry Tarnyagin
Cc: linux-wireless.vger.kernel.org, Bartosz MARKOWSKI,
Janusz DZIEDZIC, Johan Lilje
On Wed, 2011-10-12 at 03:02 +0200, Dmitry Tarnyagin wrote:
> From: Johan Lilje <johan.lilje@stericsson.com>
> Date: Tue, 2 Aug 2011 09:21:49 +0200
>
> If compat-wireless code is compiled into the kernel,
> first request regulatory hint fails to return since
> userspace is not ready yet.
> Added timeout mechanism to remove old pending requests.
Completely wrong description. Make your patches apply to the kernel, not
compat-wireless.
> + * @timestamp: stores the time when this request calls crda, to enable
> + * timeout mechanism.
> * @list: used to insert into the reg_requests_list linked list
> */
> struct regulatory_request {
> @@ -70,6 +72,7 @@ struct regulatory_request {
> bool intersect;
> bool processed;
> enum environment_cap country_ie_env;
> + struct timespec timestamp;
Seriously? You've gotta be kidding. WAAYY overkill to use timespec. Just
use jiffies.
johannes
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-10-12 8:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-12 1:02 [RFC 03/07] compat-wireless: Enable changing regulatory domain Dmitry Tarnyagin
2011-10-12 3:17 ` Julian Calaby
2011-10-12 8:22 ` Johannes Berg
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).