-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
xfrm: Move device notifications to a sepatate file
This is needed for the upcomming IPsec device offloading. Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
- Loading branch information
Steffen Klassert
committed
Apr 14, 2017
1 parent
9d389d7
commit 21f42cc
Showing
4 changed files
with
46 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* xfrm_device.c - IPsec device offloading code. | ||
* | ||
* Copyright (c) 2015 secunet Security Networks AG | ||
* | ||
* Author: | ||
* Steffen Klassert <steffen.klassert@secunet.com> | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License | ||
* as published by the Free Software Foundation; either version | ||
* 2 of the License, or (at your option) any later version. | ||
*/ | ||
|
||
#include <linux/errno.h> | ||
#include <linux/module.h> | ||
#include <linux/netdevice.h> | ||
#include <linux/skbuff.h> | ||
#include <linux/slab.h> | ||
#include <linux/spinlock.h> | ||
#include <net/dst.h> | ||
#include <net/xfrm.h> | ||
#include <linux/notifier.h> | ||
|
||
static int xfrm_dev_event(struct notifier_block *this, unsigned long event, void *ptr) | ||
{ | ||
struct net_device *dev = netdev_notifier_info_to_dev(ptr); | ||
|
||
switch (event) { | ||
case NETDEV_DOWN: | ||
xfrm_garbage_collect(dev_net(dev)); | ||
} | ||
return NOTIFY_DONE; | ||
} | ||
|
||
static struct notifier_block xfrm_dev_notifier = { | ||
.notifier_call = xfrm_dev_event, | ||
}; | ||
|
||
void __net_init xfrm_dev_init(void) | ||
{ | ||
register_netdevice_notifier(&xfrm_dev_notifier); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters