linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] RDMA/i40iw: Convert timers to use timer_setup()
@ 2017-10-05  0:45 Kees Cook
  2017-10-06 23:17 ` Shiraz Saleem
  2017-10-09 16:24 ` Doug Ledford
  0 siblings, 2 replies; 6+ messages in thread
From: Kees Cook @ 2017-10-05  0:45 UTC (permalink / raw)
  To: linux-kernel
  Cc: Faisal Latif, Shiraz Saleem, Doug Ledford, Sean Hefty,
	Hal Rosenstock, linux-rdma, Thomas Gleixner

In preparation for unconditionally passing the struct timer_list pointer to
all timer callbacks, switch to using the new timer_setup() and from_timer()
to pass the timer pointer explicitly.

Cc: Faisal Latif <faisal.latif@intel.com>
Cc: Shiraz Saleem <shiraz.saleem@intel.com>
Cc: Doug Ledford <dledford@redhat.com>
Cc: Sean Hefty <sean.hefty@intel.com>
Cc: Hal Rosenstock <hal.rosenstock@gmail.com>
Cc: linux-rdma@vger.kernel.org
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Kees Cook <keescook@chromium.org>
---
This requires commit 686fef928bba ("timer: Prepare to change timer
callback argument type") in v4.14-rc3, but should be otherwise
stand-alone.
---
 drivers/infiniband/hw/i40iw/i40iw_ctrl.c  |  1 +
 drivers/infiniband/hw/i40iw/i40iw_type.h  |  1 +
 drivers/infiniband/hw/i40iw/i40iw_utils.c | 10 +++++-----
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/infiniband/hw/i40iw/i40iw_ctrl.c b/drivers/infiniband/hw/i40iw/i40iw_ctrl.c
index d1f5345f04f0..2d076cf946e0 100644
--- a/drivers/infiniband/hw/i40iw/i40iw_ctrl.c
+++ b/drivers/infiniband/hw/i40iw/i40iw_ctrl.c
@@ -4873,6 +4873,7 @@ enum i40iw_status_code i40iw_vsi_stats_init(struct i40iw_sc_vsi *vsi, struct i40
 
 	vsi->pestat = info->pestat;
 	vsi->pestat->hw = vsi->dev->hw;
+	vsi->pestat->vsi = vsi;
 
 	if (info->stats_initialize) {
 		i40iw_hw_stats_init(vsi->pestat, fcn_id, true);
diff --git a/drivers/infiniband/hw/i40iw/i40iw_type.h b/drivers/infiniband/hw/i40iw/i40iw_type.h
index 63118f6d5ab4..7798e8e2f9bd 100644
--- a/drivers/infiniband/hw/i40iw/i40iw_type.h
+++ b/drivers/infiniband/hw/i40iw/i40iw_type.h
@@ -250,6 +250,7 @@ struct i40iw_vsi_pestat {
 	struct i40iw_dev_hw_stats last_read_hw_stats;
 	struct i40iw_dev_hw_stats_offsets hw_stats_offsets;
 	struct timer_list stats_timer;
+	struct i40iw_sc_vsi *vsi;
 	spinlock_t lock; /* rdma stats lock */
 };
 
diff --git a/drivers/infiniband/hw/i40iw/i40iw_utils.c b/drivers/infiniband/hw/i40iw/i40iw_utils.c
index e52dbbb4165e..f6c76595e834 100644
--- a/drivers/infiniband/hw/i40iw/i40iw_utils.c
+++ b/drivers/infiniband/hw/i40iw/i40iw_utils.c
@@ -1445,11 +1445,12 @@ enum i40iw_status_code i40iw_puda_get_tcpip_info(struct i40iw_puda_completion_in
  * i40iw_hw_stats_timeout - Stats timer-handler which updates all HW stats
  * @vsi: pointer to the vsi structure
  */
-static void i40iw_hw_stats_timeout(unsigned long vsi)
+static void i40iw_hw_stats_timeout(struct timer_list *t)
 {
-	struct i40iw_sc_vsi *sc_vsi =  (struct i40iw_sc_vsi *)vsi;
+	struct i40iw_vsi_pestat *pf_devstat = from_timer(pf_devstat, t,
+						       stats_timer);
+	struct i40iw_sc_vsi *sc_vsi = pf_devstat->vsi;
 	struct i40iw_sc_dev *pf_dev = sc_vsi->dev;
-	struct i40iw_vsi_pestat *pf_devstat = sc_vsi->pestat;
 	struct i40iw_vsi_pestat *vf_devstat = NULL;
 	u16 iw_vf_idx;
 	unsigned long flags;
@@ -1480,8 +1481,7 @@ void i40iw_hw_stats_start_timer(struct i40iw_sc_vsi *vsi)
 {
 	struct i40iw_vsi_pestat *devstat = vsi->pestat;
 
-	setup_timer(&devstat->stats_timer, i40iw_hw_stats_timeout,
-		    (unsigned long)vsi);
+	timer_setup(&devstat->stats_timer, i40iw_hw_stats_timeout, 0);
 	mod_timer(&devstat->stats_timer,
 		  jiffies + msecs_to_jiffies(STATS_TIMER_DELAY));
 }
-- 
2.7.4


-- 
Kees Cook
Pixel Security

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] RDMA/i40iw: Convert timers to use timer_setup()
  2017-10-05  0:45 [PATCH] RDMA/i40iw: Convert timers to use timer_setup() Kees Cook
@ 2017-10-06 23:17 ` Shiraz Saleem
  2017-10-07 14:12   ` Shiraz Saleem
  2017-10-09 16:24 ` Doug Ledford
  1 sibling, 1 reply; 6+ messages in thread
From: Shiraz Saleem @ 2017-10-06 23:17 UTC (permalink / raw)
  To: Kees Cook
  Cc: linux-kernel, Faisal Latif, Doug Ledford, Sean Hefty,
	Hal Rosenstock, linux-rdma, Thomas Gleixner

On Wed, Oct 04, 2017 at 05:45:41PM -0700, Kees Cook wrote:
> In preparation for unconditionally passing the struct timer_list pointer to
> all timer callbacks, switch to using the new timer_setup() and from_timer()
> to pass the timer pointer explicitly.
> 
> Cc: Faisal Latif <faisal.latif@intel.com>
> Cc: Shiraz Saleem <shiraz.saleem@intel.com>
> Cc: Doug Ledford <dledford@redhat.com>
> Cc: Sean Hefty <sean.hefty@intel.com>
> Cc: Hal Rosenstock <hal.rosenstock@gmail.com>
> Cc: linux-rdma@vger.kernel.org
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Signed-off-by: Kees Cook <keescook@chromium.org>
> ---
> This requires commit 686fef928bba ("timer: Prepare to change timer
> callback argument type") in v4.14-rc3, but should be otherwise
> stand-alone.
> ---

Patch looks ok. Did some minimal testing and looks good.

Acked-by: Shiraz Saleem <shiraz.saleem@intel.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] RDMA/i40iw: Convert timers to use timer_setup()
  2017-10-06 23:17 ` Shiraz Saleem
@ 2017-10-07 14:12   ` Shiraz Saleem
  2017-10-09 16:25     ` Doug Ledford
  2017-10-17 18:37     ` Kees Cook
  0 siblings, 2 replies; 6+ messages in thread
From: Shiraz Saleem @ 2017-10-07 14:12 UTC (permalink / raw)
  To: Kees Cook
  Cc: linux-kernel, Faisal Latif, Doug Ledford, Sean Hefty,
	Hal Rosenstock, linux-rdma, Thomas Gleixner

On Fri, Oct 06, 2017 at 06:17:23PM -0500, Shiraz Saleem wrote:
> On Wed, Oct 04, 2017 at 05:45:41PM -0700, Kees Cook wrote:
> > In preparation for unconditionally passing the struct timer_list pointer to
> > all timer callbacks, switch to using the new timer_setup() and from_timer()
> > to pass the timer pointer explicitly.
> > 
> > Cc: Faisal Latif <faisal.latif@intel.com>
> > Cc: Shiraz Saleem <shiraz.saleem@intel.com>
> > Cc: Doug Ledford <dledford@redhat.com>
> > Cc: Sean Hefty <sean.hefty@intel.com>
> > Cc: Hal Rosenstock <hal.rosenstock@gmail.com>
> > Cc: linux-rdma@vger.kernel.org
> > Cc: Thomas Gleixner <tglx@linutronix.de>
> > Signed-off-by: Kees Cook <keescook@chromium.org>
> > ---
> > This requires commit 686fef928bba ("timer: Prepare to change timer
> > callback argument type") in v4.14-rc3, but should be otherwise
> > stand-alone.
> > ---
> 
> Patch looks ok. Did some minimal testing and looks good.
> 
> Acked-by: Shiraz Saleem <shiraz.saleem@intel.com>
> 

Hi Kees,

Sorry, I didnt notice this earlier, but, you made the change only to the stats timer
to use the new timer init APIs. Can you do the same for the cm_timer and terminate_timer
too for i40iw; so that things are consistent?

[ssaleem@linbuild6081 i40iw]$ grep "setup_timer" *
i40iw_cm.c:	setup_timer(&cm_core->tcp_timer, i40iw_cm_timer_tick,
i40iw_utils.c:	setup_timer(&iwqp->terminate_timer, i40iw_terminate_timeout,
i40iw_utils.c:	setup_timer(&devstat->stats_timer, i40iw_hw_stats_timeout,

Shiraz
  

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] RDMA/i40iw: Convert timers to use timer_setup()
  2017-10-05  0:45 [PATCH] RDMA/i40iw: Convert timers to use timer_setup() Kees Cook
  2017-10-06 23:17 ` Shiraz Saleem
@ 2017-10-09 16:24 ` Doug Ledford
  1 sibling, 0 replies; 6+ messages in thread
From: Doug Ledford @ 2017-10-09 16:24 UTC (permalink / raw)
  To: Kees Cook, linux-kernel
  Cc: Faisal Latif, Shiraz Saleem, Sean Hefty, Hal Rosenstock,
	linux-rdma, Thomas Gleixner

On Wed, 2017-10-04 at 17:45 -0700, Kees Cook wrote:
> In preparation for unconditionally passing the struct timer_list
> pointer to
> all timer callbacks, switch to using the new timer_setup() and
> from_timer()
> to pass the timer pointer explicitly.
> 
> Cc: Faisal Latif <faisal.latif@intel.com>
> Cc: Shiraz Saleem <shiraz.saleem@intel.com>
> Cc: Doug Ledford <dledford@redhat.com>
> Cc: Sean Hefty <sean.hefty@intel.com>
> Cc: Hal Rosenstock <hal.rosenstock@gmail.com>
> Cc: linux-rdma@vger.kernel.org
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Signed-off-by: Kees Cook <keescook@chromium.org>
> ---
> This requires commit 686fef928bba ("timer: Prepare to change timer
> callback argument type") in v4.14-rc3, but should be otherwise
> stand-alone.

Thanks, applied.

-- 
Doug Ledford <dledford@redhat.com>
    GPG KeyID: B826A3330E572FDD
    Key fingerprint = AE6B 1BDA 122B 23B4 265B  1274 B826 A333 0E57 2FDD

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] RDMA/i40iw: Convert timers to use timer_setup()
  2017-10-07 14:12   ` Shiraz Saleem
@ 2017-10-09 16:25     ` Doug Ledford
  2017-10-17 18:37     ` Kees Cook
  1 sibling, 0 replies; 6+ messages in thread
From: Doug Ledford @ 2017-10-09 16:25 UTC (permalink / raw)
  To: Shiraz Saleem, Kees Cook
  Cc: linux-kernel, Faisal Latif, Sean Hefty, Hal Rosenstock,
	linux-rdma, Thomas Gleixner

On Sat, 2017-10-07 at 09:12 -0500, Shiraz Saleem wrote:
> Hi Kees,
> 
> Sorry, I didnt notice this earlier, but, you made the change only to
> the stats timer
> to use the new timer init APIs. Can you do the same for the cm_timer
> and terminate_timer
> too for i40iw; so that things are consistent?
> 
> [ssaleem@linbuild6081 i40iw]$ grep "setup_timer" *
> i40iw_cm.c:     setup_timer(&cm_core->tcp_timer, i40iw_cm_timer_tick,
> i40iw_utils.c:  setup_timer(&iwqp->terminate_timer,
> i40iw_terminate_timeout,
> i40iw_utils.c:  setup_timer(&devstat->stats_timer,
> i40iw_hw_stats_timeout,

Since I took the first patch, this will need to be as an incremental
change.

-- 
Doug Ledford <dledford@redhat.com>
    GPG KeyID: B826A3330E572FDD
    Key fingerprint = AE6B 1BDA 122B 23B4 265B  1274 B826 A333 0E57 2FDD

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] RDMA/i40iw: Convert timers to use timer_setup()
  2017-10-07 14:12   ` Shiraz Saleem
  2017-10-09 16:25     ` Doug Ledford
@ 2017-10-17 18:37     ` Kees Cook
  1 sibling, 0 replies; 6+ messages in thread
From: Kees Cook @ 2017-10-17 18:37 UTC (permalink / raw)
  To: Shiraz Saleem
  Cc: LKML, Faisal Latif, Doug Ledford, Sean Hefty, Hal Rosenstock,
	linux-rdma, Thomas Gleixner

On Sat, Oct 7, 2017 at 7:12 AM, Shiraz Saleem <shiraz.saleem@intel.com> wrote:
> On Fri, Oct 06, 2017 at 06:17:23PM -0500, Shiraz Saleem wrote:
>> On Wed, Oct 04, 2017 at 05:45:41PM -0700, Kees Cook wrote:
>> > In preparation for unconditionally passing the struct timer_list pointer to
>> > all timer callbacks, switch to using the new timer_setup() and from_timer()
>> > to pass the timer pointer explicitly.
>> >
>> > Cc: Faisal Latif <faisal.latif@intel.com>
>> > Cc: Shiraz Saleem <shiraz.saleem@intel.com>
>> > Cc: Doug Ledford <dledford@redhat.com>
>> > Cc: Sean Hefty <sean.hefty@intel.com>
>> > Cc: Hal Rosenstock <hal.rosenstock@gmail.com>
>> > Cc: linux-rdma@vger.kernel.org
>> > Cc: Thomas Gleixner <tglx@linutronix.de>
>> > Signed-off-by: Kees Cook <keescook@chromium.org>
>> > ---
>> > This requires commit 686fef928bba ("timer: Prepare to change timer
>> > callback argument type") in v4.14-rc3, but should be otherwise
>> > stand-alone.
>> > ---
>>
>> Patch looks ok. Did some minimal testing and looks good.
>>
>> Acked-by: Shiraz Saleem <shiraz.saleem@intel.com>
>>
>
> Hi Kees,
>
> Sorry, I didnt notice this earlier, but, you made the change only to the stats timer
> to use the new timer init APIs. Can you do the same for the cm_timer and terminate_timer
> too for i40iw; so that things are consistent?
>
> [ssaleem@linbuild6081 i40iw]$ grep "setup_timer" *
> i40iw_cm.c:     setup_timer(&cm_core->tcp_timer, i40iw_cm_timer_tick,
> i40iw_utils.c:  setup_timer(&iwqp->terminate_timer, i40iw_terminate_timeout,
> i40iw_utils.c:  setup_timer(&devstat->stats_timer, i40iw_hw_stats_timeout,

Hi! (Sorry for the delay, I missed this email, thanks for the reminder.)

I will send a follow-up with these added. (They were trivial
conversions, so they were originally part of my tree's tree-wide mass
conversion before I started pulling per-subsystem conversions out into
separate patches.)

Thanks!

-Kees

-- 
Kees Cook
Pixel Security

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-10-17 18:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-05  0:45 [PATCH] RDMA/i40iw: Convert timers to use timer_setup() Kees Cook
2017-10-06 23:17 ` Shiraz Saleem
2017-10-07 14:12   ` Shiraz Saleem
2017-10-09 16:25     ` Doug Ledford
2017-10-17 18:37     ` Kees Cook
2017-10-09 16:24 ` Doug Ledford

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).