From patchwork Mon Sep 19 07:46:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yuval Shaia X-Patchwork-Id: 9338735 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 A18D66077A for ; Mon, 19 Sep 2016 07:46:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 940CE28EE3 for ; Mon, 19 Sep 2016 07:46:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8860A28756; Mon, 19 Sep 2016 07:46:16 +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.4 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, UNPARSEABLE_RELAY 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 EF83A28756 for ; Mon, 19 Sep 2016 07:46:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751914AbcISHqP (ORCPT ); Mon, 19 Sep 2016 03:46:15 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:42109 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751316AbcISHqO (ORCPT ); Mon, 19 Sep 2016 03:46:14 -0400 Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u8J7kBun020647 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 19 Sep 2016 07:46:12 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id u8J7kBOt020792 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 19 Sep 2016 07:46:11 GMT Received: from abhmp0005.oracle.com (abhmp0005.oracle.com [141.146.116.11]) by userv0121.oracle.com (8.13.8/8.13.8) with ESMTP id u8J7k9mt002163; Mon, 19 Sep 2016 07:46:11 GMT Received: from yuval-net-srv-ca.us.oracle.com (/10.211.3.188) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 19 Sep 2016 00:46:08 -0700 From: Yuval Shaia To: sean.hefty@intel.com, linux-rdma@vger.kernel.org Subject: [PATCH v1] ibacm: Handle EP expiration time Date: Mon, 19 Sep 2016 00:46:08 -0700 Message-Id: <1474271168-22662-1-git-send-email-yuval.shaia@oracle.com> X-Mailer: git-send-email 1.7.1 X-Source-IP: aserv0022.oracle.com [141.146.126.234] 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 Old destination records are removed from EP's dest_map after timeout is expired in order to maintain a correct cache. Signed-off-by: Yuval Shaia --- v0 -> v1: * Move the status and timeout check to acmp_acquire_dest (i.e. deleteis_dest_ready). * Fix typo (Record expiered). * Use NULL instead of 0 --- prov/acmp/src/acmp.c | 29 ++++++++++++++++++++--------- 1 files changed, 20 insertions(+), 9 deletions(-) diff --git a/prov/acmp/src/acmp.c b/prov/acmp/src/acmp.c index ec64631..1778ca3 100644 --- a/prov/acmp/src/acmp.c +++ b/prov/acmp/src/acmp.c @@ -356,6 +356,16 @@ acmp_put_dest(struct acmp_dest *dest) } } +/* Caller must hold ep lock. */ +static void +acmp_remove_dest(struct acmp_ep *ep, struct acmp_dest *dest) +{ + acm_log(2, "%s\n", dest->name); + tdelete(dest->address, &ep->dest_map[dest->addr_type - 1], + acmp_compare_dest); + acmp_put_dest(dest); +} + static struct acmp_dest * acmp_acquire_dest(struct acmp_ep *ep, uint8_t addr_type, const uint8_t *addr) { @@ -366,6 +376,16 @@ acmp_acquire_dest(struct acmp_ep *ep, uint8_t addr_type, const uint8_t *addr) acm_log(2, "%s\n", log_data); lock_acquire(&ep->lock); dest = acmp_get_dest(ep, addr_type, addr); + if (dest && dest->state == ACMP_READY && + dest->addr_timeout != 0xFFFFFFFFFFFFFFFF) { + acm_log(2, "Record valid for the next %ld minute(s)\n", + dest->addr_timeout - time_stamp_min()); + if (time_stamp_min() >= dest->addr_timeout) { + acm_log(2, "Record expired\n"); + acmp_remove_dest(ep, dest); + dest = NULL; + } + } if (!dest) { dest = acmp_alloc_dest(addr_type, addr); if (dest) { @@ -378,15 +398,6 @@ acmp_acquire_dest(struct acmp_ep *ep, uint8_t addr_type, const uint8_t *addr) return dest; } -/* Caller must hold ep lock. */ -//static void -//acmp_remove_dest(struct acmp_ep *ep, struct acmp_dest *dest) -//{ -// acm_log(2, "%s\n", dest->name); -// tdelete(dest->address, &ep->dest_map[dest->addr_type - 1], acmp_compare_dest); -// acmp_put_dest(dest); -//} - static struct acmp_request *acmp_alloc_req(uint64_t id, struct acm_msg *msg) { struct acmp_request *req;