From patchwork Tue Oct 24 10:28:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 10024115 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A489560375 for ; Tue, 24 Oct 2017 10:28:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 990F3289EF for ; Tue, 24 Oct 2017 10:28:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8D486289F2; Tue, 24 Oct 2017 10:28:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 158C9289EF for ; Tue, 24 Oct 2017 10:28:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932442AbdJXK2b (ORCPT ); Tue, 24 Oct 2017 06:28:31 -0400 Received: from mail-pg0-f66.google.com ([74.125.83.66]:52543 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932403AbdJXK23 (ORCPT ); Tue, 24 Oct 2017 06:28:29 -0400 Received: by mail-pg0-f66.google.com with SMTP id a192so14142445pge.9 for ; Tue, 24 Oct 2017 03:28:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:mime-version:content-disposition; bh=vUtIrFgSDnx8Jk6nUYc+TZ6wqxzaDWkNMx3Cwp+ANWY=; b=SIX7fiwigM6uuyakes7qL7gUDlqtAxaRwptD/JahsZwpFMQultUQg3nb7UCr7/eNV/ bo+YXTTNItLdi8un0ERwN76MFrepCq4oE0zNoog20Va5QoSmkvRJMaQFdywvn2WbCumt 1uWsrT2cqEFbZObkFP8uG6SKy4q8SKDp5XApk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=vUtIrFgSDnx8Jk6nUYc+TZ6wqxzaDWkNMx3Cwp+ANWY=; b=JgQCB4FBANeX/Di4kYa/Fw6eJCYJW5JVZSJeUEgueSIFxIw80IPF0SA3sLT3jlPtwI l/wXOsf2lhywTo+FEsKt5DfeXEewk9TeAgt3wmjjbdSQcXLlEboRBUR3MGnfBWwOIymP a7T+I0+hciMIcXwrBBRntfXw8bqqYaYP8Le1ciuC/wj6Vmq0jqS9/5XlU3J+QQNn4F7q gOcjCaNIm5aprlKgp9JIw/KQByIq8gdandk2uEG0uIuHwQBae4QosJ3gQ3t63P6vbD8K cGaX5s1cSqfB1MtkkYk23z6XAGoVYp/Vfisn3yN6Zcwr99UgGvWCig+vkYeh30bb+iPx 7r/g== X-Gm-Message-State: AMCzsaXIcKFqexMF3MVyKcRoJs2Pb/g9ee9BFaJ8H85Hv8JhW5WGfIzc rLhikbLygHmUFZAbJmQc7SMu3Q== X-Google-Smtp-Source: ABhQp+R1MEWWI03v8zXwxKsgKK7jodYfRQMwaUpiCWFD5IexMuynQLVW/anhZB9yoDLrESYA6BlLOg== X-Received: by 10.84.195.164 with SMTP id j33mr12502880pld.36.1508840909014; Tue, 24 Oct 2017 03:28:29 -0700 (PDT) Received: from www.outflux.net (173-164-112-133-Oregon.hfc.comcastbusiness.net. [173.164.112.133]) by smtp.gmail.com with ESMTPSA id h67sm18628347pfk.60.2017.10.24.03.28.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Oct 2017 03:28:28 -0700 (PDT) Date: Tue, 24 Oct 2017 03:28:27 -0700 From: Kees Cook To: Moni Shoua Cc: Doug Ledford , Sean Hefty , Hal Rosenstock , linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] IB/rxe: Convert timers to use timer_setup() Message-ID: <20171024102827.GA69848@beast> MIME-Version: 1.0 Content-Disposition: inline Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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: Moni Shoua Cc: Doug Ledford Cc: Sean Hefty Cc: Hal Rosenstock Cc: linux-rdma@vger.kernel.org Signed-off-by: Kees Cook --- drivers/infiniband/sw/rxe/rxe_comp.c | 4 ++-- drivers/infiniband/sw/rxe/rxe_loc.h | 4 ++-- drivers/infiniband/sw/rxe/rxe_qp.c | 4 ++-- drivers/infiniband/sw/rxe/rxe_req.c | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/infiniband/sw/rxe/rxe_comp.c b/drivers/infiniband/sw/rxe/rxe_comp.c index 9eb12c2e3c74..a4cda6b3a04b 100644 --- a/drivers/infiniband/sw/rxe/rxe_comp.c +++ b/drivers/infiniband/sw/rxe/rxe_comp.c @@ -136,9 +136,9 @@ static enum ib_wc_opcode wr_to_wc_opcode(enum ib_wr_opcode opcode) } } -void retransmit_timer(unsigned long data) +void retransmit_timer(struct timer_list *t) { - struct rxe_qp *qp = (struct rxe_qp *)data; + struct rxe_qp *qp = from_timer(qp, t, retrans_timer); if (qp->valid) { qp->comp.timeout = 1; diff --git a/drivers/infiniband/sw/rxe/rxe_loc.h b/drivers/infiniband/sw/rxe/rxe_loc.h index 77b3ed0df936..d7472a442a2c 100644 --- a/drivers/infiniband/sw/rxe/rxe_loc.h +++ b/drivers/infiniband/sw/rxe/rxe_loc.h @@ -218,8 +218,8 @@ static inline void rxe_advance_resp_resource(struct rxe_qp *qp) qp->resp.res_head = 0; } -void retransmit_timer(unsigned long data); -void rnr_nak_timer(unsigned long data); +void retransmit_timer(struct timer_list *t); +void rnr_nak_timer(struct timer_list *t); /* rxe_srq.c */ #define IB_SRQ_INIT_MASK (~IB_SRQ_LIMIT) diff --git a/drivers/infiniband/sw/rxe/rxe_qp.c b/drivers/infiniband/sw/rxe/rxe_qp.c index 00bda9380a2e..4469592b839d 100644 --- a/drivers/infiniband/sw/rxe/rxe_qp.c +++ b/drivers/infiniband/sw/rxe/rxe_qp.c @@ -275,8 +275,8 @@ static int rxe_qp_init_req(struct rxe_dev *rxe, struct rxe_qp *qp, qp->qp_timeout_jiffies = 0; /* Can't be set for UD/UC in modify_qp */ if (init->qp_type == IB_QPT_RC) { - setup_timer(&qp->rnr_nak_timer, rnr_nak_timer, (unsigned long)qp); - setup_timer(&qp->retrans_timer, retransmit_timer, (unsigned long)qp); + timer_setup(&qp->rnr_nak_timer, rnr_nak_timer, 0); + timer_setup(&qp->retrans_timer, retransmit_timer, 0); } return 0; } diff --git a/drivers/infiniband/sw/rxe/rxe_req.c b/drivers/infiniband/sw/rxe/rxe_req.c index d84222f9d5d2..26a7f923045b 100644 --- a/drivers/infiniband/sw/rxe/rxe_req.c +++ b/drivers/infiniband/sw/rxe/rxe_req.c @@ -118,9 +118,9 @@ static void req_retry(struct rxe_qp *qp) } } -void rnr_nak_timer(unsigned long data) +void rnr_nak_timer(struct timer_list *t) { - struct rxe_qp *qp = (struct rxe_qp *)data; + struct rxe_qp *qp = from_timer(qp, t, rnr_nak_timer); pr_debug("qp#%d rnr nak timer fired\n", qp_num(qp)); rxe_run_task(&qp->req.task, 1);