Commit a6a1faca authored by Christoph Hellwig's avatar Christoph Hellwig Committed by David S. Miller

[NET]: Clean up the divert ifdef mess.

parent 12a7f674
...@@ -131,26 +131,20 @@ static int __init probe_list(struct net_device *dev, struct devprobe *plist) ...@@ -131,26 +131,20 @@ static int __init probe_list(struct net_device *dev, struct devprobe *plist)
{ {
struct devprobe *p = plist; struct devprobe *p = plist;
unsigned long base_addr = dev->base_addr; unsigned long base_addr = dev->base_addr;
#ifdef CONFIG_NET_DIVERT
int ret; int ret;
#endif /* CONFIG_NET_DIVERT */
while (p->probe != NULL) { while (p->probe != NULL) {
if (base_addr && p->probe(dev) == 0) { /* probe given addr */ if (base_addr && p->probe(dev) == 0) { /* probe given addr */
#ifdef CONFIG_NET_DIVERT
ret = alloc_divert_blk(dev); ret = alloc_divert_blk(dev);
if (ret) if (ret)
return ret; return ret;
#endif /* CONFIG_NET_DIVERT */
return 0; return 0;
} else if (p->status == 0) { /* has autoprobe failed yet? */ } else if (p->status == 0) { /* has autoprobe failed yet? */
p->status = p->probe(dev); /* no, try autoprobe */ p->status = p->probe(dev); /* no, try autoprobe */
if (p->status == 0) { if (p->status == 0) {
#ifdef CONFIG_NET_DIVERT
ret = alloc_divert_blk(dev); ret = alloc_divert_blk(dev);
if (ret) if (ret)
return ret; return ret;
#endif /* CONFIG_NET_DIVERT */
return 0; return 0;
} }
} }
......
...@@ -107,11 +107,24 @@ struct divert_cf ...@@ -107,11 +107,24 @@ struct divert_cf
/* diverter functions */ /* diverter functions */
#include <linux/skbuff.h> #include <linux/skbuff.h>
#ifdef CONFIG_NET_DIVERT
int alloc_divert_blk(struct net_device *); int alloc_divert_blk(struct net_device *);
void free_divert_blk(struct net_device *); void free_divert_blk(struct net_device *);
int divert_ioctl(unsigned int cmd, struct divert_cf *arg); int divert_ioctl(unsigned int cmd, struct divert_cf *arg);
void divert_frame(struct sk_buff *skb); void divert_frame(struct sk_buff *skb);
static inline void handle_diverter(struct sk_buff *skb)
{
/* if diversion is supported on device, then divert */
if (skb->dev->divert && skb->dev->divert->divert)
divert_frame(skb);
}
#else
# define alloc_divert_blk(dev) (0)
# define free_divert_blk(dev) do {} while (0)
# define divert_ioctl(cmd, arg) (-ENOPKG)
# define handle_diverter(skb) do {} while (0)
#endif
#endif #endif
#endif /* _LINUX_DIVERT_H */ #endif /* _LINUX_DIVERT_H */
...@@ -1465,15 +1465,6 @@ static __inline__ int handle_bridge(struct sk_buff *skb, ...@@ -1465,15 +1465,6 @@ static __inline__ int handle_bridge(struct sk_buff *skb,
#endif #endif
static inline void handle_diverter(struct sk_buff *skb)
{
#ifdef CONFIG_NET_DIVERT
/* if diversion is supported on device, then divert */
if (skb->dev->divert && skb->dev->divert->divert)
divert_frame(skb);
#endif
}
static inline int __handle_bridge(struct sk_buff *skb, static inline int __handle_bridge(struct sk_buff *skb,
struct packet_type **pt_prev, int *ret) struct packet_type **pt_prev, int *ret)
{ {
...@@ -2568,11 +2559,9 @@ int register_netdevice(struct net_device *dev) ...@@ -2568,11 +2559,9 @@ int register_netdevice(struct net_device *dev)
dev->fastpath_lock = RW_LOCK_UNLOCKED; dev->fastpath_lock = RW_LOCK_UNLOCKED;
#endif #endif
#ifdef CONFIG_NET_DIVERT
ret = alloc_divert_blk(dev); ret = alloc_divert_blk(dev);
if (ret) if (ret)
goto out; goto out;
#endif /* CONFIG_NET_DIVERT */
dev->iflink = -1; dev->iflink = -1;
...@@ -2638,9 +2627,7 @@ int register_netdevice(struct net_device *dev) ...@@ -2638,9 +2627,7 @@ int register_netdevice(struct net_device *dev)
out: out:
return ret; return ret;
out_err: out_err:
#ifdef CONFIG_NET_DIVERT
free_divert_blk(dev); free_divert_blk(dev);
#endif
goto out; goto out;
} }
...@@ -2845,9 +2832,7 @@ int unregister_netdevice(struct net_device *dev) ...@@ -2845,9 +2832,7 @@ int unregister_netdevice(struct net_device *dev)
/* Notifier chain MUST detach us from master device. */ /* Notifier chain MUST detach us from master device. */
BUG_TRAP(!dev->master); BUG_TRAP(!dev->master);
#ifdef CONFIG_NET_DIVERT
free_divert_blk(dev); free_divert_blk(dev);
#endif
kobject_unregister(&dev->kobj); kobject_unregister(&dev->kobj);
......
...@@ -821,11 +821,7 @@ static int sock_ioctl(struct inode *inode, struct file *file, unsigned int cmd, ...@@ -821,11 +821,7 @@ static int sock_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
case SIOCGIFDIVERT: case SIOCGIFDIVERT:
case SIOCSIFDIVERT: case SIOCSIFDIVERT:
/* Convert this to call through a hook */ /* Convert this to call through a hook */
#ifdef CONFIG_NET_DIVERT
err = divert_ioctl(cmd, (struct divert_cf *)arg); err = divert_ioctl(cmd, (struct divert_cf *)arg);
#else
err = -ENOPKG;
#endif /* CONFIG_NET_DIVERT */
break; break;
case SIOCADDDLCI: case SIOCADDDLCI:
case SIOCDELDLCI: case SIOCDELDLCI:
......
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