Commit f3906bd3 authored by Matan Barak's avatar Matan Barak Committed by Doug Ledford

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: default avatarMatan Barak <matanb@mellanox.com>
Reviewed-by: default avatarHaggai Eran <haggaie@mellanox.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent 882f3b3b
...@@ -112,6 +112,19 @@ struct ib_gid_table { ...@@ -112,6 +112,19 @@ struct ib_gid_table {
struct ib_gid_table_entry *data_vec; 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, static int write_gid(struct ib_device *ib_dev, u8 port,
struct ib_gid_table *table, int ix, struct ib_gid_table *table, int ix,
const union ib_gid *gid, const union ib_gid *gid,
...@@ -164,15 +177,9 @@ static int write_gid(struct ib_device *ib_dev, u8 port, ...@@ -164,15 +177,9 @@ static int write_gid(struct ib_device *ib_dev, u8 port,
write_unlock_irqrestore(&table->data_vec[ix].lock, flags); write_unlock_irqrestore(&table->data_vec[ix].lock, flags);
if (!ret && rdma_cap_roce_gid_table(ib_dev, port)) { if (!ret)
struct ib_event event; 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; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment