mirror of
https://github.com/rd-stuffs/msm-4.14.git
synced 2025-02-20 11:45:48 +08:00
IB/core: Register SA ibnl client during ib_core initialization
Move SA ibnl client registration to ib_core module init. This will allow us to register a single client to handle all RDMA_NL_LS operations and make it SA independent. Signed-off-by: Mark Bloch <markb@mellanox.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
This commit is contained in:
parent
c34d376187
commit
735c631ae9
@ -146,4 +146,9 @@ void ib_mad_cleanup(void);
|
|||||||
int ib_sa_init(void);
|
int ib_sa_init(void);
|
||||||
void ib_sa_cleanup(void);
|
void ib_sa_cleanup(void);
|
||||||
|
|
||||||
|
int ib_nl_handle_resolve_resp(struct sk_buff *skb,
|
||||||
|
struct netlink_callback *cb);
|
||||||
|
int ib_nl_handle_set_timeout(struct sk_buff *skb,
|
||||||
|
struct netlink_callback *cb);
|
||||||
|
|
||||||
#endif /* _CORE_PRIV_H */
|
#endif /* _CORE_PRIV_H */
|
||||||
|
@ -955,6 +955,26 @@ struct net_device *ib_get_net_dev_by_params(struct ib_device *dev,
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL(ib_get_net_dev_by_params);
|
EXPORT_SYMBOL(ib_get_net_dev_by_params);
|
||||||
|
|
||||||
|
static struct ibnl_client_cbs ibnl_ls_cb_table[] = {
|
||||||
|
[RDMA_NL_LS_OP_RESOLVE] = {
|
||||||
|
.dump = ib_nl_handle_resolve_resp,
|
||||||
|
.module = THIS_MODULE },
|
||||||
|
[RDMA_NL_LS_OP_SET_TIMEOUT] = {
|
||||||
|
.dump = ib_nl_handle_set_timeout,
|
||||||
|
.module = THIS_MODULE },
|
||||||
|
};
|
||||||
|
|
||||||
|
static int ib_add_ibnl_clients(void)
|
||||||
|
{
|
||||||
|
return ibnl_add_client(RDMA_NL_LS, ARRAY_SIZE(ibnl_ls_cb_table),
|
||||||
|
ibnl_ls_cb_table);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ib_remove_ibnl_clients(void)
|
||||||
|
{
|
||||||
|
ibnl_remove_client(RDMA_NL_LS);
|
||||||
|
}
|
||||||
|
|
||||||
static int __init ib_core_init(void)
|
static int __init ib_core_init(void)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
@ -1001,10 +1021,17 @@ static int __init ib_core_init(void)
|
|||||||
goto err_mad;
|
goto err_mad;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ib_add_ibnl_clients()) {
|
||||||
|
pr_warn("Couldn't register ibnl clients\n");
|
||||||
|
goto err_sa;
|
||||||
|
}
|
||||||
|
|
||||||
ib_cache_setup();
|
ib_cache_setup();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
err_sa:
|
||||||
|
ib_sa_cleanup();
|
||||||
err_mad:
|
err_mad:
|
||||||
ib_mad_cleanup();
|
ib_mad_cleanup();
|
||||||
err_addr:
|
err_addr:
|
||||||
@ -1023,6 +1050,7 @@ err:
|
|||||||
static void __exit ib_core_cleanup(void)
|
static void __exit ib_core_cleanup(void)
|
||||||
{
|
{
|
||||||
ib_cache_cleanup();
|
ib_cache_cleanup();
|
||||||
|
ib_remove_ibnl_clients();
|
||||||
ib_sa_cleanup();
|
ib_sa_cleanup();
|
||||||
ib_mad_cleanup();
|
ib_mad_cleanup();
|
||||||
addr_cleanup();
|
addr_cleanup();
|
||||||
|
@ -701,8 +701,8 @@ static void ib_nl_request_timeout(struct work_struct *work)
|
|||||||
spin_unlock_irqrestore(&ib_nl_request_lock, flags);
|
spin_unlock_irqrestore(&ib_nl_request_lock, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ib_nl_handle_set_timeout(struct sk_buff *skb,
|
int ib_nl_handle_set_timeout(struct sk_buff *skb,
|
||||||
struct netlink_callback *cb)
|
struct netlink_callback *cb)
|
||||||
{
|
{
|
||||||
const struct nlmsghdr *nlh = (struct nlmsghdr *)cb->nlh;
|
const struct nlmsghdr *nlh = (struct nlmsghdr *)cb->nlh;
|
||||||
int timeout, delta, abs_delta;
|
int timeout, delta, abs_delta;
|
||||||
@ -778,8 +778,8 @@ static inline int ib_nl_is_good_resolve_resp(const struct nlmsghdr *nlh)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ib_nl_handle_resolve_resp(struct sk_buff *skb,
|
int ib_nl_handle_resolve_resp(struct sk_buff *skb,
|
||||||
struct netlink_callback *cb)
|
struct netlink_callback *cb)
|
||||||
{
|
{
|
||||||
const struct nlmsghdr *nlh = (struct nlmsghdr *)cb->nlh;
|
const struct nlmsghdr *nlh = (struct nlmsghdr *)cb->nlh;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
@ -834,15 +834,6 @@ resp_out:
|
|||||||
return skb->len;
|
return skb->len;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct ibnl_client_cbs ib_sa_cb_table[] = {
|
|
||||||
[RDMA_NL_LS_OP_RESOLVE] = {
|
|
||||||
.dump = ib_nl_handle_resolve_resp,
|
|
||||||
.module = THIS_MODULE },
|
|
||||||
[RDMA_NL_LS_OP_SET_TIMEOUT] = {
|
|
||||||
.dump = ib_nl_handle_set_timeout,
|
|
||||||
.module = THIS_MODULE },
|
|
||||||
};
|
|
||||||
|
|
||||||
static void free_sm_ah(struct kref *kref)
|
static void free_sm_ah(struct kref *kref)
|
||||||
{
|
{
|
||||||
struct ib_sa_sm_ah *sm_ah = container_of(kref, struct ib_sa_sm_ah, ref);
|
struct ib_sa_sm_ah *sm_ah = container_of(kref, struct ib_sa_sm_ah, ref);
|
||||||
@ -1816,17 +1807,10 @@ int ib_sa_init(void)
|
|||||||
goto err3;
|
goto err3;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ibnl_add_client(RDMA_NL_LS, ARRAY_SIZE(ib_sa_cb_table),
|
|
||||||
ib_sa_cb_table)) {
|
|
||||||
pr_err("Failed to add netlink callback\n");
|
|
||||||
ret = -EINVAL;
|
|
||||||
goto err4;
|
|
||||||
}
|
|
||||||
INIT_DELAYED_WORK(&ib_nl_timed_work, ib_nl_request_timeout);
|
INIT_DELAYED_WORK(&ib_nl_timed_work, ib_nl_request_timeout);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
err4:
|
|
||||||
destroy_workqueue(ib_nl_wq);
|
|
||||||
err3:
|
err3:
|
||||||
mcast_cleanup();
|
mcast_cleanup();
|
||||||
err2:
|
err2:
|
||||||
@ -1837,7 +1821,6 @@ err1:
|
|||||||
|
|
||||||
void ib_sa_cleanup(void)
|
void ib_sa_cleanup(void)
|
||||||
{
|
{
|
||||||
ibnl_remove_client(RDMA_NL_LS);
|
|
||||||
cancel_delayed_work(&ib_nl_timed_work);
|
cancel_delayed_work(&ib_nl_timed_work);
|
||||||
flush_workqueue(ib_nl_wq);
|
flush_workqueue(ib_nl_wq);
|
||||||
destroy_workqueue(ib_nl_wq);
|
destroy_workqueue(ib_nl_wq);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user