addr.c (271127) | addr.c (273246) |
---|---|
1/* 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 * 7 * 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 --- 21 unchanged lines hidden (view full) --- 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. 34 */ 35 36#include <linux/mutex.h> 37#include <linux/inetdevice.h> | 1/* 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 * 7 * 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 --- 21 unchanged lines hidden (view full) --- 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. 34 */ 35 36#include <linux/mutex.h> 37#include <linux/inetdevice.h> |
38#include <linux/slab.h> |
|
38#include <linux/workqueue.h> | 39#include <linux/workqueue.h> |
40#include <linux/module.h> 41#include <linux/notifier.h> |
|
39#include <net/route.h> 40#include <net/netevent.h> 41#include <rdma/ib_addr.h> | 42#include <net/route.h> 43#include <net/netevent.h> 44#include <rdma/ib_addr.h> |
45#include <netinet/if_ether.h> |
|
42 | 46 |
47 |
|
43MODULE_AUTHOR("Sean Hefty"); 44MODULE_DESCRIPTION("IB Address Translation"); 45MODULE_LICENSE("Dual BSD/GPL"); 46 47struct addr_req { 48 struct list_head list; 49 struct sockaddr_storage src_addr; 50 struct sockaddr_storage dst_addr; --- 133 unchanged lines hidden (view full) --- 184 return ret; 185} 186EXPORT_SYMBOL(rdma_translate_ip); 187 188static void set_timeout(unsigned long time) 189{ 190 unsigned long delay; 191 | 48MODULE_AUTHOR("Sean Hefty"); 49MODULE_DESCRIPTION("IB Address Translation"); 50MODULE_LICENSE("Dual BSD/GPL"); 51 52struct addr_req { 53 struct list_head list; 54 struct sockaddr_storage src_addr; 55 struct sockaddr_storage dst_addr; --- 133 unchanged lines hidden (view full) --- 189 return ret; 190} 191EXPORT_SYMBOL(rdma_translate_ip); 192 193static void set_timeout(unsigned long time) 194{ 195 unsigned long delay; 196 |
192 cancel_delayed_work(&work); 193 | |
194 delay = time - jiffies; 195 if ((long)delay <= 0) 196 delay = 1; 197 | 197 delay = time - jiffies; 198 if ((long)delay <= 0) 199 delay = 1; 200 |
198 queue_delayed_work(addr_wq, &work, delay); | 201 mod_delayed_work(addr_wq, &work, delay); |
199} 200 201static void queue_req(struct addr_req *req) 202{ 203 struct addr_req *temp_req; 204 205 mutex_lock(&lock); 206 list_for_each_entry_reverse(temp_req, &req_list, list) { --- 408 unchanged lines hidden (view full) --- 615 } 616 return 0; 617} 618 619static struct notifier_block nb = { 620 .notifier_call = netevent_callback 621}; 622 | 202} 203 204static void queue_req(struct addr_req *req) 205{ 206 struct addr_req *temp_req; 207 208 mutex_lock(&lock); 209 list_for_each_entry_reverse(temp_req, &req_list, list) { --- 408 unchanged lines hidden (view full) --- 618 } 619 return 0; 620} 621 622static struct notifier_block nb = { 623 .notifier_call = netevent_callback 624}; 625 |
623static int addr_init(void) | 626static int __init addr_init(void) |
624{ 625 INIT_DELAYED_WORK(&work, process_req); 626 addr_wq = create_singlethread_workqueue("ib_addr"); 627 if (!addr_wq) 628 return -ENOMEM; 629 630 register_netevent_notifier(&nb); 631 return 0; 632} 633 | 627{ 628 INIT_DELAYED_WORK(&work, process_req); 629 addr_wq = create_singlethread_workqueue("ib_addr"); 630 if (!addr_wq) 631 return -ENOMEM; 632 633 register_netevent_notifier(&nb); 634 return 0; 635} 636 |
634static void addr_cleanup(void) | 637static void __exit addr_cleanup(void) |
635{ 636 unregister_netevent_notifier(&nb); 637 destroy_workqueue(addr_wq); 638} 639 640module_init(addr_init); 641module_exit(addr_cleanup); | 638{ 639 unregister_netevent_notifier(&nb); 640 destroy_workqueue(addr_wq); 641} 642 643module_init(addr_init); 644module_exit(addr_cleanup); |