aboutsummaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@osdl.org>2007-03-21 16:38:47 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-04-26 01:28:44 -0400
commit6229e362dd49b9e8387126bd4483ab0574d23e9c (patch)
tree425c24858a6d21e58e49c05655875237d9b37a7c /net/core
parent604763722c655c7e3f31ecf6f7b4dafcd26a7a15 (diff)
bridge: eliminate call by reference
Change the bridging hook to be simple function with return value rather than modifying the skb argument. This could generate better code and is cleaner. Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/dev.c31
1 files changed, 19 insertions, 12 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index d23972f56fc7..7f31d0f88424 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1687,31 +1687,37 @@ static inline int deliver_skb(struct sk_buff *skb,
1687} 1687}
1688 1688
1689#if defined(CONFIG_BRIDGE) || defined (CONFIG_BRIDGE_MODULE) 1689#if defined(CONFIG_BRIDGE) || defined (CONFIG_BRIDGE_MODULE)
1690int (*br_handle_frame_hook)(struct net_bridge_port *p, struct sk_buff **pskb); 1690/* These hooks defined here for ATM */
1691struct net_bridge; 1691struct net_bridge;
1692struct net_bridge_fdb_entry *(*br_fdb_get_hook)(struct net_bridge *br, 1692struct net_bridge_fdb_entry *(*br_fdb_get_hook)(struct net_bridge *br,
1693 unsigned char *addr); 1693 unsigned char *addr);
1694void (*br_fdb_put_hook)(struct net_bridge_fdb_entry *ent); 1694void (*br_fdb_put_hook)(struct net_bridge_fdb_entry *ent) __read_mostly;
1695 1695
1696static __inline__ int handle_bridge(struct sk_buff **pskb, 1696/*
1697 struct packet_type **pt_prev, int *ret, 1697 * If bridge module is loaded call bridging hook.
1698 struct net_device *orig_dev) 1698 * returns NULL if packet was consumed.
1699 */
1700struct sk_buff *(*br_handle_frame_hook)(struct net_bridge_port *p,
1701 struct sk_buff *skb) __read_mostly;
1702static inline struct sk_buff *handle_bridge(struct sk_buff *skb,
1703 struct packet_type **pt_prev, int *ret,
1704 struct net_device *orig_dev)
1699{ 1705{
1700 struct net_bridge_port *port; 1706 struct net_bridge_port *port;
1701 1707
1702 if ((*pskb)->pkt_type == PACKET_LOOPBACK || 1708 if (skb->pkt_type == PACKET_LOOPBACK ||
1703 (port = rcu_dereference((*pskb)->dev->br_port)) == NULL) 1709 (port = rcu_dereference(skb->dev->br_port)) == NULL)
1704 return 0; 1710 return skb;
1705 1711
1706 if (*pt_prev) { 1712 if (*pt_prev) {
1707 *ret = deliver_skb(*pskb, *pt_prev, orig_dev); 1713 *ret = deliver_skb(skb, *pt_prev, orig_dev);
1708 *pt_prev = NULL; 1714 *pt_prev = NULL;
1709 } 1715 }
1710 1716
1711 return br_handle_frame_hook(port, pskb); 1717 return br_handle_frame_hook(port, skb);
1712} 1718}
1713#else 1719#else
1714#define handle_bridge(skb, pt_prev, ret, orig_dev) (0) 1720#define handle_bridge(skb, pt_prev, ret, orig_dev) (skb)
1715#endif 1721#endif
1716 1722
1717#ifdef CONFIG_NET_CLS_ACT 1723#ifdef CONFIG_NET_CLS_ACT
@@ -1818,7 +1824,8 @@ int netif_receive_skb(struct sk_buff *skb)
1818ncls: 1824ncls:
1819#endif 1825#endif
1820 1826
1821 if (handle_bridge(&skb, &pt_prev, &ret, orig_dev)) 1827 skb = handle_bridge(skb, &pt_prev, &ret, orig_dev);
1828 if (!skb)
1822 goto out; 1829 goto out;
1823 1830
1824 type = skb->protocol; 1831 type = skb->protocol;