blob: 12523f630b6147e35160b4f0f6ac6a0d4e804572 [file] [log] [blame]
Sean Hefty7025fcd2006-06-17 20:37:28 -07001/*
2 * Copyright (c) 2005 Voltaire Inc. All rights reserved.
3 * Copyright (c) 2002-2005, Network Appliance, Inc. All rights reserved.
4 * Copyright (c) 1999-2005, Mellanox Technologies, Inc. All rights reserved.
5 * Copyright (c) 2005 Intel Corporation. All rights reserved.
6 *
Sean Heftya9474912008-07-14 23:48:43 -07007 * This software is available to you under a choice of one of two
8 * licenses. You may choose to be licensed under the terms of the GNU
9 * General Public License (GPL) Version 2, available from the file
10 * COPYING in the main directory of this source tree, or the
11 * OpenIB.org BSD license below:
Sean Hefty7025fcd2006-06-17 20:37:28 -070012 *
Sean Heftya9474912008-07-14 23:48:43 -070013 * Redistribution and use in source and binary forms, with or
14 * without modification, are permitted provided that the following
15 * conditions are met:
Sean Hefty7025fcd2006-06-17 20:37:28 -070016 *
Sean Heftya9474912008-07-14 23:48:43 -070017 * - Redistributions of source code must retain the above
18 * copyright notice, this list of conditions and the following
19 * disclaimer.
Sean Hefty7025fcd2006-06-17 20:37:28 -070020 *
Sean Heftya9474912008-07-14 23:48:43 -070021 * - Redistributions in binary form must reproduce the above
22 * copyright notice, this list of conditions and the following
23 * disclaimer in the documentation and/or other materials
24 * provided with the distribution.
Sean Hefty7025fcd2006-06-17 20:37:28 -070025 *
Sean Heftya9474912008-07-14 23:48:43 -070026 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
27 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
28 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
29 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
30 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
31 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
32 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33 * SOFTWARE.
Sean Hefty7025fcd2006-06-17 20:37:28 -070034 */
35
36#include <linux/mutex.h>
37#include <linux/inetdevice.h>
Tejun Heo5a0e3ad2010-03-24 17:04:11 +090038#include <linux/slab.h>
Sean Hefty7025fcd2006-06-17 20:37:28 -070039#include <linux/workqueue.h>
Paul Gortmakere4dd23d2011-05-27 15:35:46 -040040#include <linux/module.h>
Sean Hefty7025fcd2006-06-17 20:37:28 -070041#include <net/arp.h>
42#include <net/neighbour.h>
43#include <net/route.h>
Tom Tuckere795d092006-07-30 20:44:19 -070044#include <net/netevent.h>
Aleksey Senin38617c62008-12-24 10:16:37 -080045#include <net/addrconf.h>
46#include <net/ip6_route.h>
Sean Hefty7025fcd2006-06-17 20:37:28 -070047#include <rdma/ib_addr.h>
Sean Heftyef560862013-05-29 10:09:10 -070048#include <rdma/ib.h>
Mark Blochae43f822016-05-19 17:12:36 +030049#include <rdma/rdma_netlink.h>
50#include <net/netlink.h>
51
52#include "core_priv.h"
Sean Hefty7025fcd2006-06-17 20:37:28 -070053
Sean Hefty7025fcd2006-06-17 20:37:28 -070054struct addr_req {
55 struct list_head list;
Aleksey Senin38617c62008-12-24 10:16:37 -080056 struct sockaddr_storage src_addr;
57 struct sockaddr_storage dst_addr;
Sean Hefty7025fcd2006-06-17 20:37:28 -070058 struct rdma_dev_addr *addr;
Sean Hefty7a118df2006-10-31 11:12:59 -080059 struct rdma_addr_client *client;
Sean Hefty7025fcd2006-06-17 20:37:28 -070060 void *context;
61 void (*callback)(int status, struct sockaddr *src_addr,
62 struct rdma_dev_addr *addr, void *context);
63 unsigned long timeout;
Parav Pandit5fff41e2017-08-01 09:41:34 +030064 struct delayed_work work;
Sean Hefty7025fcd2006-06-17 20:37:28 -070065 int status;
Mark Blochae43f822016-05-19 17:12:36 +030066 u32 seq;
Sean Hefty7025fcd2006-06-17 20:37:28 -070067};
68
Mark Blochae43f822016-05-19 17:12:36 +030069static atomic_t ib_nl_addr_request_seq = ATOMIC_INIT(0);
70
David Howellsc4028952006-11-22 14:57:56 +000071static void process_req(struct work_struct *work);
Sean Hefty7025fcd2006-06-17 20:37:28 -070072
73static DEFINE_MUTEX(lock);
74static LIST_HEAD(req_list);
David Howellsc4028952006-11-22 14:57:56 +000075static DECLARE_DELAYED_WORK(work, process_req);
Sean Hefty7025fcd2006-06-17 20:37:28 -070076static struct workqueue_struct *addr_wq;
77
Mark Blochae43f822016-05-19 17:12:36 +030078static const struct nla_policy ib_nl_addr_policy[LS_NLA_TYPE_MAX] = {
79 [LS_NLA_TYPE_DGID] = {.type = NLA_BINARY,
80 .len = sizeof(struct rdma_nla_ls_gid)},
81};
82
83static inline bool ib_nl_is_good_ip_resp(const struct nlmsghdr *nlh)
84{
85 struct nlattr *tb[LS_NLA_TYPE_MAX] = {};
86 int ret;
87
88 if (nlh->nlmsg_flags & RDMA_NL_LS_F_ERR)
89 return false;
90
91 ret = nla_parse(tb, LS_NLA_TYPE_MAX - 1, nlmsg_data(nlh),
Johannes Bergfceb6432017-04-12 14:34:07 +020092 nlmsg_len(nlh), ib_nl_addr_policy, NULL);
Mark Blochae43f822016-05-19 17:12:36 +030093 if (ret)
94 return false;
95
96 return true;
97}
98
99static void ib_nl_process_good_ip_rsep(const struct nlmsghdr *nlh)
100{
101 const struct nlattr *head, *curr;
102 union ib_gid gid;
103 struct addr_req *req;
104 int len, rem;
105 int found = 0;
106
107 head = (const struct nlattr *)nlmsg_data(nlh);
108 len = nlmsg_len(nlh);
109
110 nla_for_each_attr(curr, head, len, rem) {
111 if (curr->nla_type == LS_NLA_TYPE_DGID)
112 memcpy(&gid, nla_data(curr), nla_len(curr));
113 }
114
115 mutex_lock(&lock);
116 list_for_each_entry(req, &req_list, list) {
117 if (nlh->nlmsg_seq != req->seq)
118 continue;
119 /* We set the DGID part, the rest was set earlier */
120 rdma_addr_set_dgid(req->addr, &gid);
121 req->status = 0;
122 found = 1;
123 break;
124 }
125 mutex_unlock(&lock);
126
127 if (!found)
128 pr_info("Couldn't find request waiting for DGID: %pI6\n",
129 &gid);
130}
131
132int ib_nl_handle_ip_res_resp(struct sk_buff *skb,
Leon Romanovsky647c75a2017-06-15 14:20:39 +0300133 struct nlmsghdr *nlh,
134 struct netlink_ext_ack *extack)
Mark Blochae43f822016-05-19 17:12:36 +0300135{
Mark Blochae43f822016-05-19 17:12:36 +0300136 if ((nlh->nlmsg_flags & NLM_F_REQUEST) ||
Leon Romanovskye3a2b932017-06-12 16:00:19 +0300137 !(NETLINK_CB(skb).sk))
Mark Blochae43f822016-05-19 17:12:36 +0300138 return -EPERM;
139
140 if (ib_nl_is_good_ip_resp(nlh))
141 ib_nl_process_good_ip_rsep(nlh);
142
143 return skb->len;
144}
145
146static int ib_nl_ip_send_msg(struct rdma_dev_addr *dev_addr,
147 const void *daddr,
148 u32 seq, u16 family)
149{
150 struct sk_buff *skb = NULL;
151 struct nlmsghdr *nlh;
152 struct rdma_ls_ip_resolve_header *header;
153 void *data;
154 size_t size;
155 int attrtype;
156 int len;
157
158 if (family == AF_INET) {
159 size = sizeof(struct in_addr);
160 attrtype = RDMA_NLA_F_MANDATORY | LS_NLA_TYPE_IPV4;
161 } else {
162 size = sizeof(struct in6_addr);
163 attrtype = RDMA_NLA_F_MANDATORY | LS_NLA_TYPE_IPV6;
164 }
165
166 len = nla_total_size(sizeof(size));
167 len += NLMSG_ALIGN(sizeof(*header));
168
169 skb = nlmsg_new(len, GFP_KERNEL);
170 if (!skb)
171 return -ENOMEM;
172
173 data = ibnl_put_msg(skb, &nlh, seq, 0, RDMA_NL_LS,
174 RDMA_NL_LS_OP_IP_RESOLVE, NLM_F_REQUEST);
175 if (!data) {
176 nlmsg_free(skb);
177 return -ENODATA;
178 }
179
180 /* Construct the family header first */
Johannes Berg4df864c2017-06-16 14:29:21 +0200181 header = skb_put(skb, NLMSG_ALIGN(sizeof(*header)));
Mark Blochae43f822016-05-19 17:12:36 +0300182 header->ifindex = dev_addr->bound_dev_if;
183 nla_put(skb, attrtype, size, daddr);
184
185 /* Repair the nlmsg header length */
186 nlmsg_end(skb, nlh);
Leon Romanovsky4d7f6932017-06-18 15:44:32 +0300187 rdma_nl_multicast(skb, RDMA_NL_GROUP_LS, GFP_KERNEL);
Mark Blochae43f822016-05-19 17:12:36 +0300188
189 /* Make the request retry, so when we get the response from userspace
190 * we will have something.
191 */
192 return -ENODATA;
193}
194
Sean Heftyef560862013-05-29 10:09:10 -0700195int rdma_addr_size(struct sockaddr *addr)
196{
197 switch (addr->sa_family) {
198 case AF_INET:
199 return sizeof(struct sockaddr_in);
200 case AF_INET6:
201 return sizeof(struct sockaddr_in6);
202 case AF_IB:
203 return sizeof(struct sockaddr_ib);
204 default:
205 return 0;
206 }
207}
208EXPORT_SYMBOL(rdma_addr_size);
209
Matan Barakdd5f03b2013-12-12 18:03:11 +0200210static struct rdma_addr_client self;
211
Sean Hefty7a118df2006-10-31 11:12:59 -0800212void rdma_addr_register_client(struct rdma_addr_client *client)
213{
214 atomic_set(&client->refcount, 1);
215 init_completion(&client->comp);
216}
217EXPORT_SYMBOL(rdma_addr_register_client);
218
219static inline void put_client(struct rdma_addr_client *client)
220{
221 if (atomic_dec_and_test(&client->refcount))
222 complete(&client->comp);
223}
224
225void rdma_addr_unregister_client(struct rdma_addr_client *client)
226{
227 put_client(client);
228 wait_for_completion(&client->comp);
229}
230EXPORT_SYMBOL(rdma_addr_unregister_client);
231
Tom Tucker07ebafb2006-08-03 16:02:42 -0500232int rdma_copy_addr(struct rdma_dev_addr *dev_addr, struct net_device *dev,
233 const unsigned char *dst_dev_addr)
Sean Hefty7025fcd2006-06-17 20:37:28 -0700234{
Sean Heftyc4315d82009-11-19 12:57:18 -0800235 dev_addr->dev_type = dev->type;
Sean Hefty7025fcd2006-06-17 20:37:28 -0700236 memcpy(dev_addr->src_dev_addr, dev->dev_addr, MAX_ADDR_LEN);
237 memcpy(dev_addr->broadcast, dev->broadcast, MAX_ADDR_LEN);
238 if (dst_dev_addr)
239 memcpy(dev_addr->dst_dev_addr, dst_dev_addr, MAX_ADDR_LEN);
Sean Hefty6266ed62009-11-19 12:55:22 -0800240 dev_addr->bound_dev_if = dev->ifindex;
Sean Hefty7025fcd2006-06-17 20:37:28 -0700241 return 0;
242}
Tom Tucker07ebafb2006-08-03 16:02:42 -0500243EXPORT_SYMBOL(rdma_copy_addr);
Sean Hefty7025fcd2006-06-17 20:37:28 -0700244
Matan Barak20029832015-12-23 14:56:53 +0200245int rdma_translate_ip(const struct sockaddr *addr,
246 struct rdma_dev_addr *dev_addr,
Matan Barakdd5f03b2013-12-12 18:03:11 +0200247 u16 *vlan_id)
Sean Hefty7025fcd2006-06-17 20:37:28 -0700248{
249 struct net_device *dev;
Aleksey Senin38617c62008-12-24 10:16:37 -0800250 int ret = -EADDRNOTAVAIL;
Sean Hefty7025fcd2006-06-17 20:37:28 -0700251
Sean Hefty6266ed62009-11-19 12:55:22 -0800252 if (dev_addr->bound_dev_if) {
Guy Shapiro565edd12015-10-22 15:20:08 +0300253 dev = dev_get_by_index(dev_addr->net, dev_addr->bound_dev_if);
Sean Hefty6266ed62009-11-19 12:55:22 -0800254 if (!dev)
255 return -ENODEV;
256 ret = rdma_copy_addr(dev_addr, dev, NULL);
257 dev_put(dev);
258 return ret;
259 }
260
Aleksey Senin38617c62008-12-24 10:16:37 -0800261 switch (addr->sa_family) {
262 case AF_INET:
Guy Shapiro565edd12015-10-22 15:20:08 +0300263 dev = ip_dev_find(dev_addr->net,
Matan Barak20029832015-12-23 14:56:53 +0200264 ((const struct sockaddr_in *)addr)->sin_addr.s_addr);
Sean Hefty7025fcd2006-06-17 20:37:28 -0700265
Aleksey Senin38617c62008-12-24 10:16:37 -0800266 if (!dev)
267 return ret;
268
269 ret = rdma_copy_addr(dev_addr, dev, NULL);
Moni Shouacbd09ae2017-05-23 10:48:45 +0300270 dev_addr->bound_dev_if = dev->ifindex;
Matan Barakdd5f03b2013-12-12 18:03:11 +0200271 if (vlan_id)
272 *vlan_id = rdma_vlan_dev_vlan_id(dev);
Aleksey Senin38617c62008-12-24 10:16:37 -0800273 dev_put(dev);
274 break;
Roland Dreierd90f9b32012-07-05 22:39:34 -0700275#if IS_ENABLED(CONFIG_IPV6)
Aleksey Senin38617c62008-12-24 10:16:37 -0800276 case AF_INET6:
Eric Dumazet22f4fbd2010-11-24 11:41:56 -0800277 rcu_read_lock();
Guy Shapiro565edd12015-10-22 15:20:08 +0300278 for_each_netdev_rcu(dev_addr->net, dev) {
279 if (ipv6_chk_addr(dev_addr->net,
Matan Barak20029832015-12-23 14:56:53 +0200280 &((const struct sockaddr_in6 *)addr)->sin6_addr,
Aleksey Senin38617c62008-12-24 10:16:37 -0800281 dev, 1)) {
282 ret = rdma_copy_addr(dev_addr, dev, NULL);
Moni Shouacbd09ae2017-05-23 10:48:45 +0300283 dev_addr->bound_dev_if = dev->ifindex;
Matan Barakdd5f03b2013-12-12 18:03:11 +0200284 if (vlan_id)
285 *vlan_id = rdma_vlan_dev_vlan_id(dev);
Aleksey Senin38617c62008-12-24 10:16:37 -0800286 break;
287 }
288 }
Eric Dumazet22f4fbd2010-11-24 11:41:56 -0800289 rcu_read_unlock();
Aleksey Senin38617c62008-12-24 10:16:37 -0800290 break;
Roland Dreier2c4ab622008-12-29 23:37:14 -0800291#endif
Aleksey Senin38617c62008-12-24 10:16:37 -0800292 }
Sean Hefty7025fcd2006-06-17 20:37:28 -0700293 return ret;
294}
295EXPORT_SYMBOL(rdma_translate_ip);
296
Parav Pandit5fff41e2017-08-01 09:41:34 +0300297static void set_timeout(struct delayed_work *delayed_work, unsigned long time)
Sean Hefty7025fcd2006-06-17 20:37:28 -0700298{
299 unsigned long delay;
300
Sean Hefty7025fcd2006-06-17 20:37:28 -0700301 delay = time - jiffies;
Or Kehati346f98b2014-10-29 16:32:04 +0200302 if ((long)delay < 0)
303 delay = 0;
Sean Hefty7025fcd2006-06-17 20:37:28 -0700304
Parav Pandit5fff41e2017-08-01 09:41:34 +0300305 mod_delayed_work(addr_wq, delayed_work, delay);
Sean Hefty7025fcd2006-06-17 20:37:28 -0700306}
307
308static void queue_req(struct addr_req *req)
309{
310 struct addr_req *temp_req;
311
312 mutex_lock(&lock);
313 list_for_each_entry_reverse(temp_req, &req_list, list) {
Krishna Kumarf115db42006-10-17 10:09:09 +0530314 if (time_after_eq(req->timeout, temp_req->timeout))
Sean Hefty7025fcd2006-06-17 20:37:28 -0700315 break;
316 }
317
318 list_add(&req->list, &temp_req->list);
319
Parav Pandit5fff41e2017-08-01 09:41:34 +0300320 set_timeout(&req->work, req->timeout);
Sean Hefty7025fcd2006-06-17 20:37:28 -0700321 mutex_unlock(&lock);
322}
323
Mark Blochae43f822016-05-19 17:12:36 +0300324static int ib_nl_fetch_ha(struct dst_entry *dst, struct rdma_dev_addr *dev_addr,
325 const void *daddr, u32 seq, u16 family)
326{
Leon Romanovskyff61c422017-06-18 15:51:16 +0300327 if (rdma_nl_chk_listeners(RDMA_NL_GROUP_LS))
Mark Blochae43f822016-05-19 17:12:36 +0300328 return -EADDRNOTAVAIL;
329
330 /* We fill in what we can, the response will fill the rest */
331 rdma_copy_addr(dev_addr, dst->dev, NULL);
332 return ib_nl_ip_send_msg(dev_addr, daddr, seq, family);
333}
334
Matan Barak20029832015-12-23 14:56:53 +0200335static int dst_fetch_ha(struct dst_entry *dst, struct rdma_dev_addr *dev_addr,
336 const void *daddr)
David Miller51d45972011-12-02 16:52:14 +0000337{
338 struct neighbour *n;
339 int ret;
340
David Miller02b61952012-01-24 13:15:52 +0000341 n = dst_neigh_lookup(dst, daddr);
342
David Miller51d45972011-12-02 16:52:14 +0000343 rcu_read_lock();
David Miller51d45972011-12-02 16:52:14 +0000344 if (!n || !(n->nud_state & NUD_VALID)) {
345 if (n)
346 neigh_event_send(n, NULL);
347 ret = -ENODATA;
348 } else {
David Miller02b61952012-01-24 13:15:52 +0000349 ret = rdma_copy_addr(dev_addr, dst->dev, n->ha);
David Miller51d45972011-12-02 16:52:14 +0000350 }
351 rcu_read_unlock();
352
David Miller02b61952012-01-24 13:15:52 +0000353 if (n)
354 neigh_release(n);
355
David Miller51d45972011-12-02 16:52:14 +0000356 return ret;
357}
358
Mark Blochae43f822016-05-19 17:12:36 +0300359static bool has_gateway(struct dst_entry *dst, sa_family_t family)
360{
361 struct rtable *rt;
362 struct rt6_info *rt6;
363
364 if (family == AF_INET) {
365 rt = container_of(dst, struct rtable, dst);
366 return rt->rt_uses_gateway;
367 }
368
369 rt6 = container_of(dst, struct rt6_info, dst);
370 return rt6->rt6i_flags & RTF_GATEWAY;
371}
372
373static int fetch_ha(struct dst_entry *dst, struct rdma_dev_addr *dev_addr,
374 const struct sockaddr *dst_in, u32 seq)
375{
376 const struct sockaddr_in *dst_in4 =
377 (const struct sockaddr_in *)dst_in;
378 const struct sockaddr_in6 *dst_in6 =
379 (const struct sockaddr_in6 *)dst_in;
380 const void *daddr = (dst_in->sa_family == AF_INET) ?
381 (const void *)&dst_in4->sin_addr.s_addr :
382 (const void *)&dst_in6->sin6_addr;
383 sa_family_t family = dst_in->sa_family;
384
385 /* Gateway + ARPHRD_INFINIBAND -> IB router */
386 if (has_gateway(dst, family) && dst->dev->type == ARPHRD_INFINIBAND)
387 return ib_nl_fetch_ha(dst, dev_addr, daddr, seq, family);
388 else
389 return dst_fetch_ha(dst, dev_addr, daddr);
390}
391
Sean Hefty923c1002009-11-19 13:26:51 -0800392static int addr4_resolve(struct sockaddr_in *src_in,
Matan Barak20029832015-12-23 14:56:53 +0200393 const struct sockaddr_in *dst_in,
394 struct rdma_dev_addr *addr,
395 struct rtable **prt)
Sean Hefty7025fcd2006-06-17 20:37:28 -0700396{
Al Viro1b90c132008-03-29 03:10:28 +0000397 __be32 src_ip = src_in->sin_addr.s_addr;
398 __be32 dst_ip = dst_in->sin_addr.s_addr;
Sean Hefty7025fcd2006-06-17 20:37:28 -0700399 struct rtable *rt;
David S. Miller5fc35902011-05-09 14:52:02 -0700400 struct flowi4 fl4;
Sean Hefty7025fcd2006-06-17 20:37:28 -0700401 int ret;
402
David S. Miller5fc35902011-05-09 14:52:02 -0700403 memset(&fl4, 0, sizeof(fl4));
404 fl4.daddr = dst_ip;
405 fl4.saddr = src_ip;
406 fl4.flowi4_oif = addr->bound_dev_if;
Guy Shapiro565edd12015-10-22 15:20:08 +0300407 rt = ip_route_output_key(addr->net, &fl4);
Moni Shouacbd09ae2017-05-23 10:48:45 +0300408 ret = PTR_ERR_OR_ZERO(rt);
409 if (ret)
410 return ret;
411
Sean Hefty923c1002009-11-19 13:26:51 -0800412 src_in->sin_family = AF_INET;
David S. Miller5fc35902011-05-09 14:52:02 -0700413 src_in->sin_addr.s_addr = fl4.saddr;
Sean Hefty923c1002009-11-19 13:26:51 -0800414
Mark Blochae43f822016-05-19 17:12:36 +0300415 /* If there's a gateway and type of device not ARPHRD_INFINIBAND, we're
416 * definitely in RoCE v2 (as RoCE v1 isn't routable) set the network
417 * type accordingly.
Somnath Koturc865f242015-12-23 14:56:51 +0200418 */
Mark Blochae43f822016-05-19 17:12:36 +0300419 if (rt->rt_uses_gateway && rt->dst.dev->type != ARPHRD_INFINIBAND)
Somnath Koturc865f242015-12-23 14:56:51 +0200420 addr->network = RDMA_NETWORK_IPV4;
421
Matan Barakc3efe752016-01-04 10:49:54 +0200422 addr->hoplimit = ip4_dst_hoplimit(&rt->dst);
423
Matan Barak20029832015-12-23 14:56:53 +0200424 *prt = rt;
425 return 0;
Sean Hefty7025fcd2006-06-17 20:37:28 -0700426}
427
Roland Dreierd90f9b32012-07-05 22:39:34 -0700428#if IS_ENABLED(CONFIG_IPV6)
Sean Heftyd14714d2009-11-19 16:46:25 -0800429static int addr6_resolve(struct sockaddr_in6 *src_in,
Matan Barak20029832015-12-23 14:56:53 +0200430 const struct sockaddr_in6 *dst_in,
431 struct rdma_dev_addr *addr,
432 struct dst_entry **pdst)
Aleksey Senin38617c62008-12-24 10:16:37 -0800433{
David S. Miller4c9483b2011-03-12 16:22:43 -0500434 struct flowi6 fl6;
Aleksey Senin38617c62008-12-24 10:16:37 -0800435 struct dst_entry *dst;
Somnath Koturc865f242015-12-23 14:56:51 +0200436 struct rt6_info *rt;
Sean Heftyd14714d2009-11-19 16:46:25 -0800437 int ret;
Aleksey Senin38617c62008-12-24 10:16:37 -0800438
David S. Miller4c9483b2011-03-12 16:22:43 -0500439 memset(&fl6, 0, sizeof fl6);
Alexey Dobriyan4e3fd7a2011-11-21 03:39:03 +0000440 fl6.daddr = dst_in->sin6_addr;
441 fl6.saddr = src_in->sin6_addr;
David S. Miller4c9483b2011-03-12 16:22:43 -0500442 fl6.flowi6_oif = addr->bound_dev_if;
Aleksey Senin38617c62008-12-24 10:16:37 -0800443
Paolo Abenieea40b82017-04-28 11:20:01 +0200444 ret = ipv6_stub->ipv6_dst_lookup(addr->net, NULL, &dst, &fl6);
445 if (ret < 0)
Paolo Abeni24b43c92017-05-02 16:03:58 +0200446 return ret;
Aleksey Senin38617c62008-12-24 10:16:37 -0800447
Somnath Koturc865f242015-12-23 14:56:51 +0200448 rt = (struct rt6_info *)dst;
Roland Dreier79e25952017-06-06 09:22:00 -0700449 if (ipv6_addr_any(&src_in->sin6_addr)) {
Sean Heftyd14714d2009-11-19 16:46:25 -0800450 src_in->sin6_family = AF_INET6;
Alexey Dobriyan4e3fd7a2011-11-21 03:39:03 +0000451 src_in->sin6_addr = fl6.saddr;
Aleksey Senin38617c62008-12-24 10:16:37 -0800452 }
453
Mark Blochae43f822016-05-19 17:12:36 +0300454 /* If there's a gateway and type of device not ARPHRD_INFINIBAND, we're
455 * definitely in RoCE v2 (as RoCE v1 isn't routable) set the network
456 * type accordingly.
Somnath Koturc865f242015-12-23 14:56:51 +0200457 */
Mark Blochae43f822016-05-19 17:12:36 +0300458 if (rt->rt6i_flags & RTF_GATEWAY &&
459 ip6_dst_idev(dst)->dev->type != ARPHRD_INFINIBAND)
Somnath Koturc865f242015-12-23 14:56:51 +0200460 addr->network = RDMA_NETWORK_IPV6;
461
Matan Barakc3efe752016-01-04 10:49:54 +0200462 addr->hoplimit = ip6_dst_hoplimit(dst);
463
Matan Barak20029832015-12-23 14:56:53 +0200464 *pdst = dst;
465 return 0;
Aleksey Senin38617c62008-12-24 10:16:37 -0800466}
Roland Dreier2c4ab622008-12-29 23:37:14 -0800467#else
Sean Heftyd14714d2009-11-19 16:46:25 -0800468static int addr6_resolve(struct sockaddr_in6 *src_in,
Matan Barak20029832015-12-23 14:56:53 +0200469 const struct sockaddr_in6 *dst_in,
470 struct rdma_dev_addr *addr,
471 struct dst_entry **pdst)
Roland Dreier2c4ab622008-12-29 23:37:14 -0800472{
473 return -EADDRNOTAVAIL;
474}
475#endif
Aleksey Senin38617c62008-12-24 10:16:37 -0800476
Matan Barak20029832015-12-23 14:56:53 +0200477static int addr_resolve_neigh(struct dst_entry *dst,
478 const struct sockaddr *dst_in,
Mark Blochae43f822016-05-19 17:12:36 +0300479 struct rdma_dev_addr *addr,
480 u32 seq)
Aleksey Senin38617c62008-12-24 10:16:37 -0800481{
Matan Barak20029832015-12-23 14:56:53 +0200482 if (dst->dev->flags & IFF_LOOPBACK) {
483 int ret;
484
485 ret = rdma_translate_ip(dst_in, addr, NULL);
486 if (!ret)
487 memcpy(addr->dst_dev_addr, addr->src_dev_addr,
488 MAX_ADDR_LEN);
489
490 return ret;
491 }
492
493 /* If the device doesn't do ARP internally */
Mark Blochae43f822016-05-19 17:12:36 +0300494 if (!(dst->dev->flags & IFF_NOARP))
495 return fetch_ha(dst, addr, dst_in, seq);
Matan Barak20029832015-12-23 14:56:53 +0200496
497 return rdma_copy_addr(addr, dst->dev, NULL);
498}
499
500static int addr_resolve(struct sockaddr *src_in,
501 const struct sockaddr *dst_in,
502 struct rdma_dev_addr *addr,
Mark Blochae43f822016-05-19 17:12:36 +0300503 bool resolve_neigh,
504 u32 seq)
Matan Barak20029832015-12-23 14:56:53 +0200505{
506 struct net_device *ndev;
507 struct dst_entry *dst;
508 int ret;
509
Moni Shouabebb2a42017-05-23 10:48:44 +0300510 if (!addr->net) {
511 pr_warn_ratelimited("%s: missing namespace\n", __func__);
512 return -EINVAL;
513 }
514
Aleksey Senin38617c62008-12-24 10:16:37 -0800515 if (src_in->sa_family == AF_INET) {
Matan Barak20029832015-12-23 14:56:53 +0200516 struct rtable *rt = NULL;
517 const struct sockaddr_in *dst_in4 =
518 (const struct sockaddr_in *)dst_in;
519
520 ret = addr4_resolve((struct sockaddr_in *)src_in,
521 dst_in4, addr, &rt);
522 if (ret)
523 return ret;
524
525 if (resolve_neigh)
Mark Blochae43f822016-05-19 17:12:36 +0300526 ret = addr_resolve_neigh(&rt->dst, dst_in, addr, seq);
Matan Barak20029832015-12-23 14:56:53 +0200527
Moni Shouacbd09ae2017-05-23 10:48:45 +0300528 if (addr->bound_dev_if) {
529 ndev = dev_get_by_index(addr->net, addr->bound_dev_if);
530 } else {
531 ndev = rt->dst.dev;
532 dev_hold(ndev);
533 }
Matan Barak20029832015-12-23 14:56:53 +0200534
535 ip_rt_put(rt);
536 } else {
537 const struct sockaddr_in6 *dst_in6 =
538 (const struct sockaddr_in6 *)dst_in;
539
540 ret = addr6_resolve((struct sockaddr_in6 *)src_in,
541 dst_in6, addr,
542 &dst);
543 if (ret)
544 return ret;
545
546 if (resolve_neigh)
Mark Blochae43f822016-05-19 17:12:36 +0300547 ret = addr_resolve_neigh(dst, dst_in, addr, seq);
Matan Barak20029832015-12-23 14:56:53 +0200548
Moni Shouacbd09ae2017-05-23 10:48:45 +0300549 if (addr->bound_dev_if) {
550 ndev = dev_get_by_index(addr->net, addr->bound_dev_if);
551 } else {
552 ndev = dst->dev;
553 dev_hold(ndev);
554 }
Matan Barak20029832015-12-23 14:56:53 +0200555
556 dst_release(dst);
557 }
558
Moni Shouacbd09ae2017-05-23 10:48:45 +0300559 if (ndev->flags & IFF_LOOPBACK) {
560 ret = rdma_translate_ip(dst_in, addr, NULL);
561 /*
562 * Put the loopback device and get the translated
563 * device instead.
564 */
565 dev_put(ndev);
566 ndev = dev_get_by_index(addr->net, addr->bound_dev_if);
567 } else {
568 addr->bound_dev_if = ndev->ifindex;
569 }
Matan Barak20029832015-12-23 14:56:53 +0200570 dev_put(ndev);
571
572 return ret;
Aleksey Senin38617c62008-12-24 10:16:37 -0800573}
574
Parav Pandit5fff41e2017-08-01 09:41:34 +0300575static void process_one_req(struct work_struct *_work)
576{
577 struct addr_req *req;
578 struct sockaddr *src_in, *dst_in;
579
580 mutex_lock(&lock);
581 req = container_of(_work, struct addr_req, work.work);
582
583 if (req->status == -ENODATA) {
584 src_in = (struct sockaddr *)&req->src_addr;
585 dst_in = (struct sockaddr *)&req->dst_addr;
586 req->status = addr_resolve(src_in, dst_in, req->addr,
587 true, req->seq);
588 if (req->status && time_after_eq(jiffies, req->timeout)) {
589 req->status = -ETIMEDOUT;
590 } else if (req->status == -ENODATA) {
591 /* requeue the work for retrying again */
592 set_timeout(&req->work, req->timeout);
593 mutex_unlock(&lock);
594 return;
595 }
596 }
597 list_del(&req->list);
598 mutex_unlock(&lock);
599
600 req->callback(req->status, (struct sockaddr *)&req->src_addr,
601 req->addr, req->context);
602 put_client(req->client);
603 kfree(req);
604}
605
David Howellsc4028952006-11-22 14:57:56 +0000606static void process_req(struct work_struct *work)
Sean Hefty7025fcd2006-06-17 20:37:28 -0700607{
608 struct addr_req *req, *temp_req;
Aleksey Senin38617c62008-12-24 10:16:37 -0800609 struct sockaddr *src_in, *dst_in;
Sean Hefty7025fcd2006-06-17 20:37:28 -0700610 struct list_head done_list;
611
612 INIT_LIST_HEAD(&done_list);
613
614 mutex_lock(&lock);
615 list_for_each_entry_safe(req, temp_req, &req_list, list) {
Krishna Kumarc78bb842006-11-24 16:02:34 +0530616 if (req->status == -ENODATA) {
Aleksey Senin38617c62008-12-24 10:16:37 -0800617 src_in = (struct sockaddr *) &req->src_addr;
618 dst_in = (struct sockaddr *) &req->dst_addr;
Matan Barak20029832015-12-23 14:56:53 +0200619 req->status = addr_resolve(src_in, dst_in, req->addr,
Mark Blochae43f822016-05-19 17:12:36 +0300620 true, req->seq);
Krishna Kumarc78bb842006-11-24 16:02:34 +0530621 if (req->status && time_after_eq(jiffies, req->timeout))
622 req->status = -ETIMEDOUT;
Parav Pandit5fff41e2017-08-01 09:41:34 +0300623 else if (req->status == -ENODATA) {
624 set_timeout(&req->work, req->timeout);
Krishna Kumarc78bb842006-11-24 16:02:34 +0530625 continue;
Parav Pandit5fff41e2017-08-01 09:41:34 +0300626 }
Sean Hefty7025fcd2006-06-17 20:37:28 -0700627 }
Roland Dreier04699a12006-11-29 15:33:09 -0800628 list_move_tail(&req->list, &done_list);
Sean Hefty7025fcd2006-06-17 20:37:28 -0700629 }
630
Sean Hefty7025fcd2006-06-17 20:37:28 -0700631 mutex_unlock(&lock);
632
633 list_for_each_entry_safe(req, temp_req, &done_list, list) {
634 list_del(&req->list);
Parav Pandit5fff41e2017-08-01 09:41:34 +0300635 /* It is safe to cancel other work items from this work item
636 * because at a time there can be only one work item running
637 * with this single threaded work queue.
638 */
639 cancel_delayed_work(&req->work);
Aleksey Senin38617c62008-12-24 10:16:37 -0800640 req->callback(req->status, (struct sockaddr *) &req->src_addr,
641 req->addr, req->context);
Sean Hefty7a118df2006-10-31 11:12:59 -0800642 put_client(req->client);
Sean Hefty7025fcd2006-06-17 20:37:28 -0700643 kfree(req);
644 }
645}
646
Sean Hefty7a118df2006-10-31 11:12:59 -0800647int rdma_resolve_ip(struct rdma_addr_client *client,
648 struct sockaddr *src_addr, struct sockaddr *dst_addr,
Sean Hefty7025fcd2006-06-17 20:37:28 -0700649 struct rdma_dev_addr *addr, int timeout_ms,
650 void (*callback)(int status, struct sockaddr *src_addr,
651 struct rdma_dev_addr *addr, void *context),
652 void *context)
653{
Aleksey Senin38617c62008-12-24 10:16:37 -0800654 struct sockaddr *src_in, *dst_in;
Sean Hefty7025fcd2006-06-17 20:37:28 -0700655 struct addr_req *req;
656 int ret = 0;
657
Yoann Padioleaudd00cc42007-07-19 01:49:03 -0700658 req = kzalloc(sizeof *req, GFP_KERNEL);
Sean Hefty7025fcd2006-06-17 20:37:28 -0700659 if (!req)
660 return -ENOMEM;
Sean Hefty7025fcd2006-06-17 20:37:28 -0700661
Sean Heftyd2e08862009-11-19 12:55:22 -0800662 src_in = (struct sockaddr *) &req->src_addr;
663 dst_in = (struct sockaddr *) &req->dst_addr;
664
665 if (src_addr) {
666 if (src_addr->sa_family != dst_addr->sa_family) {
667 ret = -EINVAL;
668 goto err;
669 }
670
Sean Heftyef560862013-05-29 10:09:10 -0700671 memcpy(src_in, src_addr, rdma_addr_size(src_addr));
Sean Heftyd2e08862009-11-19 12:55:22 -0800672 } else {
673 src_in->sa_family = dst_addr->sa_family;
674 }
675
Sean Heftyef560862013-05-29 10:09:10 -0700676 memcpy(dst_in, dst_addr, rdma_addr_size(dst_addr));
Sean Hefty7025fcd2006-06-17 20:37:28 -0700677 req->addr = addr;
678 req->callback = callback;
679 req->context = context;
Sean Hefty7a118df2006-10-31 11:12:59 -0800680 req->client = client;
681 atomic_inc(&client->refcount);
Parav Pandit5fff41e2017-08-01 09:41:34 +0300682 INIT_DELAYED_WORK(&req->work, process_one_req);
Mark Blochae43f822016-05-19 17:12:36 +0300683 req->seq = (u32)atomic_inc_return(&ib_nl_addr_request_seq);
Sean Hefty7025fcd2006-06-17 20:37:28 -0700684
Mark Blochae43f822016-05-19 17:12:36 +0300685 req->status = addr_resolve(src_in, dst_in, addr, true, req->seq);
Sean Hefty7025fcd2006-06-17 20:37:28 -0700686 switch (req->status) {
687 case 0:
688 req->timeout = jiffies;
689 queue_req(req);
690 break;
691 case -ENODATA:
692 req->timeout = msecs_to_jiffies(timeout_ms) + jiffies;
693 queue_req(req);
Sean Hefty7025fcd2006-06-17 20:37:28 -0700694 break;
695 default:
696 ret = req->status;
Sean Hefty7a118df2006-10-31 11:12:59 -0800697 atomic_dec(&client->refcount);
Sean Heftyd2e08862009-11-19 12:55:22 -0800698 goto err;
Sean Hefty7025fcd2006-06-17 20:37:28 -0700699 }
700 return ret;
Sean Heftyd2e08862009-11-19 12:55:22 -0800701err:
702 kfree(req);
703 return ret;
Sean Hefty7025fcd2006-06-17 20:37:28 -0700704}
705EXPORT_SYMBOL(rdma_resolve_ip);
706
Matan Barak20029832015-12-23 14:56:53 +0200707int rdma_resolve_ip_route(struct sockaddr *src_addr,
708 const struct sockaddr *dst_addr,
709 struct rdma_dev_addr *addr)
710{
711 struct sockaddr_storage ssrc_addr = {};
712 struct sockaddr *src_in = (struct sockaddr *)&ssrc_addr;
713
Matan Barak95069022015-12-30 16:14:18 +0200714 if (src_addr) {
715 if (src_addr->sa_family != dst_addr->sa_family)
716 return -EINVAL;
Matan Barak20029832015-12-23 14:56:53 +0200717
Matan Barak20029832015-12-23 14:56:53 +0200718 memcpy(src_in, src_addr, rdma_addr_size(src_addr));
Matan Barak95069022015-12-30 16:14:18 +0200719 } else {
Matan Barak20029832015-12-23 14:56:53 +0200720 src_in->sa_family = dst_addr->sa_family;
Matan Barak95069022015-12-30 16:14:18 +0200721 }
Matan Barak20029832015-12-23 14:56:53 +0200722
Mark Blochae43f822016-05-19 17:12:36 +0300723 return addr_resolve(src_in, dst_addr, addr, false, 0);
Matan Barak20029832015-12-23 14:56:53 +0200724}
725EXPORT_SYMBOL(rdma_resolve_ip_route);
726
Sean Hefty7025fcd2006-06-17 20:37:28 -0700727void rdma_addr_cancel(struct rdma_dev_addr *addr)
728{
729 struct addr_req *req, *temp_req;
730
731 mutex_lock(&lock);
732 list_for_each_entry_safe(req, temp_req, &req_list, list) {
733 if (req->addr == addr) {
734 req->status = -ECANCELED;
735 req->timeout = jiffies;
Roland Dreier04699a12006-11-29 15:33:09 -0800736 list_move(&req->list, &req_list);
Parav Pandit5fff41e2017-08-01 09:41:34 +0300737 set_timeout(&req->work, req->timeout);
Sean Hefty7025fcd2006-06-17 20:37:28 -0700738 break;
739 }
740 }
741 mutex_unlock(&lock);
742}
743EXPORT_SYMBOL(rdma_addr_cancel);
744
Matan Barakdd5f03b2013-12-12 18:03:11 +0200745struct resolve_cb_context {
746 struct rdma_dev_addr *addr;
747 struct completion comp;
Mark Bloch61c370282016-10-27 16:36:29 +0300748 int status;
Matan Barakdd5f03b2013-12-12 18:03:11 +0200749};
750
751static void resolve_cb(int status, struct sockaddr *src_addr,
752 struct rdma_dev_addr *addr, void *context)
753{
Mark Bloch61c370282016-10-27 16:36:29 +0300754 if (!status)
755 memcpy(((struct resolve_cb_context *)context)->addr,
756 addr, sizeof(struct rdma_dev_addr));
757 ((struct resolve_cb_context *)context)->status = status;
Matan Barakdd5f03b2013-12-12 18:03:11 +0200758 complete(&((struct resolve_cb_context *)context)->comp);
759}
760
Matan Barakf7f4b23e2016-01-04 10:49:53 +0200761int rdma_addr_find_l2_eth_by_grh(const union ib_gid *sgid,
762 const union ib_gid *dgid,
Matan Barakc3efe752016-01-04 10:49:54 +0200763 u8 *dmac, u16 *vlan_id, int *if_index,
764 int *hoplimit)
Matan Barakdd5f03b2013-12-12 18:03:11 +0200765{
766 int ret = 0;
767 struct rdma_dev_addr dev_addr;
768 struct resolve_cb_context ctx;
769 struct net_device *dev;
770
771 union {
772 struct sockaddr _sockaddr;
773 struct sockaddr_in _sockaddr_in;
774 struct sockaddr_in6 _sockaddr_in6;
775 } sgid_addr, dgid_addr;
776
777
Honggang LI471e7052015-04-29 17:40:44 +0800778 rdma_gid2ip(&sgid_addr._sockaddr, sgid);
779 rdma_gid2ip(&dgid_addr._sockaddr, dgid);
Matan Barakdd5f03b2013-12-12 18:03:11 +0200780
781 memset(&dev_addr, 0, sizeof(dev_addr));
Matan Barak20029832015-12-23 14:56:53 +0200782 if (if_index)
783 dev_addr.bound_dev_if = *if_index;
Guy Shapiro565edd12015-10-22 15:20:08 +0300784 dev_addr.net = &init_net;
Matan Barakdd5f03b2013-12-12 18:03:11 +0200785
786 ctx.addr = &dev_addr;
787 init_completion(&ctx.comp);
788 ret = rdma_resolve_ip(&self, &sgid_addr._sockaddr, &dgid_addr._sockaddr,
789 &dev_addr, 1000, resolve_cb, &ctx);
790 if (ret)
791 return ret;
792
793 wait_for_completion(&ctx.comp);
794
Mark Bloch61c370282016-10-27 16:36:29 +0300795 ret = ctx.status;
796 if (ret)
797 return ret;
798
Matan Barakdd5f03b2013-12-12 18:03:11 +0200799 memcpy(dmac, dev_addr.dst_dev_addr, ETH_ALEN);
800 dev = dev_get_by_index(&init_net, dev_addr.bound_dev_if);
801 if (!dev)
802 return -ENODEV;
Matan Barak20029832015-12-23 14:56:53 +0200803 if (if_index)
804 *if_index = dev_addr.bound_dev_if;
Matan Barakdd5f03b2013-12-12 18:03:11 +0200805 if (vlan_id)
806 *vlan_id = rdma_vlan_dev_vlan_id(dev);
Matan Barakc3efe752016-01-04 10:49:54 +0200807 if (hoplimit)
808 *hoplimit = dev_addr.hoplimit;
Matan Barakdd5f03b2013-12-12 18:03:11 +0200809 dev_put(dev);
810 return ret;
811}
Matan Barakf7f4b23e2016-01-04 10:49:53 +0200812EXPORT_SYMBOL(rdma_addr_find_l2_eth_by_grh);
Matan Barakdd5f03b2013-12-12 18:03:11 +0200813
814int rdma_addr_find_smac_by_sgid(union ib_gid *sgid, u8 *smac, u16 *vlan_id)
815{
816 int ret = 0;
817 struct rdma_dev_addr dev_addr;
818 union {
819 struct sockaddr _sockaddr;
820 struct sockaddr_in _sockaddr_in;
821 struct sockaddr_in6 _sockaddr_in6;
822 } gid_addr;
823
Honggang LI471e7052015-04-29 17:40:44 +0800824 rdma_gid2ip(&gid_addr._sockaddr, sgid);
Matan Barakdd5f03b2013-12-12 18:03:11 +0200825
Matan Barakdd5f03b2013-12-12 18:03:11 +0200826 memset(&dev_addr, 0, sizeof(dev_addr));
Guy Shapiro565edd12015-10-22 15:20:08 +0300827 dev_addr.net = &init_net;
Matan Barakdd5f03b2013-12-12 18:03:11 +0200828 ret = rdma_translate_ip(&gid_addr._sockaddr, &dev_addr, vlan_id);
829 if (ret)
830 return ret;
831
832 memcpy(smac, dev_addr.src_dev_addr, ETH_ALEN);
833 return ret;
834}
835EXPORT_SYMBOL(rdma_addr_find_smac_by_sgid);
836
Roland Dreier3cd96562006-09-22 15:22:46 -0700837static int netevent_callback(struct notifier_block *self, unsigned long event,
Tom Tuckere795d092006-07-30 20:44:19 -0700838 void *ctx)
Sean Hefty7025fcd2006-06-17 20:37:28 -0700839{
Roland Dreier3cd96562006-09-22 15:22:46 -0700840 if (event == NETEVENT_NEIGH_UPDATE) {
Tom Tuckere795d092006-07-30 20:44:19 -0700841 struct neighbour *neigh = ctx;
Sean Hefty7025fcd2006-06-17 20:37:28 -0700842
Parav Pandit5fff41e2017-08-01 09:41:34 +0300843 if (neigh->nud_state & NUD_VALID)
844 set_timeout(&work, jiffies);
Tom Tuckere795d092006-07-30 20:44:19 -0700845 }
Sean Hefty7025fcd2006-06-17 20:37:28 -0700846 return 0;
847}
848
Tom Tuckere795d092006-07-30 20:44:19 -0700849static struct notifier_block nb = {
850 .notifier_call = netevent_callback
Sean Hefty7025fcd2006-06-17 20:37:28 -0700851};
852
Leon Romanovskye3f20f02016-05-19 17:12:31 +0300853int addr_init(void)
Sean Hefty7025fcd2006-06-17 20:37:28 -0700854{
Parav Pandit5fff41e2017-08-01 09:41:34 +0300855 addr_wq = alloc_ordered_workqueue("ib_addr", WQ_MEM_RECLAIM);
Sean Hefty7025fcd2006-06-17 20:37:28 -0700856 if (!addr_wq)
857 return -ENOMEM;
858
Tom Tuckere795d092006-07-30 20:44:19 -0700859 register_netevent_notifier(&nb);
Matan Barakdd5f03b2013-12-12 18:03:11 +0200860 rdma_addr_register_client(&self);
Mark Blochae43f822016-05-19 17:12:36 +0300861
Sean Hefty7025fcd2006-06-17 20:37:28 -0700862 return 0;
863}
864
Leon Romanovskye3f20f02016-05-19 17:12:31 +0300865void addr_cleanup(void)
Sean Hefty7025fcd2006-06-17 20:37:28 -0700866{
Matan Barakdd5f03b2013-12-12 18:03:11 +0200867 rdma_addr_unregister_client(&self);
Tom Tuckere795d092006-07-30 20:44:19 -0700868 unregister_netevent_notifier(&nb);
Sean Hefty7025fcd2006-06-17 20:37:28 -0700869 destroy_workqueue(addr_wq);
870}