diff options
author | Stephen Hemminger <shemminger@vyatta.com> | 2009-03-21 16:39:26 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-03-21 16:39:26 -0400 |
commit | 9247744e5eaa29aecee5342a0c8694187a6aadcd (patch) | |
tree | 74ccf6e63f2a8192502f432376b1f68136ace8b1 | |
parent | 1f1900f935e810d01c716fa2aaf8c9d25caa4151 (diff) |
skb: expose and constify hash primitives
Some minor changes to queue hashing:
1. Use const on accessor functions
2. Export skb_tx_hash for use in drivers (see ixgbe)
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/linux/skbuff.h | 9 | ||||
-rw-r--r-- | net/core/dev.c | 3 |
2 files changed, 8 insertions, 4 deletions
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 1fbab2ae613c..bb1981fd60f3 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -1969,7 +1969,7 @@ static inline void skb_set_queue_mapping(struct sk_buff *skb, u16 queue_mapping) | |||
1969 | skb->queue_mapping = queue_mapping; | 1969 | skb->queue_mapping = queue_mapping; |
1970 | } | 1970 | } |
1971 | 1971 | ||
1972 | static inline u16 skb_get_queue_mapping(struct sk_buff *skb) | 1972 | static inline u16 skb_get_queue_mapping(const struct sk_buff *skb) |
1973 | { | 1973 | { |
1974 | return skb->queue_mapping; | 1974 | return skb->queue_mapping; |
1975 | } | 1975 | } |
@@ -1984,16 +1984,19 @@ static inline void skb_record_rx_queue(struct sk_buff *skb, u16 rx_queue) | |||
1984 | skb->queue_mapping = rx_queue + 1; | 1984 | skb->queue_mapping = rx_queue + 1; |
1985 | } | 1985 | } |
1986 | 1986 | ||
1987 | static inline u16 skb_get_rx_queue(struct sk_buff *skb) | 1987 | static inline u16 skb_get_rx_queue(const struct sk_buff *skb) |
1988 | { | 1988 | { |
1989 | return skb->queue_mapping - 1; | 1989 | return skb->queue_mapping - 1; |
1990 | } | 1990 | } |
1991 | 1991 | ||
1992 | static inline bool skb_rx_queue_recorded(struct sk_buff *skb) | 1992 | static inline bool skb_rx_queue_recorded(const struct sk_buff *skb) |
1993 | { | 1993 | { |
1994 | return (skb->queue_mapping != 0); | 1994 | return (skb->queue_mapping != 0); |
1995 | } | 1995 | } |
1996 | 1996 | ||
1997 | extern u16 skb_tx_hash(const struct net_device *dev, | ||
1998 | const struct sk_buff *skb); | ||
1999 | |||
1997 | #ifdef CONFIG_XFRM | 2000 | #ifdef CONFIG_XFRM |
1998 | static inline struct sec_path *skb_sec_path(struct sk_buff *skb) | 2001 | static inline struct sec_path *skb_sec_path(struct sk_buff *skb) |
1999 | { | 2002 | { |
diff --git a/net/core/dev.c b/net/core/dev.c index ca212acd3348..fdb9973b82a6 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -1725,7 +1725,7 @@ out_kfree_skb: | |||
1725 | 1725 | ||
1726 | static u32 skb_tx_hashrnd; | 1726 | static u32 skb_tx_hashrnd; |
1727 | 1727 | ||
1728 | static u16 skb_tx_hash(struct net_device *dev, struct sk_buff *skb) | 1728 | u16 skb_tx_hash(const struct net_device *dev, const struct sk_buff *skb) |
1729 | { | 1729 | { |
1730 | u32 hash; | 1730 | u32 hash; |
1731 | 1731 | ||
@@ -1740,6 +1740,7 @@ static u16 skb_tx_hash(struct net_device *dev, struct sk_buff *skb) | |||
1740 | 1740 | ||
1741 | return (u16) (((u64) hash * dev->real_num_tx_queues) >> 32); | 1741 | return (u16) (((u64) hash * dev->real_num_tx_queues) >> 32); |
1742 | } | 1742 | } |
1743 | EXPORT_SYMBOL(skb_tx_hash); | ||
1743 | 1744 | ||
1744 | static struct netdev_queue *dev_pick_tx(struct net_device *dev, | 1745 | static struct netdev_queue *dev_pick_tx(struct net_device *dev, |
1745 | struct sk_buff *skb) | 1746 | struct sk_buff *skb) |