Message ID | CAMGffEmYeYeRVk84GY1CWekNHF7_V4Lo4PDxoGb5wAd8-Tnn7Q@mail.gmail.com (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
On Mon, Jan 02, 2017 at 01:17:36PM +0100, Jinpu Wang wrote: > +++ b/include/rdma/ib_verbs.h > @@ -1781,6 +1781,7 @@ struct ib_cache { > struct ib_pkey_cache **pkey_cache; > struct ib_gid_table **gid_cache; > u8 *lmc_cache; > + enum ib_port_state *port_state_cache; > }; I think at this point the these per-port arrays should be moved into a struct.. Jason -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Tue, Jan 3, 2017 at 8:18 PM, Jason Gunthorpe <jgunthorpe@obsidianresearch.com> wrote: > On Mon, Jan 02, 2017 at 01:17:36PM +0100, Jinpu Wang wrote: >> +++ b/include/rdma/ib_verbs.h >> @@ -1781,6 +1781,7 @@ struct ib_cache { >> struct ib_pkey_cache **pkey_cache; >> struct ib_gid_table **gid_cache; >> u8 *lmc_cache; >> + enum ib_port_state *port_state_cache; >> }; > > I think at this point the these per-port arrays should be moved into a > struct.. > > Jason Ok, I will create a struct ib_port_cache, which contains lmc_cache and port_state_cache. Will submit later today. Thanks, Jason
On Wed, Jan 4, 2017 at 9:50 AM, Jinpu Wang <jinpu.wang@profitbricks.com> wrote: > On Tue, Jan 3, 2017 at 8:18 PM, Jason Gunthorpe > <jgunthorpe@obsidianresearch.com> wrote: >> On Mon, Jan 02, 2017 at 01:17:36PM +0100, Jinpu Wang wrote: >>> +++ b/include/rdma/ib_verbs.h >>> @@ -1781,6 +1781,7 @@ struct ib_cache { >>> struct ib_pkey_cache **pkey_cache; >>> struct ib_gid_table **gid_cache; >>> u8 *lmc_cache; >>> + enum ib_port_state *port_state_cache; >>> }; >> >> I think at this point the these per-port arrays should be moved into a >> struct.. >> >> Jason > > Ok, I will create a struct ib_port_cache, which contains lmc_cache and > port_state_cache. > > Will submit later today. > > Thanks, Jason > Hi Jason, I looked a bit deeper, looks all these four elements are per port cache, it will take some time, and I have other more urgent task to do, can we do it later, after this bug fix patchset merged, I will put the cleanup task on my TODO list, will address it later. Thanks,
On Wed, Jan 4, 2017 at 12:58 PM, Jinpu Wang <jinpu.wang@profitbricks.com> wrote: > On Wed, Jan 4, 2017 at 9:50 AM, Jinpu Wang <jinpu.wang@profitbricks.com> wrote: >> On Tue, Jan 3, 2017 at 8:18 PM, Jason Gunthorpe >> <jgunthorpe@obsidianresearch.com> wrote: >>> On Mon, Jan 02, 2017 at 01:17:36PM +0100, Jinpu Wang wrote: >>>> +++ b/include/rdma/ib_verbs.h >>>> @@ -1781,6 +1781,7 @@ struct ib_cache { >>>> struct ib_pkey_cache **pkey_cache; >>>> struct ib_gid_table **gid_cache; >>>> u8 *lmc_cache; >>>> + enum ib_port_state *port_state_cache; >>>> }; >>> >>> I think at this point the these per-port arrays should be moved into a >>> struct.. >>> >>> Jason >> >> Ok, I will create a struct ib_port_cache, which contains lmc_cache and >> port_state_cache. >> >> Will submit later today. >> >> Thanks, Jason >> > Hi Jason, > > I looked a bit deeper, looks all these four elements are per port > cache, it will take some time, > and I have other more urgent task to do, can we do it later, after > this bug fix patchset merged, > I will put the cleanup task on my TODO list, will address it later. > > Thanks, It's easier than I thought, I will sent out as incremental patch based on this patch.
From 83a45b0e34bb8515ec9db51629aa4e7e37dfc2e8 Mon Sep 17 00:00:00 2001 From: Jack Wang <jinpu.wang@profitbricks.com> Date: Mon, 12 Dec 2016 09:52:42 +0100 Subject: [PATCH 1/4] IB/core: add port state cache We need a port state cache in ib_core, later we will use in rdma_cm. Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com> Reviewed-by: Michael Wang <yun.wang@profitbricks.com> Acked-by: Sean Hefty <sean.hefty@intel.com> --- drivers/infiniband/core/cache.c | 10 +++++++++- include/rdma/ib_verbs.h | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/core/cache.c b/drivers/infiniband/core/cache.c index ae04826..87fd7c3 100644 --- a/drivers/infiniband/core/cache.c +++ b/drivers/infiniband/core/cache.c @@ -1105,6 +1105,8 @@ static void ib_cache_update(struct ib_device *device, } device->cache.lmc_cache[port - rdma_start_port(device)] = tprops->lmc; + device->cache.port_state_cache[port - rdma_start_port(device)] = + tprops->state; write_unlock_irq(&device->cache.lock); @@ -1164,7 +1166,11 @@ int ib_cache_setup_one(struct ib_device *device) (rdma_end_port(device) - rdma_start_port(device) + 1), GFP_KERNEL); - if (!device->cache.pkey_cache || + device->cache.port_state_cache = kmalloc(sizeof *device->cache.port_state_cache * + (rdma_end_port(device) - + rdma_start_port(device) + 1), + GFP_KERNEL); + if (!device->cache.pkey_cache || !device->cache.port_state_cache || !device->cache.lmc_cache) { err = -ENOMEM; goto free; @@ -1190,6 +1196,7 @@ int ib_cache_setup_one(struct ib_device *device) free: kfree(device->cache.pkey_cache); kfree(device->cache.lmc_cache); + kfree(device->cache.port_state_cache); return err; } @@ -1211,6 +1218,7 @@ void ib_cache_release_one(struct ib_device *device) gid_table_release_one(device); kfree(device->cache.pkey_cache); kfree(device->cache.lmc_cache); + kfree(device->cache.port_state_cache); } void ib_cache_cleanup_one(struct ib_device *device) diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index 8029d2a..7115c0f 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h @@ -1781,6 +1781,7 @@ struct ib_cache { struct ib_pkey_cache **pkey_cache; struct ib_gid_table **gid_cache; u8 *lmc_cache; + enum ib_port_state *port_state_cache; }; struct ib_dma_mapping_ops { -- 2.7.4