diff options
author | Matan Barak <matanb@mellanox.com> | 2015-10-28 14:52:39 (GMT) |
---|---|---|
committer | Doug Ledford <dledford@redhat.com> | 2015-12-23 15:19:54 (GMT) |
commit | f3906bd36087dd3440ecaf6e044690374d01f927 (patch) | |
tree | fb51c919126dcf12d6cb38340db7bc412ff60786 | |
parent | 882f3b3b916a01c703bf7516800a0dca741cd3e7 (diff) | |
download | linux-f3906bd36087dd3440ecaf6e044690374d01f927.tar.xz |
IB/core: Refactor GID cache's ib_dispatch_event
Refactor ib_dispatch_event into a new function in order to avoid
duplicating code in the next patch.
Signed-off-by: Matan Barak <matanb@mellanox.com>
Reviewed-by: Haggai Eran <haggaie@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
-rw-r--r-- | drivers/infiniband/core/cache.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/drivers/infiniband/core/cache.c b/drivers/infiniband/core/cache.c index 89bebea..f0703d2 100644 --- a/drivers/infiniband/core/cache.c +++ b/drivers/infiniband/core/cache.c @@ -112,6 +112,19 @@ struct ib_gid_table { struct ib_gid_table_entry *data_vec; }; +static void dispatch_gid_change_event(struct ib_device *ib_dev, u8 port) +{ + if (rdma_cap_roce_gid_table(ib_dev, port)) { + struct ib_event event; + + event.device = ib_dev; + event.element.port_num = port; + event.event = IB_EVENT_GID_CHANGE; + + ib_dispatch_event(&event); + } +} + static int write_gid(struct ib_device *ib_dev, u8 port, struct ib_gid_table *table, int ix, const union ib_gid *gid, @@ -164,15 +177,9 @@ static int write_gid(struct ib_device *ib_dev, u8 port, write_unlock_irqrestore(&table->data_vec[ix].lock, flags); - if (!ret && rdma_cap_roce_gid_table(ib_dev, port)) { - struct ib_event event; + if (!ret) + dispatch_gid_change_event(ib_dev, port); - event.device = ib_dev; - event.element.port_num = port; - event.event = IB_EVENT_GID_CHANGE; - - ib_dispatch_event(&event); - } return ret; } |