* [PATCH v1] ibacm: Handle EP expiration time
@ 2016-09-19 7:46 Yuval Shaia
[not found] ` <1474271168-22662-1-git-send-email-yuval.shaia-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Yuval Shaia @ 2016-09-19 7:46 UTC (permalink / raw)
To: sean.hefty-ral2JQCrhuEAvxtiuMwx3w,
linux-rdma-u79uwXL29TY76Z2rM5mHXA
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 <yuval.shaia-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
---
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;
--
1.7.1
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 3+ messages in thread[parent not found: <1474271168-22662-1-git-send-email-yuval.shaia-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>]
* Re: [PATCH v1] ibacm: Handle EP expiration time [not found] ` <1474271168-22662-1-git-send-email-yuval.shaia-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> @ 2016-09-19 11:22 ` Hal Rosenstock [not found] ` <387b0fc4-949f-b8e2-6ac3-136e5ab2e127-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org> 0 siblings, 1 reply; 3+ messages in thread From: Hal Rosenstock @ 2016-09-19 11:22 UTC (permalink / raw) To: Yuval Shaia, sean.hefty-ral2JQCrhuEAvxtiuMwx3w, linux-rdma-u79uwXL29TY76Z2rM5mHXA On 9/19/2016 3:46 AM, Yuval Shaia wrote: > 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 <yuval.shaia-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> > --- > 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) { Nit related to the timeout check: In acmp.c, (uint64_t)~0ULL is used in other places for this. Should this addr_timeout check be changed to some infinite or no timeout define along with the other occurrences for consistency and better code readability ? -- Hal > + 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; > -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 3+ messages in thread
[parent not found: <387b0fc4-949f-b8e2-6ac3-136e5ab2e127-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>]
* Re: [PATCH v1] ibacm: Handle EP expiration time [not found] ` <387b0fc4-949f-b8e2-6ac3-136e5ab2e127-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org> @ 2016-09-19 13:21 ` Yuval Shaia 0 siblings, 0 replies; 3+ messages in thread From: Yuval Shaia @ 2016-09-19 13:21 UTC (permalink / raw) To: Hal Rosenstock Cc: sean.hefty-ral2JQCrhuEAvxtiuMwx3w, linux-rdma-u79uwXL29TY76Z2rM5mHXA On Mon, Sep 19, 2016 at 07:22:54AM -0400, Hal Rosenstock wrote: > > + > > 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) { > > Nit related to the timeout check: > In acmp.c, (uint64_t)~0ULL is used in other places for this. Should this > addr_timeout check be changed to some infinite or no timeout define > along with the other occurrences for consistency and better code > readability ? Will do. > > -- Hal > > > + 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; > > + } -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-09-19 13:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-19 7:46 [PATCH v1] ibacm: Handle EP expiration time Yuval Shaia
[not found] ` <1474271168-22662-1-git-send-email-yuval.shaia-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2016-09-19 11:22 ` Hal Rosenstock
[not found] ` <387b0fc4-949f-b8e2-6ac3-136e5ab2e127-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2016-09-19 13:21 ` Yuval Shaia
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox