diff mbox series

[2/2] net: qrtr: Fix FIXME related to qrtr_ns_init()

Message ID 20200302032527.552916-3-bjorn.andersson@linaro.org (mailing list archive)
State New, archived
Headers show
Series net: qrtr: Nameserver fixes | expand

Commit Message

Bjorn Andersson March 2, 2020, 3:25 a.m. UTC
The 2 second delay before calling qrtr_ns_init() meant that the remote
processors would register as endpoints in qrtr and the say_hello() call
would therefor broadcast the outgoing HELLO to them. With the HELLO
handshake corrected this delay is no longer needed.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
---
 net/qrtr/ns.c   | 2 +-
 net/qrtr/qrtr.c | 6 +-----
 net/qrtr/qrtr.h | 2 +-
 3 files changed, 3 insertions(+), 7 deletions(-)

Comments

Manivannan Sadhasivam March 2, 2020, 5:55 a.m. UTC | #1
On Sun, Mar 01, 2020 at 07:25:27PM -0800, Bjorn Andersson wrote:
> The 2 second delay before calling qrtr_ns_init() meant that the remote
> processors would register as endpoints in qrtr and the say_hello() call
> would therefor broadcast the outgoing HELLO to them. With the HELLO
> handshake corrected this delay is no longer needed.
> 
> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
> ---
>  net/qrtr/ns.c   | 2 +-
>  net/qrtr/qrtr.c | 6 +-----
>  net/qrtr/qrtr.h | 2 +-
>  3 files changed, 3 insertions(+), 7 deletions(-)
> 
> diff --git a/net/qrtr/ns.c b/net/qrtr/ns.c
> index e3f11052b5f6..cfd4bd07a62b 100644
> --- a/net/qrtr/ns.c
> +++ b/net/qrtr/ns.c
> @@ -693,7 +693,7 @@ static void qrtr_ns_data_ready(struct sock *sk)
>  	queue_work(qrtr_ns.workqueue, &qrtr_ns.work);
>  }
>  
> -void qrtr_ns_init(struct work_struct *work)
> +void qrtr_ns_init(void)
>  {
>  	struct sockaddr_qrtr sq;
>  	int ret;
> diff --git a/net/qrtr/qrtr.c b/net/qrtr/qrtr.c
> index 423310896285..313d3194018a 100644
> --- a/net/qrtr/qrtr.c
> +++ b/net/qrtr/qrtr.c
> @@ -1263,11 +1263,7 @@ static int __init qrtr_proto_init(void)
>  		return rc;
>  	}
>  
> -	/* FIXME: Currently, this 2s delay is required to catch the NEW_SERVER
> -	 * messages from routers. But the fix could be somewhere else.
> -	 */
> -	INIT_DELAYED_WORK(&qrtr_ns_work, qrtr_ns_init);
> -	schedule_delayed_work(&qrtr_ns_work, msecs_to_jiffies(2000));
> +	qrtr_ns_init();
>  

You forgot to remove the below instances of delayed_work:

#include <linux/workqueue.h>
struct delayed_work qrtr_ns_work;
cancel_delayed_work_sync(&qrtr_ns_work);

Other than that,

Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Tested-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>

Thanks,
Mani

>  	return rc;
>  }
> diff --git a/net/qrtr/qrtr.h b/net/qrtr/qrtr.h
> index 53a237a28971..dc2b67f17927 100644
> --- a/net/qrtr/qrtr.h
> +++ b/net/qrtr/qrtr.h
> @@ -29,7 +29,7 @@ void qrtr_endpoint_unregister(struct qrtr_endpoint *ep);
>  
>  int qrtr_endpoint_post(struct qrtr_endpoint *ep, const void *data, size_t len);
>  
> -void qrtr_ns_init(struct work_struct *work);
> +void qrtr_ns_init(void);
>  
>  void qrtr_ns_remove(void);
>  
> -- 
> 2.24.0
>
Bjorn Andersson March 2, 2020, 6:55 a.m. UTC | #2
On Sun 01 Mar 21:55 PST 2020, Manivannan Sadhasivam wrote:

> On Sun, Mar 01, 2020 at 07:25:27PM -0800, Bjorn Andersson wrote:
> > The 2 second delay before calling qrtr_ns_init() meant that the remote
> > processors would register as endpoints in qrtr and the say_hello() call
> > would therefor broadcast the outgoing HELLO to them. With the HELLO
> > handshake corrected this delay is no longer needed.
> > 
> > Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
> > ---
> >  net/qrtr/ns.c   | 2 +-
> >  net/qrtr/qrtr.c | 6 +-----
> >  net/qrtr/qrtr.h | 2 +-
> >  3 files changed, 3 insertions(+), 7 deletions(-)
> > 
> > diff --git a/net/qrtr/ns.c b/net/qrtr/ns.c
> > index e3f11052b5f6..cfd4bd07a62b 100644
> > --- a/net/qrtr/ns.c
> > +++ b/net/qrtr/ns.c
> > @@ -693,7 +693,7 @@ static void qrtr_ns_data_ready(struct sock *sk)
> >  	queue_work(qrtr_ns.workqueue, &qrtr_ns.work);
> >  }
> >  
> > -void qrtr_ns_init(struct work_struct *work)
> > +void qrtr_ns_init(void)
> >  {
> >  	struct sockaddr_qrtr sq;
> >  	int ret;
> > diff --git a/net/qrtr/qrtr.c b/net/qrtr/qrtr.c
> > index 423310896285..313d3194018a 100644
> > --- a/net/qrtr/qrtr.c
> > +++ b/net/qrtr/qrtr.c
> > @@ -1263,11 +1263,7 @@ static int __init qrtr_proto_init(void)
> >  		return rc;
> >  	}
> >  
> > -	/* FIXME: Currently, this 2s delay is required to catch the NEW_SERVER
> > -	 * messages from routers. But the fix could be somewhere else.
> > -	 */
> > -	INIT_DELAYED_WORK(&qrtr_ns_work, qrtr_ns_init);
> > -	schedule_delayed_work(&qrtr_ns_work, msecs_to_jiffies(2000));
> > +	qrtr_ns_init();
> >  
> 
> You forgot to remove the below instances of delayed_work:
> 
> #include <linux/workqueue.h>
> struct delayed_work qrtr_ns_work;
> cancel_delayed_work_sync(&qrtr_ns_work);
> 

I sure did, thanks for noticing.

Regards,
Bjorn

> Other than that,
> 
> Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> Tested-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> 
> Thanks,
> Mani
> 
> >  	return rc;
> >  }
> > diff --git a/net/qrtr/qrtr.h b/net/qrtr/qrtr.h
> > index 53a237a28971..dc2b67f17927 100644
> > --- a/net/qrtr/qrtr.h
> > +++ b/net/qrtr/qrtr.h
> > @@ -29,7 +29,7 @@ void qrtr_endpoint_unregister(struct qrtr_endpoint *ep);
> >  
> >  int qrtr_endpoint_post(struct qrtr_endpoint *ep, const void *data, size_t len);
> >  
> > -void qrtr_ns_init(struct work_struct *work);
> > +void qrtr_ns_init(void);
> >  
> >  void qrtr_ns_remove(void);
> >  
> > -- 
> > 2.24.0
> >
diff mbox series

Patch

diff --git a/net/qrtr/ns.c b/net/qrtr/ns.c
index e3f11052b5f6..cfd4bd07a62b 100644
--- a/net/qrtr/ns.c
+++ b/net/qrtr/ns.c
@@ -693,7 +693,7 @@  static void qrtr_ns_data_ready(struct sock *sk)
 	queue_work(qrtr_ns.workqueue, &qrtr_ns.work);
 }
 
-void qrtr_ns_init(struct work_struct *work)
+void qrtr_ns_init(void)
 {
 	struct sockaddr_qrtr sq;
 	int ret;
diff --git a/net/qrtr/qrtr.c b/net/qrtr/qrtr.c
index 423310896285..313d3194018a 100644
--- a/net/qrtr/qrtr.c
+++ b/net/qrtr/qrtr.c
@@ -1263,11 +1263,7 @@  static int __init qrtr_proto_init(void)
 		return rc;
 	}
 
-	/* FIXME: Currently, this 2s delay is required to catch the NEW_SERVER
-	 * messages from routers. But the fix could be somewhere else.
-	 */
-	INIT_DELAYED_WORK(&qrtr_ns_work, qrtr_ns_init);
-	schedule_delayed_work(&qrtr_ns_work, msecs_to_jiffies(2000));
+	qrtr_ns_init();
 
 	return rc;
 }
diff --git a/net/qrtr/qrtr.h b/net/qrtr/qrtr.h
index 53a237a28971..dc2b67f17927 100644
--- a/net/qrtr/qrtr.h
+++ b/net/qrtr/qrtr.h
@@ -29,7 +29,7 @@  void qrtr_endpoint_unregister(struct qrtr_endpoint *ep);
 
 int qrtr_endpoint_post(struct qrtr_endpoint *ep, const void *data, size_t len);
 
-void qrtr_ns_init(struct work_struct *work);
+void qrtr_ns_init(void);
 
 void qrtr_ns_remove(void);